Subject: misc/6184: /usr/include/machine/limits.h and egcs
To: None <gnats-bugs@gnats.netbsd.org>
From: Peter Simons <simons@peti.gmd.de>
List: netbsd-bugs
Date: 09/21/1998 13:04:31
>Number:         6184
>Category:       misc
>Synopsis:       /usr/include/machine/limits.h and egcs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 21 04:05:00 1998
>Last-Modified:
>Originator:     Peter Simons
>Organization:
        
>Release:        NetBSD/i386 1.3
>Environment:
        
System: NetBSD peti.gmd.de 1.3 NetBSD 1.3 (PETI) #1: Wed Feb 11 13:59:52 CET 1998 simons@peti.gmd.de:/usr/src/sys/arch/i386/compile/PETI i386


>Description:

When installing egcs 1.1 as an additional compiler into NetBSD 1.3,
egcs installs its own version of the limits.h header file.
Unfortunately compiling sources might yield warnings, because the
limits.h file of NetBSD will re-define these symbols:

 | simons@peti:~/src/mfo/source$ g++ -Wall -ansi -pedantic -c main.cpp
 | In file included from /usr/include/sys/param.h:102,
 |               from /usr/include/netdb.h:64,
 |               from include/../include/socket++.hpp:52,
 |               from listener.hpp:43,
 |               from ./main.cpp:41:
 | /usr/include/machine/limits.h:41: warning: `SCHAR_MAX' redefined
 | /usr/local/egcs/lib/gcc-lib/i386-unknown-netbsd1.3/egcs-2.92.07/include/limits.h:33:
 |                  warning: this is the location of the previous definition
 |
 | [...]


>How-To-Repeat:
        
>Fix:

*** /usr/src/sys/arch/i386/include/limits.h     Thu Dec 21 13:28:55 1995
--- /usr/include/machine/limits.h       Mon Sep 21 13:02:41 1998
***************
*** 35,40 ****
--- 35,42 ----
   *    @(#)limits.h    7.2 (Berkeley) 6/28/90
   */

+ #ifndef _GCC_LIMITS_H_        /* Did egcs define those already? */
+
  #define       CHAR_BIT        8               /* number of bits in a char */
  #define       MB_LEN_MAX      1               /* no multibyte characters */

***************
*** 56,61 ****
--- 58,66 ----
  #define       ULONG_MAX       0xffffffffUL    /* max value for an unsigned long */
  #define       LONG_MAX        0x7fffffffL     /* max value for a long */
  #define       LONG_MIN        (-0x7fffffffL-1)        /* min value for a long */
+
+ #endif /* !defined(_GCC_LIMITS_H_) */
+

  #if !defined(_ANSI_SOURCE)
  #define       SSIZE_MAX       INT_MAX         /* max value for a ssize_t */

>Audit-Trail:
>Unformatted: