Closed ctshepherd closed 11 years ago
Thanks for the proposal. Unfortunately, it doesn't work because those builtins are of the "hard" kind (ie. their prototype cannot be written as a regular C function). The magic [overloaded] attribute was designed with [type __atomic_add_fetch (type *ptr, type val, int memmodel)] and others in mind, and it would not work in your case automatically. And some more magic is necessary in src/frontc/cabs2cil.ml (look for "overloaded" in a comment).
It gives me a list of the functions, though, so thanks for that. For future reference: http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html
If you want to try and discuss another patch, let me know. Otherwise, I'll think about it next week.
Sorry, I meant it was designed for [type sync_fetch_and_add (type *ptr, type value, ...)], so it would certainly support [__atomic_fetch_and_add], but not [atomic_load_n] or [__atomic_load] for instance. And src/frontc/cabs2cil.ml still needs to be adapted.
Fixes issue #7