summaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authortglek <tglek@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-27 19:53:03 +0000
committertglek <tglek@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-27 19:53:03 +0000
commit2458dc301c537ae18bbc8144fad7d4398f2d8100 (patch)
tree1df0cfc50045f71ab10be3320417d55473654481 /gcc/system.h
parent40b6e20ea27c855b5dcbfedc7a71ad8e4dc8dd26 (diff)
downloadgcc-2458dc301c537ae18bbc8144fad7d4398f2d8100.tar.gz
gcc/ChangeLog
* system.h (CONST_CAST2): Use C++ const_cast when compiled as C++ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147928 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 223a9dd01b4..2a111ee8e84 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -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
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
/* GCC 4.0.x has a bug where it may ICE on this expression,
so does GCC 3.4.x (PR17436). */
@@ -793,6 +796,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
#else
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#endif
+#endif
#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))