[clang] 3e649f8 - [openmp][nfc] Simplify macros guarding math complex headers

Jon Chesterfield via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 18 15:30:55 PDT 2021


Author: Jon Chesterfield
Date: 2021-07-18T23:30:35+01:00
New Revision: 3e649f8ef1875f943537b5fcecdb132c9442cb7d

URL: https://github.com/llvm/llvm-project/commit/3e649f8ef1875f943537b5fcecdb132c9442cb7d
DIFF: https://github.com/llvm/llvm-project/commit/3e649f8ef1875f943537b5fcecdb132c9442cb7d.diff

LOG: [openmp][nfc] Simplify macros guarding math complex headers

The `__CUDA__` macro is already defined for openmp/nvptx and is not used by
`__clang_cuda_complex_builtins.h`, so dropping that macro slightly simplifies
nvptx and avoids defining it on amdgcn (where it is likely to be harmful).

Also dropped a cplusplus test from a C++ header as compilation will have
failed on cmath earlier if it was included from C.

Reviewed By: jdoerfert, fodinabor

Differential Revision: https://reviews.llvm.org/D105221

Added: 
    

Modified: 
    clang/lib/Headers/openmp_wrappers/complex
    clang/lib/Headers/openmp_wrappers/complex.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/openmp_wrappers/complex b/clang/lib/Headers/openmp_wrappers/complex
index 142e526b81b35..dfd6193c97cbd 100644
--- a/clang/lib/Headers/openmp_wrappers/complex
+++ b/clang/lib/Headers/openmp_wrappers/complex
@@ -17,7 +17,6 @@
 // We require std::math functions in the complex builtins below.
 #include <cmath>
 
-#define __CUDA__
 #define __OPENMP_NVPTX__
 #include <__clang_cuda_complex_builtins.h>
 #undef __OPENMP_NVPTX__
@@ -26,9 +25,6 @@
 // Grab the host header too.
 #include_next <complex>
 
-
-#ifdef __cplusplus
-
 // If we are compiling against libc++, the macro _LIBCPP_STD_VER should be set
 // after including <cmath> above. Since the complex header we use is a
 // simplified version of the libc++, we don't need it in this case. If we
@@ -48,5 +44,3 @@
 #pragma omp end declare variant
 
 #endif
-
-#endif

diff  --git a/clang/lib/Headers/openmp_wrappers/complex.h b/clang/lib/Headers/openmp_wrappers/complex.h
index 00d278548f826..15dc415b8126d 100644
--- a/clang/lib/Headers/openmp_wrappers/complex.h
+++ b/clang/lib/Headers/openmp_wrappers/complex.h
@@ -17,7 +17,6 @@
 // We require math functions in the complex builtins below.
 #include <math.h>
 
-#define __CUDA__
 #define __OPENMP_NVPTX__
 #include <__clang_cuda_complex_builtins.h>
 #undef __OPENMP_NVPTX__


        


More information about the cfe-commits mailing list