Skip to content

Commit

Permalink
ign -> gz Macro Migration : gz-utils (#64)
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <methylDragon@gmail.com>
  • Loading branch information
methylDragon authored Jun 17, 2022
1 parent f950fed commit 3463812
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 31 deletions.
15 changes: 15 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ release will remove the deprecated code.
* Header files under `ignition/...` are deprecated and will be removed in future versions.
Use `gz/...` instead.

* The following `IGN_` prefixed macros are deprecated and will be removed in future versions.
Additionally, they will only be available when including the corresponding `ignition/...` header.
Use the `GZ_` prefix instead.
* `IGN_UTILS_TEST_DISABLED_ON_WIN32`
* `IGN_UTILS_TEST_DISABLED_ON_MAC`
* `IGN_UTILS_TEST_DISABLED_ONLY_ON_LINUX`
* `IGN_UTILS_IMPL_PTR_FWD`
* `IGN_UTILS_UNIQUE_IMPL_PTR_FWD`
* `IGN_UTILS_IMPL_PTR`
* `IGN_UTILS_UNIQUE_IMPL_PTR`
* `IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR`, `IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR`
* `IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING`, `IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING`
* `IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION`, `IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION`


## Gazebo Utils 1.2 to 1.3

Recommended migration:
Expand Down
2 changes: 1 addition & 1 deletion cli/include/gz/utils/cli/GzFormatter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "gz/utils/cli/FormatterFwd.hpp"

//////////////////////////////////////////////////
/// \brief CLI Formatter class that implements custom Ignition-specific
/// \brief CLI Formatter class that implements custom Gazebo-specific
/// formatting.
///
/// More information on custom formatters:
Expand Down
6 changes: 3 additions & 3 deletions include/gz/utils/ExtraTestMacros.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,23 @@
/// part of the test suite. The macro uses the Disabled_ prefix provided
/// by googletest. See
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
#define IGN_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
#define GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
DETAIL_GZ_UTILS_TEST_DISABLED_ON_WIN32(TestName)

/// \brief Restrict the execution of the test for the Mac platform.
/// The test will be compiled on Windows too but will never be run as
/// part of the test suite. The macro uses the Disabled_ prefix provided
/// by googletest. See
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
#define IGN_UTILS_TEST_DISABLED_ON_MAC(TestName) \
#define GZ_UTILS_TEST_DISABLED_ON_MAC(TestName) \
DETAIL_GZ_UTILS_TEST_DISABLED_ON_MAC(TestName)

/// \brief Restrict the execution of the test to just the Linux platform
/// Other platforms will get the test compiled but it won't be run
/// as part of the test suite execution.
/// The macro uses the Disabled_ prefix provided by googletest. See
/// https://chromium.googlesource.com/external/github.com/google/googletest/+/HEAD/googletest/docs/advanced.md
#define IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
#define GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
DETAIL_GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName)

#endif // GZ_UTILS_EXTRATESTMACROS_HH
20 changes: 10 additions & 10 deletions include/gz/utils/ImplPtr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -230,29 +230,29 @@ namespace gz

/// \brief Add a private ImplPtr to a class as dataPtr.
/// This variant takes a forward-declared ImplementationClass as the impl.
#define IGN_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName) \
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
#define GZ_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName) \
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::gz::utils::ImplPtr<ImplementationClass> memberName; \
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING

/// \brief Add a private UniqueImplPtr to a class as dataPtr.
/// This variant takes a forward-declared ImplementationClass as the impl.
#define IGN_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName) \
IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
#define GZ_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName) \
GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
private: ::gz::utils::UniqueImplPtr<ImplementationClass> memberName; \
IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING

/// \brief Add a private ImplPtr to a class as dataPtr.
/// This variant forward-declares Class::Implementation as the impl.
#define IGN_UTILS_IMPL_PTR(memberName) \
#define GZ_UTILS_IMPL_PTR(memberName) \
public: class Implementation; \
IGN_UTILS_IMPL_PTR_FWD(Implementation, memberName)
GZ_UTILS_IMPL_PTR_FWD(Implementation, memberName)

/// \brief Add a private UniqueImplPtr to a class as dataPtr.
/// This variant forward-declares Class::Implementation as the impl.
#define IGN_UTILS_UNIQUE_IMPL_PTR(memberName) \
#define GZ_UTILS_UNIQUE_IMPL_PTR(memberName) \
public: class Implementation; \
IGN_UTILS_UNIQUE_IMPL_PTR_FWD(Implementation, memberName)
GZ_UTILS_UNIQUE_IMPL_PTR_FWD(Implementation, memberName)


#include <gz/utils/detail/ImplPtr.hh>
Expand Down
28 changes: 14 additions & 14 deletions include/gz/utils/SuppressWarning.hh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
* Usage example:
*
* SomeClass *ptr = CreatePtr();
* IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
* GZ_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
* delete ptr;
* IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
* GZ_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
*
*/

Expand All @@ -48,13 +48,13 @@
/// We want to suppress this warning when we know for certain (via the design
/// of our implementation) that the pointer is definitely not pointing to a more
/// derived type.
#ifndef IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
#define IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR \
#ifndef GZ_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
#define GZ_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR \
DETAIL_GZ_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
#endif

#ifndef IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
#define IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR \
#ifndef GZ_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
#define GZ_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR \
DETAIL_GZ_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
#endif

Expand All @@ -63,25 +63,25 @@
/// Instead it issues this warning. When the member variable is private, we
/// choose to suppress the warning instead of needlessly adding the class
/// information to the DLL interface.
#ifndef IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
#define IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
#ifndef GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
#define GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
DETAIL_GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
#endif

#ifndef IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
#define IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING \
#ifndef GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
#define GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING \
DETAIL_GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
#endif

/// \brief Use this to suppress deprecation warnings. This may be useful when
/// retaining tests for deprecated methods to preserve code coverage.
#ifndef IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
#define IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION \
#ifndef GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
#define GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION \
DETAIL_GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
#endif

#ifndef IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#define IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION \
#ifndef GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#define GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION \
DETAIL_GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#endif

Expand Down
9 changes: 9 additions & 0 deletions include/ignition/utils/ExtraTestMacros.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@

#include <gz/utils/ExtraTestMacros.hh>
#include <ignition/utils/config.hh>

#define IGN_UTILS_TEST_DISABLED_ON_WIN32(TestName) \
GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName)

#define IGN_UTILS_TEST_DISABLED_ON_MAC(TestName) \
GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName)

#define IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName) \
GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(TestName)
12 changes: 12 additions & 0 deletions include/ignition/utils/ImplPtr.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,15 @@

#include <gz/utils/ImplPtr.hh>
#include <ignition/utils/config.hh>

#define IGN_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName) \
GZ_UTILS_IMPL_PTR_FWD(ImplementationClass, memberName)

#define IGN_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName) \
GZ_UTILS_UNIQUE_IMPL_PTR_FWD(ImplementationClass, memberName)

#define IGN_UTILS_IMPL_PTR(memberName) \
GZ_UTILS_IMPL_PTR(memberName)

#define IGN_UTILS_UNIQUE_IMPL_PTR(memberName) \
GZ_UTILS_UNIQUE_IMPL_PTR(memberName)
30 changes: 30 additions & 0 deletions include/ignition/utils/SuppressWarning.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,33 @@

#include <gz/utils/SuppressWarning.hh>
#include <ignition/utils/config.hh>

#ifndef IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
#define IGN_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR \
DETAIL_GZ_UTILS_WARN_IGNORE__NON_VIRTUAL_DESTRUCTOR
#endif

#ifndef IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
#define IGN_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR \
DETAIL_GZ_UTILS_WARN_RESUME__NON_VIRTUAL_DESTRUCTOR
#endif

#ifndef IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
#define IGN_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING \
DETAIL_GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
#endif

#ifndef IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
#define IGN_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING \
DETAIL_GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
#endif

#ifndef IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
#define IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION \
DETAIL_GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
#endif

#ifndef IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#define IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION \
DETAIL_GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
#endif
6 changes: 3 additions & 3 deletions test/integration/implptr/implptr_test_classes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace gz
/// \brief Pointer to implementation
/// This demonstrates using an implementation class that is
/// forward-declared outside of this class.
IGN_UTILS_IMPL_PTR_FWD(ObjectPrivate, dataPtr)
GZ_UTILS_IMPL_PTR_FWD(ObjectPrivate, dataPtr)
};

/// \brief A PIMPL test class that cannot be copied; it can only be moved.
Expand Down Expand Up @@ -88,7 +88,7 @@ namespace gz
/// \brief Pointer to implementation
/// This demonstrates using an implementation class that is
/// forward-declared outside of this class.
IGN_UTILS_UNIQUE_IMPL_PTR_FWD(ObjectPrivate, dataPtr)
GZ_UTILS_UNIQUE_IMPL_PTR_FWD(ObjectPrivate, dataPtr)
};

/// \brief A PIMPL test class that can be copied (alternate definition)
Expand All @@ -113,7 +113,7 @@ namespace gz
/// \brief Pointer to implementation
/// This will automatically forward declare a class named
/// "Implementation" inline
IGN_UTILS_IMPL_PTR(dataPtr)
GZ_UTILS_IMPL_PTR(dataPtr)
};

} // namespace implptr_test_classes
Expand Down

0 comments on commit 3463812

Please sign in to comment.