diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2011-03-08 02:33:44 -0600 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-03-08 12:02:31 -0800 |
commit | 26db0f2e3afc043e184a5e0ce5eb7c53aeb1f644 (patch) | |
tree | 2a3fb0dcbfac0afb11ed2e23b39c3f88a2f5cac4 /xdiff | |
parent | strbuf: add strbuf_vaddf (diff) | |
download | tgif-26db0f2e3afc043e184a5e0ce5eb7c53aeb1f644.tar.xz |
compat: fall back on __va_copy if available
Since an obvious implementation of va_list is to make it a pointer
into the stack frame, implementing va_copy as "dst = src" will work on
many systems. Platforms that use something different (e.g., a size-1
array of structs, to be assigned with *(dst) = *(src)) will need some
other compatibility macro, though.
Luckily, as the glibc manual hints, such systems tend to provide the
__va_copy macro (introduced in GCC in March, 1997). By using that if
it is available, we can cover our bases pretty well.
Discovered by building with CC="gcc -std=c89" on an amd64 machine:
$ make CC=c89 strbuf.o
[...]
strbuf.c: In function 'strbuf_vaddf':
strbuf.c:211:2: error: incompatible types when assigning to type 'va_list'
from type 'struct __va_list_tag *'
make: *** [strbuf.o] Error 1
Explained-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff')
0 files changed, 0 insertions, 0 deletions