aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Hainque <hainque@adacore.com>2019-12-30 21:26:08 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2019-12-30 21:26:08 +0000
commit7800631f7c9fd91bf58c7edd24a6d19e6fa9a10e (patch)
tree6ed03fc7527161ffd25da3b4748b07f31f6212fc
parentd7f5094aa3dc482b86861d633b6d35c59c289c8b (diff)
downloadgcc-7800631f7c9fd91bf58c7edd24a6d19e6fa9a10e.zip
gcc-7800631f7c9fd91bf58c7edd24a6d19e6fa9a10e.tar.gz
gcc-7800631f7c9fd91bf58c7edd24a6d19e6fa9a10e.tar.bz2
Improve recursion protection for VxWorks limits.h
2019-12-30 Olivier Hainque <hainque@adacore.com> Jerome Lambourg <labourg@adacore.com> * config/t-vxworks: Arrange to alter/restore glimits.h before/after stmp-int-hdrs, so it uses a different macro name to protect itself against recursive inclusions. Co-Authored-By: Jerome Lambourg <lambourg@adacore.com> From-SVN: r279777
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/t-vxworks37
2 files changed, 41 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3a472b8..d474caa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2019-12-30 Olivier Hainque <hainque@adacore.com>
+ Jerome Lambourg <labourg@adacore.com>
+
+ * config/t-vxworks: Arrange to alter/restore glimits.h
+ before/after stmp-int-hdrs, so it uses a different macro
+ name to protect itself against recursive inclusions.
+
2019-12-30 Peter Bergner <bergner@linux.ibm.com>
PR target/92923
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index d3a350f..86b26cc 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -16,9 +16,40 @@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# Both the kernel and RTP headers provide limits.h.
-LIMITS_H_TEST = true
-
vxworks.o: $(srcdir)/config/vxworks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TARGET_H) output.h $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
+# Both the kernel and RTP headers provide limits.h. They embed VxWorks
+# specificities and are dated on some configurations so we both need to
+# provide our own version and make sure the system one gets exposed.
+
+LIMITS_H_TEST = true
+STMP_FIXINC = stmp-fixinc
+
+# VxWorks system environments have been GCC based for a long time and we need
+# to make sure that our files and the system ones use distinct macro names to
+# protect against recursive inclusions. We achieve this by temporarily
+# substituting the headers used by stmp-int-headers with alternative versions
+# where we add some version indication in the inclusion-protection macro
+# names.
+
+# Before the standard stmp-int-headers operations take place, arrange to
+# copy the current version of the relevant header files locally, generate
+# the alternate version and replace the original version with ours:
+
+stmp-int-hdrs: subst-glimits.h
+
+subst-%.h:
+ cp -p $(srcdir)/$*.h orig-$*.h
+ ID=$$(echo $(BASEVER_c) | sed -e 's/\./_/g'); \
+ sed -e "s/_LIMITS_H__/_LIMITS_H_$${ID}_/" < $(srcdir)/$*.h > $@
+ cp $@ $(srcdir)/$*.h
+
+# Then arrange to restore the original versions after the standard
+# operations have taken place:
+
+INSTALL_HEADERS += restore-glimits.h
+
+restore-glimits.h: stmp-int-hdrs
+ cp -p orig-glimits.h $(srcdir)/glimits.h