shithub: opus

Download patch

ref: 6ba284f22feeedb394697d112cf1da80c77bb5a4
parent: 2654707e86cc94413998976d179b2ab4a2aa3114
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Sat Apr 2 11:18:07 EDT 2022

Fix lrint/lrintf detection

Prevents using lrint/lrintf when compiling with -std=c90 even though the
functions are in libm. This was causing tests to fail, likely due to
incorrect prototypes.

--- a/celt/float_cast.h
+++ b/celt/float_cast.h
@@ -99,7 +99,7 @@
                 return intgr ;
         }
 
-#elif defined(HAVE_LRINTF)
+#elif defined(HAVE_LRINTF) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 /*      These defines enable functionality introduced with the 1999 ISO C
 **      standard. They must be defined before the inclusion of math.h to
@@ -117,7 +117,7 @@
 #include <math.h>
 #define float2int(x) lrintf(x)
 
-#elif (defined(HAVE_LRINT))
+#elif defined(HAVE_LRINT) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
 #define _ISOC9X_SOURCE 1
 #define _ISOC99_SOURCE 1