From 59469f4248d0a24625c31b4c0582fc05133e03cd Mon Sep 17 00:00:00 2001 From: Kenneth R Westerback Date: Tue, 20 Dec 2016 21:10:30 +0000 Subject: Tweak generated .c output so switch statements always have a 'default:' case. Several hundred "not handled" warnings go away. ok deraadt@ --- usr.bin/rpcgen/rpc_cout.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'usr.bin/rpcgen') 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"); } -- cgit v1.2.3