blob: 41c9fd7165abe72e7ba36dd600ba9e83928c5d8b [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -verify -fsyntax-only %s
Daniel Dunbar6e775db2009-03-06 06:39:57 +00002
3extern int g0 __attribute__((weak));
4extern int g1 __attribute__((weak_import));
5int g2 __attribute__((weak));
6int g3 __attribute__((weak_import)); // expected-warning {{'weak_import' attribute cannot be specified on a definition}}
7int __attribute__((weak_import)) g4(void);
Mike Stumpd1969d82009-07-22 00:43:08 +00008void __attribute__((weak_import)) g5(void) {
Daniel Dunbar6e775db2009-03-06 06:39:57 +00009}
10
John McCalld6b8de02011-01-25 03:51:08 +000011struct __attribute__((weak)) s0 {}; // expected-warning {{'weak' attribute only applies to variables and functions}}
12struct __attribute__((weak_import)) s1 {}; // expected-warning {{'weak_import' attribute only applies to variables and functions}}
Daniel Dunbar6e775db2009-03-06 06:39:57 +000013
John McCall332bb2a2011-02-08 22:35:49 +000014static int x __attribute__((weak)); // expected-error {{weak declaration cannot have internal linkage}}