mirror of
https://github.com/mirror/make.git
synced 2025-01-27 12:51:07 +08:00
Minor fix and code rework.
This commit is contained in:
parent
bd2d124f27
commit
baee33eb0f
@ -1,3 +1,10 @@
|
|||||||
|
2009-10-07 Boris Kolpackov <boris@codesynthesis.com>
|
||||||
|
|
||||||
|
* read.c (do_undefine): Free the expanded variable name.
|
||||||
|
|
||||||
|
* commands.c (dep_hash_cmp, set_file_variables): Move the order-only
|
||||||
|
to normal upgrade logic from dep_hash_cmp to set_file_variables.
|
||||||
|
|
||||||
2009-10-06 Boris Kolpackov <boris@codesynthesis.com>
|
2009-10-06 Boris Kolpackov <boris@codesynthesis.com>
|
||||||
|
|
||||||
* dep.h (uniquize_deps): Remove.
|
* dep.h (uniquize_deps): Remove.
|
||||||
|
25
commands.c
25
commands.c
@ -57,16 +57,7 @@ dep_hash_cmp (const void *x, const void *y)
|
|||||||
{
|
{
|
||||||
struct dep *dx = (struct dep *) x;
|
struct dep *dx = (struct dep *) x;
|
||||||
struct dep *dy = (struct dep *) y;
|
struct dep *dy = (struct dep *) y;
|
||||||
int cmp = strcmp (dep_name (dx), dep_name (dy));
|
return strcmp (dep_name (dx), dep_name (dy));
|
||||||
|
|
||||||
/* If the names are the same but ignore_mtimes are not equal, one of these
|
|
||||||
is an order-only prerequisite and one isn't. That means that we should
|
|
||||||
remove the one that isn't and keep the one that is. */
|
|
||||||
|
|
||||||
if (!cmp && dx->ignore_mtime != dy->ignore_mtime)
|
|
||||||
dx->ignore_mtime = dy->ignore_mtime = 0;
|
|
||||||
|
|
||||||
return cmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set FILE's automatic variables up. */
|
/* Set FILE's automatic variables up. */
|
||||||
@ -74,7 +65,7 @@ dep_hash_cmp (const void *x, const void *y)
|
|||||||
void
|
void
|
||||||
set_file_variables (struct file *file)
|
set_file_variables (struct file *file)
|
||||||
{
|
{
|
||||||
const struct dep *d;
|
struct dep *d;
|
||||||
const char *at, *percent, *star, *less;
|
const char *at, *percent, *star, *less;
|
||||||
|
|
||||||
#ifndef NO_ARCHIVES
|
#ifndef NO_ARCHIVES
|
||||||
@ -252,7 +243,7 @@ set_file_variables (struct file *file)
|
|||||||
/* Make sure that no dependencies are repeated in $^, $?, and $|. It
|
/* Make sure that no dependencies are repeated in $^, $?, and $|. It
|
||||||
would be natural to combine the next two loops but we can't do it
|
would be natural to combine the next two loops but we can't do it
|
||||||
because of a situation where we have two dep entries, the first
|
because of a situation where we have two dep entries, the first
|
||||||
is order-only and the second is normal (see dep_hash_cmp). */
|
is order-only and the second is normal (see below). */
|
||||||
|
|
||||||
hash_init (&dep_hash, 500, dep_hash_1, dep_hash_2, dep_hash_cmp);
|
hash_init (&dep_hash, 500, dep_hash_1, dep_hash_2, dep_hash_cmp);
|
||||||
|
|
||||||
@ -264,6 +255,16 @@ set_file_variables (struct file *file)
|
|||||||
slot = hash_find_slot (&dep_hash, d);
|
slot = hash_find_slot (&dep_hash, d);
|
||||||
if (HASH_VACANT (*slot))
|
if (HASH_VACANT (*slot))
|
||||||
hash_insert_at (&dep_hash, d, slot);
|
hash_insert_at (&dep_hash, d, slot);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Check if the two prerequisites have different ignore_mtime.
|
||||||
|
If so then we need to "upgrade" one that is order-only. */
|
||||||
|
|
||||||
|
struct dep* hd = (struct dep*) *slot;
|
||||||
|
|
||||||
|
if (d->ignore_mtime != hd->ignore_mtime)
|
||||||
|
d->ignore_mtime = hd->ignore_mtime = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (d = file->deps; d != 0; d = d->next)
|
for (d = file->deps; d != 0; d = d->next)
|
||||||
|
1
read.c
1
read.c
@ -1341,6 +1341,7 @@ do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf)
|
|||||||
p[1] = '\0';
|
p[1] = '\0';
|
||||||
|
|
||||||
undefine_variable_global (name, p - name + 1, origin);
|
undefine_variable_global (name, p - name + 1, origin);
|
||||||
|
free (var);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Execute a `define' directive.
|
/* Execute a `define' directive.
|
||||||
|
Loading…
Reference in New Issue
Block a user