[FFmpeg-devel] [PATCH] Fix compilation on OpenBSD

Måns Rullgård mans
Wed Nov 19 23:27:06 CET 2008


Andrew Savchenko <bircoph at gmail.com> writes:

> Hi,
>
> On Thursday 20 November 2008 00:12, M?ns Rullg?rd wrote:
> [...]
>> >> And I always thought that the generic fallback define for
>> >> INFINITY would be (1.0f/0.0f), hoping the compiler would
>> >> replace it at compile time. The generic glibc code for it is
>> >> really ugly and not exactly portable...
>> >
>> > Thank you for the idea, it seems it works OK.
>> > Please review new version of the patch.
>>
>> I'm still against this patch in principle.  There really is no
>> excuse for not supporting trivial parts of a 10-year old
>> standard.
>
> You may noticed fallback definitions in the same file for another 
> mathematical constants defined in the standard you refered 
> earlier. So, I hope, there is an excuse.

Sins of the past are never an excuse for continued errors.  I would
gladly approve a patch removing those...

> Anyway this patch should harm nothing.

It makes the list of should-be-unneeded definitions longer.

That said, the patch is non-intrusive and can't harm systems that have
the definition, so I'll reluctantly accept it.

I still strongly suggest that you file a bug against the OpenBSD libc
headers.

>> > Index: libavutil/mathematics.h
>> > ==============================================================
>> >===== --- libavutil/mathematics.h	(revision 15884)
>> > +++ libavutil/mathematics.h	(working copy)
>> > @@ -40,6 +40,9 @@
>> >  #ifndef M_SQRT1_2
>> >  #define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2)
>> > */ #endif
>> > +#ifndef INFINITY
>> > +#define INFINITY       1.0f/0.0f               /* let
>> > compiler to set INFINITY value */ +#endif
>>
>> Useless comment.  The macro replacement needs ().
>
> Fixed. New version is attached.
>
> Index: libavutil/mathematics.h
> ===================================================================
> --- libavutil/mathematics.h	(revision 15884)
> +++ libavutil/mathematics.h	(working copy)
> @@ -40,6 +40,9 @@
>  #ifndef M_SQRT1_2
>  #define M_SQRT1_2      0.70710678118654752440  /* 1/sqrt(2) */
>  #endif
> +#ifndef INFINITY
> +#define INFINITY       (1.0f/0.0f)
> +#endif

OK, though I'm not maintainer of that file.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list