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): document necessary condition in SuffUp...



details:   https://anonhg.NetBSD.org/src/rev/f30837a58d02
branches:  trunk
changeset: 946230:f30837a58d02
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 21 18:06:09 2020 +0000

description:
make(1): document necessary condition in SuffUpdateTarget

diffstat:

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

diffs (49 lines):

diff -r 204f735cb525 -r f30837a58d02 usr.bin/make/suff.c
--- a/usr.bin/make/suff.c       Sat Nov 21 17:59:13 2020 +0000
+++ b/usr.bin/make/suff.c       Sat Nov 21 18:06:09 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: suff.c,v 1.262 2020/11/21 17:18:36 rillig Exp $        */
+/*     $NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 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.262 2020/11/21 17:18:36 rillig Exp $");
+MAKE_RCSID("$NetBSD: suff.c,v 1.263 2020/11/21 18:06:09 rillig Exp $");
 
 #define SUFF_DEBUG0(text) DEBUG0(SUFF, text)
 #define SUFF_DEBUG1(fmt, arg1) DEBUG1(SUFF, fmt, arg1)
@@ -667,17 +667,23 @@
        return FALSE;
 
     /*
-     * XXX: What is the purpose of the 'ptr == target->name' condition here?
-     * In suff-rebuild.mk in the line '.SUFFIXES: .c .b .a', it prevents the
-     * rule '.b.c' from being added again during Suff_AddSuffix(".b").
-     */
-    /*
      * XXX: What about a transformation ".cpp.c"?  If ".c" is added as a new
      * suffix, it seems wrong that this transformation would be skipped just
      * because ".c" happens to be a prefix of ".cpp".
      */
-    if ((ptr = strstr(target->name, suff->name)) == NULL ||
-       ptr == target->name)
+    ptr = strstr(target->name, suff->name);
+    if (ptr == NULL)
+       return FALSE;
+
+    /*
+     * XXX: In suff-rebuild.mk, in the line '.SUFFIXES: .c .b .a', this
+     * condition prevents the rule '.b.c' from being added again during
+     * Suff_AddSuffix(".b").
+     *
+     * XXX: Removing this paragraph makes suff-add-later.mk use massive
+     * amounts of memory.
+     */
+    if (ptr == target->name)
        return FALSE;
 
     if (SuffParseTransform(target->name, &srcSuff, &targSuff)) {



Home | Main Index | Thread Index | Old Index