This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] New pragma handling mechanism
Dmitry Kurochkin <dmitry.kurochkin@gmail.com> writes:
>> Third, you've introduced further divergence between the C and C++
>> front ends' pragma handling. This is a step in the wrong direction.
>> You should be working toward just one pragma-handling style for both
>> front ends. (In other words, I don't want to see init_pragma growing
>> arguments.)
>
> I don't see a way of handling pragmas in C and C++ front end in the
> same way, except than lex all tokens before parsing in C front end.
> Instead of argument in init_pragma, it can internally change arguments
> to c_register_pragma depending on the language, but I doubt this is
> what you want.
>From the point of view of the handler function, behavior has to be
identical. That doesn't mean that the C and C++ versions of c_lex()
can't be doing different stuff under the hood -- C is calling down to
cpplib on the fly, presumably, whereas C++ is fishing tokens out of
its giant buffer. However, there should still be no need for
c_register_pragma to do anything differently. Possibly you think you
need to keep Matt's save-pragma-as-a-string mode around? You don't.
zw