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): add more debug logging for suffixes



details:   https://anonhg.NetBSD.org/src/rev/ef1b86cde17b
branches:  trunk
changeset: 1016431:ef1b86cde17b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 21 10:36:01 2020 +0000

description:
make(1): add more debug logging for suffixes

The "Removing suffix" is not covered by the current tests.  It would be
best if that code were unreachable at all, since a reference count of -1
doesn't make sense.

diffstat:

 usr.bin/make/suff.c                         |  6 ++++--
 usr.bin/make/unit-tests/suff-incomplete.exp |  1 +
 usr.bin/make/unit-tests/suff-lookup.exp     |  1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 5ebd03ebf51a -r ef1b86cde17b usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Nov 21 10:32:42 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Nov 21 10:36:01 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -114,7 +114,7 @@
 #include "dir.h"
 
 /*     "@(#)suff.c     8.4 (Berkeley) 3/21/94" */
-MAKE_RCSID("$NetBSD: suff.c,v 1.256 2020/11/21 09:53:40 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.257 2020/11/21 10:36:01 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -326,6 +326,7 @@
     if (suff->refCount == 0) {
        /* XXX: can lead to suff->refCount == -1 */
        SuffList_Unref(sufflist, suff);
+       DEBUG1(SUFF, "Removing suffix \"%s\"\n", suff->name);
        SuffFree(suff);
     }
 }
@@ -399,6 +400,7 @@
 #ifdef CLEANUP
     Lst_MoveAll(suffClean, sufflist);
 #endif
+    DEBUG0(SUFF, "Clearing all suffixes\n");
     sufflist = Lst_New();
     sNum = 0;
     if (suffNull != NULL)
diff -r 5ebd03ebf51a -r ef1b86cde17b usr.bin/make/unit-tests/suff-incomplete.exp
--- a/usr.bin/make/unit-tests/suff-incomplete.exp       Sat Nov 21 10:32:42 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-incomplete.exp       Sat Nov 21 10:36:01 2020 +0000
@@ -1,5 +1,6 @@
 ParseReadLine (9): '.SUFFIXES:'
 ParseDoDependency(.SUFFIXES:)
+Clearing all suffixes
 ParseReadLine (11): '.SUFFIXES: .a .b .c'
 ParseDoDependency(.SUFFIXES: .a .b .c)
 Adding suffix ".a"
diff -r 5ebd03ebf51a -r ef1b86cde17b usr.bin/make/unit-tests/suff-lookup.exp
--- a/usr.bin/make/unit-tests/suff-lookup.exp   Sat Nov 21 10:32:42 2020 +0000
+++ b/usr.bin/make/unit-tests/suff-lookup.exp   Sat Nov 21 10:36:01 2020 +0000
@@ -24,6 +24,7 @@
 inserting ".dead-end" (6) at end of list
 inserting ".short" (4) at end of list
 transformation .dead-end.short complete
+Clearing all suffixes
 Adding suffix ".c"
 Adding suffix ".cc"
 Adding suffix ".ccc"



Home | Main Index | Thread Index | Old Index