I'm not subscribed to clang mailing list, so not sure if my mail 
comes throught. I'm reading the list via gmane.


I guess utilizing gcc  __attribute__((format(...))) would help 
here. You could put that at the log


int logmessage(
        int loglevel,
        char const *fmt __attribute__ (format (printf, 2, 3))),
        ...) {
   // more code
}

That way the compiler knows that fmt *IS* a format string and 
won't need to warn when it is used in vprintf().

Code that calls logmessage() would know that fmt is a printf-like 
format string and can check calls to logmessage. This attribute 
would even help in the case of call-backs.


BTW: why "char const *" and not "const char*" ?


_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to