This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hello Simon,

* Simon Baldwin wrote on Fri, Jul 18, 2008 at 04:18:18PM CEST:
> Okay for trunk?  Or, let the debate commence...

FWIW, I cannot approve it, so here's a couple of observations.

> Tested and confirmed with gcc and g++ build, bootstrap, and testsuite.

Did you run 'make info dvi' in gcc/, did the doc changes introduce a
very long line in the PDF?

> gcc/ChangeLog:
> 2008-07-18  Simon Baldwin  <simonb@google.com>
> 
> 	* c-pragma.c (handle_pragma_message): New function.
> 	* (init_pragma): Register handle_pragma_message.

Please drop the '* ' in this line (that's only for listing file names),
and add a line for the doc/extend.texi changes.

> *** gcc-message_orig/gcc/c-pragma.c	Thu Jul 17 13:05:49 2008
> --- gcc-message/gcc/c-pragma.c	Fri Jul 18 10:03:47 2008

> + static void
> + handle_pragma_message (cpp_reader *ARG_UNUSED(dummy))

Comment before function needed?

> + {
> +   enum cpp_ttype token;
> +   tree x, message = 0;
> + 
> +   token = pragma_lex (&x);
> +   if (token == CPP_OPEN_PAREN)
> +     {
> +       token = pragma_lex (&x);
> +       if (token == CPP_STRING)
> +         message = x;
> +       else
> +         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.

Is the malformed pragma really ignored?  Is that tested?

> +     }
> +   else if (token == CPP_STRING)
> +     message = x;
> +   else
> +     GCC_BAD ("expected a string after %<#pragma message%>");

Cheers,
Ralf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]