summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Manfredi <Raphael_Manfredi@pobox.com>2020-03-16 17:23:24 +0100
committerRaphael Manfredi <Raphael_Manfredi@pobox.com>2020-03-16 21:48:45 +0100
commit15e25d59057b78f00042640defd1f8c76b8d4d06 (patch)
tree58d0756460ba17bc69c231e565196bbdcc7e3748
parent2f64ea88c70b412b1543e36e5f7421c48bfd464e (diff)
metalint: warn if several units claim to export the same file.
-rwxr-xr-xmcon/man/mlint.SH5
-rw-r--r--mcon/pl/lint.pl14
2 files changed, 18 insertions, 1 deletions
diff --git a/mcon/man/mlint.SH b/mcon/man/mlint.SH
index e2c7f4a..58dc389 100755
--- a/mcon/man/mlint.SH
+++ b/mcon/man/mlint.SH
@@ -265,6 +265,11 @@ Private UU files (i.e. files like the \fImyread\fR script created for
later perusal by \fIConfigure\fR) may only be created in special units.
Exceptions allowed if the ?F: line is preceded by a proper ?LINT: hint.
.TP
+"(?F) file 'xxx' already exported by yyy.U."
+The listed file 'xxx' is already reported exported (listed likewise) in
+the other unit yyy.U and is conflicting. An exported file is a generated
+file above the UU directory.
+.TP
"(?T) temporary symbol '\$xxx' multiply declared."
Self explanatory.
.TP
diff --git a/mcon/pl/lint.pl b/mcon/pl/lint.pl
index 0120c51..3f212af 100644
--- a/mcon/pl/lint.pl
+++ b/mcon/pl/lint.pl
@@ -78,6 +78,7 @@ sub init_extraction {
%filetmp = (); # Local temporary files in ?F: directives
%filesetin = (); # Lists units defining a temporary file
%filecreated = (); # Records files created in this unit
+ %filedefined = (); # Records units that export a given file
%prodfile = (); # Unit where a given file is said to be created
%defseen = (); # Symbol defintions claimed
%lintset = (); # Symbols declared set by a ?LINT: line
@@ -622,7 +623,17 @@ sub p_file {
}
$prodfile{$file} .= "$unit " if $fileseen{$file} == 1;
($uufile = $file) =~ s|^\./(\S+)$|$1|;
- next if $file eq $uufile; # Don't care about non-UU files
+ if ($file eq $uufile) {
+ # This is a non-UU files created and not a temporary file
+ # It is meant to be exported by Configure
+ if (exists $filedefined{$file}) {
+ my $other = $filedefined{$file};
+ warn "$where: file '$file' already exported by $other.U.\n";
+ } else {
+ $filedefined{$file} = $unit;
+ }
+ next;
+ }
unless ($is_special || $lintcreated{$uufile}) {
warn "$where: UU file '$uufile' in non-special unit ignored.\n";
delete $lintcreated{$uufile}; # Detect spurious LINT
@@ -1308,6 +1319,7 @@ sub sanity_checks {
undef %shspecial;
undef %shvisible;
undef %filemaster;
+ undef %filedefined;
# Spot multiply defined C symbols
foreach $sym (keys %cmaster) {