This is the mail archive of the
mailing list for the GCC project.
Re: import changes from gcc-in-cxx branch
- From: Brad Hards <bradh at frogmouth dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 16 May 2009 18:26:46 +1000
- Subject: Re: import changes from gcc-in-cxx branch
- References: <email@example.com>
On Friday 15 May 2009 09:43:36 pm Brad Hards wrote:
> Attached is a patch that improves C++ compatibility, to allow
> dehydra/treehydra to build against trunk.
Ian committed a patch (see -Wc++-compat warn about typedef/tag conflict mail)
that covers most of this. Here is an updated patch.
> I didn't actually write it - I just hand-ported bits over from the
> gcc-in-cxx branch.
> 2009-05-15 Brad Hards <firstname.lastname@example.org>
> * system.h: Add C++ compatible CONST_CAST2 definition
--- system.h (revision 147608)
+++ system.h (working copy)
@@ -785,7 +785,9 @@
context. (This can be somewhat dangerous as these assumptions can
change after the fact). Beyond these uses, most other cases of
using this macro should be viewed with extreme caution. */
+#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
#if defined(__GNUC__) && GCC_VERSION > 4000
/* GCC 4.0.x has a bug where it may ICE on this expression,
so does GCC 3.4.x (PR17436). */
@@ -793,6 +795,7 @@
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (X))
#define CONST_CAST_TREE(X) CONST_CAST(union tree_node *, (X))
#define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X))
Can this please be applied?