From f2915180a6a09c10f38aed15b4aefeaa86fe12fc Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 30 Jan 2020 22:34:53 +0800 Subject: [PATCH 1/3] tests/testdnd2.c: Don't include unistd.h unconditionally Instead, on Windows when it is not available, include io.h for close() --- tests/testdnd2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/testdnd2.c b/tests/testdnd2.c index 11d604fee5..a9a2f6382f 100644 --- a/tests/testdnd2.c +++ b/tests/testdnd2.c @@ -1,6 +1,11 @@ -#include #include +#ifdef HAVE_UNISTD_H +#include +#elif defined (G_OS_WIN32) +#include +#endif + static GdkTexture * get_image_texture (GtkImage *image, int *out_size) From 69ed4c90e5ef9302304dbdce796f899b8b43c703 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Thu, 30 Jan 2020 22:35:54 +0800 Subject: [PATCH 2/3] demos/widget-factory/widget-factory.c: Include stdlib.h Include it for exit(). --- demos/widget-factory/widget-factory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c index d50143deda..bbf10e8a5d 100644 --- a/demos/widget-factory/widget-factory.c +++ b/demos/widget-factory/widget-factory.c @@ -20,6 +20,8 @@ #include "config.h" +#include + #include #include From f8d3845b1a06036c3c85b4a52d119567432349fe Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 15 Jan 2020 15:27:59 +0800 Subject: [PATCH 3/3] meson/MSVC builds: Use -utf-8 where available This avoids the build from erroring out on C4819 (Unicode handling issue in Visual Studio compiler), notably when running on Chinese, Japanese and Korean locales. Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to the C++ compiler options as well. --- meson.build | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 1c3b93aab9..6c265dd41f 100644 --- a/meson.build +++ b/meson.build @@ -223,9 +223,17 @@ endif if cc.get_id() == 'msvc' # Compiler options taken from msvc_recommended_pragmas.h # in GLib, based on _Win32_Programming_ by Rector and Newcomer - test_cflags = [] - add_project_arguments('-FImsvc_recommended_pragmas.h', language: 'c') - add_project_arguments('-D_USE_MATH_DEFINES', language: 'c') + test_cflags = [ + '-FImsvc_recommended_pragmas.h', + '-D_USE_MATH_DEFINES', + '-utf-8', + ] + add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c') + + cxx = meson.get_compiler('cpp') + if cxx.get_id() == 'msvc' + add_project_arguments(cxx.get_supported_arguments(test_cflags), language: 'cpp') + endif elif cc.get_id() == 'gcc' or cc.get_id() == 'clang' test_cflags = [ '-fno-strict-aliasing',