From 26830c2facbde04517814464d4cd099a6fe1dd08 Mon Sep 17 00:00:00 2001
From: Jeff Law <law@redhat.com>
Date: Mon, 16 Jan 2017 16:51:57 -0700
Subject: [PATCH] revert: Makefile.in (PREPROCESSOR_DEFINES): Add a level of
 indirection for several include directories that may be relative...

	Revert:
	2016-12-02  Tadek Kijkowski  <tkijkowski@gmail.com>
        * Makefile.in (PREPROCESSOR_DEFINES): Add a level of indirection
        for several include directories that may be relative to sysroot.
        * config/i386/x-mingw32 (gplus_includedir): Define.
        (gplus_tool_includedir, gplus_backward_include_dir): Likewise.
        (native_system_includedir): Likewise.
        * config/i386/mingw32.h (STANDARD_STARTFILE_PREFIX_1): Do not
        override if TARGET_SYSTEM_ROOT is defined.
        (NATIVE_SYSTEM_HEADER_DIR): Likewise.

From-SVN: r244510
---
 gcc/ChangeLog             | 11 +++++++++++
 gcc/Makefile.in           | 17 ++++-------------
 gcc/config/i386/mingw32.h |  4 ----
 gcc/config/i386/x-mingw32 | 34 ----------------------------------
 4 files changed, 15 insertions(+), 51 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 850752829e61..3ef73ce180e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,16 @@
 2017-01-16  Jeff Law  <law@redhat.com>
 
+	Revert:
+	2016-12-02  Tadek Kijkowski  <tkijkowski@gmail.com>
+        * Makefile.in (PREPROCESSOR_DEFINES): Add a level of indirection
+        for several include directories that may be relative to sysroot.
+        * config/i386/x-mingw32 (gplus_includedir): Define.
+        (gplus_tool_includedir, gplus_backward_include_dir): Likewise.
+        (native_system_includedir): Likewise.
+        * config/i386/mingw32.h (STANDARD_STARTFILE_PREFIX_1): Do not
+        override if TARGET_SYSTEM_ROOT is defined.
+        (NATIVE_SYSTEM_HEADER_DIR): Likewise.
+
 	PR tree-optimization/79090
 	PR tree-optimization/33562
 	PR tree-optimization/61912
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index c53c78a2f03f..59fe4aa28364 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -675,15 +675,6 @@ objext = .o
 exeext = @host_exeext@
 build_exeext = @build_exeext@
 
-
-# This allows overriding include paths in host specific Makefile
-# (config/i386/x-mingw32 overrides those variables and local_includedir).
-gplusplus_includedir = $(gcc_gxx_include_dir)
-gplusplus_tool_includedir = $(gcc_gxx_include_dir)/$(target_noncanonical)
-gplusplus_backward_includedir = $(gcc_gxx_include_dir)/backward
-native_system_includedir = $(NATIVE_SYSTEM_HEADER_DIR)
-
-
 # Directory in which to put man pages.
 mandir = @mandir@
 man1dir = $(mandir)/man1
@@ -2793,14 +2784,14 @@ CFLAGS-intl.o += -DLOCALEDIR=\"$(localedir)\"
 PREPROCESSOR_DEFINES = \
   -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
   -DFIXED_INCLUDE_DIR=\"$(libsubdir)/include-fixed\" \
-  -DGPLUSPLUS_INCLUDE_DIR=\"$(gplusplus_includedir)\" \
+  -DGPLUSPLUS_INCLUDE_DIR=\"$(gcc_gxx_include_dir)\" \
   -DGPLUSPLUS_INCLUDE_DIR_ADD_SYSROOT=$(gcc_gxx_include_dir_add_sysroot) \
-  -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gplusplus_tool_includedir)\" \
-  -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gplusplus_backward_includedir)\" \
+  -DGPLUSPLUS_TOOL_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/$(target_noncanonical)\" \
+  -DGPLUSPLUS_BACKWARD_INCLUDE_DIR=\"$(gcc_gxx_include_dir)/backward\" \
   -DLOCAL_INCLUDE_DIR=\"$(local_includedir)\" \
   -DCROSS_INCLUDE_DIR=\"$(CROSS_SYSTEM_HEADER_DIR)\" \
   -DTOOL_INCLUDE_DIR=\"$(gcc_tooldir)/include\" \
-  -DNATIVE_SYSTEM_HEADER_DIR=\"$(native_system_includedir)\" \
+  -DNATIVE_SYSTEM_HEADER_DIR=\"$(NATIVE_SYSTEM_HEADER_DIR)\" \
   -DPREFIX=\"$(prefix)/\" \
   -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc/\" \
   @TARGET_SYSTEM_ROOT_DEFINE@
