merge-err-lines 969 B

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