diff options
Diffstat (limited to 'host')
-rw-r--r-- | host/include/uhd/config.h | 4 | ||||
-rw-r--r-- | host/include/uhd/config.hpp | 12 | ||||
-rw-r--r-- | host/include/uhd/utils/byteswap.ipp | 18 |
3 files changed, 17 insertions, 17 deletions
diff --git a/host/include/uhd/config.h b/host/include/uhd/config.h index a6c05f0c4..4aaff659b 100644 --- a/host/include/uhd/config.h +++ b/host/include/uhd/config.h @@ -39,7 +39,7 @@ typedef SSIZE_T ssize_t; #define UHD_DEPRECATED __declspec(deprecated) #define UHD_ALIGNED(x) __declspec(align(x)) #define UHD_UNUSED(x) x __attribute__((unused)) -#elif defined(__GNUC__) && __GNUC__ >= 4 +#elif defined(__clang__) #define UHD_EXPORT __attribute__((visibility("default"))) #define UHD_IMPORT __attribute__((visibility("default"))) #define UHD_EXPORT_HEADER __attribute__((visibility("default"))) @@ -48,7 +48,7 @@ typedef SSIZE_T ssize_t; #define UHD_DEPRECATED __attribute__((deprecated)) #define UHD_ALIGNED(x) __attribute__((aligned(x))) #define UHD_UNUSED(x) x __attribute__((unused)) -#elif defined(__clang__) +#elif defined(__GNUC__) && (__GNUC__ >= 4) #define UHD_EXPORT __attribute__((visibility("default"))) #define UHD_IMPORT __attribute__((visibility("default"))) #define UHD_EXPORT_HEADER __attribute__((visibility("default"))) diff --git a/host/include/uhd/config.hpp b/host/include/uhd/config.hpp index 3fae77085..a0289ca1a 100644 --- a/host/include/uhd/config.hpp +++ b/host/include/uhd/config.hpp @@ -73,7 +73,7 @@ typedef SSIZE_T ssize_t; # define UHD_FALLTHROUGH # define UHD_FUNCTION __func__ # define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__ -#elif defined(__GNUG__) && __GNUG__ >= 4 +#elif defined(__clang__) # define UHD_EXPORT __attribute__((visibility("default"))) # define UHD_IMPORT __attribute__((visibility("default"))) # define UHD_EXPORT_HEADER __attribute__((visibility("default"))) @@ -83,14 +83,14 @@ typedef SSIZE_T ssize_t; # define UHD_DEPRECATED __attribute__((deprecated)) # define UHD_ALIGNED(x) __attribute__((aligned(x))) # define UHD_UNUSED(x) x __attribute__((unused)) -# if __GNUG__ >= 7 -# define UHD_FALLTHROUGH __attribute__((fallthrough)); +# if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8) +# define UHD_FALLTHROUGH [[clang:fallthrough]]; # else # define UHD_FALLTHROUGH # endif # define UHD_FUNCTION __func__ # define UHD_PRETTY_FUNCTION __PRETTY_FUNCTION__ -#elif defined(__clang__) +#elif defined(__GNUG__) && __GNUG__ >= 4 # define UHD_EXPORT __attribute__((visibility("default"))) # define UHD_IMPORT __attribute__((visibility("default"))) # define UHD_EXPORT_HEADER __attribute__((visibility("default"))) @@ -100,8 +100,8 @@ typedef SSIZE_T ssize_t; # define UHD_DEPRECATED __attribute__((deprecated)) # define UHD_ALIGNED(x) __attribute__((aligned(x))) # define UHD_UNUSED(x) x __attribute__((unused)) -# if __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 8) -# define UHD_FALLTHROUGH [[clang:fallthrough]]; +# if __GNUG__ >= 7 +# define UHD_FALLTHROUGH __attribute__((fallthrough)); # else # define UHD_FALLTHROUGH # endif diff --git a/host/include/uhd/utils/byteswap.ipp b/host/include/uhd/utils/byteswap.ipp index 85c11b8f4..25f688693 100644 --- a/host/include/uhd/utils/byteswap.ipp +++ b/host/include/uhd/utils/byteswap.ipp @@ -29,39 +29,39 @@ UHD_INLINE uint64_t uhd::byteswap(uint64_t x) return _byteswap_uint64(x); } -#elif defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 +#elif defined(UHD_PLATFORM_MACOS) +# include <libkern/OSByteOrder.h> UHD_INLINE uint16_t uhd::byteswap(uint16_t x) { - return (x >> 8) | (x << 8); // DNE return __builtin_bswap16(x); + return OSSwapInt16(x); } UHD_INLINE uint32_t uhd::byteswap(uint32_t x) { - return __builtin_bswap32(x); + return OSSwapInt32(x); } UHD_INLINE uint64_t uhd::byteswap(uint64_t x) { - return __builtin_bswap64(x); + return OSSwapInt64(x); } -#elif defined(UHD_PLATFORM_MACOS) -# include <libkern/OSByteOrder.h> +#elif defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 3 UHD_INLINE uint16_t uhd::byteswap(uint16_t x) { - return OSSwapInt16(x); + return (x >> 8) | (x << 8); // DNE return __builtin_bswap16(x); } UHD_INLINE uint32_t uhd::byteswap(uint32_t x) { - return OSSwapInt32(x); + return __builtin_bswap32(x); } UHD_INLINE uint64_t uhd::byteswap(uint64_t x) { - return OSSwapInt64(x); + return __builtin_bswap64(x); } #elif defined(UHD_PLATFORM_LINUX) |