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): mark srclist as a bad global variable



details:   https://anonhg.NetBSD.org/src/rev/263553c1e58a
branches:  trunk
changeset: 946162:263553c1e58a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 19 21:27:29 2020 +0000

description:
make(1): mark srclist as a bad global variable

The previous comment "List of sources" didn't tell anything about the
purpose of the variable, it was only useful before July 2020, when its
data type was still Lst, without any type information.

Having a global variable here seems pointless, but all the code about
suffix transformations is so tricky and not well covered by tests that I
don't dare to convert the global variable to a local variable in
Suff_FindDeps.  The change itself would be trivial, but the hidden and
undocumented intentions of the original author probably aren't.

diffstat:

 usr.bin/make/suff.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 51a9829527dc -r 263553c1e58a usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Thu Nov 19 20:58:30 2020 +0000
+++ b/usr.bin/make/suff.c       Thu Nov 19 21:27:29 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.249 2020/11/19 14:42:33 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.250 2020/11/19 21:27:29 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.249 2020/11/19 14:42:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.250 2020/11/19 21:27:29 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -130,7 +130,10 @@
 #ifdef CLEANUP
 static SuffList *suffClean;    /* List of suffixes to be cleaned */
 #endif
-static SrcList *srclist;       /* List of sources */
+
+/* XXX: What exactly is this variable used for? */
+/* XXX: Does it really have to be a global variable? */
+static SrcList *srclist;
 
 /* List of transformation rules, such as ".c.o" */
 static GNodeList *transforms;



Home | Main Index | Thread Index | Old Index