Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[.joined/src/trunk]: .joined/src/usr.bin/make make: clean up nitpicks



details:   https://anonhg.NetBSD.org/.joined/src/rev/0f80af7c3171
branches:  trunk
changeset: 359398:0f80af7c3171
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 02 02:57:39 2022 +0000

description:
make: clean up nitpicks

In ParseWord, the expressions '*p' and 'ch' are the same.

In ParseDependencyTargetWord, clean up a wordy comment and join two
conditions.

In the test cond-token-number, clarify that make doesn't convert from
hex to decimal but only from hex to internal representation.

No functional change.

diffstat:

 usr.bin/make/cond.c                          |   8 ++++----
 usr.bin/make/parse.c                         |  12 +++++-------
 usr.bin/make/unit-tests/cond-token-number.mk |   4 ++--
 3 files changed, 11 insertions(+), 13 deletions(-)

diffs (94 lines):

diff -r 091648af517b -r 0f80af7c3171 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sun Jan 02 02:39:55 2022 +0000
+++ b/usr.bin/make/cond.c       Sun Jan 02 02:57:39 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.321 2021/12/30 02:14:55 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.322 2022/01/02 02:57:39 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
 #include "dir.h"
 
 /*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
-MAKE_RCSID("$NetBSD: cond.c,v 1.321 2021/12/30 02:14:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.322 2022/01/02 02:57:39 rillig Exp $");
 
 /*
  * The parsing of conditional expressions is based on this grammar:
@@ -225,7 +225,7 @@
                        break;
                if ((ch == '&' || ch == '|') && paren_depth == 0)
                        break;
-               if (*p == '$') {
+               if (ch == '$') {
                        /*
                         * Parse the variable expression and install it as
                         * part of the argument if it's valid. We tell
@@ -248,7 +248,7 @@
                        paren_depth++;
                else if (ch == ')' && --paren_depth < 0)
                        break;
-               Buf_AddByte(&argBuf, *p);
+               Buf_AddByte(&argBuf, ch);
                p++;
        }
 
diff -r 091648af517b -r 0f80af7c3171 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Sun Jan 02 02:39:55 2022 +0000
+++ b/usr.bin/make/parse.c      Sun Jan 02 02:57:39 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.618 2022/01/02 02:39:55 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.619 2022/01/02 02:57:39 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -106,7 +106,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.618 2022/01/02 02:39:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.619 2022/01/02 02:57:39 rillig Exp $");
 
 /*
  * Structure for a file being read ("included file")
@@ -884,8 +884,7 @@
                if (*cp == '$') {
                        /*
                         * Must be a dynamic source (would have been expanded
-                        * otherwise), so call the Var module to parse the
-                        * puppy so we can safely advance beyond it.
+                        * otherwise).
                         *
                         * There should be no errors in this, as they would
                         * have been discovered in the initial Var_Subst and
@@ -1790,9 +1789,8 @@
                if (*p == '.')  /* Accept either ${.MAKE} or ${MAKE}. */
                        p++;
 
-               if (strncmp(p, "MAKE", 4) == 0)
-                       if (p[4] == endc)
-                               return true;
+               if (strncmp(p, "MAKE", 4) == 0 && p[4] == endc)
+                       return true;
        }
        return false;
 }
diff -r 091648af517b -r 0f80af7c3171 usr.bin/make/unit-tests/cond-token-number.mk
--- a/usr.bin/make/unit-tests/cond-token-number.mk      Sun Jan 02 02:39:55 2022 +0000
+++ b/usr.bin/make/unit-tests/cond-token-number.mk      Sun Jan 02 02:57:39 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-number.mk,v 1.6 2021/12/27 18:54:19 rillig Exp $
+# $NetBSD: cond-token-number.mk,v 1.7 2022/01/02 02:57:39 rillig Exp $
 #
 # Tests for number tokens in .if conditions.
 #
@@ -78,7 +78,7 @@
 .  error
 .endif
 
-# Make can do radix conversion from hex to decimal.
+# Make can do radix conversion from hex.
 HEX=   dead
 .if 0x${HEX} == 57005
 .else



Home | Main Index | Thread Index | Old Index