chiark / gitweb /
Warning reporting: Report each warning only once
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 28 Dec 2019 18:36:31 +0000 (18:36 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 11:35:16 +0000 (11:35 +0000)
In particular, Prefix and Suffix, or conventional &:include's can
generate a lot of repeated warnings.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
generate
tests/filter/Prefix.sd.mk
tests/filter/stderr.expected

index 61bbd50..bae0995 100755 (executable)
--- a/generate
+++ b/generate
@@ -198,6 +198,8 @@ sub wrncore ($$) {
 
 sub wrn ($$) {
     my ($wk,$m) = @_;
+    our %warn_dedupe;
+    return 0 if $warn_dedupe{$err_file,$.,$wk,$m}++;
     wrncore($wk, "${err_file}:$.: $m");
 }
 
index da3a735..45f1ac0 100644 (file)
@@ -1 +1,2 @@
 # Prefix in &.
+&:warn many-requests-for-unknown-warning
index 11dab74..fe8b3f2 100644 (file)
@@ -1,3 +1,4 @@
+subdirmk: warning (unknown-warning): ./Prefix.sd.mk:2: unknown warning many-requests-for-unknown-warning requested
 subdirmk: warning (single-char-var): ./Dir.sd.mk:8: possibly confusing unbracketed single-char $-expansion
 subdirmk: warning (local+global): saw both WARN and &WARN
  saw WARN at ./Dir.sd.mk:6