source: tests/raii/globals.cfa @ ecaedf35

Last change on this file since ecaedf35 was 107b01a, checked in by Thierry Delisle <tdelisle@…>, 6 years ago

Several changes to the makefiles

  • change .c tests to .cfa
  • add require for libtool in configure
  • libtoolize to fix some warnings
  • Property mode set to 100644
File size: 1.3 KB
RevLine 
[73abe95]1#include <fstream.hfa>
[783dfd6]2
3struct value_t {
4        int value;
5};
6
[2afec66]7void ?{}( value_t & this ) { this.value = 22; }
[783dfd6]8
9//Standard case
10struct g_t {
11        value_t val;
12};
13
[2afec66]14void ?{}( g_t & this ) { (this.val){}; }
[783dfd6]15
16g_t g;
17
18//Autogen case
19struct ga_t {
20        value_t val;
21};
22
23ga_t ga;
24
25//Inline case
26struct gi_t;
[2afec66]27void ?{}( gi_t & this );
[783dfd6]28
29struct gi_t {
30        value_t val;
31} gi;
32
[2afec66]33void ?{}( gi_t & this ) { (this.val){}; }
[783dfd6]34
35//Inline autogen case
36struct gia_t {
37        value_t val;
38} gia;
39
40//Static case
41struct gs_t {
42        value_t val;
43};
44
[2afec66]45void ?{}( gs_t & this ) { (this.val){}; }
[783dfd6]46
47static gs_t gs;
48
49//Static autogen case
50struct gsa_t {
51        value_t val;
52};
53
54static gsa_t gsa;
55
56//Static inline case
57struct gsi_t;
[2afec66]58void ?{}( gsi_t & this );
[783dfd6]59
60static struct gsi_t {
61        value_t val;
62} gsi;
63
[2afec66]64void ?{}( gsi_t & this ) { (this.val){}; }
[783dfd6]65
66//Static inline autogen case
67static struct gsia_t {
68        value_t val;
69} gsia;
70
71int main() {
[200fcb3]72        sout | "static\t\tinline\t\tautogen\t\tvalue";
73
74        sout | "no \t\tno \t\tno \t\t" | g.val.value;
75        sout | "no \t\tno \t\tyes\t\t" | ga.val.value;
76        sout | "no \t\tyes\t\tno \t\t" | gi.val.value;
77        sout | "no \t\tyes\t\tyes\t\t" | gia.val.value;
78        sout | "yes\t\tno \t\tno \t\t" | gs.val.value;
79        sout | "yes\t\tno \t\tyes\t\t" | gsa.val.value;
80        sout | "yes\t\tyes\t\tno \t\t" | gsi.val.value;
81        sout | "yes\t\tyes\t\tyes\t\t" | gsia.val.value;
[783dfd6]82
[23c4aa8]83}
Note: See TracBrowser for help on using the repository browser.