summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-03-09 10:22:13 -0500
committerZack Weinberg <zackw@panix.com>2018-05-31 21:28:17 -0400
commit13b3f8489601ab34d12382c34ea2f21843656716 (patch)
tree0501aa0a7dfb86b5b121f6d98672b6f14c8c0beb
parent3e20ce75755f7eef5fb85692e5b8733380d50ba4 (diff)
downloadglibc-13b3f8489601ab34d12382c34ea2f21843656716.tar.gz
Disable uninitialized warnings around va_arg(, long double)
This works around GCC bug 84772 on powerpcspe. * stdio-common/vfprintf-internal.c: Include libc-diag.h. Disable -Wuninitialized and -Wmaybe-uninitialized around all uses of va_arg(..., long double), to work around GCC bug 84772.
-rw-r--r--stdio-common/vfprintf-internal.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c
index d8716f4f07..6f7bd0d2da 100644
--- a/stdio-common/vfprintf-internal.c
+++ b/stdio-common/vfprintf-internal.c
@@ -31,6 +31,7 @@
#include <locale/localeinfo.h>
#include <stdio.h>
#include <scratch_buffer.h>
+#include <libc-diag.h>
/* This code is shared between the standard stdio implementation found
in GNU C library and the libio implementation originally found in
@@ -774,9 +775,19 @@ static const uint8_t jump_table[] =
.is_binary128 = 0}; \
\
if (is_long_double) \
- the_arg.pa_long_double = va_arg (ap, long double); \
+ { \
+ /* GCC 7.3 has a bug on some architectures where */ \
+ /* va_arg (ap, long double) produces spurious warnings. */ \
+ /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84772 */ \
+ DIAG_PUSH_NEEDS_COMMENT; \
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wuninitialized"); \
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wmaybe-uninitialized"); \
+ the_arg.pa_long_double = va_arg (ap, long double); \
+ DIAG_POP_NEEDS_COMMENT; \
+ } \
else \
the_arg.pa_double = va_arg (ap, double); \
+ \
ptr = (const void *) &the_arg; \
\
function_done = __printf_fp (s, &info, &ptr); \
@@ -834,7 +845,16 @@ static const uint8_t jump_table[] =
.is_binary128 = 0}; \
\
if (is_long_double) \
- the_arg.pa_long_double = va_arg (ap, long double); \
+ { \
+ /* GCC 7.3 has a bug on some architectures where */ \
+ /* va_arg (ap, long double) produces spurious warnings. */ \
+ /* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84772 */ \
+ DIAG_PUSH_NEEDS_COMMENT; \
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wuninitialized"); \
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wmaybe-uninitialized"); \
+ the_arg.pa_long_double = va_arg (ap, long double); \
+ DIAG_POP_NEEDS_COMMENT; \
+ } \
else \
the_arg.pa_double = va_arg (ap, double); \
ptr = (const void *) &the_arg; \
@@ -844,7 +864,7 @@ static const uint8_t jump_table[] =
else \
{ \
ptr = (const void *) &args_value[fspec->data_arg]; \
- if (LDBL_IS_DBL) \
+ if (LDBL_IS_DBL) \
fspec->info.is_long_double = 0; \
/* Not supported by *printf functions. */ \
fspec->info.is_binary128 = 0; \
@@ -1878,7 +1898,16 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format,
args_type[cnt] &= ~PA_FLAG_LONG_DOUBLE;
}
else
- args_value[cnt].pa_long_double = va_arg (*ap_savep, long double);
+ {
+ /* GCC 7.3 has a bug on some architectures where
+ va_arg (ap, long double) produces spurious warnings.
+ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84772 */
+ DIAG_PUSH_NEEDS_COMMENT;
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wuninitialized");
+ DIAG_IGNORE_NEEDS_COMMENT (7.3, "-Wmaybe-uninitialized");
+ args_value[cnt].pa_long_double = va_arg (*ap_savep, long double);
+ DIAG_POP_NEEDS_COMMENT;
+ }
break;
case PA_STRING: /* All pointers are the same */
case PA_WSTRING: /* All pointers are the same */