[FFmpeg-devel] [PATCH] Tell gcc not to "suggest" unnecessary parentheses

Rafaël Carré rafael.carre
Sat Jul 3 21:59:31 CEST 2010


On Sat, 3 Jul 2010 12:20:17 -0700
Eli Friedman <eli.friedman at gmail.com> wrote:

Hi,

> >> If I may give a suggestion, keep the warning as it can help
> >> spotting
> >>
> >> if ( foo = 1 )
> >>
> >> where the assignment wasn't intended.
> >
> > does our patcheck check for this?
> 
> Not at the moment... I'd write a patch, but my regex skills aren't
> quite up to the task.

I think "[^\(]\([^\(].*[^=]=[^=]" should do the trick:

It should match one single opening parenthesis and one single = in the
same line.

Depending on code conventions it could have some false positives like:
if 	(AAA 	&&	\
	(x = y) &&	\
	BBB)

HTH,

-- 
Rafa?l Carr?



More information about the ffmpeg-devel mailing list