Commit Graph

4053 Commits

Author SHA1 Message Date
Nikolay Rapotkin
85050aa2e6 Ability to join elements of std::initializer_list was added 2020-03-15 16:10:00 -07:00
Victor Zverovich
ff486a72a7 Allow leading zeros in precision (#1579) 2020-03-14 11:37:38 -07:00
Victor Zverovich
678341275b Deprecate fmt::char8_t 2020-03-14 10:32:34 -07:00
Victor Zverovich
6f01b6ebb6 Fix a typo in CMake config: STRINGS -> STRING 2020-03-14 09:50:25 -07:00
Victor Zverovich
61c5a51604 Fix handling of empty tuples (#1588) 2020-03-14 07:41:08 -07:00
Dair Grant
02bfd8a9a5 Add FMT_HAS_CPP14_ATTRIBUTE / FMT_HAS_CPP17_ATTRIBUTE to test for language-specific attributes.
FMT_DEPRECATED is now defined as FMT_HAS_CPP14_ATTRIBUTE(deprecated), as this attribute was introduced in C++14.

FMT_FALLTHROUGH is now defined as FMT_HAS_CPP17_ATTRIBUTE(fallthrough), as this attribute was introduced in C++17.

FMT_MAYBE_UNUSED is defined as FMT_HAS_CPP17_ATTRIBUTE(maybe_unused), as this attribute was introduced in C++17.

FMT_MAYBE_UNUSED has been applied to fix a couple of -Wunused-member-function warnings from clang.
2020-03-13 09:03:52 -07:00
Victor Zverovich
3c24052cf1 Workaround 'cannot call member function without object' error on gcc 4.9 2020-03-11 17:39:32 -07:00
Victor Zverovich
f72a905eb3 Fix handling of volatile enums 2020-03-11 08:40:57 -07:00
Victor Zverovich
941d5e147a Workaround broken fallthrough attribute in the PGI compiler (#1583) 2020-03-11 07:56:23 -07:00
Victor Zverovich
ee2b828b9a Tweak a comment 2020-03-09 11:27:14 -07:00
Pramod Kumbhar
5bb8856655
Workaround for broken [[deprecated]] in PGI compiler (#1581)
* Workaround broken [[deprecated]] in PGI compiler
  - similar to Intel and NVCC, add workaround for PGI compiler
2020-03-09 11:25:38 -07:00
Laurent Stacul
1c0c59d4a0 Fix empty debug postfix 2020-03-09 08:34:02 -07:00
Victor Zverovich
b1adaa9881 Remove gcc 4.4 workaround 2020-03-07 14:50:52 -08:00
Victor Zverovich
48e8d0ebef set_doc -> set_verbose 2020-03-07 14:31:39 -08:00
Victor Zverovich
ce00979152 Cleanup CMake config 2020-03-07 08:18:01 -08:00
Victor Zverovich
db4a6cfbf9 is_static_compiled_format -> is_compiled_format 2020-03-06 07:25:34 -08:00
Dair Grant
29a1ea795a Fix clang -Wdisabled-macro-expansion warning from FMT_STRING_IMPL.
FMT_STRING_IMPL has an internal helper named FMT_STRING, however FMT_STRING is also the name of the macro that invokes FMT_STRING_IMPL.

Renaming this helper avoids the appearance of a recursive macro.
2020-03-06 07:00:47 -08:00
Victor Zverovich
8a06ca84c7 Fix ambiguous overloads of format & format_to 2020-03-05 12:22:43 -08:00
Victor Zverovich
153f753bde Deprecate undocumented _u suffix 2020-03-04 19:20:19 -08:00
Victor Zverovich
eafd079868 Improve width computation 2020-03-04 17:17:34 -08:00
Victor Zverovich
0c6919ec72 Make FMT_DEBUG_POSTFIX a cache variable (#1566) 2020-03-04 08:37:11 -08:00
Victor Zverovich
197a5c3721 Apply clang-format 2020-03-04 08:37:00 -08:00
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