[libcxx-commits] [PATCH] D131336: [libc++][test] Fix MSVC warnings C6054, C6001, C4242 and -NaN is formatted differently on MSVC

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 6 11:24:04 PDT 2022


fsb4000 created this revision.
fsb4000 added a project: libc++.
Herald added a project: All.
fsb4000 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

warning C4242: '=': conversion from 'int' to 'char', possible loss of data
and double to long double.

Also

llvm-project\libcxx\test\std\utilities\format\format.functions\format_tests.h(121) : warning C6054: String 'begin' might not be zero-terminated.: Lines: 88, 89, 90, 91, 92, 109, 110, 121

llvm-project\libcxx\test\std\utilities\format\format.functions\format_tests.h(121) : warning C6001: Using uninitialized memory 'begin'.: Lines: 88, 89, 90, 91, 92, 109, 110, 121

llvm-project\libcxx\test\std\utilities\format\format.functions\format_tests.h(125) : warning C6001: Using uninitialized memory 'end'.: Lines: 88, 89, 90, 91, 92, 125

and -NaN is formatted like "-nan(ind)"

Also I found something else.
Currently this test fails on MSVC with

  Format string   answer is '{:#g}'
  Expected output answer is '0.'
  Actual output   answer is '0.00000'

This is tested there: https://github.com/llvm/llvm-project/blob/486a3c4662cb052329b96537da18893d73138b64/libcxx/test/std/utilities/format/format.functions/format_tests.h#L2035

I don't know what standard says about it but libfmt agrees with MSVC: https://gcc.godbolt.org/z/vd38r5W9x


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131336

Files:
  libcxx/test/std/utilities/format/format.functions/format_tests.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131336.450562.patch
Type: text/x-patch
Size: 52218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220806/6a72e033/attachment-0001.bin>


More information about the libcxx-commits mailing list