Skip to content
Permalink
Browse files
GEODE-5738: Fixes google-global-names-in-headers warning
- Wrap using inside anonymous namespaces
- Ignore unused-member-function warnings in old integration tests.
- Removes unused methods.
- Update ThinClientListenerWriter.hpp
  • Loading branch information
pivotal-jbarrett authored and pdxcodemonkey committed Sep 19, 2018
1 parent 9a8751f commit 9f9101926d8566f03d90976109e9e4225f235cf8
Showing 81 changed files with 724 additions and 541 deletions.
@@ -1,6 +1,6 @@
---
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,-google-readability-todo,-google-runtime-references'
WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor'
WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor,google-global-names-in-headers'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: file
@@ -35,6 +35,9 @@
#include <geode/CacheableUndefined.hpp>
#include <geode/CacheableObjectArray.hpp>

namespace CacheableHelper {

using apache::geode::client::Cacheable;
using apache::geode::client::CacheableArrayList;
using apache::geode::client::CacheableBoolean;
using apache::geode::client::CacheableByte;
@@ -68,8 +71,10 @@ using apache::geode::client::CacheableVector;
using apache::geode::client::CacheHelper;
using apache::geode::client::Serializable;
using apache::geode::client::internal::DataSerializablePrimitive;
using apache::geode::client::internal::DSCode;

namespace CacheableHelper {
using apache::geode::client::testing::CacheableWrapper;
using apache::geode::client::testing::CacheableWrapperFactory;

const uint32_t m_crc32Table[] = {
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
@@ -220,7 +225,6 @@ inline bool isContainerTypeId(DSCode typeId) {
(typeId == DSCode::CacheableLinkedHashSet) ||
(typeId == DSCode::CacheableLinkedList);
}
} // namespace CacheableHelper

// Cacheable types that can be used as keys

@@ -1219,8 +1223,6 @@ class CacheableObjectArrayWrapper : public CacheableWrapper {
}
};

namespace CacheableHelper {

void registerBuiltins(bool isRegisterFileName = false) {
// Initialize the random number generator.
srand(getpid() + static_cast<int>(time(nullptr)));
@@ -1328,6 +1330,7 @@ void registerBuiltins(bool isRegisterFileName = false) {
"CacheableStack",
CacheableStackWrapper::create, false);
}

} // namespace CacheableHelper

#endif // GEODE_INTEGRATION_TEST_BUILTINCACHEABLEWRAPPERS_H_
@@ -97,6 +97,16 @@ foreach(FILE ${SOURCES})
$<TARGET_PROPERTY:apache-geode,SOURCE_DIR>/../src
)

if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
target_compile_options(${TEST} PRIVATE
-Wno-unused-function
)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${TEST} PRIVATE
-Wno-unused-member-function
)
endif()

# Some tests depend on these library
add_dependencies(${TEST} securityImpl cryptoImpl DHImpl SqLiteImpl)

@@ -26,14 +26,16 @@
#include "testUtils.hpp"

#ifndef ROOT_NAME
ROOT_NAME++ + DEFINE ROOT_NAME before including CacheHelper.hpp
#define ROOT_NAME "DEFINE ROOT_NAME before including CacheHelper.hpp"
#endif

#ifndef ROOT_SCOPE
#define ROOT_SCOPE LOCAL
#endif

using apache::geode::client::Properties;
namespace {

using apache::geode::client::CacheHelper;
using apache::geode::client::Properties;
using apache::geode::client::RegionAttributesFactory;

@@ -67,5 +69,6 @@ class CacheImplHelper : public CacheHelper {
ASSERT(regionPtr != nullptr, "failed to create region.");
}
};
} // namespace

#endif // GEODE_INTEGRATION_TEST_CACHEIMPLHELPER_H_
@@ -17,6 +17,11 @@

#include "CacheableWrapper.hpp"

