public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Samuel Thibault <sthibaul@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] hurd: Rework generating errno.h
Date: Sun,  6 Aug 2023 20:36:28 +0000 (GMT)	[thread overview]
Message-ID: <20230806203628.0EFDB3857806@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=53850f044f65dd11efdf67a2ab214d312295d85c

commit 53850f044f65dd11efdf67a2ab214d312295d85c
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Aug 6 20:32:46 2023 +0000

    hurd: Rework generating errno.h
    
    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.

Diff:
---
 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.  */";

                 reply	other threads:[~2023-08-06 20:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230806203628.0EFDB3857806@sourceware.org \
    --to=sthibaul@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).