Fix more warnings

These were found attempting to enable -Werror
pull/6022/head
Keith Smiley 6 years ago committed by Adam Cozzette
parent c1f650a387
commit c40ab0fffa
  1. 3
      src/google/protobuf/arena_unittest.cc
  2. 1
      src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc
  3. 2
      src/google/protobuf/compiler/parser_unittest.cc
  4. 24
      src/google/protobuf/map_field_test.cc
  5. 3
      src/google/protobuf/testing/googletest.cc
  6. 2
      src/google/protobuf/util/json_util_test.cc

@ -1345,7 +1345,10 @@ TEST(ArenaTest, GetArenaShouldReturnNullForNonArenaCompatibleTypes) {
// Test that GetArena returns nullptr for types that have a GetArena alias.
struct {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
using GetArena = Arena*;
#pragma GCC diagnostic pop
} has_get_arena_alias;
EXPECT_EQ(nullptr, Arena::GetArena(&has_get_arena_alias));

@ -131,7 +131,6 @@ class MockGeneratorContext : public GeneratorContext {
const char kDescriptorParameter[] = "dllexport_decl=PROTOBUF_EXPORT";
const char kPluginParameter[] = "dllexport_decl=PROTOC_EXPORT";
const char kNormalParameter[] = "";
const char* test_protos[][2] = {
{"google/protobuf/descriptor", kDescriptorParameter},

@ -68,7 +68,7 @@ class MockErrorCollector : public io::ErrorCollector {
std::string text_;
// implements ErrorCollector ---------------------------------------
void AddError(int line, int column, const std::string& message) {
void AddError(int line, int column, const std::string& message) override {
strings::SubstituteAndAppend(&text_, "$0:$1: $2\n", line, column, message);
}
};

@ -78,25 +78,25 @@ class MapFieldBaseStub : public MapFieldBase {
void SetRepeatedDirty() {
state_.store(STATE_MODIFIED_REPEATED, std::memory_order_relaxed);
}
bool ContainsMapKey(const MapKey& map_key) const { return false; }
bool InsertOrLookupMapValue(const MapKey& map_key, MapValueRef* val) {
bool ContainsMapKey(const MapKey& map_key) const override { return false; }
bool InsertOrLookupMapValue(const MapKey& map_key, MapValueRef* val) override {
return false;
}
bool DeleteMapValue(const MapKey& map_key) { return false; }
bool EqualIterator(const MapIterator& a, const MapIterator& b) const {
bool DeleteMapValue(const MapKey& map_key) override { return false; }
bool EqualIterator(const MapIterator& a, const MapIterator& b) const override {
return false;
}
int size() const { return 0; }
int size() const override { return 0; }
void Clear() override {}
void MapBegin(MapIterator* map_iter) const {}
void MapEnd(MapIterator* map_iter) const {}
void MapBegin(MapIterator* map_iter) const override {}
void MapEnd(MapIterator* map_iter) const override {}
void MergeFrom(const MapFieldBase& other) override {}
void Swap(MapFieldBase* other) {}
void InitializeIterator(MapIterator* map_iter) const {}
void DeleteIterator(MapIterator* map_iter) const {}
void Swap(MapFieldBase* other) override {}
void InitializeIterator(MapIterator* map_iter) const override {}
void DeleteIterator(MapIterator* map_iter) const override {}
void CopyIterator(MapIterator* this_iterator,
const MapIterator& other_iterator) const {}
void IncreaseIterator(MapIterator* map_iter) const {}
const MapIterator& other_iterator) const override {}
void IncreaseIterator(MapIterator* map_iter) const override {}
void SetDefaultMessageEntry(const Message* message) const {}
const Message* GetDefaultMessageEntry() const { return NULL; }
};

@ -119,7 +119,10 @@ string GetTemporaryDirectoryName() {
// testing. We cannot use tmpfile() or mkstemp() since we're creating a
// directory.
char b[L_tmpnam + 1]; // HPUX multithread return 0 if s is 0
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
string result = tmpnam(b);
#pragma GCC diagnostic pop
#ifdef _WIN32
// Avoid a trailing dot by changing it to an underscore. On Win32 the names of
// files and directories can, but should not, end with dot.

@ -58,8 +58,6 @@ using proto3::TestMessage;
using proto3::TestOneof;
using proto_util_converter::testing::MapIn;
static const char kTypeUrlPrefix[] = "type.googleapis.com";
// As functions defined in json_util.h are just thin wrappers around the
// JSON conversion code in //net/proto2/util/converter, in this test we
// only cover some very basic cases to make sure the wrappers have forwarded

Loading…
Cancel
Save