diff options
author | Paul Smith <psmith@gnu.org> | 2005-05-03 13:57:20 +0000 |
---|---|---|
committer | Paul Smith <psmith@gnu.org> | 2005-05-03 13:57:20 +0000 |
commit | 9d5b5bd2f57cad88b2ea689bdce4f3d8662e73a4 (patch) | |
tree | 9cbe48582bbbf5a6d6754676cfc58e404feeb5e0 /read.c | |
parent | 49ee105c685cb84bc3057e8b7666fc0cc7090047 (diff) | |
download | gunmake-9d5b5bd2f57cad88b2ea689bdce4f3d8662e73a4.tar.gz |
Fix problems with losing tokens in the jobserver, reported by Grant
Taylor. There are two forms of this: first, it was possible to lose
tokens when using -j and -l at the same time, because waiting jobs were
not checked when determining whether any jobs were outstanding. Second,
if you had an exported recursive variable that contained a $(shell ...)
function there is a possibility to lose tokens, since a token was taken
but the child list was not updated until after the shell function was
complete.
To resolve this I introduced a new variable that counted the number of
tokens we have obtained, rather than checking whether there were any
children on the list. I also added some sanity checks to make sure we
weren't writing back too many or not enough tokens. And, the master
make will drain the token pipe before exiting and compare the count of
tokens at the end to what was written there at the beginning.
Also:
* Ensure a bug in the environment (missing "=") doesn't cause make to core.
* Rename the .DEFAULT_TARGET variable to .DEFAULT_GOAL, to match the
terminology in the documentation and other variables like MAKECMDGOALS.
* Add documentation of the .DEFAULT_GOAL special variable.
Still need to document the secondary expansion stuff...
Diffstat (limited to 'read.c')
-rw-r--r-- | read.c | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -1215,16 +1215,16 @@ eval (struct ebuffer *ebuf, int set_default) foo: - ifeq ($(.DEFAULT_TARGET),foo) + ifeq ($(.DEFAULT_GOAL),foo) ... endif Because the target is not recorded until after ifeq directive is - evaluated the .DEFAULT_TARGET does not contain foo yet as one + evaluated the .DEFAULT_GOAL does not contain foo yet as one would expect. Because of this we have to move some of the logic here. */ - if (**default_target_name == '\0' && set_default) + if (**default_goal_name == '\0' && set_default) { char* name; struct dep *d; @@ -1277,8 +1277,8 @@ eval (struct ebuffer *ebuf, int set_default) if (!reject) { - (void) define_variable_global ( - ".DEFAULT_TARGET", 15, t->name, o_file, 0, NILF); + define_variable_global (".DEFAULT_GOAL", 13, t->name, + o_file, 0, NILF); break; } } @@ -2095,14 +2095,11 @@ record_files (struct nameseq *filenames, char *pattern, char *pattern_percent, name = f->name; } - /* See if this target is a default target and update - DEFAULT_GOAL_FILE if necessary. */ - if (strcmp (*default_target_name, name) == 0 && - (default_goal_file == 0 || - strcmp (default_goal_file->name, name) != 0)) - { - default_goal_file = f; - } + /* If this target is a default target, update DEFAULT_GOAL_FILE. */ + if (strcmp (*default_goal_name, name) == 0 + && (default_goal_file == 0 + || strcmp (default_goal_file->name, name) != 0)) + default_goal_file = f; } if (implicit) |