Hackfix and re-enable strtoull and wcstoull, see bug #3798.
[sdcc.git] / sdcc / support / regression / tcc / 96_nodata_wanted.c
blob95938b5452a53635daa7e89efe54e0542d5e669b
1 /*****************************************************************************/
2 /* test 'nodata_wanted' data output suppression */
4 #if defined test_static_data_error
5 void foo() {
6 if (1) {
7 static short w = (int)&foo; /* initializer not computable */
11 #elif defined test_static_nodata_error
12 void foo() {
13 if (0) {
14 static short w = (int)&foo; /* initializer not computable */
18 #elif defined test_global_data_error
19 void foo();
20 static short w = (int)&foo; /* initializer not computable */
23 #elif defined test_local_data_noerror
24 void foo() {
25 short w = &foo; /* 2 cast warnings */
28 #elif defined test_data_suppression_off || defined test_data_suppression_on
30 #if defined test_data_suppression_on
31 # define SKIP 1
32 #else
33 # define SKIP 0
34 #endif
36 #include <stdio.h>
37 /* some gcc headers #define __attribute__ to empty if it's not gcc */
38 #undef __attribute__
40 int main()
42 __label__ ts0, te0, ts1, te1;
43 int tl, dl;
45 static const char ds0 = 0;
46 static const char de0 = 0;
47 /* get reference size of empty jmp */
48 ts0:;
49 if (!SKIP) {}
50 te0:;
51 dl = -(&de0 - &ds0);
52 tl = -(&&te0 - &&ts0);
54 /* test data and code suppression */
55 static const char ds1 = 0;
56 ts1:;
57 if (!SKIP) {
58 void *p = (void*)&main;
59 char cc[] = "static string";
60 double d = 8.0;
61 struct
62 #ifndef __arm__
63 __attribute__((packed))
64 #endif
66 unsigned x : 12;
67 unsigned char y : 7;
68 unsigned z : 28, a: 4, b: 5;
69 } s = { 0x333,0x44,0x555555,6,7 };
71 printf("data:\n");
72 printf(" %d - %.1f - %.1f - %s - %s\n",
73 sizeof 8.0, 8.0, d, __FUNCTION__, cc);
74 printf(" %x %x %x %x %x\n",
75 s.x, s.y, s.z, s.a, s.b);
77 te1:;
78 static const char de1 = 0;
80 dl += &de1 - &ds1;
81 tl += &&te1 - &&ts1;
82 printf("size of data/text:\n %s/%s\n",
83 dl ? "non-zero":"zero", tl ? "non-zero":"zero");
84 /*printf("# %d/%d\n", dl, tl);*/
87 #elif defined test_static_data
89 #include <stdio.h>
90 int main(int argc, char **argv)
92 goto there;
93 if (0) {
94 static int a = 1;
95 printf("hello\n"); /* the "hello\n" string is still suppressed */
96 there:
97 printf("a = %d\n", a);
99 return 0;
102 #endif