2017-08-05  Ryan Mounce  <r...@mounce.com.au>

        cherry picked from trunk r235362
        2016-04-22  Szabolcs Nagy  <szabolcs.n...@arm.com>

        * system.h (list, map, set, vector): Include conditionally.
        * auto-profile.c (INCLUDE_MAP, INCLUDE_SET): Define.
        * graphite-isl-ast-to-gimple.c (INCLUDE_MAP): Define.
        * ipa-icf.c (INCLUDE_LIST): Define.
        * ipa-icf-gimple.c (INCLUDE_LIST): Define.
        * config/sh/sh.c (INCLUDE_VECTOR): Define.
        * config/sh/sh_treg_combine.cc (INCLUDE_ALGORITHM): Define.
        (INCLUDE_LIST, INCLUDE_VECTOR): Define.
        * fortran/trans-common.c (INCLUDE_MAP): Define.
---
 gcc/ChangeLog                    | 15 +++++++++++++++
 gcc/auto-profile.c               |  5 ++---
 gcc/config/sh/sh.c               |  2 +-
 gcc/config/sh/sh_treg_combine.cc |  7 +++----
 gcc/fortran/trans-common.c       |  2 +-
 gcc/graphite-isl-ast-to-gimple.c |  2 +-
 gcc/ipa-icf-gimple.c             |  2 +-
 gcc/ipa-icf.c                    |  2 +-
 gcc/system.h                     | 12 ++++++++++++
 9 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f3280917ad8..d40ff4652af 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -3,6 +3,21 @@
        Backport from mainline
        2016-04-22  Szabolcs Nagy  <szabolcs.n...@arm.com>
 
+       * system.h (list, map, set, vector): Include conditionally.
+       * auto-profile.c (INCLUDE_MAP, INCLUDE_SET): Define.
+       * graphite-isl-ast-to-gimple.c (INCLUDE_MAP): Define.
+       * ipa-icf.c (INCLUDE_LIST): Define.
+       * ipa-icf-gimple.c (INCLUDE_LIST): Define.
+       * config/sh/sh.c (INCLUDE_VECTOR): Define.
+       * config/sh/sh_treg_combine.cc (INCLUDE_ALGORITHM): Define.
+       (INCLUDE_LIST, INCLUDE_VECTOR): Define.
+       * fortran/trans-common.c (INCLUDE_MAP): Define.
+
+2017-08-05  Ryan Mounce  <r...@mounce.com.au>
+
+       Backport from mainline
+       2016-04-22  Szabolcs Nagy  <szabolcs.n...@arm.com>
+
        * auto-profile.c: Remove <string.h> include.
        * diagnostic.c: Remove <new> include.
        * genmatch.c: Likewise.
diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c
index a5e7225e338..7bbd8140c45 100644
--- a/gcc/auto-profile.c
+++ b/gcc/auto-profile.c
@@ -19,11 +19,10 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_MAP
+#define INCLUDE_SET
 #include "system.h"
 
-#include <map>
-#include <set>
-
 #include "coretypes.h"
 #include "hash-set.h"
 #include "machmode.h"
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 3bb81fc1cd8..9db77530c1f 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -20,9 +20,9 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include <sstream>
-#include <vector>
 
 #include "config.h"
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
diff --git a/gcc/config/sh/sh_treg_combine.cc b/gcc/config/sh/sh_treg_combine.cc
index e4f3581099c..ea20c3f407e 100644
--- a/gcc/config/sh/sh_treg_combine.cc
+++ b/gcc/config/sh/sh_treg_combine.cc
@@ -19,6 +19,9 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_ALGORITHM
+#define INCLUDE_LIST
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "machmode.h"
@@ -65,10 +68,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stmt.h"
 #include "expr.h"
 
-#include <algorithm>
-#include <list>
-#include <vector>
-
 /*
 This pass tries to optimize for example this:
        mov.l   @(4,r4),r1
diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c
index f393419db5e..1ee744190d1 100644
--- a/gcc/fortran/trans-common.c
+++ b/gcc/fortran/trans-common.c
@@ -92,8 +92,8 @@ along with GCC; see the file COPYING3.  If not see
    is examined for still-unused equivalence conditions.  We create a
    block for each merged equivalence list.  */
 
-#include <map>
 #include "config.h"
+#define INCLUDE_MAP
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c
index a83a85dbabc..3216460b625 100644
--- a/gcc/graphite-isl-ast-to-gimple.c
+++ b/gcc/graphite-isl-ast-to-gimple.c
@@ -38,6 +38,7 @@ extern "C" {
 #endif
 #endif
 
+#define INCLUDE_MAP
 #include "system.h"
 #include "coretypes.h"
 #include "hash-set.h"
@@ -75,7 +76,6 @@ extern "C" {
 #include "tree-scalar-evolution.h"
 #include "gimple-ssa.h"
 #include "tree-into-ssa.h"
-#include <map>
 
 #ifdef HAVE_isl
 #include "graphite-poly.h"
diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index 9efdea465c2..144462fce11 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -20,6 +20,7 @@ along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_LIST
 #include "system.h"
 #include "coretypes.h"
 #include "hash-set.h"
@@ -74,7 +75,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cgraph.h"
 #include "data-streamer.h"
 #include "ipa-utils.h"
-#include <list>
 #include "tree-ssanames.h"
 #include "tree-eh.h"
 #include "builtins.h"
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 216e4ed6da7..7f86cca6e7f 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -52,8 +52,8 @@ along with GCC; see the file COPYING3.  If not see
 */
 
 #include "config.h"
+#define INCLUDE_LIST
 #include "system.h"
-#include <list>
 #include "coretypes.h"
 #include "hash-set.h"
 #include "machmode.h"
diff --git a/gcc/system.h b/gcc/system.h
index 94d8138c020..3b753ad3951 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -215,6 +215,18 @@ extern int errno;
 #endif
 
 #ifdef __cplusplus
+# ifdef INCLUDE_LIST
+#  include <list>
+# endif
+# ifdef INCLUDE_MAP
+#  include <map>
+# endif
+# ifdef INCLUDE_SET
+#  include <set>
+# endif
+# ifdef INCLUDE_VECTOR
+#  include <vector>
+# endif
 # include <algorithm>
 # include <cstring>
 # include <utility>
-- 
2.13.2 (Apple Git-90)

Reply via email to