From: Ivan Maidanski Date: Wed, 17 Feb 2016 07:23:55 +0000 (+0300) Subject: Fix 'signed-to-bigger-unsigned value assignment' warning in GC_setpagesize X-Git-Tag: gc7_4_4~31 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=33cdea716c0eabefde4e5c3d7b19bc6233ee31dd;p=gc Fix 'signed-to-bigger-unsigned value assignment' warning in GC_setpagesize (Apply commit 39e2468 from 'master' branch.) * include/private/gcconfig.h (GETPAGESIZE): Cast getpagesize() and sysconf() result to unsigned int. * tools/setjmp_t.c (main): Change type of "ps" local variable from long to unsigned int. --- diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index c93b2717..56ec3cb8 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -903,7 +903,7 @@ # define USE_MMAP_ANON # define MPROTECT_VDB # include -# define GETPAGESIZE() getpagesize() +# define GETPAGESIZE() (unsigned)getpagesize() # if defined(USE_PPC_PREFETCH) && defined(__GNUC__) /* The performance impact of prefetches is untested */ # define PREFETCH(x) \ @@ -1084,7 +1084,7 @@ # define HEURISTIC2 # endif # include -# define GETPAGESIZE() sysconf(_SC_PAGESIZE) +# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE) /* getpagesize() appeared to be missing from at least one */ /* Solaris 5.4 installation. Weird. */ # define DYNAMIC_LOADING @@ -1185,7 +1185,7 @@ # ifdef BEOS # define OS_TYPE "BEOS" # include -# define GETPAGESIZE() B_PAGE_SIZE +# define GETPAGESIZE() (unsigned)B_PAGE_SIZE extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif @@ -1251,7 +1251,7 @@ # define STACK_GROWS_DOWN # define HEURISTIC2 # include -# define GETPAGESIZE() sysconf(_SC_PAGESIZE) +# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE) # define DYNAMIC_LOADING # ifndef USE_MMAP # define USE_MMAP @@ -1520,7 +1520,7 @@ # define USE_MMAP_ANON # define MPROTECT_VDB # include -# define GETPAGESIZE() getpagesize() +# define GETPAGESIZE() (unsigned)getpagesize() /* There seems to be some issues with trylock hanging on darwin. */ /* This should be looked into some more. */ # define NO_PTHREAD_TRYLOCK @@ -1699,7 +1699,7 @@ # endif # define DYNAMIC_LOADING # include -# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE) +# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGE_SIZE) # ifndef __GNUC__ # define PREFETCH(x) do { \ register long addr = (long)(x); \ @@ -1846,7 +1846,7 @@ # define HPUX_STACKBOTTOM # define DYNAMIC_LOADING # include -# define GETPAGESIZE() sysconf(_SC_PAGE_SIZE) +# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGE_SIZE) /* The following was empirically determined, and is probably */ /* not very robust. */ /* Note that the backing store base seems to be at a nice */ @@ -2088,7 +2088,7 @@ # define USE_MMAP_ANON # define MPROTECT_VDB # include -# define GETPAGESIZE() getpagesize() +# define GETPAGESIZE() (unsigned)getpagesize() /* FIXME: There seems to be some issues with trylock hanging on */ /* darwin. This should be looked into some more. */ # define NO_PTHREAD_TRYLOCK @@ -2283,7 +2283,7 @@ # define USE_MMAP_ANON # define MPROTECT_VDB # include -# define GETPAGESIZE() getpagesize() +# define GETPAGESIZE() (unsigned)getpagesize() /* There seems to be some issues with trylock hanging on darwin. */ /* This should be looked into some more. */ # define NO_PTHREAD_TRYLOCK @@ -2493,7 +2493,7 @@ #if (defined(SVR4) || defined(PLATFORM_ANDROID)) && !defined(GETPAGESIZE) # include -# define GETPAGESIZE() sysconf(_SC_PAGESIZE) +# define GETPAGESIZE() (unsigned)sysconf(_SC_PAGESIZE) #endif #ifndef GETPAGESIZE @@ -2501,7 +2501,7 @@ || defined(NETBSD) || defined(FREEBSD) || defined(HPUX) # include # endif -# define GETPAGESIZE() getpagesize() +# define GETPAGESIZE() (unsigned)getpagesize() #endif #if defined(SOLARIS) || defined(DRSNX) || defined(UTS4) diff --git a/tools/setjmp_t.c b/tools/setjmp_t.c index 1d9a1ad0..e66d7f60 100644 --- a/tools/setjmp_t.c +++ b/tools/setjmp_t.c @@ -70,7 +70,7 @@ int * nested_sp(void) int main(void) { volatile word sp; - long ps = GETPAGESIZE(); + unsigned ps = GETPAGESIZE(); jmp_buf b; register int x = (int)strlen("a"); /* 1, slightly disguised */ static int y = 0;