From 6a1c7b7c2eca2d52eceb32b628a38e484f71628e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 21 Mar 2023 14:21:18 +0000 Subject: meson: Move msvc_recommended_pragmas.h to a subdirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It’s cluttering up the root directory. This should introduce no functional changes. Signed-off-by: Philip Withnall --- glib/meson.build | 4 ++++ glib/msvc_recommended_pragmas.h | 41 +++++++++++++++++++++++++++++++++++++++++ meson.build | 6 +----- msvc_recommended_pragmas.h | 41 ----------------------------------------- 4 files changed, 46 insertions(+), 46 deletions(-) create mode 100644 glib/msvc_recommended_pragmas.h delete mode 100644 msvc_recommended_pragmas.h diff --git a/glib/meson.build b/glib/meson.build index da76fc005..744275649 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -150,6 +150,10 @@ glib_headers = files( ) install_headers(glib_headers, install_dir : glib_includedir) +if host_system == 'windows' + install_headers([ 'msvc_recommended_pragmas.h' ], install_dir : glib_includedir) +endif + # Expose as variable to be used by gobject-introspection # when it includes GLib as a subproject glib_unix_h = files('glib-unix.h') diff --git a/glib/msvc_recommended_pragmas.h b/glib/msvc_recommended_pragmas.h new file mode 100644 index 000000000..051a02ae4 --- /dev/null +++ b/glib/msvc_recommended_pragmas.h @@ -0,0 +1,41 @@ +#ifndef _MSC_VER +#pragma error "This header is for Microsoft VC or clang-cl only." +#endif /* _MSC_VER */ + +/* Make MSVC more pedantic, this is a recommended pragma list + * from _Win32_Programming_ by Rector and Newcomer. + */ +#ifndef __clang__ +#pragma warning(error:4002) /* too many actual parameters for macro */ +#pragma warning(error:4003) /* not enough actual parameters for macro */ +#pragma warning(1:4010) /* single-line comment contains line-continuation character */ +#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */ +#pragma warning(1:4016) /* no function return type; using int as default */ +#pragma warning(error:4020) /* too many actual parameters */ +#pragma warning(error:4021) /* too few actual parameters */ +#pragma warning(error:4027) /* function declared without formal parameter list */ +#pragma warning(error:4029) /* declared formal parameter list different from definition */ +#pragma warning(error:4033) /* 'function' must return a value */ +#pragma warning(error:4035) /* 'function' : no return value */ +#pragma warning(error:4045) /* array bounds overflow */ +#pragma warning(error:4047) /* different levels of indirection */ +#pragma warning(error:4049) /* terminating line number emission */ +#pragma warning(error:4053) /* An expression of type void was used as an operand */ +#pragma warning(error:4071) /* no function prototype given */ +#pragma warning(disable:4101) /* unreferenced local variable */ +#pragma warning(error:4150) + +/* G_NORETURN */ +#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */ +#pragma warning(error:4715) /* 'function': not all control paths return a value */ +#pragma warning(error:4098) /* 'void' function returning a value */ + +#pragma warning(disable:4244) /* No possible loss of data warnings */ +#pragma warning(disable:4305) /* No truncation from int to char warnings */ + +#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */ +#endif /* __clang__ */ + +/* work around Microsoft's premature attempt to deprecate the C-Library */ +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_NONSTDC_NO_WARNINGS diff --git a/meson.build b/meson.build index 3576c5e6f..3027c1986 100644 --- a/meson.build +++ b/meson.build @@ -37,7 +37,7 @@ cc_can_run = meson.can_run_host_binaries() if cc.get_argument_syntax() == 'msvc' # Ignore several spurious warnings for things glib does very commonly # (also for clang-cl) - add_project_arguments('/FImsvc_recommended_pragmas.h',language : 'c') + add_project_arguments('/FIglib/msvc_recommended_pragmas.h', language : 'c') endif if cc.get_id() == 'msvc' @@ -2420,10 +2420,6 @@ endif configure_file(output : 'config.h', configuration : glib_conf) -if host_system == 'windows' - install_headers([ 'msvc_recommended_pragmas.h' ], install_dir : glib_includedir) -endif - if get_option('man') xsltproc = find_program('xsltproc', required : true) xsltproc_command = [ diff --git a/msvc_recommended_pragmas.h b/msvc_recommended_pragmas.h deleted file mode 100644 index 051a02ae4..000000000 --- a/msvc_recommended_pragmas.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _MSC_VER -#pragma error "This header is for Microsoft VC or clang-cl only." -#endif /* _MSC_VER */ - -/* Make MSVC more pedantic, this is a recommended pragma list - * from _Win32_Programming_ by Rector and Newcomer. - */ -#ifndef __clang__ -#pragma warning(error:4002) /* too many actual parameters for macro */ -#pragma warning(error:4003) /* not enough actual parameters for macro */ -#pragma warning(1:4010) /* single-line comment contains line-continuation character */ -#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */ -#pragma warning(1:4016) /* no function return type; using int as default */ -#pragma warning(error:4020) /* too many actual parameters */ -#pragma warning(error:4021) /* too few actual parameters */ -#pragma warning(error:4027) /* function declared without formal parameter list */ -#pragma warning(error:4029) /* declared formal parameter list different from definition */ -#pragma warning(error:4033) /* 'function' must return a value */ -#pragma warning(error:4035) /* 'function' : no return value */ -#pragma warning(error:4045) /* array bounds overflow */ -#pragma warning(error:4047) /* different levels of indirection */ -#pragma warning(error:4049) /* terminating line number emission */ -#pragma warning(error:4053) /* An expression of type void was used as an operand */ -#pragma warning(error:4071) /* no function prototype given */ -#pragma warning(disable:4101) /* unreferenced local variable */ -#pragma warning(error:4150) - -/* G_NORETURN */ -#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */ -#pragma warning(error:4715) /* 'function': not all control paths return a value */ -#pragma warning(error:4098) /* 'void' function returning a value */ - -#pragma warning(disable:4244) /* No possible loss of data warnings */ -#pragma warning(disable:4305) /* No truncation from int to char warnings */ - -#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */ -#endif /* __clang__ */ - -/* work around Microsoft's premature attempt to deprecate the C-Library */ -#define _CRT_SECURE_NO_WARNINGS -#define _CRT_NONSTDC_NO_WARNINGS -- cgit v1.2.1