diff options
author | Tom Tromey <tromey@adacore.com> | 2021-09-29 12:51:15 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-10-19 13:14:48 -0600 |
commit | 5dfe4bfcb96945dc5cc1f8717be454f1f7f6bbec (patch) | |
tree | aae9e022c794f4887ad3e9ac759bcb0de647e183 /gdb/unittests | |
parent | 05fb05a94729473cb04b1299fe5c36e06525c78f (diff) | |
download | fsf-binutils-gdb-5dfe4bfcb96945dc5cc1f8717be454f1f7f6bbec.zip fsf-binutils-gdb-5dfe4bfcb96945dc5cc1f8717be454f1f7f6bbec.tar.gz fsf-binutils-gdb-5dfe4bfcb96945dc5cc1f8717be454f1f7f6bbec.tar.bz2 |
Fix format_pieces selftest on Windows
The format_pieces selftest currently fails on Windows hosts.
The selftest doesn't handle the "%ll" -> "%I64" rewrite that the
formatter may perform, but also gdbsupport was missing a configure
check for PRINTF_HAS_LONG_LONG. This patch fixes both issues.
Diffstat (limited to 'gdb/unittests')
-rw-r--r-- | gdb/unittests/format_pieces-selftests.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gdb/unittests/format_pieces-selftests.c b/gdb/unittests/format_pieces-selftests.c index f8df687..6a15b5e 100644 --- a/gdb/unittests/format_pieces-selftests.c +++ b/gdb/unittests/format_pieces-selftests.c @@ -21,6 +21,12 @@ #include "gdbsupport/format.h" #include "gdbsupport/selftest.h" +#if USE_PRINTF_I64 +#define LL "I64" +#else +#define LL "ll" +#endif + namespace selftests { namespace format_pieces { @@ -55,7 +61,7 @@ test_format_specifier () { format_piece ("Hello\t ", literal_piece, 0), format_piece ("%d", int_arg, 0), - format_piece ("%llx", long_long_arg, 0), /* ARI: %ll */ + format_piece ("%" LL "x", long_long_arg, 0), format_piece ("%%d", literal_piece, 0), format_piece ("%d", int_arg, 0), }); @@ -87,7 +93,7 @@ test_format_int_sizes () format_piece ("Hello\t ", literal_piece, 0), format_piece ("%hu", int_arg, 0), format_piece ("%lu", long_arg, 0), - format_piece ("%llu", long_long_arg, 0), /* ARI: %ll */ + format_piece ("%" LL "u", long_long_arg, 0), format_piece ("%zu", size_t_arg, 0) }); @@ -96,7 +102,7 @@ test_format_int_sizes () format_piece ("Hello\t ", literal_piece, 0), format_piece ("%hx", int_arg, 0), format_piece ("%lx", long_arg, 0), - format_piece ("%llx", long_long_arg, 0), /* ARI: %ll */ + format_piece ("%" LL "x", long_long_arg, 0), format_piece ("%zx", size_t_arg, 0) }); @@ -105,7 +111,7 @@ test_format_int_sizes () format_piece ("Hello\t ", literal_piece, 0), format_piece ("%ho", int_arg, 0), format_piece ("%lo", long_arg, 0), - format_piece ("%llo", long_long_arg, 0), /* ARI: %ll */ + format_piece ("%" LL "o", long_long_arg, 0), format_piece ("%zo", size_t_arg, 0) }); @@ -114,7 +120,7 @@ test_format_int_sizes () format_piece ("Hello\t ", literal_piece, 0), format_piece ("%hd", int_arg, 0), format_piece ("%ld", long_arg, 0), - format_piece ("%lld", long_long_arg, 0), /* ARI: %ll */ + format_piece ("%" LL "d", long_long_arg, 0), format_piece ("%zd", size_t_arg, 0) }); } |