c-family: Avoid unnecessary work when -Wpragmas is being ignored
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
(where -Wfoo stands for a warning option we don't recognize), this
reduces compile time by 33% for some of its tests.
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
accordingly.