Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rpcgen Polish the error messages.



details:   https://anonhg.NetBSD.org/src/rev/1b55d587b151
branches:  trunk
changeset: 338089:1b55d587b151
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat May 09 23:12:57 2015 +0000

description:
Polish the error messages.

Don't use warn/err to print error messages about the input, as
prepending the program name to those both isn't helpful and confuses
programs that try to parse compile logs.

diffstat:

 usr.bin/rpcgen/rpc_cout.c  |   8 ++++----
 usr.bin/rpcgen/rpc_hout.c  |   6 +++---
 usr.bin/rpcgen/rpc_main.c  |  16 ++++++++--------
 usr.bin/rpcgen/rpc_parse.c |  34 +++++++++++++++++-----------------
 usr.bin/rpcgen/rpc_scan.c  |  18 +++++++++---------
 usr.bin/rpcgen/rpc_util.c  |  15 ++++++++-------
 6 files changed, 49 insertions(+), 48 deletions(-)

diffs (truncated from 414 to 300 lines):

diff -r cf6a07f1edad -r 1b55d587b151 usr.bin/rpcgen/rpc_cout.c
--- a/usr.bin/rpcgen/rpc_cout.c Sat May 09 22:58:22 2015 +0000
+++ b/usr.bin/rpcgen/rpc_cout.c Sat May 09 23:12:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $   */
+/*     $NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $   */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_cout.c,v 1.33 2013/12/15 00:40:17 christos Exp $");
+__RCSID("$NetBSD: rpc_cout.c,v 1.34 2015/05/09 23:12:57 dholland Exp $");
 #endif
 #endif
 
@@ -112,7 +112,7 @@
                break;
        case DEF_PROGRAM:
        case DEF_CONST:
-               errx(1, "Internal error %s, %d: Case %d not handled",
+               errx(1, "Internal error at %s:%d: Case %d not handled",
                    __FILE__, __LINE__, def->def_kind);
                break;
        }
@@ -660,7 +660,7 @@
                break;
        case REL_ARRAY:
        case REL_POINTER:
-               errx(1, "Internal error %s, %d: Case %d not handled",
+               errx(1, "Internal error at %s:%d: Case %d not handled",
                    __FILE__, __LINE__, decl->rel);
        }
 }
diff -r cf6a07f1edad -r 1b55d587b151 usr.bin/rpcgen/rpc_hout.c
--- a/usr.bin/rpcgen/rpc_hout.c Sat May 09 22:58:22 2015 +0000
+++ b/usr.bin/rpcgen/rpc_hout.c Sat May 09 23:12:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $   */
+/*     $NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $   */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_hout.c 1.12 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_hout.c,v 1.22 2013/12/15 00:40:17 christos Exp $");
+__RCSID("$NetBSD: rpc_hout.c,v 1.23 2015/05/09 23:12:57 dholland Exp $");
 #endif
 #endif
 
@@ -281,7 +281,7 @@
                                }
                }
        }
-       errx(1, "Internal error %s, %d: procedure not found",
+       errx(1, "Internal error at %s:%d: procedure not found",
            __FILE__, __LINE__);
        /* NOTREACHED */
 }
diff -r cf6a07f1edad -r 1b55d587b151 usr.bin/rpcgen/rpc_main.c
--- a/usr.bin/rpcgen/rpc_main.c Sat May 09 22:58:22 2015 +0000
+++ b/usr.bin/rpcgen/rpc_main.c Sat May 09 23:12:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $   */
+/*     $NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $   */
 
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_main.c 1.30 89/03/30 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_main.c,v 1.41 2015/05/09 22:58:22 dholland Exp $");
+__RCSID("$NetBSD: rpc_main.c,v 1.42 2015/05/09 23:12:57 dholland Exp $");
 #endif
 #endif
 
@@ -300,11 +300,11 @@
                return;
        }
        if (infile != NULL && streq(outfile, infile)) {
-               errx(EXIT_FAILURE, "output would overwrite `%s'", infile);
+               errx(EXIT_FAILURE, "Output would overwrite `%s'", infile);
        }
        fout = fopen(outfile, "w");
        if (fout == NULL) {
-               err(EXIT_FAILURE, "Can't to open `%s'", outfile);
+               err(EXIT_FAILURE, "Can't open `%s'", outfile);
        }
        record_open(outfile);
 
