[cfe-dev] clang missing a warning.

Du Toit, Stefanus stefanus.du.toit at intel.com
Fri Jun 28 09:31:35 PDT 2013


On 2013-06-28 12:13 PM, "James Courtier-Dutton" <james.dutton at gmail.com>
wrote:

>How do I get clang to detect the following error

Clang supports the GCC format attribute. See
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#index-Wformat-26
40

> extern test_printf(const char *format, ...);
> 
[...]
>
> It correctly warns about the lack of a third param in the "printf()"
>line.
> How do I get it to warn on the test_printf() line?



For example, if you change the declaration of test_printf as follows:

  extern int test_printf(const char *format, ...)
    __attribute__ ((format (printf, 1, 2)));;


Then Clang will emit the same warning for both lines.

Stefanus

--
Stefanus Du Toit <stefanus.du.toit at intel.com>
Intel Waterloo
Phone: 519-591-1738





More information about the cfe-dev mailing list