Skip to content

Why not use the compatible type __attribute__((__noreturn__)) as __NO_RETURN for IAR? #198

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

Closed
SuperHeroAbner opened this issue Nov 6, 2024 · 4 comments
Labels
question Further information is requested

Comments

@SuperHeroAbner
Copy link

SuperHeroAbner commented Nov 6, 2024

The type of attribute((noreturn)) can be put before or after function like 'void func(void) __NO_RETURN;'. If use the type of [[noreturn]] or _Noreturn, it must be like '__NO_RETURN void func(void)'
CMSIS_6 https://github.com/ARM-software/CMSIS_6/blob/main/CMSIS/Core/Include/cmsis_iccarm.h#L57
CMSIS_5 https://github.com/ARM-software/CMSIS_5/blob/develop/CMSIS/Core/Include/cmsis_iccarm.h#L130
This introduces compatibility issue. Does attribute((noreturn)) have any issue to apply on IAR compared with _Noreturn + [[noreturn]] ?

@JonatanAntoni
Copy link
Member

The compiler header for IAR is provided and maintained by IAR. Please consider raising this question directly with them as I am not aware how frequently they are watching CMSIS issues.

@ReinhardKeil
Copy link
Contributor

@jlonnberg maybe you can help.

@RobinKastberg
Copy link
Contributor

@SuperHeroAbner
We reasoned that it was better to follow C standard and we had an issue from a customer that wanted to allow usage of __NO_RETURN in strict language mode.

We can try to have another go here but it is hard to please everyone.

What are the benefits of having __NO_RETURN afterwards and what compatibility did we break? I recall something in trustedfirmware-m?

@SuperHeroAbner
Copy link
Author

SuperHeroAbner commented Feb 6, 2025

@RobinKastberg I just find the new type in IAR gets compiling issue if code is like 'void func(void) __NO_RETURN;', previously it's OK. But if the new way is better for certain 'strict language mode', yes we should use better one. And maybe it should be put in front of function as a law.
Thank you, please close this topic.

@jkrech jkrech closed this as completed Apr 9, 2025
@jkrech jkrech added the question Further information is requested label Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants