[PATCH] c-family: Avoid unnecessary work when -Wpragmas is being ignored

Jeff Law law@redhat.com
Mon Nov 9 16:00:04 GMT 2020


On 11/9/20 8:38 AM, Patrick Palka via Gcc-patches wrote:
> This speeds up handle_pragma_diagnostic by avoiding computing a spelling
> suggestion for an unrecognized option inside a #pragma directive when
> -Wpragmas warnings are being suppressed.
>
> In the range-v3 library, which contains many instances of
>
>   #pragma GCC diagnostic push
>   #pragma GCC diagnostic ignored "-Wpragmas"
>   #pragma GCC diagnostic ignored "-Wfoo"
>   ...
>   #pragma GCC diagnostic pop
>
> compile time is reduced by 33% in some of its tests.
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for
> trunk?
>
> gcc/c-family/ChangeLog:
>
> 	* c-pragma.c (handle_pragma_diagnostic): Split the
> 	unknown-option -Wpragmas diagnostic into a warning and a
> 	subsequent note containing a spelling suggestion.  Avoid
> 	computing the suggestion if -Wpragmas warnings are being
> 	suppressed.
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.dg/pragma-diag-6.c: Adjust expected diagnostics
> 	appropriately.

OK

jeff




More information about the Gcc-patches mailing list