Fixing signedness in glib/gthread-posix.c

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);
                      ^~~
This commit is contained in:
Emmanuel Fleury 2019-02-04 16:36:11 +01:00
parent c3d0440aa2
commit 5dd02cc6f5

View File

@ -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. */