From: Michael Matz Date: Fri, 22 Jan 2016 16:44:10 +0000 (+0000) Subject: system.h (string, algorithm): Include only conditionally. X-Git-Tag: basepoints/gcc-7~1385 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=017360184d9eabff8d1479b3ed09bd1a5b11ff11;p=thirdparty%2Fgcc.git system.h (string, algorithm): Include only conditionally. * system.h (string, algorithm): Include only conditionally. (new): Include always under C++. * bb-reorder.c (toplevel): Define INCLUDE_ALGORITHM. * final.c (toplevel): Ditto. * ipa-chkp.c (toplevel): Define INCLUDE_STRING. * genconditions.c (write_header): Make gencondmd.c define INCLUDE_STRING. * mem-stats.h (mem_usage::print_dash_line): Don't use std::string. * config/aarch64/aarch64.c (toplevel): Define INCLUDE_STRING. * common/config/aarch64/aarch64-common.c (toplevel): Ditto. From-SVN: r232736 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 996be8771dfd..4a5665f528e8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2016-01-22 Michael Matz + + * system.h (string, algorithm): Include only conditionally. + (new): Include always under C++. + * bb-reorder.c (toplevel): Define INCLUDE_ALGORITHM. + * final.c (toplevel): Ditto. + * ipa-chkp.c (toplevel): Define INCLUDE_STRING. + * genconditions.c (write_header): Make gencondmd.c define + INCLUDE_STRING. + * mem-stats.h (mem_usage::print_dash_line): Don't use std::string. + + * config/aarch64/aarch64.c (toplevel): Define INCLUDE_STRING. + * common/config/aarch64/aarch64-common.c (toplevel): Ditto. + 2016-01-22 Bill Schmidt * gcc.target/powerpc/pr63354.c: Restrict to Linux targets with diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index 944a25f536e6..8cbde89b5e14 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -91,6 +91,7 @@ */ #include "config.h" +#define INCLUDE_ALGORITHM /* stable_sort */ #include "system.h" #include "coretypes.h" #include "backend.h" diff --git a/gcc/common/config/aarch64/aarch64-common.c b/gcc/common/config/aarch64/aarch64-common.c index 005ab02313d2..69f5da70e3d7 100644 --- a/gcc/common/config/aarch64/aarch64-common.c +++ b/gcc/common/config/aarch64/aarch64-common.c @@ -19,6 +19,7 @@ . */ #include "config.h" +#define INCLUDE_STRING #include "system.h" #include "coretypes.h" #include "tm.h" diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 03bc1b97c2be..df3dec0a72b9 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -19,6 +19,7 @@ . */ #include "config.h" +#define INCLUDE_STRING #include "system.h" #include "coretypes.h" #include "backend.h" diff --git a/gcc/final.c b/gcc/final.c index 7af6b612ec7d..55cf509611f7 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -43,6 +43,7 @@ along with GCC; see the file COPYING3. If not see function_epilogue. Those instructions never exist as rtl. */ #include "config.h" +#define INCLUDE_ALGORITHM /* reverse */ #include "system.h" #include "coretypes.h" #include "backend.h" diff --git a/gcc/genconditions.c b/gcc/genconditions.c index ab07552a09aa..8abf1c243a96 100644 --- a/gcc/genconditions.c +++ b/gcc/genconditions.c @@ -51,6 +51,7 @@ write_header (void) machine description file. */\n\ \n\ #include \"bconfig.h\"\n\ +#define INCLUDE_STRING\n\ #include \"system.h\"\n\ \n\ /* It is necessary, but not entirely safe, to include the headers below\n\ diff --git a/gcc/ipa-chkp.c b/gcc/ipa-chkp.c index 183e7ce161ea..4a6b43e7a8a3 100644 --- a/gcc/ipa-chkp.c +++ b/gcc/ipa-chkp.c @@ -19,6 +19,7 @@ along with GCC; see the file COPYING3. If not see . */ #include "config.h" +#define INCLUDE_STRING #include "system.h" #include "coretypes.h" #include "backend.h" diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index 2c68ca752ebd..cdf2885ec2a6 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -200,7 +200,9 @@ struct mem_usage static inline void print_dash_line (size_t count = 140) { - fprintf (stderr, "%s\n", std::string (count, '-').c_str ()); + while (count--) + fputc ('-', stderr); + fputc ('\n', stderr); } /* Dump header with NAME. */ diff --git a/gcc/system.h b/gcc/system.h index ba2e96364f12..8151e0a7b2a3 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -198,8 +198,10 @@ extern int fprintf_unlocked (FILE *, const char *, ...); the ctype macros through safe-ctype.h */ #ifdef __cplusplus +#ifdef INCLUDE_STRING # include #endif +#endif /* There are an extraordinary number of issues with . The last straw is that it varies with the locale. Use libiberty's @@ -215,8 +217,11 @@ extern int errno; #endif #ifdef __cplusplus +#ifdef INCLUDE_ALGORITHM # include +#endif # include +# include # include #endif