grisu_count_digits is only used by grisu_gen_digits, which assigns the unsigned result to a (signed) int.
Although grisu_count_digits always returns a positive integer this keeps its return type in sync with the type its result is assigned to.
* Fix -Wsign-conversion in bigint::subtract_aligned.
n is assigned a size_t, and only used for comparisons with j.
j is assigned 0, compared to n (size_t), and passed to basic_memory_buffer::operator[] (size_t).
* Fix -Wsign-conversion in bigint::assign.
num_bigits is initialised to 0, is only ever incremented, and is passed to basic_memory_buffer::operator[] (size_t) and basic_memory_buffer::resize (size_t).
The current `FMT_FORMAT_AS` macro will make `formatter<Char *>::format`
have the first argument type `const Char *&` which is incorrect an
should be `Char *const &`. This pull request fixes that by changing the
first argument type in the macro definition body from `const Type &` to
`Type const &`.
Make FMT_API symbols use the default visibility on non-Windows
platforms. Otherwise, one cannot use the generated fmt library when
compiling globally with -fvisibility=hidden.
Fixes compile errors like:
```
../3rdParty/fmt/include/fmt/core.h:757: error: undefined reference to 'fmt::v6::internal::assert_fail(char const*, int, char const*)'
```
Note that the symbol exists, but is local:
```
$ nm -C libfmtd.so.6.1.3 | grep assert_fail
U __assert_fail
0000000000233ffa t fmt::v6::internal::assert_fail(char const*, int, char const*)
```
With this patch, the compile error is gone and the symbol is properly
exported:
```
$ nm -a bin/libfmtd.so -C | grep assert_fail
U __assert_fail
00000000002366ba T fmt::v6::internal::assert_fail(char const*, int, char const*)
```
Change-Id: I96054e622d9a2ae81907e1b01a1033e629767a91
* 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
If `FMT_STATIC_THOUSANDS_SEPARATOR` defined, then locale is not included or defined, so this call will be unresolved. I think this is the correct fix based on the code in `format-inl.h` and `format.h`
## Problem
In the case of an existing `fmt` namespace (in my project this looks like `Project::fmt`) it is possible to get a namespace clash in debug builds (MSVC 2017)
## Proposed Solution
When referencing `fmt` internally, be explicit that it is relative to the global namespace using `::fmt`
The nvcc compiler (at least up to 9.2) defines `__SIZEOF_INT128__`, but doesn't support 128-bit integers on device code:
```
error: "fmt::v6::format_arg_store<fmt::v6::basic_format_context<std::back_insert_iterator<fmt::v6::internal::buffer<char>>, char>, const char *, int, const char *>" contains a 128-bit integer, which is not supported in device code
```
The `std::is_base_of<T,U>()` and `std::is_reference<T>()` member functions were added in C++14. To maintain C++11 compatibility, use the `::value` instead.
Current code fails on intel-17 and other compilers if using strict C++11
The intel-17 and intel-18 compilers seem to require that `u` be `const`:
```
/src/fmt/format.h(226): warning #437: reference to local variable of enclosing function is not allowed
char data[sizeof(u)];
```
If `u` is declared as `const auto u =1u` instead of just `auto u=1u`, the file compiles with no warnings.
Similar to the MSC Compiler, the NVidia NVCC compiler also
emits unreachable code warnings when there is a return
statement following an exception. These changes eliminate
those warnings.
* Squelch MSVC warning exporting subclasses of runtime_error
When compiling {fmt} as a DLL, MSVC complains that we are exporting
classes that inherit from "std::runtime_error", which we are not
exporting.
In this case, it's not really a problem because that symbol is already
exported via the C++ stdlib. So we just add a pragma to silence the
warning.
* Fix compilation with MinGW
Commit 3bc28fcc6b ("Squelch MSVC warning exporting subclasses of
runtime_error", 2019-11-29) silenced a MSVC warning under. The MinGW
compiler also defines _WIN32, but does not support the "warning" pragma.
Introduce a helper macro to squelch the MSVC warning only when using the
Microsoft compiler.
Signed-off-by: Beat Bolli <dev@drbeat.li>
* Fix compilation with VS2015 (#1450)
VS2015 does not support the __pragma(...) syntax in the midst of a
class declaration, so move it to just before the declaration.
Commit 3bc28fcc6b ("Squelch MSVC warning exporting subclasses of
runtime_error", 2019-11-29) silenced a MSVC warning under. The MinGW
compiler also defines _WIN32, but does not support the "warning" pragma.
Introduce a helper macro to squelch the MSVC warning only when using the
Microsoft compiler.
Signed-off-by: Beat Bolli <dev@drbeat.li>
When compiling {fmt} as a DLL, MSVC complains that we are exporting
classes that inherit from "std::runtime_error", which we are not
exporting.
In this case, it's not really a problem because that symbol is already
exported via the C++ stdlib. So we just add a pragma to silence the
warning.