r370108 - Diagnose _Bool as a C99 extension.
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 13:33:05 PDT 2019
Author: aaronballman
Date: Tue Aug 27 13:33:05 2019
New Revision: 370108
URL: http://llvm.org/viewvc/llvm-project?rev=370108&view=rev
Log:
Diagnose _Bool as a C99 extension.
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/test/Parser/c99.c
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=370108&r1=370107&r2=370108&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Aug 27 13:33:05 2019
@@ -3777,6 +3777,9 @@ void Parser::ParseDeclarationSpecifiers(
break;
case tok::kw_bool:
case tok::kw__Bool:
+ if (Tok.is(tok::kw__Bool) && !getLangOpts().C99)
+ Diag(Tok, diag::ext_c99_feature) << Tok.getName();
+
if (Tok.is(tok::kw_bool) &&
DS.getTypeSpecType() != DeclSpec::TST_unspecified &&
DS.getStorageClassSpec() == DeclSpec::SCS_typedef) {
Modified: cfe/trunk/test/Parser/c99.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/c99.c?rev=370108&r1=370107&r2=370108&view=diff
==============================================================================
--- cfe/trunk/test/Parser/c99.c (original)
+++ cfe/trunk/test/Parser/c99.c Tue Aug 27 13:33:05 2019
@@ -6,3 +6,6 @@ double _Imaginary foo; // ext-warning {{
// expected-error {{imaginary types are not supported}}
double _Complex bar; // ext-warning {{'_Complex' is a C99 extension}}
+#if !defined(__cplusplus)
+_Bool baz; // ext-warning {{'_Bool' is a C99 extension}}
+#endif
More information about the cfe-commits
mailing list