Home | History | Annotate | Line # | Download | only in util
      1  1.1  christos #! /usr/bin/env perl
      2  1.1  christos # Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
      3  1.1  christos #
      4  1.1  christos # Licensed under the Apache License 2.0 (the "License").  You may not use
      5  1.1  christos # this file except in compliance with the License.  You can obtain a copy
      6  1.1  christos # in the file LICENSE in the source distribution or at
      7  1.1  christos # https://www.openssl.org/source/license.html
      8  1.1  christos 
      9  1.1  christos # Sometimes calls to XXXerr() are split into two lines, because the define'd
     10  1.1  christos # names are very long.  This script looks for those lines and merges them.
     11  1.1  christos # It should be run before the "err-to-raise" script.
     12  1.1  christos 
     13  1.1  christos # Run this program like this:
     14  1.1  christos #       perl -pi util/merge-err-lines files...
     15  1.1  christos # or
     16  1.1  christos #       git grep -l '[A-Z0-9]err([^)]*$' | xargs perl -pi util/merge-err-lines
     17  1.1  christos 
     18  1.1  christos use strict;
     19  1.1  christos use warnings;
     20  1.1  christos 
     21  1.1  christos # Look for "{whitespace}XXXerr(no-close-paren{WHITESPACE}" lines
     22  1.1  christos if ( /^ *[_A-Z0-9]+err\([^)]+ *$/ ) {
     23  1.1  christos     my $copy = $_;
     24  1.1  christos     chop($copy);
     25  1.1  christos     $copy =~ s/ +$//;
     26  1.1  christos     my $next = <>;
     27  1.1  christos     $next =~ s/^ +//;
     28  1.1  christos     $_ = $copy . ' ' . $next;
     29  1.1  christos }
     30