public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [libiberty] trivial C++ fixes for libiberty
@ 2004-07-11 23:49 Bernardo Innocenti
  2004-07-12 16:43 ` Mark Mitchell
  2004-07-12 19:06 ` DJ Delorie
  0 siblings, 2 replies; 4+ messages in thread
From: Bernardo Innocenti @ 2004-07-11 23:49 UTC (permalink / raw)
  To: GCC Patches, gdb-patches, binutils, Ian Lance Taylor, DJ Delorie

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  <bernie@develer.com>

	* 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); })
 \f
 #else /* not __GNUC__ or not __STDC__ */


-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libiberty] trivial C++ fixes for libiberty
  2004-07-11 23:49 [libiberty] trivial C++ fixes for libiberty Bernardo Innocenti
@ 2004-07-12 16:43 ` Mark Mitchell
  2004-07-12 18:03   ` DJ Delorie
  2004-07-12 19:06 ` DJ Delorie
  1 sibling, 1 reply; 4+ messages in thread
From: Mark Mitchell @ 2004-07-12 16:43 UTC (permalink / raw)
  To: Bernardo Innocenti
  Cc: GCC Patches, gdb-patches, binutils, Ian Lance Taylor, DJ Delorie

Bernardo Innocenti wrote:

>Hello,
>
>this patch adds a few missing casts that C++ complains about.
>  
>
OK.

>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 is OK; check it in, unless Ian or DJ object.

There is surely more value in having these macros than in spending 
inordinate amounts of time debating exactly how to spell them.

>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.
>  
>
-- 
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libiberty] trivial C++ fixes for libiberty
  2004-07-12 16:43 ` Mark Mitchell
@ 2004-07-12 18:03   ` DJ Delorie
  0 siblings, 0 replies; 4+ messages in thread
From: DJ Delorie @ 2004-07-12 18:03 UTC (permalink / raw)
  To: mark; +Cc: gcc-patches, gdb-patches, binutils


> There is surely more value in having these macros than in spending 
> inordinate amounts of time debating exactly how to spell them.

We can always add #defines for alternate spellings, too.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [libiberty] trivial C++ fixes for libiberty
  2004-07-11 23:49 [libiberty] trivial C++ fixes for libiberty Bernardo Innocenti
  2004-07-12 16:43 ` Mark Mitchell
@ 2004-07-12 19:06 ` DJ Delorie
  1 sibling, 0 replies; 4+ messages in thread
From: DJ Delorie @ 2004-07-12 19:06 UTC (permalink / raw)
  To: bernie; +Cc: gcc-patches, gdb-patches, binutils


> 	* libiberty.h (ASTRDUP, obstack_free): Add casts required for stricter
> 	type conversion rules of C++.

This is OK.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-07-12 19:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-11 23:49 [libiberty] trivial C++ fixes for libiberty Bernardo Innocenti
2004-07-12 16:43 ` Mark Mitchell
2004-07-12 18:03   ` DJ Delorie
2004-07-12 19:06 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).