This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix compilation of 64-bit gdb 7.7 on Solaris


Compiling a 64-bit gdb 7.7 on Solaris (8 to 11) with gcc fails in bfd:

cc1: warnings being treated as errors
/vol/src/gnu/gdb/gdb-7.7/bfd/cache.c: In function 'bfd_cache_max_open':
/vol/src/gnu/gdb/gdb-7.7/bfd/cache.c:85: error: comparison between signed and unsigned integer expressions

This is about

	  && rlim.rlim_cur != RLIM_INFINITY)

where <sys/resource.h> has

typedef unsigned long   rlim_t;
#define RLIM_INFINITY   (-3l)

While I've raised the issue with Oracle, the problem can easily be
avoided by casting RLIM_INFINITY to rlim_t, as the following patch does.

Ok for mainline?

	Rainer


2014-02-06  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* cache.c (bfd_cache_max_open): Case RLIM_INFINITY to rlim_t.

--- bfd/cache.c	2013/12/08 04:55:47	1.1
+++ bfd/cache.c	2014/02/06 16:13:27
@@ -82,7 +82,7 @@ bfd_cache_max_open (void)
 #ifdef HAVE_GETRLIMIT
       struct rlimit rlim;
       if (getrlimit (RLIMIT_NOFILE, &rlim) == 0
-	  && rlim.rlim_cur != RLIM_INFINITY)
+	  && rlim.rlim_cur != (rlim_t) RLIM_INFINITY)
 	max = rlim.rlim_cur / 8;
       else
 #endif /* HAVE_GETRLIMIT */
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]