Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
To: gdb-patches@sourceware.org
Subject: [PATCH] Cast RLIM_INFINITY to rlim_t to fix 64-bit Solaris 10 build
Date: Mon, 17 Sep 2018 13:34:00 -0000	[thread overview]
Message-ID: <yddsh28nt7i.fsf@CeBiTec.Uni-Bielefeld.DE> (raw)

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: sol10-rlim_inifinity.patch --]
[-- Type: text/x-patch, Size: 477 bytes --]

# 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 */

             reply	other threads:[~2018-09-17 13:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 13:34 Rainer Orth [this message]
2018-09-17 13:41 ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yddsh28nt7i.fsf@CeBiTec.Uni-Bielefeld.DE \
    --to=ro@cebitec.uni-bielefeld.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox