From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7DCDE3858C31 for ; Wed, 25 Oct 2023 23:14:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7DCDE3858C31 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7DCDE3858C31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698275678; cv=none; b=BCLBQlCz7gY8/V7L2T2KrgCOk8F0phGimChLWhqZWI9Zsjt5hKDDkUE9S9NHI1XQ6sTnsjyxHQho0g6IniwD41oICWgxQmo85B2nuw/YDJ5rwpuIZbGloOzKXlspLqYGY86PkethjXbziw8IZVZaA6QSFjs9l1B73pv2xtb19sk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698275678; c=relaxed/simple; bh=TbBjqQ9+Ws+zAV5lQmMii7auTQTdMfegyT7PQVEHkFA=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=wr/In07fAH4oK4PEoUpOquC6gD19lSHYUcc6j2KS/+G8KZkm8Co4xxF42NreMjPPrPSz1OePkOTeuEJKQ5Z6wDZz/euIWqziR2fsYeJSuFKgHZttbO/FHlJe4pgLsZQ31DfV4SuVejVS6uOBqsA0+/iP14I246YNiJF5ITqIlTs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698275676; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=EGyCTnE/vW/NdZlAgIJVBmh9VGDlIOeWvwLvvDvR//E=; b=hjwltNMbthcWsKzTlDaPvVCLWiP/ElozuyG7aS8azpwWJoUIOYu+453CCaUOSRZC3wGjxF k9xEzNYuFxVRg8iM37tSSAKczchXOmiXkQn3F2MbA7EGPERtCOthM/53gUEsdKaX1bvGZB otbonwOptUq1w53tXxd+9ZnK5rDASc8= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-S5cu4zSrMrKPu1CydZgEAg-1; Wed, 25 Oct 2023 19:14:34 -0400 X-MC-Unique: S5cu4zSrMrKPu1CydZgEAg-1 Received: by mail-ed1-f70.google.com with SMTP id 4fb4d7f45d1cf-51e535b143fso51550a12.1 for ; Wed, 25 Oct 2023 16:14:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698275672; x=1698880472; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EGyCTnE/vW/NdZlAgIJVBmh9VGDlIOeWvwLvvDvR//E=; b=eNb+ZVKFwrIrQJixyWzBS3e7cLDdnAxSnvh09NuIi5nfNinAw+gsyPOACnWGU+cY4o XTWagCGw2OHI1flRsmzMVfES3FgvmMV6VCVBXpoGbZZq3XRe1DGsIGJSlMsaQXspj7Gd NH0FRAGPAiVU/tgTqtwzsLvPTsjvzu53/Zn4QbSGYrkqpSam1akLWFUmLKLDm+ipNZY3 gScs4+XlU28214JNuj2urBuOfOQXf0nKOGG6vxnEf8iH8czSh2tC2o2Mb9IK4hppA0nY R4UgUH1+SCPSI3D9VXZJ/qOELZtLd790snqlFRBEXCg1gAs9eic95d5t9STDq3QA+EQ2 VE6Q== X-Gm-Message-State: AOJu0YzycHPNwebjufF7fBQdqZL1qQNa33rJjkVE4qiOuhW4VCz9oh0i gvjWyJu12Ou9B9+84+J7WQFFlERzJU/1huQKs93p2B2a45THwJxmQI6/VyoLQrUNX3SNYXeilqq iOFg+kK8kPc8TTdT+93Oo1qjbVMMm+qA= X-Received: by 2002:a17:906:225c:b0:9be:f78a:d438 with SMTP id 28-20020a170906225c00b009bef78ad438mr13672185ejr.5.1698275672549; Wed, 25 Oct 2023 16:14:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcWkXk/zTLwWW3rLI/k8FXCu0+EFq3BiziBsQjV4xhwj6sPnNDppHOrKPVslLnIADxaAQ+4yMRqfijViqBmu4= X-Received: by 2002:a17:906:225c:b0:9be:f78a:d438 with SMTP id 28-20020a170906225c00b009bef78ad438mr13672178ejr.5.1698275672074; Wed, 25 Oct 2023 16:14:32 -0700 (PDT) MIME-Version: 1.0 References: <20231015093230.27356-1-vapier@gentoo.org> In-Reply-To: <20231015093230.27356-1-vapier@gentoo.org> From: Jeff Johnston Date: Wed, 25 Oct 2023 19:14:20 -0400 Message-ID: Subject: Re: [PATCH] newlib: filter out versions from newlib.h to simplify autoreconf To: Mike Frysinger Cc: newlib@sourceware.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="0000000000002a43f40608929ece" X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --0000000000002a43f40608929ece Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Works well. Feel free to push. -- Jeff J. On Sun, Oct 15, 2023 at 5:32=E2=80=AFAM Mike Frysinger = wrote: > We've been manually editing newlib.hin after generating it with > autoheader to drop the version defines that we keep in the separate > _newlib_version.h header. This is confusing for people, and is an > easy source of mistakes/errors. > > Since we're already running sed on newlib.h during configure to > filter out defines we don't want to expose, add the version macros > there too. This way we don't have to manually edit newlib.hin. > > This simplifies the autoreconf step in exchange for a slightly more > complicated configure+sed step, but seems worth the trade-off. > --- > newlib/configure | 2 +- > newlib/configure.ac | 5 ++++- > newlib/newlib.hin | 12 ++++++++++++ > 3 files changed, 17 insertions(+), 2 deletions(-) > > diff --git a/newlib/configure b/newlib/configure > index 0585e0ee8b33..b21d9bf45810 100755 > --- a/newlib/configure > +++ b/newlib/configure > @@ -9269,7 +9269,7 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} > > > case $ac_file$ac_mode in > - "newlib.h":H) sed -i.tmp -e '/^#define [^_]/d' -e '/^\/\* #undef > [^_]/d' newlib.h && rm -f newlib.h.tmp ;; > + "newlib.h":H) sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef > [^_]/d' -e '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' > newlib.h && rm -f newlib.h.tmp ;; > "default-1":C) > # Only add multilib support code if we just rebuilt the top-level > # Makefile. > diff --git a/newlib/configure.ac b/newlib/configure.ac > index 94242c082d20..55e5a944689f 100644 > --- a/newlib/configure.ac > +++ b/newlib/configure.ac > @@ -8,8 +8,11 @@ dnl Since we can't control what defines autoheader picks > up (various autoconf > dnl macros will add their own), filter out all the ones w/out a _ > prefix. All > dnl the ones we want to export use a _ prefix, and all the rest we don't > want > dnl to export as it'll pollute the namespace of newlib users. > +dnl We also filter out version defines that we want in _newlib_version.h. > dnl NB: newlib.h must be the first AC_CONFIG_HEADERS call for autoheader. > -AC_CONFIG_HEADERS([newlib.h:newlib.hin], [sed -i.tmp -e '/^#define > [^_]/d' -e '/^\/\* #undef [^_]/d' newlib.h && rm -f newlib.h.tmp]) > +AC_CONFIG_HEADERS( > + [newlib.h:newlib.hin], > + [sed -i.tmp -E -e '/^#define [^_]/d' -e '/^\/\* #undef [^_]/d' -e > '/_NEWLIB_VERSION|__NEWLIB_(MINOR|PATCHLEVEL)__|__NEWLIB__/d' newlib.h && > rm -f newlib.h.tmp]) > AH_TOP([/* NB: The contents are filtered before being installed. */ > > #ifndef __NEWLIB_H__ > diff --git a/newlib/newlib.hin b/newlib/newlib.hin > index e87a5eabbb24..8318469400b0 100644 > --- a/newlib/newlib.hin > +++ b/newlib/newlib.hin > @@ -375,6 +375,9 @@ > /* nano version of malloc is used. */ > #undef _NANO_MALLOC > > +/* The newlib version in string format. */ > +#undef _NEWLIB_VERSION > + > /* Verify _REENT_CHECK macros allocate memory successfully. */ > #undef _REENT_CHECK_VERIFY > > @@ -422,4 +425,13 @@ > /* Define if wide char orientation is supported. */ > #undef _WIDE_ORIENT > > +/* The newlib minor version number. */ > +#undef __NEWLIB_MINOR__ > + > +/* The newlib patch level. */ > +#undef __NEWLIB_PATCHLEVEL__ > + > +/* The newlib major version number. */ > +#undef __NEWLIB__ > + > #endif /* !__NEWLIB_H__ */ > -- > 2.42.0 > > --0000000000002a43f40608929ece--