File: struct.c

package info (click to toggle)
sdcc 4.5.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 112,804 kB
  • sloc: ansic: 622,685; cpp: 259,454; makefile: 81,253; sh: 40,203; asm: 19,222; perl: 12,139; yacc: 7,761; awk: 3,378; lisp: 1,677; python: 1,097; lex: 1,028; sed: 76
file content (137 lines) | stat: -rw-r--r-- 1,836 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137

#ifdef TEST1
struct tag {
  int good1;
  register int bad;	/* ERROR */
  int good2;
} badstruct;		/* IGNORE */
#endif

#ifdef TEST2
struct tag {
  int good1;
  int bad;	/* IGNORE */
  int bad;	/* ERROR */
  int good2;
} badstruct;
#endif

#ifdef TEST3a
struct tag {
  int good1;
  int bad:255;	/* ERROR */
  int good2;
} badstruct;
#endif

#ifdef TEST3b
struct tag {
  int good1;
  float badtype1 : 5; /* ERROR */
  int good2;
  _Bool badwidth2 : 2; /* ERROR */
  int good3;
  int badwidth2 : 17; /* ERROR */
  int good4;
} badstruct;
#endif

#ifdef TEST4
struct tag {
  int good1;
  int good2;
} goodstruct1;

struct tag goodstruct2;
#endif

#ifdef TEST5a
struct tag {
  int good1;
  int good2;
} goodstruct1;

union tag badunion;	/* ERROR */
#endif

#ifdef TEST5b
union tag {
  int good1;
  int good2;
} goodunion1;

struct tag badstruct;	/* ERROR */
#endif


#ifdef TEST6
struct linklist {
  struct linklist *prev;
  struct linklist *next;
  int x;
} ll;
#endif

#ifdef TEST7a
union tag {
  struct tag *next;	/* ERROR */
  int x;
} ll;
#endif

#ifdef TEST7b
struct tag {
  union tag *next;	/* ERROR */
  int x;
} ll;
#endif

#ifdef TEST8a
struct tag {
  int a;		/* IGNORE */
  struct {
    int a;		/* ERROR(SDCC) */ /* IGNORE(GCC) */
    int b;
  };
} ll;  
#endif

#ifdef TEST8b
struct tag {
  int a;
  struct {
    int b;
    int c;
  };
} ll;  

void test(void)
{
  ll.a = 1;
  ll.b = 2;
  ll.c = 3;
}

#endif

/* bug 3086: SDCC had infinite loop on this error */
#ifdef TEST9
struct tag1 {
  union {
    struct tag2;	/* ERROR(SDCC) */ /* IGNORE(GCC) */
  } tag3;		/* IGNORE */
};
#endif

// C23 allows multiple compatible definitions for struct.
#ifdef TEST10
#ifdef __SDCC
#pragma std_c23
#endif

struct A {int x; int y;}; /* IGNORE */
struct A {int x; int y;}; /* IGNORE(GCC) */
struct A {int x; int z;}; /* ERROR */

#endif