build-sys: drop -mms-bitfields GCC flag

This flag is problematic for some usages, and is no longer needed since
~2012 GCC 4.7 (https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=a6c467624ade35128)

It is dropped from MINGW since:
https://github.com/msys2/MINGW-packages/pull/12891

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2023-07-24 14:40:41 +04:00
parent 741a561c4d
commit 252bbcd207
3 changed files with 5 additions and 13 deletions

View File

@ -65,10 +65,10 @@ Building software that just *uses* GLib or GTK also require to have
the right compiler set up the right way. If you intend to use MinGW-GCC, the right compiler set up the right way. If you intend to use MinGW-GCC,
follow the relevant instructions below in that case, too. follow the relevant instructions below in that case, too.
You should link to GLib using the `-mms-bitfields` GCC flag. This flag means You should link to GLib using the `-mms-bitfields` GCC flag. It is the default
that the struct layout rules are identical to those used by MSVC. This is since 2012 (GCC 4.7). This flag means that the struct layout rules are identical
essential if the same DLLs are to be usable both from gcc- and MSVC-compiled to those used by MSVC. This is essential if the same DLLs are to be usable both
code. from gcc- and MSVC-compiled code.
## Cross-CRT issues ## Cross-CRT issues

View File

@ -443,7 +443,7 @@ pkg.generate(libglib,
libraries : [libintl_deps], libraries : [libintl_deps],
libraries_private : [win32_ldflags], libraries_private : [win32_ldflags],
subdirs : ['glib-2.0'], subdirs : ['glib-2.0'],
extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags, extra_cflags : ['-I${libdir}/glib-2.0/include'],
variables : [ variables : [
'bindir=' + '${prefix}' / get_option('bindir'), 'bindir=' + '${prefix}' / get_option('bindir'),
'datadir=' + '${prefix}' / get_option('datadir'), 'datadir=' + '${prefix}' / get_option('datadir'),

View File

@ -50,7 +50,6 @@ if cc.get_id() == 'msvc'
noseh_link_args = ['/SAFESEH:NO'] noseh_link_args = ['/SAFESEH:NO']
else else
noseh_link_args = [] noseh_link_args = []
# -mms-bitfields vs -fnative-struct ?
endif endif
host_system = host_machine.system() host_system = host_machine.system()
@ -2339,15 +2338,8 @@ else
export_dynamic_cflags = ['-Wl,--export-dynamic'] export_dynamic_cflags = ['-Wl,--export-dynamic']
endif endif
win32_cflags = []
win32_ldflags = [] win32_ldflags = []
if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl' if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
# Ensure MSVC-compatible struct packing convention is used when
# compiling for Win32 with gcc. It is used for the whole project and exposed
# in glib-2.0.pc.
win32_cflags = ['-mms-bitfields']
add_project_arguments(win32_cflags, language : 'c')
# Win32 API libs, used only by libglib and exposed in glib-2.0.pc # Win32 API libs, used only by libglib and exposed in glib-2.0.pc
win32_ldflags = ['-lws2_32', '-lole32', '-lwinmm', '-lshlwapi', '-luuid'] win32_ldflags = ['-lws2_32', '-lole32', '-lwinmm', '-lshlwapi', '-luuid']
elif host_system == 'cygwin' elif host_system == 'cygwin'