build fails on Solaris 11.2 with g++ 4.8.2

Hello,

I have two problems building llvm on Solaris 11.2 using g++ 4.8.2.
1) there is predefined macro #define SEC 1(in /usr/include/sys/time.h) which breaks macro expansion in ARMArchExtName.def
2) isinf/isnan are macros as well from /usr/include/iso/math_c99.h expanding to
__builtin_isinf/__builtin_isnan so they are not from std and breaks APTFloatTest.cpp

It would be nice if you review and apply patch which fixes build on Solaris.

Thanks!
Vladimir.

Solaris_g++4.8.patch (1.52 KB)

is SEC conflicting with something?

+#undef SEC

Wouldn't renaming it be better?

cmath is supposed to handle that.

Joerg

I don't know how important to have enumerator named SEC in enum ArchExtKind (in file llvm/lib/Target/ARM/ARMArchExtName.h).
But it includes llvm/lib/Target/ARM/ARMArchExtName.def as
namespace llvm {
namespace ARM {

enum ArchExtKind {
   INVALID_ARCHEXT = 0

#define ARM_ARCHEXT_NAME(NAME, ID) , ID
#include "ARMArchExtName.def"
};

} // namespace ARM
} // namespace llvm

I just see ARMArchExtName.def has:
ARM_ARCHEXT_NAME("sec", SEC)

And it conflicts with system macro SEC on Solaris

So, someone should decide, i.e. by analyzing usage of SEC enumerator in
llvm/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp: GetArchExtName

May be it make sense to prefix all IDs in ARMArchExtName.def with ARM_EXT_ or similar, like
ARM_ARCHEXT_NAME("sec", ARM_EXT_SEC)

Vladimir.

2) isinf/isnan are macros as well from /usr/include/iso/math_c99.h expanding to
__builtin_isinf/__builtin_isnan so they are not from std and breaks APTFloatTest.cpp

cmath is supposed to handle that.

But it is not on Solaris for g++ 4.8.2 with the current compile flags.
cmath has isinf/isnan in dead code:
#if _GLIBCXX_USE_C99_MATH
#if !_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
...
namespace std _GLIBCXX_VISIBILITY(default)
{
...
   constexpr bool
   isinf(float __x)
   { return __builtin_isinf(__x); }
}

#endif

Probably test should be compiled with some different flags on Solaris?

Thanks,
Vladimir.