Fix already-defined compiler warnings by adding some #ifndef in m4/byteorder.m4

merge-requests/1/head
Reinhold Kainhofer 2011-01-06 17:51:36 +01:00
rodzic 6dc2a7d03a
commit d0097b0752
1 zmienionych plików z 36 dodań i 0 usunięć

Wyświetl plik

@ -219,10 +219,18 @@ if test "$HAVE_LE32TOH" != "1"; then
/* Define aliases for the standard byte swapping macros */
/* Arguments to these macros must be properly aligned on natural word */
/* boundaries in order to work properly on all architectures */
#ifndef htobe16
#define htobe16(x) htons(x)
#endif
#ifndef htobe32
#define htobe32(x) htonl(x)
#endif
#ifndef be16toh
#define be16toh(x) ntohs(x)
#endif
#ifndef be32toh
#define be32toh(x) ntohl(x)
#endif
#define HTOBE16(x) (x) = htobe16(x)
#define HTOBE32(x) (x) = htobe32(x)
@ -234,13 +242,25 @@ EOF
if test $ac_cv_c_bigendian = yes; then
cat >> "$ac_byteorder" << EOF
/* Define our own extended byte swapping macros for big-endian machines */
#ifndef htole16
#define htole16(x) swap16(x)
#endif
#ifndef htole32
#define htole32(x) swap32(x)
#endif
#ifndef le16toh
#define le16toh(x) swap16(x)
#endif
#ifndef le32toh
#define le32toh(x) swap32(x)
#endif
#ifndef htobe64
#define htobe64(x) (x)
#endif
#ifndef be64toh
#define be64toh(x) (x)
#endif
#define HTOLE16(x) (x) = htole16(x)
#define HTOLE32(x) (x) = htole32(x)
@ -254,12 +274,24 @@ EOF
else
cat >> "$ac_byteorder" << EOF
/* On little endian machines, these macros are null */
#ifndef htole16
#define htole16(x) (x)
#endif
#ifndef htole32
#define htole32(x) (x)
#endif
#ifndef htole64
#define htole64(x) (x)
#endif
#ifndef le16toh
#define le16toh(x) (x)
#endif
#ifndef le32toh
#define le32toh(x) (x)
#endif
#ifndef le64toh
#define le64toh(x) (x)
#endif
#define HTOLE16(x) (void) (x)
#define HTOLE32(x) (void) (x)
@ -269,8 +301,12 @@ EOF
#define LE64TOH(x) (void) (x)
/* These don't have standard aliases */
#ifndef htobe64
#define htobe64(x) swap64(x)
#endif
#ifndef be64toh
#define be64toh(x) swap64(x)
#endif
#define HTOBE64(x) (x) = htobe64(x)
#define BE64TOH(x) (x) = be64toh(x)