summaryrefslogtreecommitdiff
path: root/test/FrontendC/2009-03-09-WeakDeclarations-1.c
diff options
context:
space:
mode:
authorStuart Hastings <stuart@apple.com>2009-03-10 00:17:39 +0000
committerStuart Hastings <stuart@apple.com>2009-03-10 00:17:39 +0000
commit1f2f31493e8bc97cdb9a9ff36c788503aec5718d (patch)
tree79e2fdd2f6c2096c29f3edba0854928b8fc332f9 /test/FrontendC/2009-03-09-WeakDeclarations-1.c
parentad93e1e5fc407f460278990626b7b5577f1262bd (diff)
downloadllvm-1f2f31493e8bc97cdb9a9ff36c788503aec5718d.tar.gz
llvm-1f2f31493e8bc97cdb9a9ff36c788503aec5718d.tar.bz2
llvm-1f2f31493e8bc97cdb9a9ff36c788503aec5718d.tar.xz
Check for warnings about inappropriate weak_imports.
Darwin-specific; marked XFAIL for others. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66514 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FrontendC/2009-03-09-WeakDeclarations-1.c')
-rw-r--r--test/FrontendC/2009-03-09-WeakDeclarations-1.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/FrontendC/2009-03-09-WeakDeclarations-1.c b/test/FrontendC/2009-03-09-WeakDeclarations-1.c
new file mode 100644
index 0000000000..a0b7efbfef
--- /dev/null
+++ b/test/FrontendC/2009-03-09-WeakDeclarations-1.c
@@ -0,0 +1,22 @@
+// RUN: $llvmgcc $test -c -o /dev/null |& \
+// RUN: egrep {(14|15|22): warning:} | \
+// RUN: wc -l | grep --quiet 3
+// TARGET: *-*-darwin
+// XFAIL: alpha|ia64|sparc
+// END.
+// Insist upon warnings for inappropriate weak attributes.
+// Note the line numbers (14|15|22) embedded in the check.
+
+// O.K.
+extern int ext_weak_import __attribute__ ((__weak_import__));
+
+// These are inappropriate, and should generate warnings:
+int decl_weak_import __attribute__ ((__weak_import__));
+int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13;
+
+// O.K.
+extern int ext_f(void) __attribute__ ((__weak_import__));
+
+// These are inappropriate, and should generate warnings:
+int def_f(void) __attribute__ ((__weak_import__));
+int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};