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): clean up RCSID blocks



details:   https://anonhg.NetBSD.org/src/rev/e3da806a8db9
branches:  trunk
changeset: 938704:e3da806a8db9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 13 15:15:51 2020 +0000

description:
make(1): clean up RCSID blocks

These blocks mostly consisted of redundant structure, following the same
#ifndef pattern over and over, with only minimal variation.

It's easier to maintain if the common structure is only written once and
encapsulated in a macro.

To avoid "defined but unused" warnings from GCC in the case where
MAKE_NATIVE is not defined, I had to add volatile.  Adding
MAKE_ATTR_UNUSED alone would not preserve the rcsid variable in the
resulting binary.

diffstat:

 usr.bin/make/arch.c        |  18 ++++--------------
 usr.bin/make/buf.c         |  18 ++++--------------
 usr.bin/make/compat.c      |  17 +++--------------
 usr.bin/make/cond.c        |  18 ++++--------------
 usr.bin/make/dir.c         |  17 +++--------------
 usr.bin/make/enum.c        |  15 ++++-----------
 usr.bin/make/for.c         |  18 ++++--------------
 usr.bin/make/hash.c        |  18 ++++--------------
 usr.bin/make/job.c         |  19 +++++--------------
 usr.bin/make/lst.c         |  11 ++---------
 usr.bin/make/main.c        |  27 ++++++++-------------------
 usr.bin/make/make.c        |  18 ++++--------------
 usr.bin/make/make.h        |  11 ++++++++++-
 usr.bin/make/make_malloc.c |   9 +++------
 usr.bin/make/metachar.c    |   9 ++++-----
 usr.bin/make/parse.c       |  18 ++++--------------
 usr.bin/make/str.c         |  18 ++++--------------
 usr.bin/make/strlist.c     |  13 +++----------
 usr.bin/make/suff.c        |  18 ++++--------------
 usr.bin/make/targ.c        |  18 ++++--------------
 usr.bin/make/trace.c       |  14 +++-----------
 usr.bin/make/util.c        |  14 ++++----------
 usr.bin/make/var.c         |  18 ++++--------------
 23 files changed, 96 insertions(+), 278 deletions(-)

diffs (truncated from 827 to 300 lines):

diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/arch.c
--- a/usr.bin/make/arch.c       Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/arch.c       Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arch.c,v 1.113 2020/09/13 06:15:29 rillig Exp $        */
+/*     $NetBSD: arch.c,v 1.114 2020/09/13 15:15:51 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -68,19 +68,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: arch.c,v 1.113 2020/09/13 06:15:29 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)arch.c     8.2 (Berkeley) 1/2/94";
-#else
-__RCSID("$NetBSD: arch.c,v 1.113 2020/09/13 06:15:29 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /*-
  * arch.c --
  *     Functions to manipulate libraries, archives and their members.
@@ -145,6 +132,9 @@
 #include    "dir.h"
 #include    "config.h"
 
+/*     "@(#)arch.c     8.2 (Berkeley) 1/2/94"  */
+MAKE_RCSID("$NetBSD: arch.c,v 1.114 2020/09/13 15:15:51 rillig Exp $");
+
 #ifdef TARGET_MACHINE
 #undef MAKE_MACHINE
 #define MAKE_MACHINE TARGET_MACHINE
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/buf.c
--- a/usr.bin/make/buf.c        Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/buf.c        Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.c,v 1.37 2020/08/23 08:21:50 rillig Exp $  */
+/*     $NetBSD: buf.c,v 1.38 2020/09/13 15:15:51 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,24 +69,14 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.37 2020/08/23 08:21:50 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)buf.c      8.1 (Berkeley) 6/6/93";
-#else
-__RCSID("$NetBSD: buf.c,v 1.37 2020/08/23 08:21:50 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /* Functions for automatically-expanded null-terminated buffers. */
 
 #include <limits.h>
 #include "make.h"
 
