From d661472529852c358f2ff441dcc396db3027075a Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 4 Jan 2023 17:05:30 +0800 Subject: generate_wrap_init.pl.in: Disable warning C4273 ... for Visual Studio builds, as GLib 2.75.x and later applied __declspec(dllimport) via macros to DLL builds of the GLib libraries, meaning that when we put the GQuark and GType function prototypes into wrap_init.cc warning C4273 will be raised as the prototypes in wrap_init.cc does not have any dllimport decorations (and would not have otherwise mattered). This allows builds with '-Dwarnings=fatal' to proceed with Visual Studio builds. --- tools/generate_wrap_init.pl.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/generate_wrap_init.pl.in b/tools/generate_wrap_init.pl.in index 50e08275..21b7b907 100644 --- a/tools/generate_wrap_init.pl.in +++ b/tools/generate_wrap_init.pl.in @@ -228,6 +228,10 @@ foreach my $filename_header (sort keys %deprecated) # Declarations of glib functions. +print "\n#ifdef _MSC_VER\n"; +print "#pragma warning( push )\n"; +print "#pragma warning( disable : 4273 ) // Disable MSVC warning C4273 in wrap_init.cc momentarily\n"; +print "#endif // _MSC_VER\n"; print "\nextern \"C\"\n"; print "{\n"; print "//Declarations of the *_get_type() functions:\n\n"; @@ -263,6 +267,9 @@ foreach my $filename_header (sort keys %exceptions) } print "} // extern \"C\"\n"; +print "\n#ifdef _MSC_VER\n"; +print "#pragma warning( pop )\n"; +print "#endif // _MSC_VER\n"; print "\n"; my $namespace_whole_declarations = ""; -- cgit v1.2.1