On Thu, Oct 4, 2018 at 10:12 AM David Malcolm <dmalc...@redhat.com> wrote:
>
> -Wformat in the C++ FE doesn't work as well as it could:
> (a) it doesn't report precise locations within the string literal, and
> (b) it doesn't underline arguments for those arguments !CAN_HAVE_LOCATION_P,
> despite having location wrapper nodes.
>
> For example:
>
>   Wformat-ranges.C:32:10: warning: format '%s' expects argument of type 
> 'char*', but argument 2 has type 'int' [-Wformat=]
>   32 |   printf("hello %s", 42);
>      |          ^~~~~~~~~~
>
> (a) is due to not wiring up the langhook for extracting substring
>     locations.
>
>     This patch uses the one in c-family; it also fixes string literal
>     parsing so that it records string concatenations (needed for
>     extracting substring locations from concatenated strings).
>
> (b) is due to the call to maybe_constant_value here:
>        fargs[j] = maybe_constant_value (argarray[j]);
>     within build_over_call.

Maybe we should remove that in favor of fold_for_warn in
check_function_arguments.

Jason

Reply via email to