aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2025-05-02 12:23:40 -0400
committerGitHub <noreply@github.com>2025-05-02 12:23:40 -0400
commita635bbf1418e351651ed86230eab3d13f871f971 (patch)
tree919a59aa1b7aa0f07540030b5de3c8cf4b43379c /clang/lib/Sema/Sema.cpp
parent58addfbbcc520d925e93f33b2c68dcf657496828 (diff)
downloadllvm-a635bbf1418e351651ed86230eab3d13f871f971.zip
llvm-a635bbf1418e351651ed86230eab3d13f871f971.tar.gz
llvm-a635bbf1418e351651ed86230eab3d13f871f971.tar.bz2
[C] Update the -Wdefault-const-init-unsafe wording (#138266)
This drops the "and is incompatible with C++" phrasing from the diagnostic unless -Wc++-compat is explicitly passed. This makes the diagnostic less confusing when it is on by default rather than enabled because of C++ compatibility concerns
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index b9d33d6..1901d19 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -1457,7 +1457,12 @@ void Sema::ActOnEndOfTranslationUnit() {
if (VD->getStorageDuration() == SD_Static ||
VD->getStorageDuration() == SD_Thread)
DiagID = diag::warn_default_init_const;
- Diag(VD->getLocation(), DiagID) << Type;
+
+ bool EmitCppCompat = !Diags.isIgnored(
+ diag::warn_cxx_compat_hack_fake_diagnostic_do_not_emit,
+ VD->getLocation());
+
+ Diag(VD->getLocation(), DiagID) << Type << EmitCppCompat;
}
// Notify the consumer that we've completed a tentative definition.