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

Update XED_NORETURN to support modern C standards #333

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
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
10 changes: 9 additions & 1 deletion include/public/xed/xed-portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ XED_DLL_EXPORT int xed_strncat(char* dst, const char* src, int len);
# define XED_INLINE inline
# endif
# endif
# define XED_NORETURN __attribute__ ((noreturn))
# if __GNUC__ == 2
# define XED_NOINLINE
# else
Expand All @@ -171,6 +170,15 @@ XED_DLL_EXPORT int xed_strncat(char* dst, const char* src, int len);
# else
# define XED_NOINLINE __declspec(noinline)
# endif
#endif

#if __STDC_VERSION__ >= 202311L
# define XED_NORETURN [[noreturn]]
#elif __STDC_VERSION__ >= 201112L
# define XED_NORETURN _Noreturn
#elif defined(__GNUC__)
# define XED_NORETURN __attribute__ ((__noreturn__))
#else
# define XED_NORETURN __declspec(noreturn)
#endif

Expand Down