[PATCH] D95299: Fix truncated __OPENMP_NVPTX__ preprocessor condition

Ryan Burns via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 23 15:03:12 PST 2021


r-burns created this revision.
Herald added subscribers: guansong, yaxunl.
r-burns requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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]
  #ifdef __OPENMP_NVPTX__ && defined(__cplusplus) && __cplusplus < 201402L
                          ^


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95299

Files:
  clang/lib/Headers/__clang_cuda_math.h


Index: clang/lib/Headers/__clang_cuda_math.h
===================================================================
--- clang/lib/Headers/__clang_cuda_math.h
+++ 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__


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95299.318793.patch
Type: text/x-patch
Size: 657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210123/c7dff2e3/attachment.bin>


More information about the cfe-commits mailing list