This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: gdb-patches at sourceware dot org
- Date: Mon, 17 Sep 2018 15:34:25 +0200
- Subject: [PATCH] Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build
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 <tom@tromey.com>
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 <sys/resource.h> 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. Ok for master?
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2018-09-17 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* utils.c (dump_core) [HAVE_SETRLIMIT]: Cast RLIM_INFINITY to
rlim_t.
# HG changeset patch
# Parent e76ee5ead0d6305ffdac7965cf62a7b8b1ae5d36
Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build
diff --git a/gdb/utils.c b/gdb/utils.c
--- 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 */