The attached code, compiled with
clang -Wall varfunc.c
creates the warning
varfunc.c:27:30: warning: missing sentinel in function call
printf ("%d\n", add_em_up (3, 5, 5, 6, (int *) 0));
^
varfunc.c:8:1: note: function has been explicitly marked sentinel here
add_em_up (int count,...)
Replacing "(int *) 0" by "(void *) 0" or "NULL" solves the problem. However,
the gcc documentation at
Function Attributes (Using the GNU Compiler Collection (GCC))
stipulates that
A valid NULL in this context is defined as zero with any pointer type. If your system defines the NULL macro with an integer type then you need to add an explicit cast. GCC replaces stddef.h with a copy that redefines NULL appropriately.
Indeed, gcc compiles the attached code without problem. So this looks like
a bug in clang.
Output of "clang --version":
clang version 1.1 (Debian 2.7-3)
Target: i386-pc-linux-gnu
Thread model: posix
Andreas
PS: I would have filed a bug, were it not for the need of creating an account.
varfunc.c (528 Bytes)