Commit 492451e5 authored by Mirko Bonadei's avatar Mirko Bonadei Committed by Commit Bot

Compiling absl with the right set of flags when GCC is used.

This CL adds GCC compiler flags to the main absl BUILD.gn file. Before
this CL, clang flags were used also on GCC.

TBR=phoglund@chromium.org

Bug: webrtc:8821
Change-Id: I9d84f03e5e6986d0b5fce836bd90057437029d8c
Reviewed-on: https://chromium-review.googlesource.com/1011603Reviewed-by: default avatarPatrik Höglund <phoglund@chromium.org>
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550546}
parent 63b9c45c
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# absl specific compiler flags.
#
# Flags specified here must not impact ABI. Code compiled with and without these
# opts will be linked together, and in some cases headers compiled with and
# without these options will be part of the same program.
group("default") { group("default") {
deps = [ deps = [
"absl/types:any", "absl/types:any",
...@@ -25,91 +31,124 @@ config("absl_define_config") { ...@@ -25,91 +31,124 @@ config("absl_define_config") {
} }
config("absl_default_cflags_cc") { config("absl_default_cflags_cc") {
cflags_cc = [ if (is_clang) {
# All warnings are treated as errors by implicit -Werror flag cflags_cc = [
"-Wall", # All warnings are treated as errors by implicit -Werror flag
"-Wextra", "-Wall",
"-Weverything", "-Wextra",
# Abseil does not support C++98 "-Weverything",
"-Wno-c++98-compat-pedantic", # Abseil does not support C++98
# Turns off all implicit conversion warnings. Most are re-enabled below. "-Wno-c++98-compat-pedantic",
"-Wno-conversion", # Turns off all implicit conversion warnings. Most are re-enabled below.
"-Wno-covered-switch-default", "-Wno-conversion",
"-Wno-deprecated", "-Wno-covered-switch-default",
"-Wno-disabled-macro-expansion", "-Wno-deprecated",
"-Wno-double-promotion", "-Wno-disabled-macro-expansion",
### "-Wno-double-promotion",
# Turned off as they include valid C++ code. ###
"-Wno-comma", # Turned off as they include valid C++ code.
"-Wno-extra-semi", "-Wno-comma",
"-Wno-packed", "-Wno-extra-semi",
"-Wno-padded", "-Wno-packed",
### "-Wno-padded",
"-Wno-float-conversion", ###
"-Wno-float-equal", "-Wno-float-conversion",
"-Wno-format-nonliteral", "-Wno-float-equal",
# Too aggressive: warns on Clang extensions enclosed in Clang-only "-Wno-format-nonliteral",
# compilation paths. # Too aggressive: warns on Clang extensions enclosed in Clang-only
"-Wno-gcc-compat", # compilation paths.
### "-Wno-gcc-compat",
# Some internal globals are necessary. Don't do this at home. ###
"-Wno-global-constructors", # Some internal globals are necessary. Don't do this at home.
"-Wno-exit-time-destructors", "-Wno-global-constructors",
### "-Wno-exit-time-destructors",
"-Wno-nested-anon-types", ###
"-Wno-non-modular-include-in-module", "-Wno-nested-anon-types",
"-Wno-old-style-cast", "-Wno-non-modular-include-in-module",
# Warns on preferred usage of non-POD types such as string_view "-Wno-old-style-cast",
"-Wno-range-loop-analysis", # Warns on preferred usage of non-POD types such as string_view
"-Wno-reserved-id-macro", "-Wno-range-loop-analysis",
"-Wno-shorten-64-to-32", "-Wno-reserved-id-macro",
"-Wno-switch-enum", "-Wno-shorten-64-to-32",
"-Wno-thread-safety-negative", "-Wno-switch-enum",
"-Wno-undef", "-Wno-thread-safety-negative",
"-Wno-unknown-warning-option", "-Wno-undef",
"-Wno-unreachable-code", "-Wno-unknown-warning-option",
# Causes warnings on include guards "-Wno-unreachable-code",
"-Wno-unused-macros", # Causes warnings on include guards
"-Wno-weak-vtables", "-Wno-unused-macros",
### "-Wno-weak-vtables",
# Implicit conversion warnings turned off by -Wno-conversion ###
# which are re-enabled below. # Implicit conversion warnings turned off by -Wno-conversion
"-Wbitfield-enum-conversion", # which are re-enabled below.
"-Wbool-conversion", "-Wbitfield-enum-conversion",
"-Wconstant-conversion", "-Wbool-conversion",
"-Wenum-conversion", "-Wconstant-conversion",
"-Wint-conversion", "-Wenum-conversion",
"-Wliteral-conversion", "-Wint-conversion",
"-Wnon-literal-null-conversion", "-Wliteral-conversion",
"-Wnull-conversion", "-Wnon-literal-null-conversion",
"-Wobjc-literal-conversion", "-Wnull-conversion",
"-Wno-sign-conversion", "-Wobjc-literal-conversion",
"-Wstring-conversion", "-Wno-sign-conversion",
### "-Wstring-conversion",
] ###
]
}
if (is_linux && !is_clang) {
# If it is GCC...
cflags_cc = [
"-Wall",
"-Wextra",
"-Wcast-qual",
"-Wconversion-null",
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
"-Wunused-local-typedefs",
"-Wunused-result",
"-Wvarargs",
"-Wvla", # variable-length array
"-Wwrite-strings",
# Google style does not use unsigned integers, though STL containers
# have unsigned types.
"-Wno-sign-compare",
]
}
} }
config("absl_test_cflags_cc") { config("absl_test_cflags_cc") {
cflags_cc = [ if (is_clang) {
"-Wno-c99-extensions", cflags_cc = [
"-Wno-missing-noreturn", "-Wno-c99-extensions",
"-Wno-missing-prototypes", "-Wno-missing-noreturn",
"-Wno-null-conversion", "-Wno-missing-prototypes",
"-Wno-shadow", "-Wno-null-conversion",
"-Wno-shift-sign-overflow", "-Wno-shadow",
"-Wno-sign-compare", "-Wno-shift-sign-overflow",
"-Wno-unused-function", "-Wno-sign-compare",
"-Wno-unused-member-function", "-Wno-unused-function",
"-Wno-unused-parameter", "-Wno-unused-member-function",
"-Wno-unused-private-field", "-Wno-unused-parameter",
"-Wno-unused-template", "-Wno-unused-private-field",
"-Wno-used-but-marked-unused", "-Wno-unused-template",
"-Wno-zero-as-null-pointer-constant", "-Wno-used-but-marked-unused",
] "-Wno-zero-as-null-pointer-constant",
]
}
if (is_linux && !is_clang) {
# If is GCC...
cflags_cc = [
"-Wno-conversion-null",
"-Wno-missing-declarations",
"-Wno-sign-compare",
"-Wno-unused-function",
"-Wno-unused-parameter",
"-Wno-unused-private-field",
]
}
} }
config("absl_exceptions_cflags_cc") { config("absl_exceptions_cflags_cc") {
cflags_cc = [ cflags_cc = [
"-fexceptions", "-fexceptions",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment