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).
This commit is contained in:
rillig 2022-03-26 14:02:40 +00:00
parent bb9cc87442
commit 302298bffd
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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 @@ Trace_Log(TrEvent event, Job *job)
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,

View File

@ -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 @@ bad_modifier:
return AMR_BAD;
}
#if __STDC__ >= 199901L
#if __STDC_VERSION__ >= 199901L
# define NUM_TYPE long long
# define PARSE_NUM_TYPE strtoll
#else