Commit 476e0d37 by Sandra Loosemore Committed by Sandra Loosemore

re PR c/80409 (Document that va_arg(ap, void*) can be used to consume any pointer argument)

2019-02-25  Sandra Loosemore  <sandra@codesourcery.com>

	PR c/80409

	gcc/
	* doc/extend.texi (Variadic Pointer Args): New section.

From-SVN: r269203
parent 99e20ba5
2019-02-25 Sandra Loosemore <sandra@codesourcery.com> 2019-02-25 Sandra Loosemore <sandra@codesourcery.com>
PR c/80409
* doc/extend.texi (Variadic Pointer Args): New section.
2019-02-25 Sandra Loosemore <sandra@codesourcery.com>
Martin Sebor <msebor@gmail.com> Martin Sebor <msebor@gmail.com>
* c-family/c.opt (Wmissing-attributes): Clean up doc string. * c-family/c.opt (Wmissing-attributes): Clean up doc string.
......
...@@ -47,6 +47,7 @@ extensions, accepted by GCC in C90 mode and in C++. ...@@ -47,6 +47,7 @@ extensions, accepted by GCC in C90 mode and in C++.
* Escaped Newlines:: Slightly looser rules for escaped newlines. * Escaped Newlines:: Slightly looser rules for escaped newlines.
* Subscripting:: Any array can be subscripted, even if not an lvalue. * Subscripting:: Any array can be subscripted, even if not an lvalue.
* Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers. * Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers.
* Variadic Pointer Args:: Pointer arguments to variadic functions.
* Pointers to Arrays:: Pointers to arrays with qualifiers work as expected. * Pointers to Arrays:: Pointers to arrays with qualifiers work as expected.
* Initializers:: Non-constant initializers. * Initializers:: Non-constant initializers.
* Compound Literals:: Compound literals give structures, unions * Compound Literals:: Compound literals give structures, unions
...@@ -1944,6 +1945,22 @@ and on function types, and returns 1. ...@@ -1944,6 +1945,22 @@ and on function types, and returns 1.
The option @option{-Wpointer-arith} requests a warning if these extensions The option @option{-Wpointer-arith} requests a warning if these extensions
are used. are used.
@node Variadic Pointer Args
@section Pointer Arguments in Variadic Functions
@cindex pointer arguments in variadic functions
@cindex variadic functions, pointer arguments
Standard C requires that pointer types used with @code{va_arg} in
functions with variable argument lists either must be compatible with
that of the actual argument, or that one type must be a pointer to
@code{void} and the other a pointer to a character type. GNU C
implements the POSIX XSI extension that additionally permits the use
of @code{va_arg} with a pointer type to receive arguments of any other
pointer type.
In particular, in GNU C @samp{va_arg (ap, void *)} can safely be used
to consume an argument of any pointer type.
@node Pointers to Arrays @node Pointers to Arrays
@section Pointers to Arrays with Qualifiers Work as Expected @section Pointers to Arrays with Qualifiers Work as Expected
@cindex pointers to arrays @cindex pointers to arrays
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment