[glib] meson.build: Improve checks for va_copy() and __va_copy()
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] meson.build: Improve checks for va_copy() and __va_copy()
- Date: Mon, 17 Jul 2017 06:51:24 +0000 (UTC)
commit 5ba3b4022ebda9e1756d568b7baac7f285bfc0b4
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jul 17 12:49:24 2017 +0800
meson.build: Improve checks for va_copy() and __va_copy()
On Visual Studio, the compilation of the check program for va_copy() and
__va_copy() succeeds even though they may not be really available. So,
make sure we include msvc_recommended_pragmas.h which helps us to detect
this situation by bailing out when warning C4013 (which means this
function is really not available) is encountered.
Also make sure that on Visual Studio builds we always include
msvc_recommended_pragmas.h is included so that it helps us to find out
problems in the build, and update comments for dirent.h and sys/time.h
as they are not shipped with any Visual Studio.
https://bugzilla.gnome.org/show_bug.cgi?id=783270
meson.build | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 542890e..bbb8138 100644
--- a/meson.build
+++ b/meson.build
@@ -15,8 +15,8 @@ if cc.get_id() == 'msvc'
# If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
# If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
# NOTE: Only add warnings here if you are sure they're spurious
- add_project_arguments('/wd4244', '/wd4305', '/wd4035', '/wd4715', '/wd4116',
- '/wd4046', '/wd4068', '/wo4090', language : 'c')
+ add_project_arguments('/wd4035', '/wd4715', '/wd4116',
+ '/wd4046', '/wd4068', '/wo4090', '/FImsvc_recommended_pragmas.h',language : 'c')
# Disable SAFESEH with MSVC for plugins and libs that use external deps that
# are built with MinGW
noseh_link_args = ['/SAFESEH:NO']
@@ -163,8 +163,8 @@ headers = [
'fstab.h',
'linux/magic.h',
'termios.h',
- 'dirent.h', # Some versions of MSC lack these
- 'sys/time.h', # Some versions of MSC lack these
+ 'dirent.h', # MSC does not come with this by default
+ 'sys/time.h', # MSC does not come with this by default
'sys/times.h',
'sys/wait.h',
'unistd.h',
@@ -1017,9 +1017,13 @@ endif
# we currently check for all three va_copy possibilities, so we get
# all results in config.log for bug reports.
+va_copy_func = ''
foreach try_func : [ '__va_copy', 'va_copy' ]
if cc.compiles('''#include <stdarg.h>
#include <stdlib.h>
+ #ifdef _MSC_VER
+ # include "msvc_recommended_pragmas.h"
+ #endif
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
@@ -1036,8 +1040,12 @@ foreach try_func : [ '__va_copy', 'va_copy' ]
va_copy_func = try_func
endif
endforeach
-glib_conf.set('G_VA_COPY', va_copy_func)
-glib_vacopy = '#define G_VA_COPY ' + va_copy_func
+if va_copy_func != ''
+ glib_conf.set('G_VA_COPY', va_copy_func)
+ glib_vacopy = '#define G_VA_COPY ' + va_copy_func
+else
+ glib_vacopy = '/* #undef G_VA_COPY */'
+endif
va_list_val_copy_prog = '''
#include <stdarg.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]