[PATCH] Avoid -Wunused-macros warning for #pragma GCC target added macros (PR target/58944)

Uros Bizjak ubizjak@gmail.com
Sat Jan 18 10:07:00 GMT 2014


On Fri, Jan 17, 2014 at 8:58 PM, Jakub Jelinek <jakub@redhat.com> wrote:

> It makes no sense to warn about unused macros that weren't defined
> by the user, but the compiler instead injected them, the user
> has no control on them.
> For macros predefined at the beginning of the CU we don't get warnings
> because they don't match MAIN_FILE_P, but macros added for #pragma GCC target
> get location_t from the location of the pragma (and without libcpp hacks
> that could possibly slow down preprocessing I don't see how to get around
> it), so the following hack seems to be easiest.  All newly created macros
> when -Wunused-macros isn't on are initialized with macro->used = true,
> and never warned about for this warning, so this patch just arranges for
> all the cpp_define calls from #pragma GCC target to set that.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2014-01-17  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/58944
>         * config/i386/i386-c.c (ix86_pragma_target_parse): Temporarily
>         clear cpp_get_options (parse_in)->warn_unused_macros for
>         ix86_target_macros_internal with cpp_define.
>
>         * gcc.target/i386/pr58944.c: Drop -march=native from dg-options.
>         Remove dg-prune-output lines.

OK.

Thanks,
Uros.



More information about the Gcc-patches mailing list