[Xorp-cvs] XORP cvs commit: xorp/libxorp

Pavlin Radoslavov pavlin@icir.org
Fri, 23 Dec 2005 15:07:46 -0800


> Bruce M Simpson wrote:
> > I read that __va_copy is meant to be recognized by gcc 2.95.x vintage,
> > but can't find any header definitions for it in the default compiler
> > search paths.
> 
> Yes, FreeBSD hasn't many headers from gcc-2.95. If there are Berkeley 
> equivalents, these are used. If FreeBSD 4.x must be supported platform, 
> the only solution is to define your own va_copy if va_copy and __va_copy 
> are not defined. Note, that in the gcc-2.95 __va_copy define is trivial:
> 
> #define __va_copy(dest, src) (dest) = (src)
> 
> However it might not work on every platform in earth. See  
> http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2003-11/4133.html
> for example for more info.

Thanks for the pointer. Indeed, it seems a bit tricky to define a
generic va_copy() implementation, so it is better we don't do it
rather than risking introducing a bug that is difficult to trace.

Anyway, for the time being now we have configure-time check for
va_copy() and the xlog.c code is modified to use the new
"#ifdef HAVE_VA_COPY" instead of "#ifdef va_copy".
The reason for that replacement is that, as I mentioned in the CVS
log message, the va_copy() implementation may not be macro-based.
[See Section 7.15.1.2 from the C99 specification available from
http://www.open-std.org/JTC1/SC22/WG14/www/standards.html]

This solution still works on FreeBSD-4.x with gcc-2.95, and only if
we need to deal with some other old systems that don't have
va_copy() then we can think of something better.

Pavlin