Index: MicroBenchmarks/MemFunctions/main.cpp =================================================================== --- MicroBenchmarks/MemFunctions/main.cpp +++ MicroBenchmarks/MemFunctions/main.cpp @@ -24,10 +24,19 @@ #include "benchmark/benchmark.h" +#ifndef __clang__ +// GCC does not allow attributes in function definition, placing in forward declaration instead. +// Clang has the opposite behaviour. +int RealMemCmp(const char *, const char *, size_t) __attribute__((no_builtin("memcmp"))); +#endif + // This function prevents the compiler from interfering with `memcmp` and // makes sure the function is called. int RealMemCmp(const char *p, const char *q, size_t s) - __attribute__((no_builtin("memcmp"))) { +#ifdef __clang__ + __attribute__((no_builtin("memcmp"))) +#endif +{ return memcmp(p, q, s); }