tests: fix test that has source code incompatible with modern C

Delayed until clang 16, -Werror=incompatible-function-pointer-types is
the default. GCC 14 is "likely to do the same".

See https://wiki.gentoo.org/wiki/Modern_C_porting
pull/11221/head
Eli Schwartz 2 years ago committed by Dylan Baker
parent 1dce178022
commit 26b83eee94
  1. 5
      test cases/common/94 threads/meson.build
  2. 8
      test cases/common/94 threads/threadprog.c

@ -1,6 +1,11 @@
project('threads', 'cpp', 'c',
default_options : ['cpp_std=c++11'])
cc = meson.get_compiler('c')
if cc.has_function_attribute('unused')
add_project_arguments('-DHAVE_UNUSED', language: 'c')
endif
threaddep = dependency('threads')
test('cppthreadtest',

@ -22,7 +22,13 @@ int main(void) {
#include<pthread.h>
#include<stdio.h>
void* main_func(void) {
#ifdef HAVE_UNUSED
#define UNUSED_ATTR __attribute__((unused))
#else
#define UNUSED_ATTR
#endif
void* main_func(void UNUSED_ATTR *arg) {
printf("Printing from a thread.\n");
return NULL;
}

Loading…
Cancel
Save