[libc] Only use __has_builtin on clang
authorAlex Brachet <alexbrachetmialot@gmail.com>
Sat, 28 Mar 2020 16:28:43 +0000 (12:28 -0400)
committerAlex Brachet <alexbrachetmialot@gmail.com>
Sat, 28 Mar 2020 16:28:43 +0000 (12:28 -0400)
The preprocessor reads the whole line even if the first condition of an and is false so this broke when compiling on older gcc versions which don't recognize `__has_builtin`

libc/src/string/memory_utils/memcpy_utils.h

index 7975d47..f6f283e 100644 (file)
 
 // __builtin_memcpy_inline guarantees to never call external functions.
 // Unfortunately it is not widely available.
-#if defined(__clang__) && __has_builtin(__builtin_memcpy_inline)
+#ifdef __clang__
+#if __has_builtin(__builtin_memcpy_inline)
 #define USE_BUILTIN_MEMCPY_INLINE
+#endif
 #elif defined(__GNUC__)
 #define USE_BUILTIN_MEMCPY
 #endif