Last change
on this file since 1187 was 1187, checked in by bird, 22 years ago |
more
|
-
Property cvs2svn:cvs-rev
set to
1.3
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
1.2 KB
|
Line | |
---|
1 | /* test more complex weak stuff. Both weak symbols and weak external symbols. */
|
---|
2 | #include <stdio.h>
|
---|
3 | extern int bar1;
|
---|
4 | extern int bar2;
|
---|
5 | extern int bar3;
|
---|
6 | extern int bar4;
|
---|
7 | extern int bar5;
|
---|
8 | extern int bar6;
|
---|
9 |
|
---|
10 | extern int weak_not_defined(void);
|
---|
11 | #pragma weak weak_not_defined
|
---|
12 |
|
---|
13 | int main()
|
---|
14 | {
|
---|
15 | int i;
|
---|
16 | int cErrors = 0;
|
---|
17 |
|
---|
18 | i = foo();
|
---|
19 | if (i != 1)
|
---|
20 | {
|
---|
21 | printf("foo() returned %d, exepcted 1\n", i);
|
---|
22 | cErrors++;
|
---|
23 | }
|
---|
24 |
|
---|
25 | i = foo3();
|
---|
26 | if (i != 1)
|
---|
27 | {
|
---|
28 | printf("foo3() returned %d, exepcted 1\n", i);
|
---|
29 | cErrors++;
|
---|
30 | }
|
---|
31 |
|
---|
32 | i = foo4();
|
---|
33 | if (i != -1)
|
---|
34 | {
|
---|
35 | printf("foo4() returned %d, exepcted -1\n", i);
|
---|
36 | cErrors++;
|
---|
37 | }
|
---|
38 |
|
---|
39 | i = foo5();
|
---|
40 | if (i != 1)
|
---|
41 | {
|
---|
42 | printf("foo5() returned %d, exepcted 1\n", i);
|
---|
43 | cErrors++;
|
---|
44 | }
|
---|
45 |
|
---|
46 | i = foo6();
|
---|
47 | if (i != 12)
|
---|
48 | {
|
---|
49 | printf("foo6() returned %d, exepcted 12\n", i);
|
---|
50 | cErrors++;
|
---|
51 | }
|
---|
52 |
|
---|
53 | i = bar1 + bar2 + bar3 + bar4 + bar5 + bar6;
|
---|
54 | if (i != 21)
|
---|
55 | {
|
---|
56 | printf("bar sum is %d exepcted 21\n", i);
|
---|
57 | cErrors++;
|
---|
58 | }
|
---|
59 |
|
---|
60 | if (weak_not_defined)
|
---|
61 | {
|
---|
62 | printf("weak_not_defined %#p exepcted NULL\n", weak_not_defined);
|
---|
63 | cErrors++;
|
---|
64 | }
|
---|
65 |
|
---|
66 | return cErrors;
|
---|
67 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.