From 24a18b8a40e876f828a5ce185849d46f19c671e8 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 20 Feb 2019 18:29:40 -0600 Subject: [PATCH] Fix x86_64-xlate.pl comment regex. This did not correctly capture lines like the following: https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/chacha/asm/chacha-x86_64.pl#260 https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/aes/asm/aes-x86_64.pl#992 https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/aes/asm/aesni-x86_64.pl#641 https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/aes/asm/bsaes-x86_64.pl#387 https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/modes/asm/ghash-x86_64.pl#455 https://boringssl.googlesource.com/boringssl/+/refs/heads/master/crypto/fipsmodule/ec/asm/p256-x86_64-asm.pl#92 Reportedly that last one causes problems with some assemblers. Change-Id: I82d6f0d81b902e48fad3c45947f84f02370eb1ab Reviewed-on: https://boringssl-review.googlesource.com/c/34925 Reviewed-by: Adam Langley --- crypto/perlasm/x86_64-xlate.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl index 74fb32fe..f9284115 100755 --- a/crypto/perlasm/x86_64-xlate.pl +++ b/crypto/perlasm/x86_64-xlate.pl @@ -1188,8 +1188,11 @@ while(defined(my $line=<>)) { $line =~ s|[#!].*$||; # get rid of asm-style comments... } else { # Get rid of asm-style comments but not preprocessor directives. The - # latter are identified by not having a space after the '#'. - $line =~ s|[#!] .*$||; + # former are identified by having a letter after the '#' and starting in + # the first column. + $line =~ s|!.*$||; + $line =~ s|(?<=.)#.*$||; + $line =~ s|^#([^a-z].*)?$||; } $line =~ s|/\*.*\*/||; # ... and C-style comments...