diff options
author | Martin Sebor <msebor@redhat.com> | 2019-02-22 23:08:23 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-02-22 16:08:23 -0700 |
commit | 0a7fe8bcd953efbd22d05ec750927de0feaa96da (patch) | |
tree | 0b04f34611e2bf85e2712efc6fff49524600ad52 /gcc | |
parent | 047b3e34084d0801677aaf1dbf4c723939b55135 (diff) | |
download | gcc-0a7fe8bcd953efbd22d05ec750927de0feaa96da.zip gcc-0a7fe8bcd953efbd22d05ec750927de0feaa96da.tar.gz gcc-0a7fe8bcd953efbd22d05ec750927de0feaa96da.tar.bz2 |
builtin-sprintf-10.c: Cast wchar_t to wint_t to avoid a bogus -Wformat warning in ILP32 (bug 77970).
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/builtin-sprintf-10.c: Cast wchar_t to wint_t
to avoid a bogus -Wformat warning in ILP32 (bug 77970).
From-SVN: r269137
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c | 29 |
2 files changed, 20 insertions, 14 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dd04377..8d19215 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-22 Martin Sebor <msebor@redhat.com> + + * gcc.dg/tree-ssa/builtin-sprintf-10.c: Cast wchar_t to wint_t + to avoid a bogus -Wformat warning in ILP32 (bug 77970). + 2019-02-22 Harald Anlauf <anlauf@gmx.de> PR fortran/83057 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c index 837b6f4..b64a5e0 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-10.c @@ -5,6 +5,7 @@ typedef __SIZE_TYPE__ size_t; typedef __WCHAR_TYPE__ wchar_t; +typedef __WINT_TYPE__ wint_t; extern int snprintf (char*, size_t, const char*, ...); @@ -50,23 +51,23 @@ void elim_wide_char_call (void) ELIM (snprintf (0, 0, "%lc", L'\0')); ELIM (snprintf (0, 0, "%lc", L'1')); ELIM (snprintf (0, 0, "%lc", L'a')); - ELIM (snprintf (0, 0, "%lc", ws3[0])); - ELIM (snprintf (0, 0, "%lc", ws3[1])); - ELIM (snprintf (0, 0, "%lc", ws3[3])); + ELIM (snprintf (0, 0, "%lc", (wint_t)ws3[0])); + ELIM (snprintf (0, 0, "%lc", (wint_t)ws3[1])); + ELIM (snprintf (0, 0, "%lc", (wint_t)ws3[3])); ELIM (snprintf (0, 0, "%C", L'\0')); ELIM (snprintf (0, 0, "%C", L'9')); ELIM (snprintf (0, 0, "%C", L'z')); - ELIM (snprintf (0, 0, "%C", ws3[0])); - ELIM (snprintf (0, 0, "%C", ws3[1])); - ELIM (snprintf (0, 0, "%C", ws3[3])); + ELIM (snprintf (0, 0, "%C", (wint_t)ws3[0])); + ELIM (snprintf (0, 0, "%C", (wint_t)ws3[1])); + ELIM (snprintf (0, 0, "%C", (wint_t)ws3[3])); /* Verify an unknown character value within the ASCII range. */ if (wc < 1 || 127 < wc) wc = 0; - ELIM (snprintf (0, 0, "%C", wc)); - ELIM (snprintf (0, 0, "%C", wc)); + ELIM (snprintf (0, 0, "%C", (wint_t)wc)); + ELIM (snprintf (0, 0, "%C", (wint_t)wc)); } void elim_wide_string_call (void) @@ -83,21 +84,21 @@ void keep_wide_char_call (void) { KEEP (snprintf (0, 0, "%lc", L'\xff')); KEEP (snprintf (0, 0, "%lc", L'\xffff')); - KEEP (snprintf (0, 0, "%lc", wc)); - KEEP (snprintf (0, 0, "%lc", ws3[2])); + KEEP (snprintf (0, 0, "%lc", (wint_t)wc)); + KEEP (snprintf (0, 0, "%lc", (wint_t)ws3[2])); KEEP (snprintf (0, 0, "%C", L'\xff')); KEEP (snprintf (0, 0, "%C", L'\xffff')); - KEEP (snprintf (0, 0, "%C", wc)); - KEEP (snprintf (0, 0, "%C", ws3[2])); + KEEP (snprintf (0, 0, "%C", (wint_t)wc)); + KEEP (snprintf (0, 0, "%C", (wint_t)ws3[2])); /* Verify an unknown character value outside the ASCII range (with 128 being the only one). */ if (wc < 32 || 128 < wc) wc = 32; - KEEP (snprintf (0, 0, "%lc", wc)); - KEEP (snprintf (0, 0, "%C", wc)); + KEEP (snprintf (0, 0, "%lc", (wint_t)wc)); + KEEP (snprintf (0, 0, "%C", (wint_t)wc)); } void keep_wide_string_call (void) |