@@ -359,7 +359,7 @@
 
                retval = spawnvp(P_WAIT, arglist[0], arglist);
                if (retval != 0) {
-                       err(EXIT_FAILURE, "C PreProcessor failed");
+                       err(EXIT_FAILURE, "C preprocessor failed");
                }
                fnsplit(infile, drive, dir, name, ext);
                fnmerge(cppfile, drive, dir, name, ".i");
@@ -832,7 +832,7 @@
 addarg(const char *cp)
 {
        if (argcount >= ARGLISTLEN) {
-               errx(EXIT_FAILURE, "too many defines");
+               errx(EXIT_FAILURE, "Internal error: too many defines");
                /* NOTREACHED */
        }
        arglist[argcount++] = cp;
@@ -843,7 +843,7 @@
 putarg(int pwhere, const char *cp)
 {
        if (pwhere >= ARGLISTLEN) {
-               errx(EXIT_FAILURE, "arglist coding error");
+               errx(EXIT_FAILURE, "Internal error: arglist coding error");
                /* NOTREACHED */
        }
        arglist[pwhere] = cp;
@@ -871,7 +871,7 @@
                        return; /* file does not exist */
                else {
                        errx(EXIT_FAILURE,
-                           "`%s' already exists and may be overwritten",
+                           "`%s' already exists and would be overwritten",
                            outfile);
                }
        }
diff -r cf6a07f1edad -r 1b55d587b151 usr.bin/rpcgen/rpc_parse.c
--- a/usr.bin/rpcgen/rpc_parse.c        Sat May 09 22:58:22 2015 +0000
+++ b/usr.bin/rpcgen/rpc_parse.c        Sat May 09 23:12:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_parse.c,v 1.18 2013/12/15 00:40:17 christos Exp $  */
+/*     $NetBSD: rpc_parse.c,v 1.19 2015/05/09 23:12:57 dholland Exp $  */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_parse.c 1.8 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_parse.c,v 1.18 2013/12/15 00:40:17 christos Exp $");
+__RCSID("$NetBSD: rpc_parse.c,v 1.19 2015/05/09 23:12:57 dholland Exp $");
 #endif
 #endif
 
@@ -103,7 +103,7 @@
                free(defp);
                return (NULL);
        default:
-               error("definition keyword expected");
+               error("Expected definition keyword");
        }
        scan(TOK_SEMICOLON, &tok);
        isdefined(defp);
@@ -175,7 +175,7 @@
                        get_type(&plist->res_prefix, &plist->res_type,
                            DEF_PROGRAM);
                        if (streq(plist->res_type, "opaque")) {
-                               error("illegal result type");
+                               error("Illegal result type");
                        }
                        scan(TOK_IDENT, &tok);
                        plist->proc_name = tok.str;
@@ -207,10 +207,10 @@
                        }
                        /* multiple arguments are only allowed in newstyle */
                        if (!newstyle && num_args > 1) {
-                               error("only one argument is allowed");
+                               error("Only one argument is allowed");
                        }
                        if (isvoid && num_args > 1) {
-                               error("illegal use of void in program definition");
+                               error("Illegal use of void in program definition");
                        }
                        *tailp = NULL;
                        scan(TOK_RPAREN, &tok);
@@ -382,7 +382,7 @@
        for (i = 0; reserved_words[i] != NULL; i++) {
                if (strcmp(name, reserved_words[i]) == 0) {
                        sprintf(tmp,
-                           "illegal (reserved) name :\'%s\' in type definition", name);
+                           "Illegal (reserved) name '%s' in type definition", name);
                        error(tmp);
                }
        }
@@ -390,7 +390,7 @@
                for (i = 0; reserved_types[i] != NULL; i++) {
                        if (strcmp(name, reserved_types[i]) == 0) {
                                sprintf(tmp,
-                                   "illegal (reserved) name :\'%s\' in type definition", name);
+                                   "Illegal (reserved) name '%s' in type definition", name);
                                error(tmp);
                        }
                }
@@ -432,7 +432,7 @@
        dec->name = tok.str;
        if (peekscan(TOK_LBRACKET, &tok)) {
                if (dec->rel == REL_POINTER) {
-                       error("no array-of-pointer declarations -- use typedef");
+                       error("No array-of-pointer declarations -- use typedef");
                }
                dec->rel = REL_VECTOR;
                scan_num(&tok);
@@ -441,7 +441,7 @@
        } else
                if (peekscan(TOK_LANGLE, &tok)) {
                        if (dec->rel == REL_POINTER) {
-                               error("no array-of-pointer declarations -- use typedef");
+                               error("No array-of-pointer declarations -- use typedef");
                        }
                        dec->rel = REL_ARRAY;
                        if (peekscan(TOK_RANGLE, &tok)) {
@@ -455,12 +455,12 @@
                }
        if (streq(dec->type, "opaque")) {
                if (dec->rel != REL_ARRAY && dec->rel != REL_VECTOR) {
-                       error("array declaration expected");
+                       error("Array declaration expected");
                }
        } else
                if (streq(dec->type, "string")) {
                        if (dec->rel != REL_ARRAY) {
-                               error("variable-length array declaration expected");
+                               error("Variable-length array declaration expected");
                        }
                }
 }
@@ -495,11 +495,11 @@
                return;
        }
        if (streq(dec->type, "opaque")) {
-               error("opaque -- illegal argument type");
+               error("Opaque -- illegal argument type");
        }
        if (peekscan(TOK_STAR, &tok)) {
                if (streq(dec->type, "string")) {
-                       error("pointer to string not allowed in program arguments\n");
+                       error("Pointer to string not allowed in program arguments\n");
                }
                dec->rel = REL_POINTER;
                if (peekscan(TOK_IDENT, &tok))  /* optional name of argument */
@@ -507,7 +507,7 @@
        }
        if (peekscan(TOK_LANGLE, &tok)) {
                if (!streq(dec->type, "string")) {
-                       error("arrays cannot be declared as arguments to procedures -- use typedef");
+                       error("Arrays cannot be declared as arguments to procedures -- use typedef");
                }
                dec->rel = REL_ARRAY;
                if (peekscan(TOK_RANGLE, &tok)) {
@@ -567,7 +567,7 @@
                break;
        case TOK_VOID:
                if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
-                       error("voids allowed only inside union and program definitions with one argument");
+                       error("Void is allowed only inside union and program definitions with one argument");
                }
                *typep = tok.str;
                break;
@@ -582,7 +582,7 @@
                *typep = tok.str;
                break;
        default:
-               error("expected type specifier");
+               error("Type specifier expected");
        }
 }
 
diff -r cf6a07f1edad -r 1b55d587b151 usr.bin/rpcgen/rpc_scan.c
--- a/usr.bin/rpcgen/rpc_scan.c Sat May 09 22:58:22 2015 +0000
+++ b/usr.bin/rpcgen/rpc_scan.c Sat May 09 23:12:57 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpc_scan.c,v 1.13 2013/12/15 00:40:17 christos Exp $   */
+/*     $NetBSD: rpc_scan.c,v 1.14 2015/05/09 23:12:57 dholland Exp $   */
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)rpc_scan.c 1.11 89/02/22 (C) 1987 SMI";
 #else
-__RCSID("$NetBSD: rpc_scan.c,v 1.13 2013/12/15 00:40:17 christos Exp $");
+__RCSID("$NetBSD: rpc_scan.c,v 1.14 2015/05/09 23:12:57 dholland Exp $");
 #endif
 #endif
 
@@ -115,7 +115,7 @@
        case TOK_IDENT:
                break;
        default:
-               error("constant or identifier expected");
+               error("Expected constant or identifier");
        }
 }
 /*
@@ -286,7 +286,7 @@



Home | Main Index | Thread Index | Old Index