C99 variadic macros
John Baldwin
john at baldwin.cx
Thu Feb 5 11:30:33 PST 2004
On Thursday 05 February 2004 11:46 am, Stefan Farfeleder wrote:
> Hi,
>
> I went through the source tree and converted all occurrences of
> GNU-style variadic macros to C99 compliant ones in !contrib code.
> For macros that (ab)use string concatenation like
>
> #define foo(fmt, args...) printf("%s: " fmt "\n", __func__, ##args)
>
> three printf's must be used. As almost all variadic macros are used for
> debugging, this shouldn't matter much. Two occurrences
> (src/lib/libypclnt/ypclnt.h and src/sys/dev/ichsmb/ichsmb.c) remain
> since they can't be converted easily and are already protected by
> defined(__GNUC__).
>
> http://www.ten15.org/~stefanf/FreeBSD/vamacro.diff
C99 macros don't work when args is 0. I.e., if I did:
foo("test");
The C99 _VA_ARGS_ think doesn't delete the , whereas the GCC way does.
--
John Baldwin <john at baldwin.cx> <>< http://www.baldwin.cx/~john/
"Power Users Use the Power to Serve" = http://www.FreeBSD.org
More information about the freebsd-arch
mailing list