Comments

This patch adds support for #pragma GCC warning and #pragma GCC error.
These pragmas can be used from preprocessor macros, unlike the existing
#warning and #error directives. Library authors can use these pragmas
to add deprecation warnings to macros they define.
Bootstrapped and tested on x86_64-redhat-linux-gnu, with no apparent
regressions. Okay for trunk?

On Tue, Sep 25, 2012 at 04:25:08PM +0200, Florian Weimer wrote:
> This patch adds support for #pragma GCC warning and #pragma GCC> error. These pragmas can be used from preprocessor macros, unlike> the existing #warning and #error directives. Library authors can> use these pragmas to add deprecation warnings to macros they define.> > Bootstrapped and tested on x86_64-redhat-linux-gnu, with no apparent> regressions. Okay for trunk?
I can't approve your patch, but I find it useful and wish it would be accepted.
Cheers.

>>>>> "Florian" == Florian Weimer <fweimer@redhat.com> writes:
Florian> This patch adds support for #pragma GCC warning and #pragma GCC
Florian> error. These pragmas can be used from preprocessor macros,
Florian> unlike the existing #warning and #error directives. Library
Florian> authors can use these pragmas to add deprecation warnings to
Florian> macros they define.
I'm not sure if my libcpp review powers extend to an extension like
this.
It seems reasonable to me though.
Florian> Index: gcc/doc/cpp.texi
[...]
Florian> +contained in the pragma must be a single string literal. Similary,
Typo, "similarly" -- missing "l".
Florian> +@code{#pragma GCC error "message"} issues an error message. Unlike
Florian> +the @samp{#warning} and @samp{#error} directives provided by
Florian> +compilers, these pragmas can be embedded in preprocessor macros using
I would just remove "provided by compilers".
Florian> + cpp_error (pfile, CPP_DL_ERROR, "invalid #pragma GCC %s directive",
It seems to me that the '#pragma GCC %s' part should have quotes around
it.
Tom

On 9/26/2012 4:19 PM, Tom Tromey wrote:
>>>>>> "Florian" == Florian Weimer <fweimer@redhat.com> writes:>> Florian> This patch adds support for #pragma GCC warning and #pragma GCC> Florian> error. These pragmas can be used from preprocessor macros,> Florian> unlike the existing #warning and #error directives. Library> Florian> authors can use these pragmas to add deprecation warnings to> Florian> macros they define.>> I'm not sure if my libcpp review powers extend to an extension like> this.>> It seems reasonable to me though.
To me too, these correspond to the Compile_Time_Warning and
Compile_Time_Error in Ada, and are definitely very useful!