public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] robustify vxworks glimits.h overriding
@ 2021-01-01 1:31 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-01-01 1:31 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:d48515f16f34f76df293af20fe6019727bf2f854
commit d48515f16f34f76df293af20fe6019727bf2f854
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Dec 31 21:38:39 2020 -0300
robustify vxworks glimits.h overriding
The glimits.h overriding used in gcc/config/t-vxworks was fragile: the
intermediate file would already be there in a rebuild, and so the
adjustments would not be made, so the generated limits.h would miss
them, causing limits-width-[12] tests to fail on that target.
While changing it, I also replaced the modern $(cmd) shell syntax with
the more portable `cmd` construct.
for gcc/ChangeLog
* Makefile.in (T_GLIMITS_H): New.
(stmp-int-hdrs): Depend on it, use it.
* config/t-vxworks (T_GLIMITS_H): Override it.
(vxw-glimits.h): New.
Diff:
---
gcc/Makefile.in | 9 ++++++---
gcc/config/t-vxworks | 33 ++++++++++-----------------------
2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6847022f108..310b556c3fe 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -449,6 +449,9 @@ USER_H = $(srcdir)/ginclude/float.h \
USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
USER_H_INC_NEXT_POST = @user_headers_inc_next_post@
+# Enable target overriding of this fragment, as in config/t-vxworks.
+T_GLIMITS_H = $(srcdir)/glimits.h
+
# The GCC to use for compiling crt*.o.
# Usually the one we just built.
# Don't use this as a dependency--use $(GCC_PASSES).
@@ -3075,7 +3078,7 @@ gcov-tool$(exeext): $(GCOV_TOOL_OBJS) $(LIBDEPS)
# be rebuilt.
# Build the include directories.
-stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
+stmp-int-hdrs: $(STMP_FIXINC) $(T_GLIMITS_H) $(USER_H) fixinc_list
# Copy in the headers provided with gcc.
#
# The sed command gets just the last file name component;
@@ -3129,9 +3132,9 @@ stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
fix_dir=include-fixed$${multi_dir}; \
if $(LIMITS_H_TEST) ; then \
- cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
+ cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
else \
- cat $(srcdir)/glimits.h > tmp-xlimits.h; \
+ cat $(T_GLIMITS_H) > tmp-xlimits.h; \
fi; \
$(mkinstalldirs) $${fix_dir}; \
chmod a+rx $${fix_dir} || true; \
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index 221f53ce311..e60fd31bf09 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -43,29 +43,16 @@ $(INSTALL_HEADERS_DIR): install-stdint.h
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
+# 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 modifying the GLIMITS_H fragment that goes into limits.h
+# with 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:
+T_GLIMITS_H = vxw-glimits.h
-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
+vxw-glimits.h: $(srcdir)/glimits.h
+ ID=`echo $(BASEVER_c) | sed -e 's/\./_/g'` && \
+ sed -e "s/_LIMITS_H__/_LIMITS_H__$${ID}_/" < $(srcdir)/glimits.h > $@T
+ mv $@T $@
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/aoliva/heads/testme)] robustify vxworks glimits.h overriding
@ 2021-01-01 5:23 Alexandre Oliva
0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-01-01 5:23 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:de6473fa5bca78221d4befe3d10d8fb7aa98826e
commit de6473fa5bca78221d4befe3d10d8fb7aa98826e
Author: Alexandre Oliva <oliva@adacore.com>
Date: Thu Dec 31 21:38:39 2020 -0300
robustify vxworks glimits.h overriding
The glimits.h overriding used in gcc/config/t-vxworks was fragile: the
intermediate file would already be there in a rebuild, and so the
adjustments would not be made, so the generated limits.h would miss
them, causing limits-width-[12] tests to fail on that target.
While changing it, I also replaced the modern $(cmd) shell syntax with
the more portable `cmd` construct.
for gcc/ChangeLog
* Makefile.in (T_GLIMITS_H): New.
(stmp-int-hdrs): Depend on it, use it.
* config/t-vxworks (T_GLIMITS_H): Override it.
(vxw-glimits.h): New.
Diff:
---
gcc/Makefile.in | 9 ++++++---
gcc/config/t-vxworks | 33 ++++++++++-----------------------
2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 6847022f108..310b556c3fe 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -449,6 +449,9 @@ USER_H = $(srcdir)/ginclude/float.h \
USER_H_INC_NEXT_PRE = @user_headers_inc_next_pre@
USER_H_INC_NEXT_POST = @user_headers_inc_next_post@
+# Enable target overriding of this fragment, as in config/t-vxworks.
+T_GLIMITS_H = $(srcdir)/glimits.h
+
# The GCC to use for compiling crt*.o.
# Usually the one we just built.
# Don't use this as a dependency--use $(GCC_PASSES).
@@ -3075,7 +3078,7 @@ gcov-tool$(exeext): $(GCOV_TOOL_OBJS) $(LIBDEPS)
# be rebuilt.
# Build the include directories.
-stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
+stmp-int-hdrs: $(STMP_FIXINC) $(T_GLIMITS_H) $(USER_H) fixinc_list
# Copy in the headers provided with gcc.
#
# The sed command gets just the last file name component;
@@ -3129,9 +3132,9 @@ stmp-int-hdrs: $(STMP_FIXINC) $(USER_H) fixinc_list
multi_dir=`echo $${ml} | sed -e 's/^[^;]*;//'`; \
fix_dir=include-fixed$${multi_dir}; \
if $(LIMITS_H_TEST) ; then \
- cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
+ cat $(srcdir)/limitx.h $(T_GLIMITS_H) $(srcdir)/limity.h > tmp-xlimits.h; \
else \
- cat $(srcdir)/glimits.h > tmp-xlimits.h; \
+ cat $(T_GLIMITS_H) > tmp-xlimits.h; \
fi; \
$(mkinstalldirs) $${fix_dir}; \
chmod a+rx $${fix_dir} || true; \
diff --git a/gcc/config/t-vxworks b/gcc/config/t-vxworks
index 221f53ce311..e60fd31bf09 100644
--- a/gcc/config/t-vxworks
+++ b/gcc/config/t-vxworks
@@ -43,29 +43,16 @@ $(INSTALL_HEADERS_DIR): install-stdint.h
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
+# 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 modifying the GLIMITS_H fragment that goes into limits.h
+# with 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:
+T_GLIMITS_H = vxw-glimits.h
-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
+vxw-glimits.h: $(srcdir)/glimits.h
+ ID=`echo $(BASEVER_c) | sed -e 's/\./_/g'` && \
+ sed -e "s/_LIMITS_H__/_LIMITS_H__$${ID}_/" < $(srcdir)/glimits.h > $@T
+ mv $@T $@
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-01 5:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-01 1:31 [gcc(refs/users/aoliva/heads/testme)] robustify vxworks glimits.h overriding Alexandre Oliva
2021-01-01 5:23 Alexandre Oliva
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).