tra added a subscriber: yaxunl.
tra added inline comments.

================
Comment at: clang/lib/Headers/__clang_cuda_builtin_vars.h:14
+#ifndef __cplusplus
+#error CUDA header must be used from C++
+#endif
----------------
Nit: the error message sounds a bit odd.
Perhaps rephrase it as `This CUDA header requires C++`.


================
Comment at: clang/lib/Headers/__clang_hip_cmath.h:381
 // decltype is only available in C++11 and above.
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 // __hip_promote
----------------
HIP headers are also not expected to compile w/o C++ and we may want a 
`#error`here, too. 

Actually, I'm not even sure if we shopuld/need to add `#if 
defined(__cplusplus)`in files that are clearly C++ -- undefined macro warning 
will be the least of one's worries if they attempt to compile it w/o C++.

Perhaps it would make sense to limit these changes to the headers intended to 
be used from both C and C++? Both CUDA and HIP are expected to never be 
included from a non-C++ compilation and will never trigger the undefined macro 
warning on `__cplusplus`.

@yaxunl - FYI.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130800/new/

https://reviews.llvm.org/D130800

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to