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
pull/11597/head
Eli Schwartz 2 years ago
parent 81c3c3808e
commit 5dc4fcae34
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 1
      test cases/common/117 shared module/meson.build
  2. 6
      test cases/common/147 simd/simd_mmx.c
  3. 2
      test cases/common/148 shared module resolving symbol in executable/prog.c
  4. 4
      test cases/common/245 custom target index source/main.c
  5. 2
      test cases/rust/12 bindgen/dependencies/meson.build

@ -36,5 +36,6 @@ test('import test 2', e, args : m2)
# Shared module that does not export any symbols # Shared module that does not export any symbols
shared_module('nosyms', 'nosyms.c', shared_module('nosyms', 'nosyms.c',
override_options: ['werror=false'],
install : true, install : true,
install_dir : join_paths(get_option('libdir'), 'modules')) install_dir : join_paths(get_option('libdir'), 'modules'))

@ -45,14 +45,16 @@ void increment_mmx(float arr[4]) {
* enough to fit in int16; * enough to fit in int16;
*/ */
int i; 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 packed = _mm_set_pi16(arr[3], arr[2], arr[1], arr[0]);
__m64 incr = _mm_set1_pi16(1); __m64 incr = _mm_set1_pi16(1);
__m64 result = _mm_add_pi16(packed, incr); __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); * int64_t unpacker = _m_to_int64(result);
* but it does not exist on 32 bit platforms for some reason. * but it does not exist on 32 bit platforms for some reason.
*/ */
int64_t unpacker = (int64_t)(result);
_mm_empty(); _mm_empty();
for(i=0; i<4; i++) { for(i=0; i<4; i++) {
/* This fails on GCC 8 when optimizations are enabled. /* This fails on GCC 8 when optimizations are enabled.

@ -30,7 +30,7 @@ int main(int argc, char **argv)
int expected, actual; int expected, actual;
fptr importedfunc; fptr importedfunc;
if (argc=0) {}; // noop (void)argc; // noop
#ifdef _WIN32 #ifdef _WIN32
HMODULE h = LoadLibraryA(argv[1]); HMODULE h = LoadLibraryA(argv[1]);

@ -1,8 +1,10 @@
#include <assert.h> #include <assert.h>
#include "gen.h" #include "gen.h"
int main(int argc) int main(int argc, char **argv)
{ {
(void)argv;
assert(argc == 3); assert(argc == 3);
return genfunc(); return genfunc();
} }

@ -12,6 +12,8 @@ external_dep_rs = rust.bindgen(
external_dep = static_library( external_dep = static_library(
'external_dep', 'external_dep',
[external_dep_rs], [external_dep_rs],
# for generated code, do not lint
rust_args: ['-A', 'warnings'],
dependencies : dep_zlib.partial_dependency(links : true), dependencies : dep_zlib.partial_dependency(links : true),
) )

Loading…
Cancel
Save