On 29-12-18 07:40, Gerald Pfeifer wrote: > On Fri, 23 Nov 2018, Tom de Vries wrote: >> When building libbacktrace, we typically use elf.c, and don't build >> pecoff.c, xcoff.c or unknown.c >> >> Add testcases that use unused format to ensure that we also build and >> test those on a typical development setup. > > This is a good idea! > >> Bootstrapped and reg-tested on x86_64. > > Unfortunately, on i586-unknown-freebsd11 I'm now seeing the likes of > > gmake[3]: *** [Makefile:1086: xcoff_32.lo] Error 1 > xcoff_64.c:54:29: error: extra tokens at end of #undef directive [-Werror] > 54 | #undef BACKTRACE_XCOFF_SIZEn#define BACKTRACE_XCOFF_SIZE 64 > | ^ > xcoff_64.c:54:29: warning: extra tokens at end of #undef directive > 54 | #undef BACKTRACE_XCOFF_SIZEn#define BACKTRACE_XCOFF_SIZE 64 > | ^ > cc1: all warnings being treated as errors > gmake[3]: *** [Makefile:1086: xcoff_64.lo] Error 1 > > The reason is that GNU sed supports \n in the replacement pattern > > % echo "abc" | sed -E 's:b:\n:' > a > c > > whereas BSD sed does not > > % echo "abc" | sed -E 's:b:\n:' > anc > > so the following in libbacktrace/Makefile.am doesn't work: > > xcoff_%.c: xcoff.c > SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ > REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define BACKTRACE_XCOFF_SIZE'; \ > $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ > $(srcdir)/xcoff.c \ > > $@ > > > I believe that in addition to FreeBSD this probably also fails on > Solaris and Darwin. > > The patch below should address this (and does in my tests), though > my tester seems to have unrelated(?) problems right now, so better > for one of you to give a spin as well, please. >
Hi, thanks for finding this. I build the patch for x86_64 and ran make check in the libbacktrace subdirectory of the build directory, results looks good. Thanks, - Tom > Gerald > > > > 2018-12-28 Gerald Pfeifer <ger...@pfeifer.com> > > * Makefile.am (xcoff_%.c): Use an actual newline instead of \n. > * Makefile.in: Regenerate. > > Index: libbacktrace/Makefile.am > =================================================================== > --- libbacktrace/Makefile.am (revision 267460) > +++ libbacktrace/Makefile.am (working copy) > @@ -105,7 +105,8 @@ > > xcoff_%.c: xcoff.c > SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ > - REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define BACKTRACE_XCOFF_SIZE'; \ > + REPLACE='#undef BACKTRACE_XCOFF_SIZE\ > + #define BACKTRACE_XCOFF_SIZE'; \ > $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ > $(srcdir)/xcoff.c \ > > $@ > Index: libbacktrace/Makefile.in > =================================================================== > --- libbacktrace/Makefile.in (revision 267460) > +++ libbacktrace/Makefile.in (working copy) > @@ -1733,7 +1733,8 @@ > > @NATIVE_TRUE@xcoff_%.c: xcoff.c > @NATIVE_TRUE@ SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \ > -@NATIVE_TRUE@ REPLACE='#undef BACKTRACE_XCOFF_SIZE\n#define > BACKTRACE_XCOFF_SIZE'; \ > +@NATIVE_TRUE@ REPLACE='#undef BACKTRACE_XCOFF_SIZE\ > +@NATIVE_TRUE@ #define BACKTRACE_XCOFF_SIZE'; \ > @NATIVE_TRUE@ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \ > @NATIVE_TRUE@ $(srcdir)/xcoff.c \ > @NATIVE_TRUE@ > $@ >