Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): inline error message



details:   https://anonhg.NetBSD.org/src/rev/b21b7c748ff8
branches:  trunk
changeset: 1015560:b21b7c748ff8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 25 20:09:28 2020 +0000

description:
make(1): inline error message

This saves a variable, and since bmake needs to adhere to C90, this
variable declaration prevents refactoring the code.

diffstat:

 usr.bin/make/job.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (49 lines):

diff -r 2b5d30f5ab81 -r b21b7c748ff8 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Oct 25 19:57:43 2020 +0000
+++ b/usr.bin/make/job.c        Sun Oct 25 20:09:28 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.278 2020/10/25 19:57:43 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.279 2020/10/25 20:09:28 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.278 2020/10/25 19:57:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.279 2020/10/25 20:09:28 rillig Exp $");
 
 # define STATIC static
 
@@ -1208,7 +1208,6 @@
             * given, we stop in our tracks, otherwise we just don't update
             * this node's parents so they never get examined.
             */
-           static const char msg[] = ": don't know how to make";
 
            if (gn->flags & FROM_DEPEND) {
                if (!Job_RunTarget(".STALE", gn->fname))
@@ -1219,16 +1218,17 @@
            }
 
            if (gn->type & OP_OPTIONAL) {
-               (void)fprintf(stdout, "%s%s %s (ignored)\n", progname,
-                   msg, gn->name);
+               (void)fprintf(stdout, "%s: don't know how to make %s (%s)\n",
+                             progname, gn->name, "ignored");
                (void)fflush(stdout);
            } else if (keepgoing) {
-               (void)fprintf(stdout, "%s%s %s (continuing)\n", progname,
-                   msg, gn->name);
+               (void)fprintf(stdout, "%s: don't know how to make %s (%s)\n",
+                             progname, gn->name, "continuing");
                (void)fflush(stdout);
                return FALSE;
            } else {
-               (*abortProc)("%s%s %s. Stop", progname, msg, gn->name);
+               abortProc("%s: don't know how to make %s. Stop",
+                         progname, gn->name);
                return FALSE;
            }
        }



Home | Main Index | Thread Index | Old Index