tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

must use gcc builtin?



From /usr/include/machine/ansi.h:

#ifdef __GNUC__
#define _BSD_VA_LIST_    __builtin_va_list /* GCC built-in type */
#else
#define _BSD_VA_LIST_    char *    /* XXXfvdl should be ok? */ 
#endif

How  to avoid using gcc's builtin va_list when compiling with gcc?  

Just for fun, I thought I'd try compiling Gary Capell's "wily"
editor. The code is from 2006, hardly ancient.  Its library manipulates
a va_list as pointer using assignment and subtraction.  AFAICT the
above code makes that impossible.  The compiler certainly doesn't like
it.  

        return ap - (va_list)o;

        ../../libplan9c/doprint.c:369: error: cast specifies array type

I can't #undef __GNUC__.  Do we really want to require the use of
builtins?  I'd like a knob to compile idiomatic C, especially
*good* idiomatic C.   

http://pubs.opengroup.org/onlinepubs/009604599/basedefs/stdarg.h.html

does not define a type for va_list.  Assuming it's a pointer might be
nonportable, but it's not prohibited by the standard.  

(BTW, why is this code in the machine directory?  I don't see any
architecture dependency.)  

--jkl


Home | Main Index | Thread Index | Old Index