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): enable format string truncation warnin...



details:   https://anonhg.NetBSD.org/src/rev/67e62a2a2ee6
branches:  trunk
changeset: 940209:67e62a2a2ee6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 05 22:15:45 2020 +0000

description:
make(1): enable format string truncation warnings for parse.c

No node is ever going to have a million or more cohorts.  And even if
there were, this name is only used for printing informational messages.

diffstat:

 usr.bin/make/Makefile |  3 +--
 usr.bin/make/make.h   |  4 ++--
 usr.bin/make/parse.c  |  6 +++---
 usr.bin/make/targ.c   |  6 +++---
 4 files changed, 9 insertions(+), 10 deletions(-)

diffs (89 lines):

diff -r b0c80b83b37a -r 67e62a2a2ee6 usr.bin/make/Makefile
--- a/usr.bin/make/Makefile     Mon Oct 05 21:37:07 2020 +0000
+++ b/usr.bin/make/Makefile     Mon Oct 05 22:15:45 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.102 2020/10/05 19:27:47 rillig Exp $
+#      $NetBSD: Makefile,v 1.103 2020/10/05 22:15:45 rillig Exp $
 #      @(#)Makefile    5.2 (Berkeley) 12/28/90
 
 PROG=  make
@@ -77,7 +77,6 @@
 COPTS.dir.c+=  -Wno-error=format-truncation
 COPTS.main.c+= -Wno-error=format-truncation
 COPTS.meta.c+= -Wno-error=format-truncation
-COPTS.parse.c+=        -Wno-error=format-truncation
 .endif
 
 # Whether to compile with GCC 8 from pkgsrc, during development.
diff -r b0c80b83b37a -r 67e62a2a2ee6 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Mon Oct 05 21:37:07 2020 +0000
+++ b/usr.bin/make/make.h       Mon Oct 05 22:15:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.155 2020/10/05 19:27:47 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.156 2020/10/05 22:15:45 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -332,7 +332,7 @@
      * in the normal sense. */
     GNodeList *order_succ;
 
-    /* #n for this cohort */
+    /* The "#n" suffix for this cohort, or "" for other nodes */
     char cohort_num[8];
     /* The number of unmade instances on the cohorts list */
     int unmade_cohorts;
diff -r b0c80b83b37a -r 67e62a2a2ee6 usr.bin/make/parse.c
--- a/usr.bin/make/parse.c      Mon Oct 05 21:37:07 2020 +0000
+++ b/usr.bin/make/parse.c      Mon Oct 05 22:15:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: parse.c,v 1.369 2020/10/05 21:37:07 rillig Exp $       */
+/*     $NetBSD: parse.c,v 1.370 2020/10/05 22:15:45 rillig Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
 #include "pathnames.h"
 
 /*     "@(#)parse.c    8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.369 2020/10/05 21:37:07 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.370 2020/10/05 22:15:45 rillig Exp $");
 
 /* types and constants */
 
@@ -854,7 +854,7 @@
        cohort->centurion = gn;
        gn->unmade_cohorts++;
        snprintf(cohort->cohort_num, sizeof cohort->cohort_num, "#%d",
-               gn->unmade_cohorts);
+               gn->unmade_cohorts % 1000000);
     } else {
        /*
         * We don't want to nuke any previous flags (whatever they were) so we
diff -r b0c80b83b37a -r 67e62a2a2ee6 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Mon Oct 05 21:37:07 2020 +0000
+++ b/usr.bin/make/targ.c       Mon Oct 05 22:15:45 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.111 2020/10/05 19:27:47 rillig Exp $        */
+/*     $NetBSD: targ.c,v 1.112 2020/10/05 22:15:45 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.111 2020/10/05 19:27:47 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.112 2020/10/05 22:15:45 rillig Exp $");
 
 static GNodeList *allTargets;  /* the list of all targets found so far */
 #ifdef CLEANUP
@@ -183,7 +183,7 @@
     gn->type = name[0] == '-' && name[1] == 'l' ? OP_LIB : 0;
     gn->unmade = 0;
     gn->unmade_cohorts = 0;
-    gn->cohort_num[0] = 0;
+    gn->cohort_num[0] = '\0';
     gn->centurion = NULL;
     gn->made = UNMADE;
     gn->flags = 0;



Home | Main Index | Thread Index | Old Index