From a64f72c6c388ad64518c41d56811cb5cb65aa7a7 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Fri, 25 Oct 2024 18:35:35 +0200 Subject: [PATCH] util: Fix copysign redefinition --- src/util/nlopt-util.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/nlopt-util.h b/src/util/nlopt-util.h index e9c49f95..40963b7f 100644 --- a/src/util/nlopt-util.h +++ b/src/util/nlopt-util.h @@ -37,11 +37,13 @@ #endif #ifndef HAVE_COPYSIGN +#if !defined(__cplusplus) && __STDC_VERSION__ < 199901 /* not quite right for y == -0, but good enough for us */ # define copysign(x, y) ((y) < 0 ? -fabs(x) : fabs(x)) -#elif !defined(__cplusplus) && __STDC_VERSION__ < 199901 +#else extern double copysign(double x, double y); /* may not be declared in C89 */ #endif +#endif #ifdef __cplusplus extern "C" {