This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Today's source cannot build on NetBSD


On Fri, 7 Jan 2000, Kaveh R. Ghazi wrote:

> So perhaps it would be proper to declare it like that in the
> libiberty.h header file?  Does netbsd define __FreeBSD__ ?

No. It defines __NetBSD__  ;-)

> Does this patch fix things for you?

Yes, but I don't think it is the right thing to do...

> If it does, can you or anyone explain why _BSD_VA_LIST_ exists?  Do
> the other v*printf functions use it too?  What happens if you pass a
> va_list to vasprintf?  I.e. can you compile gcc/f/{com.c,sts.c} ?
> (Those files use vasprintf and pass it a va_list.)

I think it's there for making maintenance easy. For each architecture
there are an include file machine/ansi.h that defines _BSD_ versions
of the ANSI types 

/*
 * Types which are fundamental to the implementation and may appear in
 * more than one standard header are defined here.  Standard headers
 * then use:
 *      #ifdef  _BSD_SIZE_T_
 *      typedef _BSD_SIZE_T_ size_t;
 *      #undef  _BSD_SIZE_T_
 *      #endif
 */

and it defines _BSD_VA_LIST_ as

#define _BSD_VA_LIST_           char *          /* va_list */

for the i386.

This definition is used in stdarg.h to typedef va_list:

typedef _BSD_VA_LIST_  va_list;


What is happening when I try to bootstrap is that va_list is taken from
gnu/include/stdarg.h and the prototype from the standard include
directory that uses the _BSD_VA_LIST_ from machine/ansi.h.
It could as well use va_list, but they are beleived to be identical
by the system headers, so I'd guess it's historical reason that
_BSD_VA_LIST_ is used.


I got some suggestions from Marc Espie that I think is the correct way
to fix this. Basically I'll provide a fixed version of machine/ansi.h
at fixincludes time (together with some other random fallout.)
I'm rather busy at the moment, but I'll try to fix this soon.



Btw. is libiberty.h really the right place for this prototype. The
file has this comment

   The libiberty library provides a number of functions which are
   missing on some operating systems.  We do not declare those here,
   to avoid conflicts with the system header files on operating
   systems that do support those functions.  In this file we only
   declare those functions which are specific to libiberty.

and the other functions provided by libiberty is not prototyped there
(but in gcc/sys-protos.h ?)

   /Krister



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]