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: inline make_abort, improve error details



details:   https://anonhg.NetBSD.org/src/rev/bbefd1b97571
branches:  trunk
changeset: 365983:bbefd1b97571
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat May 07 09:44:50 2022 +0000

description:
make: inline make_abort, improve error details

This function was only called a single time, making the source code line
number redundant.  Instead, print the name of the state instead of its
ordinal value.

diffstat:

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

diffs (56 lines):

diff -r 021373543ad3 -r bbefd1b97571 usr.bin/make/make.c
--- a/usr.bin/make/make.c       Sat May 07 09:02:19 2022 +0000
+++ b/usr.bin/make/make.c       Sat May 07 09:44:50 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.c,v 1.252 2022/01/09 15:48:30 rillig Exp $        */
+/*     $NetBSD: make.c,v 1.253 2022/05/07 09:44:50 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -104,7 +104,7 @@
 #include "job.h"
 
 /*     "@(#)make.c     8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: make.c,v 1.252 2022/01/09 15:48:30 rillig Exp $");
+MAKE_RCSID("$NetBSD: make.c,v 1.253 2022/05/07 09:44:50 rillig Exp $");
 
 /* Sequence # to detect recursion. */
 static unsigned int checked_seqno = 1;
@@ -127,17 +127,6 @@
        va_end(ap);
 }
 
-MAKE_ATTR_DEAD static void
-make_abort(GNode *gn, int lineno)
-{
-
-       debug_printf("make_abort from line %d\n", lineno);
-       Targ_PrintNode(gn, 2);
-       Targ_PrintNodes(&toBeMade, 2);
-       Targ_PrintGraph(3);
-       abort();
-}
-
 static const char *
 GNodeType_ToString(GNodeType type, void **freeIt)
 {
@@ -1033,13 +1022,12 @@
                DEBUG2(MAKE, "Examining %s%s...\n", gn->name, gn->cohort_num);
 
                if (gn->made != REQUESTED) {
-                       /*
-                        * XXX: Replace %d with string representation;
-                        * see made_name.
-                        */
-                       DEBUG1(MAKE, "state %d\n", gn->made);
-
-                       make_abort(gn, __LINE__);
+                       debug_printf("internal error: made = %s\n",
+                           GNodeMade_Name(gn->made));
+                       Targ_PrintNode(gn, 2);
+                       Targ_PrintNodes(&toBeMade, 2);
+                       Targ_PrintGraph(3);
+                       abort();
                }
 
                if (gn->checked_seqno == checked_seqno) {



Home | Main Index | Thread Index | Old Index