From: Olivier Hainque Date: Mon, 30 Dec 2019 21:26:08 +0000 (+0000) Subject: Improve recursion protection for VxWorks limits.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7800631f7c9fd91bf58c7edd24a6d19e6fa9a10e;p=gcc.git Improve recursion protection for VxWorks limits.h 2019-12-30 Olivier Hainque Jerome Lambourg * 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 From-SVN: r279777 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a472b8ff54..d474caa89a6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-12-30 Olivier Hainque + Jerome Lambourg + + * 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 PR target/92923 diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks index d3a350f5f8a..86b26cc1ecc 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 # . -# 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