Update to 3.0.1

This commit is contained in:
Dave Johansen 2016-11-29 19:25:28 -07:00
parent 204c93a086
commit a5401d5080
6 changed files with 7 additions and 165 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
/fmt-3.0.0.zip
/fmt-3.0.1.zip

View File

@ -1,17 +1,11 @@
Name: fmt
Version: 3.0.0
Release: 2%{?dist}
Version: 3.0.1
Release: 1%{?dist}
Summary: Small, safe and fast formatting library for C++
License: BSD
URL: https://github.com/fmtlib/fmt
Source0: https://github.com/fmtlib/fmt/releases/download/%{version}/%{name}-%{version}.zip
# See https://github.com/fmtlib/fmt/issues/325
Patch0: fmt_gmock_crash.patch
# See https://github.com/fmtlib/fmt/issues/329
Patch1: fmt_mock_locale.patch
# See https://github.com/fmtlib/fmt/issues/398
Patch2: fmt_char_width.patch
%if 0%{?rhel}
BuildRequires: cmake3
@ -109,6 +103,9 @@ make -C build test
%postun -p /sbin/ldconfig
%changelog
* Fri Nov 25 2016 Dave Johansen <davejohansen@gmail.com> - 3.0.1-1
- Upstream release
* Tue Nov 15 2016 Dave Johansen <davejohansen@gmail.com> - 3.0.0-2
- Fix expected unqualified-id before numeric constant error

View File

@ -1,32 +0,0 @@
--- a/fmt/format.h
+++ b/fmt/format.h
@@ -1822,21 +1822,21 @@
typedef typename BasicWriter<Char>::CharPtr CharPtr;
Char fill = internal::CharTraits<Char>::cast(spec_.fill());
CharPtr out = CharPtr();
- const unsigned CHAR_WIDTH = 1;
- if (spec_.width_ > CHAR_WIDTH) {
+ const unsigned CHAR_SIZE = 1;
+ if (spec_.width_ > CHAR_SIZE) {
out = writer_.grow_buffer(spec_.width_);
if (spec_.align_ == ALIGN_RIGHT) {
- std::uninitialized_fill_n(out, spec_.width_ - CHAR_WIDTH, fill);
- out += spec_.width_ - CHAR_WIDTH;
+ std::uninitialized_fill_n(out, spec_.width_ - CHAR_SIZE, fill);
+ out += spec_.width_ - CHAR_SIZE;
} else if (spec_.align_ == ALIGN_CENTER) {
out = writer_.fill_padding(out, spec_.width_,
- internal::check(CHAR_WIDTH), fill);
+ internal::check(CHAR_SIZE), fill);
} else {
- std::uninitialized_fill_n(out + CHAR_WIDTH,
- spec_.width_ - CHAR_WIDTH, fill);
+ std::uninitialized_fill_n(out + CHAR_SIZE,
+ spec_.width_ - CHAR_SIZE, fill);
}
} else {
- out = writer_.grow_buffer(CHAR_WIDTH);
+ out = writer_.grow_buffer(CHAR_SIZE);
}
*out = internal::CharTraits<Char>::cast(value);
}

View File

@ -1,25 +0,0 @@
From d00b43c592eecb69d46210ec24968ab30ea330f7 Mon Sep 17 00:00:00 2001
From: Victor Zverovich <victor.zverovich@gmail.com>
Date: Sat, 14 May 2016 17:58:14 -0700
Subject: [PATCH] Workaround an issue with "delete this" in GMock and gcc 6.1.1
---
test/gmock/gmock.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/gmock/gmock.h b/test/gmock/gmock.h
index 17bde1e..84f58cd 100644
--- a/test/gmock/gmock.h
+++ b/test/gmock/gmock.h
@@ -10090,8 +10090,9 @@ class FunctionMockerBase : public UntypedFunctionMockerBase {
// threads concurrently.
Result InvokeWith(const ArgumentTuple& args)
GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
- return static_cast<const ResultHolder*>(
- this->UntypedInvokeWith(&args))->GetValueAndDelete();
+ const ResultHolder *rh = static_cast<const ResultHolder*>(
+ this->UntypedInvokeWith(&args));
+ return rh ? rh->GetValueAndDelete() : Result();
}
// Adds and returns a default action spec for this mock function.

