[qfcc] Make anonstruct test robust against pointer math

I noticed that pointer math is currently incorrect in qfcc, but it would
be nice for fixing it to not break anonstruct since it is testing
something else.
This commit is contained in:
Bill Currie 2020-03-17 12:16:24 +09:00
parent 0d784d9ef4
commit c5400c4581

View file

@ -28,22 +28,22 @@ int main()
{
anon_t anon;
int ret = 0;
if (&anon.snafu != &anon.fizzle) {
if ((int)&anon.snafu != (int)&anon.fizzle) {
printf ("anon union broken: %p %p\n",
&anon.snafu, &anon.fizzle);
ret |= 1;
}
if (&anon.snafu - &anon.baz != 1) {
if ((int)&anon.snafu - (int)&anon.baz != 1) {
printf ("snafu and baz not adjacant: snafu:%p baz:%p\n",
&anon.snafu, &anon.baz);
ret |= 1;
}
if (&anon.baz - &anon.bar != 1) {
if ((int)&anon.baz - (int)&anon.bar != 1) {
printf ("baz and bar not adjacant: baz:%p bar:%p\n",
&anon.baz, &anon.bar);
ret |= 1;
}
if (&anon.bar - &anon.id != 1) {
if ((int)&anon.bar - (int)&anon.id != 1) {
printf ("bar not after id: bar:%p id:%p\n",
&anon.bar, &anon.id);
ret |= 1;