1 /* { dg-do compile } */
2 /* { dg-require-alias "" } */
3 /* { dg-require-weak "" } */
4 /* { dg-options "-fno-common" } */
6 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */
7 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */
8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1c" } } */
9 /* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?ffoo1d" } } */
10 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1e" } } */
11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1f" } } */
12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1g" } } */
14 /* test function addresses with __attribute__((weak)) */
16 extern void * ffoo1a (void) __attribute__((weak
));
17 extern void * ffoo1a (void);
20 return (void *)ffoo1a
;
24 extern void * ffoo1b (void);
25 extern void * ffoo1b (void) __attribute__((weak
));
28 return (void *)ffoo1b
;
32 extern void * ffoo1c (void);
35 return (void *)ffoo1c
;
37 extern void * ffoo1c (void) __attribute__((weak
)); /* { dg-warning "weak declaration" "weak declaration" } */
41 int ffoo1d (void) __attribute__((weak
));
44 extern void * ffoo1e (void);
45 extern void * ffoo1e (void) __attribute__((weak
));
54 extern void * ffoo1f (void);
57 if (ffoo1f
) /* { dg-warning "" } */
61 void * ffoox1f (void) { return (void *)0; }
62 extern void * ffoo1f (void) __attribute__((weak
, alias ("ffoox1f"))); /* { dg-warning "weak declaration" "weak declaration" } */
65 extern void * ffoo1g (void);
66 void * ffoox1g (void) { return (void *)0; }
67 extern void * ffoo1g (void) __attribute__((weak
, alias ("ffoox1g")));