Page MenuHomePhabricator

[libc++][format] WIP Adds formatter floating-point.
Needs ReviewPublic

Authored by Mordante on Tue, Nov 16, 7:11 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

This is a draft version that lacks the localization support.
It's up for review to get feedback from the CI.

This properly implements the formatter for floating-point types.

Completes:

  • P1652R1 Printf corner cases in std::format
  • LWG 3250 std::format: # (alternate form) for NaN and inf
  • LWG 3243 std::format and negative zeroes

Implements parts of:

  • P0645 Text Formatting

Depends on D70631

Diff Detail

Unit TestsFailed

TimeTest
7,750 mslibcxx CI ASAN > llvm-libc++-shared-cfg-in.std/utilities/format/format_formatter/format_context/format_formatter_spec::formatter.floating_point.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/format/format.formatter/format.context/format.formatter.spec/formatter.floating_point.pass.cpp --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/std/utilities/format/format.formatter/format.context/format.formatter.spec/Output/formatter.floating_point.pass.cpp.dir/t.tmp.exe
37,240 mslibcxx CI ASAN > llvm-libc++-shared-cfg-in.std/utilities/format/format_functions::format.locale.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/format/format.functions/format.locale.pass.cpp --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/std/utilities/format/format.functions/Output/format.locale.pass.cpp.dir/t.tmp.exe
36,490 mslibcxx CI ASAN > llvm-libc++-shared-cfg-in.std/utilities/format/format_functions::format.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/format/format.functions/format.pass.cpp --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/std/utilities/format/format.functions/Output/format.pass.cpp.dir/t.tmp.exe
46,800 mslibcxx CI ASAN > llvm-libc++-shared-cfg-in.std/utilities/format/format_functions::format_to.locale.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/format/format.functions/format_to.locale.pass.cpp --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/std/utilities/format/format.functions/Output/format_to.locale.pass.cpp.dir/t.tmp.exe
46,320 mslibcxx CI ASAN > llvm-libc++-shared-cfg-in.std/utilities/format/format_functions::format_to.pass.cpp
Script: -- : 'COMPILED WITH'; /usr/bin/c++ /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/std/utilities/format/format.functions/format_to.pass.cpp --target=x86_64-unknown-linux-gnu -g -fno-omit-frame-pointer -fsanitize=address -nostdinc++ -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -isystem /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/include/c++/v1 -I /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support -include /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/libcxx/test/support/nasty_macros.h -std=c++2b -Werror -Wall -Wextra -Wshadow -Wundef -Wno-unused-command-line-argument -Wno-attributes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-noexcept-type -Wno-atomic-alignment -Wsign-compare -Wunused-variable -Wunused-parameter -Wunreachable-code -Wno-unused-local-typedef -D_LIBCPP_DISABLE_AVAILABILITY -fcoroutines-ts -Werror=thread-safety -Wuser-defined-warnings -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -Wno-macro-redefined -D_LIBCPP_HAS_THREAD_API_PTHREAD -Wno-macro-redefined -D_LIBCPP_ABI_VERSION=1 -D_LIBCPP_DEBUG=1 -lc++experimental -nostdlib++ -L /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -Wl,-rpath,/home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/lib -lc++ -pthread -o /home/libcxx-builder/.buildkite-agent/builds/2e4dc885512d-1/llvm-project/libcxx-ci/build/generic-asan/std/utilities/format/format.functions/Output/format_to.pass.cpp.dir/t.tmp.exe
View Full Test Results (41 Failed)

Event Timeline

Mordante created this revision.Tue, Nov 16, 7:11 AM
Mordante requested review of this revision.Tue, Nov 16, 7:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptTue, Nov 16, 7:11 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante planned changes to this revision.Tue, Nov 16, 7:12 AM
Mordante updated this revision to Diff 387989.Wed, Nov 17, 10:40 AM

Rebased.
Should fix all CI issues.
Adds more tests.

Still not ready for review.

Mordante planned changes to this revision.Wed, Nov 17, 10:40 AM
Mordante updated this revision to Diff 389600.Wed, Nov 24, 12:49 PM

More improvements and tests.
Adds benchmarks.
Still WIP, but getting close to be reviewed.

Mordante planned changes to this revision.Wed, Nov 24, 12:50 PM
Mordante updated this revision to Diff 390195.Sun, Nov 28, 4:26 AM

Some more cleanups and attempt to fix the CI.

Mordante updated this revision to Diff 390197.Sun, Nov 28, 5:05 AM

Guard against macro's named min or max.