From b759f6750645d32742e8c224f93063e692b4b278 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 2 May 2023 15:57:51 -0400 Subject: Replace strict option with new meson warning level --- .gitlab-ci.yml | 21 ++-- meson.build | 5 - meson/warnings/meson.build | 256 --------------------------------------------- meson_options.txt | 10 +- subprojects/blop.lv2 | 2 +- subprojects/fomp.lv2 | 2 +- subprojects/ganv | 2 +- subprojects/ingen | 2 +- subprojects/jalv | 2 +- subprojects/lv2kit | 2 +- subprojects/mda.lv2 | 2 +- subprojects/patchage | 2 +- subprojects/raul | 2 +- 13 files changed, 25 insertions(+), 285 deletions(-) delete mode 100644 meson/warnings/meson.build diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 22cc955..c618786 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ dev: stage: build image: lv2plugin/debian-x64-big script: - - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - ninja -C build test - meson configure -Dbuildtype=release -Db_coverage=false build - ninja -C build test @@ -27,14 +27,14 @@ static: stage: build image: lv2plugin/debian-x64-big script: - - meson setup build --wrap-mode=forcefallback -Ddefault_library=static -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Ddefault_library=static -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - ninja -C build test sanitize: stage: build image: lv2plugin/debian-x64-clang script: - - meson setup build --wrap-mode=forcefallback -Db_lundef=false -Dbuildtype=plain -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Db_lundef=false -Dbuildtype=plain -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - ninja -C build test variables: CC: "clang" @@ -49,10 +49,11 @@ fedora: stage: build image: lv2plugin/fedora-dev script: - - meson setup build --wrap-mode=forcefallback -Dbuildtype=plain -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Dbuildtype=plain -Dwarning_level=3 -Dwerror=true - ninja -C build test variables: CFLAGS: -O2 -D_FORTIFY_SOURCE=2 + CXXFLAGS: -O2 -D_FORTIFY_SOURCE=2 # Linux Platforms @@ -60,7 +61,7 @@ arm32: stage: build image: lv2plugin/debian-arm32 script: - - meson setup build --wrap-mode=forcefallback --cross-file=/usr/share/meson/cross/arm-linux-gnueabihf.ini -Dbuildtype=debug -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback --cross-file=/usr/share/meson/cross/arm-linux-gnueabihf.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test @@ -69,7 +70,7 @@ arm64: stage: build image: lv2plugin/debian-arm64 script: - - meson setup build --wrap-mode=forcefallback --cross-file=/usr/share/meson/cross/aarch64-linux-gnu.ini -Dbuildtype=debug -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback --cross-file=/usr/share/meson/cross/aarch64-linux-gnu.ini -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=3 -Dwerror=true - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test @@ -78,7 +79,7 @@ x32: stage: build image: lv2plugin/debian-x32 script: - - meson setup build --cross-file=/usr/share/meson/cross/i686-linux-gnu.ini -Dbuildtype=debug -Dstrict=true -Dwerror=true -Ddocs=disabled + - meson setup build --cross-file=/usr/share/meson/cross/i686-linux-gnu.ini -Dbuildtype=debug -Dwarning_level=3 -Dwerror=true -Ddocs=disabled - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test @@ -89,7 +90,7 @@ freebsd: stage: build tags: [freebsd,meson] script: - - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Dstrict=true -Dwerror=true -Ddocs=disabled + - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Dwarning_level=everything -Dwerror=true -Ddocs=disabled - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test @@ -98,7 +99,7 @@ mac: stage: build tags: [macos] script: - - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test @@ -107,7 +108,7 @@ win: stage: build tags: [windows,meson] script: - - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dstrict=true -Dwerror=true + - meson setup build --wrap-mode=forcefallback -Dbuildtype=debug -Ddocs=disabled -Dwarning_level=everything -Dwerror=true - ninja -C build test - meson configure -Dbuildtype=release build - ninja -C build test diff --git a/meson.build b/meson.build index e03cdf3..080143a 100644 --- a/meson.build +++ b/meson.build @@ -18,11 +18,6 @@ pkg = import('pkgconfig') cc = meson.get_compiler('c') cpp = meson.get_compiler('cpp') -# Set global warning flags -if get_option('strict') and not meson.is_subproject() - subdir('meson/warnings') -endif - ########################## # LV2 Path Configuration # ########################## diff --git a/meson/warnings/meson.build b/meson/warnings/meson.build deleted file mode 100644 index 9746c9c..0000000 --- a/meson/warnings/meson.build +++ /dev/null @@ -1,256 +0,0 @@ -# Copyright 2020-2022 David Robillard -# SPDX-License-Identifier: 0BSD OR ISC - -# General code to enable approximately all warnings in GCC 12, clang, and MSVC. -# -# This is trivial for clang and MSVC, but GCC doesn't have an "everything" -# option, so we need to enable everything we want explicitly. Wall is assumed, -# but Wextra is not, for stability. -# -# These are collected from common.opt and c.opt in the GCC source, and manually -# curated with the help of the GCC documentation. Warnings that are -# application-specific, historical, or about compatibility between specific -# language revisions are omitted. The intent here is to have roughly the same -# meaning as clang's Weverything: extremely strict, but general. Specifically -# omitted are: -# -# General: -# -# Wabi= -# Waggregate-return -# Walloc-size-larger-than=BYTES -# Walloca-larger-than=BYTES -# Wframe-larger-than=BYTES -# Wlarger-than=BYTES -# Wstack-usage=BYTES -# Wsystem-headers -# Wtraditional -# Wtraditional-conversion -# Wtrampolines -# Wvla-larger-than=BYTES -# -# Build specific: -# -# Wpoison-system-directories -# -# C Specific: -# -# Wc11-c2x-compat -# Wc90-c99-compat -# Wc99-c11-compat -# Wdeclaration-after-statement -# Wtraditional -# Wtraditional-conversion -# -# C++ Specific: -# -# Wc++0x-compat -# Wc++1z-compat -# Wc++2a-compat -# Wctad-maybe-unsupported -# Wnamespaces -# Wtemplates - -# GCC warnings that apply to all C-family languages -gcc_common_warnings = [ - '-Walloc-zero', - '-Walloca', - '-Wanalyzer-too-complex', - '-Warith-conversion', - '-Warray-bounds=2', - '-Wattribute-alias=2', - '-Wbidi-chars=ucn', - '-Wcast-align=strict', - '-Wcast-function-type', - '-Wcast-qual', - '-Wclobbered', - '-Wconversion', - '-Wdate-time', - '-Wdisabled-optimization', - '-Wdouble-promotion', - '-Wduplicated-branches', - '-Wduplicated-cond', - '-Wempty-body', - '-Wendif-labels', - '-Wfloat-equal', - '-Wformat-overflow=2', - '-Wformat-signedness', - '-Wformat-truncation=2', - '-Wformat=2', - '-Wignored-qualifiers', - '-Wimplicit-fallthrough=3', - '-Winit-self', - '-Winline', - '-Winvalid-pch', - '-Wlogical-op', - '-Wmissing-declarations', - '-Wmissing-field-initializers', - '-Wmissing-include-dirs', - '-Wmultichar', - '-Wnormalized=nfc', - '-Wnull-dereference', - '-Wopenacc-parallelism', - '-Woverlength-strings', - '-Wpacked', - '-Wpacked-bitfield-compat', - '-Wpadded', - '-Wpointer-arith', - '-Wredundant-decls', - '-Wshadow', - '-Wshift-negative-value', - '-Wshift-overflow=2', - '-Wstack-protector', - '-Wstrict-aliasing=3', - '-Wstrict-overflow=5', - '-Wstring-compare', - '-Wstringop-overflow=3', - '-Wsuggest-attribute=cold', - '-Wsuggest-attribute=const', - '-Wsuggest-attribute=format', - '-Wsuggest-attribute=malloc', - '-Wsuggest-attribute=noreturn', - '-Wsuggest-attribute=pure', - '-Wswitch-default', - '-Wswitch-enum', - '-Wtrampolines', - '-Wtrivial-auto-var-init', - '-Wtype-limits', - '-Wundef', - '-Wuninitialized', - '-Wunsafe-loop-optimizations', - '-Wunused', - '-Wunused-const-variable=2', - '-Wunused-macros', - '-Wvector-operation-performance', - '-Wvla', - '-Wwrite-strings', -] - -##### -# C # -##### - -if is_variable('cc') - # Set all_c_warnings for the current C compiler - all_c_warnings = [] - - if get_option('strict') - if cc.get_id() == 'clang' - all_c_warnings += ['-Weverything'] - - if not meson.is_cross_build() - all_c_warnings += [ - '-Wno-poison-system-directories', - ] - endif - - elif cc.get_id() == 'gcc' - all_c_warnings += gcc_common_warnings + [ - '-Wabsolute-value', - '-Wbad-function-cast', - '-Wc++-compat', - '-Wenum-conversion', - '-Wjump-misses-init', - '-Wmissing-parameter-type', - '-Wmissing-prototypes', - '-Wnested-externs', - '-Wold-style-declaration', - '-Wold-style-definition', - '-Woverride-init', - '-Wsign-compare', - '-Wstrict-prototypes', - '-Wunsuffixed-float-constants', - ] - - elif cc.get_id() == 'msvc' - all_c_warnings += [ - '/Wall', - '/experimental:external', - '/external:W0', - '/external:anglebrackets', - ] - endif - endif - - all_c_warnings = cc.get_supported_arguments(all_c_warnings) - add_global_arguments(all_c_warnings, language: ['c']) -endif - -####### -# C++ # -####### - -if is_variable('cpp') - # Set all_cpp_warnings for the current C++ compiler - all_cpp_warnings = [] - - if get_option('strict') - if cpp.get_id() == 'clang' - all_cpp_warnings += [ - '-Weverything', - '-Wno-c++98-compat', - '-Wno-c++98-compat-pedantic', - ] - - if not meson.is_cross_build() - all_cpp_warnings += [ - '-Wno-poison-system-directories', - ] - endif - - elif cpp.get_id() == 'gcc' - all_cpp_warnings += gcc_common_warnings + [ - '-Wabi-tag', - '-Waligned-new=all', - '-Wcatch-value=3', - '-Wcomma-subscript', - '-Wconditionally-supported', - '-Wctor-dtor-privacy', - '-Wdelete-non-virtual-dtor', - '-Wdeprecated', - '-Wdeprecated-copy', - '-Wdeprecated-copy-dtor', - '-Wdeprecated-enum-enum-conversion', - '-Wdeprecated-enum-float-conversion', - '-Weffc++', - '-Wexpansion-to-defined', - '-Wextra-semi', - '-Wimport', - '-Winvalid-imported-macros', - '-Wmismatched-tags', - '-Wmultiple-inheritance', - '-Wnoexcept', - '-Wnoexcept-type', - '-Wnon-virtual-dtor', - '-Wold-style-cast', - '-Woverloaded-virtual', - '-Wplacement-new=2', - '-Wredundant-move', - '-Wredundant-tags', - '-Wregister', - '-Wsign-compare', - '-Wsign-promo', - '-Wsized-deallocation', - '-Wstrict-null-sentinel', - '-Wsuggest-final-methods', - '-Wsuggest-final-types', - '-Wsuggest-override', - '-Wuseless-cast', - '-Wvirtual-inheritance', - '-Wvolatile', - '-Wzero-as-null-pointer-constant', - ] - - elif cpp.get_id() == 'msvc' - all_cpp_warnings += [ - '/Wall', - '/experimental:external', - '/external:W0', - '/external:anglebrackets', - ] - endif - endif - - all_cpp_warnings = cpp.get_supported_arguments(all_cpp_warnings) - add_global_arguments(all_cpp_warnings, language: ['cpp']) -endif diff --git a/meson_options.txt b/meson_options.txt index 6002087..a5c3a32 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,8 +1,8 @@ # Copyright 2021-2022 David Robillard # SPDX-License-Identifier: 0BSD OR ISC -option('checks', type: 'boolean', value: true, yield: true, - description: 'Check for features with the build system') +option('checks', type: 'feature', value: 'enabled', yield: true, + description: 'Check for platform-specific features') option('docs', type: 'feature', value: 'auto', description: 'Build documentation') @@ -16,6 +16,9 @@ option('ingen', type: 'feature', value: 'auto', option('jalv', type: 'feature', value: 'auto', description: 'Build jalv') +option('lint', type: 'boolean', value: false, yield: true, + description: 'Run code quality checks') + option('lv2dir', type: 'string', value: '', yield: true, description: 'LV2 bundle installation directory') @@ -31,8 +34,5 @@ option('plugins', type: 'feature', value: 'auto', option('raul', type: 'feature', value: 'auto', description: 'Build raul') -option('strict', type: 'boolean', value: false, yield: true, - description: 'Enable ultra-strict warnings') - option('tests', type: 'feature', value: 'auto', yield: true, description: 'Build tests') diff --git a/subprojects/blop.lv2 b/subprojects/blop.lv2 index a9ea949..68f5536 160000 --- a/subprojects/blop.lv2 +++ b/subprojects/blop.lv2 @@ -1 +1 @@ -Subproject commit a9ea9497cbcd3cbb67411f8a9755ad15dbfac093 +Subproject commit 68f5536daf01d4bc8a253c913a735994dbf7085d diff --git a/subprojects/fomp.lv2 b/subprojects/fomp.lv2 index 0d14d74..a443f4d 160000 --- a/subprojects/fomp.lv2 +++ b/subprojects/fomp.lv2 @@ -1 +1 @@ -Subproject commit 0d14d749f7cb6c5fb98a9f506936dec3315fe931 +Subproject commit a443f4d071522815ed59dfaf0692d2d1f408ac37 diff --git a/subprojects/ganv b/subprojects/ganv index 8570dca..98bfa26 160000 --- a/subprojects/ganv +++ b/subprojects/ganv @@ -1 +1 @@ -Subproject commit 8570dca811848ce9da417a367321f2e0087b05c5 +Subproject commit 98bfa2664067a2274c40431d94dc00b8f5e52f8f diff --git a/subprojects/ingen b/subprojects/ingen index 8035015..fce7b27 160000 --- a/subprojects/ingen +++ b/subprojects/ingen @@ -1 +1 @@ -Subproject commit 8035015f9e583f483279d306b9bae6096c0bd357 +Subproject commit fce7b27e0a1e69decdef07e751de06089ed63123 diff --git a/subprojects/jalv b/subprojects/jalv index c14e845..94579ca 160000 --- a/subprojects/jalv +++ b/subprojects/jalv @@ -1 +1 @@ -Subproject commit c14e8453649b002ecd9e31f63f3af3ee782a2aad +Subproject commit 94579ca4070b40cf7e690ee41bfdde16404df38f diff --git a/subprojects/lv2kit b/subprojects/lv2kit index 2f55215..b4ce756 160000 --- a/subprojects/lv2kit +++ b/subprojects/lv2kit @@ -1 +1 @@ -Subproject commit 2f552152a882e127eca57925ab25ded9a2bca7dd +Subproject commit b4ce7565f6d7e4bc168b1d254f469f240aeca49b diff --git a/subprojects/mda.lv2 b/subprojects/mda.lv2 index 3a4e73e..6caf63f 160000 --- a/subprojects/mda.lv2 +++ b/subprojects/mda.lv2 @@ -1 +1 @@ -Subproject commit 3a4e73ea217e91e44002dc23cef7b08b772fa8fe +Subproject commit 6caf63f4663687ea3816d99a279c97fb5585edfa diff --git a/subprojects/patchage b/subprojects/patchage index beb2386..8987e2a 160000 --- a/subprojects/patchage +++ b/subprojects/patchage @@ -1 +1 @@ -Subproject commit beb23867f8cfd5bc0c58b8044de3433b40c2b3e5 +Subproject commit 8987e2ab771b8494269387e57e670866307fe1bc diff --git a/subprojects/raul b/subprojects/raul index 32a95bd..59ae4ff 160000 --- a/subprojects/raul +++ b/subprojects/raul @@ -1 +1 @@ -Subproject commit 32a95bd5024623befa3ed445400075a6faae7522 +Subproject commit 59ae4ffb41e381f794251297e46ffaaaad74840e -- cgit v1.2.1