Commit Graph

4031 Commits

Author SHA1 Message Date
refnum
68742e1d87
Fix clang -Wsign-conversion warning in grisu_count_digits. (#1573)
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.
2020-03-04 06:48:41 -08:00
Victor Zverovich
1e8493196e Make compile-time checks in format_to handle references 2020-03-01 07:57:34 -08:00
refnum
58e6c84f5a
Fix simple -Wsign-conversion cases. (#1571)
* 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).
2020-03-01 07:22:15 -08:00
refnum
75a4525e5f
Move FMT_CLANG_VERSION definition to core.h (#1568)
Previously format.h defined FMT_CLANG_VERSION after including core.h, however core.h tests FMT_CLANG_VERSION when it defines FMT_API.
2020-02-29 17:19:34 -08:00
refnum
6ccb2e241b
Add FMT_NORETURN to assert_fail prototype. (#1569)
When building with -Werror,-Wmissing-noreturn clang identifies that assert_fail could be declared with the 'noreturn' attribute.
2020-02-29 17:17:55 -08:00
Victor Zverovich
bed134a4aa Tentative fix for default template param in friend error 2020-02-27 15:29:46 -08:00
Victor Zverovich
b2d3a86ec0 Make FMT_ASSERT work in constexpr on clang 4.0.1 2020-02-26 06:26:46 -08:00
Victor Zverovich
13d82e32bd Don't use internal GTest API 2020-02-24 11:32:34 -08:00
fghzxm
2161a73f2b
Fix FMT_FORMAT_AS const specifier position (#1554)
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 &`.
2020-02-23 07:27:22 -08:00
IkarusDeveloper
e00997b004
improved use of find (#1560)
* improved use of find

*begin is supposed to be different from '{' when this find is used, so we can avoid checking it.
2020-02-21 14:43:06 -08:00
dominicpoeschko
0415cf2350
add const begin and end overload to buffer (#1553)
* add const begin and end overload to buffer

since there is a const overload for data I think there should also be one for begin and end
2020-02-19 14:59:50 +01:00
Victor Zverovich
3bafd0749b Fix to_string docs 2020-02-15 09:51:35 +01:00
Victor Zverovich
f733882b55 Remove misleading FMT_USE_WINDOWS_H 2020-02-14 14:09:27 +01:00
Victor Zverovich
dc22360c34 Workaround broken UDL templates in GCC < 6.4 2020-02-10 17:08:14 +01:00
Victor Zverovich
1f1b50707c Make formatter override implicit conversion to a C string 2020-02-07 19:24:36 -08:00
Victor Zverovich
24924128e3 Fix a link error in gcc8 (#1548) 2020-02-07 18:34:05 -08:00
Jordan Williams
c54cd71800 only modify CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is not already set 2020-02-07 07:10:03 -08:00
Victor Zverovich
43e9b29e50 Only use compiler features if available 2020-02-06 15:43:33 -08:00
Victor Zverovich
b55ea58705 string_view::char_type -> value_type (#1539) 2020-02-01 12:27:44 -08:00
Victor Zverovich
4098970db2
Update README.rst 2020-01-31 11:33:51 -08:00
Milian Wolff
314e15001f
Fix symbol visibility on Linux when compiling with -fvisibility=hidden (#1535)
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
2020-01-30 06:26:18 -08:00
Victor Zverovich
f499b393d1 Apply coding conventions 2020-01-26 19:48:48 -08:00
Attila Mark
6c30f41443 Configure fmt.pc library name correctly.
Simplify getting library name.

Add FMT_DEBUG_SUFFIX variable.
2020-01-26 19:48:14 -08:00
zeffy
1acb73f970 Fix formatting std::chrono::duration types to wide strings (#1533)
* 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
2020-01-23 18:48:36 -08:00
Victor Zverovich
09a13244c8 Disallow passing non-string-literals to FMT_STRING 2020-01-22 21:05:46 -08:00
Victor Zverovich
419db8baa1 Fix length computation of constexpr C strings 2020-01-22 18:25:07 -08:00
dspc-douglas
9fc4161f5e fix interal compiler error when building with mingw 2020-01-22 18:14:46 -08:00
Greg Sjaardema
25d6916b3a Fix so can work without locale defined
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`
2020-01-22 07:26:03 -08:00
Victor Zverovich
0b2eb6501c Add locale example 2020-01-20 08:42:16 -08:00
Victor Zverovich
fd1cabe464 Workaround a bogus MSVC warning 2020-01-20 06:56:22 -08:00
Victor Zverovich
a844d7ab81 Add namespaces 2020-01-19 19:20:48 -08:00
Victor Zverovich
47d3968092 Add more examples 2020-01-19 19:15:54 -08:00
Victor Zverovich
7800173eb1 Update fill docs 2020-01-19 18:57:32 -08:00
Victor Zverovich
b4218aa0f8 Test invalid fill 2020-01-19 16:52:36 -08:00
Victor Zverovich
8a3a8177d6 Bump version 2020-01-19 15:34:30 -08:00
Victor Zverovich
e5f2f8ce7a Add variable-width fill support (#1109) 2020-01-19 14:49:51 -08:00
Victor Zverovich
75765bfad5 Avoid unnecessary unsigned overflows (#1515) 2020-01-18 08:19:27 -08:00
Victor Zverovich
9bd9738da0 Remove static and simplify names 2020-01-18 07:43:59 -08:00
Victor Zverovich
bd5f903f28 Add a locale example 2020-01-18 07:11:45 -08:00
Victor Zverovich
06e437fd98 Move docs to the proper place 2020-01-18 06:59:21 -08:00
JackBoosY
1bd4f54fa6 update format 2020-01-17 11:07:55 -08:00
JackBoosY
11cc2903e4 re-fix url link 2020-01-17 11:07:55 -08:00
JackBoosY
b124e3e8e7 fix url link 2020-01-17 11:07:55 -08:00
JackBoosY
ffd5f3469f Correct display format 2020-01-17 11:07:55 -08:00
JackBoosY
0f0e5ddf5f Add vcpkg installation instructions 2020-01-17 11:07:55 -08:00
Victor Zverovich
1f110702a1 Remove redundant braces 2020-01-15 15:07:30 -08:00
Jason Turner
4ccbe4b5f2 Avoid namespace clash for fmt
## 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`
2020-01-15 11:23:24 -08:00
Greg Sjaardema
40638a75b3 Use C++11 compatible std::is_same operations
The `operator()` member function of `std::is_same` was added in C++14.  For C++11, the `::value` needs to be used instead.
2020-01-15 11:20:47 -08:00
Victor Zverovich
c8dd9cc99d Use type_identity to block unnecessary template argument deduction (thanks Tim Song) 2020-01-15 10:27:50 -08:00
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