1 /* { dg-do compile } */ 2 /* { dg-require-alias "" } */ 3 /* { dg-require-weak "" } */ 4 /* { dg-options "-fno-common -Waddress" } */ 5 /* { dg-skip-if "" { x86_64-*-mingw* } } */ 6 7 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1a" } } */ 8 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1b" } } */ 9 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1c" } } */ 10 /* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?ffoo1d" } } */ 11 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1e" } } */ 12 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1f" } } */ 13 /* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?ffoo1g" } } */ 14 15 /* test function addresses with __attribute__((weak)) */ 16 17 extern void * ffoo1a (void) __attribute__((weak)); 18 extern void * ffoo1a (void); foo1a(void)19void * foo1a (void) 20 { 21 return (void *)ffoo1a; 22 } 23 24 25 extern void * ffoo1b (void); 26 extern void * ffoo1b (void) __attribute__((weak)); foo1b(void)27void * foo1b (void) 28 { 29 return (void *)ffoo1b; 30 } 31 32 33 extern void * ffoo1c (void); foo1c(void)34void * foo1c (void) 35 { 36 return (void *)ffoo1c; 37 } 38 extern void * ffoo1c (void) __attribute__((weak)); 39 40 41 int ffoo1d (void); 42 int ffoo1d (void) __attribute__((weak)); 43 44 45 extern void * ffoo1e (void); 46 extern void * ffoo1e (void) __attribute__((weak)); foo1e(void)47void * foo1e (void) 48 { 49 if (ffoo1e) 50 ffoo1e (); 51 return 0; 52 } 53 54 55 extern void * ffoo1f (void); foo1f(void)56void * foo1f (void) 57 { 58 if (ffoo1f) /* { dg-warning "" } */ 59 ffoo1f (); 60 return 0; 61 } ffoox1f(void)62void * ffoox1f (void) { return (void *)0; } 63 extern void * ffoo1f (void) __attribute__((weak, alias ("ffoox1f"))); 64 65 66 extern void * ffoo1g (void); ffoox1g(void)67void * ffoox1g (void) { return (void *)0; } 68 extern void * ffoo1g (void) __attribute__((weak, alias ("ffoox1g"))); foo1g(void)69void * foo1g (void) 70 { 71 if (ffoo1g) 72 ffoo1g (); 73 return 0; 74 } 75