Module Name:    src
Committed By:   rillig
Date:           Sun Dec 13 21:27:46 UTC 2020

Modified Files:
        src/usr.bin/make: for.c meta.c parse.c var.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/usr.bin/make/for.c
cvs rdiff -u -r1.159 -r1.160 src/usr.bin/make/meta.c
cvs rdiff -u -r1.480 -r1.481 src/usr.bin/make/parse.c
cvs rdiff -u -r1.733 -r1.734 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/for.c
diff -u src/usr.bin/make/for.c:1.116 src/usr.bin/make/for.c:1.117
--- src/usr.bin/make/for.c:1.116	Sat Dec 12 00:33:25 2020
+++ src/usr.bin/make/for.c	Sun Dec 13 21:27:45 2020
@@ -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.

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.159 src/usr.bin/make/meta.c:1.160
--- src/usr.bin/make/meta.c:1.159	Sun Dec 13 20:14:48 2020
+++ src/usr.bin/make/meta.c	Sun Dec 13 21:27:45 2020
@@ -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
 		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;

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.480 src/usr.bin/make/parse.c:1.481
--- src/usr.bin/make/parse.c:1.480	Sun Dec 13 20:14:48 2020
+++ src/usr.bin/make/parse.c	Sun Dec 13 21:27:45 2020
@@ -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
 	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
 	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);
 }

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.733 src/usr.bin/make/var.c:1.734
--- src/usr.bin/make/var.c:1.733	Sun Dec 13 20:14:48 2020
+++ src/usr.bin/make/var.c	Sun Dec 13 21:27:45 2020
@@ -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);

Reply via email to