public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Use `as_fn_error' to report errors in `preconfigure'
@ 2022-05-12 17:19 Maciej W. Rozycki
  2022-05-12 17:32 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej W. Rozycki @ 2022-05-12 17:19 UTC (permalink / raw)
  To: libc-alpha; +Cc: Palmer Dabbelt, Darius Rad, Andrew Waterman, DJ Delorie

Unlike some other `preconfigure' fragments the RISC-V one uses `echo' 
and `exit' directly for error handling.  Owing to the lack of any kind 
of error annotation it makes it difficult to spot the message in the 
flood in a parallel build and neither it is logged in `config.log'.

Switch to using `as_fn_error' then as the fragment is sourced from the 
main `configure' script and therefore the function can be used like in 
other `preconfigure' fragments, so the message printed is such as:

configure: error: glibc requires the A extension

rather than plain:

glibc requires the A extension

and one can filter on the "error" part.
---
 sysdeps/riscv/preconfigure |   18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

glibc-riscv-preconfigure-as-fn-error.diff
Index: glibc/sysdeps/riscv/preconfigure
===================================================================
--- glibc.orig/sysdeps/riscv/preconfigure
+++ glibc/sysdeps/riscv/preconfigure
@@ -9,8 +9,7 @@ riscv*)
     64 | 32)
 	;;
     *)
-	echo "Unable to determine XLEN" >&2
-	exit 1
+	as_fn_error 1 "Unable to determine XLEN" "$LINENO" 5
 	;;
     esac
 
@@ -20,15 +19,13 @@ riscv*)
 	with_fp_cond=1
 	;;
     32)
-	echo "glibc does not yet support systems with the F but not D extensions" >&2
-	exit 1
+	as_fn_error 1 "glibc does not yet support systems with the F but not D extensions" "$LINENO" 5
 	;;
     "")
 	with_fp_cond=0
 	;;
     *)
-	echo "Unable to determine FLEN" >&2
-	exit 1
+	as_fn_error 1 "Unable to determine FLEN" "$LINENO" 5
 	;;
     esac
 
@@ -37,15 +34,13 @@ riscv*)
 	abi_flen=0
 	;;
     single)
-	echo "glibc does not yet support the single floating-point ABI" >&2
-	exit 1
+	as_fn_error 1 "glibc does not yet support the single floating-point ABI" "$LINENO" 5
 	;;
     double)
 	abi_flen=64
 	;;
     *)
-	echo "Unable to determine floating-point ABI" >&2
-	exit 1
+	as_fn_error 1 "Unable to determine floating-point ABI" "$LINENO" 5
 	;;
     esac
 
@@ -53,8 +48,7 @@ riscv*)
     __riscv_atomic)
         ;;
     *)
-        echo "glibc requires the A extension" >&2
-	exit 1
+	as_fn_error 1 "glibc requires the A extension" "$LINENO" 5
 	;;
     esac
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Use `as_fn_error' to report errors in `preconfigure'
  2022-05-12 17:19 [PATCH] RISC-V: Use `as_fn_error' to report errors in `preconfigure' Maciej W. Rozycki
@ 2022-05-12 17:32 ` Andreas Schwab
  2022-05-12 18:39   ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2022-05-12 17:32 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: libc-alpha, Andrew Waterman

On Mai 12 2022, Maciej W. Rozycki wrote:

> Switch to using `as_fn_error' then as the fragment is sourced from the 
> main `configure' script and therefore the function can be used like in 
> other `preconfigure' fragments, so the message printed is such as:

I don't think we should use autoconf internals.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RISC-V: Use `as_fn_error' to report errors in `preconfigure'
  2022-05-12 17:32 ` Andreas Schwab
@ 2022-05-12 18:39   ` Maciej W. Rozycki
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2022-05-12 18:39 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: libc-alpha, Andrew Waterman

On Thu, 12 May 2022, Andreas Schwab wrote:

> > Switch to using `as_fn_error' then as the fragment is sourced from the 
> > main `configure' script and therefore the function can be used like in 
> > other `preconfigure' fragments, so the message printed is such as:
> 
> I don't think we should use autoconf internals.

 In principle I agree, I just didn't realise we have some `preconfigure' 
fragments handwritten and some autoconf-generated.  That probably confused 
people too who added various handwritten equivalents where they would have 
best relied on autoconf instead.

 So let's fix the C-SKY and RISC-V ones, which already both mess up with 
confdefs.h the wrong way, update them along with the m68k one for proper 
error reporting, and fix the MIPS one which already incorrectly relies on 
`as_fn_error'.  Other fragments are either generated or do not appear to 
mess up with autoconf internals.

 Sending v2 right away, for the total of 4 patches now.  Thanks for your 
review!

  Maciej

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-12 18:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 17:19 [PATCH] RISC-V: Use `as_fn_error' to report errors in `preconfigure' Maciej W. Rozycki
2022-05-12 17:32 ` Andreas Schwab
2022-05-12 18:39   ` Maciej W. Rozycki

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).