* Fix formatting chrono durations to wide strings
* Make format buffers const correct
* Add FormatWide chrono test case
* Fix incorrect wide encoding of 'µs'
I think might be a source file encoding issue, so I used \u00B5 instead.
* Update FormatWide test to use proper encoding of µs
* Revert changes to format_localized's parameters
* Use different overload of `std::time_put<T>::put` to avoid needing a format string
* Use utf8_to_utf16 instead of having redundant overloads of get_units
* Revert some minor changes
* Remove FMT_CONSTEXPR from expression
This should hopefully fix compilation on VS <2019
* Make suggested changes from code review
* Run clang-format on chrono.h
* Make sure unit isn't null before constructing a string_view from it
Otherwise, Google Test will insist on inserting 'char8_t' NTBS into 'char' streams, but basic_ostream<char>::operator<< overloads taking 'char8_t' arguments are defined as deleted by P1423.
Handling individual 'char8_t's is done inline.
This fixes the compilation errors seen in C++20 mode beginning with VS2019 Update 2.
Signed-off-by: Daniela Engert <dani@ngrt.de>
This fixed a compilation error of the OS X 10.11.6 C++ compiler:
./fmt/test/format-test.cc:1861:16: error: default initialization of an object of const type 'const Answer' without a user-provided default constructor
const Answer const_answer;
^
{}
* Avoid weak vtables by providing a private virtual member function
* Add warning Wweak-vtables to clang when FMT_PEDANTIC is on
* Add defaulted copy and move operations to format_error and system_error
Compiler generated copy operations are deprecated and move operations
are not generated altogether.
* Add warning Wdeprecated to clang when FMT_PEDANTIC is on
When `MoveCtor` performs `check_move_buffer`, the buffer allocator becomes null,
but then `MoveCtor` attempts to use it to allocate a dynamic buffer. This
succeeds nevertheless because a typical `std::allocator<char>::allocate` does
not use `this`, so it does not crash when `this` is null.
Fixes#1344
* Fix undefined in core-test
Fixes "reference binding to null pointer" in BufferTest.Ctor
buffer.operator[] attempts to return a reference to `buffer.ptr_[0]` when `ptr_`
in `mock_buffer<int> buffer` is null.
* Fix undefined in printf-test
Fixes "signed integer overflow" in PrintfTest.Length
This occurs in `TestLength<long long>("ll")`, since its minimum value minus one
does not fit in long long.
* Fix undefined in printf %0$
Printf counts arguments from 1.
Fixes "shift exponent -4 is negative" in PrintfTest.InvalidArgIndex.
`do_get` is called with index -1 when `basic_printf_context.arg` is called with
id 4294967295 when basic_printf_context::get_arg subtracts 1 from arg_index 0 in
the format string "%0$d".
Address enhancement request #1322.
The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.
Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
CMake 3.15 introduced a new way of handling MSVC CRT type definition for
the build: CMAKE_MSVC_RUNTIME_LIBRARY variable.
(https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html)
This is supposed to be the way to go with MSVC CRT selection in new
projects. Using this method however breaks the current CMake script for
CUDA test. The reason is the CUDA test uses "FindCUDA" CMake module to
detect and set up CUDA support in CMake, which is deprecated since CMake
version 3.10, and which does not support CMAKE_MSVC_RUNTIME_LIBRARY
selector correctly (i.e. it does not propagate the compiler option
related to the CRT).
I did not find a way to "patch" in the correct compiler options, so
(while knowing this feature is only available from CMake 3.15 on) I
decided to change also the way CUDA is handled and instead of using
FindCUDA, used enable_language. Apart from having some nice additional
side-effects, it also fixed the problem with CRT selection.
However, the propagation of the compiler options (and in particular the
options related to C++ standard selection) is still a bit flaky on
Windows+MSVC platform, so it had to be done manually.
The patch makes two things in parallel:
1) Introduces MSVC_BUILD_STATIC, which, together with CMake version >=
3.15, allows building static version of the 'fmt' lib (and all the
tests).
2) At the same time, for CMake >= 3.15 it switches handling of CUDA
support from (old) FindCUDA to (new) enable_language, to fix the
problems which the old method has with the new CRT selector for MSVC in
a new CMake.
Added a check for CUDA before enabling it.
Using VERSION_LESS instead of VERSION_GREATER_EQUAL
Since apparently VERSION_GREATER_EQUAL exists only from CMake 3.7, while
Android is using CMake 3.6.
Removed MSVC_RUNTIME_LIBRARY logic from the CMake file.
The static build can be set on the command line with CMake >= 3.15
by defining the policy and the CMAKE_MSVC_RUNTIME_LIBARY this way:
cmake -G <gen> <options>
-DCMAKE_POLICY_DEFAULT_CMP0091=NEW
-DMSVC_BUILD_STATIC=ON
-DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded$<$<CONFIG:Debug>:Debug>"
When MSVC_BUILD_DEBUG is set the test 'posix-mock-test' is skipped as it
does not build with the static runtime.
test cuda: import fmt in CUDA source code
Current test is only for Windows(cl.exe).
Need to test more with the other host compilers...
* Activate the test when `find_package(CUDA)` worked
* The test runs with C++14
Detailed comments in 'test/cuda-test'
test cuda: add more comment / macro check
* checks both `__NVCC__` and `__CUDACC__`
More comments for CMake and CUDA source file.
test cuda: <fmt/core.h> checks NVCC and CUDA
The header file checks 2 things.
* __NVCC__: if the compiler is from NVIDIA
* __CUDACC__: if the source code is CUDA(.cu) file
Since we can't sure all users prefer latest, Version for
`find_pacakge(CUDA)` is downgraded to 9.0.
This is the minimum version for C++14 in CUDA
Refactor `format_specs` and related APIs to support variable-width fill
(#1109), improve naming consistency, remove legacy setters (#940), and
optimize layout.