-
Notifications
You must be signed in to change notification settings - Fork 231
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
Replace atomic_ops with std::atomic #3082
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d-torrance
force-pushed
the
atomic
branch
3 times, most recently
from
January 22, 2024 11:37
bd4cb8f
to
8f644d5
Compare
Clang is much pickier about casting |
d-torrance
force-pushed
the
atomic
branch
3 times, most recently
from
January 23, 2024 13:10
b59545a
to
17758e6
Compare
No longer need to include atomic_ops.h
Previously, it was included via atomic_ops.h.
Used in both d and system directories
We also include atomic-exports.h instead of copy/pasting its contents.
"load" returns an int anyway, and this was causing a fatal error on macOS: CC interrupts-tmp.c ../../../../Macaulay2/d/interrupts.d:25:100: fatal error: used type 'atomic_int' (aka '_Atomic(int)') where arithmetic or pointer type is required tmp__5 = (load_Field((*((struct atomic_field*)TS_Get_Local(interrupts_interruptedFlag_id)))) != ((atomic_int)0)); ^ ~
Otherwise, we get compile errors using clang, e.g.: CC interrupts-tmp.c ../../../../Macaulay2/d/interrupts.d:25:85: fatal error: used type 'atomic_int' (aka '_Atomic(int)') where arithmetic or pointer type is required store_Field((*((struct atomic_field*)TS_Get_Local(interrupts_exceptionFlag_id))),((atomic_int)tmp__4)); ^ ~~~~~~ ../../../../Macaulay2/d/../../include/M2/atomic-field.h:20:52: note: expanded from macro 'store_Field' #define store_Field(x,val) atomic_store(&(x).field,val) ^~~ /Applications/Xcode_14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stdatomic.h:121:66: note: expanded from macro 'atomic_store' #define atomic_store(object, desired) __c11_atomic_store(object, desired, __ATOMIC_SEQ_CST) ^~~~~~~
There were lots of things we were never actually using
Are atomic ints in top-level next? |
Yup! |
This was referenced Jun 3, 2024
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
atomic_ops has been deprecated since C11/C++14. See the message at the top of https://github.com/ivmai/libatomic_ops/blob/master/README.md:
Closes: #1113