Commit cea32bca by Tom Tromey Committed by Taras Glek

system.h (CONST_CAST2): Use C++ const_cast when compiled as C++

gcc/ChangeLog
	* system.h (CONST_CAST2): Use C++ const_cast when compiled as C++

From-SVN: r147928
parent c607156f
2009-05-27 Tom Tromey <tromey@redhat.com>
* system.h (CONST_CAST2): Use C++ const_cast when compiled as C++
2009-05-27 Ian Lance Taylor <iant@google.com> 2009-05-27 Ian Lance Taylor <iant@google.com>
* Makefile.in (LINKER, LINKER_FLAGS): Define. * Makefile.in (LINKER, LINKER_FLAGS): Define.
......
...@@ -786,6 +786,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; ...@@ -786,6 +786,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
change after the fact). Beyond these uses, most other cases of change after the fact). Beyond these uses, most other cases of
using this macro should be viewed with extreme caution. */ using this macro should be viewed with extreme caution. */
#ifdef __cplusplus
#define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
#else
#if defined(__GNUC__) && GCC_VERSION > 4000 #if defined(__GNUC__) && GCC_VERSION > 4000
/* GCC 4.0.x has a bug where it may ICE on this expression, /* GCC 4.0.x has a bug where it may ICE on this expression,
so does GCC 3.4.x (PR17436). */ so does GCC 3.4.x (PR17436). */
...@@ -793,6 +796,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; ...@@ -793,6 +796,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
#else #else
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X)) #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#endif #endif
#endif
#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (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_TREE(X) CONST_CAST(union tree_node *, (X))
#define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X)) #define CONST_CAST_RTX(X) CONST_CAST(struct rtx_def *, (X))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment