Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 29 lines 1.2 kB view raw
1From 5ad351f7d271d0be0611797542c831898b2f531c Mon Sep 17 00:00:00 2001 2From: Sergei Trofimovich <slyich@gmail.com> 3Date: Sun, 11 Aug 2024 22:09:34 +0100 4Subject: [PATCH] source/test/testharness.h: don't redefine `__rdtsc()` builtin 5 6On darwin clang-16 provides `__rdtsc()` builtin. As a result the build 7fails in `nixpkgs` as: 8 9 source/test/testharness.h:78:24: error: static declaration of '__rdtsc' follows non-static declaration 10 static inline uint32_t __rdtsc(void) 11 ^ 12 x265_3.6/source/test/testharness.h:78:24: note: '__rdtsc' is a builtin with type 2 13 14The change avoid redefinition on targets that define `__rdtsc()` builtin. 15--- 16 source/test/testharness.h | 2 ++ 17 1 file changed, 2 insertions(+) 18 19--- a/test/testharness.h 20+++ b/test/testharness.h 21@@ -69,6 +69,8 @@ protected: 22 #include <intrin.h> 23 #elif HAVE_RDTSC 24 #include <intrin.h> 25+#elif defined(__has_builtin) && __has_builtin(__rdtsc) 26+/* compiler-provided builtin */ 27 #elif (!defined(__APPLE__) && (defined (__GNUC__) && (defined(__x86_64__) || defined(__i386__)))) 28 #include <x86intrin.h> 29 #elif ( !defined(__APPLE__) && defined (__GNUC__) && defined(__ARM_NEON__))