Module Name:    src
Committed By:   rillig
Date:           Sat Nov 21 10:36:01 UTC 2020

Modified Files:
        src/usr.bin/make: suff.c
        src/usr.bin/make/unit-tests: suff-incomplete.exp suff-lookup.exp

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/suff.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/suff-incomplete.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/suff-lookup.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.256 src/usr.bin/make/suff.c:1.257
--- src/usr.bin/make/suff.c:1.256	Sat Nov 21 09:53:40 2020
+++ src/usr.bin/make/suff.c	Sat Nov 21 10:36:01 2020
@@ -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 @@ SuffList_Remove(SuffList *list, Suff *su
     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 @@ Suff_ClearSuffixes(void)
 #ifdef CLEANUP
     Lst_MoveAll(suffClean, sufflist);
 #endif
+    DEBUG0(SUFF, "Clearing all suffixes\n");
     sufflist = Lst_New();
     sNum = 0;
     if (suffNull != NULL)

Index: src/usr.bin/make/unit-tests/suff-incomplete.exp
diff -u src/usr.bin/make/unit-tests/suff-incomplete.exp:1.1 src/usr.bin/make/unit-tests/suff-incomplete.exp:1.2
--- src/usr.bin/make/unit-tests/suff-incomplete.exp:1.1	Sat Nov 21 10:32:42 2020
+++ src/usr.bin/make/unit-tests/suff-incomplete.exp	Sat Nov 21 10:36:01 2020
@@ -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"

Index: src/usr.bin/make/unit-tests/suff-lookup.exp
diff -u src/usr.bin/make/unit-tests/suff-lookup.exp:1.4 src/usr.bin/make/unit-tests/suff-lookup.exp:1.5
--- src/usr.bin/make/unit-tests/suff-lookup.exp:1.4	Sat Nov 21 09:53:40 2020
+++ src/usr.bin/make/unit-tests/suff-lookup.exp	Sat Nov 21 10:36:01 2020
@@ -24,6 +24,7 @@ defining transformation from `.dead-end'
 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"

Reply via email to