diff --git a/crates/spacewasm_c_api/cbindgen.toml b/crates/spacewasm_c_api/cbindgen.toml index 440cb8f..eb64f21 100644 --- a/crates/spacewasm_c_api/cbindgen.toml +++ b/crates/spacewasm_c_api/cbindgen.toml @@ -13,10 +13,14 @@ header = """/* */""" after_includes = """ -#if !defined(SPACEWASM_NORETURN) -# if defined(__has_c_attribute) && __has_c_attribute(noreturn) +#if !defined(SPACEWASM_NORETURN) && defined(__has_c_attribute) +# if __has_c_attribute(noreturn) # define SPACEWASM_NORETURN [[noreturn]] /* Standard C23 attribute */ -# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +# endif +#endif + +#if !defined(SPACEWASM_NORETURN) +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define SPACEWASM_NORETURN _Noreturn /* Standard C11 keyword */ # elif defined(__GNUC__) || defined(__clang__) # define SPACEWASM_NORETURN __attribute__((noreturn)) /* GCC / Clang extension */ diff --git a/crates/spacewasm_c_api/include/spacewasm.h b/crates/spacewasm_c_api/include/spacewasm.h index 2f5d56c..fce63ad 100644 --- a/crates/spacewasm_c_api/include/spacewasm.h +++ b/crates/spacewasm_c_api/include/spacewasm.h @@ -10,10 +10,14 @@ #include #include -#if !defined(SPACEWASM_NORETURN) -# if defined(__has_c_attribute) && __has_c_attribute(noreturn) +#if !defined(SPACEWASM_NORETURN) && defined(__has_c_attribute) +# if __has_c_attribute(noreturn) # define SPACEWASM_NORETURN [[noreturn]] /* Standard C23 attribute */ -# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) +# endif +#endif + +#if !defined(SPACEWASM_NORETURN) +# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) # define SPACEWASM_NORETURN _Noreturn /* Standard C11 keyword */ # elif defined(__GNUC__) || defined(__clang__) # define SPACEWASM_NORETURN __attribute__((noreturn)) /* GCC / Clang extension */