+/*     "@(#)buf.c      8.1 (Berkeley) 6/6/93"  */
+MAKE_RCSID("$NetBSD: buf.c,v 1.38 2020/09/13 15:15:51 rillig Exp $");
+
 /* Extend the buffer for adding a single byte. */
 void
 Buf_Expand_1(Buffer *bp)
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/compat.c     Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.144 2020/09/13 06:36:54 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.145 2020/09/13 15:15:51 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,19 +69,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.144 2020/09/13 06:36:54 rillig 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.144 2020/09/13 06:36:54 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /*-
  * compat.c --
  *     The routines in this file implement the full-compatibility
@@ -111,6 +98,8 @@
 #include    "metachar.h"
 #include    "pathnames.h"
 
+/*     "@(#)compat.c   8.2 (Berkeley) 3/19/94" */
+MAKE_RCSID("$NetBSD: compat.c,v 1.145 2020/09/13 15:15:51 rillig Exp $");
 
 static GNode       *curTarg = NULL;
 static GNode       *ENDNode;
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/cond.c       Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cond.c,v 1.143 2020/09/13 13:53:55 rillig Exp $        */
+/*     $NetBSD: cond.c,v 1.144 2020/09/13 15:15:51 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,19 +69,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.143 2020/09/13 13:53:55 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)cond.c     8.2 (Berkeley) 1/2/94";
-#else
-__RCSID("$NetBSD: cond.c,v 1.143 2020/09/13 13:53:55 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /* Handling of conditionals in a makefile.
  *
  * Interface:
@@ -105,6 +92,9 @@
 #include "make.h"
 #include "dir.h"
 
+/*     "@(#)cond.c     8.2 (Berkeley) 1/2/94"  */
+MAKE_RCSID("$NetBSD: cond.c,v 1.144 2020/09/13 15:15:51 rillig Exp $");
+
 /*
  * The parsing of conditional expressions is based on this grammar:
  *     E -> F || E
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/dir.c        Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $ */
+/*     $NetBSD: dir.c,v 1.142 2020/09/13 15:15:51 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,19 +69,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)dir.c      8.2 (Berkeley) 1/2/94";
-#else
-__RCSID("$NetBSD: dir.c,v 1.141 2020/09/12 23:12:44 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /*-
  * dir.c --
  *     Directory searching using wildcards and/or normal names...
@@ -146,6 +133,8 @@
 #include "dir.h"
 #include "job.h"
 
+/*     "@(#)dir.c      8.2 (Berkeley) 1/2/94"  */
+MAKE_RCSID("$NetBSD: dir.c,v 1.142 2020/09/13 15:15:51 rillig Exp $");
 
 #define DIR_DEBUG0(fmt) \
     if (!DEBUG(DIR)) (void) 0; else fprintf(debug_file, fmt)
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/enum.c
--- a/usr.bin/make/enum.c       Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/enum.c       Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $  */
+/*     $NetBSD: enum.c,v 1.8 2020/09/13 15:15:51 rillig Exp $  */
 
 /*
  Copyright (c) 2020 Roland Illig <rillig%NetBSD.org@localhost>
@@ -27,20 +27,13 @@
  POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-__RCSID("$NetBSD: enum.c,v 1.7 2020/09/12 14:41:00 rillig Exp $");
-#endif
-#endif
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
-#include "enum.h"
+#include "make.h"
+
+MAKE_RCSID("$NetBSD: enum.c,v 1.8 2020/09/13 15:15:51 rillig Exp $");
 
 /* Convert a bitset into a string representation, showing the names of the
  * individual bits.
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/for.c        Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.82 2020/09/12 14:41:00 rillig Exp $  */
+/*     $NetBSD: for.c,v 1.83 2020/09/13 15:15:51 rillig Exp $  */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -29,19 +29,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.82 2020/09/12 14:41:00 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)for.c      8.1 (Berkeley) 6/6/93";
-#else
-__RCSID("$NetBSD: for.c,v 1.82 2020/09/12 14:41:00 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /*-
  * Handling of .for/.endfor loops in a makefile.
  *
@@ -72,6 +59,9 @@
 #include    "make.h"
 #include    "strlist.h"
 
+/*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
+MAKE_RCSID("$NetBSD: for.c,v 1.83 2020/09/13 15:15:51 rillig Exp $");
+
 typedef enum {
     FOR_SUB_ESCAPE_CHAR = 0x0001,
     FOR_SUB_ESCAPE_BRACE = 0x0002,
diff -r a2c21ceb6a51 -r e3da806a8db9 usr.bin/make/hash.c
--- a/usr.bin/make/hash.c       Sun Sep 13 14:36:32 2020 +0000
+++ b/usr.bin/make/hash.c       Sun Sep 13 15:15:51 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hash.c,v 1.31 2020/09/05 13:55:08 rillig Exp $ */
+/*     $NetBSD: hash.c,v 1.32 2020/09/13 15:15:51 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -69,19 +69,6 @@
  * SUCH DAMAGE.
  */
 
-#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: hash.c,v 1.31 2020/09/05 13:55:08 rillig Exp $";
-#else
-#include <sys/cdefs.h>
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)hash.c     8.1 (Berkeley) 6/6/93";
-#else
-__RCSID("$NetBSD: hash.c,v 1.31 2020/09/05 13:55:08 rillig Exp $");
-#endif
-#endif /* not lint */
-#endif
-
 /* hash.c --
  *
  *     This module contains routines to manipulate a hash table.
@@ -91,6 +78,9 @@
  */
 #include "make.h"
 
+/*     "@(#)hash.c     8.1 (Berkeley) 6/6/93"  */
+MAKE_RCSID("$NetBSD: hash.c,v 1.32 2020/09/13 15:15:51 rillig Exp $");
+
 /*



Home | Main Index | Thread Index | Old Index