diff --git a/sample/watch-timing.c b/sample/watch-timing.c index a6c1d264..0ace29e2 100644 --- a/sample/watch-timing.c +++ b/sample/watch-timing.c @@ -40,17 +40,28 @@ [2] https://github.com/mergeconflict/histogram */ +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wfloat-equal" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wfloat-equal" +#endif + /** Compare two doubles for equality without the compiler warning. This is * probably the wrong thing to do, but this is just sample code :) */ static inline int eq(double a, double b) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wfloat-equal" return a == b; -#pragma GCC diagnostic pop } +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + struct bin { double centroid; unsigned long count;