by the final warning state after processing all the toplevel
input files (including Final.sd.mk).
+&:local+global [&]VARIABLE ...
+ Suppresses the warning about seeing both VARIABLE and
+ &VARIABLE. Any & specified in the RHS is redundant: this
+ always affects both versions identically.
+
&:changequote NEWQUOTE
changes the escape sequence from & to literally NEWQUOTE
NEWQUOTE may be any series of of non-whitespace characters,
The same VARNAME was used both with and without an & prefix.
This can be confusing. Also, if you avoid this then you will
get a warning iff you accidentally leave off a needed &.
+ (You can suppress this warning for a particular VARNAME with
+ the &:local+global directive.)
single-char-var
A variable expansion like $FBAR. make's expansion rules
}
}
next;
+ } elsif (s#^\s*$esc\:local\+global\s+(\S.*)$##) {
+ foreach my $vn (split /\s+/, $1) {
+ $vn =~ s{^$esc}{};
+ $varref{$vn}{NoWarn} = 1;
+ }
+ next;
} elsif (s#^\s*$esc\:(?=(-?)include|macro)##) {
$buffering_output='';
- } elsif (m#^\s*$esc\:([a-z][-0-9a-z_]*)#) {
+ } elsif (m#^\s*$esc\:([a-z][-+0-9a-z_]*)#) {
err "unknown directive &:$1 or bad argumnt syntax";
} elsif (s{^\s*${esc}TARGETS(?:_([0-9a-zA-Z_]+))?(?=\W)}{}) {
my $t = $1 // 'all';
foreach my $vn (sort keys %varref) {
my $vv = $varref{$vn};
next unless $vv->{''} && $vv->{1};
+ next if $vv->{NoWarn};
wrncore 'local+global', "saw both $vn and &$vn" or return;
foreach my $amp ('', 1) {
printf STDERR " saw %s%s at %s\n",
# $(TOP_WARN)
# $(TOP_WARN)
+# $(TOP_NOWARN1) $(NOWARN1)
+# $(TOP_NOWARN2) $(NOWARN2)
+
${eval ${call some-macro, 42, $$x, { $(foreach something) } }}
# doctests:
# $(&WARN)
# &$WARN
+&:local+global NOWARN1 &NOWARN2
+# &$NOWARN1 $(NOWARN1)
+# &$NOWARN2 $(NOWARN2)
+
&${ some-macro, 42, $x, { &$- $(foreach something) } }
# doctests: