mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
ci: fix warnings and enable --werror for the mingw build
Fix various warnings regarding unused variables, duplicated branches etc by adjusting the ifdeffery and some missing casts. gnulib triggers -Wduplicated-branches in one of the copied files, disable as that just makes updating the code harder. The warning indicating missing features are made none fatal through pragmas. They still show but don't abort the build. https://bugzilla.gnome.org/show_bug.cgi?id=793729
This commit is contained in:
parent
995f75cdd7
commit
97c28f7fe1
@ -26,8 +26,7 @@ mkdir -p _ccache
|
|||||||
export CCACHE_BASEDIR="$(pwd)"
|
export CCACHE_BASEDIR="$(pwd)"
|
||||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||||
|
|
||||||
# FIXME: Add --werror
|
meson --werror --buildtype debug _build
|
||||||
meson --buildtype debug _build
|
|
||||||
cd _build
|
cd _build
|
||||||
ninja
|
ninja
|
||||||
|
|
||||||
|
@ -95,7 +95,10 @@ struct _GCredentials
|
|||||||
ucred_t *native;
|
ucred_t *native;
|
||||||
#else
|
#else
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic warning "-Wcpp"
|
||||||
#warning Please add GCredentials support for your OS
|
#warning Please add GCredentials support for your OS
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -348,7 +348,10 @@ mechanism_client_initiate (GDBusAuthMechanism *mechanism,
|
|||||||
*out_initial_response_len = strlen (initial_response);
|
*out_initial_response_len = strlen (initial_response);
|
||||||
#elif defined(G_OS_WIN32)
|
#elif defined(G_OS_WIN32)
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic warning "-Wcpp"
|
||||||
#warning Dont know how to send credentials on this OS. The EXTERNAL D-Bus authentication mechanism will not work.
|
#warning Dont know how to send credentials on this OS. The EXTERNAL D-Bus authentication mechanism will not work.
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_REJECTED;
|
m->priv->state = G_DBUS_AUTH_MECHANISM_STATE_REJECTED;
|
||||||
#endif
|
#endif
|
||||||
|
@ -280,7 +280,10 @@ ensure_keyring_directory (GError **error)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic warning "-Wcpp"
|
||||||
#warning Please implement permission checking on this non-UNIX platform
|
#warning Please implement permission checking on this non-UNIX platform
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -2819,7 +2819,9 @@ g_local_file_measure_size_of_file (gint parent_fd,
|
|||||||
if (S_ISDIR (buf.st_mode))
|
if (S_ISDIR (buf.st_mode))
|
||||||
{
|
{
|
||||||
int dir_fd = -1;
|
int dir_fd = -1;
|
||||||
|
#ifdef AT_FDCWD
|
||||||
int errsv;
|
int errsv;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (g_cancellable_set_error_if_cancelled (state->cancellable, error))
|
if (g_cancellable_set_error_if_cancelled (state->cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -897,19 +897,21 @@ get_access_rights (GFileAttributeMatcher *attribute_matcher,
|
|||||||
writable = FALSE;
|
writable = FALSE;
|
||||||
if (parent_info->writable)
|
if (parent_info->writable)
|
||||||
{
|
{
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
writable = TRUE;
|
||||||
|
#else
|
||||||
if (parent_info->is_sticky)
|
if (parent_info->is_sticky)
|
||||||
{
|
{
|
||||||
#ifndef G_OS_WIN32
|
|
||||||
uid_t uid = geteuid ();
|
uid_t uid = geteuid ();
|
||||||
|
|
||||||
if (uid == statbuf->st_uid ||
|
if (uid == statbuf->st_uid ||
|
||||||
uid == parent_info->owner ||
|
uid == parent_info->owner ||
|
||||||
uid == 0)
|
uid == 0)
|
||||||
#endif
|
|
||||||
writable = TRUE;
|
writable = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
writable = TRUE;
|
writable = TRUE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_RENAME))
|
if (_g_file_attribute_matcher_matches_id (attribute_matcher, G_FILE_ATTRIBUTE_ID_ACCESS_CAN_RENAME))
|
||||||
|
@ -129,7 +129,7 @@ g_local_vfs_parse_name (GVfs *vfs,
|
|||||||
GFile *file;
|
GFile *file;
|
||||||
char *filename;
|
char *filename;
|
||||||
char *user_prefix;
|
char *user_prefix;
|
||||||
const char *user_start, *user_end;
|
const char *user_end;
|
||||||
char *rest;
|
char *rest;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_VFS (vfs), NULL);
|
g_return_val_if_fail (G_IS_VFS (vfs), NULL);
|
||||||
@ -141,19 +141,22 @@ g_local_vfs_parse_name (GVfs *vfs,
|
|||||||
{
|
{
|
||||||
if (*parse_name == '~')
|
if (*parse_name == '~')
|
||||||
{
|
{
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
|
const char *user_start;
|
||||||
|
user_start = parse_name + 1;
|
||||||
|
#endif
|
||||||
parse_name ++;
|
parse_name ++;
|
||||||
user_start = parse_name;
|
|
||||||
|
|
||||||
while (*parse_name != 0 && *parse_name != '/')
|
while (*parse_name != 0 && *parse_name != '/')
|
||||||
parse_name++;
|
parse_name++;
|
||||||
|
|
||||||
user_end = parse_name;
|
user_end = parse_name;
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
if (user_end == user_start)
|
if (user_end == user_start)
|
||||||
user_prefix = g_strdup (g_get_home_dir ());
|
user_prefix = g_strdup (g_get_home_dir ());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef G_OS_UNIX
|
|
||||||
struct passwd *passwd_file_entry;
|
struct passwd *passwd_file_entry;
|
||||||
char *user_name;
|
char *user_name;
|
||||||
|
|
||||||
@ -165,9 +168,11 @@ g_local_vfs_parse_name (GVfs *vfs,
|
|||||||
passwd_file_entry->pw_dir != NULL)
|
passwd_file_entry->pw_dir != NULL)
|
||||||
user_prefix = g_strdup (passwd_file_entry->pw_dir);
|
user_prefix = g_strdup (passwd_file_entry->pw_dir);
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
user_prefix = g_strdup (g_get_home_dir ());
|
user_prefix = g_strdup (g_get_home_dir ());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
user_prefix = g_strdup (g_get_home_dir ());
|
||||||
|
#endif
|
||||||
|
|
||||||
rest = NULL;
|
rest = NULL;
|
||||||
if (*user_end != 0)
|
if (*user_end != 0)
|
||||||
|
@ -1800,7 +1800,7 @@ watch_thread_function (LPVOID parameter)
|
|||||||
* likely to block (only when changing notification subscriptions).
|
* likely to block (only when changing notification subscriptions).
|
||||||
*/
|
*/
|
||||||
event = g_slice_new (RegistryEvent);
|
event = g_slice_new (RegistryEvent);
|
||||||
event->self = g_object_ref (self->owner);
|
event->self = G_REGISTRY_BACKEND (g_object_ref (self->owner));
|
||||||
event->prefix = g_strdup (prefix);
|
event->prefix = g_strdup (prefix);
|
||||||
event->items = g_ptr_array_new_with_free_func (g_free);
|
event->items = g_ptr_array_new_with_free_func (g_free);
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ g_socket (gint domain,
|
|||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
int errsv = get_socket_errno ();
|
errsv = get_socket_errno ();
|
||||||
|
|
||||||
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
|
g_set_error (error, G_IO_ERROR, socket_io_error_from_errno (errsv),
|
||||||
_("Unable to create socket: %s"), socket_strerror (errsv));
|
_("Unable to create socket: %s"), socket_strerror (errsv));
|
||||||
@ -3251,7 +3251,7 @@ g_socket_send_with_timeout (GSocket *socket,
|
|||||||
{
|
{
|
||||||
win32_unset_event_mask (socket, FD_WRITE);
|
win32_unset_event_mask (socket, FD_WRITE);
|
||||||
|
|
||||||
if ((ret = send (socket->priv->fd, buffer, size, G_SOCKET_DEFAULT_SEND_FLAGS)) < 0)
|
if ((ret = send (socket->priv->fd, (const char *)buffer, size, G_SOCKET_DEFAULT_SEND_FLAGS)) < 0)
|
||||||
{
|
{
|
||||||
int errsv = get_socket_errno ();
|
int errsv = get_socket_errno ();
|
||||||
|
|
||||||
|
@ -1533,7 +1533,6 @@ static gboolean
|
|||||||
win32_is_pipe_tty (int fd)
|
win32_is_pipe_tty (int fd)
|
||||||
{
|
{
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
int error;
|
|
||||||
HANDLE h_fd;
|
HANDLE h_fd;
|
||||||
FILE_NAME_INFO *info = NULL;
|
FILE_NAME_INFO *info = NULL;
|
||||||
gint info_size = sizeof (FILE_NAME_INFO) + sizeof (WCHAR) * MAX_PATH;
|
gint info_size = sizeof (FILE_NAME_INFO) + sizeof (WCHAR) * MAX_PATH;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# glib enables -Werror=format-nonliteral by default, but the embedded gnulib
|
# glib enables -Werror=format-nonliteral by default, but the embedded gnulib
|
||||||
# needs to handle user provided format strings.
|
# needs to handle user provided format strings.
|
||||||
extra_gnulib_args = cc.get_supported_arguments(['-Wno-format-nonliteral'])
|
extra_gnulib_args = cc.get_supported_arguments([
|
||||||
|
'-Wno-format-nonliteral', '-Wno-duplicated-branches'])
|
||||||
|
|
||||||
gnulib_lib = static_library('gnulib', 'asnprintf.c', 'printf.c', 'printf-args.c', 'printf-parse.c', 'vasnprintf.c',
|
gnulib_lib = static_library('gnulib', 'asnprintf.c', 'printf.c', 'printf-args.c', 'printf-parse.c', 'vasnprintf.c',
|
||||||
include_directories : [configinc, glibinc],
|
include_directories : [configinc, glibinc],
|
||||||
|
@ -1432,11 +1432,15 @@ allocator_memalign (gsize alignment,
|
|||||||
guint8 *amem = (guint8*) ALIGN ((gsize) mem, sys_page_size);
|
guint8 *amem = (guint8*) ALIGN ((gsize) mem, sys_page_size);
|
||||||
if (amem != mem)
|
if (amem != mem)
|
||||||
i--; /* mem wasn't page aligned */
|
i--; /* mem wasn't page aligned */
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
while (--i >= 0)
|
while (--i >= 0)
|
||||||
g_trash_stack_push (&compat_valloc_trash, amem + i * sys_page_size);
|
g_trash_stack_push (&compat_valloc_trash, amem + i * sys_page_size);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
aligned_memory = g_trash_stack_pop (&compat_valloc_trash);
|
aligned_memory = g_trash_stack_pop (&compat_valloc_trash);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
#endif
|
#endif
|
||||||
if (!aligned_memory)
|
if (!aligned_memory)
|
||||||
errno = err;
|
errno = err;
|
||||||
@ -1451,7 +1455,9 @@ allocator_memfree (gsize memsize,
|
|||||||
free (mem);
|
free (mem);
|
||||||
#else
|
#else
|
||||||
mem_assert (memsize <= sys_page_size);
|
mem_assert (memsize <= sys_page_size);
|
||||||
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||||
g_trash_stack_push (&compat_valloc_trash, mem);
|
g_trash_stack_push (&compat_valloc_trash, mem);
|
||||||
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,6 @@ do_spawn_with_pipes (gint *exit_status,
|
|||||||
GError *conv_error = NULL;
|
GError *conv_error = NULL;
|
||||||
gint conv_error_index;
|
gint conv_error_index;
|
||||||
gchar *helper_process;
|
gchar *helper_process;
|
||||||
CONSOLE_CURSOR_INFO cursor_info;
|
|
||||||
wchar_t *whelper, **wargv, **wenvp;
|
wchar_t *whelper, **wargv, **wenvp;
|
||||||
gchar *glib_dll_directory;
|
gchar *glib_dll_directory;
|
||||||
|
|
||||||
|
@ -1150,6 +1150,7 @@ read_bytes (gint fd,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
static void
|
static void
|
||||||
test_unix_fd (void)
|
test_unix_fd (void)
|
||||||
{
|
{
|
||||||
@ -1206,6 +1207,7 @@ test_unix_fd (void)
|
|||||||
close (fds[1]);
|
close (fds[1]);
|
||||||
close (fds[0]);
|
close (fds[0]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
assert_main_context_state (gint n_to_poll,
|
assert_main_context_state (gint n_to_poll,
|
||||||
@ -1513,6 +1515,7 @@ test_unix_file_poll (void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_OS_UNIX
|
||||||
static gboolean
|
static gboolean
|
||||||
timeout_cb (gpointer data)
|
timeout_cb (gpointer data)
|
||||||
{
|
{
|
||||||
@ -1564,6 +1567,7 @@ test_mainloop_wait (void)
|
|||||||
|
|
||||||
g_main_context_unref (context);
|
g_main_context_unref (context);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
nfds_in_cb (GIOChannel *io,
|
nfds_in_cb (GIOChannel *io,
|
||||||
|
Loading…
Reference in New Issue
Block a user