public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6138] Libbacktrace: Fix the use of newline in sed replacement
@ 2021-12-28 22:29 Franथईois-Xavier Coudert
  0 siblings, 0 replies; only message in thread
From: Franथईois-Xavier Coudert @ 2021-12-28 22:29 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0ac7bab6181cf3400ba1f53fd6aac92900eef1e5

commit r12-6138-g0ac7bab6181cf3400ba1f53fd6aac92900eef1e5
Author: Francois-Xavier Coudert <fxcoudert@gmail.com>
Date:   Tue Dec 28 23:28:49 2021 +0100

    Libbacktrace: Fix the use of newline in sed replacement
    
    On non-ELF targets, the Makefile needs a newline inside the sed REPLACE
    string. The way it is currently done fails with GNU Make < 4, but GCC
    only requires "GNU make version 3.80 (or later)".
    
    The portable solution is given in the autoconf manual:
    https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Newlines-in-Make-Rules.html
    
    libbacktrace/ChangeLog:
    
            PR libbacktrace/103822
    
            * Makefile.am: Fix newline.
            * Makefile.in: Regenerate.

Diff:
---
 libbacktrace/Makefile.am | 8 ++++----
 libbacktrace/Makefile.in | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/libbacktrace/Makefile.am b/libbacktrace/Makefile.am
index 8874f41338a..d200e3a9433 100644
--- a/libbacktrace/Makefile.am
+++ b/libbacktrace/Makefile.am
@@ -145,18 +145,18 @@ endif HAVE_OBJCOPY_DEBUGLINK
 endif HAVE_ELF
 
 elf_%.c: elf.c
+	nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
 	SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \
-	REPLACE='#undef BACKTRACE_ELF_SIZE\
-	#define BACKTRACE_ELF_SIZE'; \
+	REPLACE="#undef BACKTRACE_ELF_SIZE\\$${nl}#define BACKTRACE_ELF_SIZE"; \
 	$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
 		$< \
 		> $@.tmp
 	mv $@.tmp $@
 
 xcoff_%.c: xcoff.c
+	nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
 	SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
-	REPLACE='#undef BACKTRACE_XCOFF_SIZE\
-	#define BACKTRACE_XCOFF_SIZE'; \
+	REPLACE="#undef BACKTRACE_XCOFF_SIZE\\$${nl}#define BACKTRACE_XCOFF_SIZE"; \
 	$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
 		$< \
 		> $@.tmp
diff --git a/libbacktrace/Makefile.in b/libbacktrace/Makefile.in
index 2ba8dfa8428..08cdd21fb40 100644
--- a/libbacktrace/Makefile.in
+++ b/libbacktrace/Makefile.in
@@ -2408,18 +2408,18 @@ uninstall-am:
 @HAVE_ELF_TRUE@@HAVE_OBJCOPY_DEBUGLINK_TRUE@@NATIVE_TRUE@	mv $@.tmp $@
 
 @NATIVE_TRUE@elf_%.c: elf.c
+@NATIVE_TRUE@	nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
 @NATIVE_TRUE@	SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \
-@NATIVE_TRUE@	REPLACE='#undef BACKTRACE_ELF_SIZE\
-@NATIVE_TRUE@	#define BACKTRACE_ELF_SIZE'; \
+@NATIVE_TRUE@	REPLACE="#undef BACKTRACE_ELF_SIZE\\$${nl}#define BACKTRACE_ELF_SIZE"; \
 @NATIVE_TRUE@	$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
 @NATIVE_TRUE@		$< \
 @NATIVE_TRUE@		> $@.tmp
 @NATIVE_TRUE@	mv $@.tmp $@
 
 @NATIVE_TRUE@xcoff_%.c: xcoff.c
+@NATIVE_TRUE@	nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
 @NATIVE_TRUE@	SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
-@NATIVE_TRUE@	REPLACE='#undef BACKTRACE_XCOFF_SIZE\
-@NATIVE_TRUE@	#define BACKTRACE_XCOFF_SIZE'; \
+@NATIVE_TRUE@	REPLACE="#undef BACKTRACE_XCOFF_SIZE\\$${nl}#define BACKTRACE_XCOFF_SIZE"; \
 @NATIVE_TRUE@	$(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
 @NATIVE_TRUE@		$< \
 @NATIVE_TRUE@		> $@.tmp


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-28 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 22:29 [gcc r12-6138] Libbacktrace: Fix the use of newline in sed replacement Franथईois-Xavier Coudert

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).