https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106039

--- Comment #4 from Jonathan Leffler <jonathan.leffler at gmail dot com> ---
Thank you for looking at this.

In the second and subsequent errors, the line number of the macro is used
in all three lines of the error report, whereas in the first, the second
line of the messages is the `printf()` line and not the macro line again.

On Mon, Jun 20, 2022 at 19:10 pinskia at gcc dot gnu.org <
gcc-bugzi...@gcc.gnu.org> wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106039
>
> --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
> I don't see an issue with the diagnostic here really.
>
> For the single line case (without the format as a macro):
>     printf("%-21s %-16x %-16x %-18s %-18s\n", "GHI", (intptr_t) val1,
> (intptr_t) val1, "ABC", "DEF");
>
>
> We get:
>
> <source>:22:23: warning: format '%x' expects argument of type 'unsigned
> int',
> but argument 3 has type 'long int' [-Wformat=]
>    22 |     printf("%-21s %-16x %-16x %-18s %-18s\n", "GHI", (intptr_t)
> val1,
> (intptr_t) val1, "ABC", "DEF");
>       |                   ~~~~^
> ~~~~~~~~~~~~~~~
>       |                       |                              |
>       |                       unsigned int                   long int
>       |                   %-16lx
> <source>:22:29: warning: format '%x' expects argument of type 'unsigned
> int',
> but argument 4 has type 'long int' [-Wformat=]
>    22 |     printf("%-21s %-16x %-16x %-18s %-18s\n", "GHI", (intptr_t)
> val1,
> (intptr_t) val1, "ABC", "DEF");
>       |                         ~~~~^
>
> ~~~~~~~~~~~~~~~
>       |                             |
>    |
>       |                             unsigned int
>
> long int
>       |                         %-16lx
>
> are you asking to point out where the arguments were for the macro case?
>
> --
> You are receiving this mail because:
> You reported the bug.

Reply via email to