From 5dd02cc6f518555d1402ad06f99be784dd907899 Mon Sep 17 00:00:00 2001 From: Emmanuel Fleury Date: Mon, 4 Feb 2019 16:36:11 +0100 Subject: [PATCH] Fixing signedness in glib/gthread-posix.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In file included from glib/glibconfig.h:9, from glib/gtypes.h:32, from glib/gatomic.h:27, from glib/gthread.h:32, from glib/gthread-posix.c:42: glib/gthread-posix.c: In function ‘g_system_thread_new’: glib/gmacros.h:348:26: error: comparison of integer expressions of different signedness: ‘long int’ and ‘gulong’ {aka ‘long unsigned int’} [-Werror=sign-compare] #define MAX(a, b) (((a) > (b)) ? (a) : (b)) ^ glib/gthread-posix.c:1169:22: note: in expansion of macro ‘MAX’ stack_size = MAX (min_stack_size, stack_size); ^~~ glib/gmacros.h:348:35: error: operand of ?: changes signedness from ‘long int’ to ‘gulong’ {aka ‘long unsigned int’} due to unsignedness of other operand [-Werror=sign-compare] #define MAX(a, b) (((a) > (b)) ? (a) : (b)) ^~~ glib/gthread-posix.c:1169:22: note: in expansion of macro ‘MAX’ stack_size = MAX (min_stack_size, stack_size); ^~~ --- glib/gthread-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glib/gthread-posix.c b/glib/gthread-posix.c index 9c0b032e6..1e2fdb59a 100644 --- a/glib/gthread-posix.c +++ b/glib/gthread-posix.c @@ -1177,7 +1177,7 @@ g_system_thread_new (GThreadFunc proxy, #ifdef _SC_THREAD_STACK_MIN long min_stack_size = sysconf (_SC_THREAD_STACK_MIN); if (min_stack_size >= 0) - stack_size = MAX (min_stack_size, stack_size); + stack_size = MAX ((gulong) min_stack_size, stack_size); #endif /* _SC_THREAD_STACK_MIN */ /* No error check here, because some systems can't do it and * we simply don't want threads to fail because of that. */