Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Dec 1995 19:47:22 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        current@FreeBSD.ORG, scrappy@hub.org
Subject:   Re: cd /usr/src/lib; make depend...Fails
Message-ID:  <199512080847.TAA18565@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>===> libmytinfo
>cc -O -Wall -I/usr/src/lib/libmytinfo -c /usr/src/lib/libmytinfo/readcaps.c -o readcaps.o
>In file included from /usr/src/lib/libmytinfo/defs.h:32,
>                 from /usr/src/lib/libmytinfo/readcaps.c:13:
>/usr/include/stdlib.h:42: warning: empty declaration
>In file included from /usr/src/lib/libmytinfo/readcaps.c:13:
>/usr/src/lib/libmytinfo/defs.h:194: conflicting types for `sys_errlist'
>/usr/include/stdio.h:244: previous declaration of `sys_errlist'
>*** Error code 1
>...
>	The offending code is:

>#if __FreeBSD__ != 2
>extern char *sys_errlist[];
>#endif

The compiler is expected to define __FreeBSD__ as 2.  If you use gcc-2.7.x,
then you have to change the bogus definition of __FreeBSD__ in the supplied
freebsd.h, which is for FreeBSD-1.1 or earlier.

It is bogus for the compiler to define the OS version, as this example
shows - the correct declaration of sys_errlist[] depends on the OS
version, not on the compiler.

>	Since the code *is* for current, is there any reason that this
>has been kept in defs.h?  I've commented out that section of code, and
>it compiles through...

I think it is so that diffs can be sent to the central maintainer of the
sources.  Bogus tests of the form `#if _FOO_OS == 2 || ...' might be
acceptable to the central maintainer, but ones that #include a magic
header to get a magic #define aren't, because the magic header might
not exist.

>	Now, the first error, in stdlib.h:42 still comes up...

>cc -O -Wall -I/usr/src/lib/libmytinfo -c /usr/src/lib/libmytinfo/readcaps.c -o readcaps.o
>In file included from /usr/src/lib/libmytinfo/defs.h:32,
>                 from /usr/src/lib/libmytinfo/readcaps.c:13:
>/usr/include/stdlib.h:42: warning: empty declaration
>cc -O -Wall -I/usr/src/lib/libmytinfo  -o mkcaplist /usr/src/lib/libmytinfo/mkcaplist.c readcaps.o
>In file included from /usr/src/lib/libmytinfo/defs.h:32,
>                 from /usr/src/lib/libmytinfo/mkcaplist.c:15:
>/usr/include/stdlib.h:42: warning: empty declaration


>	The offending code here, is:

>#ifdef  _BSD_SIZE_T_
>typedef _BSD_SIZE_T_    size_t;
>#undef  _BSD_SIZE_T_
>#endif

>	This one, someone is going to have to explain to me...

>	if _BSD_SIZE_T_ is defined, redefine it and then undefine
>it again?  If this is right, why?  If i is wrong, my first guess would
>be that it is backwards, in that the #undef should come before the
>typedef...

If you use gcc-2.7.x, then you have to throw out or fix the supplied
stdarg.h, which takes over 50 lines to define _BSD_SIZE_T_ incorrectly.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512080847.TAA18565>