Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20030714-1.c
blobee13dc1573d60a6b27e4706f7a22cb201e3c3beb
1 /*
2 20030714-1.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // pdk needs functions called via pointer to be reentrant even for a single argument
12 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5))
13 /* derived from PR optimization/11440 */
15 typedef _Bool bool;
16 const bool false = 0;
17 const bool true = 1;
19 enum EPosition
21 STATIC, RELATIVE, ABSOLUTE, FIXED
23 typedef enum EPosition EPosition;
25 enum EFloat
27 FNONE = 0, FLEFT, FRIGHT
29 typedef enum EFloat EFloat;
31 struct RenderBox
33 int unused[6];
34 short m_verticalPosition;
36 bool m_layouted : 1;
37 bool m_unused : 1;
38 bool m_minMaxKnown : 1;
39 bool m_floating : 1;
41 bool m_positioned : 1;
42 bool m_overhangingContents : 1;
43 bool m_relPositioned : 1;
44 bool m_paintSpecial : 1;
46 bool m_isAnonymous : 1;
47 bool m_recalcMinMax : 1;
48 bool m_isText : 1;
49 bool m_inline : 1;
51 bool m_replaced : 1;
52 bool m_mouseInside : 1;
53 bool m_hasFirstLine : 1;
54 bool m_isSelectionBorder : 1;
56 bool (*isTableCell) (struct RenderBox *this);
59 typedef struct RenderBox RenderBox;
61 struct RenderStyle
63 struct NonInheritedFlags
65 union
67 struct
69 unsigned int _display : 4;
70 unsigned int _bg_repeat : 2;
71 bool _bg_attachment : 1;
72 unsigned int _overflow : 4 ;
73 unsigned int _vertical_align : 4;
74 unsigned int _clear : 2;
75 EPosition _position : 2;
76 EFloat _floating : 2;
77 unsigned int _table_layout : 1;
78 bool _flowAroundFloats :1;
80 unsigned int _styleType : 3;
81 bool _hasHover : 1;
82 bool _hasActive : 1;
83 bool _clipSpecified : 1;
84 unsigned int _unicodeBidi : 2;
85 int _unused : 1;
86 } f;
87 int _niflags;
89 } noninherited_flags;
92 typedef struct RenderStyle RenderStyle;
94 extern void RenderObject_setStyle(RenderBox *this, RenderStyle *_style);
95 extern void removeFromSpecialObjects(RenderBox *this);
99 void RenderBox_setStyle(RenderBox *thisin, RenderStyle *_style)
101 RenderBox *this = thisin;
102 bool oldpos, tmp;
103 EPosition tmppo;
105 tmp = this->m_positioned;
107 oldpos = tmp;
109 RenderObject_setStyle(this, _style);
111 tmppo = _style->noninherited_flags.f._position;
113 switch(tmppo)
115 case ABSOLUTE:
116 case FIXED:
118 bool ltrue = true;
119 this->m_positioned = ltrue;
120 break;
123 default:
125 EFloat tmpf;
126 EPosition tmpp;
127 if (oldpos)
129 bool ltrue = true;
130 this->m_positioned = ltrue;
131 removeFromSpecialObjects(this);
134 bool lfalse = false;
135 this->m_positioned = lfalse;
138 tmpf = _style->noninherited_flags.f._floating;
140 if(!this->isTableCell (this) && !(tmpf == FNONE))
142 bool ltrue = true;
143 this->m_floating = ltrue;
145 else
147 tmpp = _style->noninherited_flags.f._position;
148 if (tmpp == RELATIVE)
150 bool ltrue = true;
151 this->m_relPositioned = ltrue;
161 RenderBox g_this;
162 RenderStyle g__style;
164 void RenderObject_setStyle(RenderBox *this, RenderStyle *_style)
166 (void) this;
167 (void) _style;
170 void removeFromSpecialObjects(RenderBox *this)
172 (void) this;
175 bool RenderBox_isTableCell (RenderBox *this)
177 (void) this;
178 return false;
180 #endif
181 #endif
183 void
184 testTortureExecute (void)
186 #ifndef __SDCC_pic16
187 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15)
188 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5))
189 g_this.m_relPositioned = false;
190 g_this.m_positioned = false;
191 g_this.m_floating = false;
192 g_this.isTableCell = RenderBox_isTableCell;
194 g__style.noninherited_flags.f._position = FIXED;
195 g__style.noninherited_flags.f._floating = FNONE;
197 RenderBox_setStyle (&g_this, &g__style);
199 if (g_this.m_positioned != true)
200 ASSERT (0);
201 if (g_this.m_relPositioned != false)
202 ASSERT (0);
203 if (g_this.m_floating != false)
204 ASSERT (0);
206 return;
207 #endif
208 #endif
209 #endif