[PATCH] D34136: [Solaris] replace Solaris.h hack with a set of better hacks

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 13 11:04:18 PDT 2017


joerg added inline comments.


================
Comment at: include/llvm/Support/Host.h:25
+#elif defined(__sun)
+/* Solaris doesn't have endian.h. SPARC is the only supported big-endian ISA. */
+#define BIG_ENDIAN 4321
----------------
fedor.sergeev wrote:
> ro wrote:
> > joerg wrote:
> > > Can't you use sys/byteorder.h or is that post-Solaris11?
> > Wouldn't it be better to just switch LLVM to always use
> > __BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__ which are predefined by
> > both clang and gcc?  There are only a few files left using
> > BYTE_ORDER and friends.
> sys/byteorder.h on my Solaris11/Solaris12 provides only #define _LITTLE_ENDIAN/_BIG_ENDIAN, which does not really help.
> 
OK, I only have the Illumos version at hand, which uses _BIG_ENDIAN to decide whether ntohl and friends should do something or not.


================
Comment at: include/llvm/Support/Host.h:25
+#elif defined(__sun)
+/* Solaris doesn't have endian.h. SPARC is the only supported big-endian ISA. */
+#define BIG_ENDIAN 4321
----------------
joerg wrote:
> fedor.sergeev wrote:
> > ro wrote:
> > > joerg wrote:
> > > > Can't you use sys/byteorder.h or is that post-Solaris11?
> > > Wouldn't it be better to just switch LLVM to always use
> > > __BYTE_ORDER__, __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__ which are predefined by
> > > both clang and gcc?  There are only a few files left using
> > > BYTE_ORDER and friends.
> > sys/byteorder.h on my Solaris11/Solaris12 provides only #define _LITTLE_ENDIAN/_BIG_ENDIAN, which does not really help.
> > 
> OK, I only have the Illumos version at hand, which uses _BIG_ENDIAN to decide whether ntohl and friends should do something or not.
ro: I disagree since we don't require gcc or clang to build.


https://reviews.llvm.org/D34136





More information about the llvm-commits mailing list