[cfe-dev] Custom C++ extension
Jonathan Roelofs
jonathan at codesourcery.com
Mon Jun 15 06:48:12 PDT 2015
On 6/13/15 7:53 PM, rzaghi at mosaic3dx.com wrote:
>
> As an example, the extension would allow us to "tag" some identifiers
> in the code as follows:
>
> class CLXYZ { public: int <tag1> x; };
>
> The identifier tagged as such is later picked at one of the phases
> and operated on.
For this particular example, have you considered using __attribute__
syntax [1], [2]?
i.e. something like:
class CLXYZ { public: int x __attribute__((tag("1"))); };
If you're able to leverage existing infrastructure, that will
significantly reduce your patch burden and make following trunk _much_
easier.
>
> (ps, not so related to my question but we call this
> "tagged-programming" paradigm. Actually we hope that the combination
> of these extensions can eventually help programmers in scenarios as
> the very question I am asking above!).
How so?
Cheers,
Jon
1:
https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Variable-Attributes.html#Variable-Attributes
2: http://clang.llvm.org/docs/InternalsManual.html#how-to-add-an-attribute
>
>
>
> _______________________________________________ cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded
More information about the cfe-dev
mailing list