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

Global use of nodiscard #801

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -714,6 +714,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 @@ -734,6 +735,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 @@ -743,6 +745,7 @@ class BoundedVector
}

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

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

/// Based on operator<
[[nodiscard]]
friend bool
operator<=(
const BoundedVector & x,
Expand All @@ -770,6 +775,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 @@ -133,6 +133,7 @@ struct Field_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const Field_ & other) const
{
if (this->name != other.name) {
Expand All @@ -146,6 +147,7 @@ struct Field_
}
return true;
}
[[nodiscard]]
bool operator!=(const Field_ & other) const
{
return !this->operator==(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ struct FieldType_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const FieldType_ & other) const
{
if (this->type_id != other.type_id) {
Expand All @@ -351,6 +352,7 @@ struct FieldType_
}
return true;
}
[[nodiscard]]
bool operator!=(const FieldType_ & other) const
{
return !this->operator==(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ struct IndividualTypeDescription_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const IndividualTypeDescription_ & other) const
{
if (this->type_name != other.type_name) {
Expand All @@ -129,6 +130,7 @@ struct IndividualTypeDescription_
}
return true;
}
[[nodiscard]]
bool operator!=(const IndividualTypeDescription_ & other) const
{
return !this->operator==(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ struct KeyValue_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const KeyValue_ & other) const
{
if (this->key != other.key) {
Expand All @@ -128,6 +129,7 @@ struct KeyValue_
}
return true;
}
[[nodiscard]]
bool operator!=(const KeyValue_ & other) const
{
return !this->operator==(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct TypeDescription_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const TypeDescription_ & other) const
{
if (this->type_description != other.type_description) {
Expand All @@ -123,6 +124,7 @@ struct TypeDescription_
}
return true;
}
[[nodiscard]]
bool operator!=(const TypeDescription_ & other) const
{
return !this->operator==(other);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ struct TypeSource_
ConstPtr;

// comparison operators
[[nodiscard]]
bool operator==(const TypeSource_ & other) const
{
if (this->type_name != other.type_name) {
Expand All @@ -143,6 +144,7 @@ struct TypeSource_
}
return true;
}
[[nodiscard]]
bool operator!=(const TypeSource_ & other) const
{
return !this->operator==(other);
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
Loading