diff options
author | Florian Weimer <fweimer@redhat.com> | 2015-10-17 12:02:22 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2015-10-17 12:02:22 +0200 |
commit | f546f87c4ffb1642ffc96b8d614c329ed35252c3 (patch) | |
tree | adb75afb2d8b6432fd738bed624cde26f6c403c8 | |
parent | 213938ee8ad50156063c3b38c3d236c6f713eb4a (diff) | |
download | glibc-f546f87c4ffb1642ffc96b8d614c329ed35252c3.tar.gz glibc-f546f87c4ffb1642ffc96b8d614c329ed35252c3.tar.xz glibc-f546f87c4ffb1642ffc96b8d614c329ed35252c3.zip |
The va_list pointer is unspecified after a call to vfprintf [BZ #18982]
This adjusts the documentation to the existing implementation.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | manual/stdio.texi | 24 |
3 files changed, 19 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog index d720fcb01b..766830713f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-10-17 Florian Weimer <fweimer@redhat.com> + + [BZ #18982] + * manual/stdio.texi (Variable Arguments Output): Add portability + note, explaining that vfprintf clobbers the va_list pointer. + 2015-10-16 Joseph Myers <joseph@codesourcery.com> * math/libm-test.inc (fabs_test_data): Add more tests. diff --git a/NEWS b/NEWS index 6fd9a6e09c..d7404f41a6 100644 --- a/NEWS +++ b/NEWS @@ -18,9 +18,9 @@ Version 2.23 18790, 18795, 18796, 18803, 18820, 18823, 18824, 18825, 18857, 18863, 18870, 18872, 18873, 18875, 18887, 18918, 18921, 18928, 18951, 18952, 18953, 18956, 18961, 18966, 18967, 18969, 18970, 18977, 18980, 18981, - 18985, 19003, 19007, 19012, 19016, 19018, 19032, 19046, 19049, 19050, - 19059, 19071, 19074, 19076, 19077, 19078, 19079, 19085, 19086, 19088, - 19094, 19095, 19124, 19125, 19129, 19134, 19137. + 18982, 18985, 19003, 19007, 19012, 19016, 19018, 19032, 19046, 19049, + 19050, 19059, 19071, 19074, 19076, 19077, 19078, 19079, 19085, 19086, + 19088, 19094, 19095, 19124, 19125, 19129, 19134, 19137. * The LD_POINTER_GUARD environment variable can no longer be used to disable the pointer guard feature. It is always enabled. diff --git a/manual/stdio.texi b/manual/stdio.texi index 5d317747f5..c0753b19cd 100644 --- a/manual/stdio.texi +++ b/manual/stdio.texi @@ -2621,20 +2621,16 @@ choice, you are ready to call @code{vprintf}. That argument and all subsequent arguments that were passed to your function are used by @code{vprintf} along with the template that you specified separately. -In some other systems, the @code{va_list} pointer may become invalid -after the call to @code{vprintf}, so you must not use @code{va_arg} -after you call @code{vprintf}. Instead, you should call @code{va_end} -to retire the pointer from service. However, you can safely call -@code{va_start} on another pointer variable and begin fetching the -arguments again through that pointer. Calling @code{vprintf} does not -destroy the argument list of your function, merely the particular -pointer that you passed to it. - -GNU C does not have such restrictions. You can safely continue to fetch -arguments from a @code{va_list} pointer after passing it to -@code{vprintf}, and @code{va_end} is a no-op. (Note, however, that -subsequent @code{va_arg} calls will fetch the same arguments which -@code{vprintf} previously used.) +@strong{Portability Note:} The value of the @code{va_list} pointer is +undetermined after the call to @code{vprintf}, so you must not use +@code{va_arg} after you call @code{vprintf}. Instead, you should call +@code{va_end} to retire the pointer from service. You can call +@code{va_start} again and begin fetching the arguments from the start of +the variable argument list. (Alternatively, you can use @code{va_copy} +to make a copy of the @code{va_list} pointer before calling +@code{vfprintf}.) Calling @code{vprintf} does not destroy the argument +list of your function, merely the particular pointer that you passed to +it. Prototypes for these functions are declared in @file{stdio.h}. @pindex stdio.h |