Home | History | Annotate | Download | only in make
History log of /src/usr.bin/make/trace.c
RevisionDateAuthorComments
 1.35  09-May-2025  rillig make: replace bitset in trace output with descriptive node attributes
 1.34  22-Apr-2025  rillig make: move struct Job from job.h to job.c

The content of this struct is an implementation detail, and other parts
of make only need to access very few parts of it.
 1.33  28-Mar-2023  rillig branches: 1.33.2;
make: declare all common symbols in headers, unexport others

No functional change.
 1.32  26-Mar-2022  rillig make: prefer 'long long' over 'long' on 32-bit C99 platforms

When sorting the words of an expression numerically using the modifier
':On' (added on 2021-07-30), use 64-bit numbers even on 32-bit
platforms. A typical use case is comparing file sizes.

When tracing the execution of jobs, fix an integer overflow after 2038.
32-bit platforms that use a pre-C99 compiler still have this problem.

No change to the test suite since most tests simply skip any potential
differences between 32-bit platforms and 64-bit platforms (see
varmod-order-numeric.mk) or already account for both variants (see
varmod-localtime.mk).
 1.31  05-Feb-2022  rillig make: improve C90 support

Do not use inline functions, remove trailing comma in enum declaration,
do not use 'long long' for printing a timestamp. This re-introduces the
Year 2038 Problem for pre-C99 compilers when printing the trace log, but
that is a seldom used feature.
 1.30  15-Dec-2021  rillig make: format comments according to /usr/share/misc/style

Assisted by indent(1), with manual corrections due to its many remaining
bugs.

No functional change.
 1.29  21-Sep-2021  rillig make: reduce relocations, thereby reducing .text size

No functional change.
 1.28  05-Feb-2021  rillig make: in the Var_ functions, move the scope to the front

This change provides for a more natural reading order in the code.
Placing the scope first makes it immediately clear in which context the
remaining parameters are interpreted.

No functional change.
 1.27  04-Feb-2021  rillig make: rename some VAR constants to SCOPE

The word "context" does not fit perfectly to the variables that are
associate with a GNode, as the context is usually something from the
outside and the variables are more like properties inherent to the
GNode.

The term "global context" fits even less. Since the thing where
variables are looked up is commonly named a scope, use that term
instead.

This commit only renames the global variables VAR_GLOBAL, VAR_INTERNAL
and VAR_CMDLINE, plus a few very closely related comments. These are:

GNode.vars (because of line breaks)
GNode_Free (dito)
varname-make_print_var_on_error.mk
varname-make_print_var_on_error-jobs.mk

The debug message in Var_Stats is left as-is since there is no unit test
for it yet.

The other renamings (variable names "context", "ctxt", as well as
further comments) will be done in a follow-up commit.
 1.26  19-Jan-2021  rillig make(1): remove do-not-format markers from comments

These markers had been used inconsistently. Furthermore the source code
had not been formatted automatically before 2020 at all, otherwise there
wouldn't have been any trailing whitespace left.
 1.25  20-Dec-2020  rillig make(1): change return type of Var_Value to FStr
 1.24  12-Dec-2020  rillig make(1): move Job.xtraced to ShellWriter

This flag was placed wrong in the Job since it is only necessary as long
as the shell commands are written to the shell file.

Resetting it in JobStart and JobExec was completely misguided since that
is far away from writing the shell commands; this should have been done
in JobPrintCommands instead.

The status of this flag doesn't need to be printed in debugging mode
since it is controlled by a single command line option (-dx) and does
not interact with all the other switches.
 1.23  10-Dec-2020  rillig make(1): unpack struct JobFlags

The job flags are only used individually.
 1.22  10-Dec-2020  rillig make(1): split JobFlags into separate fields

Having all these flags in a single bitmask makes it harder to see where
exactly they can possibly be used since their state could also be
modified using the unsuspicious job->flags = 0. Using individual names
just leaves the single memset, and that is only used during
initialization.
 1.21  31-Oct-2020  rillig make(1): document possible undefined behavior in trace.c with .CURDIR
 1.20  30-Oct-2020  rillig make(1): change char * to void * in Var_Value

