From 0b5723d74f3a731380f78dc1a02a2376951388cf Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 5 Apr 2022 16:43:16 -0400 Subject: [PATCH] Document that the 'access' and 'nonnull' attributes are independent gcc/ChangeLog: * doc/extend.texi (Common Function Attributes): Document that 'access' does not imply 'nonnull'. Signed-off-by: David Malcolm --- gcc/doc/extend.texi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 8381eb620ea..e10b10bc1f1 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2652,6 +2652,14 @@ The mode is intended to be used as a means to help validate the expected object size, for example in functions that call @code{__builtin_object_size}. @xref{Object Size Checking}. +Note that the @code{access} attribute merely specifies how an object +referenced by the pointer argument can be accessed; it does not imply that +an access @strong{will} happen. Also, the @code{access} attribute does not +imply the attribute @code{nonnull}; it may be appropriate to add both attributes +at the declaration of a function that unconditionally manipulates a buffer via +a pointer argument. See the @code{nonnull} attribute for more information and +caveats. + @item alias ("@var{target}") @cindex @code{alias} function attribute The @code{alias} attribute causes the declaration to be emitted as an alias -- 2.34.1