Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::get where it's available #815

Merged
merged 1 commit into from
Oct 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/google/protobuf/compiler/cpp/cpp_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@

namespace google {
namespace protobuf {
using internal::NewPermanentCallback;
namespace compiler {
namespace cpp {

Expand Down
6 changes: 6 additions & 0 deletions src/google/protobuf/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ class LIBPROTOBUF_EXPORT MapKey {
GOOGLE_LOG(FATAL) << "Can't get here.";
return false;
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return false;
}

void CopyFrom(const MapKey& other) {
Expand Down Expand Up @@ -852,6 +854,8 @@ struct hash<google::protobuf::MapKey> {
GOOGLE_LOG(FATAL) << "Can't get here.";
return 0;
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return 0;
}
bool
operator()(const google::protobuf::MapKey& map_key1,
Expand All @@ -875,6 +879,8 @@ struct hash<google::protobuf::MapKey> {
GOOGLE_LOG(FATAL) << "Can't get here.";
return true;
}
GOOGLE_LOG(FATAL) << "Can't get here.";
return true;
}
};
GOOGLE_PROTOBUF_HASH_NAMESPACE_DECLARATION_END
Expand Down
59 changes: 0 additions & 59 deletions src/google/protobuf/proto_cast.h

This file was deleted.

60 changes: 0 additions & 60 deletions src/google/protobuf/proto_cast_test.cc

This file was deleted.

4 changes: 2 additions & 2 deletions src/google/protobuf/stubs/callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@ class MethodResultCallback_5_2 : public ResultCallback2<R, A1, A2> {
typename remove_reference<P5>::type p5_;
};

} // namespace internal

// See Closure.
inline Closure* NewCallback(void (*function)()) {
return new internal::FunctionClosure0(function, true);
Expand Down Expand Up @@ -452,6 +450,8 @@ inline ResultCallback2<R, A1, A2>* NewPermanentCallback(
p2, p3, p4, p5);
}

} // namespace internal

// A function which does nothing. Useful for creating no-op callbacks, e.g.:
// Closure* nothing = NewCallback(&DoNothing);
void LIBPROTOBUF_EXPORT DoNothing();
Expand Down
2 changes: 1 addition & 1 deletion src/google/protobuf/stubs/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace internal {
LIBPROTOBUF_EXPORT bool IsStructurallyValidUTF8(const char* buf, int len);

inline bool IsStructurallyValidUTF8(const std::string& str) {
return IsStructurallyValidUTF8(str.data(), str.length());
return IsStructurallyValidUTF8(str.data(), static_cast<int>(str.length()));
}

// Returns initial number of bytes of structually valid UTF-8.
Expand Down
2 changes: 2 additions & 0 deletions src/google/protobuf/stubs/common_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

namespace google {
namespace protobuf {
using internal::NewCallback;
using internal::NewPermanentCallback;
namespace {

// TODO(kenton): More tests.
Expand Down
9 changes: 7 additions & 2 deletions src/google/protobuf/stubs/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,14 @@
#define GOOGLE_PROTOBUF_HAVE_HASH_MAP 1
#define GOOGLE_PROTOBUF_HAVE_HASH_SET 1

// Android
#if defined(__ANDROID__)
# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
# undef GOOGLE_PROTOBUF_HAVE_HASH_MAP

// Use C++11 unordered_{map|set} if available.
#if ((_LIBCPP_STD_VER >= 11) || \
(((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \
#elif ((_LIBCPP_STD_VER >= 11) || \
(((__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X)) && \
(__GLIBCXX__ > 20090421)))
# define GOOGLE_PROTOBUF_HAS_CXX11_HASH

Expand Down
3 changes: 2 additions & 1 deletion src/google/protobuf/stubs/int128.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ std::ostream& operator<<(std::ostream& o, const uint128& b) {
if ((flags & std::ios::adjustfield) == std::ios::left) {
rep.append(width - rep.size(), o.fill());
} else {
rep.insert(0, width - rep.size(), o.fill());
rep.insert(static_cast<std::string::size_type>(0),
width - rep.size(), o.fill());
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/google/protobuf/stubs/once_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

namespace google {
namespace protobuf {
using internal::NewCallback;
namespace {

class OnceInitTest : public testing::Test {
Expand Down Expand Up @@ -127,10 +128,11 @@ class OnceInitTest : public testing::Test {
};

TestThread* RunInitOnceInNewThread() {
return new TestThread(NewCallback(this, &OnceInitTest::InitOnce));
return new TestThread(internal::NewCallback(this, &OnceInitTest::InitOnce));
}
TestThread* RunInitRecursiveOnceInNewThread() {
return new TestThread(NewCallback(this, &OnceInitTest::InitRecursiveOnce));
return new TestThread(
internal::NewCallback(this, &OnceInitTest::InitRecursiveOnce));
}

enum State {
Expand Down
154 changes: 0 additions & 154 deletions src/google/protobuf/unknown_enum_impl.h

This file was deleted.

Loading