[PATCH] Capability attributes on a typedef

Delesley Hutchins delesley at google.com
Mon Mar 24 09:51:37 PDT 2014


The patch looks good overall.  However, I'm a little bit concerned
about the error messages.  Since the attributes are defined through
macros, and the macro at google is still LOCKABLE, the message "...
annotated with 'capability' attribute ..." is likely to cause
confusion.  I seem to recall that somebody else implemented a system
to find out whether a macro had been defined for a given attribute.
Given the multiple spellings we now have for thread safety attributes,
it seems like a good idea to map warning messages to whatever macros
the user actually happens to be using.

Richard, do you remember anything about this?

  -DeLesley


On Mon, Mar 24, 2014 at 7:31 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> This patch allows a capability attribute to be declared on a typedef
> declaration (as a declaration attribute, not a type attribute). Eg)
> typedef int __attribute__((capability("role"))) ThreadRole;
>
> This is necessary for a WIP for Boolean expressions involving
> capability attributes in C, where there are not operator overloads
> that we can use. Eg) void func(void)
> __attribute__((requires_capability(!SomeCap)));
>
> This patch removes an existing diagnostic because it no longer
> applies, which is why there is a fair amount of testcase churn.
>
> ~Aaron



-- 
DeLesley Hutchins | Software Engineer | delesley at google.com | 505-206-0315



More information about the cfe-commits mailing list