summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjb <jb@FreeBSD.org>2007-11-20 01:46:12 +0000
committerjb <jb@FreeBSD.org>2007-11-20 01:46:12 +0000
commit9b945d63ed8860abece40483c80cad15edba8186 (patch)
tree28c2499f8e0c74375c826480f57b5d0a4e90add8
parent6c4cd05be50053faf8e34d54658f463bbb1f9779 (diff)
downloadFreeBSD-src-9b945d63ed8860abece40483c80cad15edba8186.zip
FreeBSD-src-9b945d63ed8860abece40483c80cad15edba8186.tar.gz
Generate code that doesn't fail gcc 4.2's strict aliasing test.
-rw-r--r--usr.bin/rpcgen/rpc_cout.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c
index c72edc6..8bbd5d3 100644
--- a/usr.bin/rpcgen/rpc_cout.c
+++ b/usr.bin/rpcgen/rpc_cout.c
@@ -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
OpenPOWER on IntegriCloud