[FFmpeg-devel] [PATCH] Simplify checks for particular GCC versions.

Måns Rullgård mans
Sat Oct 4 00:49:33 CEST 2008


Diego 'Flameeyes' Petten? <flameeyes at gmail.com> writes:

> Instead of expanding the same check for GCC every time, create a macro
> FF_GCC_ATLEAST that can be used to check for a particular GCC version.
>
> The FF_GCC_ATLEAST test ignores whatever ICC provides, since it does
> not support the full feature set of the GCC it fakes to provide.
> ---
>
> diff --git a/libavutil/common.h b/libavutil/common.h
> index 42fe951..827b187 100644
> --- a/libavutil/common.h
> +++ b/libavutil/common.h
> @@ -41,8 +41,16 @@
>  #    include <math.h>
>  #endif /* HAVE_AV_CONFIG_H */
>
> +#if defined(__ICC) || !defined(__GNUC__)
> +# define FF_GCC_ATLEAST(maj,min,micro) 0
> +#else
> +# define FF_GCC_ATLEAST(maj,min,micro) (                                \
> +  ((__GNUC__ << 24) + (__GNUC_MINOR__ << 16) + __GNUC_PATCHLEVEL__)     \
> +  >= ((maj << 24 ) + (min << 16) + micro) )
> +#endif

The order of tests here looks very strange, as does the line wrapping.
Moreover, I suspect there is some version of gcc that icc is fully
compatible with, at least in ways relevant to us.  Defining this could
obviate the need for explicit __ICC tests in some other places,
rendering the code simpler and easier to maintain.

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




More information about the ffmpeg-devel mailing list