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

noreturn hint lost on FreeBSD clang/gcc #663

Closed
hart-NTP opened this issue Mar 15, 2023 · 0 comments
Closed

noreturn hint lost on FreeBSD clang/gcc #663

hart-NTP opened this issue Mar 15, 2023 · 0 comments

Comments

@hart-NTP
Copy link
Contributor

The NTP reference implementation uses Unity for unit testing. On FreeBSD (at least 11.2 and later) stdnoreturn.h has:
#define noreturn _Noreturn
That works fine for function declaration/definition, but it breaks __attribute__((noreturn)) as used by unity_internals.h. Changing that file to use __attribute__((__noreturn__)) resolves the problem.
Example warning from clang 6.0.0 (which is cc on FreeBSD 11.2):

../../../sntp/unity/unity_internals.h:480:65: warning: unknown attribute '_Noreturn' ignored [-Wunknown-attributes]
void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_NORETURN_ATTRIBUTE;
                                                                ^
../../../sntp/unity/unity_internals.h:311:60: note: expanded from macro 'UNITY_NORETURN_ATTRIBUTE'
#           define UNITY_NORETURN_ATTRIBUTE __attribute__((noreturn))
                                                           ^
/usr/include/stdnoreturn.h:36:19: note: expanded from macro 'noreturn'
#define noreturn                _Noreturn

That's using an older version of Unity but I see the same issue in the current source.

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

No branches or pull requests

1 participant