mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-01-22 05:33:55 +08:00
meson: Fix winflexbison warnings
Undefine __STDC_VERSION__ for C files to avoid mismatch with C11/C17. Define __STDC_VERSION__ for C++ files to use <inttypes.h> path. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10196>
This commit is contained in:
parent
5b8a4516e6
commit
75d8998f7c
14
meson.build
14
meson.build
@ -1734,15 +1734,24 @@ if build_machine.system() == 'windows'
|
||||
if prog_flex.found()
|
||||
# windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
|
||||
# _fileno functions)
|
||||
prog_flex = [prog_flex, '--wincompat', '-D__STDC_VERSION__=199901']
|
||||
prog_flex = [prog_flex, '--wincompat']
|
||||
if get_option('c_std') == 'c99'
|
||||
prog_flex += '-D__STDC_VERSION__=199901'
|
||||
endif
|
||||
else
|
||||
prog_flex = [find_program('flex', 'lex', required : with_any_opengl)]
|
||||
endif
|
||||
# Force flex to use const keyword in prototypes, as relies on __cplusplus or
|
||||
# __STDC__ macro to determine whether it's safe to use const keyword, but
|
||||
# MSVC never defines __STDC__ unless we disable all MSVC extensions.
|
||||
# MSVC only defines __STDC_VERSION__ for C11/C17.
|
||||
prog_flex += '-DYY_USE_CONST='
|
||||
|
||||
prog_flex_cpp = prog_flex
|
||||
if get_option('c_std') != 'c99'
|
||||
# Convince win_flex to use <inttypes.h> for C++ files
|
||||
prog_flex_cpp += '-D__STDC_VERSION__=199901'
|
||||
endif
|
||||
|
||||
prog_bison = find_program('win_bison', required : false)
|
||||
if not prog_bison.found()
|
||||
prog_bison = find_program('bison', 'yacc', required : with_any_opengl)
|
||||
@ -1763,6 +1772,7 @@ else
|
||||
endif
|
||||
|
||||
prog_flex = find_program('flex', required : with_any_opengl)
|
||||
prog_flex_cpp = prog_flex
|
||||
endif
|
||||
|
||||
dep_selinux = null_dep
|
||||
|
@ -44,7 +44,7 @@ glsl_lexer_cpp = custom_target(
|
||||
'glsl_lexer_cpp',
|
||||
input : 'glsl_lexer.ll',
|
||||
output : 'glsl_lexer.cpp',
|
||||
command : [prog_flex, '-o', '@OUTPUT@', '@INPUT@'],
|
||||
command : [prog_flex_cpp, '-o', '@OUTPUT@', '@INPUT@'],
|
||||
)
|
||||
|
||||
ir_expression_operation_constant_h = custom_target(
|
||||
|
Loading…
Reference in New Issue
Block a user