Enable clang-specific warnings on the clang-cl build

instead of just trying to be MSVC

This also fixes the new warnings that are caught.
These include:
  * Unreachable code after GTEST_SKIP (this is kind of ugly)
  * Some -Wundef warnings
  * A -Wshadow warning in vlog_config.cc

PiperOrigin-RevId: 838046186
Change-Id: Ief48d6db2b8755d2173997d052560880593d5819
This commit is contained in:
Abseil Team
2025-11-29 01:21:44 -08:00
committed by Copybara-Service
parent b20370e0d6
commit 9f40d6d6f3
9 changed files with 48 additions and 248 deletions

View File

@@ -94,23 +94,15 @@ TEST(StackTrace, HugeFrame) {
// This is a separate function to avoid inlining.
ABSL_ATTRIBUTE_NOINLINE static void FixupNoFixupEquivalenceNoInline() {
#if !ABSL_HAVE_ATTRIBUTE_WEAK
const char* kSkipReason = "Need weak symbol support";
#elif defined(__riscv)
const char* kSkipReason =
"Skipping test on RISC-V due to pre-existing failure";
#elif defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
const char* kSkipReason =
"Skipping test on Windows due to lack of support for fixups";
#else
const char* kSkipReason = nullptr;
GTEST_SKIP() << "Need weak symbol support";
#endif
#if defined(__riscv)
GTEST_SKIP() << "Skipping test on RISC-V due to pre-existing failure";
#endif
#if defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
#endif
// This conditional is to avoid an unreachable code warning.
if (kSkipReason != nullptr) {
GTEST_SKIP() << kSkipReason;
}
bool can_rely_on_frame_pointers = false;
if (!can_rely_on_frame_pointers) {
GTEST_SKIP() << "Frame pointers are required, but not guaranteed in OSS";
@@ -241,19 +233,12 @@ TEST(StackTrace, FixupNoFixupEquivalence) { FixupNoFixupEquivalenceNoInline(); }
TEST(StackTrace, FixupLowStackUsage) {
#if !ABSL_HAVE_ATTRIBUTE_WEAK
const char* kSkipReason = "Skipping test on MSVC due to weak symbols";
#elif defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
const char* kSkipReason =
"Skipping test on Windows due to lack of support for fixups";
#else
const char* kSkipReason = nullptr;
GTEST_SKIP() << "Skipping test on MSVC due to weak symbols";
#endif
#if defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
#endif
// This conditional is to avoid an unreachable code warning.
if (kSkipReason != nullptr) {
GTEST_SKIP() << kSkipReason;
}
const Cleanup restore_state([enable_fixup = g_enable_fixup,
fixup_calls = g_fixup_calls,
@@ -291,19 +276,12 @@ TEST(StackTrace, FixupLowStackUsage) {
TEST(StackTrace, CustomUnwinderPerformsFixup) {
#if !ABSL_HAVE_ATTRIBUTE_WEAK
const char* kSkipReason = "Need weak symbol support";
#elif defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
const char* kSkipReason =
"Skipping test on Windows due to lack of support for fixups";
#else
const char* kSkipReason = nullptr;
GTEST_SKIP() << "Need weak symbol support";
#endif
#if defined(_WIN32)
// TODO(b/434184677): Add support for fixups on Windows if needed
GTEST_SKIP() << "Skipping test on Windows due to lack of support for fixups";
#endif
// This conditional is to avoid an unreachable code warning.
if (kSkipReason != nullptr) {
GTEST_SKIP() << kSkipReason;
}
constexpr int kSkip = 1; // Skip our own frame, whose return PCs won't match
constexpr auto kStackCount = 1;