make-alpha
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Minor Comments on Gmake Internals


From: Jon Forrest
Subject: Minor Comments on Gmake Internals
Date: Fri, 17 Dec 2021 20:22:08 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.4.0

I started using make back in 1978. Now that I'm retired I've
decided to take a look at it to see how it works. So, I've
been studying the gmake 4.3 source code. I have the following
questions and observations in no particular order:

1) variable.c/free_variable_set() looks like it also frees the variable_set_list in the variable_set passed as an argument.
Should it be modified to only free the variable_set? Another
function could then be created called free_variable_set_list()
which could itself call free_variable_set().

2) The comment at line 367 in variable.c says there are only two special variables (e.g. .VARIABLES and .TARGETS). However, I see in main.c around line 1319 where .VARIABLES is defined and made special, but the line below it that does the same thing for .TARGETS is commented out.
Instead the variable .RECIPEPREFIX is defined and made special.
Shouldn't the comment in variable.c be fixed?

3) There's a misplaced comment about popping the top set off the current
variable_set_list in variable.c on lines 666 and 667. It should be before line 712.

4) In tracing the startup execution of gmake, I see lots of calls to expand.c/variable_buffer_output() with a length of 0. Is this as
expected? Such calls don't accomplish anything.

5) I've been programming in C since ~1977 but there is some code
in gmake of a style I've never seen before. For example

printf ("%s %s= ", v->name, v->recursive ? v->append ? "+" : "" : ":");

define_variable_cname (".VARIABLES", "", o_default, 0)->special = 1;

o = variable_buffer_output (o, p, p1 != 0 ? (size_t) (p1 - p) : strlen (p) + 1);

save = length == SIZE_MAX ? xstrdup (string) : xstrndup (string, length);

# define SIZE_MAX ((size_t)~(size_t)0)

variable_buffer_length = (newlen + 100 > 2 * variable_buffer_length
                                ? newlen + 100
                                : 2 * variable_buffer_length);

Cordially,
Jon Forrest





reply via email to

[Prev in Thread] Current Thread [Next in Thread]