Subject: bin/7343: gcc check for deprecated unix define seems wrong
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@erik-be.uni-c.dk>
List: netbsd-bugs
Date: 04/08/1999 11:44:23
>Number:         7343
>Category:       bin
>Synopsis:       gcc check for deprecated unix define seems wrong
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr  8 02:50:01 1999
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	
>Release:        NetBSD-1.4ALPHA, 6. Apr 1999
>Environment:
System: NetBSD erik-be.uni-c.dk 1.4_ALPHA NetBSD 1.4_ALPHA (ERIKBE) #208: Tue Apr 6 13:59:12 MEST 1999 erik@erik-be.uni-c.dk:/sw/NetBSD/src/sys/arch/i386/compile/ERIKBE i386


>Description:
	When compiling the new procmail, I noticed the following warning:
	cc -c -O procmail.c
	In file included from procmail.h:3,
			 from procmail.c:18:
			 includes.h:337: warning: deprecated symbol "unix" is no longer predefined

	Looking at includes.h reveals the following lines that don't reference
	"unix":

	#ifdef u   
	#undef u                                       /* and the winner is: AIX 3.2 */
	#endif

	Furthermore looking at src/gnu/dist/gcc to reveal the place where the
	warning is issued yields:

	  if (islookup && !strncmp(name, "unix", len) && !warned_unix) {
	      warned_unix++;
	      warning("deprecated symbol \"unix\" is no longer predefined");
		  
	This looks wrong to me: if I read it correctly, all prefixes of unix
	(e.g. "u" will cause the warning).
>How-To-Repeat:
>Fix:

Index: cccp.c
===================================================================
RCS file: /sw/cvs-base/src/gnu/dist/gcc/cccp.c,v
retrieving revision 1.1.1.6
diff -c -r1.1.1.6 cccp.c
*** cccp.c	1998/12/10 17:44:59	1.1.1.6
--- cccp.c	1999/04/08 09:41:02
***************
*** 9579,9585 ****
      bucket = bucket->next;
    }
    /* Lookups pass no hashcode.  #define passes one.  Look for no hashcode. */
!   if (islookup && !strncmp(name, "unix", len) && !warned_unix) {
      warned_unix++;
      warning("deprecated symbol \"unix\" is no longer predefined");
    }
--- 9579,9585 ----
      bucket = bucket->next;
    }
    /* Lookups pass no hashcode.  #define passes one.  Look for no hashcode. */
!   if (islookup && !strncmp(name, "unix", 4) && !warned_unix) {
      warned_unix++;
      warning("deprecated symbol \"unix\" is no longer predefined");
    }
Index: cpphash.c
===================================================================
RCS file: /sw/cvs-base/src/gnu/dist/gcc/cpphash.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 cpphash.c
*** cpphash.c	1998/09/01 14:50:18	1.1.1.4
--- cpphash.c	1999/04/08 09:42:39
***************
*** 86,92 ****
      bucket = bucket->next;
    }
    /* Lookups pass no hashcode.  #define passes one.  Look for no hashcode. */
!   if (islookup && !strncmp(name, "unix", len) && !warned_unix) {
      warned_unix++;
      warning("deprecated symbol \"unix\" is no longer predefined");
    }
--- 86,92 ----
      bucket = bucket->next;
    }
    /* Lookups pass no hashcode.  #define passes one.  Look for no hashcode. */
!   if (islookup && !strncmp(name, "unix", 4) && !warned_unix) {
      warned_unix++;
      warning("deprecated symbol \"unix\" is no longer predefined");
    }

 regards
 Erik Bertelsen
>Audit-Trail:
>Unformatted: