+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) \ + || (defined __has_builtin && __has_builtin (__builtin_bswap32))
Unfortunately this usage is not portable, not for __has_builtin or for any of the other __has_XX primitives. This is because older compilers will replace "defined __has_builtin && __has_builtin (__builtin_bswap32)" with "1 && 0 (__builtin_bswap32)" and then complain about the bad syntax.
You can safely use __has_builtin (X) only inside a block that is protected by checking that __has_builtin is defined. See stdbit.in.h for an example.