[PATCH] noclobber & noescape annotations for function arguments

Paolo Bonzini bonzini@gnu.org
Fri Apr 16 08:50:00 GMT 2010


On 04/16/2010 01:11 AM, Chris Lattner wrote:
> void foo(int __attribute__((const)) *x)
>
> could designate that the function only reads from X or something?

Indeed, for example:

- const = only read
- output = only (always?) written, *T is dead on entry
- nonnull = alternative form of the nonnull function attribute
- alloc_size (n) = only x[0]..x[n-1] is read/written, useful for n=1 and 
for warnings maybe
- malloc = for T ** arguments, *T does not alias anything upon exit
- noderef = pointer is not dereferenced, but still it might escape
- noescape = pointer does not escape

Paolo



More information about the Gcc-patches mailing list