summaryrefslogtreecommitdiff
path: root/absl/copts
diff options
context:
space:
mode:
Diffstat (limited to 'absl/copts')
-rw-r--r--absl/copts/AbseilConfigureCopts.cmake17
-rw-r--r--absl/copts/GENERATED_AbseilCopts.cmake110
-rw-r--r--absl/copts/GENERATED_copts.bzl110
-rw-r--r--absl/copts/configure_copts.bzl14
-rw-r--r--absl/copts/copts.py124
5 files changed, 111 insertions, 264 deletions
diff --git a/absl/copts/AbseilConfigureCopts.cmake b/absl/copts/AbseilConfigureCopts.cmake
index acd46d04..9cd6fd1b 100644
--- a/absl/copts/AbseilConfigureCopts.cmake
+++ b/absl/copts/AbseilConfigureCopts.cmake
@@ -12,16 +12,16 @@ else()
set(ABSL_BUILD_DLL FALSE)
endif()
-if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86_64|amd64|AMD64")
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
if (MSVC)
set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_MSVC_X64_FLAGS}")
else()
set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_X64_FLAGS}")
endif()
-elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm.*|aarch64")
- if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*|aarch64")
+ if (CMAKE_SIZEOF_VOID_P STREQUAL "8")
set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_ARM64_FLAGS}")
- elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
+ elseif(CMAKE_SIZEOF_VOID_P STREQUAL "4")
set(ABSL_RANDOM_RANDEN_COPTS "${ABSL_RANDOM_HWAES_ARM32_FLAGS}")
else()
message(WARNING "Value of CMAKE_SIZEOF_VOID_P (${CMAKE_SIZEOF_VOID_P}) is not supported.")
@@ -32,20 +32,19 @@ else()
endif()
-if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(ABSL_DEFAULT_COPTS "${ABSL_GCC_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_GCC_FLAGS};${ABSL_GCC_TEST_FLAGS}")
-elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# MATCHES so we get both Clang and AppleClang
if(MSVC)
# clang-cl is half MSVC, half LLVM
set(ABSL_DEFAULT_COPTS "${ABSL_CLANG_CL_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_CLANG_CL_FLAGS};${ABSL_CLANG_CL_TEST_FLAGS}")
- set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
else()
set(ABSL_DEFAULT_COPTS "${ABSL_LLVM_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_LLVM_FLAGS};${ABSL_LLVM_TEST_FLAGS}")
- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# AppleClang doesn't have lsan
# https://developer.apple.com/documentation/code_diagnostics
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
@@ -54,7 +53,7 @@ elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
endif()
endif()
endif()
-elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ABSL_DEFAULT_COPTS "${ABSL_MSVC_FLAGS}")
set(ABSL_TEST_COPTS "${ABSL_MSVC_FLAGS};${ABSL_MSVC_TEST_FLAGS}")
set(ABSL_DEFAULT_LINKOPTS "${ABSL_MSVC_LINKOPTS}")
diff --git a/absl/copts/GENERATED_AbseilCopts.cmake b/absl/copts/GENERATED_AbseilCopts.cmake
index 97bd283e..51742c9b 100644
--- a/absl/copts/GENERATED_AbseilCopts.cmake
+++ b/absl/copts/GENERATED_AbseilCopts.cmake
@@ -5,47 +5,6 @@
list(APPEND ABSL_CLANG_CL_FLAGS
"/W3"
- "-Wno-c++98-compat-pedantic"
- "-Wno-conversion"
- "-Wno-covered-switch-default"
- "-Wno-deprecated"
- "-Wno-disabled-macro-expansion"
- "-Wno-double-promotion"
- "-Wno-comma"
- "-Wno-extra-semi"
- "-Wno-extra-semi-stmt"
- "-Wno-packed"
- "-Wno-padded"
- "-Wno-sign-compare"
- "-Wno-float-conversion"
- "-Wno-float-equal"
- "-Wno-format-nonliteral"
- "-Wno-gcc-compat"
- "-Wno-global-constructors"
- "-Wno-exit-time-destructors"
- "-Wno-non-modular-include-in-module"
- "-Wno-old-style-cast"
- "-Wno-range-loop-analysis"
- "-Wno-reserved-id-macro"
- "-Wno-shorten-64-to-32"
- "-Wno-switch-enum"
- "-Wno-thread-safety-negative"
- "-Wno-unknown-warning-option"
- "-Wno-unreachable-code"
- "-Wno-unused-macros"
- "-Wno-weak-vtables"
- "-Wno-zero-as-null-pointer-constant"
- "-Wbitfield-enum-conversion"
- "-Wbool-conversion"
- "-Wconstant-conversion"
- "-Wenum-conversion"
- "-Wint-conversion"
- "-Wliteral-conversion"
- "-Wnon-literal-null-conversion"
- "-Wnull-conversion"
- "-Wobjc-literal-conversion"
- "-Wno-sign-conversion"
- "-Wstring-conversion"
"/DNOMINMAX"
"/DWIN32_LEAN_AND_MEAN"
"/D_CRT_SECURE_NO_WARNINGS"
@@ -78,6 +37,7 @@ list(APPEND ABSL_GCC_FLAGS
"-Wextra"
"-Wcast-qual"
"-Wconversion-null"
+ "-Wformat-security"
"-Wmissing-declarations"
"-Woverlength-strings"
"-Wpointer-arith"
@@ -87,8 +47,6 @@ list(APPEND ABSL_GCC_FLAGS
"-Wvarargs"
"-Wvla"
"-Wwrite-strings"
- "-Wno-missing-field-initializers"
- "-Wno-sign-compare"
"-DNOMINMAX"
)
@@ -105,48 +63,36 @@ list(APPEND ABSL_GCC_TEST_FLAGS
list(APPEND ABSL_LLVM_FLAGS
"-Wall"
"-Wextra"
- "-Weverything"
- "-Wno-c++98-compat-pedantic"
- "-Wno-conversion"
- "-Wno-covered-switch-default"
- "-Wno-deprecated"
- "-Wno-disabled-macro-expansion"
- "-Wno-double-promotion"
- "-Wno-comma"
- "-Wno-extra-semi"
- "-Wno-extra-semi-stmt"
- "-Wno-packed"
- "-Wno-padded"
- "-Wno-sign-compare"
+ "-Wcast-qual"
+ "-Wconversion"
+ "-Wfloat-overflow-conversion"
+ "-Wfloat-zero-conversion"
+ "-Wfor-loop-analysis"
+ "-Wformat-security"
+ "-Wgnu-redeclared-enum"
+ "-Winfinite-recursion"
+ "-Wliteral-conversion"
+ "-Wmissing-declarations"
+ "-Woverlength-strings"
+ "-Wpointer-arith"
+ "-Wself-assign"
+ "-Wshadow"
+ "-Wstring-conversion"
+ "-Wtautological-overlap-compare"
+ "-Wundef"
+ "-Wuninitialized"
+ "-Wunreachable-code"
+ "-Wunused-comparison"
+ "-Wunused-local-typedefs"
+ "-Wunused-result"
+ "-Wvla"
+ "-Wwrite-strings"
"-Wno-float-conversion"
- "-Wno-float-equal"
- "-Wno-format-nonliteral"
- "-Wno-gcc-compat"
- "-Wno-global-constructors"
- "-Wno-exit-time-destructors"
- "-Wno-non-modular-include-in-module"
- "-Wno-old-style-cast"
- "-Wno-range-loop-analysis"
- "-Wno-reserved-id-macro"
+ "-Wno-implicit-float-conversion"
+ "-Wno-implicit-int-float-conversion"
+ "-Wno-implicit-int-conversion"
"-Wno-shorten-64-to-32"
- "-Wno-switch-enum"
- "-Wno-thread-safety-negative"
- "-Wno-unknown-warning-option"
- "-Wno-unreachable-code"
- "-Wno-unused-macros"
- "-Wno-weak-vtables"
- "-Wno-zero-as-null-pointer-constant"
- "-Wbitfield-enum-conversion"
- "-Wbool-conversion"
- "-Wconstant-conversion"
- "-Wenum-conversion"
- "-Wint-conversion"
- "-Wliteral-conversion"
- "-Wnon-literal-null-conversion"
- "-Wnull-conversion"
- "-Wobjc-literal-conversion"
"-Wno-sign-conversion"
- "-Wstring-conversion"
"-DNOMINMAX"
)
diff --git a/absl/copts/GENERATED_copts.bzl b/absl/copts/GENERATED_copts.bzl
index bcdd61ef..6707488f 100644
--- a/absl/copts/GENERATED_copts.bzl
+++ b/absl/copts/GENERATED_copts.bzl
@@ -6,47 +6,6 @@
ABSL_CLANG_CL_FLAGS = [
"/W3",
- "-Wno-c++98-compat-pedantic",
- "-Wno-conversion",
- "-Wno-covered-switch-default",
- "-Wno-deprecated",
- "-Wno-disabled-macro-expansion",
- "-Wno-double-promotion",
- "-Wno-comma",
- "-Wno-extra-semi",
- "-Wno-extra-semi-stmt",
- "-Wno-packed",
- "-Wno-padded",
- "-Wno-sign-compare",
- "-Wno-float-conversion",
- "-Wno-float-equal",
- "-Wno-format-nonliteral",
- "-Wno-gcc-compat",
- "-Wno-global-constructors",
- "-Wno-exit-time-destructors",
- "-Wno-non-modular-include-in-module",
- "-Wno-old-style-cast",
- "-Wno-range-loop-analysis",
- "-Wno-reserved-id-macro",
- "-Wno-shorten-64-to-32",
- "-Wno-switch-enum",
- "-Wno-thread-safety-negative",
- "-Wno-unknown-warning-option",
- "-Wno-unreachable-code",
- "-Wno-unused-macros",
- "-Wno-weak-vtables",
- "-Wno-zero-as-null-pointer-constant",
- "-Wbitfield-enum-conversion",
- "-Wbool-conversion",
- "-Wconstant-conversion",
- "-Wenum-conversion",
- "-Wint-conversion",
- "-Wliteral-conversion",
- "-Wnon-literal-null-conversion",
- "-Wnull-conversion",
- "-Wobjc-literal-conversion",
- "-Wno-sign-conversion",
- "-Wstring-conversion",
"/DNOMINMAX",
"/DWIN32_LEAN_AND_MEAN",
"/D_CRT_SECURE_NO_WARNINGS",
@@ -79,6 +38,7 @@ ABSL_GCC_FLAGS = [
"-Wextra",
"-Wcast-qual",
"-Wconversion-null",
+ "-Wformat-security",
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
@@ -88,8 +48,6 @@ ABSL_GCC_FLAGS = [
"-Wvarargs",
"-Wvla",
"-Wwrite-strings",
- "-Wno-missing-field-initializers",
- "-Wno-sign-compare",
"-DNOMINMAX",
]
@@ -106,48 +64,36 @@ ABSL_GCC_TEST_FLAGS = [
ABSL_LLVM_FLAGS = [
"-Wall",
"-Wextra",
- "-Weverything",
- "-Wno-c++98-compat-pedantic",
- "-Wno-conversion",
- "-Wno-covered-switch-default",
- "-Wno-deprecated",
- "-Wno-disabled-macro-expansion",
- "-Wno-double-promotion",
- "-Wno-comma",
- "-Wno-extra-semi",
- "-Wno-extra-semi-stmt",
- "-Wno-packed",
- "-Wno-padded",
- "-Wno-sign-compare",
+ "-Wcast-qual",
+ "-Wconversion",
+ "-Wfloat-overflow-conversion",
+ "-Wfloat-zero-conversion",
+ "-Wfor-loop-analysis",
+ "-Wformat-security",
+ "-Wgnu-redeclared-enum",
+ "-Winfinite-recursion",
+ "-Wliteral-conversion",
+ "-Wmissing-declarations",
+ "-Woverlength-strings",
+ "-Wpointer-arith",
+ "-Wself-assign",
+ "-Wshadow",
+ "-Wstring-conversion",
+ "-Wtautological-overlap-compare",
+ "-Wundef",
+ "-Wuninitialized",
+ "-Wunreachable-code",
+ "-Wunused-comparison",
+ "-Wunused-local-typedefs",
+ "-Wunused-result",
+ "-Wvla",
+ "-Wwrite-strings",
"-Wno-float-conversion",
- "-Wno-float-equal",
- "-Wno-format-nonliteral",
- "-Wno-gcc-compat",
- "-Wno-global-constructors",
- "-Wno-exit-time-destructors",
- "-Wno-non-modular-include-in-module",
- "-Wno-old-style-cast",
- "-Wno-range-loop-analysis",
- "-Wno-reserved-id-macro",
+ "-Wno-implicit-float-conversion",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-implicit-int-conversion",
"-Wno-shorten-64-to-32",
- "-Wno-switch-enum",
- "-Wno-thread-safety-negative",
- "-Wno-unknown-warning-option",
- "-Wno-unreachable-code",
- "-Wno-unused-macros",
- "-Wno-weak-vtables",
- "-Wno-zero-as-null-pointer-constant",
- "-Wbitfield-enum-conversion",
- "-Wbool-conversion",
- "-Wconstant-conversion",
- "-Wenum-conversion",
- "-Wint-conversion",
- "-Wliteral-conversion",
- "-Wnon-literal-null-conversion",
- "-Wnull-conversion",
- "-Wobjc-literal-conversion",
"-Wno-sign-conversion",
- "-Wstring-conversion",
"-DNOMINMAX",
]
diff --git a/absl/copts/configure_copts.bzl b/absl/copts/configure_copts.bzl
index ff9a5ea9..669a9060 100644
--- a/absl/copts/configure_copts.bzl
+++ b/absl/copts/configure_copts.bzl
@@ -22,21 +22,21 @@ load(
)
ABSL_DEFAULT_COPTS = select({
- "//absl:windows": ABSL_MSVC_FLAGS,
- "//absl:llvm_compiler": ABSL_LLVM_FLAGS,
+ "//absl:msvc_compiler": ABSL_MSVC_FLAGS,
+ "//absl:clang-cl_compiler": ABSL_CLANG_CL_FLAGS,
+ "//absl:clang_compiler": ABSL_LLVM_FLAGS,
"//conditions:default": ABSL_GCC_FLAGS,
})
-# in absence of modules (--compiler=gcc or -c opt), cc_tests leak their copts
-# to their (included header) dependencies and fail to build outside absl
ABSL_TEST_COPTS = ABSL_DEFAULT_COPTS + select({
- "//absl:windows": ABSL_MSVC_TEST_FLAGS,
- "//absl:llvm_compiler": ABSL_LLVM_TEST_FLAGS,
+ "//absl:msvc_compiler": ABSL_MSVC_TEST_FLAGS,
+ "//absl:clang-cl_compiler": ABSL_CLANG_CL_TEST_FLAGS,
+ "//absl:clang_compiler": ABSL_LLVM_TEST_FLAGS,
"//conditions:default": ABSL_GCC_TEST_FLAGS,
})
ABSL_DEFAULT_LINKOPTS = select({
- "//absl:windows": ABSL_MSVC_LINKOPTS,
+ "//absl:msvc_compiler": ABSL_MSVC_LINKOPTS,
"//conditions:default": [],
})
diff --git a/absl/copts/copts.py b/absl/copts/copts.py
index a3437c1b..cf52981c 100644
--- a/absl/copts/copts.py
+++ b/absl/copts/copts.py
@@ -16,77 +16,6 @@ MSVC_BIG_WARNING_FLAGS = [
"/W3",
]
-LLVM_BIG_WARNING_FLAGS = [
- "-Wall",
- "-Wextra",
- "-Weverything",
-]
-
-# Docs on single flags is preceded by a comment.
-# Docs on groups of flags is preceded by ###.
-LLVM_DISABLE_WARNINGS_FLAGS = [
- # Abseil does not support C++98
- "-Wno-c++98-compat-pedantic",
- # Turns off all implicit conversion warnings. Most are re-enabled below.
- "-Wno-conversion",
- "-Wno-covered-switch-default",
- "-Wno-deprecated",
- "-Wno-disabled-macro-expansion",
- "-Wno-double-promotion",
- ###
- # Turned off as they include valid C++ code.
- "-Wno-comma",
- "-Wno-extra-semi",
- "-Wno-extra-semi-stmt",
- "-Wno-packed",
- "-Wno-padded",
- ###
- # Google style does not use unsigned integers, though STL containers
- # have unsigned types.
- "-Wno-sign-compare",
- ###
- "-Wno-float-conversion",
- "-Wno-float-equal",
- "-Wno-format-nonliteral",
- # Too aggressive: warns on Clang extensions enclosed in Clang-only
- # compilation paths.
- "-Wno-gcc-compat",
- ###
- # Some internal globals are necessary. Don't do this at home.
- "-Wno-global-constructors",
- "-Wno-exit-time-destructors",
- ###
- "-Wno-non-modular-include-in-module",
- "-Wno-old-style-cast",
- # Warns on preferred usage of non-POD types such as string_view
- "-Wno-range-loop-analysis",
- "-Wno-reserved-id-macro",
- "-Wno-shorten-64-to-32",
- "-Wno-switch-enum",
- "-Wno-thread-safety-negative",
- "-Wno-unknown-warning-option",
- "-Wno-unreachable-code",
- # Causes warnings on include guards
- "-Wno-unused-macros",
- "-Wno-weak-vtables",
- # Causes warnings on usage of types/compare.h comparison operators.
- "-Wno-zero-as-null-pointer-constant",
- ###
- # Implicit conversion warnings turned off by -Wno-conversion
- # which are re-enabled below.
- "-Wbitfield-enum-conversion",
- "-Wbool-conversion",
- "-Wconstant-conversion",
- "-Wenum-conversion",
- "-Wint-conversion",
- "-Wliteral-conversion",
- "-Wnon-literal-null-conversion",
- "-Wnull-conversion",
- "-Wobjc-literal-conversion",
- "-Wno-sign-conversion",
- "-Wstring-conversion",
-]
-
LLVM_TEST_DISABLE_WARNINGS_FLAGS = [
"-Wno-c99-extensions",
"-Wno-deprecated-declarations",
@@ -125,6 +54,7 @@ COPT_VARS = {
"-Wextra",
"-Wcast-qual",
"-Wconversion-null",
+ "-Wformat-security",
"-Wmissing-declarations",
"-Woverlength-strings",
"-Wpointer-arith",
@@ -134,13 +64,6 @@ COPT_VARS = {
"-Wvarargs",
"-Wvla", # variable-length array
"-Wwrite-strings",
- # gcc-4.x has spurious missing field initializer warnings.
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750
- # Remove when gcc-4.x is no longer supported.
- "-Wno-missing-field-initializers",
- # Google style does not use unsigned integers, though STL containers
- # have unsigned types.
- "-Wno-sign-compare",
# Don't define min and max macros (Build on Windows using gcc)
"-DNOMINMAX",
],
@@ -153,15 +76,48 @@ COPT_VARS = {
"-Wno-unused-parameter",
"-Wno-unused-private-field",
],
- "ABSL_LLVM_FLAGS":
- LLVM_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS + [
- # Don't define min and max macros (Build on Windows using clang)
- "-DNOMINMAX",
- ],
+ "ABSL_LLVM_FLAGS": [
+ "-Wall",
+ "-Wextra",
+ "-Wcast-qual",
+ "-Wconversion",
+ "-Wfloat-overflow-conversion",
+ "-Wfloat-zero-conversion",
+ "-Wfor-loop-analysis",
+ "-Wformat-security",
+ "-Wgnu-redeclared-enum",
+ "-Winfinite-recursion",
+ "-Wliteral-conversion",
+ "-Wmissing-declarations",
+ "-Woverlength-strings",
+ "-Wpointer-arith",
+ "-Wself-assign",
+ "-Wshadow",
+ "-Wstring-conversion",
+ "-Wtautological-overlap-compare",
+ "-Wundef",
+ "-Wuninitialized",
+ "-Wunreachable-code",
+ "-Wunused-comparison",
+ "-Wunused-local-typedefs",
+ "-Wunused-result",
+ "-Wvla",
+ "-Wwrite-strings",
+ # Warnings that are enabled by group warning flags like -Wall that we
+ # explicitly disable.
+ "-Wno-float-conversion",
+ "-Wno-implicit-float-conversion",
+ "-Wno-implicit-int-float-conversion",
+ "-Wno-implicit-int-conversion",
+ "-Wno-shorten-64-to-32",
+ "-Wno-sign-conversion",
+ # Don't define min and max macros (Build on Windows using clang)
+ "-DNOMINMAX",
+ ],
"ABSL_LLVM_TEST_FLAGS":
LLVM_TEST_DISABLE_WARNINGS_FLAGS,
"ABSL_CLANG_CL_FLAGS":
- (MSVC_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS + MSVC_DEFINES),
+ (MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES),
"ABSL_CLANG_CL_TEST_FLAGS":
LLVM_TEST_DISABLE_WARNINGS_FLAGS,
"ABSL_MSVC_FLAGS":