In OpenMP device offloading we must ensure that unde C++ 17, the inclusion of cstdlib will works correctly.
ABataev tra jdoerfert hfinkel caomhin
- rL360804: [OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions
rG7641f310d7b0: [OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions
rC360804: [OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions
If I recall correctly, __cplusplus is not defined in C mode, so both GCC and Clang will issue a warning with -Wundef.
Maybe this can be solved with something similar to:
#ifdef __cplusplus #define cpp_version __cplusplus #else #define cpp_version 0 #endif
(to avoid repetition of #if defined(__cplusplus) && __cplusplus >= 201703L)
Missing defined(__cplusplus) to avoid warnings and we have to resolve the two new includes. Otherwise, this looks good. So, if you "fix" both go ahead and commit, if not, lets discuss.
I dislike defining the version and advice to repeating #if defined(__cplusplus) && __cplusplus >= 201703L)
|24 ↗||(On Diff #199613)|
I ask this question again and again, do we need them now? Why?
I agree with @jdoerfert.
This is typically dealt with by defining and using a macro which would expand to noexcept or to nothing.
This should reduce the number of needed #if.