C++11 attributes for C11 (was Re: [PATCH] Generalized attribute support)
Alp Toker
alp at nuanti.com
Tue Apr 22 14:04:17 PDT 2014
On 22/04/2014 21:45, Nico Weber wrote:
> On Sat, Apr 19, 2014 at 4:05 PM, Alp Toker <alp at nuanti.com
> <mailto:alp at nuanti.com>> wrote:
>
> Small update for the list..
>
> We discussed this at LLVM Europe 2014 and came to the conclusion
> that we might as well offer the feature behind an -f flag.
>
> This should satisfy user requests for C++11-style attributes in
> C11 without prejudicing any standards process. Thanks to the many
> detailed use-cases people sent in that have made me more
> comfortable picking this up again.
>
>
> Are these use-cases visible anywhere?
So, I brought this up at the FOSDEM clang talk and some folks came up in
person who were looking for this attribute syntax in non-C++11 dialetcs,
or rolling their own. The ones I remember are:
PENCIL C extension team (Sven K?)
Machine Guided Energy Efficient Compilation (MAGEEC)
Some kernel people
There were also some promising leads on-list on the original thread
including Aaron's team at CERT I believe.
That's about the sum of my record-keeping abilities :-)
Alp.
>
> So, I've got a slightly improved version of the patch and will aim
> to rebase and post it to the list for review in the coming weeks.
>
> All we need now is great name for the -f flag ;-)
>
> Alp.
>
>
> On 15/01/2014 20:44, Alp Toker wrote:
>
>
> On 15/01/2014 20:29, Richard Smith wrote:
>
> On Wed Jan 15 2014 at 3:42:08 AM, Alp Toker
> <alp at nuanti.com <mailto:alp at nuanti.com>
> <mailto:alp at nuanti.com <mailto:alp at nuanti.com>>> wrote:
>
>
> On 15/01/2014 06:04, Nico Weber wrote:
> > Does gcc allow this for C? Is C planning on
> standardizing this?
>
> The impression I get is that everybody's doing it but
> nobody's talking
> about it. Yet.
>
>
> Weird. The impression I get is that nobody is doing it (at
> least, not publically).
>
>
> People said they were patching internally to use new security
> and optimization attributes, and presumably there are others
> ("nobody's talking about it"). Seems a reasonable use case.
>
>
> What if a future revision of a standard we care about
> (maybe C, OpenMP, OpenCL, CUDA, ...) standardizes a
> *different* meaning for square brackets? Code that used
> our extension would be in trouble.
>
>
> This is a great reason to hold back from switching it on globally.
>
> If we don't have "nudge" power in getting this as a de-facto
> C1y feature it becomes less interesting.
>
>
> This isn't even purely theoretical -- Objective-C does
> this, and it is essentially only by luck that it's
> possible to disambiguate this fully. As another example,
> if C17 took C++'s lambdas but not its attributes, we'd run
> into some amount of trouble with expressions like
>
> int x[ [] { ... } () ];
>
> (which is an ill-formed attribute under the C++11 rules).
>
>
> It'd be far from the worst disambiguation we have in-tree.
>
> Objective-C disambiguation is working fine with the C11
> extension enabled for what it's worth.
>
> I'm withdrawing the patch, there are probably more useful
> things to be working on.
>
> Tentatively setting a date to revisit this in a years time or
> after gcc implements, whichever comes first, when there might
> be a clearer way forward.
>
> Alp.
>
>
>
> --
> http://www.nuanti.com
> the browser experts
>
>
--
http://www.nuanti.com
the browser experts
More information about the cfe-commits
mailing list