Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only %s |
Daniel Dunbar | 6e775db | 2009-03-06 06:39:57 +0000 | [diff] [blame] | 2 | |
| 3 | extern int g0 __attribute__((weak)); |
| 4 | extern int g1 __attribute__((weak_import)); |
| 5 | int g2 __attribute__((weak)); |
| 6 | int g3 __attribute__((weak_import)); // expected-warning {{'weak_import' attribute cannot be specified on a definition}} |
| 7 | int __attribute__((weak_import)) g4(void); |
Mike Stump | d1969d8 | 2009-07-22 00:43:08 +0000 | [diff] [blame] | 8 | void __attribute__((weak_import)) g5(void) { |
Daniel Dunbar | 6e775db | 2009-03-06 06:39:57 +0000 | [diff] [blame] | 9 | } |
| 10 | |
John McCall | d6b8de0 | 2011-01-25 03:51:08 +0000 | [diff] [blame] | 11 | struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables and functions}} |
| 12 | struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}} |
Daniel Dunbar | 6e775db | 2009-03-06 06:39:57 +0000 | [diff] [blame] | 13 | |
John McCall | 332bb2a | 2011-02-08 22:35:49 +0000 | [diff] [blame] | 14 | static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}} |