From fd46149d241f6fde59de0de6bc8383f50d278c77 Mon Sep 17 00:00:00 2001 From: Phil Miller Date: Wed, 7 Oct 2020 14:49:21 -0400 Subject: [PATCH] #132 Virtual Serialize: Rename revised macro to not break code --- src/checkpoint/dispatch/dispatch_virtual.h | 2 +- src/checkpoint/dispatch/vrt/base.h | 6 ++++-- src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h | 2 +- tests/unit/test_footprinter.cc | 2 +- tests/unit/test_virtual_serialize.cc | 8 ++++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/checkpoint/dispatch/dispatch_virtual.h b/src/checkpoint/dispatch/dispatch_virtual.h index bcd88e63..660803bd 100644 --- a/src/checkpoint/dispatch/dispatch_virtual.h +++ b/src/checkpoint/dispatch/dispatch_virtual.h @@ -68,7 +68,7 @@ * * - Insert checkpoint macros in your virtual class hierarchy for derived and * base classes with the corresponding macros: - * - \c checkpoint_virtual_serialize_base() + * - \c checkpoint_virtual_serialize_root() * - \c checkpoint_virtual_serialize_derived_from(ParentT) * * Invoking the virtual serializer: diff --git a/src/checkpoint/dispatch/vrt/base.h b/src/checkpoint/dispatch/vrt/base.h index 9f4971df..5d4f3225 100644 --- a/src/checkpoint/dispatch/vrt/base.h +++ b/src/checkpoint/dispatch/vrt/base.h @@ -51,7 +51,7 @@ #include "checkpoint/dispatch/vrt/inheritance_assert_helpers.h" #include "checkpoint/dispatch/vrt/serialize_instantiator.h" -#define checkpoint_virtual_serialize_base() \ +#define checkpoint_virtual_serialize_root() \ auto _CheckpointVSBaseTypeFn() -> decltype(auto) { return this; } \ virtual void _checkpointDynamicSerialize( \ void* s, \ @@ -73,6 +73,8 @@ return ::checkpoint::dispatch::vrt::objregistry::makeObjIdx<_CheckpointVirtualSerializerBaseType>(); \ } \ +#define checkpoint_virtual_serialize_base(BASE) checkpoint_virtual_serialize_root() + namespace checkpoint { namespace dispatch { namespace vrt { /** @@ -83,7 +85,7 @@ namespace checkpoint { namespace dispatch { namespace vrt { */ template struct SerializableBase { - checkpoint_virtual_serialize_base() + checkpoint_virtual_serialize_root() }; }}} /* end namespace checkpoint::dispatch::vrt */ diff --git a/src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h b/src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h index 9f5ab2ff..35599326 100644 --- a/src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h +++ b/src/checkpoint/dispatch/vrt/inheritance_assert_helpers.h @@ -61,7 +61,7 @@ inline void assertTypeIdxMatch(TypeIdx const expected_idx) { "\" does not matched expected value. " "You are probably missing a SerializableBase or SerializableDerived " "in the virtual class hierarchy; or, if you are using macros: " - "checkpoint_virtual_serialize_base() or checkpoint_virtual_serialize_derived(..)"; + "checkpoint_virtual_serialize_root() or checkpoint_virtual_serialize_derived_from(..)"; checkpointAssert( obj_idx == expected_idx or expected_idx == no_type_idx, debug_str.c_str() ); diff --git a/tests/unit/test_footprinter.cc b/tests/unit/test_footprinter.cc index c0a382f5..5ca1209c 100644 --- a/tests/unit/test_footprinter.cc +++ b/tests/unit/test_footprinter.cc @@ -478,7 +478,7 @@ TEST_F(TestFootprinter, test_vector) { struct TestBase { - checkpoint_virtual_serialize_base() + checkpoint_virtual_serialize_root() virtual ~TestBase() = default; diff --git a/tests/unit/test_virtual_serialize.cc b/tests/unit/test_virtual_serialize.cc index 4785562c..0ff5d64f 100644 --- a/tests/unit/test_virtual_serialize.cc +++ b/tests/unit/test_virtual_serialize.cc @@ -216,7 +216,7 @@ struct TestBase { explicit TestBase(TEST_CONSTRUCT) { init(); } explicit TestBase(SERIALIZE_CONSTRUCT_TAG) {} - checkpoint_virtual_serialize_base() + checkpoint_virtual_serialize_root() virtual ~TestBase() = default; @@ -425,7 +425,7 @@ struct TestBase { explicit TestBase(TEST_CONSTRUCT) { init(); } explicit TestBase(SERIALIZE_CONSTRUCT_TAG) {} - checkpoint_virtual_serialize_base() + checkpoint_virtual_serialize_root() virtual ~TestBase() = default; @@ -455,7 +455,7 @@ struct TestDerived1 : TestBase { explicit TestDerived1(TEST_CONSTRUCT tag) : Parent(tag) { init(); } explicit TestDerived1(SERIALIZE_CONSTRUCT_TAG tag) : Parent(tag) {} - checkpoint_virtual_serialize_derived(TestDerived1, TestBase) + checkpoint_virtual_serialize_derived_from(Parent) template void serialize(SerializerT& s) { @@ -500,7 +500,7 @@ struct TestDerived2 : TestBase { explicit TestDerived2(TEST_CONSTRUCT tag) : Parent(tag) { init(); } explicit TestDerived2(SERIALIZE_CONSTRUCT_TAG tag) : Parent(tag) {} - checkpoint_virtual_serialize_derived(TestDerived2, TestBase) + checkpoint_virtual_serialize_derived_from(Parent) template void serialize(SerializerT& s) {