[llvm-branch-commits] [clang] f36309a - Fix truncated __OPENMP_NVPTX__ preprocessor condition

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Aug 15 23:19:19 PDT 2023


Author: Ryan Burns
Date: 2023-08-16T08:18:26+02:00
New Revision: f36309a39b28ecfc515a9e2b90ac6a40ece264ad

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

LOG: Fix truncated __OPENMP_NVPTX__ preprocessor condition

I don't have a test case for this but noticed this warning when including system headers with `-I` rather than `-isystem`.

```
In file included from <built-in>:1:
In file included from /nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_runtime_wrapper.h:157:
/nix/store/jq6bpm0xmhnbffhs5rkxq4n88g5xi2zg-clang-wrapper-11.0.1/resource-root/include/__clang_cuda_math.h:39:25: warning: extra tokens at end of #ifdef directive [-Wextra-tokens]
                        ^
```

Reviewed By: tra

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

(cherry picked from commit c49142e4f5c8645a4d741d233f0cb55ef1ef87a2)

Added: 
    

Modified: 
    clang/lib/Headers/__clang_cuda_math.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/__clang_cuda_math.h b/clang/lib/Headers/__clang_cuda_math.h
index e447590393ec71..6166317f8f9d57 100644
--- a/clang/lib/Headers/__clang_cuda_math.h
+++ b/clang/lib/Headers/__clang_cuda_math.h
@@ -36,7 +36,7 @@
 // because the OpenMP overlay requires constexpr functions here but prior to
 // c++14 void return functions could not be constexpr.
 #pragma push_macro("__DEVICE_VOID__")
-#ifdef __OPENMP_NVPTX__ && defined(__cplusplus) && __cplusplus < 201402L
+#if defined(__OPENMP_NVPTX__) && defined(__cplusplus) && __cplusplus < 201402L
 #define __DEVICE_VOID__ static __attribute__((always_inline, nothrow))
 #else
 #define __DEVICE_VOID__ __DEVICE__


        


More information about the llvm-branch-commits mailing list