summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/attr-used.c
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-02-13 19:23:53 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-02-13 19:23:53 +0000
commitfee07a0b47acc2f6d39cf2b809b9daafb4949077 (patch)
tree1f1a752f01e7c6d1e52f8f24912153b0961f75af /clang/test/Sema/attr-used.c
parent29942a349c51efabef98c692425bb4d3fc323987 (diff)
downloadbcm5719-llvm-fee07a0b47acc2f6d39cf2b809b9daafb4949077.tar.gz
bcm5719-llvm-fee07a0b47acc2f6d39cf2b809b9daafb4949077.zip
Sema/AST support for attribute used. Patch by Anders Johnson (with small tweaks & test case)!
llvm-svn: 64478
Diffstat (limited to 'clang/test/Sema/attr-used.c')
-rw-r--r--clang/test/Sema/attr-used.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/test/Sema/attr-used.c b/clang/test/Sema/attr-used.c
new file mode 100644
index 00000000000..7d0265ef323
--- /dev/null
+++ b/clang/test/Sema/attr-used.c
@@ -0,0 +1,17 @@
+// RUN: clang -verify -fsyntax-only %s
+
+struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variable and function types}}
+ int x;
+};
+
+int a __attribute__((used));
+
+static void __attribute__((used)) f0(void) {
+}
+
+void f1() {
+ static int a __attribute__((used));
+ int b __attribute__((used)); // expected-warning {{used attribute ignored}}
+}
+
+
OpenPOWER on IntegriCloud