| 
            Last change
 on this file since 2df85ce was             10b5970, checked in by Michael Brooks <mlbrooks@…>, 10 months ago           | 
        
        
          | 
             
Fix many test-suite- and libcfa-caused unused variable warnings. 
 
In scope are easy fixes among tests whose sole warnings were unused variable.  Reduces the wflags lax list by 40%. 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.3 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [02fa55e] | 1 | #include <select.hfa>
 | 
|---|
 | 2 | #include <thread.hfa>
 | 
|---|
 | 3 | #include <channel.hfa>
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | channel(long long int) A, B, C;
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | volatile bool done = false;
 | 
|---|
 | 8 | long long int globalTotal = 0;
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | thread Server1 {};
 | 
|---|
| [10b5970] | 11 | void main( Server1 & ) {
 | 
|---|
| [02fa55e] | 12 |     long long int a, b, c, i = 0, myTotal = 0;
 | 
|---|
 | 13 |     for( ;;i++ ) {
 | 
|---|
 | 14 |         // printf("loop S\n");
 | 
|---|
 | 15 |         waituntil( a << A ) { myTotal += a; }
 | 
|---|
 | 16 |         or waituntil( b << B ) { myTotal += b; }
 | 
|---|
 | 17 |         or waituntil( c << C ) { if ( c == -1 ) break; myTotal += c; }
 | 
|---|
 | 18 |     }
 | 
|---|
 | 19 |     __atomic_fetch_add( &globalTotal, myTotal, __ATOMIC_SEQ_CST );
 | 
|---|
 | 20 | }
 | 
|---|
 | 21 | 
 | 
|---|
 | 22 | size_t numtimes = 100000;
 | 
|---|
 | 23 | size_t numServers = 1;
 | 
|---|
 | 24 | int main( int argc, char * argv[] ) {
 | 
|---|
 | 25 |     if ( argc == 2 )
 | 
|---|
 | 26 |         numtimes = atoi( argv[1] );
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 |     processor p[numServers];
 | 
|---|
 | 29 |     A{0};
 | 
|---|
 | 30 |     B{0};
 | 
|---|
 | 31 |     C{0};
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 |     long long int total = 0;
 | 
|---|
 | 34 |     printf("start\n");
 | 
|---|
 | 35 |     {
 | 
|---|
 | 36 |         Server1 s[numServers];
 | 
|---|
 | 37 |         for( long long int j = 0; j < numtimes; j++ ) {
 | 
|---|
 | 38 |             // printf("loop\n");
 | 
|---|
| [cb344f7] | 39 |             waituntil( A << j ) { total += j; }
 | 
|---|
 | 40 |             or waituntil( B << j ) { total += j; }
 | 
|---|
 | 41 |             or waituntil( C << j ) { total += j; }
 | 
|---|
| [02fa55e] | 42 |         }
 | 
|---|
 | 43 |         printf("sending sentinels\n");
 | 
|---|
 | 44 |         for ( i; numServers ) insert( C, -1 );
 | 
|---|
 | 45 |         printf("joining servers\n");
 | 
|---|
 | 46 |     }
 | 
|---|
 | 47 |     if ( total != globalTotal ) 
 | 
|---|
 | 48 |         printf("CHECKSUM MISMATCH!! Main thread got %lld, server sum is %lld\n", total, globalTotal);
 | 
|---|
 | 49 |     printf("done\n");
 | 
|---|
 | 50 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.