About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonggang Luo <luoyonggang@gmail.com>2025-09-22 23:28:11 +0800
committerMarge Bot <marge-bot@fdo.invalid>2025-09-24 18:13:03 +0000
commit00783d821dda27ce4e918ab5c1beff794ce73a5b (patch)
tree587c5cbcf7ba3d6ad28e3f02c2118913f99660c7
parenta8470a3c1ccf044a5145b80dbef9b161a68f28d2 (diff)
meson/util: Define _GNU_SOURCE for mingw
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13944 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13906 Even though use -Dc_std=gnu18 -Dcpp_std=gnu++20 can also compile with mingw, but for not bothering user, let's us define _GNU_SOURCE for mingw, and it's also expose more functional that exists in mingw As it's not a fixes just a improve so have no fixes in commit message Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Tested-by: Vinson Lee <vlee@freedesktop.org> Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37514>
-rw-r--r--meson.build3
-rw-r--r--src/util/u_string.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index 08f24f53933..5d6ee648f24 100644
--- a/meson.build
+++ b/meson.build
@@ -1090,6 +1090,9 @@ elif host_machine.system() == 'windows'
'-D_UCRT_NOISY_NAN', # https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907?viewtype=all
]
else
+ # MINGW also accept _GNU_SOURCE
+ pre_args += '-D_GNU_SOURCE'
+
# When the target is not (mingw with ucrt)
# NOTE: clang's stddef.h are conflict with mingw or ucrt's stddef.h
# So do not include headers that defined in clang for detecting
diff --git a/src/util/u_string.h b/src/util/u_string.h
index 73d5c3be3e4..093101af8a0 100644
--- a/src/util/u_string.h
+++ b/src/util/u_string.h
@@ -50,7 +50,7 @@
extern "C" {
#endif
-#if !defined(_GNU_SOURCE) || defined(__APPLE__)
+#if !defined(_GNU_SOURCE) || defined(__APPLE__) || defined(DETECT_OS_WINDOWS)
#define strchrnul util_strchrnul
static inline char *