View File

@ -1,99 +0,0 @@
From e2a332e5df1783580c42f62eb7f4bef04d8000b2 Mon Sep 17 00:00:00 2001
From: Victor Zverovich <victor.zverovich@gmail.com>
Date: Thu, 19 May 2016 15:04:25 -0700
Subject: [PATCH] Use a mock to test locale support
---
test/format-test.cc | 29 ++++++++++++++++++++++-------
test/gtest-extra.h | 8 +++++++-
test/posix-mock-test.cc | 6 ------
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/test/format-test.cc b/test/format-test.cc
index 31f9d57..4a0e85c 100644
--- a/test/format-test.cc
+++ b/test/format-test.cc
@@ -43,6 +43,22 @@
// Test that the library compiles if None is defined to 0 as done by xlib.h.
#define None 0
+struct LocaleMock {
+ static LocaleMock *instance;
+
+ MOCK_METHOD0(localeconv, lconv *());
+} *LocaleMock::instance;
+
+namespace fmt {
+namespace std {
+using namespace ::std;
+lconv *localeconv() {
+ return LocaleMock::instance ?
+ LocaleMock::instance->localeconv() : ::std::localeconv();
+}
+}
+}
+
#include "fmt/format.h"
#include "fmt/time.h"
@@ -1209,13 +1225,12 @@ TEST(FormatterTest, FormatOct) {
}
TEST(FormatterTest, FormatIntLocale) {
-#ifndef _WIN32
- const char *locale = "en_US.utf-8";
-#else
- const char *locale = "English_United States";
-#endif
- std::setlocale(LC_ALL, locale);
- EXPECT_EQ("1,234,567", format("{:n}", 1234567));
+ ScopedMock<LocaleMock> mock;
+ lconv lc = {};
+ char sep[] = "--";
+ lc.thousands_sep = sep;
+ EXPECT_CALL(mock, localeconv()).WillOnce(testing::Return(&lc));
+ EXPECT_EQ("1--234--567", format("{:n}", 1234567));
}
TEST(FormatterTest, FormatFloat) {
diff --git a/test/gtest-extra.h b/test/gtest-extra.h
index 649fbe2..5f7fe29 100644
--- a/test/gtest-extra.h
+++ b/test/gtest-extra.h
@@ -29,7 +29,7 @@
#define FMT_GTEST_EXTRA_H_
#include <string>
-#include <gtest/gtest.h>
+#include <gmock/gmock.h>
#include "fmt/format.h"
@@ -172,4 +172,10 @@ std::string read(fmt::File &f, std::size_t count);
#endif // FMT_USE_FILE_DESCRIPTORS
+template <typename Mock>
+struct ScopedMock : testing::StrictMock<Mock> {
+ ScopedMock() { Mock::instance = this; }
+ ~ScopedMock() { Mock::instance = 0; }
+};
+
#endif // FMT_GTEST_EXTRA_H_
diff --git a/test/posix-mock-test.cc b/test/posix-mock-test.cc
index 2a89a82..3eaca21 100644
--- a/test/posix-mock-test.cc
+++ b/test/posix-mock-test.cc
@@ -453,12 +453,6 @@ TEST(BufferedFileTest, FilenoNoRetry) {
fileno_count = 0;
}
-template <typename Mock>
-struct ScopedMock : testing::StrictMock<Mock> {
- ScopedMock() { Mock::instance = this; }
- ~ScopedMock() { Mock::instance = 0; }
-};
-
struct TestMock {
static TestMock *instance;
} *TestMock::instance;

View File

@ -1 +1 @@
c099561e70fa194bb03b3fd5de2d3fd0 fmt-3.0.0.zip
14505463b838befe1513b09cae112715 fmt-3.0.1.zip