This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/84381] replace non-std 'call abort' by 'stop 1' in gfortran testsuite
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 17 Feb 2018 13:06:15 +0000
- Subject: [Bug fortran/84381] replace non-std 'call abort' by 'stop 1' in gfortran testsuite
- Auto-submitted: auto-generated
- References: <bug-84381-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84381
--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Neil Carlson from comment #5)
> Thomas, I saw you generated a patch with "stop n". I'd love to see how you
> did it -- the regexp and counting magic.
At first, I tried to find the all-inclusive regexp to do this, but
that didn't work fast enough, so I settled for running different
scripts for different cases. I didn't actually save all the
scripts.
The first one was
#! /usr/bin/perl
$n = 1;
$abort = "call *abort *([(] *[)])?";
while (<>)
{
if (/$abort/) {
s/$abort/STOP $n/;
$n++;
}
print;
}
and another one
$n = 1;
while (<>)
{
if (/call\s*abort$/i) {
s/call\s*abort/STOP $n/i;
$n++;
}
print;
}
and invoked them with
find . -type f -name '*.[fF]*' -exec perl -i ./c2.pl '{}' ';'
Not the most general solution, but it got me there :-)