]> granicus.if.org Git - clang/commitdiff
Diagnose _Bool as a C99 extension.
authorAaron Ballman <aaron@aaronballman.com>
Tue, 27 Aug 2019 20:33:05 +0000 (20:33 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Tue, 27 Aug 2019 20:33:05 +0000 (20:33 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370108 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseDecl.cpp
test/Parser/c99.c

index 6c3b6d6e62ad9ac1847d7029fcc33908e2a870cd..c4c5045d2feedfde85b4a98d63e2426ebd60b912 100644 (file)
@@ -3777,6 +3777,9 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS,
       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) {
index 3828f2057a3db5a42058167380fc7e42e3101bc8..1213a20b6e8ea0c2b3f8fcc429902b545fa65b6b 100644 (file)
@@ -6,3 +6,6 @@ double _Imaginary foo; // ext-warning {{'_Imaginary' is a C99 extension}} \
                        // 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