chiark / gitweb /
Syntax: Support &:local+global !...
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 29 Dec 2019 15:50:28 +0000 (15:50 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 30 Dec 2019 11:35:17 +0000 (11:35 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
README
generate
tests/filter/stderr.expected
tests/filter/sub/dir/Dir.mk.expected
tests/filter/sub/dir/Dir.sd.mk

diff --git a/README b/README
index 415913b..3d18dc2 100644 (file)
--- a/README
+++ b/README
@@ -174,10 +174,11 @@ So pathname syntax is a subset of:
        by the final warning state after processing all the toplevel
        input files (including Final.sd.mk).
 
-&:local+global [&]VARIABLE ...
+&:local+global [!][&]VARIABLE ...
        Suppresses any warnings relating to forthcoming mentions
        to VARIABLE or &VARIABLE, as applicable.  Scope ends at
        the end of the current directory's Suffix.sd.mk.
+       Prefixing with ! removes [&]VARIABLE from the suppresion list.
 
 &:changequote NEWQUOTE
        changes the escape sequence from & to literally NEWQUOTE
index 2278928..15e2235 100755 (executable)
--- a/generate
+++ b/generate
@@ -296,8 +296,9 @@ sub process_input_mk ($$$$) {
            next;
        } elsif (s#^\s*$esc\:local\+global\s+(\S.*)$##) {
            foreach my $vn (split /\s+/, $1) {
+               my $pos = !($vn =~ s{^!}{});
                my $amp = $vn =~ s{^$esc}{};
-               $varref_exp{$vn}{!!$amp} = 1;
+               $varref_exp{$vn}{!!$amp} = $pos;
            }
            next;
        } elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
index c23e275..5d777c2 100644 (file)
@@ -13,4 +13,5 @@ subdirmk: warning (local+global): saw both WARN and &WARN
  saw &WARN at ./Dir.sd.mk:10
  saw &WARN at ./Dir.sd.mk:11
  saw &WARN at ./sub/dir/Dir.sd.mk:15
+ saw &WARN at ./sub/dir/Dir.sd.mk:24
 subdirmk: warning (unknown-warning): ./sub/dir/Dir.sd.mk:3: attempt to suppress unknown warning(s) `some-unknown-warning'
index 9fe4f75..627eaa5 100644 (file)
@@ -18,6 +18,8 @@ WARN += 5
 
 $(NOWARN1)
 
+sub_dir_WARN += 6
+
 # doctests:
 # Suffix in sub/dir
 
index bc974ea..c3603a0 100644 (file)
@@ -20,5 +20,8 @@ WARN += 5
 
 $(NOWARN1)
 
+&:local+global !&WARN
+&WARN += 6
+
 # doctests:
 &:include &doctests.sd.mk