summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp9
-rw-r--r--clang/test/Preprocessor/has_attribute.c10
-rw-r--r--clang/test/Sema/inline.c2
-rw-r--r--clang/test/Sema/unused-expr.c2
4 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 7aef2f1a0e4..ebdb6446d16 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1054,7 +1054,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
if (Tok.is(tok::l_paren)) {
// Read the identifier
Lex(Tok);
- if (Tok.is(tok::identifier)) {
+ if (Tok.is(tok::identifier) || Tok.is(tok::kw_const)) {
FeatureII = Tok.getIdentifierInfo();
// Read the ')'.
@@ -1062,13 +1062,6 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
if (Tok.is(tok::r_paren))
IsValid = true;
}
- else if (Tok.is(tok::kw_const)) {
- FeatureII = getIdentifierInfo("const");
- // Read the ')'.
- Lex(Tok);
- if (Tok.is(tok::r_paren))
- IsValid = true;
- }
}
bool Value = false;
diff --git a/clang/test/Preprocessor/has_attribute.c b/clang/test/Preprocessor/has_attribute.c
index 80f53a52fe3..711cf671cfe 100644
--- a/clang/test/Preprocessor/has_attribute.c
+++ b/clang/test/Preprocessor/has_attribute.c
@@ -24,3 +24,13 @@ int has_has_attribute();
#if !__has_attribute(something_we_dont_have)
int has_something_we_dont_have();
#endif
+
+// rdar://10253857
+#if __has_attribute(__const)
+ int fn3() __attribute__ ((__const));
+#endif
+
+#if __has_attribute(const)
+ static int constFunction() __attribute__((const));
+#endif
+
diff --git a/clang/test/Sema/inline.c b/clang/test/Sema/inline.c
index 6377d40b8f3..c27c00efaad 100644
--- a/clang/test/Sema/inline.c
+++ b/clang/test/Sema/inline.c
@@ -34,9 +34,7 @@ extern inline int useStaticInlineFromExtern () {
return useStaticFromStatic(); // no-warning
}
-#if __has_attribute(const)
static int constFunction() __attribute__((const));
-#endif
inline int useConst () {
return constFunction(); // no-warning
diff --git a/clang/test/Sema/unused-expr.c b/clang/test/Sema/unused-expr.c
index 6081ce651f0..056d09a8713 100644
--- a/clang/test/Sema/unused-expr.c
+++ b/clang/test/Sema/unused-expr.c
@@ -82,9 +82,7 @@ void t5() {
int fn1() __attribute__ ((warn_unused_result));
int fn2() __attribute__ ((pure));
-#if __has_attribute(__const)
int fn3() __attribute__ ((__const));
-#endif
// rdar://6587766
int t6() {
if (fn1() < 0 || fn2(2,1) < 0 || fn3(2) < 0) // no warnings
OpenPOWER on IntegriCloud