[libcxx-commits] [PATCH] D70631: Microsoft's floating-point to_chars powered by Ryu and Ryu Printf

Brian Cain via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Feb 22 07:34:41 PST 2022


bcain added a comment.

This test `libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp` fails downstream for us w/Hexagon SDK.  It's a subtle nit from the compiler regarding format specifiers.

I can post a patch to change the test to use the `inttypes.h` `PRI___` specifiers instead.  But it occurs to me: since this is a lit test, are the printouts only used for debugging?  Should/could we purge them or hide them behind a debug guard?  Does this test come from a third party repository that we want to stay in sync with?  The commit regards printf implementation -- are any of the calls to `printf` part of the intended scope of the test?  If not, could/should the test be redesigned to use C++ streams instead?

Apologies for the lack-of-context questions.

Here's the downstream failures btw (both `unsigned long` and `unsigned int` are 32-bits on this target):

  .../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:94:23: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
          printf("%u ", elem);
                  ~~    ^~~~
                  %lu
  .../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:569:56: error: format specifies type 'unsigned int' but the argument has type 'uint32_t' (aka 'unsigned long') [-Werror,-Wformat]
          fprintf(stderr, "%s failed for 0x%08X\n", msg, bits);
                                           ~~~~          ^~~~
                                           %08lX
  .../tools/llvm-top/libcxx/test/std/utilities/charconv/charconv.msvc/test.cpp:1096:43: error: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Werror,-Wformat]
      printf("Randomized test cases: %u\n", PrefixesToTest * Fractions);
                                     ~~     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                     %lu


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70631/new/

https://reviews.llvm.org/D70631



More information about the libcxx-commits mailing list