Improve static_assert/_Static_assert diagnostics
authorAaron Ballman <aaron@aaronballman.com>
Wed, 3 Mar 2021 13:44:04 +0000 (08:44 -0500)
committerAaron Ballman <aaron@aaronballman.com>
Wed, 3 Mar 2021 13:48:27 +0000 (08:48 -0500)
commit8da090381d567d0ec555840f6b2a651d2997e4b3
tree6e3485d5ce1f12945bec042103b64db527760c75
parent4672bac1776e2245abfd671e208fd56d21cca1ad
Improve static_assert/_Static_assert diagnostics

Our diagnostics relating to static assertions were a bit confused. For
instance, when in MS compatibility mode in C (where we accept
static_assert even without including <assert.h>), we would fail
to warn the user that they were using the wrong spelling (even in
pedantic mode), we were missing a compatibility warning about using
_Static_assert in earlier standards modes, diagnostics for the optional
message were not reflected in C as they were in C++, etc.
clang/include/clang/Basic/DiagnosticGroups.td
clang/include/clang/Basic/DiagnosticParseKinds.td
clang/lib/Lex/PPDirectives.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/test/Parser/static_assert.c [new file with mode: 0644]
clang/test/Preprocessor/static_assert-already-defined.c [new file with mode: 0644]
clang/test/Preprocessor/static_assert.c [new file with mode: 0644]
clang/test/Sema/static-assert.c
clang/test/SemaCXX/static-assert.cpp