For debugging purposes, I've created a custom logging function. For all practical purposes, let's say it's defined like this:
void debugLog(const char * s, ...) {
va_list args;
va_start(args, s);
if(NULL!=logfp) {
vfprintf(logfp, s, args);
}
va_end(args);
}
The problem is that format warnings are skipped for my custom function.
If I write, for example:
fprintf(logfp, "Received error: %d.\n");
I'll get a warning like this:
warning: format '%d' expects a matching 'int' argument [-Wformat]
But I won't get any warning if I call:
debugLog("Received error: %d.\n");
Is there a way to enable such a warning for my function?
Maybe I can tell mingw-gcc to treat debugLog the way it would treat printf? Or are this kind of warnings hard-coded into the compiler? (ie: gcc simply knows the *printf* family but we can't expect it to know my function)