[Mesa-dev] [PATCH 17/17] glsl: Suppress sign-compare warning generated by flex 2.6.1.

Ian Romanick idr at freedesktop.org
Mon Feb 12 19:59:05 UTC 2018


Supposedly later versions of flex fix this... or so I heard.

On 02/10/2018 08:33 AM, Eric Anholt wrote:
> I got the following warning:
> 
> src/compiler/glsl/glsl_lexer.cpp:1521:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
>    for ( n = 0; n < max_size && \
> src/compiler/glsl/glsl_lexer.cpp:3448:3: note: in expansion of macro ‘YY_INPUT’
>    YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
>    ^~~~~~~~
> 
> and it doesn't look like something from our code.  Just silence it.
> ---
>  src/compiler/glsl/meson.build | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
> index 26ab4f1c8d3a..12bf545132fd 100644
> --- a/src/compiler/glsl/meson.build
> +++ b/src/compiler/glsl/meson.build
> @@ -199,13 +199,20 @@ files_libglsl_standalone = files(
>    'standalone.h',
>  )
>  
> +# flex 2.6.1 generates code with sign-compare warnings
> +glsl_lexer_warnings_suppressed = static_library('glsl-lexer',
> +  glsl_lexer_cpp,
> +  cpp_args : [cpp_vis_args, cpp_msvc_compat_args, '-Wno-sign-compare'],
> +  include_directories : [inc_common, inc_compiler, inc_nir],
> +)
> +
>  libglsl = static_library(
>    'glsl',
> -  [files_libglsl, glsl_parser, glsl_lexer_cpp, ir_expression_operation_h,
> +  [files_libglsl, glsl_parser, ir_expression_operation_h,
>     ir_expression_operation_strings_h, ir_expression_operation_constant_h],
>    c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
>    cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
> -  link_with : libglcpp,
> +  link_with : [libglcpp, glsl_lexer_warnings_suppressed],
>    include_directories : [inc_common, inc_compiler, inc_nir],
>    dependencies : idep_nir,
>    build_by_default : false,
> 



More information about the mesa-dev mailing list