-
Couldn't load subscription status.
- Fork 728
Fix compilation error when MSVC is not set to C11 standard #4588
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
base: main
Are you sure you want to change the base?
Conversation
| extern "C" { | ||
| #elif defined(_MSC_VER) && !_CRT_HAS_C11 | ||
| #define _Static_assert static_assert | ||
| #define _Alignof __alignof |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMM, how about?
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _Static_assert
#define _Static_assert static_assert
#endif /* _Static_assert */
#ifndef _Alignof
#if defined(_MSC_VER) && !_CRT_HAS_C11
#define _Alignof __alignof
#else
#define _Alignof alignof
#endif
#endif /* _Alignof */There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This make a lot error. So I revert it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May I ask about the error? the modification I apologize for the confusion. My intention is to expand the compatibility of _Static_assert and _Align_of.
As far as I know, if __cplusplus >= 201103L, static_assert is a keyword. if __STDC_VERSION__ >= 201112L, _Static_assert is a keyword. Both __GNUC__ and __clang__ support _Static_assert since version 4.6, and if _MSC_VER >= 1600 supports _Static_assert for both C++ and C.
Therefore, we might need to reorganize to cover all these cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
errors are here: https://github.com/bytecodealliance/wasm-micro-runtime/actions/runs/17377924957/job/49328417065
I am not familiar with gcc/clang. Seems gcc and clang is ok when use c99. Only msvc must use c11.
This reverts commit bd15116.
No description provided.