Commit Graph

409 Commits

Author SHA1 Message Date
Victor Zverovich
04cde756bc Simplify checks 2020-04-19 07:35:19 -07:00
Victor Zverovich
c9a57b9a81 Fix incorrect assumptions about nul termination 2020-04-18 06:51:52 -07:00
Victor Zverovich
6e8d7e2776 Don't use constexpr on Intel compiler (#1628) 2020-04-16 07:08:04 -07:00
Victor Zverovich
567ed03f88 Merge arg overloads and cleanup 2020-04-15 08:44:58 -07:00
Johan Norberg
c3fa333140 Remove warning in core.h with when compiling with gcc and -Wshadow
In file included from build/_deps/fmt-src/include/fmt/format.h:44:0,
                 from src/main.cpp:5:
build/_deps/fmt-src/include/fmt/core.h: In member function ‘const T& fmt::v6::internal::dynamic_arg_list::push(const Arg&)’:
build/_deps/fmt-src/include/fmt/core.h:1256:10: error: declaration of ‘node’ shadows a member of ‘fmt::v6::internal::dynamic_arg_list’ [-Werror=shadow]
     auto node = std::unique_ptr<typed_node<T>>(new typed_node<T>(arg));
          ^~~~
build/_deps/fmt-src/include/fmt/core.h:1236:37: note: shadowed declaration is here
   template <typename = void> struct node {
2020-04-15 07:31:24 -07:00
Victor Zverovich
538d83fd08 Cleanup named arguments 2020-04-15 06:28:41 -07:00
Victor Zverovich
8a4630686e Improve handling of named arguments 2020-04-14 11:56:55 -07:00
Victor Zverovich
fdcf7870a2 Add stack-based named argument storage 2020-04-13 08:03:51 -07:00
Victor Zverovich
e99809f29d Fix ostream support in sprintf (#1631) 2020-04-12 07:53:17 -07:00
Victor Zverovich
3aab2171ed Clean up basic_format_args 2020-04-11 08:22:53 -07:00
Victor Zverovich
8cd8ef03eb Simplify warning suppression 2020-04-11 06:17:31 -07:00
Victor Zverovich
36ea32640f Suppress a bogus MSVC warning 2020-04-10 06:44:07 -07:00
Victor Zverovich
141a00d642 Define FMT_EXTERN_TEMPLATE_API on export 2020-04-09 11:54:55 -07:00
Victor Zverovich
3860edc5d9 Bump version 2020-04-08 14:48:14 -07:00
Victor Zverovich
7d01859ef1 Fix handling of unsigned char strings in printf 2020-04-08 13:05:42 -07:00
Victor Zverovich
346500e70b Fix gcc version check 2020-04-04 11:23:40 -07:00
Victor Zverovich
51c58a56ba Bump version 2020-04-03 08:32:45 -07:00
Victor Zverovich
80ce222ca6 Fix wide print overload (#1609) 2020-03-28 09:44:18 -07:00
Victor Zverovich
96c68afe69 Fix -Wsign-conversion warnings 2020-03-25 07:46:00 -07:00
Scott Ramsby
664dd88e31 Enable FMT_STRING() use with types other than string literals 2020-03-24 12:56:21 -07:00
Victor Zverovich
08ca40ea91 Detect /utf-8 in MSVC 2020-03-22 08:19:38 -07:00
Victor Zverovich
dd97f4920c Improve exception safety in dynamic_format_arg_store 2020-03-21 08:58:50 -07:00
Victor Zverovich
2951169481 Move FMT_USE_FLOAT and friends to fmt/format.h 2020-03-20 07:55:43 -07:00
Alberto Aguirre
d3e668418f
Allow disabling floating point support (#1590)
* Allow disabling floating point support

Add FMT_USE_FLOAT, FMT_USE_DOUBLE and FMT_USE_LONG_DOUBLE to allow a
user of the library to configure the float types they want to allow.
This is specially useful in embedded environements where code size is
important.

* Avoid conditional macros to disable float support

* Add is_supported_floating_point constexpr function

* Fix empty-body warning
2020-03-20 06:46:31 -07:00
Victor Zverovich
3cf619de55 Simplify dynamic_format_arg_store 2020-03-17 07:13:46 -07:00
Victor Zverovich
026f99178e Simplify dynamic store 2020-03-16 19:10:41 -07:00
Victor Zverovich
9f70fc3e7a Minor tweaks for dynamic_format_arg_store 2020-03-16 07:58:15 -07:00
Vladimir Solontsov
6012dc9ab4
Dynamic arguments storage. Implementation of enhancement from issue #1170. (#1584) 2020-03-16 07:00:29 -07:00
Victor Zverovich
678341275b Deprecate fmt::char8_t 2020-03-14 10:32:34 -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
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
Victor Zverovich
1e8493196e Make compile-time checks in format_to handle references 2020-03-01 07:57:34 -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
b2d3a86ec0 Make FMT_ASSERT work in constexpr on clang 4.0.1 2020-02-26 06:26:46 -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
1f1b50707c Make formatter override implicit conversion to a C string 2020-02-07 19:24:36 -08:00
Victor Zverovich
b55ea58705 string_view::char_type -> value_type (#1539) 2020-02-01 12:27:44 -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
8a3a8177d6 Bump version 2020-01-19 15:34:30 -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
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
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
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
Victor Zverovich
7b478f9dec Simplify example 2020-01-02 07:31:45 -10:00