diff options
author | Richard Levitte <levitte@openssl.org> | 2019-09-13 00:06:46 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2019-09-16 16:29:57 +0200 |
commit | 1aa89a7a3afb053d0c0b7fad8d3ea1b0a5447289 (patch) | |
tree | ec9b4705f579c93debe2484db1e93bcbb755d29e /crypto/x86cpuid.pl | |
parent | a1c8befd661fa2145d330bb04ebc6061660db4fd (diff) |
Unify all assembler file generators
They now generally conform to the following argument sequence:
script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \
$(PROCESSOR) <output file>
However, in the spirit of being able to use these scripts manually,
they also allow for no argument, or for only the flavour, or for only
the output file. This is done by only using the last argument as
output file if it's a file (it has an extension), and only using the
first argument as flavour if it isn't a file (it doesn't have an
extension).
While we're at it, we make all $xlate calls the same, i.e. the $output
argument is always quoted, and we always die on error when trying to
start $xlate.
There's a perl lesson in this, regarding operator priority...
This will always succeed, even when it fails:
open FOO, "something" || die "ERR: $!";
The reason is that '||' has higher priority than list operators (a
function is essentially a list operator and gobbles up everything
following it that isn't lower priority), and since a non-empty string
is always true, so that ends up being exactly the same as:
open FOO, "something";
This, however, will fail if "something" can't be opened:
open FOO, "something" or die "ERR: $!";
The reason is that 'or' has lower priority that list operators,
i.e. it's performed after the 'open' call.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9884)
Diffstat (limited to 'crypto/x86cpuid.pl')
-rw-r--r-- | crypto/x86cpuid.pl | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/x86cpuid.pl b/crypto/x86cpuid.pl index f15d55723b..bf8020d2af 100644 --- a/crypto/x86cpuid.pl +++ b/crypto/x86cpuid.pl @@ -10,9 +10,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC, "${dir}perlasm", "perlasm"); require "x86asm.pl"; -$output = pop; -open OUT,">$output"; -*STDOUT=*OUT; +$output = pop and open STDOUT,">$output"; &asm_init($ARGV[0]); |