Windows: Add type casting in CRYPTO_atomic_add to remove warning
[openssl.git] / crypto / pariscid.pl
index f82e27ac4c34e8bebd75245f9f097382aecb6aa8..c8ee8bdb0a4cdd739eddb950404dec8e0a21ff76 100644 (file)
@@ -1,15 +1,18 @@
 #! /usr/bin/env perl
-# Copyright 2009-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2009-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL license (the "License").  You may not use
+# Licensed under the Apache License 2.0 (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
 # in the file LICENSE in the source distribution or at
 # https://www.openssl.org/source/license.html
 
 
-$flavour = shift;
-$output = shift;
-open STDOUT,">$output";
+# $output is the last argument if it looks like a file (it has an extension)
+# $flavour is the first argument if it doesn't look like a file
+$output = $#ARGV >= 0 && $ARGV[$#ARGV] =~ m|\.\w+$| ? pop : undef;
+$flavour = $#ARGV >= 0 && $ARGV[0] !~ m|\.| ? shift : undef;
+
+$output and open STDOUT,">$output";
 
 if ($flavour =~ /64/) {
        $LEVEL          ="2.0W";
@@ -160,7 +163,7 @@ L\$oop_cmp
        or              %r29,$rv,$rv
 
        sub             %r0,$rv,%r29
-       extru           %r29,31,1,$rv
+       extru           %r29,0,1,$rv
 L\$no_data
        bv              ($rp)
        .EXIT
@@ -255,9 +258,22 @@ L\$done2
        .PROCEND
 ___
 }
-$code =~ s/cmpib,\*/comib,/gm  if ($SIZE_T==4);
-$code =~ s/,\*/,/gm            if ($SIZE_T==4);
-$code =~ s/\bbv\b/bve/gm       if ($SIZE_T==8);
-print $code;
-close STDOUT;
+
+if (`$ENV{CC} -Wa,-v -c -o /dev/null -x assembler /dev/null 2>&1`
+       =~ /GNU assembler/) {
+    $gnuas = 1;
+}
+
+foreach(split("\n",$code)) {
+
+       s/(\.LEVEL\s+2\.0)W/$1w/        if ($gnuas && $SIZE_T==8);
+       s/\.SPACE\s+\$TEXT\$/.text/     if ($gnuas && $SIZE_T==8);
+       s/\.SUBSPA.*//                  if ($gnuas && $SIZE_T==8);
+       s/cmpib,\*/comib,/              if ($SIZE_T==4);
+       s/,\*/,/                        if ($SIZE_T==4);
+       s/\bbv\b/bve/                   if ($SIZE_T==8);
+
+       print $_,"\n";
+}
+close STDOUT or die "error closing STDOUT: $!";