xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/2009-03-09-WeakDeclarations-1.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify %s -triple i686-apple-darwin
2f4a2713aSLionel Sambuc // Insist upon warnings for inappropriate weak attributes.
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // O.K.
5f4a2713aSLionel Sambuc extern int ext_weak_import __attribute__ ((__weak_import__));
6f4a2713aSLionel Sambuc 
7f4a2713aSLionel Sambuc // These are inappropriate, and should generate warnings:
8*0a6a1f1dSLionel Sambuc int decl_weak_import __attribute__ ((__weak_import__)); // expected-warning {{'weak_import' attribute cannot be specified on a definition}}
9*0a6a1f1dSLionel Sambuc int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13; // expected-warning {{'weak_import' attribute cannot be specified on a definition}}
10f4a2713aSLionel Sambuc 
11f4a2713aSLionel Sambuc // O.K.
12f4a2713aSLionel Sambuc extern int ext_f(void) __attribute__ ((__weak_import__));
13f4a2713aSLionel Sambuc 
14f4a2713aSLionel Sambuc // These are inappropriate, and should generate warnings:
15f4a2713aSLionel Sambuc int def_f(void) __attribute__ ((__weak_import__));
decl_f(void)16f4a2713aSLionel Sambuc int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};
17