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: improve C90 support



details:   https://anonhg.NetBSD.org/src/rev/4e08762dca30
branches:  trunk
changeset: 359977:4e08762dca30
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 05 00:26:21 2022 +0000

description:
make: improve C90 support

Do not use inline functions, remove trailing comma in enum declaration,
do not use 'long long' for printing a timestamp.  This re-introduces the
Year 2038 Problem for pre-C99 compilers when printing the trace log, but
that is a seldom used feature.

diffstat:

 usr.bin/make/make.h  |   8 ++++++--
 usr.bin/make/trace.c |  11 +++++++++--
 2 files changed, 15 insertions(+), 4 deletions(-)

diffs (66 lines):

diff -r 2665b1a909fe -r 4e08762dca30 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Feb 05 00:20:48 2022 +0000
+++ b/usr.bin/make/make.h       Sat Feb 05 00:26:21 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.297 2022/02/04 23:22:19 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.298 2022/02/05 00:26:21 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -136,7 +136,11 @@
 #define MAKE_ATTR_USE          /* delete */
 #endif
 
+#if __STDC__ >= 199901L || defined(lint)
 #define MAKE_INLINE static inline MAKE_ATTR_UNUSED
+#else
+#define MAKE_INLINE static MAKE_ATTR_UNUSED
+#endif
 
 /* MAKE_STATIC marks a function that may or may not be inlined. */
 #if defined(lint)
@@ -359,7 +363,7 @@
         */
        OP_DEPS_FOUND   = 1 << 24,
        /* Node found while expanding .ALLSRC */
-       OP_MARK         = 1 << 23,
+       OP_MARK         = 1 << 23
 } GNodeType;
 
 typedef struct GNodeFlags {
diff -r 2665b1a909fe -r 4e08762dca30 usr.bin/make/trace.c
--- a/usr.bin/make/trace.c      Sat Feb 05 00:20:48 2022 +0000
+++ b/usr.bin/make/trace.c      Sat Feb 05 00:26:21 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trace.c,v 1.30 2021/12/15 12:58:01 rillig Exp $        */
+/*     $NetBSD: trace.c,v 1.31 2022/02/05 00:26:21 rillig Exp $        */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
 #include "job.h"
 #include "trace.h"
 
-MAKE_RCSID("$NetBSD: trace.c,v 1.30 2021/12/15 12:58:01 rillig Exp $");
+MAKE_RCSID("$NetBSD: trace.c,v 1.31 2022/02/05 00:26:21 rillig Exp $");
 
 static FILE *trfile;
 static pid_t trpid;
@@ -90,10 +90,17 @@
 
        gettimeofday(&rightnow, NULL);
 
+#if __STDC__ >= 199901L
        fprintf(trfile, "%lld.%06ld %d %s %d %s",
            (long long)rightnow.tv_sec, (long)rightnow.tv_usec,
            jobTokensRunning,
            evname[event], trpid, trwd);
+#else
+       fprintf(trfile, "%ld.%06ld %d %s %d %s",
+           (long)rightnow.tv_sec, (long)rightnow.tv_usec,
+           jobTokensRunning,
+           evname[event], trpid, trwd);
+#endif
        if (job != NULL) {
                char flags[4];
 



Home | Main Index | Thread Index | Old Index