summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2023-05-06 16:12:11 -0400
committerPaul Smith <psmith@gnu.org>2023-05-07 16:51:06 -0400
commit3f28ec2f58c3defebd1d9e66ec0ae653e78d88d5 (patch)
tree64f727dac88683be401dea0c3e5da5cbb5895609 /src
parent24a84f99bb131675bd8f7e714e5b9d342fbde361 (diff)
downloadmake-git-3f28ec2f58c3defebd1d9e66ec0ae653e78d88d5.tar.gz
* src/read.c (eval): [SV 40942] Allow targets named "load"
Previously "load:" worked but "load :" failed. Allow the latter as well. This doesn't fix all issues; "load foo :" is still treated as a load operation for "foo" and ":". Avoids SV 50413 as well. * tests/scripts/features/load: Write tests.
Diffstat (limited to 'src')
-rw-r--r--src/read.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/read.c b/src/read.c
index 3909fc64..4e8432a0 100644
--- a/src/read.c
+++ b/src/read.c
@@ -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;