From: Bernardo Innocenti <bernie@develer.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>,
gdb-patches@sources.redhat.com, binutils@sources.redhat.com,
Ian Lance Taylor <ian@wasabisystems.com>,
DJ Delorie <dj@redhat.com>
Subject: [libiberty] trivial C++ fixes for libiberty
Date: Sun, 11 Jul 2004 23:49:00 -0000 [thread overview]
Message-ID: <40F1D216.8040403@develer.com> (raw)
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/
next reply other threads:[~2004-07-11 23:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-11 23:49 Bernardo Innocenti [this message]
2004-07-12 16:43 ` Mark Mitchell
2004-07-12 18:03 ` DJ Delorie
2004-07-12 19:06 ` DJ Delorie
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=40F1D216.8040403@develer.com \
--to=bernie@develer.com \
--cc=binutils@sources.redhat.com \
--cc=dj@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=ian@wasabisystems.com \
/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