From: Consolatis <35009135+Consolatis@users.noreply.github.com> Date: Mon, 8 Apr 2024 15:32:16 +0000 (+0200) Subject: CI: enable gcc static analyzer X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b959e23d6d98b72a6ff094ad0a2cc7781bfe8f67;p=proto%2Flabwc.git CI: enable gcc static analyzer --- diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index db5621c2..7f91f07d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -155,6 +155,17 @@ jobs: meson compile -C build-gcc-release ' | $TARGET + - name: Build with gcc - static analyzer + run: | + echo ' + cd "$GITHUB_WORKSPACE" + export CC=gcc + meson setup build-gcc-static_analyzer -Dxwayland=enabled \ + -Dstatic_analyzer=enabled --werror + meson compile -C build-gcc-static_analyzer + ' | $TARGET + + # Runtime tests, these run on Debian and Void only (the later due to libmusl being used) - name: Build with clang - release run: | diff --git a/meson.build b/meson.build index adbd5455..25e050fd 100644 --- a/meson.build +++ b/meson.build @@ -87,6 +87,10 @@ else endif conf_data.set10('HAVE_RSVG', have_rsvg) +if get_option('static_analyzer').enabled() + add_project_arguments(['-fanalyzer'], language: 'c') +endif + msgfmt = find_program('msgfmt', required: get_option('nls')) if msgfmt.found() source_root = meson.current_source_dir() diff --git a/meson_options.txt b/meson_options.txt index 9104ec9a..d9cb73a8 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,3 +2,4 @@ option('man-pages', type: 'feature', value: 'auto', description: 'Generate and i option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications') option('svg', type: 'feature', value: 'enabled', description: 'Enable svg window buttons') option('nls', type: 'feature', value: 'auto', description: 'Enable native language support') +option('static_analyzer', type: 'feature', value: 'disabled', description: 'Run gcc static analyzer')