Subject: port-sparc/3163: errno.h multiple inclusion problem
To: None <gnats-bugs@gnats.netbsd.org>
From: Paul Boven <paul@wit387304.student.utwente.nl>
List: netbsd-bugs
Date: 01/30/1997 14:05:35
>Number: 3163
>Category: port-sparc
>Synopsis: errno.h multiple inclusion problem
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jan 30 05:20:00 1997
>Last-Modified:
>Originator: Paul Boven
>Organization:
----------------------------------------------------------------------
Paul Boven, <e.p.boven@student.utwente.nl> PE1NUT QRV 145.575 JO32KF
Nothing would get done in the world, if we didn't have insomniacs.
Or at least, nothing would get done at night.
----------------------------------------------------------------------
>Release: include.tar.gz from current, 4th jan 1997
>Environment:
System: NetBSD wit387304.student.utwente.nl 1.2B NetBSD 1.2B (ELC) #4: Sat Jan 18 17:44:10 CET 1997 paul@wit387304.student.utwente.nl:/usr/src/sys/arch/sparc/compile/ELC sparc
>Description:
When compiling a file that includes errno.h twice, a compilation error
results. The second inclusion of line 54 or /usr/include/errno.h conflicts
with the first one because somehow an extra "const" is generated.
c++ -c -I. -I.. -I../liboctave -I../src -I../glob -I../libcruft/misc -DHAVE_CONFIG_H -fno-implicit-templates -g -O2 -Wall file-ops.cc
In file included from safe-stat.h:30,
from file-ops.cc:47:
/usr/include/errno.h:54: conflicting types for `const char *const const sys_errlist[]'
/usr/include/errno.h:54: previous declaration as `const char * const sys_errlist[]'
This fails on NetBSD-sparc and on intel, so I suspect it's common to most
NetBSD-platforms.
>How-To-Repeat:
I have tried to construct a simple example to trigger this problem, but just
including errno.h twice in a simple c-file does not trigger this effect.
The easiest way to reproduce this would be to ftp octave-2.0(.1) from a
local site or ftp.che.wisc.edu and unpack and ./configure it. Then cd to
the liboctave subdirectory and either "gnumake file-ops.o" or give the
command-line shown in the Description-field. (Don't use NetBSD-make).
>Fix:
The generation of an extra "const" might be a compiler-bug and is way
beyond me to fix. I`d _suggest_ protecting errno.h against multiple inclusion
via te normal _ERRNO_H #define and #ifdef-statements. Because of the somewhat
complicated nature of errno.h I haven't made an actual patch because I cannot
oversee where to put these lines so as not to break compilation for a lot of
other things.
>Audit-Trail:
>Unformatted: