On Dec 17, 2007, at 7:19 AM, Holger Schurig wrote:

> 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.

I like this solution.  I think this would catch 90% of the correct  
cases, while suppressing most bogus messages.
_______________________________________________
cfe-dev mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

Reply via email to