namespace apache {
namespace geode {
namespace client {
namespace testing {

void CacheableWrapper::initKey(int32_t, int32_t) {
throw IllegalArgumentException("Cannot call initKey.");
}
@@ -76,3 +81,8 @@ std::string CacheableWrapperFactory::getTypeForId(DSCode typeId) {
return "";
}
}

} // namespace testing
} // namespace client
} // namespace geode
} // namespace apache
@@ -26,6 +26,11 @@

#include <geode/CacheableBuiltins.hpp>

namespace apache {
namespace geode {
namespace client {
namespace testing {

using apache::geode::client::Cacheable;
using apache::geode::client::IllegalArgumentException;
using apache::geode::client::internal::DSCode;
@@ -80,6 +85,9 @@ class CacheableWrapperFactory {
static std::map<DSCode, std::string> m_typeIdNameMap;
};


} // namespace testing
} // namespace client
} // namespace geode
} // namespace apache

#endif // GEODE_INTEGRATION_TEST_CACHEABLEWRAPPER_H_
@@ -30,6 +30,8 @@

#include "CacheHelper.hpp"

namespace {

using apache::geode::client::DataInput;
using apache::geode::client::DataOutput;
using apache::geode::client::DataSerializable;
@@ -164,4 +166,6 @@ class PdxDeltaEx : public PdxSerializable, public Delta {
}
};

} // namespace

