[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-fortran
Subject: Re: [patch, testsuite, committed] Clean up gfortran.dg leftover module files.
From: Bernhard Fischer <rep.dot.nop () gmail ! com>
Date: 2007-03-27 17:09:03
Message-ID: 20070327170903.GA11737 () aon ! at
[Download RAW message or body]
On Tue, Mar 27, 2007 at 06:54:23PM +0200, Bernhard Fischer wrote:
>On Mon, Mar 26, 2007 at 10:28:40PM +0200, FX Coudert wrote:
>>>There are still a lot of module files left over from running
>>>gfortran.fortran-torture, since (as Kaveh pointed out) that doesn't
>>>recognize dg-final directives. I've got a patch that adds the
>>>directives, but not one for recognizing them yet....
>>
>>I'm wondering why we don't simply incorporate all these tests in the
>>gfortran.dg framework. It's rather easy to do, we just need to add
>>the compile tests a { dg-do compile } line, and the execution tests
>>both { dg-do run } and { dg-options "-w" }. There are a few special
>>cases (the execution tests associated to a .x file), but nothing too
>>difficult. We could even move them into subdirectory so we don't mix
>>everything.
>
>Short of teaching dejagnu to automagically rm all .mod by scanning the
>input for 'module [procedure] name', perhaps a quick script like the
>attached would ease the handling of those?
>
>Something for contrib/, perhaps?
>Just a thought..
And it helps to send the correct version too.. Sorry for that
["gfortran.dg-final.cleanup-mods.awk" (text/plain)]
#! /usr/bin/awk -f
# Public Domain
/[eE][nN][dD][ \t]*[mM][oO][dD][uU][lL][eE]/ { next; }
/^[ \t]*[mM][oO][dD][uU][lL][eE][ \t]/ {
if (tolower($2) == "procedure")
next;
pos++;
tmp = tolower($2);
gsub(/[ \t
]*/, "", tmp);
mod[pos] = tmp;
file[pos] = FILENAME;
# printf("%s:%d saw module '%s'\n", FILENAME, FNR, $2);
}
/{[ \t]*cleanup-modules/ {
cleanup = tolower($0);
sub(/.*{[ \t]*cleanup-modules/, "", cleanup);
gsub(/[ \t][ \t]*/, " ", cleanup);
gsub(/(^[ \t]+|["{}])/, "", cleanup);
gsub(/[ \t]*$/, "", cleanup);
split(cleanup, mods);
for (i in mods) {
cleaned++;
clean[cleaned] = mods[i];
}
}
/
/ {
if (warned_encoding[FILENAME] != 1) {
warned_encoding[FILENAME] = 1;
print "Wrong encoding\x21 sed -i -e 's/\\x0D//g' "FILENAME > "/dev/stderr"
}
}
BEGIN {
pos = -1;
cleaned = -1;
fixup = 1;
}
END {
for (i = 0; i <= pos; i++) {
for (j in clean) {
if (mod[i] == clean[j]) {
delete mod[i];
}
}
}
for (i = 0; i <= pos; i++) {
if (length(mod[i])) {
printf("%s: no cleanup for module '%s'\n",
file[i], mod[i]) > "/dev/stderr";
if (fixup) {
emit[file[i]] = emit[file[i]] " " mod[i];
gsub(/^[ ]*/, "", emit[file[i]]);
}
}
}
if (fixup) {
for (i = 0; i <= pos; i++) {
if (length(emit[file[i]])) {
printf("sed -i -e '/cleanup-modules/s/\\(\"[[:space:]]*}\\)/ %s\\1/' %s\n", emit[file[i]], file[i]);
}
}
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic