mirror of
https://github.com/mirror/make.git
synced 2025-01-27 21:00:22 +08:00
* Fix for dir.c from Andreas Schwab.
* Fix += target-specific variables: if your direct parent doesn't have a setting for the variable but his parent does, you'll get recursive expansion errors.
This commit is contained in:
parent
90f23f1ea6
commit
17f2dda0ac
36
ChangeLog
36
ChangeLog
@ -1,3 +1,31 @@
|
|||||||
|
2000-02-07 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
For += target-specific variables we need to remember which
|
||||||
|
variable set we found the variable in, so we can start looking
|
||||||
|
there in the next iteration (otherwise we'll see it again in
|
||||||
|
recursively_expand and fail!). This is getting to be a hack; if
|
||||||
|
it gets any worse we'll have to rethink this entire algorithm;
|
||||||
|
probably implementing expansion of these separately from the
|
||||||
|
"normal" expansion, instead of alongside.
|
||||||
|
|
||||||
|
* variable.h (recursively_expand_setlist): Rename
|
||||||
|
recursively_expand to add a struct variable_set_list argument, and
|
||||||
|
make a macro for recursively_expand.
|
||||||
|
(lookup_variable_setlist): Rename lookup_variable to add a struct
|
||||||
|
variable_set_list argument, and make a macro for lookup_variable.
|
||||||
|
|
||||||
|
* expand.c (recursively_expand_setlist): Take an extra struct
|
||||||
|
variable_set_list argument and pass it to
|
||||||
|
allocated_variable_append().
|
||||||
|
(reference_variable): Use lookup_variable_setlist() and pass the
|
||||||
|
returned variable_set_list to recursively_expand_setlist.
|
||||||
|
(allocated_variable_append): Take an extra setlist argument and
|
||||||
|
use this as the starting place when searching for the appended
|
||||||
|
expansion. If it's null, use current_variable_set_list as before.
|
||||||
|
|
||||||
|
* variable.c (lookup_variable_setlist): If the LISTP argument is
|
||||||
|
not nil, return the list where we found the variable in it.
|
||||||
|
|
||||||
2000-02-04 Paul D. Smith <psmith@gnu.org>
|
2000-02-04 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
* variable.c (print_variable): Write out filename/linenumber
|
* variable.c (print_variable): Write out filename/linenumber
|
||||||
@ -130,6 +158,10 @@
|
|||||||
* variable.c, vmsdir.h, vmsfunctions.c, vmsify.c, glob/glob.c:
|
* variable.c, vmsdir.h, vmsfunctions.c, vmsify.c, glob/glob.c:
|
||||||
* glob/glob.h: Installed patches. See readme.vms for details.
|
* glob/glob.h: Installed patches. See readme.vms for details.
|
||||||
|
|
||||||
|
2000-01-14 Andreas Schwab <schwab@suse.de>
|
||||||
|
|
||||||
|
* dir.c (read_dirstream): Initialize d_type if it exists.
|
||||||
|
|
||||||
2000-01-11 Paul D. Smith <psmith@gnu.org>
|
2000-01-11 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
Resolve PR/xxxx: don't automatically evaluate the $(call ...)
|
Resolve PR/xxxx: don't automatically evaluate the $(call ...)
|
||||||
@ -137,7 +169,7 @@
|
|||||||
protocol to always use simple nul-terminated strings, instead of
|
protocol to always use simple nul-terminated strings, instead of
|
||||||
sometimes using offset pointers to mark the end of arguments.
|
sometimes using offset pointers to mark the end of arguments.
|
||||||
This change also fixes PR/1517.
|
This change also fixes PR/1517.
|
||||||
Both PR's by Damien GIBOU <damien.gibou@st.com>.
|
Reported by Damien GIBOU <damien.gibou@st.com>.
|
||||||
|
|
||||||
* function.c (struct function_table_entry): Remove the negative
|
* function.c (struct function_table_entry): Remove the negative
|
||||||
required_args hack; put in explicit min and max # of arguments.
|
required_args hack; put in explicit min and max # of arguments.
|
||||||
@ -173,7 +205,7 @@
|
|||||||
* implicit.c (pattern_search): Remove the extra check of the
|
* implicit.c (pattern_search): Remove the extra check of the
|
||||||
implicit flag added on 8/24/1998. This causes problems and the
|
implicit flag added on 8/24/1998. This causes problems and the
|
||||||
reason for the change was better resolved by the change made to
|
reason for the change was better resolved by the change made to
|
||||||
check_deps() on 8/26/1998. This fixes PR/1423.
|
check_deps() on 1998-08-26. This fixes PR/1423.
|
||||||
|
|
||||||
1999-12-08 Paul D. Smith <psmith@gnu.org>
|
1999-12-08 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
27
dir.c
27
dir.c
@ -1058,6 +1058,9 @@ read_dirstream (stream)
|
|||||||
FAKE_DIR_ENTRY (d);
|
FAKE_DIR_ENTRY (d);
|
||||||
#ifdef _DIRENT_HAVE_D_NAMLEN
|
#ifdef _DIRENT_HAVE_D_NAMLEN
|
||||||
d->d_namlen = len - 1;
|
d->d_namlen = len - 1;
|
||||||
|
#endif
|
||||||
|
#ifdef _DIRENT_HAVE_D_TYPE
|
||||||
|
d->d_type = DT_UNKNOWN;
|
||||||
#endif
|
#endif
|
||||||
memcpy (d->d_name, df->name, len);
|
memcpy (d->d_name, df->name, len);
|
||||||
return d;
|
return d;
|
||||||
@ -1079,19 +1082,33 @@ ansi_free(p)
|
|||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a
|
||||||
|
* macro for stat64(). If stat is a macro, make a local wrapper function to
|
||||||
|
* invoke it.
|
||||||
|
*/
|
||||||
|
#ifndef stat
|
||||||
|
# ifndef VMS
|
||||||
|
extern int stat ();
|
||||||
|
# endif
|
||||||
|
# define local_stat stat
|
||||||
|
#else
|
||||||
|
static int local_stat (path, buf)
|
||||||
|
char *path;
|
||||||
|
struct stat *buf;
|
||||||
|
{
|
||||||
|
return stat (path, buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
dir_setup_glob (gl)
|
dir_setup_glob (gl)
|
||||||
glob_t *gl;
|
glob_t *gl;
|
||||||
{
|
{
|
||||||
#ifndef VMS
|
|
||||||
extern int stat ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Bogus sunos4 compiler complains (!) about & before functions. */
|
/* Bogus sunos4 compiler complains (!) about & before functions. */
|
||||||
gl->gl_opendir = open_dirstream;
|
gl->gl_opendir = open_dirstream;
|
||||||
gl->gl_readdir = read_dirstream;
|
gl->gl_readdir = read_dirstream;
|
||||||
gl->gl_closedir = ansi_free;
|
gl->gl_closedir = ansi_free;
|
||||||
gl->gl_stat = stat;
|
gl->gl_stat = local_stat;
|
||||||
/* We don't bother setting gl_lstat, since glob never calls it.
|
/* We don't bother setting gl_lstat, since glob never calls it.
|
||||||
The slot is only there for compatibility with 4.4 BSD. */
|
The slot is only there for compatibility with 4.4 BSD. */
|
||||||
}
|
}
|
||||||
|
25
expand.c
25
expand.c
@ -91,11 +91,13 @@ initialize_variable_output ()
|
|||||||
|
|
||||||
/* Recursively expand V. The returned string is malloc'd. */
|
/* Recursively expand V. The returned string is malloc'd. */
|
||||||
|
|
||||||
static char *allocated_variable_append PARAMS ((struct variable *v));
|
static char *allocated_variable_append PARAMS ((struct variable *v,
|
||||||
|
struct variable_set_list *l));
|
||||||
|
|
||||||
char *
|
char *
|
||||||
recursively_expand (v)
|
recursively_expand_setlist (v, list)
|
||||||
register struct variable *v;
|
register struct variable *v;
|
||||||
|
struct variable_set_list *list;
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
@ -107,7 +109,7 @@ recursively_expand (v)
|
|||||||
|
|
||||||
v->expanding = 1;
|
v->expanding = 1;
|
||||||
if (v->append)
|
if (v->append)
|
||||||
value = allocated_variable_append (v);
|
value = allocated_variable_append (v, list);
|
||||||
else
|
else
|
||||||
value = allocated_variable_expand (v->value);
|
value = allocated_variable_expand (v->value);
|
||||||
v->expanding = 0;
|
v->expanding = 0;
|
||||||
@ -141,16 +143,19 @@ reference_variable (o, name, length)
|
|||||||
char *name;
|
char *name;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
{
|
{
|
||||||
register struct variable *v = lookup_variable (name, length);
|
register struct variable *v;
|
||||||
|
struct variable_set_list *setlist;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
|
v = lookup_variable_setlist (name, length, &setlist);
|
||||||
|
|
||||||
if (v == 0)
|
if (v == 0)
|
||||||
warn_undefined (name, length);
|
warn_undefined (name, length);
|
||||||
|
|
||||||
if (v == 0 || *v->value == '\0')
|
if (v == 0 || *v->value == '\0')
|
||||||
return o;
|
return o;
|
||||||
|
|
||||||
value = (v->recursive ? recursively_expand (v) : v->value);
|
value = (v->recursive ? recursively_expand_setlist (v, setlist) : v->value);
|
||||||
|
|
||||||
o = variable_buffer_output (o, value, strlen (value));
|
o = variable_buffer_output (o, value, strlen (value));
|
||||||
|
|
||||||
@ -467,8 +472,9 @@ variable_expand_for_file (line, file)
|
|||||||
context of the next variable set, then we append the expanded value. */
|
context of the next variable set, then we append the expanded value. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
allocated_variable_append (v)
|
allocated_variable_append (v, list)
|
||||||
struct variable *v;
|
struct variable *v;
|
||||||
|
struct variable_set_list *list;
|
||||||
{
|
{
|
||||||
struct variable_set_list *save;
|
struct variable_set_list *save;
|
||||||
int len = strlen (v->name);
|
int len = strlen (v->name);
|
||||||
@ -480,9 +486,12 @@ allocated_variable_append (v)
|
|||||||
|
|
||||||
variable_buffer = 0;
|
variable_buffer = 0;
|
||||||
|
|
||||||
assert(current_variable_set_list->next != 0);
|
if (!list)
|
||||||
|
list = current_variable_set_list;
|
||||||
|
|
||||||
|
assert(list->next != 0);
|
||||||
save = current_variable_set_list;
|
save = current_variable_set_list;
|
||||||
current_variable_set_list = current_variable_set_list->next;
|
current_variable_set_list = list->next;
|
||||||
|
|
||||||
var[0] = '$';
|
var[0] = '$';
|
||||||
var[1] = '(';
|
var[1] = '(';
|
||||||
|
18
variable.c
18
variable.c
@ -134,12 +134,17 @@ define_variable_in_set (name, length, value, origin, recursive, set, flocp)
|
|||||||
/* Lookup a variable whose name is a string starting at NAME
|
/* Lookup a variable whose name is a string starting at NAME
|
||||||
and with LENGTH chars. NAME need not be null-terminated.
|
and with LENGTH chars. NAME need not be null-terminated.
|
||||||
Returns address of the `struct variable' containing all info
|
Returns address of the `struct variable' containing all info
|
||||||
on the variable, or nil if no such variable is defined. */
|
on the variable, or nil if no such variable is defined.
|
||||||
|
|
||||||
|
If LISTP is not nil, return a pointer to the setlist where
|
||||||
|
the variable was found. If the variable wasn't found, the
|
||||||
|
value of LISTP is unchanged. */
|
||||||
|
|
||||||
struct variable *
|
struct variable *
|
||||||
lookup_variable (name, length)
|
lookup_variable_setlist (name, length, listp)
|
||||||
char *name;
|
char *name;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
|
struct variable_set_list **listp;
|
||||||
{
|
{
|
||||||
register struct variable_set_list *setlist;
|
register struct variable_set_list *setlist;
|
||||||
|
|
||||||
@ -160,7 +165,11 @@ lookup_variable (name, length)
|
|||||||
if (*v->name == *name
|
if (*v->name == *name
|
||||||
&& strneq (v->name + 1, name + 1, length - 1)
|
&& strneq (v->name + 1, name + 1, length - 1)
|
||||||
&& v->name[length] == 0)
|
&& v->name[length] == 0)
|
||||||
return v;
|
{
|
||||||
|
if (listp)
|
||||||
|
*listp = setlist;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
@ -181,6 +190,9 @@ lookup_variable (name, length)
|
|||||||
sptr = value;
|
sptr = value;
|
||||||
scnt = 0;
|
scnt = 0;
|
||||||
|
|
||||||
|
if (listp)
|
||||||
|
*listp = current_variable_set_list;
|
||||||
|
|
||||||
while ((sptr = strchr (sptr, '$')))
|
while ((sptr = strchr (sptr, '$')))
|
||||||
{
|
{
|
||||||
scnt++;
|
scnt++;
|
||||||
|
12
variable.h
12
variable.h
@ -95,7 +95,10 @@ extern char *patsubst_expand PARAMS ((char *o, char *text, char *pattern, char *
|
|||||||
char *pattern_percent, char *replace_percent));
|
char *pattern_percent, char *replace_percent));
|
||||||
|
|
||||||
/* expand.c */
|
/* expand.c */
|
||||||
extern char *recursively_expand PARAMS ((struct variable *v));
|
extern char *recursively_expand_setlist PARAMS ((struct variable *v,
|
||||||
|
struct variable_set_list *l));
|
||||||
|
|
||||||
|
#define recursively_expand(v) recursively_expand_setlist((v),(struct variable_set_list *)0)
|
||||||
|
|
||||||
/* variable.c */
|
/* variable.c */
|
||||||
extern struct variable_set_list *create_new_variable_set PARAMS ((void));
|
extern struct variable_set_list *create_new_variable_set PARAMS ((void));
|
||||||
@ -108,7 +111,12 @@ extern void print_variable_set PARAMS ((struct variable_set *set, char *prefix))
|
|||||||
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
|
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
|
||||||
extern struct variable *try_variable_definition PARAMS ((const struct floc *flocp, char *line, enum variable_origin origin, int target_var));
|
extern struct variable *try_variable_definition PARAMS ((const struct floc *flocp, char *line, enum variable_origin origin, int target_var));
|
||||||
|
|
||||||
extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
|
extern struct variable *lookup_variable_setlist
|
||||||
|
PARAMS ((char *name, unsigned int length,
|
||||||
|
struct variable_set_list **lisp));
|
||||||
|
|
||||||
|
#define lookup_variable(n,l) lookup_variable_setlist((n),(l),\
|
||||||
|
(struct variable_set_list **)0)
|
||||||
|
|
||||||
extern struct variable *define_variable_in_set
|
extern struct variable *define_variable_in_set
|
||||||
PARAMS ((char *name, unsigned int length, char *value,
|
PARAMS ((char *name, unsigned int length, char *value,
|
||||||
|
Loading…
Reference in New Issue
Block a user