tra added inline comments.
================ Comment at: lib/Headers/__clang_cuda_device_functions.h:1477 #endif // CUDA_VERSION >= 9020 +#if __cplusplus >= 201703L +__DEVICE__ int abs(int __a) noexcept { return __nv_abs(__a); } ---------------- jdoerfert wrote: > Hahnfeld wrote: > > 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: > > ```lang=c > > #ifdef __cplusplus > > #define cpp_version __cplusplus > > #else > > #define cpp_version 0 > > #endif > > ``` > > (to avoid repetition of `#if defined(__cplusplus) && __cplusplus >= > > 201703L`) > I dislike defining the version and advice to repeating `#if > defined(__cplusplus) && __cplusplus >= 201703L)` > I agree with @jdoerfert. If that's needed too often, we can move c++-only functions under one global `#if defined(__cplusplus)`. ================ Comment at: lib/Headers/__clang_cuda_device_functions.h:1579-1586 +#if __cplusplus >= 201703L +__DEVICE__ long labs(long __a) noexcept { return __nv_llabs(__a); }; +#else __DEVICE__ long labs(long __a) { return __nv_llabs(__a); }; +#endif +#else +#if __cplusplus >= 201703L ---------------- This is typically dealt with by defining and using a macro which would expand to `noexcept` or to nothing. E.g. something like [[ https://github.com/llvm-mirror/libcxx/blob/dbd4f51025003a7c869c4e5267ab8780e91367d5/include/__config#L848 | what libcxx does ]]. This should reduce the number of needed `#if`. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61949/new/ https://reviews.llvm.org/D61949 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits