views:

91

answers:

2

What does this GCC warning mean?

cpfs.c:232:33: warning: ISO C99 requires rest arguments to be used

The relevant lines are:

__attribute__((format(printf, 2, 3)))
static void cpfs_log(log_t level, char const *fmt, ...);

#define log_debug(fmt, ...) cpfs_log(DEBUG, fmt, ##__VA_ARGS__)

log_debug("Resetting bitmap");

The last line being line 232 inside a function implementation. The compiler flags are:

-g -Wall -std=gnu99 -Wfloat-equal -Wuninitialized -Winit-self -pedantic
+1  A: 

It means that you are not passing a second argument to log_debug. It's expecting one or more arguments for the ... part, but you're passing zero.

Douglas
+4  A: 

Yes it means that you have to pass at least two arguments the way that you defined it. You could just do

#define log_debug(...) cpfs_log(DEBUG, __VA_ARGS__)

and then you'd also avoid the gcc extension of the , ## construct.

Jens Gustedt
That puzzled me for quite some time too. Actually standard way would be `log_debug("%s", "Resetting bitmap");`.
Dummy00001