Skip to content

Commit

Permalink
Create one location to set the C++ standard flag
Browse files Browse the repository at this point in the history
Will make updating the flag value a small change going forward.  In the
future we should standarize the `copts` values across our builds so the
flags/warnings/errors all stay consistent, but this commit is only to
swap to using the variable and not to make changes.

Decided to not update `libbase` or `libsparse` since that code is a copy
and I do not believe the team has any intention of making updates to it.

Bug: 388011569
  • Loading branch information
cjreynol committed Jan 30, 2025
1 parent aca9557 commit 8c73b4a
Show file tree
Hide file tree
Showing 22 changed files with 73 additions and 95 deletions.
5 changes: 3 additions & 2 deletions base/cvd/allocd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -16,14 +18,13 @@ cc_binary(
"utils.cpp",
"utils.h",
],
copts = [
copts = COPTS + [
"-Wno-reorder",
"-Wno-unknown-pragmas",
"-Wno-attributes",
"-Wno-sign-compare",
"-Wno-write-strings",
"-DNODISCARD_EXPECTED=true",
"-std=c++17",
],
includes = [""],
deps = [
Expand Down
3 changes: 3 additions & 0 deletions base/cvd/build_variables.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
COPTS = [
"-std=c++17"
]
10 changes: 4 additions & 6 deletions base/cvd/cuttlefish/common/libs/fs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -17,9 +19,7 @@ cc_library(
"shared_fd_stream.h",
"shared_select.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils:result",
Expand All @@ -33,9 +33,7 @@ cc_test(
srcs = [
"shared_fd_test.cpp",
],
copts = [
"-std=c++17",
],
copts = COPTS,
includes = [""],
deps = [
":fs",
Expand Down
22 changes: 7 additions & 15 deletions base/cvd/cuttlefish/common/libs/utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -10,9 +12,7 @@ cc_library(
hdrs = [
"result.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
"//libbase",
Expand All @@ -26,9 +26,7 @@ cc_library(
hdrs = [
"result_matchers.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
":result",
Expand Down Expand Up @@ -79,9 +77,7 @@ cc_library(
"unix_sockets.h",
"users.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
":result",
Expand All @@ -101,10 +97,7 @@ cc_test(
srcs = [
"result_test.cpp",
],
copts = [
"-std=c++17",
"-Icuttlefish",
],
copts = COPTS + [ "-Icuttlefish" ],
deps = [
":result",
":result_matchers",
Expand All @@ -127,9 +120,8 @@ cc_test(
"unique_resource_allocator_test.h",
"unix_sockets_test.cpp",
],
copts = [
copts = COPTS + [
"-Wno-ctad-maybe-unsupported",
"-std=c++17",
"-Icuttlefish",
],
deps = [
Expand Down
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/assemble_cvd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -7,10 +9,7 @@ cc_library(
hdrs = [
"flags_defaults.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/host/libs/config",
Expand Down
11 changes: 4 additions & 7 deletions base/cvd/cuttlefish/host/commands/cvd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -6,10 +8,7 @@ cc_library(
name = "libcvd",
srcs = ["cvd.cpp" ],
hdrs = ["cvd.h"],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils",
Expand All @@ -28,9 +27,7 @@ cc_library(
cc_binary(
name = "cvd",
srcs = ["main.cc" ],
copts = [
"-std=c++17",
],
copts = COPTS,
deps = [
":libcvd",
"//cuttlefish/common/libs/utils",
Expand Down
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/cvd/acloud/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -24,10 +26,7 @@ cc_library(
"converter.h",
"create_converter_parser.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
":user_config_cc_proto",
Expand Down
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/cvd/cache/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -6,10 +8,7 @@ cc_library(
name = "cache",
srcs = ["cache.cpp"],
hdrs = ["cache.h"],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils:result",
Expand Down
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/cvd/fetch/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -14,10 +16,7 @@ cc_library(
"fetch_cvd_parser.h",
"fetch_tracer.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils:result",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -12,10 +14,7 @@ cc_library(
"instance_lock.h",
"lock_file.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/fs",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -8,10 +10,7 @@ cc_test(
"fetch_cvd_parser_test.cpp",
"fetch_cvd_test.cpp",
],
copts = [
"-std=c++17",
"-Icuttlefish",
],
copts = COPTS + [ "-Icuttlefish" ],
deps = [
"//cuttlefish/common/libs/utils",
"//cuttlefish/common/libs/utils:result",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -15,10 +17,7 @@ cc_test(
"test_common.cc",
"test_common.h",
],
copts = [
"-std=c++17",
"-Icuttlefish",
],
copts = COPTS + [ "-Icuttlefish" ],
deps = [
"//cuttlefish/common/libs/utils",
"//cuttlefish/common/libs/utils:result",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -18,10 +20,7 @@ cc_test(
"parser_names_helper.h",
"parser_names_test.cpp",
],
copts = [
"-std=c++17",
"-Icuttlefish",
],
copts = COPTS + [ "-Icuttlefish" ],
deps = [
"//cuttlefish/common/libs/fs",
"//cuttlefish/common/libs/utils",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -8,10 +10,7 @@ cc_test(
"frontline_parser_test.cpp",
"utils.h",
],
copts = [
"-std=c++17",
"-Icuttlefish",
],
copts = COPTS + [ "-Icuttlefish" ],
deps = [
"//cuttlefish/common/libs/utils:result_matchers",
"//cuttlefish/host/commands/cvd/cli:frontline_parser",
Expand Down
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/cvd/utils/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -16,10 +18,7 @@ cc_library(
"interrupt_listener.h",
"subprocess_waiter.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils:result",
Expand Down
6 changes: 3 additions & 3 deletions base/cvd/cuttlefish/host/commands/logcat_receiver/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -13,7 +15,5 @@ cc_binary(
srcs = [
"main.cpp",
],
cxxopts = [
"-std=c++17",
],
copts = COPTS,
)
7 changes: 3 additions & 4 deletions base/cvd/cuttlefish/host/commands/metrics/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -7,9 +9,6 @@ cc_library(
hdrs = [
"metrics_defs.h",
],
copts = [
"-Werror=sign-compare",
"-std=c++17",
],
copts = COPTS + [ "-Werror=sign-compare" ],
strip_include_prefix = "//cuttlefish",
)
6 changes: 3 additions & 3 deletions base/cvd/cuttlefish/host/libs/command_util/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -14,9 +16,7 @@ cc_library(
"runner/defs.h",
"util.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/fs",
Expand Down
6 changes: 3 additions & 3 deletions base/cvd/cuttlefish/host/libs/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
load("//:build_variables.bzl", "COPTS")

package(
default_visibility = ["//:android_cuttlefish"],
)
Expand All @@ -24,9 +26,7 @@ cc_library(
"instance_nums.h",
"logging.h",
],
copts = [
"-std=c++17",
],
copts = COPTS,
strip_include_prefix = "//cuttlefish",
deps = [
"//cuttlefish/common/libs/utils",
Expand Down
Loading

0 comments on commit 8c73b4a

Please sign in to comment.