00001 """Abseil compiler options.
00002
00003 This is the source of truth for Abseil compiler options. To modify Abseil
00004 compilation options:
00005
00006 (1) Edit the appropriate list in this file based on the platform the flag is
00007 needed on.
00008 (2) Run `<path_to_absl>/copts/generate_copts.py`.
00009
00010 The generated copts are consumed by configure_copts.bzl and
00011 AbseilConfigureCopts.cmake.
00012 """
00013
00014
00015 MSVC_BIG_WARNING_FLAGS = [
00016 "/W3",
00017 ]
00018
00019 LLVM_BIG_WARNING_FLAGS = [
00020 "-Wall",
00021 "-Wextra",
00022 "-Weverything",
00023 ]
00024
00025
00026
00027 LLVM_DISABLE_WARNINGS_FLAGS = [
00028
00029 "-Wno-c++98-compat-pedantic",
00030
00031 "-Wno-conversion",
00032 "-Wno-covered-switch-default",
00033 "-Wno-deprecated",
00034 "-Wno-disabled-macro-expansion",
00035 "-Wno-double-promotion",
00036
00037
00038 "-Wno-comma",
00039 "-Wno-extra-semi",
00040 "-Wno-extra-semi-stmt",
00041 "-Wno-packed",
00042 "-Wno-padded",
00043
00044
00045
00046 "-Wno-sign-compare",
00047
00048 "-Wno-float-conversion",
00049 "-Wno-float-equal",
00050 "-Wno-format-nonliteral",
00051
00052
00053 "-Wno-gcc-compat",
00054
00055
00056 "-Wno-global-constructors",
00057 "-Wno-exit-time-destructors",
00058
00059 "-Wno-nested-anon-types",
00060 "-Wno-non-modular-include-in-module",
00061 "-Wno-old-style-cast",
00062
00063 "-Wno-range-loop-analysis",
00064 "-Wno-reserved-id-macro",
00065 "-Wno-shorten-64-to-32",
00066 "-Wno-switch-enum",
00067 "-Wno-thread-safety-negative",
00068 "-Wno-unknown-warning-option",
00069 "-Wno-unreachable-code",
00070
00071 "-Wno-unused-macros",
00072 "-Wno-weak-vtables",
00073
00074 "-Wno-zero-as-null-pointer-constant",
00075
00076
00077
00078 "-Wbitfield-enum-conversion",
00079 "-Wbool-conversion",
00080 "-Wconstant-conversion",
00081 "-Wenum-conversion",
00082 "-Wint-conversion",
00083 "-Wliteral-conversion",
00084 "-Wnon-literal-null-conversion",
00085 "-Wnull-conversion",
00086 "-Wobjc-literal-conversion",
00087 "-Wno-sign-conversion",
00088 "-Wstring-conversion",
00089 ]
00090
00091 LLVM_TEST_DISABLE_WARNINGS_FLAGS = [
00092 "-Wno-c99-extensions",
00093 "-Wno-deprecated-declarations",
00094 "-Wno-missing-noreturn",
00095 "-Wno-missing-prototypes",
00096 "-Wno-missing-variable-declarations",
00097 "-Wno-null-conversion",
00098 "-Wno-shadow",
00099 "-Wno-shift-sign-overflow",
00100 "-Wno-sign-compare",
00101 "-Wno-unused-function",
00102 "-Wno-unused-member-function",
00103 "-Wno-unused-parameter",
00104 "-Wno-unused-private-field",
00105 "-Wno-unused-template",
00106 "-Wno-used-but-marked-unused",
00107 "-Wno-zero-as-null-pointer-constant",
00108
00109 "-Wno-gnu-include-next",
00110
00111 "-Wno-gnu-zero-variadic-macro-arguments",
00112 ]
00113
00114 MSVC_STYLE_EXCEPTIONS_FLAGS = [
00115 "/U_HAS_EXCEPTIONS",
00116 "/D_HAS_EXCEPTIONS=1",
00117 "/EHsc"
00118 ]
00119
00120 MSVC_DEFINES = [
00121 "/DNOMINMAX",
00122
00123 "/DWIN32_LEAN_AND_MEAN",
00124
00125 "/D_CRT_SECURE_NO_WARNINGS",
00126 "/D_SCL_SECURE_NO_WARNINGS",
00127
00128 "/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
00129 ]
00130
00131 COPT_VARS = {
00132 "ABSL_GCC_FLAGS": [
00133 "-Wall",
00134 "-Wextra",
00135 "-Wcast-qual",
00136 "-Wconversion-null",
00137 "-Wmissing-declarations",
00138 "-Woverlength-strings",
00139 "-Wpointer-arith",
00140 "-Wunused-local-typedefs",
00141 "-Wunused-result",
00142 "-Wvarargs",
00143 "-Wvla",
00144 "-Wwrite-strings",
00145
00146
00147
00148 "-Wno-missing-field-initializers",
00149
00150
00151 "-Wno-sign-compare",
00152 ],
00153 "ABSL_GCC_TEST_FLAGS": [
00154 "-Wno-conversion-null",
00155 "-Wno-deprecated-declarations",
00156 "-Wno-missing-declarations",
00157 "-Wno-sign-compare",
00158 "-Wno-unused-function",
00159 "-Wno-unused-parameter",
00160 "-Wno-unused-private-field",
00161 ],
00162 "ABSL_GCC_EXCEPTIONS_FLAGS": ["-fexceptions"],
00163 "ABSL_LLVM_FLAGS":
00164 LLVM_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS,
00165 "ABSL_LLVM_TEST_FLAGS":
00166 LLVM_TEST_DISABLE_WARNINGS_FLAGS,
00167 "ABSL_LLVM_EXCEPTIONS_FLAGS": ["-fexceptions"],
00168 "ABSL_CLANG_CL_FLAGS":
00169 (MSVC_BIG_WARNING_FLAGS + LLVM_DISABLE_WARNINGS_FLAGS + MSVC_DEFINES),
00170 "ABSL_CLANG_CL_TEST_FLAGS":
00171 LLVM_TEST_DISABLE_WARNINGS_FLAGS,
00172 "ABSL_CLANG_CL_EXCEPTIONS_FLAGS":
00173 MSVC_STYLE_EXCEPTIONS_FLAGS,
00174 "ABSL_MSVC_FLAGS":
00175 MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + [
00176 "/wd4005",
00177 "/wd4068",
00178
00179 "/wd4180",
00180
00181 "/wd4244",
00182
00183 "/wd4267",
00184
00185 "/wd4503",
00186
00187 "/wd4800",
00188 ],
00189 "ABSL_MSVC_TEST_FLAGS": [
00190 "/wd4018",
00191 "/wd4101",
00192 "/wd4503",
00193 "/wd4996",
00194 "/DNOMINMAX",
00195 ],
00196 "ABSL_MSVC_EXCEPTIONS_FLAGS":
00197 MSVC_STYLE_EXCEPTIONS_FLAGS,
00198 "ABSL_MSVC_LINKOPTS": [
00199
00200 "-ignore:4221",
00201 ],
00202 }