[FFmpeg-devel] [PATCH] Current SVN doesn't build with gcc 4.2.x

Måns Rullgård mans
Mon Jul 2 20:19:05 CEST 2007


Bernhard Rosenkraenzer <bero at arklinux.org> writes:

> On Monday 02 July 2007, Bernhard Rosenkraenzer wrote:
>> On Monday 02 July 2007, Uoti Urpala wrote:
>> > > ffmpeg.c:118: error: initializer element is not constant.
>> >
>> > I see no such error on this machine.
>> >
>> > gcc-4.2 (GCC) 4.2.1 20070627 (prerelease) (Debian 4.2-20070627-1)
>>
>> Happens here with
>>
>> gcc (GCC) 4.2.1 20070613 (prerelease)
>>
>> So either it was fixed between 20070613 and 20070627 or Debian is applying
>> a patch...
>
> Or it's caused by compiler flags.
> I just talked to a gcc guy, this happens if gcc is run in C99 mode
> (-std=*99, even gnu99), and not if it's run in one of the
> traditional modes.
>
> Since gnu99 will be the default for gcc 4.3, the code should probably be 
> fixed.

The code is not valid C89.  I may be wrong, but I believe the C99
standard does indeed not allow that construct.

Writing (AVRational){1,25} in C99 creates an unnamed AVRational
initialised to {1,25}.  Since this unnamed object is not semantically
constant, it cannot be used as a constant initialiser.  It would be
similar to writing something like this:

static int a = 5;
static int b = a;

The above is certainly not allowed.

All those gcc extensions really ought not be enabled by default...
But that's another rant.

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




More information about the ffmpeg-devel mailing list