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: prefer 'long long' over 'long' on 32-bit ...



details:   https://anonhg.NetBSD.org/src/rev/499d2a41c2f9
branches:  trunk
changeset: 364463:499d2a41c2f9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 26 14:02:40 2022 +0000

description:
make: prefer 'long long' over 'long' on 32-bit C99 platforms

When sorting the words of an expression numerically using the modifier
':On' (added on 2021-07-30), use 64-bit numbers even on 32-bit
platforms.  A typical use case is comparing file sizes.

When tracing the execution of jobs, fix an integer overflow after 2038.
32-bit platforms that use a pre-C99 compiler still have this problem.

No change to the test suite since most tests simply skip any potential
differences between 32-bit platforms and 64-bit platforms (see
varmod-order-numeric.mk) or already account for both variants (see
varmod-localtime.mk).

diffstat:

 usr.bin/make/make.h  |  4 ++--
 usr.bin/make/trace.c |  6 +++---
 usr.bin/make/var.c   |  6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diffs (72 lines):

diff -r 2301afec5598 -r 499d2a41c2f9 usr.bin/make/make.h
--- a/usr.bin/make/make.h       Sat Mar 26 13:41:16 2022 +0000
+++ b/usr.bin/make/make.h       Sat Mar 26 14:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: make.h,v 1.298 2022/02/05 00:26:21 rillig Exp $        */
+/*     $NetBSD: make.h,v 1.299 2022/03/26 14:02:40 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -136,7 +136,7 @@
 #define MAKE_ATTR_USE          /* delete */
 #endif
 
-#if __STDC__ >= 199901L || defined(lint)
+#if __STDC_VERSION__ >= 199901L || defined(lint)
 #define MAKE_INLINE static inline MAKE_ATTR_UNUSED
 #else
 #define MAKE_INLINE static MAKE_ATTR_UNUSED
diff -r 2301afec5598 -r 499d2a41c2f9 usr.bin/make/trace.c
--- a/usr.bin/make/trace.c      Sat Mar 26 13:41:16 2022 +0000
+++ b/usr.bin/make/trace.c      Sat Mar 26 14:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trace.c,v 1.31 2022/02/05 00:26:21 rillig Exp $        */
+/*     $NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 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.31 2022/02/05 00:26:21 rillig Exp $");
+MAKE_RCSID("$NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 rillig Exp $");
 
 static FILE *trfile;
 static pid_t trpid;
@@ -90,7 +90,7 @@
 
        gettimeofday(&rightnow, NULL);
 
-#if __STDC__ >= 199901L
+#if __STDC_VERSION__ >= 199901L
        fprintf(trfile, "%lld.%06ld %d %s %d %s",
            (long long)rightnow.tv_sec, (long)rightnow.tv_usec,
            jobTokensRunning,
diff -r 2301afec5598 -r 499d2a41c2f9 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Mar 26 13:41:16 2022 +0000
+++ b/usr.bin/make/var.c        Sat Mar 26 14:02:40 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $        */
+/*     $NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $        */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -3217,7 +3217,7 @@
        return AMR_BAD;
 }
 
-#if __STDC__ >= 199901L
+#if __STDC_VERSION__ >= 199901L
 # define NUM_TYPE long long
 # define PARSE_NUM_TYPE strtoll
 #else



Home | Main Index | Thread Index | Old Index