This is the mail archive of the gcc@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: FreeBSD 4.0


"David O'Brien" wrote:
> > Because the "real" type is __gnuc_va_list.  Doing it your way won't do
> > what you want.  I hope you don't have system headers that typedef
> > _BSD_VA_LIST_ without reference to gcc's stdarg.h - 
> 
>     from /usr/include/machine/ansi.h
> 
>         #define _BSD_VA_LIST_   char *                  /* va_list */
> 
> There are no GCC headers in my base system.  We've never needed them, and
> there are copyright issues anyway.

Do you have your own stdarg.h too?

This definition will not work with the new stdarg scheme.  gcc's
stdarg.h does

#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif

__builtin_va_list is an opaque type which may be 'char *' deep inside,
but won't be compatible in the C sense with 'char *'.

Since it's a #define not a typedef, we can work around it:

#ifdef _BSD_VA_LIST_
#undef _BSD_VA_LIST_
#define _BSD_VA_LIST_ __gnuc_va_list
#endif

but that requires us to get machine/ansi.h included by stdarg.h.
Since that header is BSD specific, we go back to needing some
automatically defined macro that can be tested.  And I'm sorry, but
Andreas is right, we cannot use 'BSD'.  Suppose stdarg.h is the very
first header included by a user program.  Only the macros predefined
by the compiler are available, and those don't include BSD.  (It has
nothing to do with -ansi.)  gcc's stddef.h has the same problem and is
using

/* On 4.3bsd-net2, make sure ansi.h is included, so we have
   one less case to deal with in the following.  */
#if defined __BSD_NET2__ || defined ____386BSD____ \
    || defined __FreeBSD__ || defined __NetBSD__
#include <machine/ansi.h>
#endif

which looks pretty safe modulo the absence of __OpenBSD__...

I'd like to know what machine/ansi.h does on Alphas, where "char *"
doesn't work for va_list.

zw


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