]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Simplify makefile rule for largefile-config.h (PR91947)
authorJonathan Wakely <jwakely@redhat.com>
Fri, 24 Jan 2020 11:13:55 +0000 (11:13 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 24 Jan 2020 11:18:43 +0000 (11:18 +0000)
The previous rule could leave an incomplete file if the build was
interrupted, which would then not be remade if make was run again.

This makes the rule more robust by writing to a temporary file and only
moving it into place as the final step. It also simplifies the rule so
that only the essential macro definitions are written to the file, not
the explanatory comments and commented out #undef lines.

Also, the macro for enabling LFS on Mac OS X 10.5 is now set
unconditionally, which is a bug fix from upstream autoconf.

Backport from mainline
2020-01-23  Jonathan Wakely  <jwakely@redhat.com>

PR libstdc++/91947
* include/Makefile.am (${host_builddir}/largefile-config.h): Simplify
rule.
* include/Makefile.in: Regenerate.

libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in

index 5b259164a013b3a6c0703ec629fab6b75918a66f..60f21017664126bed243d792e8bcb83faff79940 100644 (file)
@@ -1,5 +1,13 @@
 2020-01-24  Jonathan Wakely  <jwakely@redhat.com>
 
+       Backport from mainline
+       2020-01-23  Jonathan Wakely  <jwakely@redhat.com>
+
+       PR libstdc++/91947
+       * include/Makefile.am (${host_builddir}/largefile-config.h): Simplify
+       rule.
+       * include/Makefile.in: Regenerate.
+
        Backport from mainline
        2020-01-20  Jonathan Wakely  <jwakely@redhat.com>
 
index f4d89db30bb49df9a7ccb15404f811e5af445bd0..7958f43624218ff30dc7eabc0a32218bb83cd1fc 100644 (file)
@@ -1285,22 +1285,12 @@ stamp-float128:
 endif
 
 # This header is not installed, it's only used to build libstdc++ itself.
-${host_builddir}/largefile-config.h: ${CONFIG_HEADER} \
-                                    ${glibcxx_srcdir}/include/bits/c++config
-       @echo '#if defined _GLIBCXX_CXX_CONFIG_H || defined _FEATURES_H' > $@
-       @echo '# error "This file must be included before any others"' >> $@
-       @echo '#endif' >> $@
-       @echo >> $@
-       @echo '/* Enable large inode numbers on Mac OS X 10.5.  */' >> $@
-       @echo '#ifndef _DARWIN_USE_64_BIT_INODE' >> $@
-       @echo '# define _DARWIN_USE_64_BIT_INODE 1' >> $@
-       @echo '#endif' >> $@
-       @echo >> $@
-       @echo '/* Number of bits in a file offset, on hosts where this is settable. */' >> $@
-       @grep '_FILE_OFFSET_BITS' ${CONFIG_HEADER} >> $@
-       @echo >> $@
-       @echo '/* Define for large files, on AIX-style hosts. */' >> $@
-       @grep '_LARGE_FILES' ${CONFIG_HEADER} >> $@
+${host_builddir}/largefile-config.h: ${CONFIG_HEADER}
+       @rm -f $@.tmp
+       @-grep 'define _DARWIN_USE_64_BIT_INODE' ${CONFIG_HEADER} >> $@.tmp
+       @-grep 'define _FILE_OFFSET_BITS' ${CONFIG_HEADER} >> $@.tmp
+       @-grep 'define _LARGE_FILES' ${CONFIG_HEADER} >> $@.tmp
+       @mv $@.tmp $@
 
 # NB: The non-empty default ldbl_compat works around an AIX sed
 # oddity, see libstdc++/31957 for details.
index 40628e1978ae005f5356f08bdf3cdb016338d0b0..631c77280b00b1a933e2f4a8c8c5cbce84ee7e8f 100644 (file)
@@ -1767,22 +1767,12 @@ stamp-host: ${host_headers} ${bits_host_headers} ${ext_host_headers} ${host_head
 @ENABLE_FLOAT128_FALSE@        echo 'undef _GLIBCXX_USE_FLOAT128' > stamp-float128
 
 # This header is not installed, it's only used to build libstdc++ itself.
-${host_builddir}/largefile-config.h: ${CONFIG_HEADER} \
-                                    ${glibcxx_srcdir}/include/bits/c++config
-       @echo '#if defined _GLIBCXX_CXX_CONFIG_H || defined _FEATURES_H' > $@
-       @echo '# error "This file must be included before any others"' >> $@
-       @echo '#endif' >> $@
-       @echo >> $@
-       @echo '/* Enable large inode numbers on Mac OS X 10.5.  */' >> $@
-       @echo '#ifndef _DARWIN_USE_64_BIT_INODE' >> $@
-       @echo '# define _DARWIN_USE_64_BIT_INODE 1' >> $@
-       @echo '#endif' >> $@
-       @echo >> $@
-       @echo '/* Number of bits in a file offset, on hosts where this is settable. */' >> $@
-       @grep '_FILE_OFFSET_BITS' ${CONFIG_HEADER} >> $@
-       @echo >> $@
-       @echo '/* Define for large files, on AIX-style hosts. */' >> $@
-       @grep '_LARGE_FILES' ${CONFIG_HEADER} >> $@
+${host_builddir}/largefile-config.h: ${CONFIG_HEADER}
+       @rm -f $@.tmp
+       @-grep 'define _DARWIN_USE_64_BIT_INODE' ${CONFIG_HEADER} >> $@.tmp
+       @-grep 'define _FILE_OFFSET_BITS' ${CONFIG_HEADER} >> $@.tmp
+       @-grep 'define _LARGE_FILES' ${CONFIG_HEADER} >> $@.tmp
+       @mv $@.tmp $@
 
 # NB: The non-empty default ldbl_compat works around an AIX sed
 # oddity, see libstdc++/31957 for details.