From 206c1947c1cb8e4ac6abb8e6803c762200167cde Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 18 Sep 2018 09:14:11 +0200 Subject: [PATCH] Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gdb doesn't currently build on 64-bit Solaris 10: /vol/src/gnu/gdb/hg/master/local/gdb/utils.c: In function ‘void dump_core()’: /vol/src/gnu/gdb/hg/master/local/gdb/utils.c:223:55: error: narrowing conversion of ‘-3’ from ‘long int’ to ‘rlim_t’ {aka ‘long unsigned int’} inside { } [-Wnarrowing] struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY }; ^ /vol/src/gnu/gdb/hg/master/local/gdb/utils.c:223:55: error: narrowing conversion of ‘-3’ from ‘long int’ to ‘rlim_t’ {aka ‘long unsigned int’} inside { } [-Wnarrowing] This was introduced by 2018-08-27 Tom Tromey PR build/23087: * configure: Rebuild. * warning.m4 (AM_GDB_WARNINGS): Remove -Wno-narrowing. and can be fixed by the following patch. Solaris 11 isn't affected because there has #define RLIM_INFINITY ((rlim_t)-3l) instead of #define RLIM_INFINITY (-3l) on Solaris 10. Tested on amd64-pc-solaris2.10 and amd64-pc-solaris2.11. * utils.c (dump_core) [HAVE_SETRLIMIT]: Cast RLIM_INFINITY to rlim_t. --- gdb/ChangeLog | 5 +++++ gdb/utils.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a468d8dc32..ddd2782d99 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2018-09-18 Rainer Orth + + * utils.c (dump_core) [HAVE_SETRLIMIT]: Cast RLIM_INFINITY to + rlim_t. + 2018-09-17 Philippe Waroquiers * python/lib/gdb/command/frame_filters.py (EnableFrameFilter): diff --git a/gdb/utils.c b/gdb/utils.c index d7980fe3a1..8d4a744e71 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -220,7 +220,7 @@ void dump_core (void) { #ifdef HAVE_SETRLIMIT - struct rlimit rlim = { RLIM_INFINITY, RLIM_INFINITY }; + struct rlimit rlim = { (rlim_t) RLIM_INFINITY, (rlim_t) RLIM_INFINITY }; setrlimit (RLIMIT_CORE, &rlim); #endif /* HAVE_SETRLIMIT */