From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113741 invoked by alias); 29 Dec 2018 22:59:52 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 113731 invoked by uid 89); 29 Dec 2018 22:59:51 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,SPF_PASS autolearn=ham version=3.3.2 spammy=HTo:U*gerald X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 29 Dec 2018 22:59:49 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 551A9AC8A; Sat, 29 Dec 2018 22:59:47 +0000 (UTC) Subject: Re: [PATCH 4/4][libbacktrace] Add tests for unused formats To: Gerald Pfeifer , Ian Lance Taylor , gcc-patches@gcc.gnu.org Cc: Rainer Orth References: <20181123205612.GA3609@delia> From: Tom de Vries Message-ID: <0a906242-3738-bce0-c06d-e420e1183a5e@suse.de> Date: Sun, 30 Dec 2018 09:06:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-12/txt/msg01767.txt.bz2 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 > > * 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@ > $@ >