[FFmpeg-devel] [PATCH 2/2] avutil/cpu-test: Add includes from cpu.c
James Almer
jamrial at gmail.com
Thu May 12 00:05:22 CEST 2016
On 5/11/2016 5:34 PM, Michael Niedermayer wrote:
> config.h is needed for HAVE_*
> config.h alone breaks build
> some of the added includes may be unneccesary
>
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavutil/cpu-test.c | 33 ++++++++++++++++++++++++---------
> 1 file changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/libavutil/cpu-test.c b/libavutil/cpu-test.c
> index 3eca6d2..52a82bc 100644
> --- a/libavutil/cpu-test.c
> +++ b/libavutil/cpu-test.c
> @@ -16,19 +16,34 @@
> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> */
>
> -#include <stdio.h>
> -#include "avstring.h"
> -
> -#if !HAVE_GETOPT
> -#include "compat/getopt.c"
> -#endif
> -
> #include <stdint.h>
> -#include <stdio.h>
>
> #include "avstring.h"
> -#include "common.h"
> #include "cpu.h"
> +#include "cpu_internal.h"
> +#include "config.h"
> +#include "opt.h"
> +#include "common.h"
> +
> +#if HAVE_SCHED_GETAFFINITY
> +#ifndef _GNU_SOURCE
> +# define _GNU_SOURCE
> +#endif
> +#include <sched.h>
> +#endif
> +#if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT
> +#include <windows.h>
> +#endif
> +#if HAVE_SYSCTL
> +#if HAVE_SYS_PARAM_H
> +#include <sys/param.h>
> +#endif
> +#include <sys/types.h>
> +#include <sys/sysctl.h>
> +#endif
> +#if HAVE_UNISTD_H
> +#include <unistd.h>
> +#endif
>
> static const struct {
> int flag;
Most of those are only needed for the internal bits in cpu.c
Try instead
diff --git a/libavutil/cpu-test.c b/libavutil/cpu-test.c
index 3eca6d2..35e7631 100644
--- a/libavutil/cpu-test.c
+++ b/libavutil/cpu-test.c
@@ -17,19 +17,18 @@
*/
#include <stdio.h>
+
+#include "config.h"
+#include "cpu.h"
#include "avstring.h"
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#if !HAVE_GETOPT
#include "compat/getopt.c"
#endif
-#include <stdint.h>
-#include <stdio.h>
-
-#include "avstring.h"
-#include "common.h"
-#include "cpu.h"
-
static const struct {
int flag;
const char *name;
Compiles fine for me on mingw-w64 and ArchLinux, but you have access to more
varied machines.
More information about the ffmpeg-devel
mailing list