mirror of
https://github.com/fmtlib/fmt.git
synced 2026-01-01 03:31:17 +01:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6f4ceaed0 | ||
|
|
15f812dae8 | ||
|
|
6884aab49b | ||
|
|
88ec4e7061 | ||
|
|
dd3d2490ed | ||
|
|
739055ae7b | ||
|
|
dbbd711f46 | ||
|
|
98cbb6a43c | ||
|
|
214cf13f17 | ||
|
|
17a5c808da | ||
|
|
fc1783fcc6 | ||
|
|
1b193e7b37 | ||
|
|
8e59744b8d | ||
|
|
7081a6aa34 |
@@ -1,5 +1,24 @@
|
||||
8.1.0 - TBD
|
||||
-----------
|
||||
8.1.1 - 2022-01-06
|
||||
------------------
|
||||
|
||||
* Restored ABI compatibility with version 8.0.x
|
||||
(`#2695 <https://github.com/fmtlib/fmt/issues/2695>`_,
|
||||
`#2696 <https://github.com/fmtlib/fmt/pull/2696>`_).
|
||||
Thanks `@saraedum (Julian Rüth) <https://github.com/saraedum>`_.
|
||||
|
||||
* Fixed chorno formatting on big endian systems
|
||||
(`#2698 <https://github.com/fmtlib/fmt/issues/2698>`_,
|
||||
`#2699 <https://github.com/fmtlib/fmt/pull/2699>`_).
|
||||
Thanks `@phprus (Vladislav Shchapov) <https://github.com/phprus>`_ and
|
||||
`@xvitaly (Vitaly Zaitsev) <https://github.com/xvitaly>`_.
|
||||
|
||||
* Fixed a linkage error with mingw
|
||||
(`#2691 <https://github.com/fmtlib/fmt/issues/2691>`_,
|
||||
`#2692 <https://github.com/fmtlib/fmt/pull/2692>`_).
|
||||
Thanks `@rbberger (Richard Berger) <https://github.com/rbberger>`_.
|
||||
|
||||
8.1.0 - 2022-01-02
|
||||
------------------
|
||||
|
||||
* Optimized chrono formatting
|
||||
(`#2500 <https://github.com/fmtlib/fmt/pull/2500>`_,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import errno, os, re, sys
|
||||
from subprocess import check_call, CalledProcessError, Popen, PIPE, STDOUT
|
||||
|
||||
versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0', '4.1.0', '5.0.0', '5.1.0', '5.2.0', '5.2.1', '5.3.0', '6.0.0', '6.1.0', '6.1.1', '6.1.2', '6.2.0', '6.2.1', '7.0.0', '7.0.1', '7.0.2', '7.0.3', '7.1.0', '7.1.1', '7.1.2', '7.1.3', '8.0.0', '8.0.1']
|
||||
versions = ['1.0.0', '1.1.0', '2.0.0', '3.0.2', '4.0.0', '4.1.0', '5.0.0', '5.1.0', '5.2.0', '5.2.1', '5.3.0', '6.0.0', '6.1.0', '6.1.1', '6.1.2', '6.2.0', '6.2.1', '7.0.0', '7.0.1', '7.0.2', '7.0.3', '7.1.0', '7.1.1', '7.1.2', '7.1.3', '8.0.0', '8.0.1', '8.1.0', '8.1.1']
|
||||
|
||||
class Pip:
|
||||
def __init__(self, venv_dir):
|
||||
|
||||
@@ -558,7 +558,15 @@ inline void write_digit2_separated(char* buf, unsigned a, unsigned b,
|
||||
auto usep = static_cast<unsigned long long>(sep);
|
||||
// Add ASCII '0' to each digit byte and insert separators.
|
||||
digits |= 0x3030003030003030 | (usep << 16) | (usep << 40);
|
||||
memcpy(buf, &digits, 8);
|
||||
|
||||
constexpr const size_t len = 8;
|
||||
if (const_check(is_big_endian())) {
|
||||
char tmp[len];
|
||||
memcpy(tmp, &digits, len);
|
||||
std::reverse_copy(tmp, tmp + len, buf);
|
||||
} else {
|
||||
memcpy(buf, &digits, len);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename Period> FMT_CONSTEXPR inline const char* get_units() {
|
||||
@@ -1082,7 +1090,7 @@ template <typename OutputIt, typename Char> class tm_writer {
|
||||
}
|
||||
template <typename T, FMT_ENABLE_IF(!has_member_data_tm_gmtoff<T>::value)>
|
||||
void format_utc_offset_impl(const T& tm) {
|
||||
#if defined(_WIN32)
|
||||
#if defined(_WIN32) && defined(_UCRT)
|
||||
# if FMT_USE_TZSET
|
||||
tzset_once();
|
||||
# endif
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
// The fmt library version in the form major * 10000 + minor * 100 + patch.
|
||||
#define FMT_VERSION 80100
|
||||
#define FMT_VERSION 80101
|
||||
|
||||
#if defined(__clang__) && !defined(__ibmxl__)
|
||||
# define FMT_CLANG_VERSION (__clang_major__ * 100 + __clang_minor__)
|
||||
@@ -219,6 +219,20 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_DEPRECATED
|
||||
# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VER >= 1900
|
||||
# define FMT_DEPRECATED [[deprecated]]
|
||||
# else
|
||||
# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__)
|
||||
# define FMT_DEPRECATED __attribute__((deprecated))
|
||||
# elif FMT_MSC_VER
|
||||
# define FMT_DEPRECATED __declspec(deprecated)
|
||||
# else
|
||||
# define FMT_DEPRECATED /* deprecated */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_BEGIN_NAMESPACE
|
||||
# define FMT_BEGIN_NAMESPACE \
|
||||
namespace fmt { \
|
||||
@@ -601,7 +615,7 @@ struct error_handler {
|
||||
constexpr error_handler(const error_handler&) = default;
|
||||
|
||||
// This function is intentionally not constexpr to give a compile-time error.
|
||||
void on_error(const char* message) { throw_format_error(message); }
|
||||
FMT_NORETURN FMT_API void on_error(const char* message);
|
||||
};
|
||||
FMT_END_DETAIL_NAMESPACE
|
||||
|
||||
@@ -1373,21 +1387,20 @@ template <typename Context> struct arg_mapper {
|
||||
using cstring_result = conditional_t<std::is_same<char_type, char>::value,
|
||||
const char*, unformattable_pointer>;
|
||||
|
||||
// DEPRECATED!
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const signed char* val) -> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
// DEPRECATED!
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char* val)
|
||||
FMT_DEPRECATED FMT_CONSTEXPR FMT_INLINE auto map(const signed char* val)
|
||||
-> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
// DEPRECATED!
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(signed char* val) -> cstring_result {
|
||||
FMT_DEPRECATED FMT_CONSTEXPR FMT_INLINE auto map(const unsigned char* val)
|
||||
-> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
// DEPRECATED!
|
||||
FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val) -> cstring_result {
|
||||
FMT_DEPRECATED FMT_CONSTEXPR FMT_INLINE auto map(signed char* val)
|
||||
-> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
FMT_DEPRECATED FMT_CONSTEXPR FMT_INLINE auto map(unsigned char* val)
|
||||
-> cstring_result {
|
||||
return map(reinterpret_cast<const char*>(val));
|
||||
}
|
||||
|
||||
|
||||
@@ -2575,6 +2575,12 @@ FMT_FUNC void report_system_error(int error_code,
|
||||
report_error(format_system_error, error_code, message);
|
||||
}
|
||||
|
||||
// DEPRECATED!
|
||||
// This function is defined here and not inline for ABI compatiblity.
|
||||
FMT_FUNC void detail::error_handler::on_error(const char* message) {
|
||||
throw_format_error(message);
|
||||
}
|
||||
|
||||
FMT_FUNC std::string vformat(string_view fmt, format_args args) {
|
||||
// Don't optimize the "{}" case to keep the binary size small and because it
|
||||
// can be better optimized in fmt::format anyway.
|
||||
|
||||
@@ -110,20 +110,6 @@ FMT_END_NAMESPACE
|
||||
# define FMT_CATCH(x) if (false)
|
||||
#endif
|
||||
|
||||
#ifndef FMT_DEPRECATED
|
||||
# if FMT_HAS_CPP14_ATTRIBUTE(deprecated) || FMT_MSC_VER >= 1900
|
||||
# define FMT_DEPRECATED [[deprecated]]
|
||||
# else
|
||||
# if (defined(__GNUC__) && !defined(__LCC__)) || defined(__clang__)
|
||||
# define FMT_DEPRECATED __attribute__((deprecated))
|
||||
# elif FMT_MSC_VER
|
||||
# define FMT_DEPRECATED __declspec(deprecated)
|
||||
# else
|
||||
# define FMT_DEPRECATED /* deprecated */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_MAYBE_UNUSED
|
||||
# if FMT_HAS_CPP17_ATTRIBUTE(maybe_unused)
|
||||
# define FMT_MAYBE_UNUSED [[maybe_unused]]
|
||||
@@ -310,10 +296,18 @@ FMT_CONSTEXPR20 auto bit_cast(const From& from) -> To {
|
||||
}
|
||||
|
||||
inline auto is_big_endian() -> bool {
|
||||
#ifdef _WIN32
|
||||
return false;
|
||||
#elif defined(__BIG_ENDIAN__)
|
||||
return true;
|
||||
#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
|
||||
return __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__;
|
||||
#else
|
||||
struct bytes {
|
||||
char data[sizeof(int)];
|
||||
};
|
||||
return bit_cast<bytes>(1).data[0] == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// A fallback implementation of uintptr_t for systems that lack it.
|
||||
@@ -323,7 +317,7 @@ struct fallback_uintptr {
|
||||
fallback_uintptr() = default;
|
||||
explicit fallback_uintptr(const void* p) {
|
||||
*this = bit_cast<fallback_uintptr>(p);
|
||||
if (is_big_endian()) {
|
||||
if (const_check(is_big_endian())) {
|
||||
for (size_t i = 0, j = sizeof(void*) - 1; i < j; ++i, --j)
|
||||
std::swap(value[i], value[j]);
|
||||
}
|
||||
@@ -526,7 +520,7 @@ FMT_CONSTEXPR inline auto utf8_decode(const char* s, uint32_t* c, int* e)
|
||||
return next;
|
||||
}
|
||||
|
||||
enum { invalid_code_point = ~uint32_t() };
|
||||
constexpr uint32_t invalid_code_point = ~uint32_t();
|
||||
|
||||
// Invokes f(cp, sv) for every code point cp in s with sv being the string view
|
||||
// corresponding to the code point. cp is invalid_code_point on error.
|
||||
@@ -3044,14 +3038,8 @@ constexpr auto operator"" _a(const char* s, size_t) -> detail::udl_arg<char> {
|
||||
}
|
||||
# endif
|
||||
|
||||
/**
|
||||
DEPRECATED! User-defined literal equivalent of fmt::format.
|
||||
|
||||
**Example**::
|
||||
|
||||
using namespace fmt::literals;
|
||||
std::string message = "The answer is {}"_format(42);
|
||||
*/
|
||||
// DEPRECATED!
|
||||
// User-defined literal equivalent of fmt::format.
|
||||
FMT_DEPRECATED constexpr auto operator"" _format(const char* s, size_t n)
|
||||
-> detail::udl_formatter<char> {
|
||||
return {{s, n}};
|
||||
|
||||
@@ -270,9 +270,9 @@ def release(args):
|
||||
|
||||
# Create a release on GitHub.
|
||||
fmt_repo.push('origin', 'release')
|
||||
params = {'access_token': os.getenv('FMT_TOKEN')}
|
||||
auth_headers = {'Authorization': 'token ' + os.getenv('FMT_TOKEN')}
|
||||
r = requests.post('https://api.github.com/repos/fmtlib/fmt/releases',
|
||||
params=params,
|
||||
headers=auth_headers,
|
||||
data=json.dumps({'tag_name': version,
|
||||
'target_commitish': 'release',
|
||||
'body': changes, 'draft': True}))
|
||||
@@ -283,8 +283,8 @@ def release(args):
|
||||
package = 'fmt-{}.zip'.format(version)
|
||||
r = requests.post(
|
||||
'{}/{}/assets?name={}'.format(uploads_url, id, package),
|
||||
headers={'Content-Type': 'application/zip'},
|
||||
params=params, data=open('build/fmt/' + package, 'rb'))
|
||||
headers={'Content-Type': 'application/zip'} | auth_headers,
|
||||
data=open('build/fmt/' + package, 'rb'))
|
||||
if r.status_code != 201:
|
||||
raise Exception('Failed to upload an asset ' + str(r))
|
||||
|
||||
|
||||
@@ -740,10 +740,13 @@ struct convertible_to_pointer {
|
||||
enum class test_scoped_enum {};
|
||||
|
||||
TEST(core_test, is_formattable) {
|
||||
#if 0
|
||||
// This should be enabled once corresponding map overloads are gone.
|
||||
static_assert(fmt::is_formattable<signed char*>::value, "");
|
||||
static_assert(fmt::is_formattable<unsigned char*>::value, "");
|
||||
static_assert(fmt::is_formattable<const signed char*>::value, "");
|
||||
static_assert(fmt::is_formattable<const unsigned char*>::value, "");
|
||||
#endif
|
||||
static_assert(!fmt::is_formattable<wchar_t>::value, "");
|
||||
#ifdef __cpp_char8_t
|
||||
static_assert(!fmt::is_formattable<char8_t>::value, "");
|
||||
@@ -768,11 +771,6 @@ TEST(core_test, is_formattable) {
|
||||
|
||||
static_assert(!fmt::is_formattable<convertible_to_pointer>::value, "");
|
||||
|
||||
static_assert(!fmt::is_formattable<signed char*, wchar_t>::value, "");
|
||||
static_assert(!fmt::is_formattable<unsigned char*, wchar_t>::value, "");
|
||||
static_assert(!fmt::is_formattable<const signed char*, wchar_t>::value, "");
|
||||
static_assert(!fmt::is_formattable<const unsigned char*, wchar_t>::value, "");
|
||||
|
||||
static_assert(!fmt::is_formattable<void (*)()>::value, "");
|
||||
|
||||
struct s;
|
||||
|
||||
@@ -1386,22 +1386,6 @@ TEST(format_test, format_cstring) {
|
||||
format_error, "string pointer is null");
|
||||
}
|
||||
|
||||
TEST(format_test, format_schar_string) {
|
||||
signed char str[] = "test";
|
||||
EXPECT_EQ("test", fmt::format("{0:s}", str));
|
||||
const signed char* const_str = str;
|
||||
EXPECT_EQ("test", fmt::format("{0:s}", const_str));
|
||||
}
|
||||
|
||||
TEST(format_test, format_uchar_string) {
|
||||
unsigned char str[] = "test";
|
||||
EXPECT_EQ("test", fmt::format("{0:s}", str));
|
||||
const unsigned char* const_str = str;
|
||||
EXPECT_EQ("test", fmt::format("{0:s}", const_str));
|
||||
unsigned char* ptr = str;
|
||||
EXPECT_EQ("test", fmt::format("{0:s}", ptr));
|
||||
}
|
||||
|
||||
void function_pointer_test(int, double, std::string) {}
|
||||
|
||||
TEST(format_test, format_pointer) {
|
||||
|
||||
@@ -481,12 +481,6 @@ TEST(printf_test, string) {
|
||||
EXPECT_PRINTF(L" (null)", L"%10s", null_wstr);
|
||||
}
|
||||
|
||||
TEST(printf_test, uchar_string) {
|
||||
unsigned char str[] = "test";
|
||||
unsigned char* pstr = str;
|
||||
EXPECT_EQ("test", fmt::sprintf("%s", pstr));
|
||||
}
|
||||
|
||||
TEST(printf_test, pointer) {
|
||||
int n;
|
||||
void* p = &n;
|
||||
|
||||
Reference in New Issue
Block a user