|
Last change
on this file since bb85f76 was 641707d, checked in by Andrew Beach <ajbeach@…>, 9 months ago |
|
More fixing of warnings. Including another error that slipped through to the build and the rest of the 'easy' fixes on tests not in a directory.
|
-
Property mode
set to
100644
|
|
File size:
1.2 KB
|
| Line | |
|---|
| 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
|
|---|
| 3 | //
|
|---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
|---|
| 5 | // file "LICENCE" distributed with Cforall.
|
|---|
| 6 | //
|
|---|
| 7 | // shortCircuit.cfa --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Peter A. Buhr
|
|---|
| 10 | // Created On : Thu Jan 28 18:26:16 2016
|
|---|
| 11 | // Last Modified By : Peter A. Buhr
|
|---|
| 12 | // Last Modified On : Tue Dec 4 18:26:05 2018
|
|---|
| 13 | // Update Count : 4
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | void g( float ) {}
|
|---|
| 17 | void g( int ) {}
|
|---|
| 18 |
|
|---|
| 19 | void f( int a ) {
|
|---|
| 20 | int b = 0;
|
|---|
| 21 | float c = 0;
|
|---|
| 22 | g( a ? b : c );
|
|---|
| 23 | g( a && c );
|
|---|
| 24 | g( a || b );
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | void g() {
|
|---|
| 28 | int a = 1;
|
|---|
| 29 | struct Int { int b; } a = { 0 };
|
|---|
| 30 | if ( a ) {
|
|---|
| 31 | while ( a ) {
|
|---|
| 32 | int *b;
|
|---|
| 33 | for ( b; a; b ) {
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 | // This should never be resolved to.
|
|---|
| 38 | (void)(Int)a;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | #include <fstream.hfa>
|
|---|
| 42 |
|
|---|
| 43 | struct test_t {
|
|---|
| 44 | int x;
|
|---|
| 45 | };
|
|---|
| 46 |
|
|---|
| 47 | int ?!=?( test_t lhs, zero_t ) {
|
|---|
| 48 | sout | lhs.x | " ";
|
|---|
| 49 | return lhs.x != 0;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | int main() {
|
|---|
| 53 | sout | nlOff;
|
|---|
| 54 | test_t true_val, false_val;
|
|---|
| 55 | true_val.x = 1;
|
|---|
| 56 | false_val.x = 0;
|
|---|
| 57 |
|
|---|
| 58 | true_val && false_val;
|
|---|
| 59 | sout | nl;
|
|---|
| 60 |
|
|---|
| 61 | true_val || false_val;
|
|---|
| 62 | sout | nl;
|
|---|
| 63 |
|
|---|
| 64 | false_val && true_val;
|
|---|
| 65 | sout | nl;
|
|---|
| 66 |
|
|---|
| 67 | false_val || true_val;
|
|---|
| 68 | sout | nl;
|
|---|
| 69 |
|
|---|
| 70 | return 0;
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | // Local Variables: //
|
|---|
| 74 | // tab-width: 4 //
|
|---|
| 75 | // compile-command: "cfa abs.cfa" //
|
|---|
| 76 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.