Select OpenMP data sharing mode based on specific GCC versions#3823
Conversation
|
We should be checking for clang version in this case too, right? Or is the clang version strictly dependent on the OpenMP version? PS: maybe some more parenthesis in the macro would help |
I don't think so, as we only need a version check for GCC (as already mentioned here). And as currently all Clang versions are working on gobolt with this macro, I don't believe Clang requires it too.
So you suggest (?): |
|
The macro reads funny. Perhaps refactor it by compiler behavior. If GCC then this, else if clang then this. This might be more manageable in case clang changes behavior (or we add support MSVC + OpenMP. Do we already?) |
|
There is no specific flag where I can see it GCC or not. Alternatively I could use Or do we have a value we are getting from CMake? If we would not support GCC |
In that case, just make en exception for GCC using the 2 diff rules (one for GCC version, one for OpenMP). No need to drag other compilers in 😄 |
1a8d861 to
79f20a3
Compare
You are right. In case someone has trouble with any other compiler, which define itself as Gnu compiler, we can check what we do then. I adjusted the code as it was currently a bit lucky that it worked, as I didn't checked if |
…3.1 (201107). As value of __GNUC_ is still 4, we need to extend our exception for GCC, so that Clang can use the newer data sharing model.
79f20a3 to
308dc13
Compare
|
A better title for the changelog... And two more eyes |
Starting with Clang 10 (released some days ago) clang supports OpenMP 4.5 (201511) instead of 3.1 (201107). As value of _GNUC is still 4, we need to extend our exception for GCC, so that Clang can use the newer data sharing model.
Note: Clang 10 can OpenMP 5.0, too, if you add compiler flag
-fopenmp-version=50. But as far as I can see we don't get additional compiler errors with OpenMP 5.0 (only short check via godbolt).