Skip to content

Commit

Permalink
Greedy macro migration
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon committed May 20, 2022
1 parent 7b2dbbe commit 1d9e268
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 50 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ign_find_package(DL

#--------------------------------------
# Find ignition-tools
find_program(IGN_TOOLS_PROGRAM ign)
find_program(GZ_TOOLS_PROGRAM ign)


#--------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions core/include/gz/plugin/detail/PluginPtr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ namespace gz
}

//////////////////////////////////////////////////
#define DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR(op)\
#define DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR(op)\
template <typename PluginType>\
bool TemplatePluginPtr<PluginType>::operator op (\
const TemplatePluginPtr &_other) const\
Expand All @@ -131,12 +131,12 @@ namespace gz
_other.dataPtr->PrivateGetInstancePtr() );\
}

DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( == ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( < ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( > ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( != ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( <= ) // NOLINT
DETAIL_IGN_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( >= ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( == ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( < ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( > ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( != ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( <= ) // NOLINT
DETAIL_GZ_PLUGIN_PLUGINPTR_IMPLEMENT_OPERATOR( >= ) // NOLINT

//////////////////////////////////////////////////
template <typename PluginType>
Expand Down
14 changes: 7 additions & 7 deletions core/include/gz/plugin/detail/SpecializedPlugin.hh
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace gz
/// specializes for the requested Interface, if such a type is availabe
/// within its inheritance structure. Otherwise, we cast to the generic
/// Plugin type.
#define DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH( \
#define DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH( \
ReturnType, Function, Suffix, CastTo, Args) \
public: \
template <class T> \
Expand All @@ -233,20 +233,20 @@ namespace gz
}


DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
T*, QueryInterface, (), Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
const T*, QueryInterface, () const, const Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
std::shared_ptr<T>, QueryInterfaceSharedPtr, (), Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
std::shared_ptr<const T>, QueryInterfaceSharedPtr,
() const, const Specializer, ())

DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH(
DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH(
bool, HasInterface, () const, const Specializer, ())

// Declare friendship
Expand All @@ -260,7 +260,7 @@ namespace gz
/// \brief ComposePlugin provides a way for a multi-specialized Plugin
/// type to find its specializations within itself each time an
/// interface-querying function is called. The macro
/// DETAIL_IGN_PLUGIN_COMPOSEPLUGIN_DISPATCH accomplishes this for each
/// DETAIL_GZ_PLUGIN_COMPOSEPLUGIN_DISPATCH accomplishes this for each
/// of the different functions by doing a compile-time check on whether
/// Base2 contains the specialization, and then picks Base1 if it does
/// not.
Expand Down
6 changes: 3 additions & 3 deletions loader/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ign_get_libsources_and_unittests(sources tests)

# Disable ign_TEST if ignition-tools is not found
if (MSVC OR NOT IGN_TOOLS_PROGRAM)
if (MSVC OR NOT GZ_TOOLS_PROGRAM)
list(REMOVE_ITEM tests src/ign_TEST.cc)
endif()

Expand Down Expand Up @@ -34,7 +34,7 @@ foreach(test ${test_targets})
"IGNDummyPlugins_LIB=\"$<TARGET_FILE:IGNDummyPlugins>\"")

target_compile_definitions(${test} PRIVATE
"IGN_PATH=\"${IGN_TOOLS_PROGRAM}\"")
"GZ_PATH=\"${GZ_TOOLS_PROGRAM}\"")

target_compile_definitions(${test} PRIVATE
"IGN_VERSION_FULL=\"${PROJECT_VERSION_FULL}\"")
Expand All @@ -43,7 +43,7 @@ endforeach()

if(TARGET UNIT_ign_TEST)
set(_env_vars)
list(APPEND _env_vars "IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>")
list(APPEND _env_vars "GZ_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf/$<CONFIG>")

set_tests_properties(UNIT_ign_TEST PROPERTIES
ENVIRONMENT "${_env_vars}")
Expand Down
12 changes: 6 additions & 6 deletions loader/src/ign_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::string custom_exec_str(std::string _cmd)
TEST(ignTest, IgnPluginHelp)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);
std::string output = custom_exec_str(ign + " plugin --help");
EXPECT_NE(std::string::npos,
output.find("-i,--info Get info about a plugin."))
Expand All @@ -81,7 +81,7 @@ TEST(ignTest, IgnPluginHelp)
TEST(ignTest, PluginInfoNonexistentLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
"/path/to/libDoesNotExist.so");
Expand All @@ -99,7 +99,7 @@ TEST(ignTest, PluginInfoNonexistentLibrary)
TEST(ignTest, PluginInfoNonLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
std::string(IGN_PLUGIN_SOURCE_DIR) + "/core/src/Plugin.cc");
Expand All @@ -117,7 +117,7 @@ TEST(ignTest, PluginInfoNonLibrary)
TEST(ignTest, PluginInfoNonPluginLibrary)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGN_PLUGIN_LIB);
Expand All @@ -136,7 +136,7 @@ TEST(ignTest, PluginInfoNonPluginLibrary)
TEST(ignTest, PluginInfoDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB);
Expand Down Expand Up @@ -175,7 +175,7 @@ TEST(ignTest, PluginInfoDummyPlugins)
TEST(ignTest, PluginInfoVerboseDummyPlugins)
{
// Path to ign executable
std::string ign = std::string(IGN_PATH);
std::string ign = std::string(GZ_PATH);

std::string output = custom_exec_str(ign + " plugin --info --plugin " +
IGNDummyPlugins_LIB + " --verbose");
Expand Down
8 changes: 4 additions & 4 deletions register/include/gz/plugin/Register.hh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
/// the gz/plugin/RegisterMore.hh header in all of the rest of the
/// translation units.
#define IGNITION_ADD_PLUGIN(PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN(PluginClass, __VA_ARGS__)
DETAIL_GZ_ADD_PLUGIN(PluginClass, __VA_ARGS__)

/// \brief Add an alias for one of your plugins.
///
Expand All @@ -72,7 +72,7 @@
/// of another plugin, then the Loader will always prefer to instantiate the
/// plugin whose symbol name matches that string.
#define IGNITION_ADD_PLUGIN_ALIAS(PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)
DETAIL_GZ_ADD_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)


/// \brief Add a plugin factory.
Expand Down Expand Up @@ -117,7 +117,7 @@
/// IGNITION_ADD_FACTORY(MyType, MyFactory);
/// \endcode
#define IGNITION_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_IGNITION_ADD_FACTORY(ProductType, FactoryType)
DETAIL_GZ_ADD_FACTORY(ProductType, FactoryType)

/// \brief Add an alias for a factory.
///
Expand All @@ -134,7 +134,7 @@
/// IGNITION_ADD_FACTORY(), but there is nothing wrong with calling both (except
/// it might imperceptibly increase your compile time).
#define IGNITION_ADD_FACTORY_ALIAS(ProductType, FactoryType, ...) \
DETAIL_IGNITION_ADD_FACTORY_ALIAS(ProductType, FactoryType, __VA_ARGS__)
DETAIL_GZ_ADD_FACTORY_ALIAS(ProductType, FactoryType, __VA_ARGS__)


#endif
44 changes: 22 additions & 22 deletions register/include/gz/plugin/detail/Register.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define DETAIL_IGN_PLUGIN_VISIBLE __attribute__ ((dllexport))
#define DETAIL_GZ_PLUGIN_VISIBLE __attribute__ ((dllexport))
#else
#define DETAIL_IGN_PLUGIN_VISIBLE __declspec(dllexport)
#define DETAIL_GZ_PLUGIN_VISIBLE __declspec(dllexport)
#endif
#else
#if __GNUC__ >= 4
#define DETAIL_IGN_PLUGIN_VISIBLE __attribute__ ((visibility ("default")))
#define DETAIL_GZ_PLUGIN_VISIBLE __attribute__ ((visibility ("default")))
#else
#define DETAIL_IGN_PLUGIN_VISIBLE
#define DETAIL_GZ_PLUGIN_VISIBLE
#endif
#endif

Expand All @@ -55,7 +55,7 @@ extern "C"
/// retrieve Info from a shared library that provides plugins.
///
/// The symbol is explicitly exported (visibility is turned on) using
/// DETAIL_IGN_PLUGIN_VISIBLE to ensure that dlsym(~) is able to find it.
/// DETAIL_GZ_PLUGIN_VISIBLE to ensure that dlsym(~) is able to find it.
///
/// DO NOT CALL THIS FUNCTION DIRECTLY OR CREATE YOUR OWN IMPLEMENTATION OF IT
/// This function is used by the Registrar and Loader classes. Nothing else
Expand Down Expand Up @@ -100,7 +100,7 @@ extern "C"
/// Similar to _inputAndOutputInfoSize, this is used for sanity checking. It
/// inspects and returns the alignof(Info) value instead of the sizeof(Info)
/// value.
DETAIL_IGN_PLUGIN_VISIBLE void IgnitionPluginHook(
DETAIL_GZ_PLUGIN_VISIBLE void IgnitionPluginHook(
const void *_inputSingleInfo,
const void ** const _outputAllInfo,
int *_inputAndOutputAPIVersion,
Expand Down Expand Up @@ -442,7 +442,7 @@ IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
/// instance has a static lifetime, it will be constructed when the shared
/// library is loaded. When it is constructed, the Register function will
/// be called.
#define DETAIL_IGNITION_ADD_PLUGIN_HELPER(UniqueID, ...) \
#define DETAIL_GZ_ADD_PLUGIN_HELPER(UniqueID, ...) \
namespace gz \
{ \
namespace plugin \
Expand All @@ -466,15 +466,15 @@ IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
//////////////////////////////////////////////////
/// This macro is needed to force the __COUNTER__ macro to expand to a value
/// before being passed to the *_HELPER macro.
#define DETAIL_IGNITION_ADD_PLUGIN_WITH_COUNTER(UniqueID, ...) \
DETAIL_IGNITION_ADD_PLUGIN_HELPER(UniqueID, __VA_ARGS__)
#define DETAIL_GZ_ADD_PLUGIN_WITH_COUNTER(UniqueID, ...) \
DETAIL_GZ_ADD_PLUGIN_HELPER(UniqueID, __VA_ARGS__)


//////////////////////////////////////////////////
/// We use the __COUNTER__ here to give each plugin registration its own unique
/// name, which is required in order to statically initialize each one.
#define DETAIL_IGNITION_ADD_PLUGIN(...) \
DETAIL_IGNITION_ADD_PLUGIN_WITH_COUNTER(__COUNTER__, __VA_ARGS__)
#define DETAIL_GZ_ADD_PLUGIN(...) \
DETAIL_GZ_ADD_PLUGIN_WITH_COUNTER(__COUNTER__, __VA_ARGS__)


//////////////////////////////////////////////////
Expand All @@ -484,7 +484,7 @@ IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
/// the class instance has a static lifetime, it will be constructed when the
/// shared library is loaded. When it is constructed, the Register function will
/// be called.
#define DETAIL_IGNITION_ADD_PLUGIN_ALIAS_HELPER(UniqueID, PluginClass, ...) \
#define DETAIL_GZ_ADD_PLUGIN_ALIAS_HELPER(UniqueID, PluginClass, ...) \
namespace gz \
{ \
namespace plugin \
Expand All @@ -509,31 +509,31 @@ IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
//////////////////////////////////////////////////
/// This macro is needed to force the __COUNTER__ macro to expand to a value
/// before being passed to the *_HELPER macro.
#define DETAIL_IGNITION_ADD_PLUGIN_ALIAS_WITH_COUNTER( \
#define DETAIL_GZ_ADD_PLUGIN_ALIAS_WITH_COUNTER( \
UniqueID, PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS_HELPER(UniqueID, PluginClass, __VA_ARGS__)
DETAIL_GZ_ADD_PLUGIN_ALIAS_HELPER(UniqueID, PluginClass, __VA_ARGS__)


//////////////////////////////////////////////////
/// We use the __COUNTER__ here to give each plugin registration its own unique
/// name, which is required in order to statically initialize each one.
#define DETAIL_IGNITION_ADD_PLUGIN_ALIAS(PluginClass, ...) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS_WITH_COUNTER( \
#define DETAIL_GZ_ADD_PLUGIN_ALIAS(PluginClass, ...) \
DETAIL_GZ_ADD_PLUGIN_ALIAS_WITH_COUNTER( \
__COUNTER__, PluginClass, __VA_ARGS__)


//////////////////////////////////////////////////
#define DETAIL_IGNITION_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_IGNITION_ADD_PLUGIN(FactoryType::Producing<ProductType>, FactoryType) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS( \
#define DETAIL_GZ_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_GZ_ADD_PLUGIN(FactoryType::Producing<ProductType>, FactoryType) \
DETAIL_GZ_ADD_PLUGIN_ALIAS( \
FactoryType::Producing<ProductType>, \
::gz::plugin::DemangleSymbol(typeid(ProductType).name()))


//////////////////////////////////////////////////
#define DETAIL_IGNITION_ADD_FACTORY_ALIAS(ProductType, FactoryType, ...) \
DETAIL_IGNITION_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_IGNITION_ADD_PLUGIN_ALIAS(FactoryType::Producing<ProductType>, \
#define DETAIL_GZ_ADD_FACTORY_ALIAS(ProductType, FactoryType, ...) \
DETAIL_GZ_ADD_FACTORY(ProductType, FactoryType) \
DETAIL_GZ_ADD_PLUGIN_ALIAS(FactoryType::Producing<ProductType>, \
__VA_ARGS__)

#endif

0 comments on commit 1d9e268

Please sign in to comment.