summaryrefslogtreecommitdiff
path: root/implicit.c
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2013-09-22 16:59:04 -0400
committerPaul Smith <psmith@gnu.org>2013-09-22 17:10:35 -0400
commitfd30db129060770ac0851035e1ca00c371cbee62 (patch)
tree78751c2d36ded09824d12a3a6365f4fb7f8fb3c7 /implicit.c
parentc3524b83b9bfb7e943f9b91b0d624129a78e5963 (diff)
downloadgunmake-fd30db129060770ac0851035e1ca00c371cbee62.tar.gz
[SV 31155] Parse order-only tokens in second expansion results.
Diffstat (limited to 'implicit.c')
-rw-r--r--implicit.c39
1 files changed, 28 insertions, 11 deletions
diff --git a/implicit.c b/implicit.c
index f0bb385..5fedec0 100644
--- a/implicit.c
+++ b/implicit.c
@@ -574,6 +574,7 @@ pattern_search (struct file *file, int archive,
{
int add_dir = 0;
unsigned int len;
+ struct dep **dptr;
nptr = get_next_word (nptr, &len);
if (nptr == 0)
@@ -616,6 +617,9 @@ pattern_search (struct file *file, int archive,
add_dir = 1;
}
+ /* Set up for the next word. */
+ nptr += len;
+
/* Initialize and set file variables if we haven't already
done so. */
if (!file_vars_initialized)
@@ -634,20 +638,33 @@ pattern_search (struct file *file, int archive,
/* Perform the 2nd expansion. */
p = variable_expand_for_file (depname, file);
+ dptr = &dl;
- /* Parse the expanded string. */
- dl = PARSE_FILE_SEQ (&p, struct dep, order_only ? MAP_NUL : MAP_PIPE,
- add_dir ? dir : NULL, PARSEFS_NONE);
-
- for (d = dl; d != NULL; d = d->next)
+ /* Parse the results into a deps list. */
+ do
{
- ++deps_found;
- if (order_only)
- d->ignore_mtime = 1;
- }
+ /* Parse the expanded string. */
+ struct dep *dp = PARSE_FILE_SEQ (&p, struct dep,
+ order_only ? MAP_NUL : MAP_PIPE,
+ add_dir ? dir : NULL, PARSEFS_NONE);
+ *dptr = dp;
- /* Set up for the next word. */
- nptr += len;
+ for (d = dp; d != NULL; d = d->next)
+ {
+ ++deps_found;
+ if (order_only)
+ d->ignore_mtime = 1;
+ dptr = &d->next;
+ }
+
+ /* If we stopped due to an order-only token, note it. */
+ if (*p == '|')
+ {
+ order_only = 1;
+ ++p;
+ }
+ }
+ while (*p != '\0');
}
/* If there are more than max_pattern_deps prerequisites (due to