On 08/09/2012 11:39 AM, Chad Versace wrote:
> Fixes the following warnings:
>   ff_fragment_shader.cpp: In function 'ir_rvalue* 
> emit_texenv(texenv_fragment_program*, GLuint)':
>   ff_fragment_shader.cpp:897:3: warning: narrowing conversion of '(1 << 
> ((int)rgb_shift))' from 'int' to 'float' inside { } is ill-formed in C++11 
> [-Wnarrowing]
>   ff_fragment_shader.cpp:897:3: warning: narrowing conversion of '(1 << 
> ((int)rgb_shift))' from 'int' to 'float' inside { } is ill-formed in C++11 
> [-Wnarrowing]
>   ff_fragment_shader.cpp:897:3: warning: narrowing conversion of '(1 << 
> ((int)rgb_shift))' from 'int' to 'float' inside { } is ill-formed in C++11 
> [-Wnarrowing]
>   ff_fragment_shader.cpp:897:3: warning: narrowing conversion of '(1 << 
> ((int)alpha_shift))' from 'int' to 'float' inside { } is ill-formed in C++11 
> [-Wnarrowing]
> 
> CC: Josh Triplett <j...@joshtriplett.org>
> Signed-off-by: Chad Versace <chad.vers...@linux.intel.com>
> ---
>  src/mesa/main/ff_fragment_shader.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/mesa/main/ff_fragment_shader.cpp 
> b/src/mesa/main/ff_fragment_shader.cpp
> index f743ce1..aefd412 100644
> --- a/src/mesa/main/ff_fragment_shader.cpp
> +++ b/src/mesa/main/ff_fragment_shader.cpp
> @@ -890,10 +890,10 @@ emit_texenv(struct texenv_fragment_program *p, GLuint 
> unit)
>        }
>        else {
>        float const_data[4] = {
> -         1 << rgb_shift,
> -         1 << rgb_shift,
> -         1 << rgb_shift,
> -         1 << alpha_shift
> +        static_cast<float>(1 << rgb_shift),
> +        static_cast<float>(1 << rgb_shift),
> +        static_cast<float>(1 << rgb_shift),
> +        static_cast<float>(1 << alpha_shift)
>        };
>        shift = new(p->mem_ctx) ir_constant(glsl_type::vec4_type,
>                                            (ir_constant_data *)const_data);
> 

We should just disable that warning.  This is not C++11 code, and I
doubt it ever will be.  The fact that g++ turned that on in -Wall is stupid.

Unfortunately, that's kind of a pain right now.  We should import
XORG_TESTSET_CFLAG from xorg-util-macros...then it'd be a single line in
configure.ac.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to