Skip to content

Commit

Permalink
Global use of nodiscard (#801)
Browse files Browse the repository at this point in the history
* Global use of nodiscard

Signed-off-by: CursedRock17 <mtglucas1@gmail.com>
  • Loading branch information
CursedRock17 committed Apr 24, 2024
1 parent 858e76a commit 2e4d84d
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace rosidl_runtime_cpp
* \return Function handler for the action's typesupport.
*/
template<typename T>
[[nodiscard]]
const rosidl_action_type_support_t * get_action_type_support_handle();

} // namespace rosidl_runtime_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,7 @@ class BoundedVector
* \param y A %BoundedVector of the same type as @a x
* \return True if the size and elements of the vectors are equal
*/
[[nodiscard]]
friend bool
operator==(
const BoundedVector & x,
Expand All @@ -744,6 +745,7 @@ class BoundedVector
* \param y A %BoundedVector of the same type as @a x
* @return True if @a x is lexicographically less than @a y
*/
[[nodiscard]]
friend bool
operator<(
const BoundedVector & x,
Expand All @@ -753,6 +755,7 @@ class BoundedVector
}

/// Based on operator==
[[nodiscard]]
friend bool
operator!=(
const BoundedVector & x,
Expand All @@ -762,6 +765,7 @@ class BoundedVector
}

/// Based on operator<
[[nodiscard]]
friend bool
operator>(
const BoundedVector & x,
Expand All @@ -771,6 +775,7 @@ class BoundedVector
}

/// Based on operator<
[[nodiscard]]
friend bool
operator<=(
const BoundedVector & x,
Expand All @@ -780,6 +785,7 @@ class BoundedVector
}

/// Based on operator<
[[nodiscard]]
friend bool
operator>=(
const BoundedVector & x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace rosidl_runtime_cpp
* \return Function handler for the message's typesupport.
*/
template<typename T>
[[nodiscard]]
const rosidl_message_type_support_t * get_message_type_support_handle();

} // namespace rosidl_runtime_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace rosidl_runtime_cpp
* \return Function handler for the service's typesupport.
*/
template<typename T>
[[nodiscard]]
const rosidl_service_type_support_t * get_service_type_support_handle();

} // namespace rosidl_runtime_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace rosidl_typesupport_cpp
{

template<typename T>
[[nodiscard]]
const rosidl_action_type_support_t * get_action_type_support_handle();

} // namespace rosidl_typesupport_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace rosidl_typesupport_cpp
{

template<typename T>
[[nodiscard]]
const rosidl_message_type_support_t * get_message_type_support_handle();

} // namespace rosidl_typesupport_cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace rosidl_typesupport_cpp
{

template<typename T>
[[nodiscard]]
const rosidl_service_type_support_t * get_service_type_support_handle();

template<typename T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace rosidl_typesupport_introspection_cpp
/// the rosidl_generate_interfaces() macro.
/// This is implemented in the shared library provided by this package.
template<typename T>
[[nodiscard]]
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_message_type_support_t * get_message_type_support_handle();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace rosidl_typesupport_introspection_cpp
/// services.
/// This is implemented in the shared library provided by this package.
template<typename T>
[[nodiscard]]
ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_PUBLIC
const rosidl_service_type_support_t * get_service_type_support_handle();

Expand Down

0 comments on commit 2e4d84d

Please sign in to comment.