Re: [PATCH 2/3] config.sub: Factor out `invalid_config` function

2023-09-21 Thread Jacob Bachmeyer
Zack Weinberg wrote: On Thu, Sep 21, 2023, at 3:52 PM, John Ericson wrote: ... # Functions ### +# Invalid configuration; display a message and exit +# +# Param 1: configuration +# Param 2: message +invalid_config () { + echo "Invalid configuration '$1': $2" 1>&2 + exit

Re: [PATCH] config.sub: Accept LLVM-style $cpu-$vendor-windows-cygnus

2023-09-21 Thread Jacob Bachmeyer
Zack Weinberg wrote: On Wed, Sep 20, 2023, at 9:59 AM, John Ericson wrote: On Wed, Sep 20, 2023, at 6:01 AM, Dmitry V. Levin wrote: Of course config.sub can provide a canonicalization of windows-cygnus into cygwin if it helps. I was worried that would close off the possibility o

Re: [PATCH 2/3] config.sub: Factor out `invalid_config` function

2023-09-21 Thread Zack Weinberg
On Thu, Sep 21, 2023, at 3:52 PM, John Ericson wrote: ... > # Functions > ### > > +# Invalid configuration; display a message and exit > +# > +# Param 1: configuration > +# Param 2: message > +invalid_config () { > + echo "Invalid configuration '$1': $2" 1>&2 > + exit 1 > +} Um.

[PATCH 1/3] config.sub: Start moving code into functions

2023-09-21 Thread John Ericson
The idea is to be explicit about the different steps, and also separate the more regular parts from the more irregular parts. This is a large diff, but simple code motion. Anything that less trivially preserves behavior would done separately so it is reasonably possible to review. --- config.sub

[PATCH 2/3] config.sub: Factor out `invalid_config` function

2023-09-21 Thread John Ericson
There were indeed some cases we displayed the message but then forgot to exit! --- config.sub | 44 +--- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/config.sub b/config.sub index 79a960d..7d6c7be 100755 --- a/config.sub +++ b/config.sub @

[PATCH 3/3] config.sub: Factor out single-field shorthands

2023-09-21 Thread John Ericson
This is another "big case" that deserves to be in its own function. These are rather legacy cases so it is use to have them "out of the way" when reading the code too. --- config.sub | 914 +++-- 1 file changed, 464 insertions(+), 450 deletions(-)

Re: [PATCH] config.sub: Accept LLVM-style $cpu-$vendor-windows-cygnus

2023-09-21 Thread John Ericson
On 9/21/23 09:35, Dmitry V. Levin wrote: On Wed, Sep 20, 2023 at 09:59:22AM -0400, John Ericson wrote: Of course config.sub can provide a canonicalization of windows-cygnus into cygwin if it helps. I was worried that would close off the possibility of adding them as normal forms later, but

[PATCH] config.sub: Fix some inconsistent indentation

2023-09-21 Thread John Ericson
From: John Ericson A mix of spaces and tabs were used here instead of tabs. I would certainly not oppose switching from tabs to spaces everywhere, but right now most things use tabs, so I went with that. --- config.sub | 44 ++-- 1 file changed, 22 insert

Re: [PATCH] config.sub: Accept LLVM-style $cpu-$vendor-windows-cygnus

2023-09-21 Thread Dmitry V. Levin
On Wed, Sep 20, 2023 at 09:59:22AM -0400, John Ericson wrote: > On Wed, Sep 20, 2023, at 6:01 AM, Dmitry V. Levin wrote: > > The issue with adding new names duplicating already supported ones is that > > every piece of software that handles the old name would have to be patched > > eventually to ha

Re: [PATCH] config.sub: Accept LLVM-style $cpu-$vendor-windows-cygnus

2023-09-21 Thread Zack Weinberg
On Wed, Sep 20, 2023, at 9:59 AM, John Ericson wrote: > On Wed, Sep 20, 2023, at 6:01 AM, Dmitry V. Levin wrote: >> Of course config.sub can provide a canonicalization of windows-cygnus >> into cygwin if it helps. > > I was worried that would close off the possibility of adding them as > normal for