[cfe-dev] RFC: Incompatible, but similar pragma handling

Alp Toker alp at nuanti.com
Mon Jun 23 13:29:26 PDT 2014


On 23/06/2014 23:12, Reid Kleckner wrote:
> On Sun, Jun 22, 2014 at 6:50 AM, "C. Bergström" 
> <cbergstrom at pathscale.com <mailto:cbergstrom at pathscale.com>> wrote:
>
>
>     I can give more precise details if necessary, but it's more a
>     general question to start.
>
>     Any recommendations on how to best handle two similar, but
>     incompatible sets of pragma?
>
>
> Unfortunately, I don't have any good suggestions.  Clang has basically 
> no reusable pragma parsing infrastructure.  Nothing is consistent, 
> because we're parsing all pragmas that have ever seen any significant 
> use.  Aaron has done a really good job cleaning up attributes, and I'd 
> love to see the same happen to pragmas.  I tried once and it didn't go 
> well.  :)

Cool :-) I tried rewriting the pragma parsers too once, using a 
templatized PEG.

It reduced implementing pragmas to a couple of lines. There are some 
really nice C++ templatized PEGs out there and in principle it should be 
possible to integrate them fully to achieve the same quality or better 
diagnostics as the hand-written code we have now.

We don't use parser generators for C++ but in theory there's nothing 
stopping us using them for the various other kinds of sub-grammars we 
encounter like pragmas which are trivial/regular in comparison.

Fun project for a rainy day perhaps, though contrary to the 
time-honoured LLVM tradition of hand-parsing.

Alp.


>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-dev mailing list