Merge branch 'wip/pwithnall/macos-werror' into 'main'

gutils: Disable some dead code on macOS

See merge request GNOME/glib!2345
This commit is contained in:
Emmanuele Bassi 2021-11-18 14:48:07 +00:00
commit 3ec896b6f4
5 changed files with 27 additions and 11 deletions

View File

@ -436,7 +436,6 @@ macos:
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
script:
# FIXME: Add --werror
# FIXME: Use --wrap-mode=default so we download dependencies each time,
# until the macOS runner is a VM where we can use a pre-made image which
# already contains the dependencies. See:
@ -444,6 +443,7 @@ macos:
# - https://gitlab.gnome.org/Infrastructure/Infrastructure/issues/225
- meson ${MESON_COMMON_OPTIONS}
--wrap-mode=default
--werror
_build
- ninja -C _build
# FIXME: Multiple unit tests currently fails

View File

@ -21,6 +21,8 @@
#include "gutils.h"
#include "gstrfuncs.h"
void load_user_special_dirs_macos (gchar **table);
static gchar *
find_folder (NSSearchPathDirectory type)
{

View File

@ -1368,7 +1368,7 @@ get_windows_version (gboolean with_windows)
}
#endif
#ifdef G_OS_UNIX
#if defined (G_OS_UNIX) && !defined (__APPLE__)
static gchar *
get_os_info_from_os_release (const gchar *key_name,
const gchar *buffer)
@ -1497,7 +1497,7 @@ get_os_info_from_uname (const gchar *key_name)
else
return NULL;
}
#endif
#endif /* defined (G_OS_UNIX) && !defined (__APPLE__) */
/**
* g_get_os_info:

View File

@ -553,7 +553,7 @@ test_os_info (void)
{
gchar *name;
gchar *contents = NULL;
#ifdef G_OS_UNIX
#if defined (G_OS_UNIX) && !(defined (G_OS_WIN32) || defined (__APPLE__))
struct utsname info;
#endif

View File

@ -425,31 +425,40 @@ endforeach
# Compiler flags
if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
warning_c_args = [
warning_common_args = [
'-Wduplicated-branches',
'-Wimplicit-fallthrough',
'-Wmisleading-indentation',
'-Wstrict-prototypes',
'-Wunused',
# Due to maintained deprecated code, we do not want to see unused parameters
'-Wno-unused-parameter',
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
# building with -Wbad-function-cast.
'-Wno-bad-function-cast',
'-Wno-cast-function-type',
# Due to function casts through (void*) we cannot support -Wpedantic:
# https://wiki.gnome.org/Projects/GLib/CompilerRequirements#Function_pointer_conversions.
'-Wno-pedantic',
# A zero-length format string shouldn't be considered an issue.
'-Wno-format-zero-length',
'-Werror=declaration-after-statement',
# We explicitly require variadic macros
'-Wno-variadic-macros',
'-Werror=format=2',
'-Werror=implicit-function-declaration',
'-Werror=init-self',
'-Werror=missing-include-dirs',
'-Werror=missing-prototypes',
'-Werror=pointer-arith',
]
warning_c_args = warning_common_args + [
'-Wstrict-prototypes',
# Due to pervasive use of things like GPOINTER_TO_UINT(), we do not support
# building with -Wbad-function-cast.
'-Wno-bad-function-cast',
'-Werror=declaration-after-statement',
'-Werror=implicit-function-declaration',
'-Werror=missing-prototypes',
]
warning_cxx_args = warning_common_args
warning_objc_args = warning_c_args
warning_c_link_args = [
'-Wl,-z,nodelete',
]
@ -458,10 +467,13 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
endif
else
warning_c_args = []
warning_cxx_args = []
warning_objc_args = []
warning_c_link_args = []
endif
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
# FIXME: We cannot build some of the GResource tests with -z nodelete, which
# means we cannot use that flag in add_project_link_arguments(), and must add
@ -755,6 +767,8 @@ if host_system == 'darwin'
add_languages('objc')
objcc = meson.get_compiler('objc')
add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
osx_ldflags += ['-Wl,-framework,CoreFoundation']
# Mac OS X Carbon support