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