Mesa (main): meson: modernize win_flex stdint.h logic

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 2 13:50:04 UTC 2022


Module: Mesa
Branch: main
Commit: 8575d0e84bf52b17f13bba9ba4d1de90bb6608a4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8575d0e84bf52b17f13bba9ba4d1de90bb6608a4

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Jun  1 13:14:27 2022 +0200

meson: modernize win_flex stdint.h logic

Since this logic was written, we've moved to require C11, so this can
now be simplified. First of all, we no longer need to set
__STDC_VERSION__ for C code at all, because the issue that MSVC doesn't
set __STDC_VERSION__ for C99 is longer a concern. Second, we can make
the C++ check unconditional.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16812>

---

 meson.build | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/meson.build b/meson.build
index d6b49c8dd02..fe6b0c63abb 100644
--- a/meson.build
+++ b/meson.build
@@ -1916,22 +1916,16 @@ if build_machine.system() == 'windows'
     # windows compatibility (uses <io.h> instead of <unistd.h> and _isatty,
     # _fileno functions)
     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 only defines __STDC_VERSION__ for C11/C17.
+  # __STDC__ macro to determine whether it's safe to use const keyword
   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
+  # Convince win_flex to use <inttypes.h> for C++ files
+  prog_flex_cpp += '-D__STDC_VERSION__=201112'
 
   prog_bison = find_program('win_bison', required : false)
   if not prog_bison.found()



More information about the mesa-commit mailing list