NetBSD Problem Report #16348

Received: (qmail 19803 invoked from network); 14 Apr 2002 06:03:56 -0000
Message-Id: <200204140604.g3E64XG17806@flurgle.eecs.harvard.edu>
Date: Sun, 14 Apr 2002 02:04:33 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.netbsd.org
Subject: minor make patch
X-Send-Pr-Version: 3.95

>Number:         16348
>Category:       bin
>Synopsis:       minor warning fixes to -current make
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 14 06:04:00 +0000 2002
>Closed-Date:    Fri Jan 28 05:22:12 +0000 2005
>Last-Modified:  Fri Jan 28 05:22:12 +0000 2005
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Release:        NetBSD-current of 20020413
>Organization:
		Harvard EECS
>Environment:


System: NetBSD flurgle 1.5Z NetBSD 1.5Z (FLURGLE) #3: Wed Dec 12 16:51:30 EST 2001 root@flurgle:/usr/src/sys/arch/i386/compile/FLURGLE i386
Architecture: i386
Machine: i386
>Description:

	I happened to be porting make to another platform today. The
	enclosed patch fixes a few gcc warnings I ran into, and
	doesn't seem to (and shouldn't) affect the mainstream build.

	Note that one change adds an XXX - this is because while the
	change that's in the patch suppresses the warning, it is not a
	proper fix. 

	The problem is that on a 32-bit platform, one of the type
	flag bits is the sign bit. The result is that the constant 
	OP_TRANSFORM becomes, pedantically, unsigned, and thus
	triggers a warning. Presumably later gccs don't do this 
	conversion in the same way, but AFAICR from the standard it is
	in fact correct, or at least legal, to convert to unsigned. :-/

	The proper fix is either to change the node type flags so that
	the sign bit isn't used, or to change the node type field and
	associated data to unsigned. I didn't want to do either of these
	blindly without further thought.

	If this is too pedantic to bother with, as I'm inclined to
	think after writing about it, take the approprate change out
	of the patch and throw it away, but please do look at the rest. :-)


>How-To-Repeat:

	Compile with gcc 2.95.2 for i386 using -Wall -W -Werror.

>Fix:

	Patch against today (20020413)'s -current usr.bin/make.

