quakeforge/tools/qfcc/test/ptraliasenc.r
Bill Currie dd183d3ba6 [qfcc] Handle signed-unsigned int comparison better
This fixes the upostop-- test by auto-casting implicit constants to
unsigned (and it gives a warning for signed-unsigned comparisons
otherwise). The generated code isn't quite the best, but the fix for
that is next.

Also clean up the resulting mess, though not properly. There are a few
bogus warnings, and the legit ones could do with a review.
2023-12-20 23:09:06 +09:00

32 lines
705 B
R

#include <types.h>
#include "test-harness.h"
typedef int int32_t;
int32_t *int32_ptr;
typedef struct xdef_s {
qfot_type_t *type; ///< pointer to type definition
void *ofs; ///< 32-bit version of ddef_t.ofs
} xdef_t;
typedef struct xdefs_s {
xdef_t *xdefs;
unsigned num_xdefs;
} xdefs_t;
void *PR_FindGlobal (string name) = #0;
int
main (void)
{
//FIXME need a simple way to get at a def's meta-data
xdefs_t *xdefs = PR_FindGlobal (".xdefs");
xdef_t *xdef = xdefs.xdefs;
while (xdef - xdefs.xdefs < (int) xdefs.num_xdefs
&& xdef.ofs != &int32_ptr) {
xdef++;
}
printf ("int32_ptr: %s\n", xdef.type.encoding);
return xdef.type.encoding != "{>^{int32_t>i}}";
}