Skip to content

Commit

Permalink
#333: warnings: fix all the warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Apr 8, 2024
1 parent 97fc09a commit 7a2b431
Show file tree
Hide file tree
Showing 24 changed files with 47 additions and 45 deletions.
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ struct MyObj : ::checkpoint::SerializableDerived<MyObj, MyBase> {
explicit MyObj(::checkpoint::SERIALIZE_CONSTRUCT_TAG){}

template <typename SerializerT>
void serialize(SerializerT& s) {
void serialize(SerializerT&) {
printf("MyObj: serialize\n");
}

Expand All @@ -85,7 +85,7 @@ struct MyObj2 : ::checkpoint::SerializableDerived<MyObj2, MyBase> {
explicit MyObj2(::checkpoint::SERIALIZE_CONSTRUCT_TAG) {}

template <typename SerializerT>
void serialize(SerializerT& s) {
void serialize(SerializerT&) {
printf("MyObj2: serialize\n");
}
void test() override {
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic_macro.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct MyObj : public MyBase {
checkpoint_virtual_serialize_derived_from(MyBase)

template <typename SerializerT>
void serialize(SerializerT& s) {
void serialize(SerializerT&) {
printf("MyObj: serialize\n");
}

Expand All @@ -97,7 +97,7 @@ struct MyObj2 : public MyBase {
checkpoint_virtual_serialize_derived_from(MyBase)

template <typename SerializerT>
void serialize(SerializerT& s) {
void serialize(SerializerT&) {
printf("MyObj2: serialize\n");
}
void test() override {
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic_macro_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ void serialize(S& s, MyBase& obj) {
}

template <typename SerializerT>
void serialize(SerializerT& s, MyObj& obj) {
void serialize(SerializerT&, MyObj&) {
printf("MyObj: serialize\n");
}

template <typename SerializerT>
void serialize(SerializerT& s, MyObj2& obj) {
void serialize(SerializerT&, MyObj2&) {
printf("MyObj2: serialize\n");
}

Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_polymorphic_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ void serialize(S& s, MyBase& obj) {
}

template <typename SerializerT>
void serialize(SerializerT& s, MyObj& obj) {
void serialize(SerializerT&, MyObj&) {
printf("MyObj: serialize\n");
}

template <typename SerializerT>
void serialize(SerializerT& s, MyObj2& obj) {
void serialize(SerializerT&, MyObj2&) {
printf("MyObj2: serialize\n");
}

Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_traversal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct TestObject {
struct PrintBytesTraverse : checkpoint::BaseSerializer {
PrintBytesTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { }

void contiguousBytes(void* ptr, std::size_t size, std::size_t num_elms) {
void contiguousBytes(void*, std::size_t size, std::size_t num_elms) {
printf("PrintBytesTraverse: size=%zu, num_elms=%zu\n", size, num_elms);
}
};
Expand Down Expand Up @@ -114,7 +114,7 @@ struct CustomDispatch {
// skip that overload
template <typename SerializerT, typename U>
struct CustomDispatch<SerializerT, std::vector<U>> {
static void serializeNonIntrusive(SerializerT& s, std::vector<U>& t) {
static void serializeNonIntrusive(SerializerT&, std::vector<U>& t) {
// Do something special here: e.g., an RDMA for the vector during packing
printf("Traversing vector: size=%zu\n", t.size());
for (std::size_t i = 0; i < t.size(); i++) {
Expand Down
4 changes: 2 additions & 2 deletions examples/checkpoint_example_traversal_nonintrusive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void serialize(Serializer& s, TestObject& obj) {
struct PrintBytesTraverse : checkpoint::BaseSerializer {
PrintBytesTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { }

void contiguousBytes(void* ptr, std::size_t size, std::size_t num_elms) {
void contiguousBytes(void*, std::size_t size, std::size_t num_elms) {
printf("PrintBytesTraverse: size=%zu, num_elms=%zu\n", size, num_elms);
}
};
Expand Down Expand Up @@ -126,7 +126,7 @@ struct CustomDispatch {
// skip that overload
template <typename SerializerT, typename U>
struct CustomDispatch<SerializerT, std::vector<U>> {
static void serializeNonIntrusive(SerializerT& s, std::vector<U>& t) {
static void serializeNonIntrusive(SerializerT&, std::vector<U>& t) {
// Do something special here: e.g., an RDMA for the vector during packing
printf("Traversing vector: size=%zu\n", t.size());
for (std::size_t i = 0; i < t.size(); i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/checkpoint/buffer/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ namespace checkpoint { namespace buffer {
using SerializedInfo = ::checkpoint::SerializedInfo;

struct Buffer : SerializedInfo {
virtual SerialByteType* getBuffer() const = 0;
virtual SerialSizeType getSize() const = 0;
virtual SerialByteType* getBuffer() const override = 0;
virtual SerialSizeType getSize() const override = 0;
virtual ~Buffer() { }
};

Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/container/list_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ inline typename std::enable_if_t<
std::is_same<Serializer, checkpoint::Footprinter>::value, void
>
deserializeOrderedElems(
Serializer& s, ContainerT& cont, typename ContainerT::size_type size
Serializer&, ContainerT&, typename ContainerT::size_type
) { }

template <typename Serializer, typename ContainerT>
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/container/map_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ inline typename std::enable_if_t<
std::is_same<Serializer, checkpoint::Footprinter>::value,
void
> deserializeEmplaceElems(
Serializer& s, ContainerT& cont, typename ContainerT::size_type size
Serializer&, ContainerT&, typename ContainerT::size_type
) { }

template <typename Serializer, typename ContainerT>
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/container/variant_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ template <>
struct SerializeEntry<> {
template <typename SerializerT, typename VariantT>
static void serialize(
SerializerT& s, VariantT& v, std::size_t entry, std::size_t cur
SerializerT&, VariantT&, std::size_t, std::size_t
) {
// base case
}
Expand Down
6 changes: 3 additions & 3 deletions src/checkpoint/container/view_equality.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,21 @@ struct ViewEqualityStatic {
}

template <typename AnyT, typename... Args>
bool operator()(Kokkos::View<AnyT,Args...> const& v, Callable eq) {
bool operator()(Kokkos::View<AnyT,Args...> const&, Callable) {
// No static dimension to check against dynamic dimension, return true
return true;
}

template <typename AnyT, typename... Args>
bool operator()(
Kokkos::Experimental::DynamicView<AnyT,Args...> const& v, Callable eq
Kokkos::Experimental::DynamicView<AnyT,Args...> const&, Callable
) {
// No static dimension to check against dynamic dimension, return true
return true;
}

template <typename AnyT, typename... Args>
bool operator()(Kokkos::DynRankView<AnyT,Args...> const& v, Callable eq) {
bool operator()(Kokkos::DynRankView<AnyT,Args...> const&, Callable) {
// No static dimension to check against dynamic dimension, return true
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/container/view_traits_extract.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ template <
struct CountDims {
using BaseT = typename std::decay<T>::type;
static constexpr size_t dynamic = 0;
static int numDims(ViewType const& view) { return 0; }
static int numDims(ViewType const&) { return 0; }
};

template <typename ViewType, typename T>
Expand Down
4 changes: 2 additions & 2 deletions src/checkpoint/dispatch/clean_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ struct CleanType {
}

template <typename U = T>
static NonConstRefT* apply1(T* val, isConst<U>* x = nullptr) {
static NonConstRefT* apply1(T* val, isConst<U>* = nullptr) {
return reinterpret_cast<NonConstRefT*>(const_cast<NonConstT*>(val));
}

template <typename U = T>
static NonConstRefT* apply1(T* val, isNotConst<U>* x = nullptr) {
static NonConstRefT* apply1(T* val, isNotConst<U>* = nullptr) {
return reinterpret_cast<NonConstRefT*>(val);
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/checkpoint/dispatch/dispatch_serializer_byte.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ struct SerializerDispatchByte {

template <typename U = T>
void operator()(
SerializerT& s, T* val, SerialSizeType num, isByteCopyType<U>* x = nullptr
SerializerT& s, T* val, SerialSizeType num, isByteCopyType<U>* = nullptr
) {
s.contiguousTyped(s, val, num);
}

template <typename U = T>
void operator()(
SerializerT& s, T* val, SerialSizeType num, isNotByteCopyType<U>* x = nullptr
SerializerT& s, T* val, SerialSizeType num, isNotByteCopyType<U>* = nullptr
) {
SerializerDispatchNonByte<SerializerT, T, Dispatcher> dispatch;
dispatch(s, val, num);
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/dispatch/dispatch_serializer_nonbyte.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ struct SerializerDispatchNonByte {

template <typename U = T>
void applyElm(
SerializerT& s, T* val, hasNotSplitSerialize<U>* = nullptr
SerializerT&, T*, hasNotSplitSerialize<U>* = nullptr
) { }

template <typename U = T>
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/dispatch/reconstructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct Reconstructor {
}

template <typename U = T>
static T* constructAllowFailImpl(void* buf, isNotConstructible<U>* = nullptr) {
static T* constructAllowFailImpl(void*, isNotConstructible<U>* = nullptr) {
constexpr int max_buffer_length = 32768;
std::unique_ptr<char[]> msg = std::make_unique<char[]>(max_buffer_length);
snprintf(
Expand Down
2 changes: 2 additions & 0 deletions src/checkpoint/dispatch/vrt/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ namespace checkpoint { namespace dispatch { namespace vrt {
template <typename BaseT>
struct SerializableBase {
checkpoint_virtual_serialize_root()

virtual ~SerializableBase() {}
};

}}} /* end namespace checkpoint::dispatch::vrt */
Expand Down
8 changes: 4 additions & 4 deletions src/checkpoint/dispatch/vrt/virtual_serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct SerializeVirtualTypeIfNeeded<
>
>
{
static dispatch::vrt::TypeIdx apply(SerializerT& s, T* target) {
static dispatch::vrt::TypeIdx apply(SerializerT&, T*) {
// no type idx needed in this case
return dispatch::vrt::no_type_idx;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ struct ReconstructAsVirtualIfNeeded<
not std::is_same<SerializerT, checkpoint::Footprinter>::value
>
> {
static T* apply(SerializerT& s, dispatch::vrt::TypeIdx entry) {
static T* apply(SerializerT&, dispatch::vrt::TypeIdx) {
// no type idx needed in this case, static construction in default case
auto t = std::allocator<T>{}.allocate(1);
return dispatch::Reconstructor<T>::construct(t);
Expand All @@ -165,7 +165,7 @@ struct ReconstructAsVirtualIfNeeded<
std::is_same<SerializerT, checkpoint::Footprinter>::value
>
> {
static T* apply(SerializerT& s, dispatch::vrt::TypeIdx entry) { return nullptr; }
static T* apply(SerializerT&, dispatch::vrt::TypeIdx) { return nullptr; }
};

template <typename T, typename SerializerT>
Expand All @@ -176,7 +176,7 @@ struct ReconstructAsVirtualIfNeeded<
dispatch::vrt::VirtualSerializeTraits<T>::has_virtual_serialize
>
> {
static T* apply(SerializerT& s, dispatch::vrt::TypeIdx entry) {
static T* apply(SerializerT&, dispatch::vrt::TypeIdx entry) {
using BaseT = ::checkpoint::dispatch::vrt::checkpoint_base_type_t<T>;

// use type idx here, registration needed for proper type re-construction
Expand Down
10 changes: 5 additions & 5 deletions src/checkpoint/serializers/base_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ struct BaseSerializer {
* \param[in] t an element
*/
template<typename T>
void countBytes(const T& t) {}
void countBytes(T const&) {}

/**
* \brief Add bytes for footprinting---default empty implementation
*
* \param[in] s the amount of bytes to add
*/
void addBytes(std::size_t s) {}
void addBytes(std::size_t) {}

/**
* \brief Add contiguous bytes to the sizer
Expand All @@ -142,7 +142,7 @@ struct BaseSerializer {
* \param[in] size the number of bytes for each element
* \param[in] num_elms the number of elements
*/
void contiguousBytes(void* ptr, SerialSizeType size, SerialSizeType num_elms) {}
void contiguousBytes(void*, SerialSizeType, SerialSizeType) {}

/**
* \brief Returns size of buffer (in bytes) used during given serialization
Expand Down Expand Up @@ -170,7 +170,7 @@ struct BaseSerializer {
* \note Used/implemented in serialization sanitizer.
*/
template <typename... Args>
void skip(Args&&... args) { }
void skip(Args&&...) { }

/**
* \brief Get a buffer if it is associated with the serializer
Expand All @@ -187,7 +187,7 @@ struct BaseSerializer {
*
* \return the current spot
*/
SerialByteType* getSpotIncrement(SerialSizeType const inc) { return nullptr; }
SerialByteType* getSpotIncrement(SerialSizeType const) { return nullptr; }

/**
* \brief Check if virtual serialization is disabled
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoint/serializers/stream_serializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace checkpoint {

template<typename StreamT = std::ostream>
struct StreamPacker : BaseSerializer {
StreamPacker(SerialSizeType size, StreamT& m_stream)
StreamPacker(SerialSizeType, StreamT& m_stream)
: BaseSerializer(ModeType::Packing), stream(m_stream) {
//Nothing to do with the size.
//Pre-allocating a buffer for the stream has more problems than solutions.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_footprinter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct TestBase {
};

struct TestDerived2 : TestBase {
explicit TestDerived2(int i) {}
explicit TestDerived2(int) {}
explicit TestDerived2(SERIALIZE_CONSTRUCT_TAG) {}

checkpoint_virtual_serialize_derived_from(TestBase)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ namespace checkpoint { namespace tests { namespace unit {

template <typename TestBase>
struct TestHarnessAny : TestBase {
virtual void SetUp() {
virtual void SetUp() override {
argc_ = orig_args_.size();
argv_ = new char*[argc_];

Expand All @@ -65,7 +65,7 @@ struct TestHarnessAny : TestBase {
}
}

virtual void TearDown() {
virtual void TearDown() override {
for (int i = 0; i < argc_; i++) {
delete [] argv_[i];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/test_traversal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ struct TestObject {
struct TestTraverse : checkpoint::BaseSerializer {
TestTraverse() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { }

void contiguousBytes(void* ptr, std::size_t size, std::size_t num_elms) {
void contiguousBytes(void*, std::size_t size, std::size_t num_elms) {
printf("size=%zu, num=%zu\n", size, num_elms);
bytes_ += size * num_elms;
}
Expand All @@ -127,7 +127,7 @@ struct CustomDispatch {

template <typename SerializerT, typename U>
struct CustomDispatch<SerializerT, std::vector<U>> {
static void serializeNonIntrusive(SerializerT& s, std::vector<U>& t) {
static void serializeNonIntrusive(SerializerT&, std::vector<U>& t) {
// Do something special here: e.g., an RDMA for the vector during packing
printf("Traversing vector: size=%zu\n", t.size());
for (std::size_t i = 0; i < t.size(); i++) {
Expand All @@ -143,7 +143,7 @@ struct TestTraverse2 : checkpoint::BaseSerializer {
template <typename U, typename V>
using DispatcherType = CustomDispatch<U, V>;

void contiguousBytes(void* ptr, std::size_t size, std::size_t num_elms) { }
void contiguousBytes(void*, std::size_t, std::size_t) { }

TestTraverse2() : checkpoint::BaseSerializer(checkpoint::eSerializationMode::None) { }
};
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_virtual_serialize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ struct HolderBase {
virtual ~HolderBase() = default;

template <typename Serializer>
void serialize(Serializer& s) {}
void serialize(Serializer&) {}
};

template <typename ObjT>
Expand All @@ -635,7 +635,7 @@ struct HolderObjBase : HolderBase {
virtual ObjT* get() = 0;

template <typename Serializer>
void serialize(Serializer& s) {}
void serialize(Serializer&) {}
};

template <typename ObjT>
Expand Down

0 comments on commit 7a2b431

Please sign in to comment.