The only purpose of the parameter freeIt is to free the memory
associated with the return value. To do this, no pointer arithmetic is
needed. Therefore, change to a void pointer, to catch accidental use of
that pointer.
 1.19  05-Oct-2020  rillig make(1): revert previous commit

It had accidentally reverted all the work from the past few days.
 1.18  05-Oct-2020  rillig make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02)

The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25. In
that commit, openDirectories was replaced with a combination of a list
with a hash table, for more efficient lookup by name.

Upon cleanup, OpenDirs_Done is called, which in turn called
Dir_ClearPath. Dir_ClearPath takes full ownership of the given list and
empties it. This was no problem before since afterwards the list was
empty and calling Lst_Free just frees the remaining list pointer.

With OpenDirs, this list was combined with a hash table, and the hash
table contains the list nodes, assuming that the OpenDirs functions have
full ownership of both the list and the hash table. This assumption was
generally correct, except for the one moment during cleanup where full
ownership of the list was passed to Dir_ClearPath, while the hash table
still contained pointers to the (now freed) list nodes. This by itself
was not a problem since the hash table would be freed afterwards. But
as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up
the freed directory by name and now found the freed list node, trying to
free it again. Boom.

Fixed by replacing the call to Dir_ClearPath with code that only frees
the directories, without giving up control over the list.
 1.17  03-Oct-2020  rillig make(1): clean up #include sections
 1.16  13-Sep-2020  rillig make(1): clean up RCSID blocks

These blocks mostly consisted of redundant structure, following the same
#ifndef pattern over and over, with only minimal variation.

It's easier to maintain if the common structure is only written once and
encapsulated in a macro.

To avoid "defined but unused" warnings from GCC in the case where
MAKE_NATIVE is not defined, I had to add volatile. Adding
MAKE_ATTR_UNUSED alone would not preserve the rcsid variable in the
resulting binary.
 1.15  03-Aug-2020  rillig make(1): no declaration-after-statement anymore

NetBSD make is intended to be maximally portable, therefore it uses only
C89. This was not declared in the Makefile before.

There are still a few places in parse.c and metachar.c that use
end-of-line comments. These will be fixed in a follow-up commit.
 1.14  01-Aug-2020  rillig make(1): avoid calls to free(3) in the common case of a NULL pointer
 1.13  01-Aug-2020  rillig make(1): let Var_Value return a const char *

The return value must not be modified anyway, so let the compiler check
this for free.
 1.12  03-Jul-2020  rillig make(1): remove trailing whitespace
 1.11  28-Dec-2008  christos prepare for time_t 64
 1.10  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9  15-Feb-2008  christos branches: 1.9.4;
back all changes out until I fix it properly.
 1.8  14-Feb-2008  christos - use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4
 1.7  04-Jan-2006  dsl Expunge last references to jobTokensFree
 1.6  07-May-2004  ross Simplify build, no functional changes.

Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when
you want things simple, instead add MAKE_NATIVE to get those hugely
important features like __RCSID().

It's now possible to build make on some hosts with: cc *.c */*.c
 1.5  15-Jun-2002  wiz branches: 1.5.2;
Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
 1.4  27-Jan-2002  reinoud Fix major bug in make(1) ... due to shadowing of the dotLast path used for
the .DOTLAST primitive by a boolean variable with the same name, this whole
mechanism was broken ... it doesn't save much stat calls but it was wrong.

Thanks to Jason Thorpe for the other shadow-variable fixing patches he
made.
 1.3  23-Jan-2001  cgd <sys/time.h>, rather than <time.h>. The former is actually the documented
way to get gettimeofday(), etc. On some systems on which you might want
to host make (e.g. solaris), <time.h> won't get you a struct timeval
definition.
 1.2  30-Dec-2000  sommerfeld Include token counts in trace output.
Don't let tokensFree go negative.
 1.1  29-Dec-2000  sommerfeld Quick and dirty trace mechanism to make it easier to look at how different
parallel make job distribution algorithms work in practice.
 1.5.2.1  10-May-2004  tron Pull up revision 1.6 (requested by sjg in ticket #282):
Simplify build, no functional changes.
Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when
you want things simple, instead add MAKE_NATIVE to get those hugely
important features like __RCSID().
It's now possible to build make on some hosts with: cc *.c */*.c
 1.9.4.1  18-May-2008  yamt sync with head.
 1.33.2.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed