Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

comp.sys.hp.hpux FAQ
Section - 6.2.4 Why do I get "_builtin_va_start" undefined when I build with gcc?

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Airports ]


Top Document: comp.sys.hp.hpux FAQ
Previous Document: 6.2.3 How do I deal with "too many defines"?
Next Document: 6.2.5 Is there some kind of problem with using FLT_MIN in ANSI mode?
See reader questions & answers on this topic! - Help others by sharing your knowledge

The <varargs.h> and <stdarg.h> include files define va_start in terms of
this function, which is built-in on the HP C compiler.

If you're using GCC you should be picking up include files
from the gcc library directory.  These include files do the right
thing for both GCC and HP C.

More often than not these files were never installed, or someone has
placed a copy of varargs.h/stdarg.h into /usr/local/include (gcc searches
there *first*).

When all else fails, you can replace the definition of va_start as
follows, depending on whether you are using varargs or stdarg (K&R or
ANSI, respectively).

    #include <varargs.h>
    #ifdef __hppa
    #undef va_start
    #define va_start(a) ((a)=(char *)&va_alist+4)
    #endif

    #include <stdarg.h>
    #ifdef __hppa
    #undef va_start
    #define va_start(a,b) ((a)=(va_list)&(b))
    #endif

For <varargs.h>, this replacement should always work.

For <stdarg.h>, this replacement will work unless the last fixed
parameter ("b" in the call to va_start) is a structure larger
than 8 bytes.  Large structures are passed by reference, with the
callee responsible for copying the structure to a temporary area
if it will be modified.  In this case, "&b" will take the address
of that temporary area instead of the position in the argument
list, and va_next won't work.  That's why HP uses a compiler
built-in.

User Contributions:

Comment about this article, ask questions, or add new information about this topic:




Top Document: comp.sys.hp.hpux FAQ
Previous Document: 6.2.3 How do I deal with "too many defines"?
Next Document: 6.2.5 Is there some kind of problem with using FLT_MIN in ANSI mode?

Single Page

[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
hpux.faq@gmail.com





Last Update March 27 2014 @ 02:11 PM