Skip to content

Commit 0cc960e

Browse files
Abseil Teamcopybara-github
authored andcommitted
Automated rollback of commit 9f40d6d.
PiperOrigin-RevId: 838084272 Change-Id: I8b1b15618e12cc17d85a71b7f5062b66ceaaf04f
1 parent 9f40d6d commit 0cc960e

File tree

9 files changed

+243
-43
lines changed

9 files changed

+243
-43
lines changed

absl/base/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' ||
755755
#ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
756756
#error ABSL_INTERNAL_HAS_CXA_DEMANGLE cannot be directly set
757757
#elif defined(OS_ANDROID) && (defined(__i386__) || defined(__x86_64__))
758-
#define ABSL_INTERNAL_HAS_CXA_DEMANGLE 0
758+
#undef ABSL_INTERNAL_HAS_CXA_DEMANGLE
759759
#elif defined(__GNUC__)
760760
#define ABSL_INTERNAL_HAS_CXA_DEMANGLE 1
761761
#elif defined(__clang__) && !defined(_MSC_VER)

absl/container/btree_test.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2048,7 +2048,10 @@ TEST(Btree, ExtractAndGetNextEndIter) {
20482048

20492049
TEST(Btree, ExtractDoesntCauseExtraMoves) {
20502050
#ifdef _MSC_VER
2051-
GTEST_SKIP() << "This test fails on MSVC.";
2051+
// This conditional is to avoid an unreachable code warning.
2052+
if (_MSC_VER > 0) {
2053+
GTEST_SKIP() << "This test fails on MSVC.";
2054+
}
20522055
#endif
20532056

20542057
using Set = absl::btree_set<MovableOnlyInstance>;

absl/copts/GENERATED_AbseilCopts.cmake

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,46 @@ list(APPEND ABSL_CLANG_CL_FLAGS
1010
"/D_CRT_SECURE_NO_WARNINGS"
1111
"/D_SCL_SECURE_NO_WARNINGS"
1212
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE"
13+
"-Wmost"
14+
"-Wextra"
15+
"-Wc++98-compat-extra-semi"
16+
"-Wcast-qual"
17+
"-Wconversion"
18+
"-Wdeprecated-pragma"
19+
"-Wfloat-overflow-conversion"
20+
"-Wfloat-zero-conversion"
21+
"-Wfor-loop-analysis"
22+
"-Wformat-security"
23+
"-Wgnu-redeclared-enum"
24+
"-Winfinite-recursion"
25+
"-Winvalid-constexpr"
26+
"-Wliteral-conversion"
27+
"-Wmissing-declarations"
28+
"-Wnullability-completeness"
29+
"-Woverlength-strings"
30+
"-Wpointer-arith"
31+
"-Wself-assign"
32+
"-Wshadow-all"
33+
"-Wshorten-64-to-32"
34+
"-Wsign-conversion"
35+
"-Wstring-conversion"
36+
"-Wtautological-overlap-compare"
37+
"-Wtautological-unsigned-zero-compare"
38+
"-Wthread-safety"
39+
"-Wundef"
40+
"-Wuninitialized"
41+
"-Wunreachable-code"
42+
"-Wunused-comparison"
43+
"-Wunused-local-typedefs"
44+
"-Wunused-result"
45+
"-Wvla"
46+
"-Wwrite-strings"
47+
"-Wno-float-conversion"
48+
"-Wno-implicit-float-conversion"
49+
"-Wno-implicit-int-float-conversion"
50+
"-Wno-unknown-warning-option"
51+
"-Wno-unused-command-line-argument"
52+
"-DNOMINMAX"
1353
)
1454

1555
list(APPEND ABSL_CLANG_CL_TEST_FLAGS
@@ -19,6 +59,43 @@ list(APPEND ABSL_CLANG_CL_TEST_FLAGS
1959
"/D_CRT_SECURE_NO_WARNINGS"
2060
"/D_SCL_SECURE_NO_WARNINGS"
2161
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE"
62+
"-Wmost"
63+
"-Wextra"
64+
"-Wc++98-compat-extra-semi"
65+
"-Wcast-qual"
66+
"-Wconversion"
67+
"-Wdeprecated-pragma"
68+
"-Wfloat-overflow-conversion"
69+
"-Wfloat-zero-conversion"
70+
"-Wfor-loop-analysis"
71+
"-Wformat-security"
72+
"-Wgnu-redeclared-enum"
73+
"-Winfinite-recursion"
74+
"-Winvalid-constexpr"
75+
"-Wliteral-conversion"
76+
"-Wmissing-declarations"
77+
"-Woverlength-strings"
78+
"-Wpointer-arith"
79+
"-Wself-assign"
80+
"-Wshadow-all"
81+
"-Wstring-conversion"
82+
"-Wtautological-overlap-compare"
83+
"-Wtautological-unsigned-zero-compare"
84+
"-Wthread-safety"
85+
"-Wundef"
86+
"-Wuninitialized"
87+
"-Wunreachable-code"
88+
"-Wunused-comparison"
89+
"-Wunused-local-typedefs"
90+
"-Wunused-result"
91+
"-Wvla"
92+
"-Wwrite-strings"
93+
"-Wno-float-conversion"
94+
"-Wno-implicit-float-conversion"
95+
"-Wno-implicit-int-float-conversion"
96+
"-Wno-unknown-warning-option"
97+
"-Wno-unused-command-line-argument"
98+
"-DNOMINMAX"
2299
"-Wno-deprecated-declarations"
23100
"-Wno-implicit-int-conversion"
24101
"-Wno-missing-prototypes"
@@ -84,6 +161,7 @@ list(APPEND ABSL_GCC_TEST_FLAGS
84161

85162
list(APPEND ABSL_LLVM_FLAGS
86163
"-Wall"
164+
"-Wmost"
87165
"-Wextra"
88166
"-Wc++98-compat-extra-semi"
89167
"-Wcast-qual"
@@ -127,6 +205,7 @@ list(APPEND ABSL_LLVM_FLAGS
127205

128206
list(APPEND ABSL_LLVM_TEST_FLAGS
129207
"-Wall"
208+
"-Wmost"
130209
"-Wextra"
131210
"-Wc++98-compat-extra-semi"
132211
"-Wcast-qual"

absl/copts/GENERATED_copts.bzl

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,46 @@ ABSL_CLANG_CL_FLAGS = [
1111
"/D_CRT_SECURE_NO_WARNINGS",
1212
"/D_SCL_SECURE_NO_WARNINGS",
1313
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
14+
"-Wmost",
15+
"-Wextra",
16+
"-Wc++98-compat-extra-semi",
17+
"-Wcast-qual",
18+
"-Wconversion",
19+
"-Wdeprecated-pragma",
20+
"-Wfloat-overflow-conversion",
21+
"-Wfloat-zero-conversion",
22+
"-Wfor-loop-analysis",
23+
"-Wformat-security",
24+
"-Wgnu-redeclared-enum",
25+
"-Winfinite-recursion",
26+
"-Winvalid-constexpr",
27+
"-Wliteral-conversion",
28+
"-Wmissing-declarations",
29+
"-Wnullability-completeness",
30+
"-Woverlength-strings",
31+
"-Wpointer-arith",
32+
"-Wself-assign",
33+
"-Wshadow-all",
34+
"-Wshorten-64-to-32",
35+
"-Wsign-conversion",
36+
"-Wstring-conversion",
37+
"-Wtautological-overlap-compare",
38+
"-Wtautological-unsigned-zero-compare",
39+
"-Wthread-safety",
40+
"-Wundef",
41+
"-Wuninitialized",
42+
"-Wunreachable-code",
43+
"-Wunused-comparison",
44+
"-Wunused-local-typedefs",
45+
"-Wunused-result",
46+
"-Wvla",
47+
"-Wwrite-strings",
48+
"-Wno-float-conversion",
49+
"-Wno-implicit-float-conversion",
50+
"-Wno-implicit-int-float-conversion",
51+
"-Wno-unknown-warning-option",
52+
"-Wno-unused-command-line-argument",
53+
"-DNOMINMAX",
1454
]
1555

1656
ABSL_CLANG_CL_TEST_FLAGS = [
@@ -20,6 +60,43 @@ ABSL_CLANG_CL_TEST_FLAGS = [
2060
"/D_CRT_SECURE_NO_WARNINGS",
2161
"/D_SCL_SECURE_NO_WARNINGS",
2262
"/D_ENABLE_EXTENDED_ALIGNED_STORAGE",
63+
"-Wmost",
64+
"-Wextra",
65+
"-Wc++98-compat-extra-semi",
66+
"-Wcast-qual",
67+
"-Wconversion",
68+
"-Wdeprecated-pragma",
69+
"-Wfloat-overflow-conversion",
70+
"-Wfloat-zero-conversion",
71+
"-Wfor-loop-analysis",
72+
"-Wformat-security",
73+
"-Wgnu-redeclared-enum",
74+
"-Winfinite-recursion",
75+
"-Winvalid-constexpr",
76+
"-Wliteral-conversion",
77+
"-Wmissing-declarations",
78+
"-Woverlength-strings",
79+
"-Wpointer-arith",
80+
"-Wself-assign",
81+
"-Wshadow-all",
82+
"-Wstring-conversion",
83+
"-Wtautological-overlap-compare",
84+
"-Wtautological-unsigned-zero-compare",
85+
"-Wthread-safety",
86+
"-Wundef",
87+
"-Wuninitialized",
88+
"-Wunreachable-code",
89+
"-Wunused-comparison",
90+
"-Wunused-local-typedefs",
91+
"-Wunused-result",
92+
"-Wvla",
93+
"-Wwrite-strings",
94+
"-Wno-float-conversion",
95+
"-Wno-implicit-float-conversion",
96+
"-Wno-implicit-int-float-conversion",
97+
"-Wno-unknown-warning-option",
98+
"-Wno-unused-command-line-argument",
99+
"-DNOMINMAX",
23100
"-Wno-deprecated-declarations",
24101
"-Wno-implicit-int-conversion",
25102
"-Wno-missing-prototypes",
@@ -85,6 +162,7 @@ ABSL_GCC_TEST_FLAGS = [
85162

86163
ABSL_LLVM_FLAGS = [
87164
"-Wall",
165+
"-Wmost",
88166
"-Wextra",
89167
"-Wc++98-compat-extra-semi",
90168
"-Wcast-qual",
@@ -128,6 +206,7 @@ ABSL_LLVM_FLAGS = [
128206

129207
ABSL_LLVM_TEST_FLAGS = [
130208
"-Wall",
209+
"-Wmost",
131210
"-Wextra",
132211
"-Wc++98-compat-extra-semi",
133212
"-Wcast-qual",

absl/copts/copts.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@
4141
"-Wno-unused-private-field",
4242
]
4343

44-
ABSL_LLVM_FLAGS = [
45-
"-Wall",
44+
# https://github.com/llvm/llvm-project/issues/102982
45+
# A list of LLVM base flags without -Wall. This is because clang-cl
46+
# translates -Wall to -Weverything on Windows, mimicking MSVCs
47+
# behavior. On most other platforms, -Wall is just a set of very good
48+
# default flags.
49+
ABSL_LLVM_BASE_FLAGS = [
50+
"-Wmost",
4651
"-Wextra",
4752
"-Wc++98-compat-extra-semi",
4853
"-Wcast-qual",
@@ -89,6 +94,8 @@
8994
"-DNOMINMAX",
9095
]
9196

97+
ABSL_LLVM_FLAGS = ["-Wall"] + ABSL_LLVM_BASE_FLAGS
98+
9299
ABSL_LLVM_TEST_ADDITIONAL_FLAGS = [
93100
"-Wno-deprecated-declarations",
94101
"-Wno-implicit-int-conversion",
@@ -164,9 +171,15 @@ def GccStyleFilterAndCombine(default_flags, test_flags):
164171
"ABSL_LLVM_TEST_FLAGS": GccStyleFilterAndCombine(
165172
ABSL_LLVM_FLAGS, ABSL_LLVM_TEST_ADDITIONAL_FLAGS
166173
),
167-
"ABSL_CLANG_CL_FLAGS": MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES,
174+
"ABSL_CLANG_CL_FLAGS": (
175+
MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + ABSL_LLVM_BASE_FLAGS
176+
),
168177
"ABSL_CLANG_CL_TEST_FLAGS": (
169-
MSVC_BIG_WARNING_FLAGS + MSVC_DEFINES + ABSL_LLVM_TEST_ADDITIONAL_FLAGS
178+
MSVC_BIG_WARNING_FLAGS
179+
+ MSVC_DEFINES
180+
+ GccStyleFilterAndCombine(
181+
ABSL_LLVM_BASE_FLAGS, ABSL_LLVM_TEST_ADDITIONAL_FLAGS
182+
)
170183
),
171184
"ABSL_MSVC_FLAGS": (
172185
MSVC_BIG_WARNING_FLAGS + MSVC_WARNING_FLAGS + MSVC_DEFINES

absl/debugging/internal/demangle.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include "absl/base/config.h"
2929
#include "absl/debugging/internal/demangle_rust.h"
3030

31-
#if ABSL_INTERNAL_HAS_CXA_DEMANGLE
31+
#ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
3232
#include <cxxabi.h>
3333
#endif
3434

@@ -2941,7 +2941,7 @@ std::string DemangleString(const char* mangled) {
29412941
std::string out;
29422942
int status = 0;
29432943
char* demangled = nullptr;
2944-
#if ABSL_INTERNAL_HAS_CXA_DEMANGLE
2944+
#ifdef ABSL_INTERNAL_HAS_CXA_DEMANGLE
29452945
demangled = abi::__cxa_demangle(mangled, nullptr, nullptr, &status);
29462946
#endif
29472947
if (status == 0 && demangled != nullptr) {

absl/debugging/stacktrace_test.cc

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,23 @@ TEST(StackTrace, HugeFrame) {
9494
// This is a separate function to avoid inlining.
9595
ABSL_ATTRIBUTE_NOINLINE static void FixupNoFixupEquivalenceNoInline() {
9696
#if !ABSL_HAVE_ATTRIBUTE_WEAK
97-
GTEST_SKIP() << "Need weak symbol support";
98-
#endif
99-
#if defined(__riscv)
100-
GTEST_SKIP() << "Skipping test on RISC-V due to pre-existing failure";
101-
#endif
102-
#if defined(_WIN32)
97+
const char* kSkipReason = "Need weak symbol support";
98+
#elif defined(__riscv)
99+
const char* kSkipReason =
100+
"Skipping test on RISC-V due to pre-existing failure";
101+
#elif defined(_WIN32)
103102
// TODO(b/434184677): Add support for fixups on Windows if needed
104-
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
103+
const char* kSkipReason =
104+
"Skipping test on Windows due to lack of support for fixups";
105+
#else
106+
const char* kSkipReason = nullptr;
105107
#endif
108+
109+
// This conditional is to avoid an unreachable code warning.
110+
if (kSkipReason != nullptr) {
111+
GTEST_SKIP() << kSkipReason;
112+
}
113+
106114
bool can_rely_on_frame_pointers = false;
107115
if (!can_rely_on_frame_pointers) {
108116
GTEST_SKIP() << "Frame pointers are required, but not guaranteed in OSS";
@@ -233,13 +241,20 @@ TEST(StackTrace, FixupNoFixupEquivalence) { FixupNoFixupEquivalenceNoInline(); }
233241

234242
TEST(StackTrace, FixupLowStackUsage) {
235243
#if !ABSL_HAVE_ATTRIBUTE_WEAK
236-
GTEST_SKIP() << "Skipping test on MSVC due to weak symbols";
237-
#endif
238-
#if defined(_WIN32)
244+
const char* kSkipReason = "Skipping test on MSVC due to weak symbols";
245+
#elif defined(_WIN32)
239246
// TODO(b/434184677): Add support for fixups on Windows if needed
240-
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
247+
const char* kSkipReason =
248+
"Skipping test on Windows due to lack of support for fixups";
249+
#else
250+
const char* kSkipReason = nullptr;
241251
#endif
242252

253+
// This conditional is to avoid an unreachable code warning.
254+
if (kSkipReason != nullptr) {
255+
GTEST_SKIP() << kSkipReason;
256+
}
257+
243258
const Cleanup restore_state([enable_fixup = g_enable_fixup,
244259
fixup_calls = g_fixup_calls,
245260
should_fixup_calls = g_should_fixup_calls]() {
@@ -276,13 +291,20 @@ TEST(StackTrace, FixupLowStackUsage) {
276291

277292
TEST(StackTrace, CustomUnwinderPerformsFixup) {
278293
#if !ABSL_HAVE_ATTRIBUTE_WEAK
279-
GTEST_SKIP() << "Need weak symbol support";
280-
#endif
281-
#if defined(_WIN32)
294+
const char* kSkipReason = "Need weak symbol support";
295+
#elif defined(_WIN32)
282296
// TODO(b/434184677): Add support for fixups on Windows if needed
283-
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
297+
const char* kSkipReason =
298+
"Skipping test on Windows due to lack of support for fixups";
299+
#else
300+
const char* kSkipReason = nullptr;
284301
#endif
285302

303+
// This conditional is to avoid an unreachable code warning.
304+
if (kSkipReason != nullptr) {
305+
GTEST_SKIP() << kSkipReason;
306+
}
307+
286308
constexpr int kSkip = 1; // Skip our own frame, whose return PCs won't match
287309
constexpr auto kStackCount = 1;
288310

absl/hash/internal/low_level_hash_test.cc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,13 @@ TEST(LowLevelHashTest, VerifyGolden) {
361361
#if defined(ABSL_IS_BIG_ENDIAN) || !defined(ABSL_HAVE_INTRINSIC_INT128) || \
362362
UINTPTR_MAX != UINT64_MAX
363363
constexpr uint64_t kGolden[kNumGoldenOutputs] = {};
364-
GTEST_SKIP()
365-
<< "We only maintain golden data for little endian 64 bit systems with "
366-
"128 bit intristics.";
364+
// This conditional is to avoid an unreachable code warning.
365+
bool skip = true;
366+
if (skip) {
367+
GTEST_SKIP()
368+
<< "We only maintain golden data for little endian 64 bit systems with "
369+
"128 bit intristics.";
370+
}
367371
#elif defined(__SSE4_2__) && defined(__AES__)
368372
constexpr uint64_t kGolden[kNumGoldenOutputs] = {
369373
0xd6bdb2c9ba5e55f2, 0xffd3e23d4115a8ae, 0x2c3218ef486127de,

0 commit comments

Comments
 (0)