[PATCH] D50845: [CUDA/OpenMP] Define only some host macros during device compilation
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 30 11:39:52 PDT 2018
tra added a comment.
In our case the headers from a relatively old glibc and compiler errors out on this:
/* This function is used in the `isfinite' macro. */
__MATH_INLINE int
__NTH (__finite (double __x))
{
return (__extension__
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
| 0x800fffffu) + 1) >> 31));
}
expanded to this:
extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) int
__finite (double __x) throw ()
{
return (__extension__
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
| 0x800fffffu) + 1) >> 31));
}
The error:
.../include/bits/mathinline.h:945:9: error: '(anonymous union at .../include/bits/mathinline.h:945:9)' cannot be defined in a type specifier
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
^
.../include/bits/mathinline.h:945:55: error: member reference base type 'void' is not a structure or union
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
Also, whatever macros we generate do not prevent headers from using x86 inline assembly. I see quite a few inline asm code in preprocessed output. The headers are from libc ~2.19.
Repository:
rL LLVM
https://reviews.llvm.org/D50845
More information about the cfe-commits
mailing list