diff options
-rw-r--r-- | src/read.c | 7 | ||||
-rw-r--r-- | tests/scripts/features/load | 20 |
2 files changed, 24 insertions, 3 deletions
@@ -621,6 +621,7 @@ eval (struct ebuffer *ebuf, int set_default) size_t wlen; char *p; char *p2; + unsigned int is_rule; struct vmodifiers vmod; /* At the top of this loop, we are starting a brand new line. */ @@ -760,6 +761,8 @@ eval (struct ebuffer *ebuf, int set_default) wlen = p2 - p; NEXT_TOKEN (p2); + is_rule = *p2 == ':' || ((*p2 == '&' || *p2 == '|') && p2[1] == ':'); + /* If we're in an ignored define, skip this line (but maybe get out). */ if (in_ignored_define) { @@ -910,8 +913,8 @@ eval (struct ebuffer *ebuf, int set_default) continue; } - /* Handle the load operations. */ - if (word1eq ("load") || word1eq ("-load")) + /* Handle the load operations. Allow targets named "load". */ + if ((word1eq ("load") || word1eq ("-load")) && !is_rule) { /* A 'load' line specifies a dynamic object to load. */ struct nameseq *files; diff --git a/tests/scripts/features/load b/tests/scripts/features/load index b462ed9c..3713f944 100644 --- a/tests/scripts/features/load +++ b/tests/scripts/features/load @@ -144,7 +144,25 @@ all: ; @echo pre=$(PRE) post=$(POST) $(TESTLOAD) testload.so: testload.c ; @echo "rebuilding $@"; !.$sobuild, '', "pre= post=testload.so implicit\n"); -unlink(qw(testload.c testload.so)) unless $keep; +# Check using load as a target or variable name +run_make_test(q! +load: ; @echo $@ +-load&: ; @echo $@ +!, + "", "load\n"); + +run_make_test(q! +load : ; @echo $@ +-load &: ; echo $@ +!, + "", "load\n"); + +run_make_test(q! +load = @echo $@ +all: ; $(load) +load |: ; echo $@ +!, + "", "all\n"); # This tells the test driver that the perl test script executed properly. 1; |