| Last change
 on this file since 2417 was             1152, checked in by bird, 22 years ago | 
        
          | 
Extended testcase.
 | 
        
          | 
              
Property                 cvs2svn:cvs-rev
 set to                 1.2
Property                 svn:eol-style
 set to                 native
Property                 svn:executable
 set to                 *
Property                 svn:keywords
 set to                 Author Date Id Revision | 
        
          | File size:
            688 bytes | 
      
      
| Line |  | 
|---|
| 1 | /* very simple testcase/experiment for weak symbols. */ | 
|---|
| 2 | extern int bar; | 
|---|
| 3 |  | 
|---|
| 4 | int foo(void) | 
|---|
| 5 | { | 
|---|
| 6 | return 1; | 
|---|
| 7 | } | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 | #pragma weak weak_in_main | 
|---|
| 11 | int weak_in_main(void) | 
|---|
| 12 | { | 
|---|
| 13 | return 3; | 
|---|
| 14 | } | 
|---|
| 15 |  | 
|---|
| 16 | int main() | 
|---|
| 17 | { | 
|---|
| 18 | int i; | 
|---|
| 19 | int cErrors = 0; | 
|---|
| 20 |  | 
|---|
| 21 | i = foo(); | 
|---|
| 22 | if (i != 1) | 
|---|
| 23 | { | 
|---|
| 24 | printf("foo -> %d expected 1\n", i); | 
|---|
| 25 | cErrors++; | 
|---|
| 26 | } | 
|---|
| 27 |  | 
|---|
| 28 | i = doo(); | 
|---|
| 29 | if (i != -2) | 
|---|
| 30 | { | 
|---|
| 31 | printf("doo -> %d expected -2\n", i); | 
|---|
| 32 | cErrors++; | 
|---|
| 33 | } | 
|---|
| 34 |  | 
|---|
| 35 | if (bar != -1) | 
|---|
| 36 | { | 
|---|
| 37 | printf("bar == %d expected -1\n", bar); | 
|---|
| 38 | cErrors++; | 
|---|
| 39 | } | 
|---|
| 40 |  | 
|---|
| 41 | i = weak_in_main(); | 
|---|
| 42 | if (i != -3) | 
|---|
| 43 | { | 
|---|
| 44 | printf("weak_in_main == %d expected -3\n", i); | 
|---|
| 45 | cErrors++; | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 | return cErrors; | 
|---|
| 49 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.