diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0f04816ac..4dcab274e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -303,6 +303,7 @@ msys2-mingw32: variables: MSYSTEM: "MINGW32" CHERE_INVOKING: "yes" + CFLAGS: -coverage -ftest-coverage -fprofile-arcs script: - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20 - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh @@ -317,6 +318,28 @@ msys2-mingw32: - _build/meson-logs - _coverage/ +msys2-clang64: + extends: .only-schedules + stage: build + tags: + - win32-ps + needs: [] + variables: + MSYSTEM: "CLANG64" + CHERE_INVOKING: "yes" + script: + - C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20 + - C:\msys64\usr\bin\bash .gitlab-ci/show-execution-environment.sh + - C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh" + artifacts: + reports: + junit: "_build/meson-logs/testlog.junit.xml" + name: "glib-${env:CI_JOB_NAME}-${env:CI_COMMIT_REF_NAME}" + when: always + expire_in: 1 week + paths: + - _build/meson-logs + vs2017-x64: extends: .only-default stage: build diff --git a/.gitlab-ci/test-msys2.sh b/.gitlab-ci/test-msys2.sh index a345fda6a..85394a754 100755 --- a/.gitlab-ci/test-msys2.sh +++ b/.gitlab-ci/test-msys2.sh @@ -1,29 +1,24 @@ #!/bin/bash -set -e +set -ex export PATH="/c/msys64/$MSYSTEM/bin:$PATH" -if [[ "$MSYSTEM" == "MINGW32" ]]; then - export MSYS2_ARCH="i686" -else - export MSYS2_ARCH="x86_64" -fi pacman --noconfirm -Suy pacman --noconfirm -S --needed \ base-devel \ lcov \ - mingw-w64-$MSYS2_ARCH-ccache \ - mingw-w64-$MSYS2_ARCH-gettext \ - mingw-w64-$MSYS2_ARCH-libffi \ - mingw-w64-$MSYS2_ARCH-meson \ - mingw-w64-$MSYS2_ARCH-pcre2 \ - mingw-w64-$MSYS2_ARCH-python3 \ - mingw-w64-$MSYS2_ARCH-python-pip \ - mingw-w64-$MSYS2_ARCH-toolchain \ - mingw-w64-$MSYS2_ARCH-zlib \ - mingw-w64-$MSYS2_ARCH-libelf + "${MINGW_PACKAGE_PREFIX}"-ccache \ + "${MINGW_PACKAGE_PREFIX}"-gettext \ + "${MINGW_PACKAGE_PREFIX}"-libffi \ + "${MINGW_PACKAGE_PREFIX}"-meson \ + "${MINGW_PACKAGE_PREFIX}"-pcre2 \ + "${MINGW_PACKAGE_PREFIX}"-python3 \ + "${MINGW_PACKAGE_PREFIX}"-python-pip \ + "${MINGW_PACKAGE_PREFIX}"-toolchain \ + "${MINGW_PACKAGE_PREFIX}"-zlib \ + "${MINGW_PACKAGE_PREFIX}"-libelf mkdir -p _coverage mkdir -p _ccache @@ -34,28 +29,39 @@ export CCACHE_BASEDIR CCACHE_DIR pip3 install --upgrade --user meson==0.60.3 PATH="$(cygpath "$USERPROFILE")/.local/bin:$HOME/.local/bin:$PATH" -CFLAGS="-coverage -ftest-coverage -fprofile-arcs" DIR="$(pwd)" export PATH CFLAGS -meson --werror --buildtype debug _build +if [[ "$MSYSTEM" == "CLANG64" ]]; then + # FIXME: fix the clang build warnings + # shellcheck disable=SC2086 + meson ${MESON_COMMON_OPTIONS} _build +else + # shellcheck disable=SC2086 + meson ${MESON_COMMON_OPTIONS} --werror _build +fi + cd _build ninja -lcov \ - --quiet \ - --config-file "${DIR}"/.lcovrc \ - --directory "${DIR}/_build" \ - --capture \ - --initial \ - --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov" +if [[ "$CFLAGS" == *"-coverage"* ]]; then + lcov \ + --quiet \ + --config-file "${DIR}"/.lcovrc \ + --directory "${DIR}/_build" \ + --capture \ + --initial \ + --output-file "${DIR}/_coverage/${CI_JOB_NAME}-baseline.lcov" +fi # FIXME: fix the test suite meson test --timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" --no-suite flaky || true -lcov \ - --quiet \ - --config-file "${DIR}"/.lcovrc \ - --directory "${DIR}/_build" \ - --capture \ - --output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov" +if [[ "$CFLAGS" == *"-coverage"* ]]; then + lcov \ + --quiet \ + --config-file "${DIR}"/.lcovrc \ + --directory "${DIR}/_build" \ + --capture \ + --output-file "${DIR}/_coverage/${CI_JOB_NAME}.lcov" +fi diff --git a/gio/tests/win32-streams.c b/gio/tests/win32-streams.c index 6451a9faa..9c32a56b2 100644 --- a/gio/tests/win32-streams.c +++ b/gio/tests/win32-streams.c @@ -40,7 +40,8 @@ static gpointer writer_thread (gpointer user_data) { GOutputStream *out; - gssize nwrote, offset; + gssize nwrote; + size_t offset; GError *err = NULL; HANDLE out_handle; @@ -58,7 +59,7 @@ writer_thread (gpointer user_data) g_usleep (10); offset = 0; - while (offset < (gssize) sizeof (DATA)) + while (offset < sizeof (DATA)) { nwrote = g_output_stream_write (out, DATA + offset, sizeof (DATA) - offset, diff --git a/glib/gatomic.h b/glib/gatomic.h index e1b5d2391..8c6a0877e 100644 --- a/glib/gatomic.h +++ b/glib/gatomic.h @@ -241,7 +241,8 @@ G_END_DECLS * https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1715#note_1024120. */ #define g_atomic_pointer_compare_and_exchange(atomic, oldval, newval) \ (G_GNUC_EXTENSION ({ \ - G_STATIC_ASSERT (sizeof (oldval) == sizeof (gpointer)); \ + G_STATIC_ASSERT (sizeof (static_cast((oldval))) \ + == sizeof (gpointer)); \ glib_typeof (*(atomic)) gapcae_oldval = (oldval); \ G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \ (void) (0 ? (gpointer) *(atomic) : NULL); \ diff --git a/glib/gfileutils.c b/glib/gfileutils.c index f0c8f6776..44c22f3ee 100644 --- a/glib/gfileutils.c +++ b/glib/gfileutils.c @@ -1143,7 +1143,7 @@ write_to_file (const gchar *contents, { gssize s; - s = write (fd, contents, MIN (length, G_MAXSSIZE)); + s = write (fd, contents, MIN (length, G_MAXSIZE)); if (s < 0) { diff --git a/glib/gnulib/meson.build b/glib/gnulib/meson.build index bdd623385..c8040f648 100644 --- a/glib/gnulib/meson.build +++ b/glib/gnulib/meson.build @@ -3,6 +3,13 @@ extra_gnulib_args = cc.get_supported_arguments([ '-Wno-format-nonliteral', '-Wno-duplicated-branches']) +if host_system == 'windows' and cc.get_id() == 'clang' + extra_gnulib_args += cc.get_supported_arguments([ + '-Wno-unused-but-set-variable', + '-Wno-implicit-fallthrough', + ]) +endif + math_h_config = configuration_data () unneeded_funcs = [ diff --git a/glib/tests/cxx.cpp b/glib/tests/cxx.cpp index 045457c6e..aa5e0cb57 100644 --- a/glib/tests/cxx.cpp +++ b/glib/tests/cxx.cpp @@ -186,7 +186,11 @@ test_steal_pointer (void) int main (int argc, char *argv[]) { +#if __cplusplus >= 201103L g_test_init (&argc, &argv, NULL); +#else + g_test_init (&argc, &argv, static_cast(NULL)); +#endif g_test_add_func ("/C++/typeof", test_typeof); g_test_add_func ("/C++/atomic-pointer-compare-and-exchange", test_atomic_pointer_compare_and_exchange); diff --git a/meson.build b/meson.build index c49815a9c..1b2601791 100644 --- a/meson.build +++ b/meson.build @@ -467,6 +467,7 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'clang' '-Werror=implicit-function-declaration', '-Werror=missing-prototypes', '-Werror=pointer-sign', + '-Wno-string-plus-int', ] warning_cxx_args = warning_common_args warning_objc_args = warning_c_args