#endif // GEODE_INTEGRATION_TEST_DELTAEX_H_
@@ -46,6 +46,10 @@ void millisleep(uint32_t x) {

extern "C" {

using apache::geode::client::testing::TallyListener;
using apache::geode::client::testing::TallyLoader;
using apache::geode::client::testing::TallyWriter;

_T_DLL_EXPORT apache::geode::client::CacheListener* createCacheListener() {
TallyListener* tl = new TallyListener();
tl->beQuiet(true);
@@ -23,6 +23,8 @@
#define SERVER2 s2p2
#endif

namespace {

using apache::geode::client::CacheHelper;

DUNIT_TASK_DEFINITION(SERVER1, CreateLocator1)
@@ -151,4 +153,6 @@ DUNIT_TASK_DEFINITION(SERVER1, CloseLocator1)
}
END_TASK_DEFINITION

} // namespace

#endif // GEODE_INTEGRATION_TEST_LOCATORHELPER_H_
@@ -51,6 +51,8 @@
#define ROOT_SCOPE LOCAL
#endif

namespace {

using apache::geode::client::CacheableKey;
using apache::geode::client::CacheableStringArray;
using apache::geode::client::CacheRegionHelper;
@@ -386,4 +388,6 @@ bool QueryHelper::verifySS(std::shared_ptr<SelectResults>& structSet,
return false;
}

} // namespace

#endif // GEODE_INTEGRATION_TEST_QUERYHELPER_H_
@@ -24,6 +24,11 @@
#include <string>
#include <util/Log.hpp>

namespace apache {
namespace geode {
namespace client {
namespace testing {

using apache::geode::client::Cacheable;
using apache::geode::client::CacheableKey;
using apache::geode::client::CacheableString;
@@ -221,4 +226,9 @@ void TallyListener::afterRegionClear(const EntryEvent& event) {
checkcallbackArg(event);
}

} // namespace testing
} // namespace client
} // namespace geode
} // namespace apache

#endif // GEODE_INTEGRATION_TEST_TALLYLISTENER_H_
@@ -20,6 +20,11 @@
#ifndef GEODE_INTEGRATION_TEST_TALLYLOADER_H_
#define GEODE_INTEGRATION_TEST_TALLYLOADER_H_

namespace apache {
namespace geode {
namespace client {
namespace testing {

using apache::geode::client::Cacheable;
using apache::geode::client::CacheableInt32;
using apache::geode::client::CacheableKey;
@@ -32,11 +37,7 @@ class TallyLoader : virtual public CacheLoader {
int32_t m_loads;

public:
TallyLoader()
: CacheLoader(),
m_loads(0)

{}
TallyLoader() : CacheLoader(), m_loads(0) {}
virtual ~TallyLoader() = default;

std::shared_ptr<Cacheable> load(Region&, const std::shared_ptr<CacheableKey>&,
@@ -70,4 +71,9 @@ class TallyLoader : virtual public CacheLoader {
}
};

} // namespace testing
} // namespace client
} // namespace geode
} // namespace apache

#endif // GEODE_INTEGRATION_TEST_TALLYLOADER_H_
@@ -23,6 +23,11 @@
#include <geode/CacheableKey.hpp>
#include <geode/CacheWriter.hpp>

namespace apache {
namespace geode {
namespace client {
namespace testing {

using apache::geode::client::Cacheable;
using apache::geode::client::CacheableKey;
using apache::geode::client::CacheWriter;
@@ -154,4 +159,9 @@ class TallyWriter : virtual public CacheWriter {
}
};

} // namespace testing
} // namespace client
} // namespace geode
} // namespace apache

#endif // GEODE_INTEGRATION_TEST_TALLYWRITER_H_
@@ -1,8 +1,3 @@
#pragma once

#ifndef GEODE_INTEGRATION_TEST_THINCLIENTCQ_H_
#define GEODE_INTEGRATION_TEST_THINCLIENTCQ_H_

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,12 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* ThinClientCQ.hpp
*
* Created on: Nov 14, 2008
* Author: vrao
*/

#pragma once

#ifndef GEODE_INTEGRATION_TEST_THINCLIENTCQ_H_
#define GEODE_INTEGRATION_TEST_THINCLIENTCQ_H_

#include "fw_dunit.hpp"
#include "ThinClientHelper.hpp"
@@ -1,8 +1,3 @@
#pragma once

#ifndef GEODE_INTEGRATION_TEST_THINCLIENTCALLBACKARG_H_
#define GEODE_INTEGRATION_TEST_THINCLIENTCALLBACKARG_H_

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,6 +15,11 @@
* limitations under the License.
*/

#pragma once

#ifndef GEODE_INTEGRATION_TEST_THINCLIENTCALLBACKARG_H_
#define GEODE_INTEGRATION_TEST_THINCLIENTCALLBACKARG_H_

#include "fw_dunit.hpp"
#include "ThinClientHelper.hpp"
#include "TallyListener.hpp"
@@ -37,6 +37,11 @@
* + callback Argument
*/

namespace {

using apache::geode::client::testing::TallyListener;
using apache::geode::client::testing::TallyWriter;

static bool isLocalServer = false;
static bool isLocator = false;
static int numberOfLocators = 0;
@@ -196,4 +201,6 @@ void runCallbackArg() {
CALL_TASK(CloseLocator1);
}

} // namespace

#endif // GEODE_INTEGRATION_TEST_THINCLIENTCALLBACKARG_H_
@@ -39,6 +39,8 @@
#define CREATE_TWICE_KEY "__create_twice_key"
#define CREATE_TWICE_VALUE "__create_twice_value"

namespace {

using apache::geode::client::CacheableInt32;
using apache::geode::client::CacheableInt64;
using apache::geode::client::CacheableKey;
@@ -598,11 +600,13 @@ DUNIT_TASK_DEFINITION(CLIENT1, VerifyUpdateLocatorListThread)
// too strict.
// Assert(numLocatorListUpdates <= numExpectedLocatorListUpdates+2) is
// ideal.
ASSERT(numLocatorListUpdates >= numExpectedLocatorListUpdates -
1 /*&& numLocatorListUpdates <=
numExpectedLocatorListUpdates+2*/
,
"Got unexpected number of LocatorList updates");
ASSERT(
numLocatorListUpdates >=
numExpectedLocatorListUpdates -
1 /*&& numLocatorListUpdates <=
numExpectedLocatorListUpdates+2*/
,
"Got unexpected number of LocatorList updates");
} else {
ASSERT(
numLocatorListUpdates == 0,
@@ -894,4 +898,6 @@ void runDistOpsDontUpdateLocatorList() {
CALL_TASK(CloseLocator1);
}

} // namespace

#endif // GEODE_INTEGRATION_TEST_THINCLIENTDISTOPS_H_

0 comments on commit 9f91019

Please sign in to comment.