summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2019-08-27 20:33:05 +0000
committerAaron Ballman <aaron@aaronballman.com>2019-08-27 20:33:05 +0000
commitae3841677ef28ba80dc30d74e32a33bf3f6dde8c (patch)
treeacd0af73dd3003bb411007d837a7bf29d5695c3d
parent3ad1e6c06900802ec30dab5faede486ba07e9387 (diff)
downloadclang-ae3841677ef28ba80dc30d74e32a33bf3f6dde8c.tar.gz
Diagnose _Bool as a C99 extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370108 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseDecl.cpp3
-rw-r--r--test/Parser/c99.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 6c3b6d6e62..c4c5045d2f 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -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) {
diff --git a/test/Parser/c99.c b/test/Parser/c99.c
index 3828f2057a..1213a20b6e 100644
--- a/test/Parser/c99.c
+++ b/test/Parser/c99.c
@@ -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