From mboxrd@z Thu Jan 1 00:00:00 1970 From: "David O'Brien" To: Zack Weinberg Cc: rittle AT rsch.comm.mot.com, gcc AT gcc.gnu.org Subject: Re: FreeBSD 4.0 Date: Wed, 15 Sep 1999 10:24:00 -0000 Message-id: <19990915102403.I17808@dragon.nuxi.com> References: <199909150533.AAA14241@latour.rsch.comm.mot.com> <199909150601.XAA22053@zack.bitmover.com> <19990914231414.B17808@dragon.nuxi.com> <199909150726.AAA31243@zack.bitmover.com> <19990915011710.B25121@relay.nuxi.com> <199909151623.JAA02391@zack.bitmover.com> X-SW-Source: 1999-09/msg00637.html > > 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? Yes. Both /usr/include/stdarg.h and /usr/include/machine/stdarg.h, they are identical files. The following are from the 4.0 development branch. i386 version: typedef char *va_list; #define __va_size(type) \ (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) #ifdef __GNUC__ #define va_start(ap, last) \ ((ap) = (va_list)__builtin_next_arg(last)) #else #define va_start(ap, last) \ ((ap) = (va_list)&(last) + __va_size(last)) #endif #define va_arg(ap, type) \ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) #define va_end(ap) Alpha version: #include #ifdef __lint__ #define __builtin_saveregs() (0) #define __builtin_classify_type(t) (0) #endif typedef _BSD_VA_LIST_ va_list; #define __va_size(type) \ (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ (__builtin_next_arg(last), (ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0) #define __REAL_TYPE_CLASS 8 #define __va_arg_offset(ap, type) \ ((__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS && \ (ap).__offset <= (6 * 8) ? -(6 * 8) : 0) - __va_size(type)) #define va_arg(ap, type) \ (*(type *)((ap).__offset += __va_size(type), \ (ap).__base + (ap).__offset + __va_arg_offset(ap, type))) #define va_end(ap) ((void)0) > 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'. Yes, I offered testing for "BSD" as something configure or any fix includes scripts could do and so _something_inserted_here_ to deal with the issue. > #if defined __BSD_NET2__ || defined ____386BSD____ \ > || defined __FreeBSD__ || defined __NetBSD__ > #include > #endif Yes, those are the only compiler/cpp defines you can be guarenteed of. > 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. typedef struct { char *__base; int __offset; int __pad; } __va_list; #define _BSD_VA_LIST_ __va_list /* va_list */ -- -- David (obrien@NUXI.com) From mboxrd@z Thu Jan 1 00:00:00 1970 From: "David O'Brien" To: Zack Weinberg Cc: rittle@rsch.comm.mot.com, gcc@gcc.gnu.org Subject: Re: FreeBSD 4.0 Date: Thu, 30 Sep 1999 18:02:00 -0000 Message-ID: <19990915102403.I17808@dragon.nuxi.com> References: <199909150533.AAA14241@latour.rsch.comm.mot.com> <199909150601.XAA22053@zack.bitmover.com> <19990914231414.B17808@dragon.nuxi.com> <199909150726.AAA31243@zack.bitmover.com> <19990915011710.B25121@relay.nuxi.com> <199909151623.JAA02391@zack.bitmover.com> X-SW-Source: 1999-09n/msg00637.html Message-ID: <19990930180200.8nZysl5z1kqF6HQ7m3Zv3L9BITVHm5m9YpDQlEPdFVU@z> > > 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? Yes. Both /usr/include/stdarg.h and /usr/include/machine/stdarg.h, they are identical files. The following are from the 4.0 development branch. i386 version: typedef char *va_list; #define __va_size(type) \ (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) #ifdef __GNUC__ #define va_start(ap, last) \ ((ap) = (va_list)__builtin_next_arg(last)) #else #define va_start(ap, last) \ ((ap) = (va_list)&(last) + __va_size(last)) #endif #define va_arg(ap, type) \ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) #define va_end(ap) Alpha version: #include #ifdef __lint__ #define __builtin_saveregs() (0) #define __builtin_classify_type(t) (0) #endif typedef _BSD_VA_LIST_ va_list; #define __va_size(type) \ (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) #define va_start(ap, last) \ (__builtin_next_arg(last), (ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0) #define __REAL_TYPE_CLASS 8 #define __va_arg_offset(ap, type) \ ((__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS && \ (ap).__offset <= (6 * 8) ? -(6 * 8) : 0) - __va_size(type)) #define va_arg(ap, type) \ (*(type *)((ap).__offset += __va_size(type), \ (ap).__base + (ap).__offset + __va_arg_offset(ap, type))) #define va_end(ap) ((void)0) > 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'. Yes, I offered testing for "BSD" as something configure or any fix includes scripts could do and so _something_inserted_here_ to deal with the issue. > #if defined __BSD_NET2__ || defined ____386BSD____ \ > || defined __FreeBSD__ || defined __NetBSD__ > #include > #endif Yes, those are the only compiler/cpp defines you can be guarenteed of. > 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. typedef struct { char *__base; int __offset; int __pad; } __va_list; #define _BSD_VA_LIST_ __va_list /* va_list */ -- -- David (obrien@NUXI.com)