first version.
[build-srcpkg.git] / src / LangFeatureTesting / abc.c
blobc270c7451e8ca67f3c933be2c48427c5a647af12
3 #include <stdio.h>
5 #define offsetof(v, mbr) ((unsigned int)&((typeof(v) *)0)->mbr)
6 #define V(v, mbr) ( \
7 ( \
8 (typeof(v) *) \
9 ( (unsigned int)&v + offsetof(v, i) ) \
10 )->mbr \
13 typedef struct __tag_ABC {
14 int a, b;
16 int i;
18 int (*pfunc) (void);
19 } ABC;
21 //_Pragma ("GCC error \"[__LINENO__] [__DATE__ __TIME__] xxxxxxxxxxx.\"");
22 //#pragma ();
24 extern int xxx_func (void);
26 int aaa (void), abc_func1 (void);
28 int aaa (void)
30 return 0;
33 int abc_func1 (void)
35 return 0;
38 int xxx_func (void)
40 int abc_func1 (void);
42 int xxx=1;
43 ABC var = {
44 .pfunc = abc_func1,
46 typeof(ABC) x;
48 var.i=123;
50 printf("(unsigned int)&v = %x\n", (unsigned int)&var);
51 printf("offsetof(v, i) = %d\n", offsetof(var, i));
52 printf("var.i = %d\n", V(var, i));
54 printf("xxx = %d\n", xxx);
55 printf("xxx = %d\n", xxx);
56 printf("xxx = %d\n", xxx);
57 printf("xxx = %d\n", xxx);
58 printf("xxx = %d\n", xxx);
59 return 0;