Generate code that doesn't fail gcc 4.2's strict aliasing test.

This commit is contained in:
John Birrell 2007-11-20 01:46:12 +00:00
parent 64b9ee201a
commit 844b78330c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173761

View File

@ -200,11 +200,13 @@ print_ifsizeof(int indent, const char *prefix, const char *type)
}
static void
print_ifclose(int indent)
print_ifclose(int indent, int brace)
{
f_print(fout, "))\n");
tabify(fout, indent);
f_print(fout, "\treturn (FALSE);\n");
if (brace)
f_print(fout, "\t}\n");
}
static void
@ -212,12 +214,16 @@ print_ifstat(int indent, const char *prefix, const char *type, relation rel,
const char *amax, const char *objname, const char *name)
{
const char *alt = NULL;
int brace = 0;
switch (rel) {
case REL_POINTER:
brace = 1;
f_print(fout, "\t{\n");
f_print(fout, "\t%s **pp = %s;\n", type, objname);
print_ifopen(indent, "pointer");
print_ifarg("(char **)");
f_print(fout, "%s", objname);
f_print(fout, "pp");
print_ifsizeof(0, prefix, type);
break;
case REL_VECTOR:
@ -274,7 +280,7 @@ print_ifstat(int indent, const char *prefix, const char *type, relation rel,
print_ifarg(objname);
break;
}
print_ifclose(indent);
print_ifclose(indent, brace);
}
/* ARGSUSED */
@ -283,7 +289,7 @@ emit_enum(definition *def __unused)
{
print_ifopen(1, "enum");
print_ifarg("(enum_t *)objp");
print_ifclose(1);
print_ifclose(1, 0);
}
static void