From 9dc75031963f01b1711a769b7afcc5c590ce07fd Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 9 Mar 2022 16:52:49 -0500 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 0dc752e8aad..bfa09c0f5bc 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2652,6 +2652,13 @@ 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. If the pointer will definitely be +dereferenced, you may want to also add +@code{__attribute__((nonnull (@var{arg-index})))} to the function for the +pointer parameter in question. + @item alias ("@var{target}") @cindex @code{alias} function attribute The @code{alias} attribute causes the declaration to be emitted as an alias -- 2.26.3