From 5dc4fcae34ee3a5a3d47021f8ea8b2c5d3b14ea9 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 28 Mar 2023 23:00:00 -0400 Subject: [PATCH] test cases: make various things werror-safe Allows getting closer to `./run_project_tests.py -- -Dwerror=true`. - when argc and argv are not *both* used, there's a standard, compliant mechanism to mark the variable as unused - generated code should not build as -Werror - more thoroughly comment out some commented code --- test cases/common/117 shared module/meson.build | 1 + test cases/common/147 simd/simd_mmx.c | 6 ++++-- .../148 shared module resolving symbol in executable/prog.c | 2 +- test cases/common/245 custom target index source/main.c | 4 +++- test cases/rust/12 bindgen/dependencies/meson.build | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/test cases/common/117 shared module/meson.build b/test cases/common/117 shared module/meson.build index 936c8396f..94d17a716 100644 --- a/test cases/common/117 shared module/meson.build +++ b/test cases/common/117 shared module/meson.build @@ -36,5 +36,6 @@ test('import test 2', e, args : m2) # Shared module that does not export any symbols shared_module('nosyms', 'nosyms.c', + override_options: ['werror=false'], install : true, install_dir : join_paths(get_option('libdir'), 'modules')) diff --git a/test cases/common/147 simd/simd_mmx.c b/test cases/common/147 simd/simd_mmx.c index 76054420b..443deafd1 100644 --- a/test cases/common/147 simd/simd_mmx.c +++ b/test cases/common/147 simd/simd_mmx.c @@ -45,14 +45,16 @@ void increment_mmx(float arr[4]) { * enough to fit in int16; */ int i; + /* This is unused due to below comment about GCC 8. __m64 packed = _mm_set_pi16(arr[3], arr[2], arr[1], arr[0]); __m64 incr = _mm_set1_pi16(1); __m64 result = _mm_add_pi16(packed, incr); - /* Should be + int64_t unpacker = (int64_t)(result); + */ + /* The above should be * int64_t unpacker = _m_to_int64(result); * but it does not exist on 32 bit platforms for some reason. */ - int64_t unpacker = (int64_t)(result); _mm_empty(); for(i=0; i<4; i++) { /* This fails on GCC 8 when optimizations are enabled. diff --git a/test cases/common/148 shared module resolving symbol in executable/prog.c b/test cases/common/148 shared module resolving symbol in executable/prog.c index b2abcdb18..55ffee0d3 100644 --- a/test cases/common/148 shared module resolving symbol in executable/prog.c +++ b/test cases/common/148 shared module resolving symbol in executable/prog.c @@ -30,7 +30,7 @@ int main(int argc, char **argv) int expected, actual; fptr importedfunc; - if (argc=0) {}; // noop + (void)argc; // noop #ifdef _WIN32 HMODULE h = LoadLibraryA(argv[1]); diff --git a/test cases/common/245 custom target index source/main.c b/test cases/common/245 custom target index source/main.c index 48af14199..248ab2072 100644 --- a/test cases/common/245 custom target index source/main.c +++ b/test cases/common/245 custom target index source/main.c @@ -1,8 +1,10 @@ #include #include "gen.h" -int main(int argc) +int main(int argc, char **argv) { + (void)argv; + assert(argc == 3); return genfunc(); } diff --git a/test cases/rust/12 bindgen/dependencies/meson.build b/test cases/rust/12 bindgen/dependencies/meson.build index 37e5a4234..998bd32f2 100644 --- a/test cases/rust/12 bindgen/dependencies/meson.build +++ b/test cases/rust/12 bindgen/dependencies/meson.build @@ -12,6 +12,8 @@ external_dep_rs = rust.bindgen( external_dep = static_library( 'external_dep', [external_dep_rs], + # for generated code, do not lint + rust_args: ['-A', 'warnings'], dependencies : dep_zlib.partial_dependency(links : true), )