bloaty/third_party/abseil-cpp/absl/copts/copts.py
Go to the documentation of this file.
1 """Abseil compiler options.
2 
3 This is the source of truth for Abseil compiler options. To modify Abseil
4 compilation options:
5 
6  (1) Edit the appropriate list in this file based on the platform the flag is
7  needed on.
8  (2) Run `<path_to_absl>/copts/generate_copts.py`.
9 
10 The generated copts are consumed by configure_copts.bzl and
11 AbseilConfigureCopts.cmake.
12 """
13 
14 # /Wall with msvc includes unhelpful warnings such as C4711, C4710, ...
15 MSVC_BIG_WARNING_FLAGS = [
16  "/W3",
17 ]
18 
19 LLVM_TEST_DISABLE_WARNINGS_FLAGS = [
20  "-Wno-c99-extensions",
21  "-Wno-deprecated-declarations",
22  "-Wno-missing-noreturn",
23  "-Wno-missing-prototypes",
24  "-Wno-missing-variable-declarations",
25  "-Wno-null-conversion",
26  "-Wno-shadow",
27  "-Wno-shift-sign-overflow",
28  "-Wno-sign-compare",
29  "-Wno-unused-function",
30  "-Wno-unused-member-function",
31  "-Wno-unused-parameter",
32  "-Wno-unused-private-field",
33  "-Wno-unused-template",
34  "-Wno-used-but-marked-unused",
35  "-Wno-zero-as-null-pointer-constant",
36  # gtest depends on this GNU extension being offered.
37  "-Wno-gnu-zero-variadic-macro-arguments",
38 ]
39 
40 MSVC_DEFINES = [
41  "/DNOMINMAX", # Don't define min and max macros (windows.h)
42  # Don't bloat namespace with incompatible winsock versions.
43  "/DWIN32_LEAN_AND_MEAN",
44  # Don't warn about usage of insecure C functions.
45  "/D_CRT_SECURE_NO_WARNINGS",
46  "/D_SCL_SECURE_NO_WARNINGS",
47  # Introduced in VS 2017 15.8, allow overaligned types in aligned_storage
48  "/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
49 ]
50 
51 COPT_VARS = {
52  "ABSL_GCC_FLAGS": [
53  "-Wall",
54  "-Wextra",
55  "-Wcast-qual",
56  "-Wconversion-null",
57  "-Wformat-security",
58  "-Wmissing-declarations",
59  "-Woverlength-strings",
60  "-Wpointer-arith",
61  "-Wundef",
62  "-Wunused-local-typedefs",
63  "-Wunused-result",
64  "-Wvarargs",
65  "-Wvla", # variable-length array
66  "-Wwrite-strings",
67  # Don't define min and max macros (Build on Windows using gcc)
68  "-DNOMINMAX",
69  ],
70  "ABSL_GCC_TEST_FLAGS": [
71  "-Wno-conversion-null",
72  "-Wno-deprecated-declarations",
73  "-Wno-missing-declarations",
74  "-Wno-sign-compare",
75  "-Wno-unused-function",
76  "-Wno-unused-parameter",
77  "-Wno-unused-private-field",
78  ],
79  "ABSL_LLVM_FLAGS": [
80  "-Wall",
81  "-Wextra",
82  "-Wcast-qual",
83  "-Wconversion",
84  "-Wfloat-overflow-conversion",
85  "-Wfloat-zero-conversion",
86  "-Wfor-loop-analysis",
87  "-Wformat-security",
88  "-Wgnu-redeclared-enum",
89  "-Winfinite-recursion",
90  "-Winvalid-constexpr",
91  "-Wliteral-conversion",
92  "-Wmissing-declarations",
93  "-Woverlength-strings",
94  "-Wpointer-arith",
95  "-Wself-assign",
96  "-Wshadow",
97  "-Wstring-conversion",
98  "-Wtautological-overlap-compare",
99  "-Wundef",
100  "-Wuninitialized",
101  "-Wunreachable-code",
102  "-Wunused-comparison",
103  "-Wunused-local-typedefs",
104  "-Wunused-result",
105  "-Wvla",
106  "-Wwrite-strings",
107  # Warnings that are enabled by group warning flags like -Wall that we
108  # explicitly disable.
109  "-Wno-float-conversion",
110  "-Wno-implicit-float-conversion",
111  "-Wno-implicit-int-float-conversion",
112  "-Wno-implicit-int-conversion",
113  "-Wno-shorten-64-to-32",
114  "-Wno-sign-conversion",
115  # Don't define min and max macros (Build on Windows using clang)
116  "-DNOMINMAX",
117  ],
118  "ABSL_LLVM_TEST_FLAGS":
119  LLVM_TEST_DISABLE_WARNINGS_FLAGS,
120  "ABSL_CLANG_CL_FLAGS":
121  (MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES),
122  "ABSL_CLANG_CL_TEST_FLAGS":
123  LLVM_TEST_DISABLE_WARNINGS_FLAGS,
124  "ABSL_MSVC_FLAGS":
125  MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + [
126  # Increase the number of sections available in object files
127  "/bigobj",
128  "/wd4005", # macro-redefinition
129  "/wd4068", # unknown pragma
130  # qualifier applied to function type has no meaning; ignored
131  "/wd4180",
132  # conversion from 'type1' to 'type2', possible loss of data
133  "/wd4244",
134  # conversion from 'size_t' to 'type', possible loss of data
135  "/wd4267",
136  # The decorated name was longer than the compiler limit
137  "/wd4503",
138  # forcing value to bool 'true' or 'false' (performance warning)
139  "/wd4800",
140  ],
141  "ABSL_MSVC_TEST_FLAGS": [
142  "/wd4018", # signed/unsigned mismatch
143  "/wd4101", # unreferenced local variable
144  "/wd4503", # decorated name length exceeded, name was truncated
145  "/wd4996", # use of deprecated symbol
146  "/DNOMINMAX", # disable the min() and max() macros from <windows.h>
147  ],
148  "ABSL_MSVC_LINKOPTS": [
149  # Object file doesn't export any previously undefined symbols
150  "-ignore:4221",
151  ],
152  # "HWAES" is an abbreviation for "hardware AES" (AES - Advanced Encryption
153  # Standard). These flags are used for detecting whether or not the target
154  # architecture has hardware support for AES instructions which can be used
155  # to improve performance of some random bit generators.
156  "ABSL_RANDOM_HWAES_ARM64_FLAGS": ["-march=armv8-a+crypto"],
157  "ABSL_RANDOM_HWAES_ARM32_FLAGS": ["-mfpu=neon"],
158  "ABSL_RANDOM_HWAES_X64_FLAGS": [
159  "-maes",
160  "-msse4.1",
161  ],
162  "ABSL_RANDOM_HWAES_MSVC_X64_FLAGS": [],
163 }


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:02