[llvm-commits] [llvm] r66514 - /llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c
Stuart Hastings
stuart at apple.com
Mon Mar 9 17:17:39 PDT 2009
Author: stuart
Date: Mon Mar 9 19:17:39 2009
New Revision: 66514
URL: http://llvm.org/viewvc/llvm-project?rev=66514&view=rev
Log:
Check for warnings about inappropriate weak_imports.
Darwin-specific; marked XFAIL for others.
Added:
llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c
Added: llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c?rev=66514&view=auto
==============================================================================
--- llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c (added)
+++ llvm/trunk/test/FrontendC/2009-03-09-WeakDeclarations-1.c Mon Mar 9 19:17:39 2009
@@ -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;};
More information about the llvm-commits
mailing list