Merge branch 'wip/3v1n0/sys-64-clang' into 'main'

gatomic: Cast the oldval pointer type to the atomic value type, and add msys2-clang64 scheduled CI job

Closes #2798

See merge request GNOME/glib!3031
This commit is contained in:
Philip Withnall 2022-10-31 12:24:10 +00:00
commit 9931696eca
8 changed files with 78 additions and 35 deletions

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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<glib_typeof (*(atomic))>((oldval))) \
== sizeof (gpointer)); \
glib_typeof (*(atomic)) gapcae_oldval = (oldval); \
G_STATIC_ASSERT (sizeof *(atomic) == sizeof (gpointer)); \
(void) (0 ? (gpointer) *(atomic) : NULL); \

View File

@ -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)
{

View File

@ -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 = [

View File

@ -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<void *>(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);

View File

@ -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