On 2024-05-16 23:25, Collin Funk wrote:
Hi Paul,
On 5/16/24 10:16 PM, Paul Eggert wrote:
+#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.
Oops, I wasn't aware of this. Was that a bug in old versions?
No, it was expected behavior before __has_builtin was standardized, the
same behavior you'd get now with "#if defined FOO && FOO (x)" when FOO
is not defined.