make(1): replace %zu with %u in printf calls

This is needed to compile bmake with GCC 2.8.1 on SunOS 5.9.

To support ancient systems like this, the whole code of usr.bin/make is
supposed to use only ISO C90 features, except for filemon, which is not
used on these systems.
This commit is contained in:
rillig 2020-12-13 21:27:45 +00:00
parent ac4393a924
commit ed7166493f
4 changed files with 20 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: for.c,v 1.116 2020/12/12 00:33:25 rillig Exp $ */
/* $NetBSD: for.c,v 1.117 2020/12/13 21:27:45 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@ -60,7 +60,7 @@
#include "make.h"
/* "@(#)for.c 8.1 (Berkeley) 6/6/93" */
MAKE_RCSID("$NetBSD: for.c,v 1.116 2020/12/12 00:33:25 rillig Exp $");
MAKE_RCSID("$NetBSD: for.c,v 1.117 2020/12/13 21:27:45 rillig Exp $");
static int forLevel = 0; /* Nesting level */
@ -217,8 +217,9 @@ For_Eval(const char *line)
if ((nitems = f->items.len) > 0 && nitems % (nvars = f->vars.len)) {
Parse_Error(PARSE_FATAL,
"Wrong number of words (%zu) in .for substitution list"
" with %zu variables", nitems, nvars);
"Wrong number of words (%u) in .for substitution list"
" with %u variables",
(unsigned)nitems, (unsigned)nvars);
/*
* Return 'success' so that the body of the .for loop is
* accumulated.

View File

@ -1,4 +1,4 @@
/* $NetBSD: meta.c,v 1.159 2020/12/13 20:14:48 rillig Exp $ */
/* $NetBSD: meta.c,v 1.160 2020/12/13 21:27:45 rillig Exp $ */
/*
* Implement 'meta' mode.
@ -924,7 +924,8 @@ fgetLine(char **bufp, size_t *szp, int o, FILE *fp)
newsz = ROUNDUP((size_t)fs.st_size, BUFSIZ);
if (newsz <= bufsz)
return x; /* truncated */
DEBUG2(META, "growing buffer %zu -> %zu\n", bufsz, newsz);
DEBUG2(META, "growing buffer %u -> %u\n",
(unsigned)bufsz, (unsigned)newsz);
p = bmake_realloc(buf, newsz);
*bufp = buf = p;
*szp = bufsz = newsz;

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.480 2020/12/13 20:14:48 rillig Exp $ */
/* $NetBSD: parse.c,v 1.481 2020/12/13 21:27:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -117,7 +117,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: parse.c,v 1.480 2020/12/13 20:14:48 rillig Exp $");
MAKE_RCSID("$NetBSD: parse.c,v 1.481 2020/12/13 21:27:45 rillig Exp $");
/* types and constants */
@ -618,7 +618,7 @@ PrintLocation(FILE *f, const char *fname, size_t lineno)
void *dir_freeIt, *base_freeIt;
if (*fname == '/' || strcmp(fname, "(stdin)") == 0) {
(void)fprintf(f, "\"%s\" line %zu: ", fname, lineno);
(void)fprintf(f, "\"%s\" line %u: ", fname, (unsigned)lineno);
return;
}
@ -635,7 +635,7 @@ PrintLocation(FILE *f, const char *fname, size_t lineno)
if (base == NULL)
base = str_basename(fname);
(void)fprintf(f, "\"%s/%s\" line %zu: ", dir, base, lineno);
(void)fprintf(f, "\"%s/%s\" line %u: ", dir, base, (unsigned)lineno);
bmake_free(base_freeIt);
bmake_free(dir_freeIt);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: var.c,v 1.733 2020/12/13 20:14:48 rillig Exp $ */
/* $NetBSD: var.c,v 1.734 2020/12/13 21:27:45 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
MAKE_RCSID("$NetBSD: var.c,v 1.733 2020/12/13 20:14:48 rillig Exp $");
MAKE_RCSID("$NetBSD: var.c,v 1.734 2020/12/13 21:27:45 rillig Exp $");
/* A string that may need to be freed after use. */
typedef struct FStr {
@ -1467,11 +1467,12 @@ tryagain:
rp++;
if (n >= args->nsub) {
Error("No subexpression \\%zu", n);
Error("No subexpression \\%u",
(unsigned)n);
} else if (m[n].rm_so == -1) {
Error(
"No match for subexpression \\%zu",
n);
"No match for subexpression \\%u",
(unsigned)n);
} else {
SepBuf_AddBytesBetween(buf,
wp + m[n].rm_so, wp + m[n].rm_eo);
@ -1640,8 +1641,8 @@ ModifyWords(const char *str,
words = Str_Words(str, FALSE);
DEBUG2(VAR, "ModifyWords: split \"%s\" into %zu words\n",
str, words.len);
DEBUG2(VAR, "ModifyWords: split \"%s\" into %u words\n",
str, (unsigned)words.len);
for (i = 0; i < words.len; i++) {
modifyWord(words.words[i], &result, modifyWord_args);