Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make - remove gcc-4.5 warnings



details:   https://anonhg.NetBSD.org/src/rev/d42fbd1241a9
branches:  trunk
changeset: 768321:d42fbd1241a9
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Aug 14 13:06:09 2011 +0000

description:
- remove gcc-4.5 warnings
- simplify job printing code
- document non-literal format strings

diffstat:

 usr.bin/make/Makefile |  12 +++++-------
 usr.bin/make/compat.c |   8 ++++----
 usr.bin/make/job.c    |  24 ++++++------------------
 3 files changed, 15 insertions(+), 29 deletions(-)

diffs (130 lines):

diff -r 71b93fdfd777 -r d42fbd1241a9 usr.bin/make/Makefile
--- a/usr.bin/make/Makefile     Sun Aug 14 12:59:25 2011 +0000
+++ b/usr.bin/make/Makefile     Sun Aug 14 13:06:09 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.54 2011/06/22 02:49:44 mrg Exp $
+#      $NetBSD: Makefile,v 1.55 2011/08/14 13:06:09 christos Exp $
 #      @(#)Makefile    5.2 (Berkeley) 12/28/90
 
 PROG=  make
@@ -36,7 +36,10 @@
 .include <bsd.subdir.mk>
 
 CPPFLAGS+= -DMAKE_NATIVE
-COPTS.var.c+= -Wno-cast-qual
+COPTS.var.c += -Wno-cast-qual
+COPTS.job.c += -Wno-format-nonliteral
+COPTS.parse.c += -Wno-format-nonliteral
+COPTS.var.c += -Wno-format-nonliteral
 
 .ifdef TOOLDIR
 # this is a native netbsd build, 
@@ -49,8 +52,3 @@
 # A simple unit-test driver to help catch regressions
 accept test:
        cd ${.CURDIR}/unit-tests && ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.compat.c+=       -Wno-error
-.endif
diff -r 71b93fdfd777 -r d42fbd1241a9 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Aug 14 12:59:25 2011 +0000
+++ b/usr.bin/make/compat.c     Sun Aug 14 13:06:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $     */
+/*     $NetBSD: compat.c,v 1.83 2011/08/14 13:06:09 christos Exp $     */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.83 2011/08/14 13:06:09 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.82 2010/11/25 21:31:09 christos Exp $");
+__RCSID("$NetBSD: compat.c,v 1.83 2011/08/14 13:06:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -347,7 +347,7 @@
                useShell = 1;
                goto again;
        }
-       av = (const char **)mav;
+       av = (void *)mav;
     }
 
     local = TRUE;
diff -r 71b93fdfd777 -r d42fbd1241a9 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sun Aug 14 12:59:25 2011 +0000
+++ b/usr.bin/make/job.c        Sun Aug 14 13:06:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.157 2011/08/01 02:13:21 christos Exp $       */
+/*     $NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $       */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.157 2011/08/01 02:13:21 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)job.c      8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: job.c,v 1.157 2011/08/01 02:13:21 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.158 2011/08/14 13:06:09 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -321,10 +321,7 @@
 
 STATIC GNode           *lastNode;      /* The node for which output was most recently
                                 * produced. */
-STATIC const char *targFmt;    /* Format string to use to head output from a
-                                * job when it's not the most-recent job heard
-                                * from */
-static char *targPrefix = NULL; /* What we print at the start of targFmt */
+static char *targPrefix = NULL; /* What we print at the start of TARG_FMT */
 static Job tokenWaitJob;       /* token wait pseudo-job */
 
 static Job childExitJob;       /* child exit pseudo-job */
@@ -333,7 +330,8 @@
 
 #define TARG_FMT  "%s %s ---\n" /* Default format */
 #define MESSAGE(fp, gn) \
-       (void)fprintf(fp, targFmt, targPrefix, gn->name)
+       if (maxJobs != 1) \
+           (void)fprintf(fp, TARG_FMT, targPrefix, gn->name)
 
 static sigset_t caught_signals;        /* Set of signals we handle */
 #if defined(SYSV)
@@ -2178,16 +2176,6 @@
 
     lastNode =   NULL;
 
-    if (maxJobs == 1) {
-       /*
-        * If only one job can run at a time, there's no need for a banner,
-        * is there?
-        */
-       targFmt = "";
-    } else {
-       targFmt = TARG_FMT;
-    }
-
     /*
      * There is a non-zero chance that we already have children.
      * eg after 'make -f- <<EOF'



Home | Main Index | Thread Index | Old Index