Skip to content

Add scope_exit helper.#78

Merged
hidmic merged 4 commits intomasterfrom
hidmic/scope_exit
Jun 26, 2020
Merged

Add scope_exit helper.#78
hidmic merged 4 commits intomasterfrom
hidmic/scope_exit

Conversation

@hidmic
Copy link
Copy Markdown

@hidmic hidmic commented Jun 25, 2020

Based off of rclcpp's. Can be cancelled.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic hidmic requested review from ivanpauno and wjwwood June 25, 2020 19:23
@hidmic hidmic requested a review from a team as a code owner June 25, 2020 19:23
EXPECT_FALSE(called);
}

TEST(test_scope_exit, code_types) {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

If anybody has a nice way to "test" signatures in compile time (w/o an actual bare test), I'm all ears.

Copy link
Copy Markdown
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

lgtm, we should remove the one in rclcpp and use this instead.

@hidmic
Copy link
Copy Markdown
Author

hidmic commented Jun 25, 2020

CI up to rcpputils:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@hidmic
Copy link
Copy Markdown
Author

hidmic commented Jun 25, 2020

lgtm, we should remove the one in rclcpp and use this instead.

Will do, but I want the original rmw PRs in first 😅 !

hidmic added 2 commits June 25, 2020 16:46
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
} // namespace rcpputils

#define RCPPUTILS_SCOPE_EXIT(code) \
auto RCUTILS_JOIN(scope_exit_, __LINE__) = rcpputils::make_scope_exit([&]() {code;})
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

RCUTILS_JOIN will be defined in rcutils, right? I was not able to find it. just want to confirm.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@hidmic
Copy link
Copy Markdown
Author

hidmic commented Jun 26, 2020

@ros-pull-request-builder retest this please

@hidmic
Copy link
Copy Markdown
Author

hidmic commented Jun 26, 2020

@hidmic hidmic merged commit 8a29426 into master Jun 26, 2020
@hidmic hidmic deleted the hidmic/scope_exit branch June 26, 2020 15:52
ahcorde pushed a commit that referenced this pull request Oct 8, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde pushed a commit that referenced this pull request Oct 9, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
ahcorde added a commit that referenced this pull request Oct 9, 2020
Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>

Co-authored-by: Michel Hidalgo <michel@ekumenlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants