From 1aa89a7a3afb053d0c0b7fad8d3ea1b0a5447289 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 13 Sep 2019 00:06:46 +0200 Subject: Unify all assembler file generators They now generally conform to the following argument sequence: script.pl "$(PERLASM_SCHEME)" [ C preprocessor arguments ... ] \ $(PROCESSOR) 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 (Merged from https://github.com/openssl/openssl/pull/9884) --- crypto/des/asm/crypt586.pl | 3 +-- crypto/des/asm/des-586.pl | 3 +-- crypto/des/asm/dest4-sparcv9.pl | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'crypto/des') diff --git a/crypto/des/asm/crypt586.pl b/crypto/des/asm/crypt586.pl index ab5d173468..b611b4e983 100644 --- a/crypto/des/asm/crypt586.pl +++ b/crypto/des/asm/crypt586.pl @@ -13,8 +13,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "x86asm.pl"; -$output=pop; -open STDOUT,">$output"; +$output=pop and open STDOUT,">$output"; &asm_init($ARGV[0]); diff --git a/crypto/des/asm/des-586.pl b/crypto/des/asm/des-586.pl index 3d2953884f..483f19503f 100644 --- a/crypto/des/asm/des-586.pl +++ b/crypto/des/asm/des-586.pl @@ -20,8 +20,7 @@ require "desboth.pl"; # format. # -$output=pop; -open STDOUT,">$output"; +$output=pop and open STDOUT,">$output"; &asm_init($ARGV[0]); diff --git a/crypto/des/asm/dest4-sparcv9.pl b/crypto/des/asm/dest4-sparcv9.pl index a7de3a51f0..0cf25add75 100644 --- a/crypto/des/asm/dest4-sparcv9.pl +++ b/crypto/des/asm/dest4-sparcv9.pl @@ -34,8 +34,7 @@ $0 =~ m/(.*[\/\\])[^\/\\]+$/; $dir=$1; push(@INC,"${dir}","${dir}../../perlasm"); require "sparcv9_modes.pl"; -$output=pop; -open STDOUT,">$output"; +$output=pop and open STDOUT,">$output"; $code.=<<___; #include "sparc_arch.h" -- cgit v1.2.1