diff mbox series

[doc] mention optimization options relevant to in attribute nonnull

Message ID e9679809-667c-3278-dc14-dd2dc0620365@gmail.com
State New
Headers show
Series [doc] mention optimization options relevant to in attribute nonnull | expand

Commit Message

Martin Sebor Oct. 24, 2018, 6:02 p.m. UTC
The attached patch mentions the options that disable the null
pointer check optimization related to functions declared with
the nonnull attribute, and that have GCC insert traps when
it detects null pointer arguments.

Martin

Comments

Joseph Myers Oct. 24, 2018, 7:31 p.m. UTC | #1
On Wed, 24 Oct 2018, Martin Sebor wrote:

> The attached patch mentions the options that disable the null
> pointer check optimization related to functions declared with
> the nonnull attribute, and that have GCC insert traps when
> it detects null pointer arguments.

This patch is OK.
diff mbox series

Patch

gcc/ChangeLog:

	* doc/extend.texi (nonnull): List no-argument form.  Reference
	-fno-delete-null-pointer-checks and -fisolate-erroneous-paths-attribute.

Index: gcc/doc/extend.texi
===================================================================
--- gcc/doc/extend.texi	(revision 265465)
+++ gcc/doc/extend.texi	(working copy)
@@ -3075,7 +3075,8 @@  including those that do not have an attribute suit
 them individually.  This attribute is supported mainly for the purpose
 of testing the compiler.
 
-@item nonnull (@var{arg-index}, @dots{})
+@item nonnull
+@itemx nonnull (@var{arg-index}, @dots{})
 @cindex @code{nonnull} function attribute
 @cindex functions with non-null pointer arguments
 The @code{nonnull} attribute specifies that some function parameters should
@@ -3092,10 +3093,15 @@  causes the compiler to check that, in calls to @co
 arguments @var{dest} and @var{src} are non-null.  If the compiler
 determines that a null pointer is passed in an argument slot marked
 as non-null, and the @option{-Wnonnull} option is enabled, a warning
-is issued.  The compiler may also choose to make optimizations based
-on the knowledge that certain function arguments will never be null.
+is issued.  @xref{Warning Options}.  Unless disabled by
+the @option{-fno-delete-null-pointer-checks} option the compiler may
+also perform optimizations based on the knowledge that certain function
+arguments cannot be null. In addition,
+the @option{-fisolate-erroneous-paths-attribute} option can be specified
+to have GCC transform calls with null arguments to non-null functions
+into traps. @xref{Optimize Options}.
 
-If no argument index list is given to the @code{nonnull} attribute,
+If no @var{arg-index} is given to the @code{nonnull} attribute,
 all pointer arguments are marked as non-null.  To illustrate, the
 following declaration is equivalent to the previous example: