source: branches/libc-0.6/testcase/weak/weak2-main.c@ 2492

Last change on this file since 2492 was 1191, checked in by bird, 22 years ago

more/fixed.

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