Page MenuHomePhabricator

[CUDA] Define __CUDACC__ before standard library headers
ClosedPublic

Authored by tambre on Apr 17 2020, 12:00 PM.

Details

Summary

libstdc++ since version 7 when GNU extensions are enabled (e.g. -std=gnu++11) use it to avoid defining overloads using __float128.
This fixes compiling with GNU extensions failing due to __float128 being used.

Discovered at https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4442#note_737136.

Diff Detail

Event Timeline

tambre created this revision.Apr 17 2020, 12:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2020, 12:00 PM
tambre edited the summary of this revision. (Show Details)Apr 17 2020, 12:01 PM
tambre edited the summary of this revision. (Show Details)
tra added inline comments.Apr 17 2020, 12:08 PM
clang/lib/Headers/__clang_cuda_runtime_wrapper.h
45

We should undef CUDACC here to make sure it does not affect anything else in the headers we include further down.

tra updated this revision to Diff 258396.Apr 17 2020, 12:26 PM

Undef CUDACC after the standard headers.

tra accepted this revision.Apr 17 2020, 12:26 PM
This revision is now accepted and ready to land.Apr 17 2020, 12:26 PM
This revision was automatically updated to reflect the committed changes.