From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19658 invoked by alias); 11 Jul 2004 23:49:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19650 invoked from network); 11 Jul 2004 23:49:51 -0000 Received: from unknown (HELO develer.com) (151.38.19.110) by sourceware.org with SMTP; 11 Jul 2004 23:49:51 -0000 Received: (qmail 10794 invoked from network); 11 Jul 2004 23:49:42 -0000 Received: from beetle.trilan (HELO ?10.3.2.254?) (?vGN098pUjFbIuYbzRbm9oprj9PXN9H7E?@10.3.2.254) by trinity.trilan with SMTP; 11 Jul 2004 23:49:42 -0000 Message-ID: <40F1D216.8040403@develer.com> Date: Sun, 11 Jul 2004 23:49:00 -0000 From: Bernardo Innocenti Organization: Develer S.r.l. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040625 MIME-Version: 1.0 To: GCC Patches , gdb-patches@sources.redhat.com, binutils@sources.redhat.com, Ian Lance Taylor , DJ Delorie Subject: [libiberty] trivial C++ fixes for libiberty Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2004-07/txt/msg00103.txt.bz2 Hello, this patch adds a few missing casts that C++ complains about. PING: the XNEW/XDELETE patch is still pending as the discussion halted before reaching consensus: http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00039.html This version addresses most (not all) of the issues raised along the thread. I already had an earlier version approved, but I'd prefer to get it explicitly approved again with the discussed changes. include/ 2004-07-11 Bernardo Innocenti * libiberty.h (ASTRDUP, obstack_free): Add casts required for stricter type conversion rules of C++. diff -u -p -r1.35 libiberty.h --- libiberty.h 15 May 2003 19:02:12 -0000 1.35 +++ libiberty.h 11 Jul 2004 23:13:02 -0000 @@ -309,7 +340,7 @@ extern PTR C_alloca PARAMS ((size_t)) AT # define ASTRDUP(X) \ (__extension__ ({ const char *const libiberty_optr = (X); \ const unsigned long libiberty_len = strlen (libiberty_optr) + 1; \ - char *const libiberty_nptr = alloca (libiberty_len); \ + char *const libiberty_nptr = (char *const) alloca (libiberty_len); \ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len); })) #else # define alloca(x) C_alloca(x) @@ -323,7 +354,7 @@ extern unsigned long libiberty_len; # define ASTRDUP(X) \ (libiberty_optr = (X), \ libiberty_len = strlen (libiberty_optr) + 1, \ - libiberty_nptr = alloca (libiberty_len), \ + libiberty_nptr = (char *) alloca (libiberty_len), \ (char *) memcpy (libiberty_nptr, libiberty_optr, libiberty_len)) #endif diff -u -p -r1.6 obstack.h --- obstack.h 22 Oct 2003 22:28:20 -0000 1.6 +++ obstack.h 11 Jul 2004 23:13:03 -0000 @@ -494,9 +494,9 @@ __extension__ \ # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ - void *__obj = (OBJ); \ + void *__obj = (void *) (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ - __o->next_free = __o->object_base = __obj; \ + __o->next_free = __o->object_base = (char *) __obj; \ else (obstack_free) (__o, __obj); }) #else /* not __GNUC__ or not __STDC__ */ -- // Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/