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

Missing C11 conditional feature macros #5224

Closed
nemequ opened this issue May 17, 2017 · 3 comments
Closed

Missing C11 conditional feature macros #5224

nemequ opened this issue May 17, 2017 · 3 comments
Labels

Comments

@nemequ
Copy link

nemequ commented May 17, 2017

According to § 6.10.8.3 of the C11 spec, __STDC_NO_ATOMICS__ should be defined in C11 mode when stdatomic.h is not available, as is the case for emscripten.

Testing is easy:

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
#include <stdatomic.h>
#endif

I use variants of that snippet in several places. I'm working around the issue with an additional && !defined(__EMSCRIPTEN__), but that's obviously sub-optimal.

You should probably also define __STDC_NO_THREADS__ until threads.h provides a complete implementation (i.e., until mtx_t and cnd_t are implemented).

@paulshapiro
Copy link
Contributor

This would be very useful for me. @kripken any idea on the level of effort on this? I may be able to help with a bit of guidance.

@kripken
Copy link
Member

kripken commented Aug 14, 2018

The best place to add that define is in tools/shared.py (around where we define -D__EMSCRIPTEN__ etc.).

However, it seems like we could provide that header - we do have threads and atomics support, in particular pthreads works. Maybe it needs clang integration, though - if so, I'm not sure of the status of that.

@stale
Copy link

stale bot commented Sep 18, 2019

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Sep 18, 2019
@stale stale bot closed this as completed Sep 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants