Skip to content

Commit

Permalink
Remove unnecessary conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
niranjanyardi committed Jan 10, 2025
1 parent 3ee475b commit bb1178d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import("//build_overrides/build.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")

if (is_cobalt && is_starboard) {
if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

Expand Down
8 changes: 4 additions & 4 deletions base/allocator/partition_allocator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import("//build/config/chromeos/ui_mode.gni")
import("//build/config/dcheck_always_on.gni")
import("//build/config/logging.gni")

if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

# Add partition_alloc.gni and import it for partition_alloc configs.

config("partition_alloc_implementation") {
Expand Down Expand Up @@ -230,10 +234,7 @@ component("partition_alloc") {

# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
sources -= [ "partition_alloc_base/rand_util_posix.cc" ]
}
}

if (is_android || is_chromeos_ash) {
Expand Down Expand Up @@ -330,7 +331,6 @@ component("partition_alloc") {
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
deps += [ "//starboard:starboard_group" ]
}
Expand Down
6 changes: 4 additions & 2 deletions build/config/c++/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import("//build/config/compiler/compiler.gni")
import("//build/config/dcheck_always_on.gni")
import("//buildtools/deps_revisions.gni")

if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

assert(use_custom_libcxx, "should only be used if use_custom_libcxx is set")

# This is included by reference in the //build/config/compiler:runtime_library
Expand Down Expand Up @@ -69,7 +73,6 @@ config("runtime_library") {
"-isystem" + rebase_path("$libcxxabi_prefix/include", root_build_dir),
]
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
cflags_cc += [
"-isystem" +
Expand Down Expand Up @@ -110,7 +113,6 @@ config("runtime_library") {
"rt",
]
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
libs -= [
"c",
Expand Down
22 changes: 11 additions & 11 deletions buildtools/third_party/libc++/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import("//build/config/c++/c++.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/toolchain/toolchain.gni")

if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

# Used by libc++ and libc++abi.
config("config") {
cflags = [ "-fstrict-aliasing" ]
Expand Down Expand Up @@ -55,7 +59,6 @@ target(_libcxx_target_type, "libc++") {
"//third_party/catapult/devil:devil",
]
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
visibility += [ "//starboard:starboard_group" ]
}
Expand Down Expand Up @@ -123,7 +126,6 @@ target(_libcxx_target_type, "libc++") {
]

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
# TODO: b/384652502 - Cobalt: Fix compiler errors building hermetically.
sources -= [ "trunk/src/atomic.cpp" ]
Expand Down Expand Up @@ -225,14 +227,12 @@ target(_libcxx_target_type, "libc++") {
deps = [ "//buildtools/third_party/libc++abi" ]
}
}
if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
if (is_starboard && current_toolchain == cobalt_toolchain &&
use_custom_libc) {
deps += [
"//third_party/llvm-project/compiler-rt:compiler_rt",
"//third_party/musl:c",
]
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain &&
use_custom_libc) {
deps += [
"//third_party/llvm-project/compiler-rt:compiler_rt",
"//third_party/musl:c",
]
}
}
12 changes: 6 additions & 6 deletions buildtools/third_party/libc++abi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# found in the LICENSE file.

import("//build/config/c++/c++.gni")
if (is_cobalt) {
import("//cobalt/build/configs/modular_variables.gni")
}

source_set("libc++abi") {
if (export_libcxxabi_from_executables) {
Expand All @@ -14,7 +17,6 @@ source_set("libc++abi") {
visibility = [ "//buildtools/third_party/libc++" ]
}
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
visibility += [ "//starboard:starboard_group" ]
}
Expand All @@ -27,11 +29,9 @@ source_set("libc++abi") {
deps = [ "//buildtools/third_party/libunwind" ]
}

if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain) {
import("//cobalt/build/configs/modular_variables.gni")
if (use_custom_libc) {
deps = [ "//third_party/musl:c" ]
}
if (is_cobalt && is_starboard && current_toolchain == cobalt_toolchain &&
use_custom_libc) {
deps = [ "//third_party/musl:c" ]
}

sources = [
Expand Down
3 changes: 2 additions & 1 deletion starboard/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import("//starboard/build/config/os_definitions.gni")
import("//starboard/build/config/starboard_target_type.gni")
import("//starboard/contrib/cast/cast.gni")
import("//cobalt/build/configs/modular_variables.gni")

if (!is_cobalt) {
group("gn_all") {
Expand Down Expand Up @@ -175,7 +176,7 @@ if (!is_cobalt) {
"//starboard/client_porting/eztime",
]

if (sb_is_modular && current_toolchain == cobalt_toolchain) {
if (sb_is_modular && use_custom_libc && current_toolchain == cobalt_toolchain) {
public_deps += [
"//buildtools/third_party/libc++",
"//buildtools/third_party/libc++abi",
Expand Down

0 comments on commit bb1178d

Please sign in to comment.