[Intel-gfx] [PATCH 1/2] Fix "always false" conditionals
Chris Wilson
chris at chris-wilson.co.uk
Sat Sep 17 00:11:30 CEST 2011
On Fri, 16 Sep 2011 18:53:01 -0300, przanoni at gmail.com wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
>
> Enums are unsigned by default in gcc and we can't rely on any specific
> signedess for the other compilers.
>
> i965_render.c: In function ‘i965_prepare_composite’:
> i965_render.c:2018:2: warning: comparison of unsigned expression < 0 is always false
> i965_render.c:2025:2: warning: comparison of unsigned expression < 0 is always false
> i965_render.c:2050:3: warning: comparison of unsigned expression < 0 is always false
> i965_render.c:2057:3: warning: comparison of unsigned expression < 0 is always false
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
> ---
> src/i965_render.c | 18 ++++++++++--------
> 1 files changed, 10 insertions(+), 8 deletions(-)
>
> I could also have defined FILTER_ERROR as -1, then gcc would have automagically
> converted the enum to signed, but I'm not sure what other compilers would do in
> this case.
That behaviour is guarranteed by the C standard. Besides which we only
have one compiler. ;-)
The extra verbosity is good, but you should also fixup all the switches
that use those enums (in preparation for -Wswitch-enum).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list