Commit Graph

4132 Commits

Author SHA1 Message Date
Greg Sjaardema
4bbe57cebf Work-around for nvcc
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
```
2020-01-15 07:31:58 -08:00
Greg Sjaardema
55b6130055 Use C++11-compatible operations
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
2020-01-15 07:23:39 -08:00
Greg Sjaardema
ae3ea156ea Fix for older versions of intel compiler
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.
2020-01-14 17:56:06 -08:00
Tobias Hammer
77165fdf85 Use FMT_NOEXCEPT instead of noexcept directly
Otherwise breaks on compilers without noexcept support
2020-01-14 09:31:31 -08:00
Victor Zverovich
65ac626c58 Improve join docs 2020-01-12 07:26:16 -08:00
torsten
cd0b3f9695 check if _SECURE_SCL is defined not equal to 0 2020-01-09 15:01:48 -08:00
Victor Zverovich
cef1e4354b Optimize grisu_gen_digits 2020-01-07 16:11:18 -10:00
Victor Zverovich
0201c8db21 Restructure float_format 2020-01-07 14:41:30 -10:00
Victor Zverovich
9e3f3e8cff Fix handling of output iterators in format_to_n (#1506) 2020-01-05 09:59:01 -10:00
Victor Zverovich
aa07c57654 Move vprint_mojibake to the internal namespace 2020-01-04 08:31:18 -10:00
Victor Zverovich
a73d89e9c7 Catch invalid uses of fmt::arg 2020-01-04 07:11:35 -10:00
Daniela Engert
cb8e7caf7c Convert 'char8_t' character sequences to 'char' sequences
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>
2020-01-04 07:01:48 -10:00
Victor Zverovich
b3fd0005dd Suppress a bogus -Wdouble-promotion warning 2020-01-03 06:57:14 -10:00
Victor Zverovich
7b478f9dec Simplify example 2020-01-02 07:31:45 -10:00
Victor Zverovich
c85efef312 More showpoint fixes and tests (#1498) 2019-12-30 13:08:35 -10:00
Victor Zverovich
455a7c0787 Clarify lifetime of basic_format_args 2019-12-30 08:51:47 -10:00
Victor Zverovich
674c326d7c
Update syntax.rst 2019-12-29 07:25:34 -10:00
Victor Zverovich
061a9897fe
Update syntax.rst 2019-12-26 16:49:40 -10:00
Ivan Shynkarenka
d2d1c9c560 warning C4267: 'argument': conversion from 'size_t' to 'DWORD', possible loss of data 2019-12-26 08:07:24 -08:00
Victor Zverovich
b6e19e5953 Update apidoc 2019-12-24 12:08:37 -08:00
Victor Zverovich
f219dcd59b Add fmt::bytes 2019-12-24 10:45:15 -08:00
Victor Zverovich
dea7fde8b7 Deprecate u8string_view 2019-12-24 09:44:57 -08:00
Victor Zverovich
5390e29d42 Enable mojibake 2019-12-24 08:42:29 -08:00
Victor Zverovich
9f6434dcde Improve UTF-8 handling on Windows 2019-12-23 16:19:11 -08:00
Victor Zverovich
dac9a7f99d Improve UTF-8 handling on Windows 2019-12-22 12:05:28 -08:00
Victor Zverovich
3ca9533f38 Flatten forward 2019-12-22 08:23:54 -08:00
Victor Zverovich
7eec036d9a Improve UTF-8 support 2019-12-21 19:53:52 -08:00
Victor Zverovich
e6b37b4aff Handle block boundaries in utf8_to_utf16 2019-12-21 16:33:34 -08:00
Victor Zverovich
8cf4c52068 Apply clang-format 2019-12-21 13:10:45 -08:00
Victor Zverovich
74532c23a3 Make type a scoped enum 2019-12-21 12:22:17 -08:00
Victor Zverovich
b308159be5 Make round_direction a scoped enum 2019-12-21 09:24:42 -08:00
Victor Zverovich
162995fedd Add os.h to docs 2019-12-18 14:17:49 -08:00
Victor Zverovich
8b41362a0a Add trailing decimal point if # is specified (#1476) 2019-12-18 12:41:56 -08:00
Victor Zverovich
1b1c70108a trailing_zeros -> showpoint 2019-12-18 12:12:09 -08:00
Victor Zverovich
d7e72a09e0 Simplify FMT_STRING_IMPL 2019-12-18 11:50:47 -08:00
Victor Zverovich
2201890d7a Apply clang-format and update inclusion guards 2019-12-18 11:17:36 -08:00
Greg Sjaardema
6100ed4bb3 Eliminate NVCC NVidia compiler emits unreachable code 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.
2019-12-18 10:39:40 -08:00
Victor Zverovich
1afe201ae8 Handle block boundaries in utf8_to_utf16 2019-12-18 10:35:51 -08:00
谭九鼎
cd2b99032f Chore(readme): use https (#1481) 2019-12-17 06:48:27 -08:00
parkertomatoes
9acf89fef6 Mitigate MSVC issue with min/max macros (#1480) 2019-12-16 08:24:00 -08:00
Victor Zverovich
9ea42fb26e Rename posix-test to os-test 2019-12-15 16:43:40 -08:00
Victor Zverovich
da2569827e posix.cc -> os.cc 2019-12-15 12:36:15 -08:00
Victor Zverovich
35959a31d7 Move OS-specific APIs to a separate header 2019-12-15 11:46:45 -08:00
Victor Zverovich
ec2463c905 Implement utf8_to_utf16 using utf8_decode 2019-12-15 09:35:26 -08:00
Victor Zverovich
0012917f69 Add a UTF-8 decoder 2019-12-15 07:28:19 -08:00
Victor Zverovich
9e450911fa Give an error on precision overflow 2019-12-14 07:45:27 -08:00
Victor Zverovich
068d20bc31 Avoid shadowing warnings in FMT_STRING 2019-12-14 07:00:08 -08:00
Victor Zverovich
a99fbe67b9 Apply a typo fix retroactively 2019-12-14 06:50:53 -08:00
Victor Zverovich
adbed11ed4 Fix a typo 2019-12-13 15:49:40 -08:00
iPherian
8ab1c5c6e8 Squelch MSVC warning exporting subclasses of runtime_error (fix for PR #1433) (#1470)
* 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.
2019-12-13 12:16:36 -08:00