summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/weak/weak-1.c
blob: 078c3ef36151858b6275ba16471cc0256069abb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* { dg-do compile } */
/* { dg-require-weak "" } */
/* { dg-options "-fno-common" } */

/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?a" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?b" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?c" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?d" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?e" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?g" } } */
/* { dg-final { scan-assembler-not "weak\[^ \t\]*\[ \t\]_?i" } } */
/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?j" } } */

#pragma weak a
int a;

int b;
#pragma weak b

#pragma weak c
extern int c;
int c;

extern int d;
#pragma weak d
int d;

#pragma weak e
void e(void) { }

#if 0
/* This permutation is illegal.  */
void f(void) { }
#pragma weak f
#endif

#pragma weak g
int g = 1;

#if 0
/* This permutation is illegal.  */
int h = 1;
#pragma weak h
#endif

#pragma weak i
extern int i;

#pragma weak j
extern int j;
int use_j() { return j; }