diff mbox

Do not define unimplemented functions

Message ID 1411474645-19490-1-git-send-email-cristian@samknows.com
State New
Headers show

Commit Message

Cristian Morales Vega Sept. 23, 2014, 12:17 p.m. UTC
e.g. fminf() is not implemented, only fmin(), but both are defined.

Signed-off-by: Cristian Morales Vega <cristian@samknows.com>
---
 include/math.h                             |  2 ++
 libc/sysdeps/linux/common/bits/mathcalls.h | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

Comments

Bernd Kuhls Sept. 23, 2014, 1:35 p.m. UTC | #1
Cristian Morales Vega <cristian@samknows.com> wrote in news:1411474645-19490-
1-git-send-email-cristian@samknows.com:

> e.g. fminf() is not implemented, only fmin(), but both are defined.

Hi,

this patch really fixes a build error with ffmpeg making my previous patch 
obsolete: http://git.buildroot.net/buildroot/tree/package/ffmpeg/ffmpeg-0001-
fminf.patch

Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de>

Regards, Bernd
Bernhard Reutner-Fischer Nov. 13, 2014, 7:12 p.m. UTC | #2
On 23 September 2014 15:35, Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
> Cristian Morales Vega <cristian@samknows.com> wrote in news:1411474645-19490-
> 1-git-send-email-cristian@samknows.com:
>
>> e.g. fminf() is not implemented, only fmin(), but both are defined.
>
> Hi,
>
> this patch really fixes a build error with ffmpeg making my previous patch
> obsolete: http://git.buildroot.net/buildroot/tree/package/ffmpeg/ffmpeg-0001-
> fminf.patch
>
> Tested-by: Bernd Kuhls <bernd.kuhls@t-online.de>

That sounds a bit awkward.

IIRC we deliberately do not provide wrappers for those since:
---8<---
/* For the time being, do _NOT_ implement these functions
 * that are defined by SuSv3 [because we don't need them
 * and nobody asked to include them] */
#undef L_fdimf         /*float       fdimf(float, float);*/
#undef L_fmaf          /*float       fmaf(float, float, float);*/
#undef L_fmaxf         /*float       fmaxf(float, float);*/
#undef L_fminf         /*float       fminf(float, float);*/
#undef L_nearbyintf    /*float       nearbyintf(float);*/
#undef L_nexttowardf   /*float       nexttowardf(float, long double);*/
#undef L_remquof       /*float       remquof(float, float, int *);*/
#undef L_scalblnf      /*float       scalblnf(float, long);*/
#undef L_tgammaf       /*float       tgammaf(float);*/
---8<---

Anyone got a better idea to conditionalize those other than
Christian's patch upthread?
TIA!
Bernd Kuhls Nov. 22, 2014, 10:46 a.m. UTC | #3
Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote in 
news:CAC1BbcT8GPQ7JegoYdDzY57iu4Rb5-5Fm_kvaPc8sURVmjXAqw@mail.gmail.com:

> On 23 September 2014 15:35, Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
>>
>> this patch really fixes a build error with ffmpeg
> 
> That sounds a bit awkward.
> 
> IIRC we deliberately do not provide wrappers for those

Hi,

for ffmpeg this patch is no longer needed since they fixed the problem on 
their side themselves: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=
4436a8f44dedc83767b3d9da9beb85d1fae2ca30

Regards, Bernd
Bernhard Reutner-Fischer March 18, 2015, 9:41 p.m. UTC | #4
On Sat, Nov 22, 2014 at 11:46:54AM +0100, Bernd Kuhls wrote:
> Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> wrote in 
> news:CAC1BbcT8GPQ7JegoYdDzY57iu4Rb5-5Fm_kvaPc8sURVmjXAqw@mail.gmail.com:
> 
> > On 23 September 2014 15:35, Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
> >>
> >> this patch really fixes a build error with ffmpeg
> > 
> > That sounds a bit awkward.
> > 
> > IIRC we deliberately do not provide wrappers for those
> 
> Hi,
> 
> for ffmpeg this patch is no longer needed since they fixed the problem on 
> their side themselves: http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=
> 4436a8f44dedc83767b3d9da9beb85d1fae2ca30

mesa3d seems to use fmax and fmin so i think it is best to just add
those few missing wrappers. I'll push this to master i a minute.

Thanks,
diff mbox

Patch

diff --git a/include/math.h b/include/math.h
index ecb9aa6..40dd90e 100644
--- a/include/math.h
+++ b/include/math.h
@@ -118,6 +118,7 @@  __BEGIN_DECLS
 #  define _Mfloat_		float
 # endif
 # define _Mdouble_		_Mfloat_
+# define _Mdouble_is_float_
 # ifdef __STDC__
 #  define __MATH_PRECNAME(name,r) name##f##r
 # else
@@ -126,6 +127,7 @@  __BEGIN_DECLS
 # define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
 # define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 # include <bits/mathcalls.h>
+# undef _Mdouble_is_float_
 # undef	_Mdouble_
 # undef _Mdouble_BEGIN_NAMESPACE
 # undef _Mdouble_END_NAMESPACE
diff --git a/libc/sysdeps/linux/common/bits/mathcalls.h b/libc/sysdeps/linux/common/bits/mathcalls.h
index 84b793c..4270273 100644
--- a/libc/sysdeps/linux/common/bits/mathcalls.h
+++ b/libc/sysdeps/linux/common/bits/mathcalls.h
@@ -271,7 +271,9 @@  __END_NAMESPACE_C99
 #ifdef __USE_ISOC99
 __BEGIN_NAMESPACE_C99
 /* True gamma function.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (tgamma,, (_Mdouble_))
+# endif
 __END_NAMESPACE_C99
 #endif
 
@@ -299,7 +301,9 @@  __MATHCALLI (rint,, (_Mdouble_ __x))
 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
 __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__))
 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT
+#  ifndef _Mdouble_is_float_
 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__))
+#  endif
 # endif
 
 /* Return the remainder of integer divison X / Y with infinite precision.  */
@@ -316,11 +320,15 @@  __MATHDECLI (int,ilogb,, (_Mdouble_ __x))
 
 #ifdef __USE_ISOC99
 /* Return X times (2 to the Nth power).  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (scalbln,, (_Mdouble_ __x, long int __n))
+# endif
 
 /* Round X to integral value in floating-point format using current
    rounding direction, but do not raise inexact exception.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (nearbyint,, (_Mdouble_ __x))
+# endif
 
 /* Round X to nearest integral value, rounding halfway cases away from
    zero.  */
@@ -333,7 +341,9 @@  __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__))
 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
    and magnitude congruent `mod 2^n' to the magnitude of the integral
    quotient x/y, with n >= 3.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo))
+# endif
 
 
 /* Conversion functions.  */
@@ -350,13 +360,19 @@  __MATHDECLI (long long int,llround,, (_Mdouble_ __x))
 
 
 /* Return positive difference between X and Y.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (fdim,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
 
 /* Return maximum numeric value from X and Y.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (fmax,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
 
 /* Return minimum numeric value from X and Y.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (fmin,, (_Mdouble_ __x, _Mdouble_ __y))
+# endif
 
 
 /* Classify given number.  */
@@ -367,7 +383,9 @@  __MATHDECL_PRIV (int, signbit,, (_Mdouble_ __value), (__const__))
 
 
 /* Multiply-add function computed as a ternary operation.  */
+# ifndef _Mdouble_is_float_
 __MATHCALLI (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z))
+# endif
 #endif /* Use ISO C99.  */
 
 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99