mirror of
https://github.com/mirror/make.git
synced 2025-03-26 20:10:15 +08:00
Ensure that loaded functions increment the command count
Since we don't know what a loaded function (via Guile or load) may do, increment the command count just in case. * src/function.c (struct file_table_entry): New adds_command bool. (FT_ENTRY): Initialize it to 0 for built-in functions. (expand_builtin_function): If adds_command, increment the count. (define_new_function): Set adds_command for loaded functions.
This commit is contained in:
parent
26f4bb89bd
commit
b6a779d262
@ -40,6 +40,7 @@ struct function_table_entry
|
|||||||
unsigned char maximum_args;
|
unsigned char maximum_args;
|
||||||
unsigned int expand_args:1;
|
unsigned int expand_args:1;
|
||||||
unsigned int alloc_fn:1;
|
unsigned int alloc_fn:1;
|
||||||
|
unsigned int adds_command:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
@ -2515,7 +2516,7 @@ func_abspath (char *o, char **argv, const char *funcname UNUSED)
|
|||||||
static char *func_call (char *o, char **argv, const char *funcname);
|
static char *func_call (char *o, char **argv, const char *funcname);
|
||||||
|
|
||||||
#define FT_ENTRY(_name, _min, _max, _exp, _func) \
|
#define FT_ENTRY(_name, _min, _max, _exp, _func) \
|
||||||
{ { (_func) }, STRING_SIZE_TUPLE(_name), (_min), (_max), (_exp), 0 }
|
{ { (_func) }, STRING_SIZE_TUPLE(_name), (_min), (_max), (_exp), 0, 0 }
|
||||||
|
|
||||||
static struct function_table_entry function_table_init[] =
|
static struct function_table_entry function_table_init[] =
|
||||||
{
|
{
|
||||||
@ -2591,6 +2592,9 @@ expand_builtin_function (char *o, int argc, char **argv,
|
|||||||
OS (fatal, *expanding_var,
|
OS (fatal, *expanding_var,
|
||||||
_("unimplemented on this platform: function '%s'"), entry_p->name);
|
_("unimplemented on this platform: function '%s'"), entry_p->name);
|
||||||
|
|
||||||
|
if (entry_p->adds_command)
|
||||||
|
++command_count;
|
||||||
|
|
||||||
if (!entry_p->alloc_fn)
|
if (!entry_p->alloc_fn)
|
||||||
return entry_p->fptr.func_ptr (o, argv, entry_p->name);
|
return entry_p->fptr.func_ptr (o, argv, entry_p->name);
|
||||||
|
|
||||||
@ -2858,6 +2862,8 @@ define_new_function (const floc *flocp, const char *name,
|
|||||||
ent->maximum_args = (unsigned char) max;
|
ent->maximum_args = (unsigned char) max;
|
||||||
ent->expand_args = ANY_SET(flags, GMK_FUNC_NOEXPAND) ? 0 : 1;
|
ent->expand_args = ANY_SET(flags, GMK_FUNC_NOEXPAND) ? 0 : 1;
|
||||||
ent->alloc_fn = 1;
|
ent->alloc_fn = 1;
|
||||||
|
/* We don't know what this function will do. */
|
||||||
|
ent->adds_command = 1;
|
||||||
ent->fptr.alloc_func_ptr = func;
|
ent->fptr.alloc_func_ptr = func;
|
||||||
|
|
||||||
hash_insert (&function_table, ent);
|
hash_insert (&function_table, ent);
|
||||||
|
Loading…
Reference in New Issue
Block a user