aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx0x-attributes.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-01-14 07:53:01 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-01-14 07:53:01 +0000
commitf7a052732c2b6c82f74708038f75fa92c9b4dba0 (patch)
tree9a925c78da81ee4900e67300b509194f5a10b63b /test/Parser/cxx0x-attributes.cpp
parentefaddc0705cfc7c36b76da9ebc33b69843e31996 (diff)
Accept [[gnu::*]] for all __attribute__((*))s which are:
1) Supported by Clang, and 2) Supported by GCC, and 3) Documented in GCC's manual. g++ allows its C++11-style attributes to appertain only to the entity being declared, and never to a type (even for a type attribute), so we do the same. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172382 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/cxx0x-attributes.cpp')
-rw-r--r--test/Parser/cxx0x-attributes.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp
index a1268a8118..dac159a03f 100644
--- a/test/Parser/cxx0x-attributes.cpp
+++ b/test/Parser/cxx0x-attributes.cpp
@@ -247,14 +247,18 @@ enum class __attribute__((visibility("hidden"))) SecretKeepers {
enum class [[]] EvenMoreSecrets {};
namespace arguments {
- // FIXME: remove the sema warnings after migrating existing gnu attributes to c++11 syntax.
- void f(const char*, ...) [[gnu::format(printf, 1, 2)]]; // expected-warning {{unknown attribute 'format' ignored}}
+ void f[[gnu::format(printf, 1, 2)]](const char*, ...);
void g() [[unknown::foo(currently arguments of attributes from unknown namespace other than 'gnu' namespace are ignored... blah...)]]; // expected-warning {{unknown attribute 'foo' ignored}}
}
-// forbid attributes on decl specifiers
+// Forbid attributes on decl specifiers.
unsigned [[gnu::used]] static int [[gnu::unused]] v1; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
expected-error {{an attribute list cannot appear here}}
typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
expected-error {{an attribute list cannot appear here}}
int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-warning 2{{attribute 'carries_dependency' ignored, because it is not attached to a declaration}}
+
+// Forbid [[gnu::...]] attributes on declarator chunks.
+int *[[gnu::unused]] v3; // expected-warning {{attribute 'unused' ignored}}
+int v4[2][[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}}
+int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}}