Commit 10d291f6 by Kai Tietz Committed by Kai Tietz

system.h (helper_const_non_const_cast): New inline for gcc version <= 4.0.

2010-06-11  Kai Tietz  <kai.tietz@onevision.com>

        * system.h (helper_const_non_const_cast): New inline for
        gcc version <= 4.0.
        (CONST_CAST2): For gcc version <= 4.0 use
        new helper to do const/non-const casting.

From-SVN: r160598
parent 2aa9a961
2010-06-11 Kai Tietz <kai.tietz@onevision.com>
* system.h (helper_const_non_const_cast): New inline for
gcc version <= 4.0.
(CONST_CAST2): For gcc version <= 4.0 use
new helper to do const/non-const casting.
2010-06-10 Richard Sandiford <rdsandiford@googlemail.com>
* doc/md.texi: Document the "unspec" and "unspecv" enum names.
......
......@@ -834,6 +834,20 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
/* GCC 4.0.x has a bug where it may ICE on this expression,
so does GCC 3.4.x (PR17436). */
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
#elif defined(__GNUC__)
static inline char *
helper_const_non_const_cast (const char *p)
{
union {
const char *const_c;
char *c;
} val;
val.const_c = p;
return val.c;
}
#define CONST_CAST2(TOTYPE,FROMTYPE,X) \
((TOTYPE) helper_const_non_const_cast ((const char *) (FROMTYPE) (X)))
#else
#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
#endif
......
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