diff options
-rw-r--r-- | test cases/common/94 threads/meson.build | 5 | ||||
-rw-r--r-- | test cases/common/94 threads/threadprog.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/test cases/common/94 threads/meson.build b/test cases/common/94 threads/meson.build index 1fbb15a..6a939ff 100644 --- a/test cases/common/94 threads/meson.build +++ b/test cases/common/94 threads/meson.build @@ -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', diff --git a/test cases/common/94 threads/threadprog.c b/test cases/common/94 threads/threadprog.c index 7bfb7c4..19130d5 100644 --- a/test cases/common/94 threads/threadprog.c +++ b/test cases/common/94 threads/threadprog.c @@ -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; } |