how to fool gcc?

Andreas Hauser andy at splashground.de
Tue Feb 10 03:30:48 PST 2004


des wrote @ Tue, 10 Feb 2004 10:09:03 +0100:
 
> Part of the patch declares openpam_log(3) as printf-like so gcc can
> check format strings etc.  However, openpam_log(3) is also used in
> debugging macros such as this:
> 
> #define RETURNS(s) do { \
>         if ((s) == NULL) \
>                 openpam_log(PAM_LOG_DEBUG, "returning NULL"); \
>         else \
>                 openpam_log(PAM_LOG_DEBUG, "returning '%s'", (s)); \
>         return (s); \
> } while (0)

That is how it looks after preprocessing,
obviously not what what you want.

...
openpam_log(PAM_LOG_DEBUG, "returning '%s'", (0));
...

Andy


More information about the freebsd-hackers mailing list