Skip to content

Commit 459eeb9

Browse files
committed
avoid C warnings
1 parent 114c999 commit 459eeb9

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('cysignals', 'c', 'cpp', 'cython',
2-
default_options: ['warning_level=3', 'cpp_std=c++17']
2+
default_options: ['warning_level=2', 'cpp_std=c++17']
33
)
44

55
# Python

src/cysignals/implementation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void cysigs_signal_handler(int sig)
492492
* fact, POSIX recommends threads in
493493
* http://pubs.opengroup.org/onlinepubs/009695299/functions/makecontext.html
494494
*/
495-
static void* _sig_on_trampoline(void* dummy)
495+
static void* _sig_on_trampoline(CYTHON_UNUSED void* dummy)
496496
{
497497
register int sig;
498498

@@ -523,7 +523,7 @@ static void setup_trampoline(void)
523523
size_t trampolinestacksize = 1 << 17;
524524

525525
#ifdef PTHREAD_STACK_MIN
526-
if (trampolinestacksize < PTHREAD_STACK_MIN)
526+
if (trampolinestacksize < (size_t) PTHREAD_STACK_MIN)
527527
trampolinestacksize = PTHREAD_STACK_MIN;
528528
#endif
529529
trampolinestack = malloc(trampolinestacksize + 4096);

src/cysignals/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ extern "C" {
112112
/*
113113
* Set message, return 0 if we need to cysetjmp(), return 1 otherwise.
114114
*/
115-
static inline int _sig_on_prejmp(const char* message, const char* file, int line)
115+
static inline int _sig_on_prejmp(const char* message, CYTHON_UNUSED const char* file, CYTHON_UNUSED int line)
116116
{
117117
cysigs.s = message;
118118
#if ENABLE_DEBUG_CYSIGNALS

src/cysignals/tests.pyx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ cdef extern from "<pthread.h>" nogil:
5858

5959

6060
cdef extern from *:
61+
# disable warning (variable might be clobbered by longjmp)
62+
'#pragma GCC diagnostic ignored "-Wclobbered"'
6163
ctypedef int volatile_int "volatile int"
6264

6365

@@ -101,6 +103,9 @@ cdef void dereference_null_pointer() noexcept nogil:
101103
cdef volatile_int* ptr = <volatile_int*>(0)
102104
ptr[0] += 1
103105

106+
# disable warning (infinite recursion in stack_overflow)
107+
cdef extern from *:
108+
'#pragma GCC diagnostic ignored "-Winfinite-recursion"'
104109

105110
cdef int stack_overflow(volatile_int* x=NULL) noexcept nogil:
106111
cdef volatile_int a = 0

0 commit comments

Comments
 (0)