summaryrefslogtreecommitdiffstats
path: root/Utilities
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-10-23 14:24:47 (GMT)
committerBrad King <brad.king@kitware.com>2015-10-28 12:44:47 (GMT)
commit43d577dcb9e29842c91073056ca400963d6bee0e (patch)
tree0f710af0424ad8dda6657da141a7884e4a1447a0 /Utilities
parent85e0bb84f5eca2f77f070bce9f83024854096307 (diff)
downloadCMake-43d577dcb9e29842c91073056ca400963d6bee0e.zip
CMake-43d577dcb9e29842c91073056ca400963d6bee0e.tar.gz
CMake-43d577dcb9e29842c91073056ca400963d6bee0e.tar.bz2
libarchive: Test for Clang builtin before using it
The __builtin_bswap16 builtin is not available on Clang 2.1.
Diffstat (limited to 'Utilities')
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
index c359d83..eff02d8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_lha.c
@@ -1712,10 +1712,13 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
for (;len >= 8; len -= 8) {
/* This if statement expects compiler optimization will
* remove the stament which will not be executed. */
+#ifndef __has_builtin
+# define __has_builtin(x) 0
+#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
# define bswap16(x) _byteswap_ushort(x)
#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \
- || defined(__clang__)
+ || (defined(__clang__) && __has_builtin(__builtin_bswap16))
# define bswap16(x) __builtin_bswap16(x)
#else
# define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8))