diff options
| author | Gheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com> | 2019-05-13 22:11:44 +0000 |
|---|---|---|
| committer | Gheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com> | 2019-05-13 22:11:44 +0000 |
| commit | 946957189d6b43a3d2079403633c183224813f95 (patch) | |
| tree | 812d493681bcc2b878398004167a7dad942f911b /clang/lib/Headers/openmp_wrappers | |
| parent | 44a7abe584103da1c261fa706dc08f7f4c0dda52 (diff) | |
| download | bcm5719-llvm-946957189d6b43a3d2079403633c183224813f95.tar.gz bcm5719-llvm-946957189d6b43a3d2079403633c183224813f95.zip | |
[OpenMP][Clang][BugFix] Split declares and math functions inclusion.
Summary: This patches fixes an issue in which the __clang_cuda_cmath.h header is being included even when cmath or math.h headers are not included.
Reviewers: jdoerfert, ABataev, hfinkel, caomhin, tra
Reviewed By: tra
Subscribers: tra, mgorny, guansong, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61765
llvm-svn: 360626
Diffstat (limited to 'clang/lib/Headers/openmp_wrappers')
4 files changed, 33 insertions, 13 deletions
diff --git a/clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h b/clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h index 4cfeb397da2..5d7ce9a965d 100644 --- a/clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h +++ b/clang/lib/Headers/openmp_wrappers/__clang_openmp_math.h @@ -23,15 +23,6 @@ #define __CUDA__ #if defined(__cplusplus) - #include <__clang_cuda_math_forward_declares.h> -#endif - -/// Include declarations for libdevice functions. -#include <__clang_cuda_libdevice_declares.h> -/// Provide definitions for these functions. -#include <__clang_cuda_device_functions.h> - -#if defined(__cplusplus) #include <__clang_cuda_cmath.h> #endif diff --git a/clang/lib/Headers/openmp_wrappers/__clang_openmp_math_declares.h b/clang/lib/Headers/openmp_wrappers/__clang_openmp_math_declares.h new file mode 100644 index 00000000000..a422c98bf97 --- /dev/null +++ b/clang/lib/Headers/openmp_wrappers/__clang_openmp_math_declares.h @@ -0,0 +1,33 @@ +/*===---- __clang_openmp_math_declares.h - OpenMP math declares ------------=== + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + *===-----------------------------------------------------------------------=== + */ + +#ifndef __CLANG_OPENMP_MATH_DECLARES_H__ +#define __CLANG_OPENMP_MATH_DECLARES_H__ + +#ifndef _OPENMP +#error "This file is for OpenMP compilation only." +#endif + +#if defined(__NVPTX__) && defined(_OPENMP) + +#define __CUDA__ + +#if defined(__cplusplus) + #include <__clang_cuda_math_forward_declares.h> +#endif + +/// Include declarations for libdevice functions. +#include <__clang_cuda_libdevice_declares.h> +/// Provide definitions for these functions. +#include <__clang_cuda_device_functions.h> + +#undef __CUDA__ + +#endif +#endif diff --git a/clang/lib/Headers/openmp_wrappers/cmath b/clang/lib/Headers/openmp_wrappers/cmath index 0f34375d45f..a5183a1d8d1 100644 --- a/clang/lib/Headers/openmp_wrappers/cmath +++ b/clang/lib/Headers/openmp_wrappers/cmath @@ -7,9 +7,7 @@ *===-----------------------------------------------------------------------=== */ -#ifndef __cplusplus #include <__clang_openmp_math.h> -#endif #ifndef __CLANG_NO_HOST_MATH__ #include_next <cmath> diff --git a/clang/lib/Headers/openmp_wrappers/math.h b/clang/lib/Headers/openmp_wrappers/math.h index d9f798943ca..d2786ecb242 100644 --- a/clang/lib/Headers/openmp_wrappers/math.h +++ b/clang/lib/Headers/openmp_wrappers/math.h @@ -7,9 +7,7 @@ *===-----------------------------------------------------------------------=== */ -#ifndef __cplusplus #include <__clang_openmp_math.h> -#endif #ifndef __CLANG_NO_HOST_MATH__ #include_next <math.h> |

