[PATCH][RFC] Add #pragma message ... to gcc/g++

Ralf Wildenhues Ralf.Wildenhues@gmx.de
Fri Jul 18 17:29:00 GMT 2008


* Simon Baldwin wrote on Fri, Jul 18, 2008 at 06:23:21PM CEST:
> Ralf Wildenhues wrote:
>>
>> Did you run 'make info dvi' in gcc/, did the doc changes introduce a
>> very long line in the PDF?
>
> PDF output for doc/gcc.dvi converted via dvipdf looks fine; no long  
> lines evident.  Is this a sufficient check?

Sure.  I meant "in the DVI", sorry about that.  FWIW, you can 'make pdf'
to generate a PDF directly.

>>> +         GCC_BAD ("expected a string after %<#pragma message%>");
>>> +       if (pragma_lex (&x) != CPP_CLOSE_PAREN)
>>> +         GCC_BAD ("malformed %<#pragma message%> - ignored");
>>
>> I think the usual punctuation would be to drop the '- ' or to replace it
>> with a comma.
>
> handle_pragma_pack, handle_pragma_push_macro, handle_pragma_pop_macro,  
> and handle_pragma_visibility use this message format.   
> handle_pragma_weak, handle_pragma_redefine_extname, and  
> handle_pragma_extern_prefix use the comma form.  c-pragma.c seems  
> indecisive!

Hmm, I didn't look.  Anyway, the comma looks nicer.

>> Is the malformed pragma really ignored?  Is that tested?
>
> Yes, it's an explicit case in the accompanying test file pragma-message.c.
>
> The code could equally well allow unclosed parentheses at this point,  
> since by this stage they're only syntactic sugar.  But a complaint seems  
> clearer overall, and is in keeping with other pragma handlers.

Yes, I agree.

What I meant though was: your warning states that the (malformed) pragma
would be ignored, thus not printed.  Reading the code tells me that it
is printed, however.  That's the bug I was hinting at, and this seems
not to be verified by the test case.  Admittedly, it's a really minor
point, and you could just as well fix it by adjusting the warning
message not to indicate that the pragma were ignored (plus adjusting
the test to ensure that the pragma is indeed printed).

That, or I badly need some coffee now (I haven't done any testing).


BTW, I suppose this change is worth a small note to changes.html
(which I cannot approve either).

Cheers,
Ralf



More information about the Gcc-patches mailing list