Iain,
It doesn't look like it will be that simple. If I replace the
proposed patches with a change like...
Index: gcc/system.h
===================================================================
--- gcc/system.h (revision 217238)
+++ gcc/system.h (working copy)
@@ -194,6 +194,13 @@ extern int fprintf_unlocked (FILE *, con
#undef fread_unlocked
#undef fwrite_unlocked
+/* Include <string> before "safe-ctype.h" to avoid avoid GCC poisoning
+the ctype macros through safe-ctype.h */
+
+#ifdef __cplusplus
+# include <string>
+#endif
+
/* There are an extraordinary number of issues with <ctype.h>.
The last straw is that it varies with the locale. Use libiberty's
replacement instead. */
The bootstrap fails at a new place with...
make[3]: Entering directory
'/sw/src/fink.build/gcc50-5.0.0-1000/darwin_objdir/gcc'
g++ -c -g -DIN_GCC -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wno-format -Wmissing-format-attribute
-Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -I. -I.
-I../../gcc-5.0-20141107/gcc -I../../gcc-5.0-20141107/gcc/.
-I../../gcc-5.0-20141107/gcc/../include
-I../../gcc-5.0-20141107/gcc/../libcpp/include -I/sw/include
-I/sw/include -I../../gcc-5.0-20141107/gcc/../libdecnumber
-I../../gcc-5.0-20141107/gcc/../libdecnumber/dpd -I../libdecnumber
-I../../gcc-5.0-20141107/gcc/../libbacktrace -DCLOOG_INT_GMP
-I/sw/include -DCLOOG_INT_GMP -I/sw/include -I/sw/include -o
simplify-rtx.o -MT simplify-rtx.o -MMD -MP -MF
./.deps/simplify-rtx.TPo ../../gcc-5.0-20141107/gcc/simplify-rtx.c
clang: warning: treating 'c' input as 'c++' when in C++ mode, this
behavior is deprecated
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:23:
../../gcc-5.0-20141107/gcc/coretypes.h:62:1: warning: class 'rtx_def'
was previously declared as a struct [-Wmismatched-tags]
class rtx_def;
^
../../gcc-5.0-20141107/gcc/coretypes.h:55:8: note: previous use is here
struct rtx_def;
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:27:
In file included from ../../gcc-5.0-20141107/gcc/real.h:25:
../../gcc-5.0-20141107/gcc/wide-int.h:370:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:377:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:384:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:394:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:401:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:411:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:422:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:886:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:965:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
../../gcc-5.0-20141107/gcc/wide-int.h:1127:1: warning:
'fixed_wide_int_storage' defined as a class template here but
previously declared as a struct template
[-Wmismatched-tags]
class GTY(()) fixed_wide_int_storage
^
../../gcc-5.0-20141107/gcc/wide-int.h:286:18: note: did you mean class here?
template <int N> struct fixed_wide_int_storage;
^~~~~~
class
../../gcc-5.0-20141107/gcc/wide-int.h:1152:3: warning: extraneous
template parameter list in template specialization
template <>
^~~~~~~~~~~
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
../../gcc-5.0-20141107/gcc/ggc.h:315:15: warning: struct 'rtx_def' was
previously declared as a class [-Wmismatched-tags]
static inline struct rtx_def *
^
../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use is here
class rtx_def;
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:28:
In file included from ../../gcc-5.0-20141107/gcc/vec.h:44:
../../gcc-5.0-20141107/gcc/ggc.h:318:11: warning: struct 'rtx_def' was
previously declared as a class [-Wmismatched-tags]
return (struct rtx_def *) ggc_internal_alloc (s PASS_MEM_STAT);
^
../../gcc-5.0-20141107/gcc/coretypes.h:62:7: note: previous use is here
class rtx_def;
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
../../gcc-5.0-20141107/gcc/rtl.h:283:1: warning: 'rtx_def' defined as
a struct here but previously declared as a class [-Wmismatched-tags]
struct GTY((desc("0"), tag("0"),
^
../../gcc-5.0-20141107/gcc/coretypes.h:62:1: note: did you mean struct here?
class rtx_def;
^~~~~
struct
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:3164:
./genrtl.h:435:3: warning: array index 1 is past the end of the array
(which contains 1 element) [-Warray-bounds]
XWINT (rt, 1) = arg1;
^ ~
../../gcc-5.0-20141107/gcc/rtl.h:1121:29: note: expanded from macro 'XWINT'
#define XWINT(RTX, N) ((RTX)->u.hwint[N])
^
../../gcc-5.0-20141107/gcc/rtl.h:398:5: note: array 'hwint' declared here
HOST_WIDE_INT hwint[1];
^
../../gcc-5.0-20141107/gcc/hwint.h:58:26: note: expanded from macro
'HOST_WIDE_INT'
# define HOST_WIDE_INT long long
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:3164:
./genrtl.h:436:3: warning: array index 2 is past the end of the array
(which contains 1 element) [-Warray-bounds]
XWINT (rt, 2) = arg2;
^ ~
../../gcc-5.0-20141107/gcc/rtl.h:1121:29: note: expanded from macro 'XWINT'
#define XWINT(RTX, N) ((RTX)->u.hwint[N])
^
../../gcc-5.0-20141107/gcc/rtl.h:398:5: note: array 'hwint' declared here
HOST_WIDE_INT hwint[1];
^
../../gcc-5.0-20141107/gcc/hwint.h:58:26: note: expanded from macro
'HOST_WIDE_INT'
# define HOST_WIDE_INT long long
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:911:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (asm_out)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:1519:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (sched)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:1549:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (simd_clone)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:1767:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (vectorize)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:3023:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (addr_space)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:4522:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (calls)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5050:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (c)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5203:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (cxx)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5292:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (emutls)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5398:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (target_option)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5686:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (mode_switching)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:45:
In file included from ../../gcc-5.0-20141107/gcc/target.h:192:
../../gcc-5.0-20141107/gcc/target.def:5689:1: warning: empty macro
arguments are a C99 feature [-Wc99-extensions]
HOOK_VECTOR_END (C90_EMPTY_HACK)
^
../../gcc-5.0-20141107/gcc/target-hooks-macros.h:43:50: note: expanded
from macro 'HOOK_VECTOR_END'
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
^
../../gcc-5.0-20141107/gcc/simplify-rtx.c:118:13: warning: array index
1 is past the end of the array (which contains 1 element)
[-Warray-bounds]
val = CONST_DOUBLE_HIGH (x);
^~~~~~~~~~~~~~~~~~~~~
../../gcc-5.0-20141107/gcc/rtl.h:1758:30: note: expanded from macro
'CONST_DOUBLE_HIGH'
#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
^ ~
../../gcc-5.0-20141107/gcc/rtl.h:1124:36: note: expanded from macro 'XCMWINT'
#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
^
../../gcc-5.0-20141107/gcc/rtl.h:398:5: note: array 'hwint' declared here
HOST_WIDE_INT hwint[1];
^
../../gcc-5.0-20141107/gcc/hwint.h:58:26: note: expanded from macro
'HOST_WIDE_INT'
# define HOST_WIDE_INT long long
^
../../gcc-5.0-20141107/gcc/simplify-rtx.c:5368:9: warning: array index
1 is past the end of the array (which contains 1 element)
[-Warray-bounds]
= CONST_DOUBLE_HIGH (el) >> (i - HOST_BITS_PER_WIDE_INT);
^~~~~~~~~~~~~~~~~~~~~~
../../gcc-5.0-20141107/gcc/rtl.h:1758:30: note: expanded from macro
'CONST_DOUBLE_HIGH'
#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
^ ~
../../gcc-5.0-20141107/gcc/rtl.h:1124:36: note: expanded from macro 'XCMWINT'
#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
^
../../gcc-5.0-20141107/gcc/rtl.h:398:5: note: array 'hwint' declared here
HOST_WIDE_INT hwint[1];
^
../../gcc-5.0-20141107/gcc/hwint.h:58:26: note: expanded from macro
'HOST_WIDE_INT'
# define HOST_WIDE_INT long long
^
../../gcc-5.0-20141107/gcc/simplify-rtx.c:5372:12: warning: array
index 1 is past the end of the array (which contains 1 element)
[-Warray-bounds]
if (CONST_DOUBLE_HIGH (el) >> (HOST_BITS_PER_WIDE_INT - 1))
^~~~~~~~~~~~~~~~~~~~~~
../../gcc-5.0-20141107/gcc/rtl.h:1758:30: note: expanded from macro
'CONST_DOUBLE_HIGH'
#define CONST_DOUBLE_HIGH(r) XCMWINT (r, 1, CONST_DOUBLE, VOIDmode)
^ ~
../../gcc-5.0-20141107/gcc/rtl.h:1124:36: note: expanded from macro 'XCMWINT'
#define XCMWINT(RTX, N, C, M) ((RTX)->u.hwint[N])
^
../../gcc-5.0-20141107/gcc/rtl.h:398:5: note: array 'hwint' declared here
HOST_WIDE_INT hwint[1];
^
../../gcc-5.0-20141107/gcc/hwint.h:58:26: note: expanded from macro
'HOST_WIDE_INT'
# define HOST_WIDE_INT long long
^
In file included from ../../gcc-5.0-20141107/gcc/simplify-rtx.c:25:
In file included from ../../gcc-5.0-20141107/gcc/rtl.h:27:
In file included from ../../gcc-5.0-20141107/gcc/real.h:25:
../../gcc-5.0-20141107/gcc/wide-int.h:2132:10: error: call to 'min' is ambiguous
return min (x, y, SIGNED);
^~~
../../gcc-5.0-20141107/gcc/simplify-rtx.c:3898:17: note: in
instantiation of function template specialization
'wi::smin<std::__1::pair<rtx_def *,
machine_mode>, std::__1::pair<rtx_def *, machine_mode> >' requested here
result = wi::smin (pop0, pop1);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2536:1:
note: candidate function [with _Tp
= std::__1::pair<rtx_def *, machine_mode>, _Compare = signop_e]
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2116:5: note: candidate function
[with T1 = std::__1::pair<rtx_def *, machine_mode>, T2 =
std::__1::pair<rtx_def *,
machine_mode>]
wi::min (const T1 &x, const T2 &y, signop sgn)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2163:10: error: call to 'max' is ambiguous
return max (x, y, SIGNED);
^~~
../../gcc-5.0-20141107/gcc/simplify-rtx.c:3902:17: note: in
instantiation of function template specialization
'wi::smax<std::__1::pair<rtx_def *,
machine_mode>, std::__1::pair<rtx_def *, machine_mode> >' requested here
result = wi::smax (pop0, pop1);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2600:1:
note: candidate function [with _Tp
= std::__1::pair<rtx_def *, machine_mode>, _Compare = signop_e]
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2147:5: note: candidate function
[with T1 = std::__1::pair<rtx_def *, machine_mode>, T2 =
std::__1::pair<rtx_def *,
machine_mode>]
wi::max (const T1 &x, const T2 &y, signop sgn)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2140:10: error: call to 'min' is ambiguous
return min (x, y, UNSIGNED);
^~~
../../gcc-5.0-20141107/gcc/simplify-rtx.c:3906:17: note: in
instantiation of function template specialization
'wi::umin<std::__1::pair<rtx_def *,
machine_mode>, std::__1::pair<rtx_def *, machine_mode> >' requested here
result = wi::umin (pop0, pop1);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2536:1:
note: candidate function [with _Tp
= std::__1::pair<rtx_def *, machine_mode>, _Compare = signop_e]
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2116:5: note: candidate function
[with T1 = std::__1::pair<rtx_def *, machine_mode>, T2 =
std::__1::pair<rtx_def *,
machine_mode>]
wi::min (const T1 &x, const T2 &y, signop sgn)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2171:10: error: call to 'max' is ambiguous
return max (x, y, UNSIGNED);
^~~
../../gcc-5.0-20141107/gcc/simplify-rtx.c:3910:17: note: in
instantiation of function template specialization
'wi::umax<std::__1::pair<rtx_def *,
machine_mode>, std::__1::pair<rtx_def *, machine_mode> >' requested here
result = wi::umax (pop0, pop1);
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:2600:1:
note: candidate function [with _Tp
= std::__1::pair<rtx_def *, machine_mode>, _Compare = signop_e]
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
../../gcc-5.0-20141107/gcc/wide-int.h:2147:5: note: candidate function
[with T1 = std::__1::pair<rtx_def *, machine_mode>, T2 =
std::__1::pair<rtx_def *,
machine_mode>]
wi::max (const T1 &x, const T2 &y, signop sgn)
^
32 warnings and 4 errors generated.
I think we are better off for the moment going with the conservative
fix (as only two files in all of gcc need it).
Jack
On Sun, Nov 9, 2014 at 9:53 AM, Iain Sandoe <[email protected]> wrote:
> Hi Jack,
>
> comments below apply also to the patch for PR63699
>
> On 7 Nov 2014, at 17:13, Jack Howarth wrote:
>
>> The attached revised patch eliminates the compilation error...
>>
>> error: use of undeclared
>> identifier 'do_not_use_toupper_with_safe_ctype'
>>
>> on x86_64-apple-darwin14 when bootstrapping using the Clang 6.0
>> compiler by moving the include for <strings> earlier.
>> Okay for gcc trunk?
>> Jack
>> <PR63750_v3.patch>
>
> Since you have two instances of this (and given that the other required
> headers are included in system.h)
> ISTM, that the right place for this (and the fix for PR63699) is in system.h
> with appropriate guards for cplusplus and an explanation of why the fix is
> needed.
>
> Need to make sure we're not just burying some other problem, right?
> 0.02GBP as always
> Iain
>
> 2014-10-07 Jack Howarth <[email protected]>
>
> PR other/63750
> * gcc/ipa-chkp.c: Include string earlier.
>
> In any event, if the existing patch is preferred by the maintainers, please
> make this ^ something like
> "Include <string> before system.h"
> to give to poor reader some idea of what the change was about ;)
>