[FFmpeg-devel] [PATCH] indeo2.c:202:1: directives may not be used inside a macro argument (gcc 3.2)

Måns Rullgård mans
Mon Jun 4 12:00:57 CEST 2007


Guillaume POIRIER wrote:
> Hi,
>
> On 6/3/07, Christian Lohmaier <cloph at openoffice.org> wrote:
>
>> I'm not subcribed, so please CC me in replies.
>>
>> This simple patch allows to build ffmpeg with gcc 3.2.3
>> It doesn't change functionality, only moves the #ifdef out of the
>> parameter-list.
>
> Wow, that's an oldie! It was introduced 2 years ago!
> http://svn.mplayerhq.hu/ffmpeg/trunk/libavcodec/indeo2.c?r1=4144&r2=4216
>
>
>> Since I know that this compiler is pretty old, feel free to not apply
>> the patch, just as you wish.
>
> Is indeo2.c the only file that makes gcc-3.2.3 choke?
>
>> For reference, the error the compiler spits out:
>>
>> indeo2.c:202:1: directives may not be used inside a macro argument
>> indeo2.c:201:40: unterminated argument list invoking macro "init_vlc"
>> indeo2.c: In function `ir2_decode_init':
>> indeo2.c:203: `init_vlc' undeclared (first use in this function)
>> indeo2.c:203: (Each undeclared identifier is reported only once
>> indeo2.c:203: for each function it appears in.)
>> indeo2.c:203: warning: left-hand operand of comma expression has no effect
>> indeo2.c:203: warning: left-hand operand of comma expression has no effect
>> indeo2.c:203: warning: left-hand operand of comma expression has no effect
>> indeo2.c:203: syntax error before ')' token
>
> The patch seems harmless to me, but I won't apply it unless Michael
> gives his go-ahead: when compile problem like this are only reported 2
> years after the regression is introduced, you're in the right to
> assume that the environment on which it breaks (gcc-3.2.3) is seldom
> used.

The problem is new as init_vlc was only recently changed to a macro,
and preprocessing directives inside macro arguments invoke undefined
behaviour.  Apparently newer gcc versions tolerate this, but it's not
correct C.

IMO it's quite clear that the code is broken and needs to be fixed.

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




More information about the ffmpeg-devel mailing list