diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-12-20 21:10:30 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-12-20 21:10:30 +0000 |
commit | 59469f4248d0a24625c31b4c0582fc05133e03cd (patch) | |
tree | 0a7c807e85a67b091a46dcbbdcab82288d085d54 /usr.bin/rpcgen | |
parent | be3672895c4ea67cfb9d4ccaee5db4c56f73d91c (diff) |
Tweak generated .c output so switch statements always have a
'default:' case.
Several hundred "not handled" warnings go away.
ok deraadt@
Diffstat (limited to 'usr.bin/rpcgen')
-rw-r--r-- | usr.bin/rpcgen/rpc_cout.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.bin/rpcgen/rpc_cout.c b/usr.bin/rpcgen/rpc_cout.c index 1a04f04fa67..0a76c95d791 100644 --- a/usr.bin/rpcgen/rpc_cout.c +++ b/usr.bin/rpcgen/rpc_cout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc_cout.c,v 1.25 2015/08/20 22:32:41 deraadt Exp $ */ +/* $OpenBSD: rpc_cout.c,v 1.26 2016/12/20 21:10:29 krw Exp $ */ /* $NetBSD: rpc_cout.c,v 1.6 1996/10/01 04:13:53 cgd Exp $ */ /* @@ -374,12 +374,12 @@ emit_union(def) fprintf(fout, "\t\tbreak;\n"); } dflt = def->def.un.default_decl; + fprintf(fout, "\tdefault:\n"); if (dflt != NULL) { if (!streq(dflt->type, "void")) { int len = strlen(def->def_name) + strlen(format) + strlen(dflt->name) + 1; - fprintf(fout, "\tdefault:\n"); object = malloc(len); if (object == NULL) { fprintf(stderr, "Fatal error: no memory\n"); @@ -396,10 +396,9 @@ emit_union(def) print_ifstat(2, dflt->prefix, dflt->type, dflt->rel, dflt->array_max, object, dflt->name); free(object); - fprintf(fout, "\t\tbreak;\n"); } + fprintf(fout, "\t\tbreak;\n"); } else { - fprintf(fout, "\tdefault:\n"); fprintf(fout, "\t\treturn (FALSE);\n"); } |