Message ID | yddty9xul4g.fsf@manam.CeBiTec.Uni-Bielefeld.DE |
---|---|
State | New |
Headers | show |
> unfortunately, it turned out that this fix only works when compiling > ada/init.c inside gcc, not for gnatlib where CONST_CAST* isn't defined. > I need the following patch instead, which is also simpler for using > CONST_CAST, not CONST_CAST2, and provides a CONST_CAST definition in > tsystem.h, where it doesn't have to care about non-gcc compilers and > older versions of gcc. > > alpha-dec-osf5.1b bootstrap has completed, make check currently > running. Of for mainline if that passes? The Ada part is OK. I can't formally approve the tsystem.h bit though. Arno
Arnaud Charlet <charlet@adacore.com> writes: >> unfortunately, it turned out that this fix only works when compiling >> ada/init.c inside gcc, not for gnatlib where CONST_CAST* isn't defined. >> I need the following patch instead, which is also simpler for using >> CONST_CAST, not CONST_CAST2, and provides a CONST_CAST definition in >> tsystem.h, where it doesn't have to care about non-gcc compilers and >> older versions of gcc. >> >> alpha-dec-osf5.1b bootstrap has completed, make check currently >> running. Of for mainline if that passes? > > The Ada part is OK. I can't formally approve the tsystem.h bit though. Since this fixes a bootstrap failure, I've installed the patch, considering the tsystem.h part obvious. Thanks. Rainer
diff --git a/gcc/ada/init.c b/gcc/ada/init.c --- a/gcc/ada/init.c +++ b/gcc/ada/init.c @@ -379,7 +379,7 @@ __gnat_error_handler (int sig, siginfo_t } recurse = 0; - Raise_From_Signal_Handler (exception, (char *) msg); + Raise_From_Signal_Handler (exception, CONST_CAST (char *, msg)); } void diff --git a/gcc/tsystem.h b/gcc/tsystem.h --- a/gcc/tsystem.h +++ b/gcc/tsystem.h @@ -1,6 +1,7 @@ /* Get common system includes and various definitions and declarations based on target macros. - Copyright (C) 2000, 2001, 2004, 2005, 2009 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2004, 2005, 2009, 2011 + Free Software Foundation, Inc. This file is part of GCC. @@ -128,6 +129,9 @@ extern int errno; unreachable default case of a switch. Do not use gcc_assert(0). */ #define gcc_unreachable() (abort ()) +#define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq) +#define CONST_CAST(TYPE,X) CONST_CAST2(TYPE, const TYPE, (X)) + /* Filename handling macros. */ #include "filenames.h"