From patchwork Sun Aug 6 20:36:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 73665 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 15CB13857723 for ; Sun, 6 Aug 2023 20:36:50 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from sonata.ens-lyon.org (domu-toccata.ens-lyon.fr [140.77.166.138]) by sourceware.org (Postfix) with ESMTPS id D09FD3857735 for ; Sun, 6 Aug 2023 20:36:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D09FD3857735 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bounce.ens-lyon.org Received: from localhost (localhost [127.0.0.1]) by sonata.ens-lyon.org (Postfix) with ESMTP id AF0E3200F3; Sun, 6 Aug 2023 22:36:34 +0200 (CEST) Received: from sonata.ens-lyon.org ([127.0.0.1]) by localhost (sonata.ens-lyon.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9RMFnJqe04Wx; Sun, 6 Aug 2023 22:36:34 +0200 (CEST) Received: from begin (lfbn-bor-1-1163-184.w92-158.abo.wanadoo.fr [92.158.138.184]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by sonata.ens-lyon.org (Postfix) with ESMTPSA id 5F224200EE; Sun, 6 Aug 2023 22:36:34 +0200 (CEST) Received: from samy by begin with local (Exim 4.96) (envelope-from ) id 1qSkUL-0092Y1-2j; Sun, 06 Aug 2023 22:36:33 +0200 From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault , commit-hurd@gnu.org Subject: [hurd,commited] hurd: Rework generating errno.h Date: Sun, 6 Aug 2023 22:36:33 +0200 Message-Id: <20230806203633.2154738-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" We only need to give to gawk the headers that actually define error numbers, so let's rather filter out the other included headers early. --- sysdeps/mach/hurd/Makefile | 30 ++++++++++++++++++------------ sysdeps/mach/hurd/bits/errno.h | 24 ------------------------ sysdeps/mach/hurd/errnos.awk | 6 +----- 3 files changed, 19 insertions(+), 41 deletions(-) diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 5bc682a397..029dac4bc7 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -66,26 +66,32 @@ errno.texinfo = $(..)manual/errno.texi hurd = $(..)sysdeps/mach/hurd -define mach-errno-h -($(foreach h,mach/message.h \ +mach-errno-h = \ + mach/message.h \ mach/kern_return.h \ mach/mig_errors.h \ - device/device_types.h,\ - echo '#include <$h>';\ - )) -endef + device/device_types.h # We use the compiler to generate a list of absolute file names for # the headers we want to search for Mach error codes, listed above (and # incidentally, all other headers those include). -include $(common-objpfx)errnos.d $(common-objpfx)errnos.d: $(mach-errnos-deps) - $(mach-errno-h) | \ - $(CC) $(CFLAGS) \ - $(subst -include $(common-objpfx)libc-modules.h,,$(CPPFLAGS)) \ - -M -x c - | \ - sed $(sed-remove-objpfx) -e 's,- *:,mach-errnos-deps :=,' \ - -e 's, \.\./, $(..),g' > $@t + echo -n "mach-errnos-deps := " > $@t + for h in $(mach-errno-h) ; do \ + echo "#include <$$h>" \ + | $(CC) $(CFLAGS) \ + $(subst -include $(common-objpfx)libc-modules.h,,$(CPPFLAGS)) \ + -M -x c - \ + | sed $(sed-remove-objpfx) \ + -e 's, \.\./, $(..),g' \ + -e 's,\\$$,,g' \ + -e 's, ,\n,g' \ + | grep "$$h$$" \ + | tr '\n' ' ' \ + >> $@t ; \ + done + echo >> $@t mv -f $@t $@ $(hurd)/bits/errno.h: $(common-objpfx)stamp-errnos ; diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h index a0794f96aa..3b54f5855e 100644 --- a/sysdeps/mach/hurd/bits/errno.h +++ b/sysdeps/mach/hurd/bits/errno.h @@ -1,33 +1,9 @@ /* This file generated by errnos.awk from errno.texi - stdc-predef.h - libc-symbols.h mach/message.h mach/kern_return.h - mach/port.h - mach/boolean.h - stdint.h - ../stdlib/stdint.h - ../bits/libc-header-start.h - features.h - features-time64.h - ../sysdeps/generic/features-time64.h - sys/cdefs.h - ../misc/sys/cdefs.h - ../sysdeps/x86/bits/wordsize.h - ../sysdeps/ieee754/ldbl-96/bits/long-double.h - gnu/stubs.h - bits/types.h - ../posix/bits/types.h - ../sysdeps/mach/hurd/bits/timesize.h - ../sysdeps/mach/hurd/bits/typesizes.h - ../bits/time64.h - ../bits/wchar.h - ../bits/stdint-intn.h - ../bits/stdint-uintn.h mach/mig_errors.h device/device_types.h - mach/std_types.h Do not edit this file; edit errnos.awk and regenerate it. */ #ifndef _BITS_ERRNO_H diff --git a/sysdeps/mach/hurd/errnos.awk b/sysdeps/mach/hurd/errnos.awk index b9f717c1af..507e9d26ff 100644 --- a/sysdeps/mach/hurd/errnos.awk +++ b/sysdeps/mach/hurd/errnos.awk @@ -23,12 +23,8 @@ BEGIN { for (i = 1; i < ARGC; i++) { arg = ARGV[i]; - sub(/.*(manual|include)\//, "", arg); + sub(/.*(manual|include|-gnu)\//, "", arg); if (arg ~ /.*errnos.d/) continue; - # Those not not actually define anything for errno.h - if (arg ~ /mach\/.*\/kern_return.h/) continue; - if (arg ~ /mach\/.*\/boolean.h/) continue; - if (arg ~ /mach\/.*\/vm_types.h/) continue; print " " arg; } print " Do not edit this file; edit errnos.awk and regenerate it. */";