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

Define mmk_noreturn if __STDC_VERSION__ >= 201112L #29

Conversation

christophebedard
Copy link
Member

@christophebedard christophebedard commented Jan 26, 2024

If CMAKE_C_STANDARD is set to 11 (e.g., globally), then mmk_noreturn is never defined, which results in errors like this:

In file included from /home/user/ros2_ws/build/mimick_vendor/mimick_vendor-prefix/src/mimick_vendor/src/plt.c:25:
/home/user/ros2_ws/build/mimick_vendor/mimick_vendor-prefix/src/mimick_vendor/src/vitals.h:46:13: error: expected ‘;’ before ‘void’
   46 | mmk_noreturn void mmk_panic(const char *, ...);
      |             ^~~~~
      |             ;

_Noreturn is deprecated in C23, but I'm not sure if we should worry about that just yet. See https://en.cppreference.com/w/c/language/_Noreturn.

Relates to Snaipe#28, but using C99 is not really a great solution.

@christophebedard
Copy link
Member Author

Should this be contributed upstream instead/in addition to this PR?

@clalancette
Copy link

Should this be contributed upstream instead/in addition to this PR?

I think we can open it in addition to this PR. Upstream is not very active, I've had PRs waiting quite a while there.

Copy link

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks reasonable to me, thanks. I'm also going to open a corresponding PR to https://github.com/ros2/mimick_vendor, and run CI for this over there.

@clalancette
Copy link

CI was happy in ros2/mimick_vendor#34, so going ahead and merging this. I'll then update that PR to point to the correct commit. Thanks for the fix.

@clalancette clalancette merged commit 60f8e4f into ros2:ros2 Feb 10, 2024
1 check passed
christophebedard added a commit to christophebedard/Mimick that referenced this pull request Feb 10, 2024
@christophebedard christophebedard deleted the christophebedard/define-mmk-noreturn-if-c11 branch February 10, 2024 18:39
@christophebedard
Copy link
Member Author

Contributed upstream: Snaipe#40

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.

2 participants