|
Last change
on this file since 3ae2069 was 2853d6f, checked in by Michael Brooks <mlbrooks@…>, 10 months ago |
|
Remove uses of warnings to show test success. Eliminate simple causes of other warnings from affected tests and remove the result from WFLAG_OPT_LAX.
Many affected tests also formerly used -fsyntax-only to avoid errors at later compilation stages, or at runtime. Repair such tests to actually work though runtime, and remove them from SYNTAX_ONLY_CODE.
Group tests listed under WFLAGS_OPT according to why they should receive lax treatment. Add reason WFLGAS_OPT_LAX_EXPECT_WARN and give the original list reason WFLGAS_OPT_LAX_TO_INVESTIGATE.
Tests whose purpose is to show a warning are listed as both SYNTAX_ONLY_CODE (so that the warning is the output) and WFLGAS_OPT_LAX_EXPECT_WARN (to document this fact).
|
-
Property mode
set to
100644
|
|
File size:
1.8 KB
|
| Line | |
|---|
| 1 | //
|
|---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2018 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 | // nested-types.cfa --
|
|---|
| 8 | //
|
|---|
| 9 | // Author : Rob Schluntz
|
|---|
| 10 | // Created On : Mon Jul 9 10:20:03 2018
|
|---|
| 11 | // Last Modified By : Peter A. Buhr
|
|---|
| 12 | // Last Modified On : Sat Jun 5 10:07:42 2021
|
|---|
| 13 | // Update Count : 7
|
|---|
| 14 | //
|
|---|
| 15 |
|
|---|
| 16 | typedef int N;
|
|---|
| 17 | struct A {
|
|---|
| 18 | forall(T)
|
|---|
| 19 | struct N {
|
|---|
| 20 | T x;
|
|---|
| 21 | };
|
|---|
| 22 | };
|
|---|
| 23 |
|
|---|
| 24 | struct S {
|
|---|
| 25 | struct T {
|
|---|
| 26 | int i;
|
|---|
| 27 | typedef int Bar;
|
|---|
| 28 | };
|
|---|
| 29 | T x;
|
|---|
| 30 |
|
|---|
| 31 | // struct U;
|
|---|
| 32 | typedef T Bar;
|
|---|
| 33 | typedef int Baz;
|
|---|
| 34 | };
|
|---|
| 35 |
|
|---|
| 36 | // // // // need a way to stuff a qualified name into a struct decl
|
|---|
| 37 | // // struct S.U {
|
|---|
| 38 | // // double z;
|
|---|
| 39 | // // };
|
|---|
| 40 |
|
|---|
| 41 | // // what will this do?
|
|---|
| 42 | // struct U {
|
|---|
| 43 | // union S {
|
|---|
| 44 | // int i;
|
|---|
| 45 | // double d;
|
|---|
| 46 | // };
|
|---|
| 47 | // };
|
|---|
| 48 |
|
|---|
| 49 | // struct T {
|
|---|
| 50 | // double d;
|
|---|
| 51 | // };
|
|---|
| 52 |
|
|---|
| 53 | // struct S {
|
|---|
| 54 | // enum C { R, G, B };
|
|---|
| 55 | // int i;
|
|---|
| 56 | // struct T {
|
|---|
| 57 | // int i;
|
|---|
| 58 | // };
|
|---|
| 59 | // T t;
|
|---|
| 60 | // };
|
|---|
| 61 |
|
|---|
| 62 | // S s;
|
|---|
| 63 | // S.C c;
|
|---|
| 64 | // S.T t;
|
|---|
| 65 |
|
|---|
| 66 | #pragma GCC diagnostic ignored "-Wunused-variable"
|
|---|
| 67 |
|
|---|
| 68 | int main() {
|
|---|
| 69 | // access nested struct
|
|---|
| 70 | S.T x;
|
|---|
| 71 |
|
|---|
| 72 | {
|
|---|
| 73 | struct S {
|
|---|
| 74 | int i;
|
|---|
| 75 | struct Z {
|
|---|
| 76 | double d;
|
|---|
| 77 | };
|
|---|
| 78 | };
|
|---|
| 79 |
|
|---|
| 80 | S.Z z; // gets local S
|
|---|
| 81 | .S.T y; // lookup at global scope only
|
|---|
| 82 |
|
|---|
| 83 | const volatile .S.T q;
|
|---|
| 84 | #if ERR1
|
|---|
| 85 | T err1; // error: no T in scope
|
|---|
| 86 | #endif
|
|---|
| 87 | #if ERR2
|
|---|
| 88 | .Z err2; // error: no Z in global scope
|
|---|
| 89 | .S.Baz.Bar err3; // error: .S.Baz => int, int is not aggregate and should not appear left of the dot
|
|---|
| 90 | .S.Z err4; // error: no Z in global S
|
|---|
| 91 | #endif
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | // U.S un;
|
|---|
| 95 |
|
|---|
| 96 | S.Bar y;
|
|---|
| 97 | S.Baz w;
|
|---|
| 98 | S.T.Bar z;
|
|---|
| 99 |
|
|---|
| 100 | // A.N(int) x; // xxx - should not be an error, but currently is.
|
|---|
| 101 |
|
|---|
| 102 | printf("done\n");
|
|---|
| 103 | }
|
|---|
| 104 |
|
|---|
| 105 | // Local Variables: //
|
|---|
| 106 | // tab-width: 4 //
|
|---|
| 107 | // compile-command: "cfa nested-types.cfa" //
|
|---|
| 108 | // End: //
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.