0

I am building ffmpeg and stuck in an unusual spot. Inside libavutil we have float_dsp.h and float_dsp.c files. Inside these file there is a declaration of a methond which is:

void (*butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len);
float (*scalarproduct_float)(const float *v1, const float *v2, int len);

when building and compiling this file i get this error and have no idea what to do. I think problem is somewhere else but again have no idea at all. Error is

jni/ffmpeg/libavcodec/../libavutil/float_dsp.h:150: error: expected ';', ',' or ')'  before 'v1'
jni/ffmpeg/libavcodec/../libavutil/float_dsp.h:161: error: expected ';' before 'float'

Anybody who wants to help please take a step forward because i have not really got any support on ffmpeg during couple of weeks now.

Regards

Talha Malik
  • 1,509
  • 3
  • 22
  • 44

1 Answers1

0

This may be caused by:

  • not set GCC to C99 mode where restrict keyword is supported
  • restrict was redefined by some #define
  • restrict is not supported for particular architecture but this is unlikely
  • GCC is set to C++ mode where restrict keyword is not supported GCC according http://gcc.gnu.org/onlinedocs/gcc/Restricted-Pointers.html.

There are other supported forms by GCC like __restrict and __restrict__. ffmpeg configure script sets macro av_restrict to just restrict which can be checked in produced config.h file.

Fix could be to change configure detection code and remove invalid case restrict:

--- ./configure.orig    2014-01-15 18:53:59.000000000 +0100
+++ ./configure 2014-03-13 17:50:45.754442028 +0100
@@ -3896,7 +3896,7 @@
 EOF

 _restrict=
-for restrict_keyword in restrict __restrict__ __restrict; do
+for restrict_keyword in __restrict__ __restrict; do
     check_cc <<EOF && _restrict=$restrict_keyword && break
 void foo(char * $restrict_keyword p);
 EOF
Chronos
  • 1
  • 1