Index: arch.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/arch.c,v
retrieving revision 1.34
diff -u -r1.34 arch.c
--- arch.c	2001/11/30 01:29:48	1.34
+++ arch.c	2002/04/14 05:42:16
@@ -524,7 +524,7 @@
 	} else {
 	    /* Try truncated name */
 	    char copy[AR_MAX_NAME_LEN+1];
-	    int len = strlen (member);
+	    size_t len = strlen (member);

 	    if (len > AR_MAX_NAME_LEN) {
 		len = AR_MAX_NAME_LEN;
@@ -819,7 +819,7 @@
     int		  size;       /* Size of archive member */
     char	  *cp;	      /* Useful character pointer */
     char	  magic[SARMAG];
-    int		  len, tlen;
+    size_t	  len, tlen;

     arch = fopen (archive, mode);
     if (arch == (FILE *) NULL) {
@@ -1009,6 +1009,9 @@
 	times.actime = times.modtime = now;
 	utime(gn->path, &times);
     }
+#else
+    /* unused */
+    (void) gn;
 #endif
 }

Index: dir.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/dir.c,v
retrieving revision 1.33
diff -u -r1.33 dir.c
--- dir.c	2002/02/03 20:08:30	1.33
+++ dir.c	2002/04/14 05:42:17
@@ -746,6 +746,10 @@
 {
     char *file;		/* the current filename to check */

+    /* not used */
+    (void) name;
+    (void) hasSlash;
+
     if (DEBUG(DIR)) {
 	printf("%s...", p->name);
     }
@@ -904,6 +908,9 @@
     char *name;
     char *cp;
 {
+
+	/* not used */
+	(void) hasSlash;

 	if (Hash_FindEntry (&dot->files, cp) != (Hash_Entry *)NULL) {
 	    if (DEBUG(DIR)) {
Index: job.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/job.c,v
retrieving revision 1.70
diff -u -r1.70 job.c
--- job.c	2002/03/18 13:32:36	1.70
+++ job.c	2002/04/14 05:42:19
@@ -425,6 +425,8 @@
 	 * Do nothing.  The mere fact that we've been called will cause
 	 * poll/select in Job_CatchOutput() to return early.
 	 */
+
+	(void) signo;
 }


@@ -446,6 +448,9 @@
 JobContinueSig(signo)
     int	    signo;	/* The signal number we've received */
 {
+    /* not used */
+    (void) signo;
+
     JobRestartJobs();
 }
 #endif
Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/main.c,v
retrieving revision 1.83
diff -u -r1.83 main.c
--- main.c	2002/03/14 16:08:39	1.83
+++ main.c	2002/04/14 05:42:20
@@ -972,6 +972,9 @@
 	char *name, *path = emalloc(len);
 	int setMAKEFILE;

+	/* Not used */
+	(void) q;
+
 	if (!strcmp(fname, "-")) {
 		Parse_File("(stdin)", stdin);
 		Var_Set("MAKEFILE", "", VAR_GLOBAL, 0);
@@ -1050,7 +1053,7 @@
     char *cp, **mp;
     int is_cmd, next_cmd;
     int i;
-    int n;
+    size_t n;

     if (Check_Cwd_Off)
 	return NULL;
Index: make.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/make.c,v
retrieving revision 1.49
diff -u -r1.49 make.c
--- make.c	2002/03/21 11:42:21	1.49
+++ make.c	2002/04/14 05:42:20
@@ -754,6 +754,9 @@
 {
     GNode	*cgn = (GNode *) cgnp;

+    /* not used */
+    (void) pgnp;
+
     cgn->type &= ~OP_MARK;
     return (0);
 }
Index: suff.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/suff.c,v
retrieving revision 1.38
diff -u -r1.38 suff.c
--- suff.c	2002/02/04 17:24:57	1.38
+++ suff.c	2002/04/14 05:42:21
@@ -862,7 +862,7 @@
 	return 1;
     }

-    if (target->type == OP_TRANSFORM)
+    if (target->type == (int) OP_TRANSFORM)	 /* XXX */
 	return 0;

     if ((ptr = strstr(target->name, gs->s->name)) == NULL ||
Index: targ.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/targ.c,v
retrieving revision 1.27
diff -u -r1.27 targ.c
--- targ.c	2002/03/20 18:10:31	1.27
+++ targ.c	2002/04/14 05:42:22
@@ -719,6 +719,10 @@
     ClientData   junk;
 {
     GNode	  *gn = (GNode *) gnp;
+
+    /* not used */
+    (void) junk;
+
     if (gn->type & OP_DOUBLEDEP)
 	Lst_ForEach (gn->cohorts, TargPropagateCohort, gnp);
     return (0);
Index: var.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/make/var.c,v
retrieving revision 1.69
diff -u -r1.69 var.c
--- var.c	2002/03/21 01:24:44	1.69
+++ var.c	2002/04/14 05:42:23
@@ -642,6 +642,9 @@
 {
     register char *slash;

+    /* not used */
+    (void) ctx;
+
     slash = strrchr (word, '/');
     if (slash != (char *)NULL) {
 	if (addSpace) {
@@ -690,6 +693,9 @@
 {
     register char *slash;

+    /* not used */
+    (void) ctx;
+
     if (addSpace) {
 	Buf_AddByte (buf, (Byte)' ');
     }
@@ -730,6 +736,9 @@
 {
     register char *dot;

+    /* not used */
+    (void) ctx;
+
     dot = strrchr (word, '.');
     if (dot != (char *)NULL) {
 	if (addSpace) {
@@ -769,6 +778,9 @@
 {
     register char *dot;

+    /* not used */
+    (void) ctx;
+
     if (addSpace) {
 	Buf_AddByte (buf, (Byte)' ');
     }
@@ -809,6 +821,9 @@
     Buffer  	  buf;	    	/* Buffer in which to store it */
     ClientData    pattern; 	/* Pattern the word must match */
 {
+    /* not used */
+    (void) ctx;
+
     if (Str_Match(word, (char *) pattern)) {
 	if (addSpace) {
 	    Buf_AddByte(buf, (Byte)' ');
@@ -894,6 +909,9 @@
     Buffer  	  buf;	    	/* Buffer in which to store it */
     ClientData    pattern; 	/* Pattern the word must match */
 {
+    /* not used */
+    (void) ctx;
+
     if (!Str_Match(word, (char *) pattern)) {
 	if (addSpace) {
 	    Buf_AddByte(buf, (Byte)' ');
@@ -932,6 +950,9 @@
     register char 	*cp;	    /* General pointer */
     VarPattern	*pattern = (VarPattern *) patternp;

+    /* not used */
+    (void) ctx;
+
     wordLen = strlen(word);
     if ((pattern->flags & (VAR_SUB_ONE|VAR_SUB_MATCHED)) !=
 	(VAR_SUB_ONE|VAR_SUB_MATCHED)) {
@@ -1138,6 +1159,9 @@
     int added;
     int flags = 0;

+    /* not used */
+    (void) ctx;
+
 #define MAYBE_ADD_SPACE()		\
 	if (addSpace && !added)		\
 	    Buf_AddByte(buf, ' ');	\
@@ -1272,6 +1296,9 @@
     char *s;
     int slen;

+    /* not used */
+    (void) ctx;
+
     if (word && *word) {
         Var_Set(loop->tvar, word, loop->ctxt, VAR_NO_EXPORT);
         s = Var_Subst(NULL, loop->str, loop->ctxt, loop->err);
@@ -1999,8 +2026,8 @@
 	 */
 	*tstr++ = ':';
 	while (*tstr != endc) {
-	    char	*newStr;    /* New value to return */
-	    char	termc;	    /* Character which terminated scan */
+	    char	*newStr = NULL;   /* New value to return */
+	    char	termc = 0;	  /* Character which terminated scan */

 	    if (DEBUG(VAR)) {
 		printf("Applying :%c to \"%s\"\n", *tstr, str);
@@ -2011,7 +2038,7 @@
 		if (tstr[1] == '=' ||
 		    (tstr[2] == '=' &&
 		     (tstr[1] == '!' || tstr[1] == '+' || tstr[1] == '?'))) {
-		    GNode *v_ctxt;		/* context where v belongs */
+		    GNode *v_ctxt = NULL;	/* context where v belongs */
 		    char *emsg;
 		    VarPattern	pattern;
 		    int	how;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jmc@netbsd.org
State-Changed-When: Fri, 28 Jan 2005 05:22:12 +0000
State-Changed-Why:
Current make code passes all warnings this noted.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.