diff options
author | Kaveh R. Ghazi <ghazi@caip.rutgers.edu> | 2004-09-05 02:55:28 +0000 |
---|---|---|
committer | Kaveh Ghazi <ghazi@gcc.gnu.org> | 2004-09-05 02:55:28 +0000 |
commit | 254986c7ff3175c29307b999f161cfcc7961baf4 (patch) | |
tree | 35944d27904d831ba5d78370c59d633d19c4fe13 /gcc/doc | |
parent | 44269c4093f881d5321ee09d40490e1989345bae (diff) | |
download | gcc-254986c7ff3175c29307b999f161cfcc7961baf4.zip gcc-254986c7ff3175c29307b999f161cfcc7961baf4.tar.gz gcc-254986c7ff3175c29307b999f161cfcc7961baf4.tar.bz2 |
builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
* builtin-attrs.def (ATTR_NOTHROW_SENTINEL_1): New.
* builtins.def (BUILT_IN_EXECLE): Set ATTR_NOTHROW_SENTINEL_1.
* c-common.c (c_common_attribute_table): Accept parameters to
sentinel attribute.
(check_function_sentinel, handle_sentinel_attribute): Likewise.
* doc/extend.texi: Update accordingly.
testsuite:
* gcc.dg/format/sentinel-1.c: Update for parameter option.
From-SVN: r87098
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 4c27320..bbde788 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2113,15 +2113,30 @@ section, consider using the facilities of the linker instead. @item sentinel @cindex @code{sentinel} function attribute -This function attribute ensures that the last parameter in a function -call is an explicit @code{NULL}. The attribute is only valid on -variadic functions. For example the attribute is automatically set for -the built-in functions @code{execl} and @code{execlp} where @code{NULL} -is the marker for argument list termination. A valid @code{NULL} in -this context is defined as zero with any pointer type. If your system -defines the @code{NULL} macro with an integer type then you need to add -an explicit cast. The warnings for missing or incorrect sentinels are -enabled with @option{-Wformat}. +This function attribute ensures that a parameter in a function call is +an explicit @code{NULL}. The attribute is only valid on variadic +functions. By default, the sentinel is located at position zero, the +last parameter of the function call. If an optional integer position +argument P is supplied to the attribute, the sentinel must be located at +position P counting backwards from the end of the argument list. + +@smallexample +__attribute__ ((sentinel)) +is equivalent to +__attribute__ ((sentinel(0))) +@end smallexample + +The attribute is automatically set with a position of 0 for the built-in +functions @code{execl} and @code{execlp}. The built-in function +@code{execle} has the attribute set set with a position of 1. + +A valid @code{NULL} in this context is defined as zero with any pointer +type. If your system defines the @code{NULL} macro with an integer type +then you need to add an explicit cast. GCC replaces @code{stddef.h} +with a copy that redefines NULL appropriately. + +The warnings for missing or incorrect sentinels are enabled with +@option{-Wformat}. @item short_call See long_call/short_call. |