Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace custom SDF_* macros with GZ_* #1067

Merged
merged 5 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ but with improved human-readability..
+ ***Deprecation:*** void Root(sdf::ElementPtr)
+ ***Replacement:*** void SetRoot(sdf::ElementPtr)

### Removals

- **sdf/Types.hh**: The `SDF_DEPRECATED` and `SDF_SUPPRESS_*` macros have been
removed in favor of `GZ_DEPRECATED` and `GZ_UTILS_WARN_*`.

## libsdformat 11.x to 12.0

An error is now emitted instead of a warning for a file containing more than
Expand Down
25 changes: 13 additions & 12 deletions include/sdf/InterfaceElements.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <gz/math/Pose3.hh>
#include <gz/utils/ImplPtr.hh>
#include <gz/utils/SuppressWarning.hh>

#include "sdf/Element.hh"
#include "sdf/InterfaceModel.hh"
Expand Down Expand Up @@ -50,13 +51,13 @@ class SDFORMAT_VISIBLE NestedInclude
// class.
// TODO(anyone) Remove the constructor and destructor once the deprecated
// members are removed.
SDF_SUPPRESS_DEPRECATED_BEGIN
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
public: NestedInclude(const NestedInclude&) = default;
public: NestedInclude(NestedInclude&&) = default;
public: NestedInclude& operator=(const NestedInclude&) = default;
public: NestedInclude& operator=(NestedInclude&&) = default;
public: ~NestedInclude() = default;
SDF_SUPPRESS_DEPRECATED_END
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION

/// \brief Provides the URI as specified in `//include/uri`. This may or may
/// not end with a file extension (it will not end with an extension if it
Expand Down Expand Up @@ -169,57 +170,57 @@ class SDFORMAT_VISIBLE NestedInclude
/// not end with a file extension (it will not end with an extension if it
/// refers to a model package).
/// \deprecated Use NestedInclude::Uri() instead
public: std::string uri SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::string uri;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these say 13?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, these were actually deprecated in fortress; I suppose they can be removed here. Do you mind if I do that in a separate pull request?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah I didn't pay attention to the diff. SGTM


/// \brief Provides the *resolved* absolute file path from the URI.
/// It is recommended to use this in `CustomModelParser` when checking
/// predicates on filenames -- however, the predicates should generally only
/// check the file extension.
/// \deprecated Use NestedInclude::ResolvedFileName() instead
public: std::string resolvedFileName SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::string resolvedFileName;

/// \brief Name of the parent entity in absolute hierarchy.
/// Example: if the interface model's name is
/// `top_model::middle_model::my_new_model`, the absoluteParentName would be
/// `top_model::middle_model`. If the parent entity is the world, this would
/// be an empty string.
/// \deprecated Use NestedInclude::AbsoluteParentName() instead
public: std::string absoluteParentName SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::string absoluteParentName;

/// \brief Name relative to immediate parent as specified in
/// `//include/name`. This is nullopt if `//include/name` is not set. Then the
/// name of the model must be determined by the custom model parser from the
/// included model file.
/// Example: `my_new_model`
/// \deprecated Use NestedInclude::LocalModelName() instead
public: std::optional<std::string> localModelName SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::optional<std::string> localModelName;

/// \brief Whether the model is static as defined by `//include/static`. This
/// is nullopt if `//include/static` is not set.
/// \deprecated Use NestedInclude::IsStatic() instead
public: std::optional<bool> isStatic SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::optional<bool> isStatic;

/// \brief The raw pose as specified in //include/pose. This is nullopt if
/// `//include/pose` is not set.
/// \deprecated Use NestedInclude::IncludeRawPose() instead
public: std::optional<gz::math::Pose3d> includeRawPose
SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12)
std::optional<gz::math::Pose3d> includeRawPose;

/// \brief The relative-to frame of the pose as specified in
/// `//include/pose/@relative_to`. This is nullopt if
/// `//include/pose/@relative_to` is not set.
/// \deprecated Use NestedInclude::IncludePoseRelativeTo() instead
public: std::optional<std::string> includePoseRelativeTo SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::optional<std::string> includePoseRelativeTo;

/// \brief The placement frame as specified in `//include/placement_frame`.
/// This is nullopt if `//include/placement_frame` is is not set.
/// \deprecated Use NestedInclude::PlacementFrame() instead
public: std::optional<std::string> placementFrame SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) std::optional<std::string> placementFrame;

/// This is the `//include` element. This can be used to pass custom elements
/// and attributes to the custom model parser.
/// \deprecated Use NestedInclude::IncludeElement() instead
public: sdf::ElementPtr includeElement SDF_DEPRECATED(12);
public: GZ_DEPRECATED(12) sdf::ElementPtr includeElement;

/// \brief Private data pointer.
GZ_UTILS_IMPL_PTR(dataPtr)
Expand Down
28 changes: 1 addition & 27 deletions include/sdf/Types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,6 @@
#include "sdf/system_util.hh"
#include "sdf/Error.hh"

#if defined(__GNUC__) || defined(__clang__)
#define SDF_DEPRECATED(version) __attribute__((deprecated))
#define SDF_FORCEINLINE __attribute__((always_inline))
#elif defined(_MSC_VER)
#define SDF_DEPRECATED(version)
#define SDF_FORCEINLINE __forceinline
#else
#define SDF_DEPRECATED(version)
#define SDF_FORCEINLINE
#endif

#if defined(__GNUC__)
# define SDF_SUPPRESS_DEPRECATED_BEGIN \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define SDF_SUPPRESS_DEPRECATED_END _Pragma("GCC diagnostic pop")
#elif defined(__clang__)
# define SDF_SUPPRESS_DEPRECATED_BEGIN \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
# define SDF_SUPPRESS_DEPRECATED_END _Pragma("clang diagnostic pop")
#else
# define SDF_SUPPRESS_DEPRECATED_BEGIN
# define SDF_SUPPRESS_DEPRECATED_END
#endif

namespace sdf
{
// Inline bracket to help doxygen filtering.
Expand Down Expand Up @@ -170,7 +144,7 @@ namespace sdf
};

/// \brief A class for inertial information about a link.
class SDFORMAT_VISIBLE SDF_DEPRECATED(13) Inertia
class SDFORMAT_VISIBLE GZ_DEPRECATED(13) Inertia
{
public: double mass;
};
Expand Down
5 changes: 3 additions & 2 deletions src/InterfaceElements.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*
*/

#include <gz/utils/SuppressWarning.hh>
#include "sdf/InterfaceElements.hh"

using namespace sdf;
Expand All @@ -27,7 +28,7 @@ class sdf::NestedInclude::Implementation
public: std::optional<bool> isMerge;
};

SDF_SUPPRESS_DEPRECATED_BEGIN
GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
/////////////////////////////////////////////////
NestedInclude::NestedInclude()
: dataPtr(gz::utils::MakeImpl<Implementation>())
Expand Down Expand Up @@ -146,7 +147,7 @@ void NestedInclude::SetIncludeElement(sdf::ElementPtr _includeElement)
{
this->includeElement = _includeElement;
}
SDF_SUPPRESS_DEPRECATED_END
GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION

/////////////////////////////////////////////////
void NestedInclude::SetIsMerge(bool _isMerge)
Expand Down