diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8b93687ec..a89211a35 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ cache: variables: FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/glib/fedora:v9" + COVERITY_IMAGE: "registry.gitlab.gnome.org/gnome/glib/coverity:v1" DEBIAN_IMAGE: "registry.gitlab.gnome.org/gnome/glib/debian-stable:v6" ANDROID_IMAGE: "registry.gitlab.gnome.org/gnome/glib/android-ndk:v3" MINGW_IMAGE: "registry.gitlab.gnome.org/gnome/glib/mingw:v2" @@ -470,6 +471,37 @@ scan-build: paths: - "_scan_build/meson-logs/scanbuild" +coverity: + extends: .build-only-schedules + image: $COVERITY_IMAGE + stage: analysis + needs: [] + variables: + # cov-build doesn’t like GLIB_DEPRECATED_ENUMERATOR + CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS' + script: + - meson ${MESON_COMMON_OPTIONS} + --werror + --default-library=both + --prefix=$HOME/glib-installed + --libdir=lib + -Dsystemtap=true + -Ddtrace=true + -Dfam=true + -Dinstalled_tests=true + _coverity_build + - $HOME/cov-analysis-linux64-*/bin/cov-build --dir cov-int ninja -C _coverity_build + - tar cfz cov-int.tar.gz cov-int + - curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME + --form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL + --form file=@cov-int.tar.gz --form version="$CI_COMMIT_SHA" + --form description="$CI_COMMIT_SHA / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID" + artifacts: + name: "glib-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}" + when: always + paths: + - "cov-int/build-log.txt" + pages: stage: deploy only: diff --git a/.gitlab-ci/README.md b/.gitlab-ci/README.md index f56cbbd49..15df442a8 100644 --- a/.gitlab-ci/README.md +++ b/.gitlab-ci/README.md @@ -8,7 +8,10 @@ GitLab CI jobs run in a Docker image, defined here. To update that image 1. Edit `.gitlab-ci/Dockerfile` with the changes you want 1. Run `.gitlab-ci/run-docker.sh build --base=debian-stable --base-version=1` to build the new image (bump the version from the latest listed for that `base` - on https://gitlab.gnome.org/GNOME/glib/container_registry) + on https://gitlab.gnome.org/GNOME/glib/container_registry). If rebuilding the + `coverity.Dockerfile` image, you’ll need to have access to [Coverity Scan][cs] + and will need to specify your project name and access token as the environment + variables `COVERITY_SCAN_PROJECT_NAME` and `COVERITY_SCAN_TOKEN`. 1. Run `.gitlab-ci/run-docker.sh push --base=debian-stable --base-version=1` to upload the new image to the GNOME GitLab Docker registry * If this is the first time you're doing this, you'll need to log into the @@ -21,3 +24,4 @@ GitLab CI jobs run in a Docker image, defined here. To update that image image [pat]: https://gitlab.gnome.org/profile/personal_access_tokens +[cs]: https://scan.coverity.com/ diff --git a/.gitlab-ci/coverity.Dockerfile b/.gitlab-ci/coverity.Dockerfile new file mode 100644 index 000000000..7c13d2d3c --- /dev/null +++ b/.gitlab-ci/coverity.Dockerfile @@ -0,0 +1,11 @@ +FROM registry.gitlab.gnome.org/gnome/glib/fedora:v9 + +ARG COVERITY_SCAN_PROJECT_NAME +ARG COVERITY_SCAN_TOKEN + +RUN curl https://scan.coverity.com/download/linux64 \ + -o /tmp/cov-analysis-linux64.tgz \ + --form project="${COVERITY_SCAN_PROJECT_NAME}" \ + --form token="${COVERITY_SCAN_TOKEN}" \ + && tar xfz /tmp/cov-analysis-linux64.tgz \ + && rm /tmp/cov-analysis-linux64.tgz diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh index 9b6fce4bc..6299c5595 100755 --- a/.gitlab-ci/run-docker.sh +++ b/.gitlab-ci/run-docker.sh @@ -103,6 +103,8 @@ if [ $build == 1 ]; then echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}" $SUDO_CMD docker build \ --build-arg HOST_USER_ID="$UID" \ + --build-arg COVERITY_SCAN_PROJECT_NAME="${COVERITY_SCAN_PROJECT_NAME}" \ + --build-arg COVERITY_SCAN_TOKEN="${COVERITY_SCAN_TOKEN}" \ --tag "${TAG}" \ --file "${base}.Dockerfile" . exit $? diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index ed98570fe..b779b309b 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -26,7 +26,9 @@ /* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented * in the preprocessor, we need to define this before including glib.h*/ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include #include diff --git a/gio/giomodule.c b/gio/giomodule.c index d8d64be51..dc4d6d3b3 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -22,7 +22,9 @@ /* For the #GDesktopAppInfoLookup macros; since macro deprecation is implemented * in the preprocessor, we need to define this before including glib.h*/ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/deprecated/gallocator.c b/glib/deprecated/gallocator.c index ad9695aea..66483b632 100644 --- a/glib/deprecated/gallocator.c +++ b/glib/deprecated/gallocator.c @@ -16,7 +16,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gallocator.h" diff --git a/glib/deprecated/gcache.c b/glib/deprecated/gcache.c index 179ad9e17..9e04145be 100644 --- a/glib/deprecated/gcache.c +++ b/glib/deprecated/gcache.c @@ -29,7 +29,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gcache.h" diff --git a/glib/deprecated/gcompletion.c b/glib/deprecated/gcompletion.c index 74342c64f..d09c1f1fa 100644 --- a/glib/deprecated/gcompletion.c +++ b/glib/deprecated/gcompletion.c @@ -29,7 +29,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gcompletion.h" diff --git a/glib/deprecated/grel.c b/glib/deprecated/grel.c index 32ec37ca8..b48ec1173 100644 --- a/glib/deprecated/grel.c +++ b/glib/deprecated/grel.c @@ -30,7 +30,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "grel.h" diff --git a/glib/deprecated/gthread-deprecated.c b/glib/deprecated/gthread-deprecated.c index 48418177e..e7e68fbd6 100644 --- a/glib/deprecated/gthread-deprecated.c +++ b/glib/deprecated/gthread-deprecated.c @@ -22,7 +22,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gmessages.h" #include "gslice.h" diff --git a/glib/gtrashstack.c b/glib/gtrashstack.c index 8d5226840..e2beaf32f 100644 --- a/glib/gtrashstack.c +++ b/glib/gtrashstack.c @@ -25,7 +25,9 @@ #include "config.h" /* we know we are deprecated here, no need for warnings */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gtrashstack.h" diff --git a/glib/tests/642026.c b/glib/tests/642026.c index 51eb2cac1..ef54f14bb 100644 --- a/glib/tests/642026.c +++ b/glib/tests/642026.c @@ -10,7 +10,9 @@ * See the included COPYING file for more information. */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/asyncqueue.c b/glib/tests/asyncqueue.c index fbd6dbc54..2c6abf1b7 100644 --- a/glib/tests/asyncqueue.c +++ b/glib/tests/asyncqueue.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/cache.c b/glib/tests/cache.c index f68761674..e725b735e 100644 --- a/glib/tests/cache.c +++ b/glib/tests/cache.c @@ -15,7 +15,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/cond.c b/glib/tests/cond.c index a48714961..0f0b3d249 100644 --- a/glib/tests/cond.c +++ b/glib/tests/cond.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/date.c b/glib/tests/date.c index 159203e4d..92f0a7f6e 100644 --- a/glib/tests/date.c +++ b/glib/tests/date.c @@ -2,7 +2,9 @@ #undef G_LOG_DOMAIN /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "config.h" diff --git a/glib/tests/fileutils.c b/glib/tests/fileutils.c index a3aa084f6..4baedf6f9 100644 --- a/glib/tests/fileutils.c +++ b/glib/tests/fileutils.c @@ -24,7 +24,9 @@ #include /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/mappedfile.c b/glib/tests/mappedfile.c index b263143ec..785e7c516 100644 --- a/glib/tests/mappedfile.c +++ b/glib/tests/mappedfile.c @@ -1,4 +1,6 @@ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include #include diff --git a/glib/tests/mutex.c b/glib/tests/mutex.c index 14e83cf69..e4302fd74 100644 --- a/glib/tests/mutex.c +++ b/glib/tests/mutex.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/private.c b/glib/tests/private.c index 6e6eba167..5e89b35e2 100644 --- a/glib/tests/private.c +++ b/glib/tests/private.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/rec-mutex.c b/glib/tests/rec-mutex.c index 5b2f9c221..f5be71523 100644 --- a/glib/tests/rec-mutex.c +++ b/glib/tests/rec-mutex.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/rwlock.c b/glib/tests/rwlock.c index 1ddc3a03e..6c0b281f7 100644 --- a/glib/tests/rwlock.c +++ b/glib/tests/rwlock.c @@ -21,7 +21,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/strfuncs.c b/glib/tests/strfuncs.c index ea87c7d1e..3947fdf9a 100644 --- a/glib/tests/strfuncs.c +++ b/glib/tests/strfuncs.c @@ -19,7 +19,9 @@ * if advised of the possibility of such damage. */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #define _XOPEN_SOURCE 600 #include diff --git a/glib/tests/string.c b/glib/tests/string.c index 017fdff53..cb5df4cec 100644 --- a/glib/tests/string.c +++ b/glib/tests/string.c @@ -20,7 +20,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include #include diff --git a/glib/tests/tree.c b/glib/tests/tree.c index b7c79c44b..5bf7bd368 100644 --- a/glib/tests/tree.c +++ b/glib/tests/tree.c @@ -26,7 +26,9 @@ #undef G_LOG_DOMAIN /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include #include diff --git a/glib/tests/unicode.c b/glib/tests/unicode.c index d42cf7adf..fa8bd1fa1 100644 --- a/glib/tests/unicode.c +++ b/glib/tests/unicode.c @@ -23,7 +23,9 @@ */ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/glib/tests/utils.c b/glib/tests/utils.c index ed1d63d57..2c5d16c3a 100644 --- a/glib/tests/utils.c +++ b/glib/tests/utils.c @@ -21,7 +21,9 @@ * Author: Matthias Clasen */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "glib.h" #include "glib-private.h" diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 6f4a5d49d..c7e9b75b6 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -20,7 +20,9 @@ #include /* for GValueArray */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gboxed.h" #include "gclosure.h" diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c index c45ebc548..8ca4b620f 100644 --- a/gobject/gparamspecs.c +++ b/gobject/gparamspecs.c @@ -24,7 +24,9 @@ #include +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include "gparamspecs.h" #include "gtype-private.h" diff --git a/gobject/tests/boxed.c b/gobject/tests/boxed.c index 70e3ea762..7f70d40c8 100644 --- a/gobject/tests/boxed.c +++ b/gobject/tests/boxed.c @@ -1,4 +1,6 @@ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/gobject/tests/param.c b/gobject/tests/param.c index 44faef10c..1bfdaff87 100644 --- a/gobject/tests/param.c +++ b/gobject/tests/param.c @@ -1,4 +1,7 @@ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif + #include #include diff --git a/gobject/tests/private.c b/gobject/tests/private.c index ee8fd8f45..1289c48e4 100644 --- a/gobject/tests/private.c +++ b/gobject/tests/private.c @@ -1,5 +1,7 @@ /* We are testing some deprecated APIs here */ +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif #include diff --git a/gobject/tests/threadtests.c b/gobject/tests/threadtests.c index f7042c837..4cba720be 100644 --- a/gobject/tests/threadtests.c +++ b/gobject/tests/threadtests.c @@ -19,7 +19,11 @@ * otherwise) arising in any way out of the use of this software, even * if advised of the possibility of such damage. */ + +#ifndef GLIB_DISABLE_DEPRECATION_WARNINGS #define GLIB_DISABLE_DEPRECATION_WARNINGS +#endif + #include #include