diff --git a/gcc/config/i386/mingw32.h b/gcc/config/i386/mingw32.h
index 1d988ca44221..543d851f5388 100644
--- a/gcc/config/i386/mingw32.h
+++ b/gcc/config/i386/mingw32.h
@@ -161,8 +161,6 @@ along with GCC; see the file COPYING3.  If not see
     fvtable-verify=std:vtv_end.o%s} \
   crtend.o%s"
 
-#if !defined(TARGET_SYSTEM_ROOT)
-
 /* Override startfile prefix defaults.  */
 #ifndef STANDARD_STARTFILE_PREFIX_1
 #define STANDARD_STARTFILE_PREFIX_1 "/mingw/lib/"
@@ -176,8 +174,6 @@ along with GCC; see the file COPYING3.  If not see
 #undef NATIVE_SYSTEM_HEADER_DIR
 #define NATIVE_SYSTEM_HEADER_DIR "/mingw/include"
 
-#endif /* !defined(TARGET_SYSTEM_ROOT) */
-
 /* Output STRING, a string representing a filename, to FILE.
    We canonicalize it to be in Unix format (backslashes are replaced
    forward slashes.  */
diff --git a/gcc/config/i386/x-mingw32 b/gcc/config/i386/x-mingw32
index b5cef9751203..6a2d5a506946 100644
--- a/gcc/config/i386/x-mingw32
+++ b/gcc/config/i386/x-mingw32
@@ -16,44 +16,10 @@
 # along with GCC; see the file COPYING3.  If not see
 # <http://www.gnu.org/licenses/>.
 #
-
-# MSYS will zealously translate all paths to Windows form, so /usr/include becomes c:/msysX/usr/include.
-# This is undesirable when TARGET_SYSTEM_ROOT is specified, so this function converts /usr/include to //usr\include,
-# which will become /usr/include again when passed to gcc.
-
-# This function takes two parameters: first parameter is include directory path, second parameter tells
-# if the path is relative to TARGET_SYSTEM_ROOT.
-# If TARGET_SYSTEM_ROOT is not configured, or
-#   this function always expands to the unmodified first parameter
-# if TARGET_SYSTEM_ROOT is configured, but second parameter is not 1,
-#   this function again expands to the unmodified first parameter
-# otherwise,
-#  it expands to a shell expression which will transform the first parameter as described above.
-ifneq ($(TARGET_SYSTEM_ROOT),)
-sysroot_relative_path = $(if $(filter 1,$(2)),`echo "$(1)" | tr '/' '\\\\' | sed 's|^\\\\|//|'`,$(1))
-else
-sysroot_relative_path = $(1)
-endif
-
-ifneq ($(TARGET_SYSTEM_ROOT),)
-#
-# Make sure that relative the path is not converted to absolute DOS style path
-#
-local_includedir = $(call sysroot_relative_path,$(local_prefix)/include,1)
-else
 #
 # Make local_includedir relative to EXEC_PREFIX 
 #
 local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e 's|/[^/]*|/..|g'`/include
-endif
-
-#
-# Make sure that relative path are not converted to absolute DOS style paths
-#
-gplusplus_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir),$(gcc_gxx_include_dir_add_sysroot))
-gplusplus_tool_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir)/$(target_noncanonical),$(gcc_gxx_include_dir_add_sysroot))
-gplusplus_backward_includedir = $(call sysroot_relative_path,$(gcc_gxx_include_dir)/backward,$(gcc_gxx_include_dir_add_sysroot))
-native_system_includedir = $(call sysroot_relative_path,$(NATIVE_SYSTEM_HEADER_DIR),1)
 
 # On MinGW, we use "%IA64d" to print 64-bit integers, and the format-checking
 # code does not handle that, so we have to disable checking here.
-- 
GitLab