Merge branch 'fix-warnings-clang-windows' into 'main'

Fix warnings with Clang on Windows and enable --Werror in CI

See merge request GNOME/glib!3635
This commit is contained in:
Philip Withnall 2023-10-16 21:29:09 +00:00
commit fa165204ae
10 changed files with 19 additions and 49 deletions

View File

@ -341,10 +341,6 @@ msys2-mingw32:
CHERE_INVOKING: "yes"
CFLAGS: -coverage -ftest-coverage -fprofile-arcs
PYTHONUTF8: "1"
# FIXME: For some reason enabling jit debugging "fixes" random python crashes
# see https://github.com/msys2/MINGW-packages/issues/11864 and
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
MSYS: "winjitdebug"
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
- C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh
@ -371,10 +367,6 @@ msys2-clang64:
MSYSTEM: "CLANG64"
CHERE_INVOKING: "yes"
PYTHONUTF8: "1"
# FIXME: For some reason enabling jit debugging "fixes" random python crashes
# see https://github.com/msys2/MINGW-packages/issues/11864 and
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3280#note_1678973
MSYS: "winjitdebug"
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
- C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh

View File

@ -32,14 +32,8 @@ PATH="$(cygpath "$USERPROFILE")/.local/bin:$HOME/.local/bin:$PATH"
DIR="$(pwd)"
export PATH CFLAGS
if [[ "$MSYSTEM" == "CLANG64" ]]; then
# FIXME: fix the clang build warnings
# shellcheck disable=SC2086
meson setup ${MESON_COMMON_OPTIONS} _build
else
# shellcheck disable=SC2086
meson setup ${MESON_COMMON_OPTIONS} --werror _build
fi
# shellcheck disable=SC2086
meson setup ${MESON_COMMON_OPTIONS} --werror _build
meson compile -C _build

View File

@ -443,7 +443,7 @@ typedef struct
gint32 ref_count : 9;
gint32 readable : 1;
guint32 readable : 1;
RegistryValue value;
} RegistryCacheItem;

View File

@ -59,7 +59,7 @@ int
main (int argc, char **argv)
{
#if G_CXX_STD_CHECK_VERSION (11)
g_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, nullptr);
#else
g_test_init (&argc, &argv, static_cast<void *>(NULL));
#endif

View File

@ -1661,7 +1661,7 @@ g_io_channel_new_file (const gchar *filename,
mode_num |= MODE_PLUS;
break;
}
/* Fall through */
G_GNUC_FALLTHROUGH;
default:
g_warning ("Invalid GIOFileMode %s.", mode);
return NULL;

View File

@ -426,27 +426,6 @@ static gboolean win32_keep_fatal_message = FALSE;
* called with huge strings, is it?
*/
static gchar fatal_msg_buf[1000] = "Unspecified fatal error encountered, aborting.";
static gchar *fatal_msg_ptr = fatal_msg_buf;
#undef write
static inline int
dowrite (int fd,
const void *buf,
unsigned int len)
{
if (win32_keep_fatal_message)
{
memcpy (fatal_msg_ptr, buf, len);
fatal_msg_ptr += len;
*fatal_msg_ptr = 0;
return len;
}
write (fd, buf, len);
return len;
}
#define write(fd, buf, len) dowrite(fd, buf, len)
#endif

View File

@ -92,6 +92,8 @@ typedef struct { gchar bytes[8]; } gint64_be;
typedef struct { gchar bytes[4]; } gint32_be;
typedef struct { gchar bytes[4]; } guint32_be;
#ifdef G_OS_UNIX
static inline gint64 gint64_from_be (const gint64_be be) {
gint64 tmp; memcpy (&tmp, &be, sizeof tmp); return GINT64_FROM_BE (tmp);
}
@ -104,6 +106,8 @@ static inline guint32 guint32_from_be (const guint32_be be) {
guint32 tmp; memcpy (&tmp, &be, sizeof tmp); return GUINT32_FROM_BE (tmp);
}
#endif
/* The layout of an IANA timezone file header */
struct tzhead
{

View File

@ -536,7 +536,7 @@ int
main (int argc, char *argv[])
{
#if G_CXX_STD_CHECK_VERSION (11)
g_test_init (&argc, &argv, NULL);
g_test_init (&argc, &argv, nullptr);
#else
g_test_init (&argc, &argv, static_cast<void *>(NULL));
#endif

View File

@ -44,7 +44,7 @@ test_subst_pid_and_event (void)
char *debugger_big_utf8;
gchar *output;
guintptr be = (guintptr) 0xFFFFFFFF;
DWORD bp = G_MAXSIZE;
DWORD bp = MAXDWORD;
/* %f is not valid */
g_assert_false (_g_win32_subst_pid_and_event_w (debugger_3, G_N_ELEMENTS (debugger_3),

View File

@ -93,6 +93,7 @@
#include <stdarg.h>
#include <stdint.h>
/* Nb: this file might be included in a file compiled with -ansi. So
we can't use C++ style "//" comments nor the "asm" keyword (instead
@ -411,14 +412,14 @@ typedef
_zzq_default, _zzq_request, \
_zzq_arg1, _zzq_arg2, _zzq_arg3, _zzq_arg4, _zzq_arg5) \
__extension__ \
({ volatile unsigned long int _zzq_args[6]; \
({ volatile uintptr_t _zzq_args[6]; \
volatile unsigned long int _zzq_result; \
_zzq_args[0] = (unsigned long int)(_zzq_request); \
_zzq_args[1] = (unsigned long int)(_zzq_arg1); \
_zzq_args[2] = (unsigned long int)(_zzq_arg2); \
_zzq_args[3] = (unsigned long int)(_zzq_arg3); \
_zzq_args[4] = (unsigned long int)(_zzq_arg4); \
_zzq_args[5] = (unsigned long int)(_zzq_arg5); \
_zzq_args[0] = (uintptr_t)(_zzq_request); \
_zzq_args[1] = (uintptr_t)(_zzq_arg1); \
_zzq_args[2] = (uintptr_t)(_zzq_arg2); \
_zzq_args[3] = (uintptr_t)(_zzq_arg3); \
_zzq_args[4] = (uintptr_t)(_zzq_arg4); \
_zzq_args[5] = (uintptr_t)(_zzq_arg5); \
__asm__ volatile(__SPECIAL_INSTRUCTION_PREAMBLE \
/* %RDX = client_request ( %RAX ) */ \
"xchgq %%rbx,%%rbx" \