* config.sub: Cordon off single component aliases.

More detail from the patch author:

Currently there are number of aliases that expand both on their own
and as part of multi-component configurations. For example:

	$ ./config.sub 386bsd-linux
	i386-pc-bsd

This change moves all of those to just trigger on a single field
branch, preventing their matching as part of larger components:

	$ ./config.sub 386bsd-linux
	Invalid configuration `386bsd-linux': machine `386bsd' not recognized

This should increase correctness and avoid needless work in the common
case (as many of these are very, very old).

I was very conservative in deciding which patterns were such single
component aliases, as this does make config.sub less forgiving than
before. My criteria for patterns in this `case $basic_machine` were:

  - the pattern doesn't contain any `-`
  - the pattern doesn't contain any `*`
  - `os` was assigned in the match body
  - basic_machine wasn't essentially left as is.

The first rule is simple: if it contains a `-` it's not a
single-component pattern. The second rule is because any
`$basic_machine` pattern with an asterisk (`*`) could conceivably
match a two component string, even if the actual code strongly
signaled that was not the intent. The third rule was to indicate no
`os` was expected, as it is valid to omit a vendor in the two
component case so `basic_machine` is just one component without being
the entire configuration.

The 4th and last rule is the trickiest. If the basic_machine was left
as is, or appended with a vendor, I considered the pattern less of an
alias and more a defaulting of a canonical or near canonical
name. This seemed like a "higher quality" short-hand and thus one that
is valid as part of a larger config. Instead of just hard-assigning
`os`, however, I changed it to default `os` with:

	os=${os:-DEFAULT}

so as to respect any more information the user passed. This gives us
more pleasant absurdities like:
	$ ./config.sub j90
	j90-cray-unicos

	$ ./config.sub j90-linux
	j90-cray-linux-gnu

rather than:
	$ ./config.sub j90-linux
	j90-cray-unicos

Signed-off-by: Ben Elliston <bje@gnu.org>
This commit is contained in:
John Ericson 2018-05-19 13:59:45 +10:00 committed by Ben Elliston
parent 45e7cb552c
commit 14ec0b015e
2 changed files with 404 additions and 391 deletions

View File

@ -1,3 +1,7 @@
2018-05-19 John Ericson <john.ericson@obsidian.systems>
* config.sub: Cordon off single component aliases.
2018-05-14 Ben Elliston <bje@gnu.org>
* Makefile (shellcheck): Include testsuite/*.sh scripts.

791
config.sub vendored

File diff suppressed because it is too large Load Diff