The NetBSD Project

CVS log for src/usr.bin/make/parse.c

[BACK] Up to [cvs.NetBSD.org] / src / usr.bin / make

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.565 / (download) - annotate - [select for diffs], Tue Sep 21 23:06:18 2021 UTC (3 weeks, 5 days ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.564: +3 -3 lines
Diff to previous 1.564 (colored)

make: reduce relocations, thereby reducing .text size

No functional change.

Revision 1.564 / (download) - annotate - [select for diffs], Tue Sep 21 21:39:32 2021 UTC (3 weeks, 5 days ago) by rillig
Branch: MAIN
Changes since 1.563: +4 -6 lines
Diff to previous 1.563 (colored)

make: remove unnecessary const from parameters

These were leftovers from earlier refactorings, when extracting code to
separate functions.

No functional change.

Revision 1.563 / (download) - annotate - [select for diffs], Sat Aug 14 13:39:43 2021 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.562: +3 -3 lines
Diff to previous 1.562 (colored)

make: fix spelling of CVS and RCS in error message

Revision 1.562 / (download) - annotate - [select for diffs], Sat Aug 14 13:37:55 2021 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.561: +10 -10 lines
Diff to previous 1.561 (colored)

make: rename ParseMark to be more expressive

No functional change.

Revision 1.561 / (download) - annotate - [select for diffs], Sat Aug 14 13:32:12 2021 UTC (2 months ago) by rillig
Branch: MAIN
Changes since 1.560: +7 -7 lines
Diff to previous 1.560 (colored)

make: rename variable and function for handling parse errors

The word 'fatals' was an unnecessary abbreviation.

No functional change.

Revision 1.560 / (download) - annotate - [select for diffs], Mon Jun 21 10:42:06 2021 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.559: +9 -5 lines
Diff to previous 1.559 (colored)

make: document ParseDependencyOp

Revision 1.559 / (download) - annotate - [select for diffs], Mon Jun 21 10:33:11 2021 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.558: +12 -4 lines
Diff to previous 1.558 (colored)

make: document where to find tests for the dependency lines

Revision 1.558 / (download) - annotate - [select for diffs], Mon Jun 21 10:29:08 2021 UTC (3 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.557: +61 -51 lines
Diff to previous 1.557 (colored)

make: extract ParseDependencySources from ParseDependency

No functional change.

Revision 1.557 / (download) - annotate - [select for diffs], Sun Apr 4 11:56:43 2021 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1, cjep_staticlib_x-base, cjep_staticlib_x
Changes since 1.556: +6 -6 lines
Diff to previous 1.556 (colored)

make: convert VarEvalFlags back into an enum, but not a bit-set

As was apparent in VarEvalFlags_ToString, a bit-set was not the best
data type since most of the flags were not freely combinable.  The two
flags that could be combined were keepDollar and keepUndef, but even
these have distinguished names in the debug log.

The downside of struct bit-fields is that they need extra helper
functions in C90 (see nonints.h).  Exchange these for a few helper
functions in var.c, to keep the code outside var.c simple.

No functional change.

Revision 1.556 / (download) - annotate - [select for diffs], Sun Apr 4 10:13:09 2021 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.555: +49 -49 lines
Diff to previous 1.555 (colored)

make: remove filler word 'Do' from function names for parsing

No functional change, except for debug logging.

Revision 1.555 / (download) - annotate - [select for diffs], Sun Apr 4 09:58:51 2021 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.554: +5 -5 lines
Diff to previous 1.554 (colored)

make: rename ambiguous functions

These two functions have counterparts that include the word 'Do' in
their name, which is confusing.

No functional change.

Revision 1.554 / (download) - annotate - [select for diffs], Sat Apr 3 14:31:44 2021 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.553: +5 -5 lines
Diff to previous 1.553 (colored)

make: rename function parameters to match boolean constants

No functional change.

Revision 1.553 / (download) - annotate - [select for diffs], Sat Apr 3 11:08:40 2021 UTC (6 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.552: +126 -126 lines
Diff to previous 1.552 (colored)

make: use C99 bool type instead of defining its own

No functional change.

Revision 1.552 / (download) - annotate - [select for diffs], Mon Mar 15 12:15:03 2021 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.551: +6 -7 lines
Diff to previous 1.551 (colored)

make: replace enum bit-field with struct bit-field for VarEvalFlags

This makes the code easier to read, especially in var.c.  It also makes
debugging sessions easier since some debuggers don't show enum
bit-fields symbolically as soon as more than one bit is set.

The code outside var.c is basically unchanged, except that instead of
passing the individual flags, there are 4 predefined evaluation modes.
These suffice for all practical use cases.  Only in the implementation
deep inside var.c, the value of the flags keepDollar and keepUndef
differs.

There is no way of passing the struct to EnumFlags_ToString, which means
the ToString function has to be spelled out explicitly.  This allows for
fine-tuning the representation in the debug log, to reduce the amount of
uppercae letters.

No functional change.

Revision 1.551 / (download) - annotate - [select for diffs], Mon Mar 15 11:41:07 2021 UTC (7 months ago) by rillig
Branch: MAIN
Changes since 1.550: +5 -5 lines
Diff to previous 1.550 (colored)

make: rename VARE_NONE to VARE_PARSE_ONLY

The name 'NONE' described the bit pattern, which was not useful to
understand its meaning.  Omitting VARE_WANTRES only parses the
expression, without evaluating any part of it.

No functional change, not even in debug mode since Enum_FlagsToString
always returns "none" for all-bits-unset.

Revision 1.550 / (download) - annotate - [select for diffs], Mon Feb 22 23:21:33 2021 UTC (7 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.549: +9 -10 lines
Diff to previous 1.549 (colored)

make: remove freestanding freeIt variables

These variables all belong to a string variable.  Connect them using
FStr, which reduces the number of variables to keep track of.

No functional change.

Revision 1.549 / (download) - annotate - [select for diffs], Fri Feb 5 05:46:27 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.548: +12 -15 lines
Diff to previous 1.548 (colored)

make: clean up a few comments in parse.c

Revision 1.548 / (download) - annotate - [select for diffs], Fri Feb 5 05:15:12 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.547: +14 -14 lines
Diff to previous 1.547 (colored)

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.

Revision 1.547 / (download) - annotate - [select for diffs], Fri Feb 5 04:41:17 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.546: +8 -8 lines
Diff to previous 1.546 (colored)

make: add shortcut Global_Delete for deleting a global variable

Revision 1.546 / (download) - annotate - [select for diffs], Thu Feb 4 21:42:46 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.545: +21 -21 lines
Diff to previous 1.545 (colored)

make: rename context and ctxt to scope

This continues the previous commit, in which VAR_GLOBAL, VAR_INTERNAL
and VAR_CMDLINE were renamed.

Renaming the variable 'ctxt' was trivial since that word is used nowhere
else.  In the comments though, each occurrence of the word 'context' had
to be checked individually since the word 'context' was not only used
for referring to a variable scope.  It is also used to distinguish
different situations where characters are escaped in a certain way
('parsing context') and in a few other expressions.

Revision 1.545 / (download) - annotate - [select for diffs], Thu Feb 4 21:33:14 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.544: +22 -21 lines
Diff to previous 1.544 (colored)

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.

Revision 1.544 / (download) - annotate - [select for diffs], Thu Feb 4 19:00:45 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.543: +6 -6 lines
Diff to previous 1.543 (colored)

make: rename Var_Set to Var_SetExpand

After doing the textual renaming across all files, I added a new
function Var_Set that does not expand the variable name.  I then undid
the renaming for all calls where the variable name cannot ever contain a
dollar sign.  I omitted the word "Expand" from the textual references in
the unit tests and in the debug logging messages since the focus is
usually on the "Set" part, not on the "Expand".

No functional change.

Revision 1.543 / (download) - annotate - [select for diffs], Wed Feb 3 14:33:09 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.542: +4 -4 lines
Diff to previous 1.542 (colored)

make: split Var_Exists into plain Var_Exists and Var_ExistsExpand

Most previous calls to Var_Exists use constant variable names.  Only the
two calls in parse.c need to expand the variable name.

It may be a good idea to expand the variable name once in VarAssign_Eval
instead of repeating the expansion in each of its special cases.

No functional change.

Revision 1.542 / (download) - annotate - [select for diffs], Wed Feb 3 13:53:12 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.541: +5 -5 lines
Diff to previous 1.541 (colored)

make: replace Global_AppendExpand with Global_Append

All callers with a variable name that is guaranteed to not contain a
dollar sign have been converted to call Global_Append instead of the
previous Global_AppendExpand.  After that, Global_AppendExpand was
unused, therefore it was effectively just renamed.

Revision 1.541 / (download) - annotate - [select for diffs], Wed Feb 3 13:44:39 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.540: +3 -3 lines
Diff to previous 1.540 (colored)

make: split Var_Append into Var_Append and Var_AppendExpand

The plain Var_Append now does not expand the variable name anymore.  It
is used in situations where the variable name is known to not contain a
dollar sign.

This is a preparation for adding Global_Append, corresponding to
Global_AppendExpand.

Revision 1.540 / (download) - annotate - [select for diffs], Wed Feb 3 08:08:18 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.539: +3 -3 lines
Diff to previous 1.539 (colored)

make: replace Global_SetExpand with Global_Set for constant names

Revision 1.539 / (download) - annotate - [select for diffs], Wed Feb 3 08:00:36 2021 UTC (8 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.538: +8 -8 lines
Diff to previous 1.538 (colored)

make: use shortcut functions Global_SetExpand and Global_AppendExpand

There are many places where global variables are set or appended to.  To
reduce clutter and code size, encode the VAR_GLOBAL in the function
name.

The word Expand in the function names says that the variable name is
expanded.  In most of the cases, this is not necessary, but there are no
corresponding functions Global_Set or Global_Append yet.

Encoding the information whether the name is expanded or not in the
function name will make inconsistencies obvious in future manual code
reviews. Letting the compiler check this by using different types for
unexpanded and expanded variable names is probably not worth the effort.
There are still a few bugs to be fixed, such as in SetVar, which expands
the variable name twice in a row.

Revision 1.538 / (download) - annotate - [select for diffs], Mon Feb 1 22:21:33 2021 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.537: +14 -11 lines
Diff to previous 1.537 (colored)

make: clean up comments in parse.c

Revision 1.537 / (download) - annotate - [select for diffs], Mon Feb 1 22:16:57 2021 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.536: +6 -6 lines
Diff to previous 1.536 (colored)

make: rename Parse_include_file to IncludeFile

Revision 1.536 / (download) - annotate - [select for diffs], Mon Feb 1 22:06:05 2021 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.535: +4 -6 lines
Diff to previous 1.535 (colored)

make: simplify VarAssign_EvalSubst

No functional change.

Revision 1.535 / (download) - annotate - [select for diffs], Mon Feb 1 21:56:03 2021 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.534: +3 -3 lines
Diff to previous 1.534 (colored)

make: replace parse error "Need an operator" with better message

The previous error message is not easily understandable since it is
missing a crucial detail, the column where the operator is needed.
Without this information, the author of the makefile gets no useful
hint.  Furthermore, there are several types of operators in makefiles:

	the dependency operators ':', '!', '::',
	the variable assignment operators '=', '!=', '+=', '?=', ':=',
	the conditional operators '&&', '||', '!',
	the comparison operators '==', '!=', '>', '>=', '<', '<='.

This leaves too much ambiguity.

Replace this error message with "Invalid line type", which is more
generic, more accurate and thus less misleading.

Revision 1.534 / (download) - annotate - [select for diffs], Sat Jan 30 20:53:29 2021 UTC (8 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.533: +3 -3 lines
Diff to previous 1.533 (colored)

make(1): split Buf_Destroy into Buf_Done and Buf_DoneData

In all cases except one, the boolean argument to Buf_Destroy was
constant.  Removing that argument by splitting the function into two
separate functions makes the intention clearer on the call site.  It
also removes the possibility for using the return value of Buf_Done,
which would have made no sense.

The function Buf_Done now pairs with Buf_Init, just as in HashTable and
Lst.

Even though Buf_Done is essentially a no-op, it is kept as a function,
both for symmetry with Buf_Init and for clearing the Buffer members
after use (this will be done only in CLEANUP mode, in a follow-up
commit).

Revision 1.533 / (download) - annotate - [select for diffs], Wed Jan 27 00:02:38 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.532: +6 -9 lines
Diff to previous 1.532 (colored)

make(1): fix irrelevant message in -W mode

Revision 1.532 / (download) - annotate - [select for diffs], Tue Jan 26 23:44:56 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.531: +65 -42 lines
Diff to previous 1.531 (colored)

make(1): in -dp mode, print stack trace with each diagnostic

This makes it easier to track down where a warning or an error
originated from.  This information could be further enriched for .for
loops, to also include the variable names and their values.  For now,
it's good enough to replace the large comment describing how a stack
trace _could_ be generated with actual code that implements that idea.

The syntax of the locations is <filename>:<lineno>, which intentionally
differs from the traditional "<filename>" line <lineno>, since the
former is more widely supported by editors and IDEs.

Having this stacktrace information is especially intended for
complicated systems built upon make, such as pkgsrc.

Revision 1.531 / (download) - annotate - [select for diffs], Sun Jan 24 20:11:55 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.530: +4 -4 lines
Diff to previous 1.530 (colored)

make(1): convert SearchPath to struct

This prepares for making dotLast a simple struct member instead of a
fake CachedDir, which is easier to understand.

Revision 1.530 / (download) - annotate - [select for diffs], Sat Jan 23 12:03:25 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.529: +21 -22 lines
Diff to previous 1.529 (colored)

make(1): improve variable names when parsing directives

Revision 1.529 / (download) - annotate - [select for diffs], Sat Jan 23 11:34:41 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.528: +4 -4 lines
Diff to previous 1.528 (colored)

make(1): rename Dir_AddDir, reorder parameters of SearchPath_ToFlags

Revision 1.528 / (download) - annotate - [select for diffs], Sat Jan 23 10:48:49 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.527: +3 -3 lines
Diff to previous 1.527 (colored)

make(1): rename Dir_Expand to SearchPath_Expand

The main subject of this function is the search path.  In this search
path the pattern is expanded.

Revision 1.527 / (download) - annotate - [select for diffs], Thu Jan 21 14:30:01 2021 UTC (8 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.526: +4 -6 lines
Diff to previous 1.526 (colored)

make(1): merge duplicate code in Parse_MainName

Revision 1.526 / (download) - annotate - [select for diffs], Sun Jan 10 21:20:46 2021 UTC (9 months ago) by rillig
Branch: MAIN
Changes since 1.525: +4 -4 lines
Diff to previous 1.525 (colored)

make(1): consistently use boolean expressions in conditions

Most of the make code already followed the style of explicitly writing
(ptr != NULL) instead of the shorter (ptr) in conditions.

The remaining 50 instances have been found by an experimental,
unpublished check in lint(1) that treats bool expressions as
incompatible to any other scalar type, just as in Java, C#, Pascal and
several other languages.

The only unsafe operation on Boolean that is left over is (flags &
FLAG), for an enum implementing a bit set.  If Boolean is an ordinary
integer type (the default), some high bits may get lost.  But if Boolean
is the same as _Bool (by compiling with -DUSE_C99_BOOLEAN), C99 6.3.1.2
defines that a conversion from any scalar to the type _Bool acts as a
comparison to 0, which cannot lose any bits.

Revision 1.525 / (download) - annotate - [select for diffs], Thu Dec 31 17:39:36 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.524: +3 -3 lines
Diff to previous 1.524 (colored)

make(1): replace pointers in controlling conditions with booleans

Revision 1.524 / (download) - annotate - [select for diffs], Wed Dec 30 10:03:16 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.523: +60 -31 lines
Diff to previous 1.523 (colored)

make(1): format multi-line comments

Revision 1.523 / (download) - annotate - [select for diffs], Mon Dec 28 15:42:53 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.522: +3 -3 lines
Diff to previous 1.522 (colored)

make(1): rename Buf_Expand_1 to Buf_Expand

Revision 1.522 / (download) - annotate - [select for diffs], Mon Dec 28 15:21:33 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.521: +41 -115 lines
Diff to previous 1.521 (colored)

make(1): remove mmap for loading files, only allow files < 1 GiB

Using mmap is beneficial if the loaded data is read-only, or if it is
accessed in random order.  Neither of these applies here.  When loading
a file, make reads it strictly from top to bottom, once.  During
parsing, the loaded data is modified in-place to insert '\0' and '\n'
for terminating strings and lines.  Because of all of this, there is no
benefit in using mmap.

Reading the file using 2 calls to read(2) (one for the data, one for
checking for EOF) loads the data in a single pass, instead of producing
a page fault whenever the parser passes another page boundary.

Use a Buffer for loading the file data, to avoid calling bmake_realloc
directly.

Do not resize the loaded buffer at the end.  Each loaded file is
short-lived anyway, and only a few files are loaded at the same time, so
there is no point in optimizing this part for low memory usage.

Revision 1.521 / (download) - annotate - [select for diffs], Mon Dec 28 00:46:24 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.520: +4 -6 lines
Diff to previous 1.520 (colored)

make(1): replace global preserveUndefined with VARE_KEEP_UNDEF

Controlling the expansion of variable expressions using a global
variable and a VARE flag was inconsistent.

Converting the global variable into a flag had to prerequisites:

1.  The unintended duplicate variable assignment had to be fixed, as
done in parse.c 1.520 from 2020-12-27.  Without this fix, it would have
been necessary to add more flags to Var_Exists and Var_SetWithFlags, and
this would have become too complex.

2.  There had to be a unit test demonstrating that VARE_KEEP_DOLLAR only
applies to the top-level expression and is not passed to the
subexpressions, while VARE_KEEP_UNDEF applies to all subexpressions as
well.  This test is in var-op-expand.mk 1.10 from 2020-12-28, at least
for the ':@word@' modifier.  In ParseModifierPartSubst, VARE_KEEP_UNDEF
is not passed down either, in the same way.

Revision 1.520 / (download) - annotate - [select for diffs], Sun Dec 27 22:29:37 2020 UTC (9 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.519: +5 -14 lines
Diff to previous 1.519 (colored)

make(1): fix edge case in := with undefined in variable name

Previously, the assignment "VAR${UNDEF} := value" actually assigned to 2
variables.  See var-op-expand.mk for details.

Revision 1.519 / (download) - annotate - [select for diffs], Sun Dec 27 18:22:28 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.518: +4 -5 lines
Diff to previous 1.518 (colored)

make(1): skip variable expansion in ParseDependencyTargetWord

The goal of the code is just to skip over the variable expression, thus
there is no need to evaluate it.

Revision 1.518 / (download) - annotate - [select for diffs], Sun Dec 27 11:47:04 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.517: +4 -4 lines
Diff to previous 1.517 (colored)

make(1): exit 2 on technical errors

This allows the -q option to distinguish errors from out-of-date
targets.  Granted, it's an edge case but it should be solved
consistently anyway.

The majority of cases in which make exits with exit status 1, even in -q
mode, is when there are parse errors.  These have been kept as-is for
now as they affect many of the unit tests.

The technical errors, on the other hand, occur so rarely that it's hard
to write reliable tests for them that fail consistently on all platforms
supported by make.

Revision 1.517 / (download) - annotate - [select for diffs], Sun Dec 27 05:06:17 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.516: +4 -4 lines
Diff to previous 1.516 (colored)

make(1): align names of VarExportMode with the directives

Revision 1.516 / (download) - annotate - [select for diffs], Wed Dec 23 14:13:49 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.515: +3 -3 lines
Diff to previous 1.515 (colored)

make(1): fix a few lint warnings

Revision 1.515 / (download) - annotate - [select for diffs], Wed Dec 23 13:50:54 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.514: +4 -4 lines
Diff to previous 1.514 (colored)

make(1): rename CmdOpts.lint to strict

When running lint(1) on the code, it defines the preprocessor macro
"lint" to 1, which generated a syntax error in the declaration "Boolean
lint", as that became "Boolean 1".

Revision 1.514 / (download) - annotate - [select for diffs], Tue Dec 22 08:51:30 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.513: +3 -3 lines
Diff to previous 1.513 (colored)

make(1): re-add improved assertion in ParseGetLine

Revision 1.513 / (download) - annotate - [select for diffs], Tue Dec 22 08:31:13 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.512: +2 -3 lines
Diff to previous 1.512 (colored)

make(1): remove assertion about lines ending with '\n'

It fails the NetBSD build.sh.

Revision 1.512 / (download) - annotate - [select for diffs], Tue Dec 22 08:10:39 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.511: +4 -6 lines
Diff to previous 1.511 (colored)

make(1): remove needless assignment to line_end in ParseGetLine

Revision 1.511 / (download) - annotate - [select for diffs], Tue Dec 22 08:05:08 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.510: +20 -27 lines
Diff to previous 1.510 (colored)

make(1): fix assertion failure for files without trailing newline

Previously, mmapped files didn't always have the final newline added.
Only those that ended at a page boundary did.

This confused ParseRawLine, which assumed (and since parse.c 1.510 from
moments ago also asserted) that every line ends with a newline, which
allows the code to assume that after a backslash, there is at least one
other character in the buffer, thereby preventing an out-of-bounds read.

This bug had been there at least since parse.c 1.170 from 2010-12-25
04:57:07, maybe even earlier, I didn't check.

Now line_end always points to the trailing newline, which allows
ParseGetLine to overwrite that character to end the string.

Revision 1.510 / (download) - annotate - [select for diffs], Tue Dec 22 06:48:33 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.509: +20 -2 lines
Diff to previous 1.509 (colored)

make(1): prevent undefined behavior in loadfile_mmap

Reading a file without a trailing newline had resulted in an
out-of-bounds write, in the common case where the file is loaded via
mmap.

Revision 1.509 / (download) - annotate - [select for diffs], Mon Dec 21 02:09:34 2020 UTC (9 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.508: +3 -3 lines
Diff to previous 1.508 (colored)

make(1): fix garbled output for failed shell command (since 2020-12-20)

Passing a struct as printf argument for the %s conversion doesn't work.
On NetBSD-8.0-x86_64, the output looks normal, but on SunOS-5.9, the
output is garbled, containing bytes 0xFF and 0xFE.

This bug had been introduced in parse.c 1.507 from 2020-12-20 14:52:16.

Thanks to sjg for finding this bug so quickly.

Revision 1.508 / (download) - annotate - [select for diffs], Sun Dec 20 18:23:24 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.507: +3 -3 lines
Diff to previous 1.507 (colored)

make(1): remove redundant const declarations for parameters

Revision 1.507 / (download) - annotate - [select for diffs], Sun Dec 20 14:52:16 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.506: +12 -12 lines
Diff to previous 1.506 (colored)

make(1): clean up memory handling in VarAssign_EvalShell

Revision 1.506 / (download) - annotate - [select for diffs], Sun Dec 20 14:48:35 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.505: +17 -25 lines
Diff to previous 1.505 (colored)

make(1): clean up memory handling in Parse_DoVar

Revision 1.505 / (download) - annotate - [select for diffs], Sun Dec 20 14:32:13 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.504: +21 -21 lines
Diff to previous 1.504 (colored)

make(1): change return type of Var_Value to FStr

Revision 1.504 / (download) - annotate - [select for diffs], Sun Dec 20 13:38:43 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.503: +5 -6 lines
Diff to previous 1.503 (colored)

make(1): return FStr from Var_Parse

This reduces the number of variable declarations at the call sites.

Revision 1.503 / (download) - annotate - [select for diffs], Sat Dec 19 22:33:11 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.502: +15 -13 lines
Diff to previous 1.502 (colored)

make(1): fix error message for .info/.warning/.error without argument

Previously, the error message was "Unknown directive", which was
obviously wrong.  The new error message is "Missing argument".

Revision 1.502 / (download) - annotate - [select for diffs], Sat Dec 19 20:16:36 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.501: +3 -8 lines
Diff to previous 1.501 (colored)

make(1): extract Var_Undef from ParseDirective

Revision 1.501 / (download) - annotate - [select for diffs], Sat Dec 19 17:54:29 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.500: +29 -20 lines
Diff to previous 1.500 (colored)

make(1): extract ParseSkippedBranches from ParseReadLine

Revision 1.500 / (download) - annotate - [select for diffs], Sat Dec 19 17:49:11 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.499: +34 -28 lines
Diff to previous 1.499 (colored)

make(1): extract ParseForLoop from ParseReadLine

Revision 1.499 / (download) - annotate - [select for diffs], Sat Dec 19 16:05:33 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.498: +15 -23 lines
Diff to previous 1.498 (colored)

make(1): rename mode constants for ParseGetLine to be more expressive

Revision 1.498 / (download) - annotate - [select for diffs], Sat Dec 19 15:29:28 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.497: +6 -6 lines
Diff to previous 1.497 (colored)

make(1): fix documentation of GetLineMode

ParseGetLine always returns a logical line, even for PARSE_RAW.

Revision 1.497 / (download) - annotate - [select for diffs], Sat Dec 19 13:30:00 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.496: +5 -9 lines
Diff to previous 1.496 (colored)

make(1): reduce debugging details in Parse_SetInput

The address of readMoreArg is hardly useful when stepping through this
part of the code, therefore omit it.  Instead of mentioning the exact
function names of the data source, describe them in words, which helps
especially in the case of .for loops.

Revision 1.496 / (download) - annotate - [select for diffs], Sat Dec 19 13:16:25 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.495: +6 -6 lines
Diff to previous 1.495 (colored)

make(1): rename parameter line to lineno

Revision 1.495 / (download) - annotate - [select for diffs], Sat Dec 19 12:48:59 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.494: +24 -2 lines
Diff to previous 1.494 (colored)

make(1): document enum GetLineMode

Revision 1.494 / (download) - annotate - [select for diffs], Sat Dec 19 12:24:46 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.493: +4 -4 lines
Diff to previous 1.493 (colored)

make(1): fix line numbers in .for loops (since 2007-01-01)

Revision 1.493 / (download) - annotate - [select for diffs], Sat Dec 19 10:57:17 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.492: +26 -22 lines
Diff to previous 1.492 (colored)

make(1): merge parameter of ParseRawLine into return value

Revision 1.492 / (download) - annotate - [select for diffs], Sat Dec 19 10:49:36 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.491: +46 -52 lines
Diff to previous 1.491 (colored)

make(1): clean up variable names in ParseGetLine and ParseRawLine

Revision 1.491 / (download) - annotate - [select for diffs], Sat Dec 19 10:18:46 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.490: +24 -21 lines
Diff to previous 1.490 (colored)

make(1): fix variable names in UnescapeBackslash

The previous variable names had been chosen at a time when compilers
didn't merge variables into the same registers.  Luckily, these times
are gone, and it's no longer necessary to use a variable for 2 or more
completely unrelated purposes.

Revision 1.490 / (download) - annotate - [select for diffs], Sat Dec 19 00:27:34 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.489: +9 -14 lines
Diff to previous 1.489 (colored)

make(1): clean up ParseRawLine

Revision 1.489 / (download) - annotate - [select for diffs], Sat Dec 19 00:20:57 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.488: +78 -53 lines
Diff to previous 1.488 (colored)

make(1): extract ParseRawLine from ParseGetLine

Revision 1.488 / (download) - annotate - [select for diffs], Sat Dec 19 00:02:34 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.487: +4 -7 lines
Diff to previous 1.487 (colored)

make(1): clean up another local variable in ParseGetLine

Revision 1.487 / (download) - annotate - [select for diffs], Fri Dec 18 23:18:08 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.486: +7 -19 lines
Diff to previous 1.486 (colored)

make(1): clean up UnescapeBackslash

Revision 1.486 / (download) - annotate - [select for diffs], Fri Dec 18 23:13:45 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.485: +4 -5 lines
Diff to previous 1.485 (colored)

make(1): remove unused parameter from UnescapeBackslash

Revision 1.485 / (download) - annotate - [select for diffs], Fri Dec 18 19:02:37 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.484: +73 -45 lines
Diff to previous 1.484 (colored)

make(1): split ParseGetLine into separate functions

Revision 1.484 / (download) - annotate - [select for diffs], Fri Dec 18 18:23:29 2020 UTC (9 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.483: +20 -21 lines
Diff to previous 1.483 (colored)

make(1): separate ParseGetLine into paragraphs

Revision 1.483 / (download) - annotate - [select for diffs], Tue Dec 15 00:32:26 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.482: +15 -2 lines
Diff to previous 1.482 (colored)

make(1): document how to detect typos in .elif directives

Revision 1.482 / (download) - annotate - [select for diffs], Mon Dec 14 23:48:03 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.481: +14 -12 lines
Diff to previous 1.481 (colored)

make(1): clean up ParseReadLine

In function names, the word "get" was not used consistently to look up
or compute data, in several cases "get" was a synonym for "read", just
like in the standard C library (fgetc).

The really confusing part is that there are two functions now, called
ParseGetLine and ParseReadLine, and both were underdocumented.

Revision 1.481 / (download) - annotate - [select for diffs], Sun Dec 13 21:27:45 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.480: +4 -4 lines
Diff to previous 1.480 (colored)

make(1): replace %zu with %u in printf calls

This is needed to compile bmake with GCC 2.8.1 on SunOS 5.9.

To support ancient systems like this, the whole code of usr.bin/make is
supposed to use only ISO C90 features, except for filemon, which is not
used on these systems.

Revision 1.480 / (download) - annotate - [select for diffs], Sun Dec 13 20:14:48 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.479: +4 -6 lines
Diff to previous 1.479 (colored)

make(1): add str_basename to reduce duplicate code

The function basename from POSIX has a few unfortunate properties, it is
allowed to return a pointer to static memory.  This is too unreliable,
therefore this trivial own implementation.

Revision 1.479 / (download) - annotate - [select for diffs], Sun Dec 13 02:15:49 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.478: +7 -5 lines
Diff to previous 1.478 (colored)

make(1): remove dead code from GetVarnamesToUnexport

Now that the parsing of the directives is unified and strict, there is
no need anymore for the dispatched functions to check for unknown
directives.  These functions don't even get the information to decide
that since this decision is already done.

Revision 1.478 / (download) - annotate - [select for diffs], Sun Dec 13 02:01:43 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.477: +15 -11 lines
Diff to previous 1.477 (colored)

make(1): replace *line with line[0]

Since a line is not an iterator and since the expression *line typically
means "the current element", not "the first character", replacing *line
with line[0] more directly expresses the idea of accessing the first
character of a string.

Revision 1.477 / (download) - annotate - [select for diffs], Sun Dec 13 01:51:08 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.476: +11 -7 lines
Diff to previous 1.476 (colored)

make(1): clean up comment for ParseDirective

Revision 1.476 / (download) - annotate - [select for diffs], Sun Dec 13 01:41:12 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.475: +10 -6 lines
Diff to previous 1.475 (colored)

make(1): clean up Var_Export

Revision 1.475 / (download) - annotate - [select for diffs], Sun Dec 13 01:07:54 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.474: +45 -31 lines
Diff to previous 1.474 (colored)

make(1): error out on misspelled directives

Before, make accepted misspellings like .warnings, .export-literally and
a few others, all of which are unlikely to occur in practice.  See the
test directive-misspellings.mk for further details.

Revision 1.474 / (download) - annotate - [select for diffs], Sat Dec 12 21:35:21 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.473: +40 -42 lines
Diff to previous 1.473 (colored)

make(1): reduce indentation of ParseDirective

Revision 1.473 / (download) - annotate - [select for diffs], Sat Dec 12 21:20:30 2020 UTC (10 months ago) by rillig
Branch: MAIN
Changes since 1.472: +4 -4 lines
Diff to previous 1.472 (colored)

make(1): eliminate boolean argument of Var_Export

Revision 1.472 / (download) - annotate - [select for diffs], Sun Dec 6 20:33:44 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.471: +6 -32 lines
Diff to previous 1.471 (colored)

make(1): error out on null bytes in makefiles

Makefiles are text files, they must not contain null bytes.

The previous code in this area was rotten anyway.  It assumed that
buf_end could be NULL even if buf_ptr was a valid pointer, which is no
longer true, probably since a few years already.

Continuing parsing after a null byte does not make sense.  If there's a
null byte in a text file, that file is corrupted, and parsing it leads
to unintended effects easily.  Therefore the only sensible action is to
stop parsing immediately.

The check whether cf->readMore could be null was outdated as well, which
previously made the fatal error impossible to reach.  Because of the
missing unit tests, nobody noticed this though.

The "exit status 0" in opt-file.exp is worring but that's due to another
bug and will be fixed in a follow-up commit.

Revision 1.471 / (download) - annotate - [select for diffs], Sun Dec 6 20:09:01 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.470: +24 -22 lines
Diff to previous 1.470 (colored)

make(1): rename IFile.nextbuf to readMore

The previous name sounded too much like a noun, which was too confusing.
See unit-tests/opt-file.mk for the history of this part of the code.

Revision 1.470 / (download) - annotate - [select for diffs], Sun Dec 6 18:37:04 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.469: +3 -3 lines
Diff to previous 1.469 (colored)

make(1): fix undefined behavior in ParseEOF

Adding a number to a null pointer should have been caught by any
Undefined Behavior Sanitizer, but apparently neither GCC nor Clang do
this.

Revision 1.469 / (download) - annotate - [select for diffs], Sat Dec 5 19:46:04 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.468: +1867 -1770 lines
Diff to previous 1.468 (colored)

make(1): indent parse.c with tabs instead of spaces

Revision 1.468 / (download) - annotate - [select for diffs], Sat Dec 5 19:06:51 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.467: +17 -13 lines
Diff to previous 1.467 (colored)

make(1): reduce indentation in ParseDependencySourceKeyword

Revision 1.467 / (download) - annotate - [select for diffs], Sat Dec 5 19:03:45 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.466: +27 -21 lines
Diff to previous 1.466 (colored)

make(1): extract ParseDependencySourceWait

Revision 1.466 / (download) - annotate - [select for diffs], Sat Dec 5 18:38:02 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.465: +26 -26 lines
Diff to previous 1.465 (colored)

make(1): define constants for enum zero-values

Revision 1.465 / (download) - annotate - [select for diffs], Sat Dec 5 18:15:40 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.464: +4 -4 lines
Diff to previous 1.464 (colored)

make(1): remove redundant assignments

Revision 1.464 / (download) - annotate - [select for diffs], Fri Dec 4 20:23:33 2020 UTC (10 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.463: +14 -13 lines
Diff to previous 1.463 (colored)

make(1): rename parse functions

The word "Do" was not necessary.

Revision 1.463 / (download) - annotate - [select for diffs], Sun Nov 29 01:40:26 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.462: +5 -5 lines
Diff to previous 1.462 (colored)

make(1): reduce memory allocation for dirSearchPath

Revision 1.462 / (download) - annotate - [select for diffs], Sun Nov 29 01:35:33 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.461: +13 -16 lines
Diff to previous 1.461 (colored)

make(1): reduce memory allocations for parsing dependencies

Revision 1.461 / (download) - annotate - [select for diffs], Sun Nov 29 00:04:22 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.460: +7 -16 lines
Diff to previous 1.460 (colored)

make(1): reduce memory allocation for targets

This change moves the initialization and finalization of the list of
targets to the same function.  They had been split before.

Revision 1.460 / (download) - annotate - [select for diffs], Sat Nov 28 23:39:58 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.459: +4 -4 lines
Diff to previous 1.459 (colored)

make(1): reduce memory allocation for CmdOpts.create

Revision 1.459 / (download) - annotate - [select for diffs], Sat Nov 28 22:56:01 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.458: +10 -10 lines
Diff to previous 1.458 (colored)

make(1): replace Dir_Destroy with SearchPath_Free

The function Dir_Destroy is an implementation detail of the cached
directories, and it should not be exported to the other modules.  The
search paths, on the other hand, are the high-level API that may be used
by the other modules, as the concept of search paths is documented in
the manual page.

Revision 1.458 / (download) - annotate - [select for diffs], Sat Nov 28 22:13:56 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.457: +3 -3 lines
Diff to previous 1.457 (colored)

make(1): rename some Dir functions to SearchPath

These functions have the search path as their main subject.

Revision 1.457 / (download) - annotate - [select for diffs], Sat Nov 28 19:20:03 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.456: +8 -8 lines
Diff to previous 1.456 (colored)

make(1): reduce pointer indirection for GNode.cohorts

Revision 1.456 / (download) - annotate - [select for diffs], Sat Nov 28 19:16:53 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.455: +4 -4 lines
Diff to previous 1.455 (colored)

make(1): reduce pointer indirection for GNode.order_pred and order_succ

Revision 1.455 / (download) - annotate - [select for diffs], Sat Nov 28 19:12:28 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.454: +4 -4 lines
Diff to previous 1.454 (colored)

make(1): reduce memory allocation for GNode.parents and GNode.children

Revision 1.454 / (download) - annotate - [select for diffs], Sat Nov 28 18:55:52 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.453: +4 -4 lines
Diff to previous 1.453 (colored)

make(1): remove pointer indirection from GNode.commands

Just to save a few memory allocations.  No noticeable effect on the
performance though.

Revision 1.453 / (download) - annotate - [select for diffs], Sat Nov 28 16:34:13 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.452: +4 -4 lines
Diff to previous 1.452 (colored)

make(1): fix type of local variable in ParseMessage

Revision 1.452 / (download) - annotate - [select for diffs], Sat Nov 28 10:05:49 2020 UTC (10 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.451: +7 -7 lines
Diff to previous 1.451 (colored)

make(1): rename local variable in ParseFindKeyword

It conflicts with the global 'cur'.

Revision 1.451 / (download) - annotate - [select for diffs], Mon Nov 23 23:41:11 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.450: +4 -4 lines
Diff to previous 1.450 (colored)

make(1): use comparisons in boolean expressions

The generated code stays exactly the same.

Revision 1.450 / (download) - annotate - [select for diffs], Mon Nov 23 20:52:59 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.449: +7 -7 lines
Diff to previous 1.449 (colored)

make(1): use properly typed comparisons in boolean contexts

Revision 1.449 / (download) - annotate - [select for diffs], Mon Nov 23 20:41:20 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.448: +3 -3 lines
Diff to previous 1.448 (colored)

make(1): align end-of-line comments with tabs

Revision 1.448 / (download) - annotate - [select for diffs], Sun Nov 22 20:36:17 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.447: +5 -4 lines
Diff to previous 1.447 (colored)

make(1): add another unit test for suffix handling

Revision 1.447 / (download) - annotate - [select for diffs], Sun Nov 22 20:29:53 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.446: +3 -2 lines
Diff to previous 1.446 (colored)

make(1): add debug logging for setting and resetting the main target

The suffix code still doesn't behave as expected.  Make sure that at
least setting the main target works as expected.  It does, and the added
debug logging provides further hints for debugging the suffix handling
code.

Revision 1.446 / (download) - annotate - [select for diffs], Sun Nov 22 19:14:24 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.445: +3 -3 lines
Diff to previous 1.445 (colored)

make(1): use canonical character comparison in ParseDoDependencyTargets

Revision 1.445 / (download) - annotate - [select for diffs], Fri Nov 20 20:01:16 2020 UTC (10 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.444: +8 -5 lines
Diff to previous 1.444 (colored)

make(1): make string iterator in ParseDependencyTargetWord const

Revision 1.444 / (download) - annotate - [select for diffs], Fri Nov 20 00:24:56 2020 UTC (10 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.443: +19 -19 lines
Diff to previous 1.443 (colored)

make(1): fix local variable name in ParseDoDependencyTargets

Revision 1.443 / (download) - annotate - [select for diffs], Mon Nov 16 21:39:22 2020 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.442: +3 -3 lines
Diff to previous 1.442 (colored)

make(1): rename Targ_NewGN to GNode_New

This function is a classical constructor function, and if it weren't for
CLEANUP mode, it would have no dependencies on anything else besides the
memory allocator.  Therefore it doesn't really matter which module
defines this function, and there is no need for the "Targ" to be part of
the function name.

Revision 1.442 / (download) - annotate - [select for diffs], Sun Nov 15 22:31:03 2020 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.441: +4 -4 lines
Diff to previous 1.441 (colored)

make(1): clean up coding style in compat, parse, suff

Revision 1.441 / (download) - annotate - [select for diffs], Sun Nov 15 12:02:44 2020 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.440: +112 -129 lines
Diff to previous 1.440 (colored)

make(1): clean up make.h, meta.c, parse.c, str.c

The main changes are in the comments, which have been shortened and
corrected.

Some local variables changed their names.

In ParseErrorInternal, the scope of va_start is now narrower.

In ParseDoDependency, the type of tOp has been fixed.

ParseGetLine doesn't take flags anymore but instead a parsing mode.
Previously, the flags had not been combined anyway.

At the beginning of Parse_File, fatals is already guaranteed to be 0, and
even if not, it would be wrong to just discard the fatal errors.

Revision 1.440 / (download) - annotate - [select for diffs], Sat Nov 14 16:09:08 2020 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.439: +9 -34 lines
Diff to previous 1.439 (colored)

make(1): clean up comment above ParseDoDependencyTargetSpecial

Revision 1.439 / (download) - annotate - [select for diffs], Sat Nov 14 15:58:01 2020 UTC (11 months ago) by rillig
Branch: MAIN
Changes since 1.438: +4 -4 lines
Diff to previous 1.438 (colored)

make(1): rename DEFAULT to defaultNode

In C, uppercase names are typically used for constants, and this is not
a constant.

Revision 1.438 / (download) - annotate - [select for diffs], Thu Nov 12 23:35:21 2020 UTC (11 months ago) by sjg
Branch: MAIN
Changes since 1.437: +3 -3 lines
Diff to previous 1.437 (colored)

Pass a writable flag to Main_SetObjdir to control writable check

For curdir and an explicit .OBJDIR target, we allow for
the directory to be read-only.
During InitObjdir we otherwise default to requiring objdir to be
writable - this can be controlled by env variable
MAKE_OBJDIR_CHECK_WRITABLE

Add unit-tests/objdir-writable

Reviewed by: christos rillig

Revision 1.437 / (download) - annotate - [select for diffs], Sun Nov 8 23:38:02 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.436: +4 -4 lines
Diff to previous 1.436 (colored)

make(1): move lint option away from the debug flags

The lint option affects much more than a typical debug flag.  Not only
does it produce additional diagnostics, it also changes the control flow
and fixes the traditional error handling in a few places.

No functional change.

Revision 1.436 / (download) - annotate - [select for diffs], Sun Nov 8 19:53:11 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.435: +6 -6 lines
Diff to previous 1.435 (colored)

make(1): clean up code related to VarEvalFlags

Mention VARE_WANTRES before VARE_UNDEFERR since the latter depends on
the former.

In ApplyModifier_Assign, VARE_KEEP_DOLLAR doesn't have to be removed
from eflags since ParseModifierPart does this already.

In EvalUndefined, testing for VARE_WANTRES is redundant if VARE_UNDEFERR
is already set.

Revision 1.435 / (download) - annotate - [select for diffs], Sun Nov 8 16:58:33 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.434: +3 -3 lines
Diff to previous 1.434 (colored)

make(1): rename VARE_ASSIGN to VARE_KEEP_DOLLAR

The other flags in VarEvalFlags already describe their effects, not the
place where they are used.  It's more important to know the effect.

Only a single unit test had to be adjusted.  This probably means that
there are too few tests where the special effects of VARE_KEEP_DOLLAR
come into play.  It could also mean that the effects are so simple and
obvious that they don't need any debug log, but that's not the case.

Revision 1.434 / (download) - annotate - [select for diffs], Sun Nov 8 15:07:37 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.433: +5 -5 lines
Diff to previous 1.433 (colored)

make(1): use strict typing in conditions of the form !var

Revision 1.433 / (download) - annotate - [select for diffs], Sun Nov 8 02:37:22 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.432: +3 -3 lines
Diff to previous 1.432 (colored)

make(1): inline strncmp in Parse_IsVar

The usual compilers don't do this themselves.

Revision 1.432 / (download) - annotate - [select for diffs], Sat Nov 7 23:41:38 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.431: +35 -30 lines
Diff to previous 1.431 (colored)

make(1): replace strstr in ParseMaybeSubMake with optimized code

This code is called for each command that is parsed.  Calling strstr with
4 strings that all start with the same character is unnecessary work.
Therefore, replace strstr with manually optimized code.  Neither GCC
5.5.0 nor GCC 10 inlines strncmp like this, otherwise I would have used
that.

Change in behavior: previously, a${MAKE}b would not be considered to be a
sub-make command, which is probably correct but does not occur in
practice.  The check for non-alphanumeric characters around the found
string was probably meant only for the plain word "make".

Revision 1.431 / (download) - annotate - [select for diffs], Sat Nov 7 22:26:42 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.430: +2 -25 lines
Diff to previous 1.430 (colored)

make(1): remove redundant empty lines from parse.c

Revision 1.430 / (download) - annotate - [select for diffs], Sat Nov 7 22:25:19 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.429: +148 -148 lines
Diff to previous 1.429 (colored)

make(1): clean up parse.c

The generated code stays exactly the same.  The only changes will be the
line numbers of assertions.  To preserve them, the removed lines have
been filled up with comments and will be removed in the follow-up commit.

Revision 1.429 / (download) - annotate - [select for diffs], Sat Nov 7 10:44:53 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.428: +6 -10 lines
Diff to previous 1.428 (colored)

make(1): add pp_skip_hspace to skip horizontal whitespace during parsing

Revision 1.428 / (download) - annotate - [select for diffs], Sat Nov 7 10:16:19 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.427: +14 -14 lines
Diff to previous 1.427 (colored)

make(1): clean up code stylistically

* Replace character literal 0 with '\0'.
* Replace pointer literal 0 with NULL.
* Remove redundant parentheses.
* Parentheses in multi-line conditions are not redundant at the
  beginning of a line.
* Replace a few !ptr with ptr == NULL.
* Replace a few ptr with ptr != NULL.
* Replace (expr & mask) == 0 with !(expr & mask).
* Remove redundant braces for blocks in cases where the generated code
  stays the same.  (Assertions further down in the code would get
  different line numbers.)
* Rename parameters in CondParser_String to reflect the data flow.
* Replace #ifdef notdef with #if 0.

The generated code stays exactly the same, at least with GCC 5.5.0 on
NetBSD 8.0 amd64 using the default configuration.

Revision 1.427 / (download) - annotate - [select for diffs], Thu Nov 5 17:27:16 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.426: +4 -4 lines
Diff to previous 1.426 (colored)

make(1): remove redundant parentheses from sizeof operator

The parentheses are only needed if the argument is a type, not an
expression.

Revision 1.426 / (download) - annotate - [select for diffs], Wed Nov 4 13:31:58 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.425: +3 -3 lines
Diff to previous 1.425 (colored)

make(1): align comments on a few commonly used variables

Revision 1.425 / (download) - annotate - [select for diffs], Wed Nov 4 06:09:55 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.424: +3 -3 lines
Diff to previous 1.424 (colored)

make(1): fix indentation in parse.c

Revision 1.424 / (download) - annotate - [select for diffs], Wed Nov 4 04:49:32 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.423: +14 -5 lines
Diff to previous 1.423 (colored)

make(1): negate discardUndefined to preserveUndefined

Revision 1.423 / (download) - annotate - [select for diffs], Wed Nov 4 03:37:51 2020 UTC (11 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.422: +5 -16 lines
Diff to previous 1.422 (colored)

make(1): rename oldVars to discardUndefined

While here, moved all the documentation about this variable into a
single place.

Revision 1.422 / (download) - annotate - [select for diffs], Mon Nov 2 22:50:55 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.421: +4 -6 lines
Diff to previous 1.421 (colored)

make(1): fix undefined behavior in Parse_IsVar

Even though the pointer was out-of-bounds, a crash was unlikely in
practice, since typical C compilers don't check the pointers for invalid
values after each modification.  The memory it pointed to was not
accessed though.

Revision 1.421 / (download) - annotate - [select for diffs], Mon Nov 2 22:44:29 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.420: +4 -2 lines
Diff to previous 1.420 (colored)

make(1): document undefined behavior in Parse_IsVar

Sigh.  If only C could be compiled in strict mode that detects these
out-of-bounds memory accesses.

Revision 1.420 / (download) - annotate - [select for diffs], Sun Nov 1 00:24:57 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.419: +8 -2 lines
Diff to previous 1.419 (colored)

make(1): in lint mode, exit with error status on errors

Calling Parse_Error during parsing has always led to a nonzero exit
status.  Calling Parse_Error later, when expanding the shell commands,
has had no effect on the exit status.  Neither had calling Error.

To make make a reliable tool, it has to report errors as they occur.
Enable this strict behavior in lint mode for now.  Lint mode has to be
enabled explicitly, preserving the default behavior.

Revision 1.419 / (download) - annotate - [select for diffs], Sat Oct 31 23:44:42 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.418: +12 -13 lines
Diff to previous 1.418 (colored)

make(1): clean up StrContainsWord

Revision 1.418 / (download) - annotate - [select for diffs], Sat Oct 31 23:39:01 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.417: +41 -23 lines
Diff to previous 1.417 (colored)

make(1): fix out-of-bounds pointer in ParseTrackInput

Revision 1.417 / (download) - annotate - [select for diffs], Sat Oct 31 23:10:06 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.416: +7 -6 lines
Diff to previous 1.416 (colored)

make(1): improve local variable name in ParseTrackInput

By the way, the Address Sanitizer that ran over this code on 2015-11-26
didn't find the other out-of-bounds bug.  Most probably the Address
Sanitizer only detected obvious bugs in the actual test data, and there
was no test case in which .MAKE.MAKEFILES was shorter than the newly
added makefile.

Revision 1.416 / (download) - annotate - [select for diffs], Sat Oct 31 23:01:23 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.415: +3 -3 lines
Diff to previous 1.415 (colored)

make(1): fix off-by-one bug in ParseTrackInput (since 2015-11-26)

Revision 1.415 / (download) - annotate - [select for diffs], Sat Oct 31 21:52:56 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.414: +5 -5 lines
Diff to previous 1.414 (colored)

make(1): document local variable in parse.c more precisely

Revision 1.414 / (download) - annotate - [select for diffs], Sat Oct 31 09:47:27 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.413: +46 -36 lines
Diff to previous 1.413 (colored)

make(1): extract loadedfile_mmap from loadfile

Revision 1.413 / (download) - annotate - [select for diffs], Fri Oct 30 20:30:44 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.412: +4 -4 lines
Diff to previous 1.412 (colored)

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.

Revision 1.412 / (download) - annotate - [select for diffs], Fri Oct 30 15:39:17 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.411: +5 -5 lines
Diff to previous 1.411 (colored)

make(1): fix indentation in source code

Revision 1.411 / (download) - annotate - [select for diffs], Fri Oct 30 07:19:30 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.410: +11 -11 lines
Diff to previous 1.410 (colored)

make(1): rename VAR_CMD to VAR_CMDLINE

Since make has to do with both the command line and child commands, the
former name was confusing.

Revision 1.410 / (download) - annotate - [select for diffs], Thu Oct 29 20:37:47 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.409: +9 -15 lines
Diff to previous 1.409 (colored)

make(1): move comment from Parse_DoVar to Parse_IsVar

Revision 1.409 / (download) - annotate - [select for diffs], Wed Oct 28 03:21:25 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.408: +7 -7 lines
Diff to previous 1.408 (colored)

make(1): rename defIncPath to defSysIncPath

There are two variables, parseIncPath and sysIncPath, which made the
name defIncPath ambiguous.

Revision 1.408 / (download) - annotate - [select for diffs], Wed Oct 28 03:12:54 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.407: +39 -42 lines
Diff to previous 1.407 (colored)

make(1): merge curFile into includes

This makes GetActuallyIncludingFile simpler since it no longer needs the
special case for curFile.

The type of 'includes' has changed from Vector<IFile *> to
Vector<IFile>, to avoid a few extra memory allocations and because
Vector is easier to use with structs than with pointers (see
GetInclude).

Revision 1.407 / (download) - annotate - [select for diffs], Wed Oct 28 01:58:37 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.406: +10 -10 lines
Diff to previous 1.406 (colored)

make(1): rename predecessor to order_pred

The new name aligns nicely with the GNode field of the same name.

Revision 1.406 / (download) - annotate - [select for diffs], Wed Oct 28 01:51:36 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.405: +6 -6 lines
Diff to previous 1.405 (colored)

make(1): sort ParseSpecial alphabetically

Revision 1.405 / (download) - annotate - [select for diffs], Wed Oct 28 01:47:11 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.404: +2 -3 lines
Diff to previous 1.404 (colored)

make(1): remove unused, undocumented .NOEXPORT

Revision 1.404 / (download) - annotate - [select for diffs], Wed Oct 28 01:43:01 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.403: +130 -130 lines
Diff to previous 1.403 (colored)

make(1): rename ParseSpecial enum values consistently

The previous naming scheme was inconsistent in that dotError started
with a lowercase character and ExObjdir and ExPath had a distracting
prefix.

Revision 1.403 / (download) - annotate - [select for diffs], Wed Oct 28 00:44:39 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.402: +22 -17 lines
Diff to previous 1.402 (colored)

make(1): rename some fields of struct IFile

The initial "P_" of these field names didn't match anything else.  The
documentation was missing the purpose of the buffer.  The start of the
buffer is only needed to free it later, so reflect that in the variable
name.

Revision 1.402 / (download) - annotate - [select for diffs], Wed Oct 28 00:38:37 2020 UTC (11 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.401: +22 -36 lines
Diff to previous 1.401 (colored)

make(1): clean up API comment in parse.c

Revision 1.401 / (download) - annotate - [select for diffs], Mon Oct 26 21:34:10 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.400: +16 -14 lines
Diff to previous 1.400 (colored)

make(1): group the command line options and arguments

By having a single struct that holds all command line options and
arguments, it is easy to see in the code when such a command line
argument is modified.  It also cleans up the namespace since the command
line options don't follow a common naming style.  Having them in a
struct also means that there is a single place for putting the
documentation, not two as before.

The struct also suggests to extract the initialization code out of main,
which is still too large, having more than 400 lines of code and
covering far too many topics.

Revision 1.400 / (download) - annotate - [select for diffs], Sun Oct 25 13:06:12 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.399: +21 -12 lines
Diff to previous 1.399 (colored)

make(1): replace PtrVector with Vector, which can contain any type

Revision 1.399 / (download) - annotate - [select for diffs], Sun Oct 25 12:08:53 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.398: +9 -9 lines
Diff to previous 1.398 (colored)

make(1): rename type Vector to PtrVector

This allows the name Vector to be used for a more generic vector type,
which will be added soon.

Revision 1.398 / (download) - annotate - [select for diffs], Fri Oct 23 20:04:56 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.397: +6 -6 lines
Diff to previous 1.397 (colored)

make(1): convert error level for Parse_Error to an enum

Revision 1.397 / (download) - annotate - [select for diffs], Fri Oct 23 18:36:09 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.396: +6 -7 lines
Diff to previous 1.396 (colored)

make(1): negate OP_NOP and rename it to GNode_IsTarget

Revision 1.396 / (download) - annotate - [select for diffs], Thu Oct 22 05:50:02 2020 UTC (11 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.395: +3 -3 lines
Diff to previous 1.395 (colored)

make(1): remove redundant type casts

This mainly affects the void pointers in callback functions for lists.
These had been necessary once when the parameter type was still
ClientData instead of void pointer.

Revision 1.395 / (download) - annotate - [select for diffs], Tue Oct 20 22:50:55 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.394: +58 -66 lines
Diff to previous 1.394 (colored)

make(1): clean up parsing code for dependency lines

The variable names "line" and "cp" were not appropriate for some of the
functions where they point to a single word, not to the whole line.

The const parameters were only necessary during refactoring, to make
sure that no unintended aliasing happens between the local variables.
This kind of bugs has already happened a few times in the last months,
and it requires full test coverage of all edge cases, which is not
achieved yet.

In ParseErrorNoDependency, lstart was always the same as line.

Revision 1.394 / (download) - annotate - [select for diffs], Mon Oct 19 21:57:37 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.393: +3 -3 lines
Diff to previous 1.393 (colored)

make(1): inline simple Lst getters

The function call variant takes more screen space than the direct field
access.  Having an abstract API is usually a good idea, in this case of
simple read-only member access it makes the code more difficult to read.

LstNode_Set has been kept as a function since it is not a read-only
accessor function.

Revision 1.393 / (download) - annotate - [select for diffs], Mon Oct 19 20:55:30 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.392: +13 -10 lines
Diff to previous 1.392 (colored)

make(1): remove void pointers from ParseAddDir

Revision 1.392 / (download) - annotate - [select for diffs], Mon Oct 19 20:51:18 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.391: +16 -11 lines
Diff to previous 1.391 (colored)

make(1): remove void pointers from ParseClearPath

Revision 1.391 / (download) - annotate - [select for diffs], Sun Oct 18 20:46:42 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.390: +23 -20 lines
Diff to previous 1.390 (colored)

make(1): clean up and document VarAssign_Eval

In the previous commit, out_avalue_freeIt had been passed to
VarAssign_EvalSubst, which created a memory leak.  Other than that, the
code changes are purely cosmetic.

Revision 1.390 / (download) - annotate - [select for diffs], Sun Oct 18 20:29:50 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.389: +72 -53 lines
Diff to previous 1.389 (colored)

make(1): split VarAssign_Eval into smaller functions

Revision 1.389 / (download) - annotate - [select for diffs], Sun Oct 18 20:14:27 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.388: +26 -26 lines
Diff to previous 1.388 (colored)

make(1): remove redundant code for determining the assignment operator

Revision 1.388 / (download) - annotate - [select for diffs], Sun Oct 18 20:07:26 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.387: +47 -47 lines
Diff to previous 1.387 (colored)

make(1): move ParseVarassignOp further up

Revision 1.387 / (download) - annotate - [select for diffs], Sun Oct 18 19:11:35 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.386: +3 -3 lines
Diff to previous 1.386 (colored)

make(1): fix GCC warning about small buffer for cohort_num

Since unmade_cohorts is a signed number (the code contains an underflow
check), the result of the '%' operator could be negative and result in
"#-999999", which would overflow the buffer, truncating the last digit.

Revision 1.386 / (download) - annotate - [select for diffs], Sun Oct 18 17:19:54 2020 UTC (11 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.385: +3 -3 lines
Diff to previous 1.385 (colored)

make(1): add tags to enum types

This allows IDEs to offer better type information than "anonymous enum".

Revision 1.385 / (download) - annotate - [select for diffs], Sun Oct 18 13:02:10 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.384: +13 -13 lines
Diff to previous 1.384 (colored)

make(1): rename Lst_Init to Lst_New

For the other types such as HashTable and Buffer, the Init function does
not allocate the memory for the structure itself, it only fills it.

Revision 1.384 / (download) - annotate - [select for diffs], Sun Oct 18 08:58:29 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.383: +9 -10 lines
Diff to previous 1.383 (colored)

make(1): rename Stack to Vector

Both Var_Dump and GetActuallyIncludingFile access more than only the top
item of the stack, therefore it is more honest to rename the data type.

Revision 1.383 / (download) - annotate - [select for diffs], Sat Oct 17 21:32:30 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.382: +5 -15 lines
Diff to previous 1.382 (colored)

make(1): normalize initialization and cleanup of the modules

Revision 1.382 / (download) - annotate - [select for diffs], Sat Oct 17 21:21:37 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.381: +21 -29 lines
Diff to previous 1.381 (colored)

make(1): remove struct ParseLinkSrcArgs

Inlining Lst_ForEach removes the need for the void pointers and the
additional parameter struct.

Revision 1.381 / (download) - annotate - [select for diffs], Sat Oct 17 20:57:08 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.380: +44 -37 lines
Diff to previous 1.380 (colored)

make(1): extract ParseLine from Parse_File

Revision 1.380 / (download) - annotate - [select for diffs], Sat Oct 17 20:51:34 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.379: +41 -41 lines
Diff to previous 1.379 (colored)

make(1): extract FindSemicolon from ParseDependency

Revision 1.379 / (download) - annotate - [select for diffs], Sat Oct 17 20:37:38 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.378: +165 -140 lines
Diff to previous 1.378 (colored)

make(1): split Parse_File into smaller functions

Revision 1.378 / (download) - annotate - [select for diffs], Sat Oct 17 20:32:20 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.377: +2 -26 lines
Diff to previous 1.377 (colored)

make(1): remove dead and broken warning for novices

In non-POSIX mode (which can only be enabled by editing config.h),
having a shell command indented by spaces instead of tabs would generate
a warning, and then, contrary to the comment above the code, no command
would be added to the current targets, since *cp == '\0'.

This had been broken since parse.c 1.133 on 2007-02-24, therefore it
seems unnecessary to even try to fix this code.

Revision 1.377 / (download) - annotate - [select for diffs], Sat Oct 17 19:10:07 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.376: +16 -28 lines
Diff to previous 1.376 (colored)

make(1): clean up ParseMessage

Since there is no code path that would lead to the "invalid syntax"
message, it has been removed.

The switch statement for choosing the log level was overly bloated.

Revision 1.376 / (download) - annotate - [select for diffs], Sat Oct 17 18:58:26 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.375: +9 -17 lines
Diff to previous 1.375 (colored)

make(1): remove redundant macros from ParseEOF and Parse_File

Revision 1.375 / (download) - annotate - [select for diffs], Sat Oct 17 18:39:43 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.374: +17 -17 lines
Diff to previous 1.374 (colored)

make(1): fix stylistic issues in parse.c

Revision 1.374 / (download) - annotate - [select for diffs], Sat Oct 17 18:36:56 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.373: +60 -61 lines
Diff to previous 1.373 (colored)

make(1): normalize spacing in parse.c

Revision 1.373 / (download) - annotate - [select for diffs], Sat Oct 17 17:47:14 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.372: +37 -37 lines
Diff to previous 1.372 (colored)

make(1): fix indentation

Revision 1.372 / (download) - annotate - [select for diffs], Sat Oct 17 17:23:22 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.371: +6 -3 lines
Diff to previous 1.371 (colored)

make(1): document the purpose of targCmds

Revision 1.371 / (download) - annotate - [select for diffs], Sat Oct 17 17:16:54 2020 UTC (12 months ago) by rillig
Branch: MAIN
Changes since 1.370: +15 -22 lines
Diff to previous 1.370 (colored)

make(1): inline ParseHasCommands and ParseHasCommands

Revision 1.370 / (download) - annotate - [select for diffs], Mon Oct 5 22:15:45 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.369: +3 -3 lines
Diff to previous 1.369 (colored)

make(1): enable format string truncation warnings for parse.c

No node is ever going to have a million or more cohorts.  And even if
there were, this name is only used for printing informational messages.

Revision 1.369 / (download) - annotate - [select for diffs], Mon Oct 5 21:37:07 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.368: +9 -9 lines
Diff to previous 1.368 (colored)

make(1): prepare job.c, main.c, parse.c, suff.c for WARNS=6

In job.c, GCC 5 complains about the macro FILENO that it has type
unsigned int, which is then passed as the argument of dup2, which
expects a simple int.  Maybe this workaround from 1995 is not necessary
anymore, or maybe it is but can be restricted to the few affected
platforms.

This leaves meta.c and the filemon files to be converted.  I didn't do
them since they are not well covered by the unit tests.

Revision 1.368 / (download) - annotate - [select for diffs], Mon Oct 5 19:27:47 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.367: +833 -742 lines
Diff to previous 1.367 (colored)

make(1): revert previous commit

It had accidentally reverted all the work from the past few days.

Revision 1.367 / (download) - annotate - [select for diffs], Mon Oct 5 19:24:29 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.366: +734 -825 lines
Diff to previous 1.366 (colored)

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.

Revision 1.366 / (download) - annotate - [select for diffs], Mon Oct 5 16:54:41 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.365: +77 -61 lines
Diff to previous 1.365 (colored)

make(1): extract parsing of sources from ParseDoDependency

Revision 1.365 / (download) - annotate - [select for diffs], Mon Oct 5 16:45:03 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.364: +88 -66 lines
Diff to previous 1.364 (colored)

make(1): extract the target parsing from ParseDoDependency

Revision 1.364 / (download) - annotate - [select for diffs], Mon Oct 5 16:33:20 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.363: +366 -286 lines
Diff to previous 1.363 (colored)

make(1): split ParseDoDependency into several smaller functions

Revision 1.363 / (download) - annotate - [select for diffs], Mon Oct 5 15:43:32 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.362: +105 -108 lines
Diff to previous 1.362 (colored)

make(1): split ParseDoSrc into smaller functions

Revision 1.362 / (download) - annotate - [select for diffs], Sun Oct 4 21:53:28 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.361: +18 -21 lines
Diff to previous 1.361 (colored)

make(1): fix assignment to .CURDIR via the shell assignment operator

This is probably an edge case that nobody will ever stumble upon, since
.CURDIR is usually regarded as a read-only variable.

The other variable that is affected by this code path is .MAKE.EXPORTED,
and for this variable as well, it would be unusual to assign it a value
from a shell command.

Revision 1.361 / (download) - annotate - [select for diffs], Sun Oct 4 21:41:44 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.360: +8 -4 lines
Diff to previous 1.360 (colored)

make(1): rename local variable in VarAssign_Eval

The value to be freed is not always evalue.  In the case of VAR_SUBST,
it will be the output of the command, not the command itself.

Revision 1.360 / (download) - annotate - [select for diffs], Sun Oct 4 21:08:37 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.359: +16 -17 lines
Diff to previous 1.359 (colored)

make(1): hide some more implementation details from Parse_DoVar

Revision 1.359 / (download) - annotate - [select for diffs], Sun Oct 4 20:57:26 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.358: +13 -22 lines
Diff to previous 1.358 (colored)

make(1): clean up remaining details in variable assignment parser

Revision 1.358 / (download) - annotate - [select for diffs], Sun Oct 4 20:37:11 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.357: +21 -32 lines
Diff to previous 1.357 (colored)

make(1): clean up code for parsing ?= variable assignments

There is no need to handle the ?= operator in ParseVarassignOp already,
when all other operators are handled later.

Revision 1.357 / (download) - annotate - [select for diffs], Sun Oct 4 20:23:32 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.356: +35 -34 lines
Diff to previous 1.356 (colored)

make(1): clean up parsing of variable assignments

Revision 1.356 / (download) - annotate - [select for diffs], Sun Oct 4 19:36:32 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.355: +59 -85 lines
Diff to previous 1.355 (colored)

make(1): remove duplicate code for parsing a variable name

Revision 1.355 / (download) - annotate - [select for diffs], Sun Oct 4 19:21:13 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.354: +14 -28 lines
Diff to previous 1.354 (colored)

make(1): rename parameter of Parse_IsVar

Revision 1.354 / (download) - annotate - [select for diffs], Sun Oct 4 16:43:22 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.353: +129 -64 lines
Diff to previous 1.353 (colored)

make(1): split Parse_DoVar into manageable pieces

This makes it easier to eliminate duplicate code, for example in
Parse_IsVar and Parse_DoVar.

Revision 1.353 / (download) - annotate - [select for diffs], Sun Oct 4 14:40:13 2020 UTC (12 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.352: +57 -50 lines
Diff to previous 1.352 (colored)

make(1): don't modify the given line during Parse_DoVar

Placing null characters all over the line made the code hard to
understand.  The null characters were placed for top-level whitespace as
well as the operator.

Working with a read-only line makes it easier to inspect the parsing
state during debugging.

This change involves an additional bmake_malloc for each variable name.
This will be compensated later by extending the API of the Var module to
also accept a pair of pointers (start, end) as the variable name.

Revision 1.352 / (download) - annotate - [select for diffs], Sun Oct 4 13:24:59 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.351: +56 -64 lines
Diff to previous 1.351 (colored)

make(1): clean up local variables in Parse_DoVar

The variable "line" was misnamed since it turned from the beginning of
the line to the variable name.  The variable "cp" was named too broadly.
Having two moving pointers in a single parsing function was too much.

Now p is the only moving pointer.  From it, the variable name and value
are extracted as the pointer flies by.  These more specific names make
the lower half of the function more readable since Var_Set(name, value)
sounds more correct and to the point than Var_Set(line, cp).

Memory management for the possibly expanded variable value is now
simpler as there may or may not be an expanded value, and that is freed
in every case.  No need for another Boolean variable called freeCp
anymore.  Distinguishing between the unexpanded value and the actual
value highlights the data flow.

Using const pointers is a step into the direction of having a parser
that operates on a read-only string.  Right now the string is destroyed
upon parsing.

Revision 1.351 / (download) - annotate - [select for diffs], Sun Oct 4 11:58:57 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.350: +3 -3 lines
Diff to previous 1.350 (colored)

make(1): fix out-of-bounds memory access in Parse_DoVar

When a line starts with "=value", this is interpreted as a variable
assignment, with an empty variable name.  In that case, there is no
"previous character" from the '='.  Accessing that character therefore
was an out-of-bounds read access.

If a whole file starts with "=value", instead of just a single line,
this out-of-bounds access can actually lead to a segmentation fault.
This depends on the memory allocator though.

Revision 1.350 / (download) - annotate - [select for diffs], Sun Oct 4 10:35:25 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.349: +5 -4 lines
Diff to previous 1.349 (colored)

make(1): only use the VARE_ASSIGN flag if necessary

When checking the right-hand side of a variable assignment for syntax
errors, it does not matter  whether a '$$' is expanded to '$' or kept as
'$$'.

Revision 1.349 / (download) - annotate - [select for diffs], Sun Oct 4 07:49:45 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.348: +7 -5 lines
Diff to previous 1.348 (colored)

make(1): fix parsing of the :sh assignment operator modifier

Revision 1.348 / (download) - annotate - [select for diffs], Sat Oct 3 21:52:50 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.347: +2 -3 lines
Diff to previous 1.347 (colored)

make(1): clean up #include sections

Revision 1.347 / (download) - annotate - [select for diffs], Sat Oct 3 21:43:41 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.346: +7 -12 lines
Diff to previous 1.346 (colored)

make(1): remove dead store in ParseGetLine

GCC 5 didn't dare to optimize this by itself.

Revision 1.346 / (download) - annotate - [select for diffs], Sat Oct 3 21:23:42 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.345: +4 -8 lines
Diff to previous 1.345 (colored)

make(1): inline macro ISEQOPERATOR

The name of the macro was wrong.  These characters are not used in an
equality operator, it's an assignment operator.

Revision 1.345 / (download) - annotate - [select for diffs], Sat Oct 3 21:19:54 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.344: +19 -41 lines
Diff to previous 1.344 (colored)

make(1): use consistent pattern for parsing whitespace

The pp and cpp in the function names stand for "parsing position" and
"const parsing position".

Revision 1.344 / (download) - annotate - [select for diffs], Thu Oct 1 23:44:36 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.343: +3 -3 lines
Diff to previous 1.343 (colored)

make(1): add missing const for Parse_AddIncludeDir

Revision 1.343 / (download) - annotate - [select for diffs], Mon Sep 28 23:13:57 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.342: +5 -5 lines
Diff to previous 1.342 (colored)

make(1): replace += 1 with ++ and -= 1 with --

Just for visual consistency.  The generated code stays exactly the same.

Revision 1.342 / (download) - annotate - [select for diffs], Mon Sep 28 22:23:35 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.341: +10 -9 lines
Diff to previous 1.341 (colored)

make(1): make debug logging simpler

This avoids referring to the debug_file variable in many places where
this implementation detail is not necessary.

Revision 1.341 / (download) - annotate - [select for diffs], Mon Sep 28 20:46:11 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.340: +10 -17 lines
Diff to previous 1.340 (colored)

make(1): make debugging code shorter

Revision 1.340 / (download) - annotate - [select for diffs], Mon Sep 28 02:06:27 2020 UTC (12 months, 2 weeks ago) by sjg
Branch: MAIN
Changes since 1.339: +2 -4 lines
Diff to previous 1.339 (colored)

Remove unnecessary dieQuietly calls

Revision 1.339 / (download) - annotate - [select for diffs], Mon Sep 28 01:24:34 2020 UTC (12 months, 2 weeks ago) by sjg
Branch: MAIN
Changes since 1.338: +6 -3 lines
Diff to previous 1.338 (colored)

Ensure that parse errors report 'stopped in'

Revision 1.338 / (download) - annotate - [select for diffs], Sun Sep 27 21:35:16 2020 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.337: +135 -134 lines
Diff to previous 1.337 (colored)

make(1): normalize whitespace in source code

There is no more space tab.  Either only tabs or only spaces or tabs
followed by spaces, but not spaces followed by tabs.

Revision 1.337 / (download) - annotate - [select for diffs], Sun Sep 27 12:42:09 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.336: +18 -31 lines
Diff to previous 1.336 (colored)

make(1): inline Lst_ForEachUntil when parsing dependency lines

This avoids a few operations on void pointers.

Revision 1.336 / (download) - annotate - [select for diffs], Sun Sep 27 12:26:23 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.335: +13 -16 lines
Diff to previous 1.335 (colored)

make(1): remove redundant null checks for the active targets

Before August 2020, the Lst library passed null pointers through.  This
was a confusing design pattern that has been removed since.  Now the Lst
functions fail fast on null pointers.

The 'targets' list is one of the few places where there is indeed an
optional list that may sometimes be null.  Back then, there was not
enough inline documentation to understand when the targets list was null
and when it wasn't.

Now that the documentation is there, the redundant and thereby
misleading null checks are no longer useful.

Revision 1.335 / (download) - annotate - [select for diffs], Sun Sep 27 12:05:04 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.334: +22 -38 lines
Diff to previous 1.334 (colored)

make(1): inline Lst_ForEachUntil in ParseDoDependency

Revision 1.334 / (download) - annotate - [select for diffs], Sat Sep 26 17:39:45 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.333: +3 -0 lines
Diff to previous 1.333 (colored)

make(1): revert migration from Lst_ForEachUntil to Lst_ForEach

There is a crucial difference between these functions, in that
Lst_ForEachUntil can cope with a few concurrent modifications while
iterating over the list.  This is something that Lst_ForEach doesn't do.

This difference led to a crash very early in NetBSD's build.sh.

Revision 1.333 / (download) - annotate - [select for diffs], Sat Sep 26 16:55:58 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.332: +2 -5 lines
Diff to previous 1.332 (colored)

make(1): replace a few Lst_ForEachUntil with simpler Lst_ForEach

Revision 1.332 / (download) - annotate - [select for diffs], Sat Sep 26 16:00:12 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.331: +8 -8 lines
Diff to previous 1.331 (colored)

make(1): clean up API for finding and creating GNodes

The previous API had complicated rules for the cases in which the single
function returned NULL or what it did.  The flags for that function were
confusing since passing TARG_NOHASH would create a new node even though
TARG_CREATE was not included in that bit mask.

Splitting the function into 3 separate functions avoids this confusion.
It also reveals several places where the complicated API led to
unreachable code.  Such code has been removed.

Revision 1.331 / (download) - annotate - [select for diffs], Sat Sep 26 00:03:29 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.330: +12 -43 lines
Diff to previous 1.330 (colored)

make(1): replace a few Lst_ForEachUntil with simpler Lst_ForEach

Revision 1.330 / (download) - annotate - [select for diffs], Fri Sep 25 23:39:51 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.329: +11 -21 lines
Diff to previous 1.329 (colored)

make(1): remove redundant variable inLine from parse.c

This variable has served at least 27 years bringing unnecessary
redundancy to the code.  It was already redundant at 1993-03-21, when
the code was imported to NetBSD.

Revision 1.329 / (download) - annotate - [select for diffs], Fri Sep 25 23:35:25 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.328: +6 -19 lines
Diff to previous 1.328 (colored)

make(1): rename ParseFinishLine to FinishDependencyGroup

Even after 27 or more years, it's not too late to fix bad function
names.  This one for example does not finish a line but a dependency
group.

Revision 1.328 / (download) - annotate - [select for diffs], Fri Sep 25 23:30:16 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.327: +4 -2 lines
Diff to previous 1.327 (colored)

make(1): fix missing check for duplicate commands in Parse_File

Revision 1.327 / (download) - annotate - [select for diffs], Fri Sep 25 21:13:44 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.326: +28 -38 lines
Diff to previous 1.326 (colored)

make(1): inline Lst_ForEachUntil in ParseLine_ShellCommand

Revision 1.326 / (download) - annotate - [select for diffs], Fri Sep 25 20:57:22 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.325: +26 -23 lines
Diff to previous 1.325 (colored)

make(1): extract ParseLine_ShellCommand from Parse_File

Parsing a single shell command from a line does not belong in
Parse_File, its proper place is in Parse_Line.  Having the whole
detailed code inline in Parse_File is even more confusing.

Revision 1.325 / (download) - annotate - [select for diffs], Fri Sep 25 20:48:23 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.324: +13 -11 lines
Diff to previous 1.324 (colored)

make(1): rename variables cp2 to be more expressive

Revision 1.324 / (download) - annotate - [select for diffs], Thu Sep 24 07:11:29 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.323: +15 -15 lines
Diff to previous 1.323 (colored)

make(1): rename Lst_ForEach to Lst_ForEachUntil

Since the callback function returns a terminating condition, this is not
really a foreach loop.

Many of the calls to Lst_ForEachUntil don't make use of the terminating
condition, and several don't modify the list structurally, which means
they don't need this complicated implementation.

In a follow-up commit, Lst_ForEach will be added back with a much
simpler implementation that iterates over the list naively, without a
terminating condition and without taking the iteration state from
Lst_Open/Lst_Next/Lst_Close into account.  The migration to this simpler
implementation will be done step by step since each callback function
needs to be examined closely.

Revision 1.323 / (download) - annotate - [select for diffs], Tue Sep 22 20:19:46 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.322: +19 -10 lines
Diff to previous 1.322 (colored)

make(1): prepare Var_Subst for proper error handling

Returning a VarParseResult instead of a string makes it possible to let
the error bubble up, until it reaches the main expression.

Revision 1.322 / (download) - annotate - [select for diffs], Tue Sep 22 04:05:41 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.321: +19 -18 lines
Diff to previous 1.321 (colored)

make(1): use fine-grained type names for lists and their nodes

This is only intended to help the human reader.  There is no additional
type safety yet.

Revision 1.321 / (download) - annotate - [select for diffs], Tue Sep 22 02:26:22 2020 UTC (12 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.320: +4 -4 lines
Diff to previous 1.320 (colored)

make(1): rename type Path to CachedDir

The word "path" is commonly used either as an abbreviation for pathname
(a string consisting of several directory or file names) or as an
abbreviation for search path (a list of directory names used for
searching files), but not for a single directory.

Revision 1.320 / (download) - annotate - [select for diffs], Mon Sep 14 21:23:58 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.319: +35 -5 lines
Diff to previous 1.319 (colored)

make(1): in lint mode, allow undefined variables in dependency lines

This is needed to get past the first few seconds in a src/build.sh run.

The nest obstacle is src/tools/Makefile.gnuhost:30, where the variable
MODULE is undefined even though that file says in line 3 that MODULE is
expected to be set.  It has been saying this since 2001, but since make
didn't have the corresponding check enabled, this didn't break the
build.

Revision 1.319 / (download) - annotate - [select for diffs], Mon Sep 14 19:59:47 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.318: +42 -5 lines
Diff to previous 1.318 (colored)

make(1): describe how Parse_Error might print stack traces

In deeply nested include chains and .for loops this may be a useful
feature.  It's a little tricky to generate an intuitive stack trace,
though not impossible.  This explanation also serves as a detailed
documentation about how the .include and .for directives are
implemented.

Revision 1.318 / (download) - annotate - [select for diffs], Mon Sep 14 18:21:26 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.317: +6 -4 lines
Diff to previous 1.317 (colored)

make(1): add test for the global variable 'targets' in parse.c

Revision 1.317 / (download) - annotate - [select for diffs], Mon Sep 14 17:47:05 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.316: +3 -3 lines
Diff to previous 1.316 (colored)

make(1): fix documentation of ParseLinkSrcArgs.specType

That code is never called for .SUFFIXES, but for .END.

Revision 1.316 / (download) - annotate - [select for diffs], Mon Sep 14 17:44:57 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.315: +18 -26 lines
Diff to previous 1.315 (colored)

make(1): clean up documentation and code of ParseLinkSrc

The previous documentation was focused on the implementation details,
which are already clear from the code.  Add some high-level
documentation to help readers understand how this function fits into the
overall picture.

Revision 1.315 / (download) - annotate - [select for diffs], Mon Sep 14 16:59:41 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.314: +29 -21 lines
Diff to previous 1.314 (colored)

make(1): eliminate the global variable specType

This variable didn't have an intended lifetype of "whole application",
therefore it is better implemented as a local variable that is passed
around the few functions that really need it.  It's the same pattern as
in the ModifyWord functions in var.c, only this time without a typedef.

Revision 1.314 / (download) - annotate - [select for diffs], Mon Sep 14 16:40:06 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.313: +38 -27 lines
Diff to previous 1.313 (colored)

make(1): extract ParseDependencyTargetWord from ParseDoDependency

Revision 1.313 / (download) - annotate - [select for diffs], Mon Sep 14 16:33:07 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.312: +13 -15 lines
Diff to previous 1.312 (colored)

make(1): split "general GNode *" in ParseDoDepends

Revision 1.312 / (download) - annotate - [select for diffs], Mon Sep 14 16:27:07 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.311: +3 -3 lines
Diff to previous 1.311 (colored)

make(1): fix type of parseKeywords.op

Revision 1.311 / (download) - annotate - [select for diffs], Mon Sep 14 16:23:32 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.310: +32 -27 lines
Diff to previous 1.310 (colored)

make(1): extract some code out of ParseDoDependency

With its almost 600 lines, that function is way too long.

Revision 1.310 / (download) - annotate - [select for diffs], Mon Sep 14 16:16:52 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.309: +7 -15 lines
Diff to previous 1.309 (colored)

make(1): inline LPAREN in parse.c

It's shorter and more readable, and the other characters don't have
named constants as well.

Revision 1.309 / (download) - annotate - [select for diffs], Mon Sep 14 16:12:41 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.308: +6 -5 lines
Diff to previous 1.308 (colored)

make(1): flip conditions in ParseDoDependency

In the usual case where the character is a letter or another ordinary
character, each of the terminal conditions has to be evaluated,
therefore from the compiler's view the order doesn't matter.  For
humans, "a unless b" is easier to grasp and more common than "not b but
a", therefore switch to the common pattern.

Revision 1.308 / (download) - annotate - [select for diffs], Mon Sep 14 16:05:09 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.307: +7 -5 lines
Diff to previous 1.307 (colored)

make(1): split complicated condition in ParseDoDependency

Revision 1.307 / (download) - annotate - [select for diffs], Mon Sep 14 15:11:13 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.306: +8 -5 lines
Diff to previous 1.306 (colored)

make(1): split confusing condition in ParseDoDependency

A while loop is easier to understand than a do-while loop.

An if statement of the form if-something-then-do-something is easier to
understand than if-complicated-condition-then-continue-doing-something.

Revision 1.306 / (download) - annotate - [select for diffs], Mon Sep 14 14:58:27 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.305: +16 -28 lines
Diff to previous 1.305 (colored)

make(1): clean up documentation of ParseDoDependency

The documentation was too low-level in parts, essentially repeating the
code in prose.  Instead, add more examples and high-level context
information since that is something that the code cannot do.

Revision 1.305 / (download) - annotate - [select for diffs], Sun Sep 13 21:12:08 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.304: +13 -13 lines
Diff to previous 1.304 (colored)

make(1): rename local variables in PrintLocation

For PrintLocation, there is no "current" filename or line number,
therefore the "c" in the variable names was confusing.

Revision 1.304 / (download) - annotate - [select for diffs], Sun Sep 13 18:27:39 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.303: +6 -4 lines
Diff to previous 1.303 (colored)

make(1): prepare Var_Parse for proper error handling and reporting

Right now, Var_Parse swallows many errors during parsing and evaluation.
Ideally, these errors should propagate from the deeply nested
expressions where they occur up to the top-level expressions.  When such
an error occurs, the depending expressions should not be evaluated any
further.  They may still be parsed, but side effects should be
minimized.

The goal is to prevent incomplete expressions like the "xy}" in
moderrs.exp:106 from being evaluated and eventually passed to the shell
for execution.  This expression is a left-over from a parse error in the
mod-t-parse target in moderrs.mk:154.

This commit is a first step in analyzing and verifying the current state
of affairs. The modelling in VarParseErrors already looks complicated
but is expected to closely match reality.

Revision 1.303 / (download) - annotate - [select for diffs], Sun Sep 13 15:15:51 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.302: +4 -14 lines
Diff to previous 1.302 (colored)

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.

Revision 1.302 / (download) - annotate - [select for diffs], Sun Sep 13 13:50:27 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.301: +5 -5 lines
Diff to previous 1.301 (colored)

make(1): clean up API for evaluating conditions

There was no need to make struct If publicly visible.

There was no need to have parameters in the public API that were passed
the same constants all the time.

The former function names had not been distinctive.

Revision 1.301 / (download) - annotate - [select for diffs], Sun Sep 13 13:25:07 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.300: +7 -19 lines
Diff to previous 1.300 (colored)

make(1): clean up comments for ParseErrorInternal and ParseMessage

Revision 1.300 / (download) - annotate - [select for diffs], Sun Sep 13 13:22:29 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.299: +9 -14 lines
Diff to previous 1.299 (colored)

make(1): fix comment for ParseVErrorInternal

Revision 1.299 / (download) - annotate - [select for diffs], Sun Sep 13 13:17:44 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.298: +26 -31 lines
Diff to previous 1.298 (colored)

make(1): reduce complexity of PrintLocation

Analyzing a printf statement that is split into several small pieces is
harder than necessary in this case.  Joing the printf statements into
simple strings.  While here, remove the needless casts to int and add a
few empty lines for visual guidance.

Revision 1.298 / (download) - annotate - [select for diffs], Sun Sep 13 09:43:01 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.297: +8 -11 lines
Diff to previous 1.297 (colored)

make(1): inline strchr call in IsInclude

Revision 1.297 / (download) - annotate - [select for diffs], Sun Sep 13 09:25:52 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.296: +7 -20 lines
Diff to previous 1.296 (colored)

make(1): clean up the documentation for Parse_File

Revision 1.296 / (download) - annotate - [select for diffs], Sun Sep 13 06:05:56 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.295: +3 -6 lines
Diff to previous 1.295 (colored)

make(1): remove redundant VARARGS comments

These had been necessary at a time when the functions were declared with
"unknown parameter types".

On 1994-03-05, conditional support for function prototypes was added,
for those compilers that already supported this feature.

On 2002-06-15, the prototypes were made mandatory, and since then the
VARARGS comments had been completely redundant, or worse, simply wrong
(for ParseVErrorInternal).

Revision 1.295 / (download) - annotate - [select for diffs], Sat Sep 12 19:41:20 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.294: +4 -4 lines
Diff to previous 1.294 (colored)

make(1): reword variable invocation to variable expression

Variables are a passive thing.  They cannot be invoked, they can only be
evaluated.

Revision 1.294 / (download) - annotate - [select for diffs], Sat Sep 12 18:19:50 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.293: +5 -5 lines
Diff to previous 1.293 (colored)

make(1): rename Var_ParsePP back to Var_Parse

The migration to the "parsing position" pointer has been done.

Revision 1.293 / (download) - annotate - [select for diffs], Sat Sep 12 15:21:25 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.292: +11 -4 lines
Diff to previous 1.292 (colored)

make(1): fix prototype of Suff_EndTransform

Revision 1.292 / (download) - annotate - [select for diffs], Sat Sep 12 14:41:00 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.291: +5 -5 lines
Diff to previous 1.291 (colored)

make(1): fix inconsistent code indentation

Revision 1.291 / (download) - annotate - [select for diffs], Sat Sep 12 11:21:15 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.290: +42 -36 lines
Diff to previous 1.290 (colored)

make(1): split ParseVErrorInternal into 2 functions

Revision 1.290 / (download) - annotate - [select for diffs], Fri Sep 11 17:32:36 2020 UTC (13 months ago) by rillig
Branch: MAIN
Changes since 1.289: +36 -38 lines
Diff to previous 1.289 (colored)

make(1): add wrappers around ctype.h functions

This avoids casting the argument to unsigned char, and to cast the
result of toupper/tolower back to char.

Revision 1.289 / (download) - annotate - [select for diffs], Tue Sep 8 05:26:21 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.288: +6 -13 lines
Diff to previous 1.288 (colored)

make(1): fix off-by-one error in SuffExpandChildren

In suff.c r1.144 from yesterday, in the line "cp += nested_p - cp", I
accidentally removed the "- 1".  Since these "- 1" lines lead to slow
execution, each branch now increments the pointer separately by the
actually needed amount.

Fixing this bug posed way more new questions than it answered, and it
revealed an inconsistency in the parser about how characters are to be
escaped, and missing details in the documentation of Var_Parse, as well
as a parse error that unexpectedly doesn't stop make from continuing.

Revision 1.288 / (download) - annotate - [select for diffs], Mon Sep 7 18:37:09 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.287: +6 -5 lines
Diff to previous 1.287 (colored)

make(1): with -dp, print name of the function instead of its address

This makes the output a bit more reproducible.  There are still the file
descriptors, which may differ between different runs, but at least the
nextbuf function is printed using a symbolic name instead of a meaningless address.
Besides loadedfile_nextbuf, the only other function is ForIterate.

Revision 1.287 / (download) - annotate - [select for diffs], Mon Sep 7 06:58:02 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.286: +10 -10 lines
Diff to previous 1.286 (colored)

make(1): migrate Var_Parse to Var_ParsePP in ParseDoDependency

Revision 1.286 / (download) - annotate - [select for diffs], Sun Sep 6 19:34:36 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.285: +4 -4 lines
Diff to previous 1.285 (colored)

make(1): add const for Parse_IsVar

Revision 1.285 / (download) - annotate - [select for diffs], Sat Sep 5 19:11:16 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.284: +4 -6 lines
Diff to previous 1.284 (colored)

make(1): replay the changes from v1.283

I accidentally reverted them in v1.284.

Revision 1.284 / (download) - annotate - [select for diffs], Sat Sep 5 19:07:25 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.283: +30 -139 lines
Diff to previous 1.283 (colored)

make(1): clean up comments about parsing

Revision 1.283 / (download) - annotate - [select for diffs], Sat Sep 5 18:41:59 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.282: +5 -9 lines
Diff to previous 1.282 (colored)

make(1): fix comments about setting .PARSEDIR and .PARSEFILE

Revision 1.282 / (download) - annotate - [select for diffs], Sat Sep 5 18:31:03 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.281: +8 -9 lines
Diff to previous 1.281 (colored)

make(1): make GetActuallyIncludingFile faster

In deeply nested includes, starting the search from the inner end is
faster since it needs fewer comparisons.

Revision 1.281 / (download) - annotate - [select for diffs], Sat Sep 5 18:18:05 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.280: +60 -66 lines
Diff to previous 1.280 (colored)

make(1): fix .INCLUDEDFROMDIR/.INCLUDEDFROMFILE

Revision 1.280 / (download) - annotate - [select for diffs], Sat Sep 5 15:12:03 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.279: +4 -7 lines
Diff to previous 1.279 (colored)

make(1): fix local variable type in ParseIsEscaped

Revision 1.279 / (download) - annotate - [select for diffs], Sat Sep 5 15:05:08 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.278: +5 -17 lines
Diff to previous 1.278 (colored)

make(1): fix return type of ParseIsEscaped

Revision 1.278 / (download) - annotate - [select for diffs], Sat Sep 5 15:04:09 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.277: +12 -21 lines
Diff to previous 1.277 (colored)

make(1): remove redundant prototype for ParseMark

Revision 1.277 / (download) - annotate - [select for diffs], Sat Sep 5 14:58:07 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.276: +3 -26 lines
Diff to previous 1.276 (colored)

make(1): remove redundant prototypes for local functions from parse.c

Revision 1.276 / (download) - annotate - [select for diffs], Fri Sep 4 17:59:36 2020 UTC (13 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.275: +15 -22 lines
Diff to previous 1.275 (colored)

make(1): use a stack instead of a list for the nested include path

By using a Stack instead of a Lst, the available API is reduced to the
very few functions that are really needed for a stack.  This prevents
accidental misuse (such as confusing Lst_Append with Lst_Prepend) and
clearly communicates what the expected behavior is.

A stack also needs fewer calls to bmake_malloc than an equally-sized
list, and the memory is contiguous.  For the nested include path, all
this doesn't matter, but the type is so generic that it may be used in
other places as well.

Revision 1.275 / (download) - annotate - [select for diffs], Tue Sep 1 17:38:26 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.274: +3 -5 lines
Diff to previous 1.274 (colored)

make(1): clean up documentation in buf.h, and redundant include files

Revision 1.274 / (download) - annotate - [select for diffs], Sun Aug 30 11:15:05 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.273: +5 -5 lines
Diff to previous 1.273 (colored)

make(1): rename Lst_Datum to LstNode_Datum

Revision 1.273 / (download) - annotate - [select for diffs], Sat Aug 29 13:38:48 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.272: +4 -4 lines
Diff to previous 1.272 (colored)

make(1): trust that Var_Parse never returns NULL

That function is quite long, but all its return paths lead either to the
expanded variable expression, or to var_Error or varNoError.

Revision 1.272 / (download) - annotate - [select for diffs], Sat Aug 29 12:20:17 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.271: +12 -12 lines
Diff to previous 1.271 (colored)

make(1): remove ReturnStatus, SUCCESS and FAILURE

These are used in so few places now that it is easier to use a simple
Boolean for them.

Revision 1.271 / (download) - annotate - [select for diffs], Sat Aug 29 11:24:54 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.270: +4 -4 lines
Diff to previous 1.270 (colored)

make(1): add bmake_strsedup for duplicating a substring

Revision 1.270 / (download) - annotate - [select for diffs], Sat Aug 29 11:13:43 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.269: +5 -9 lines
Diff to previous 1.269 (colored)

make(1): merge duplicate code for bmake_strldup

Revision 1.269 / (download) - annotate - [select for diffs], Sat Aug 29 07:52:55 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.268: +4 -4 lines
Diff to previous 1.268 (colored)

make(1): allow for strict type checking for Boolean

Having Boolean aliased to int creates ambiguities since int is widely
used.  Allow to occasionally compile make with -DUSE_DOUBLE_BOOLEAN to
check that the type definitions still agree.

Revision 1.268 / (download) - annotate - [select for diffs], Fri Aug 28 04:48:57 2020 UTC (13 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.267: +59 -59 lines
Diff to previous 1.267 (colored)

make(1): remove trailing 'S' from names of Lst functions

The migration from null-passing Lst functions to argument-checking Lst
functions is completed.

There were 2 surprises: The targets list may be NULL, and in Dir_AddDir,
the path may be NULL.  The latter case is especially surprising since
that function turns into an almost-nop in that case.  This is another
case where probably 2 independent functions have been squeezed into a
single function.  This may be improved in a follow-up commit.

All other lists were fine.  They were always defined and thus didn't
need much work.

Revision 1.267 / (download) - annotate - [select for diffs], Thu Aug 27 19:15:35 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.266: +12 -12 lines
Diff to previous 1.266 (colored)

make(1): migrate Lst_IsEmpty to Lst_IsEmptyS

Revision 1.266 / (download) - annotate - [select for diffs], Thu Aug 27 07:03:48 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.265: +4 -4 lines
Diff to previous 1.265 (colored)

make(1): migrate Lst_Last to Lst_LastS

Revision 1.265 / (download) - annotate - [select for diffs], Thu Aug 27 06:53:57 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.264: +19 -13 lines
Diff to previous 1.264 (colored)

make(1): migrate Lst_ForEach to Lst_ForEachS

Most lists are always valid.  Only the "targets" variable may be null in
some cases, probably.

Revision 1.264 / (download) - annotate - [select for diffs], Thu Aug 27 06:13:53 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.263: +5 -5 lines
Diff to previous 1.263 (colored)

make(1): convert Arch_ParseArchive from ReturnStatus to Boolean

There are only few functions left that use the ReturnStatus.  These will
be converted as well, to get rid of the additional typedef.

Revision 1.263 / (download) - annotate - [select for diffs], Wed Aug 26 22:55:46 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.262: +24 -22 lines
Diff to previous 1.262 (colored)

make(1): add stricter variants for remaining Lst functions

In most cases the Lst functions are only called when the arguments are
indeed valid.  It's not guaranteed though, therefore each function call
needs to be analyzed and converted individually.

While here, remove a few statements that were only useful when the Lst
functions handled circular lists.

Revision 1.262 / (download) - annotate - [select for diffs], Tue Aug 25 16:50:02 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.261: +4 -4 lines
Diff to previous 1.261 (colored)

make(1): fix obvious bugs in -DCLEANUP mode

The outdated type name FreeProc had been renamed to LstFreeProc.
Casting the function free to it is not necessary since the type of this
function is already exactly the correct type.  Anything else would be
undefined behavior anyway.

The uninitialized sufflist in Suff_ClearSuffixes was ok until now
because the Lst functions had silently skipped any calls with invalid
arguments.  This silent skipping is a good argument to have strict
argument validation since it detects these unintended control flows.

Revision 1.261 / (download) - annotate - [select for diffs], Sat Aug 22 22:41:42 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.260: +4 -4 lines
Diff to previous 1.260 (colored)

make(1): make moving and copying lists simpler

Instead of the two-in-one Lst_Concat, having two separate functions is
easier to understand.  There is no need for a long API comment anymore
since the new functions have a single purpose that is accurately
described by their name.

The long comment inside Lst_Concat has been removed since it only
repeated the exact code, only in more words.

The comments in make.c about appending the cohorts had been wrong.  They
were not appended but prepended.  Once more, the function name expresses
everything that the comment said, making the comment redundant.  There
is no need to test whether the cohorts list is empty, doing nothing is
implied by the word All in Lst_PrependAllS.

Revision 1.260 / (download) - annotate - [select for diffs], Sat Aug 22 21:42:38 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.259: +3 -5 lines
Diff to previous 1.259 (colored)

make(1): clean up headers

Remove redundant headers that are already included by "make.h".
Make <assert.h> available to all compilation units that use "make.h".

Revision 1.259 / (download) - annotate - [select for diffs], Sat Aug 22 21:12:29 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.258: +4 -4 lines
Diff to previous 1.258 (colored)

make(1): fix undefined behavior when assigning to variable ""

Using a programming language with built-in array bounds checks would
have prevented this bug, and many others as well.

Revision 1.258 / (download) - annotate - [select for diffs], Sat Aug 22 17:34:25 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.257: +4 -4 lines
Diff to previous 1.257 (colored)

make(1): fix indentation

Revision 1.257 / (download) - annotate - [select for diffs], Sat Aug 22 15:17:09 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.256: +7 -7 lines
Diff to previous 1.256 (colored)

make(1): replace Lst_Datum with non-null guaranteeing Lst_DatumS

Revision 1.256 / (download) - annotate - [select for diffs], Sat Aug 22 14:39:12 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.255: +9 -9 lines
Diff to previous 1.255 (colored)

make(1): convert Lst_Enqueue and Lst_Dequeue to nonnull variants

Except for once instance in parse.c, the usage pattern for Lst_Dequeue
was to first test whether the list is empty.  This pattern allowed the
implementation of Lst_Dequeue to become simpler since the null check is
not needed anymore.

The calls to Lst_Enqueue never pass an invalid list or a null pointer,
therefore making them strict was trivial.

Revision 1.255 / (download) - annotate - [select for diffs], Sat Aug 22 13:44:17 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.254: +4 -4 lines
Diff to previous 1.254 (colored)

make(1): replace two instances of Lst_AtFront with Lst_Prepend

In these cases, the list is guaranteed to be valid, therefore no
assertion is expected.

For comparison, the Lst_AtFront in dir.c needs to be kept since the path
may be null there.

Revision 1.254 / (download) - annotate - [select for diffs], Sat Aug 22 13:28:20 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.253: +4 -4 lines
Diff to previous 1.253 (colored)

make(1): convert remaining Lst_AtEnd to the stricter Lst_Append

The general-purpose list library that is included in make allows to call
Lst_AtEnd for invalid lists, silently ignoring this programming error.
This is a flexibility that make doesn't need.

Another unneeded "feature" is that list items can theoretically be null
pointers.  This doesn't make sense as well and is therefore not needed
by make.

These programming errors are now caught early by assertions.

Revision 1.253 / (download) - annotate - [select for diffs], Sat Aug 22 11:35:00 2020 UTC (13 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.252: +19 -19 lines
Diff to previous 1.252 (colored)

make(1): replace "(void)Lst_AtEnd" with stricter "Lst_AppendS"

This change ensures that there is actually something added to the list.
Lst_AtEnd had silently skipped the addition if the list was invalid
(null pointer), which was not intended in these cases.  The "(void)" is
assumed to mean "I know that this cannot fail", while it could also mean
"I don't care whether something actually happened".

Running "./build.sh -j6 tools" still succeeds after this change,
therefore chances are very low that this change breaks anything.  If
there is any change, it's an obvious assertion failure.  There is no
silent change in behavior though.

Revision 1.252 / (download) - annotate - [select for diffs], Fri Aug 21 02:20:47 2020 UTC (13 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.251: +15 -15 lines
Diff to previous 1.251 (colored)

make(1): remove unused code for circular lists

The list library had probably been imported from a general-purpose
library that also supported circular lists.  These are not used by make
though.

After replacing Lst_Init(FALSE) with Lst_Init(), only a single call to
Lst_Init remained with a non-constant argument, and that was in
Lst_Concat, which was to be expected.

Revision 1.251 / (download) - annotate - [select for diffs], Mon Aug 10 19:53:19 2020 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.250: +4 -4 lines
Diff to previous 1.250 (colored)

make(1): replace str_concat with str_concat2 and str_concat3

The new functions have a simpler interface, and str_concat3 is even more
general-purpose, since the middle string is no longer required to be
exactly of length 1.

Revision 1.250 / (download) - annotate - [select for diffs], Sun Aug 9 13:05:04 2020 UTC (14 months, 1 week ago) by rillig
Branch: MAIN
Changes since 1.249: +5 -5 lines
Diff to previous 1.249 (colored)

make(1): improve type signature of Var_Export

Revision 1.249 / (download) - annotate - [select for diffs], Thu Aug 6 16:03:04 2020 UTC (14 months, 1 week ago) by sjg
Branch: MAIN
Changes since 1.248: +4 -4 lines
Diff to previous 1.248 (colored)

Remove VARE_WANTRES for LINT

We need the parsing checked.
I might make sense to add a VARE_LINT flag for corner cases.
Time will tell.

Reviewed by: rillig

Revision 1.248 / (download) - annotate - [select for diffs], Mon Aug 3 20:43:41 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.247: +13 -21 lines
Diff to previous 1.247 (colored)

make(1): replace end-of-line comments with block comments

Just in case someone wants to port the current NetBSD make to an ancient
compiler that knows only C90.

Revision 1.247 / (download) - annotate - [select for diffs], Mon Aug 3 20:26:09 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.246: +9 -8 lines
Diff to previous 1.246 (colored)

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.

Revision 1.246 / (download) - annotate - [select for diffs], Sat Aug 1 14:47:49 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.245: +9 -9 lines
Diff to previous 1.245 (colored)

make(1): use consistent indentation in source code

Tabs for multiples of 8, then spaces.

The usage string has been kept as-is since the spaces there are
indentional and do influence the output.

Revision 1.245 / (download) - annotate - [select for diffs], Sat Aug 1 09:55:00 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.244: +8 -8 lines
Diff to previous 1.244 (colored)

make(1): avoid calls to free(3) in the common case of a NULL pointer

Revision 1.244 / (download) - annotate - [select for diffs], Sat Aug 1 09:25:36 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.243: +13 -17 lines
Diff to previous 1.243 (colored)

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.

Revision 1.243 / (download) - annotate - [select for diffs], Fri Jul 31 20:22:10 2020 UTC (14 months, 2 weeks ago) by sjg
Branch: MAIN
Changes since 1.242: +13 -3 lines
Diff to previous 1.242 (colored)

Add -dL for LINT

When parsing variable assignments other than := and if
value contains '$' attempt Var_Subst the same as for :=,
if the value does not parse correctly, we get a fatal error
including file an line number.

This can greatly help with finding the cause of problems.

Reviewed by: christos

Revision 1.242 / (download) - annotate - [select for diffs], Tue Jul 28 19:13:49 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.241: +26 -28 lines
Diff to previous 1.241 (colored)

make(1): remove unnecessary parentheses in obvious cases

Revision 1.241 / (download) - annotate - [select for diffs], Tue Jul 28 18:31:16 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.240: +4 -5 lines
Diff to previous 1.240 (colored)

make(1): remove dead code in parse error handling

Revision 1.240 / (download) - annotate - [select for diffs], Tue Jul 28 18:15:11 2020 UTC (14 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.239: +13 -4 lines
Diff to previous 1.239 (colored)

make(1): when parsing an unknown directive, print the directive name

Revision 1.239 / (download) - annotate - [select for diffs], Tue Jul 28 16:42:22 2020 UTC (14 months, 3 weeks ago) by rillig
Branch: MAIN
Changes since 1.238: +10 -10 lines
Diff to previous 1.238 (colored)

make(1): remove dead code from Var_Subst

The first parameter from Var_Subst had been a literal NULL in all cases.
These have been fixed using this command:

sed -i 's|Var_Subst(NULL, |Var_Subst(|' *.c

The one remaining case was not found because the "NULL," was followed by
a line break instead of a space.

The removed code probably wouldn't have worked as expected anyway.
Expanding a single variable to a literal string would have led to
unexpected behavior for cases like ${VAR:M${pattern}}, in case pattern
would contain an unescaped ':' itself.

Revision 1.238 / (download) - annotate - [select for diffs], Mon Jul 20 14:50:41 2020 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.237: +5 -6 lines
Diff to previous 1.237 (colored)

make(1): make modifier handling simpler

Implementing a modifier such as :S or :M should not be concerned with
separating the words of the resulting string.  Ideally this should be
done in the same way by all modifiers.

Before, the :R (filename root) modifier added a separator even if the
resulting filename root was an empty string.  The chances that this
change in behavior breaks anything are epsilon.

The :@ modifier, if it appeared after a :ts modifier, did not use the
word separator from the :ts modifier (which all other modifiers do) but
always added a space.  This behavior has been preserved for now.  It's an
unnecessary inconsistency though.

In contrast to Buffer, the newly added SepBuf uses size_t for memory
sizes and also uses the conventional parameter order (mem, memsize)
instead of the unusual (memsize, mem).

Revision 1.237 / (download) - annotate - [select for diffs], Sun Jul 19 12:26:17 2020 UTC (14 months, 4 weeks ago) by rillig
Branch: MAIN
Changes since 1.236: +11 -11 lines
Diff to previous 1.236 (colored)

make(1): rename Varf_Flags to VarEvalFlags

In var.c there are lots of different flag types.  To make any accidental
mixture obvious, each flag group gets its own prefix.

The only flag group that is visible outside of var.c is concerned with
evaluating variables, therefore the "e", which replaces the former "f"
that probably just meant "flag".

Revision 1.236 / (download) - annotate - [select for diffs], Fri Jul 3 08:13:23 2020 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.235: +5 -5 lines
Diff to previous 1.235 (colored)

make(1): remove trailing whitespace

Revision 1.235 / (download) - annotate - [select for diffs], Fri Jul 3 08:02:55 2020 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.234: +13 -13 lines
Diff to previous 1.234 (colored)

make(1): remove redundant parentheses around return values

Revision 1.234 / (download) - annotate - [select for diffs], Thu Jul 2 15:47:38 2020 UTC (15 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.233: +14 -14 lines
Diff to previous 1.233 (colored)

make(1): remove useless parameter from Var_Set

The enum corresponding to this int parameter is only defined in var.c,
which makes it impractical for the outside to set this parameter to
anything but 0.

On x86_64, this reduces the size of the resulting executable by 5 kB.

Revision 1.229.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:05:43 2020 UTC (18 months ago) by martin
Branch: phil-wifi
Changes since 1.229.2.1: +5 -6 lines
Diff to previous 1.229.2.1 (colored) to branchpoint 1.229 (colored) next main 1.230 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.233 / (download) - annotate - [select for diffs], Thu Sep 26 21:09:55 2019 UTC (2 years ago) by sjg
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, phil-wifi-20191119, is-mlppp-base, is-mlppp
Changes since 1.232: +5 -6 lines
Diff to previous 1.232 (colored)

Do not assume safe to pass NULL to realpath(3).

PR: 54574
Reviewed by: buhrow

Revision 1.229.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:10:21 2019 UTC (2 years, 4 months ago) by christos
Branch: phil-wifi
Changes since 1.229: +24 -12 lines
Diff to previous 1.229 (colored)

Sync with HEAD

Revision 1.232 / (download) - annotate - [select for diffs], Tue Apr 9 18:28:10 2019 UTC (2 years, 6 months ago) by sjg
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Changes since 1.231: +5 -4 lines
Diff to previous 1.231 (colored)

ParseDoDependency: free paths rather than assert

PR: 52737
Reviewed by: christos

Revision 1.227.2.2 / (download) - annotate - [select for diffs], Wed Dec 26 14:02:10 2018 UTC (2 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.227.2.1: +22 -11 lines
Diff to previous 1.227.2.1 (colored) to branchpoint 1.227 (colored) next main 1.228 (colored)

Sync with HEAD, resolve a few conflicts

Revision 1.231 / (download) - annotate - [select for diffs], Sat Dec 22 00:36:32 2018 UTC (2 years, 9 months ago) by sjg
Branch: MAIN
CVS Tags: pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226
Changes since 1.230: +21 -10 lines
Diff to previous 1.230 (colored)

ParseVErrorInternal: use .PARSEDIR and
apply realpath(3) if not absolute,
and use .PARSEFILE for consitent results.

Reviewed by: christos

Revision 1.230 / (download) - annotate - [select for diffs], Mon Dec 17 02:06:00 2018 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.229: +6 -6 lines
Diff to previous 1.229 (colored)

PR/53796: Valery Ushakov: make prints wrong makefile path in an error message
Use ${.CURDIR} if ${.PARSEDIR} is not absolute.

Revision 1.227.2.1 / (download) - annotate - [select for diffs], Sat Apr 7 04:12:21 2018 UTC (3 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.227: +70 -15 lines
Diff to previous 1.227 (colored)

Sync with HEAD.  77 conflicts resolved - all of them $NetBSD$

Revision 1.229 / (download) - annotate - [select for diffs], Thu Apr 5 16:31:54 2018 UTC (3 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-1126, pgoyette-compat-1020, pgoyette-compat-0930, pgoyette-compat-0906, pgoyette-compat-0728, pgoyette-compat-0625, pgoyette-compat-0521, pgoyette-compat-0502, pgoyette-compat-0422, pgoyette-compat-0415, pgoyette-compat-0407
Branch point for: phil-wifi
Changes since 1.228: +4 -4 lines
Diff to previous 1.228 (colored)

Appease the compiler gods; yes I know what I am doing adding to a literal
string.

Revision 1.228 / (download) - annotate - [select for diffs], Thu Apr 5 00:31:10 2018 UTC (3 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.227: +70 -15 lines
Diff to previous 1.227 (colored)

Be more selective about detecting a SYSV include as opposed to a dependency
line. Dependency lines should contain a '::' operator or ':<space>'.

Revision 1.227 / (download) - annotate - [select for diffs], Thu Feb 22 01:59:28 2018 UTC (3 years, 7 months ago) by sjg
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.226: +6 -5 lines
Diff to previous 1.226 (colored)

Avoid calling sysconf for every file loaded.
At start of a meta build this can be measurable overhead.

Patch from bdrewery at freebsd.org

Revision 1.226 / (download) - annotate - [select for diffs], Mon Feb 12 21:38:09 2018 UTC (3 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.225: +6 -4 lines
Diff to previous 1.225 (colored)

Do not treat .info as warning for -W

Reported by: lwhsu at FreeBSD.org

Revision 1.214.2.3 / (download) - annotate - [select for diffs], Wed Apr 26 02:53:35 2017 UTC (4 years, 5 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.214.2.2: +22 -10 lines
Diff to previous 1.214.2.2 (colored) to branchpoint 1.214 (colored) next main 1.215 (colored)

Sync with HEAD

Revision 1.217.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:54:14 2017 UTC (4 years, 5 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.217: +26 -10 lines
Diff to previous 1.217 (colored) next main 1.218 (colored)

Sync with HEAD

Revision 1.225 / (download) - annotate - [select for diffs], Mon Apr 17 13:29:07 2017 UTC (4 years, 6 months ago) by maya
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base, netbsd-8-2-RELEASE, netbsd-8-1-RELEASE, netbsd-8-1-RC1, netbsd-8-0-RELEASE, netbsd-8-0-RC2, netbsd-8-0-RC1, netbsd-8, matt-nb8-mediatek-base, matt-nb8-mediatek, bouyer-socketcan-base1
Changes since 1.224: +4 -4 lines
Diff to previous 1.224 (colored)

Use correct header for SIZE_MAX. from a.rin

Revision 1.224 / (download) - annotate - [select for diffs], Sun Apr 16 21:38:38 2017 UTC (4 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.223: +5 -4 lines
Diff to previous 1.223 (colored)

Plug memory leak in ParseTraditionalInclude.

Revision 1.223 / (download) - annotate - [select for diffs], Sun Apr 16 21:37:37 2017 UTC (4 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.222: +4 -3 lines
Diff to previous 1.222 (colored)

Plug memory leak.

CID 978370

Revision 1.222 / (download) - annotate - [select for diffs], Sun Apr 16 21:35:08 2017 UTC (4 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.221: +6 -3 lines
Diff to previous 1.221 (colored)

Make it clearer that this is not a memory leak.

CID 978369

Revision 1.221 / (download) - annotate - [select for diffs], Sun Apr 16 21:03:13 2017 UTC (4 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.220: +10 -3 lines
Diff to previous 1.220 (colored)

Guarantee no arithmetic overflow.

Revision 1.220 / (download) - annotate - [select for diffs], Sun Apr 16 20:00:58 2017 UTC (4 years, 6 months ago) by maya
Branch: MAIN
Changes since 1.219: +4 -4 lines
Diff to previous 1.219 (colored)

Use bmake_malloc where we don't test the return value of malloc currently.

Appeases coverity.

Revision 1.219 / (download) - annotate - [select for diffs], Sun Apr 16 19:53:58 2017 UTC (4 years, 6 months ago) by riastradh
Branch: MAIN
Changes since 1.218: +8 -8 lines
Diff to previous 1.218 (colored)

Use, don't kludge, MAKE_ATTR_UNUSED.

CID 1300234
CID 1300237
CID 1300238
CID 1300245
CID 1300255
CID 1300267
CID 1300284

Revision 1.214.2.2 / (download) - annotate - [select for diffs], Mon Mar 20 06:58:04 2017 UTC (4 years, 7 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.214.2.1: +7 -3 lines
Diff to previous 1.214.2.1 (colored) to branchpoint 1.214 (colored)

Sync with HEAD

Revision 1.218 / (download) - annotate - [select for diffs], Wed Mar 1 16:39:49 2017 UTC (4 years, 7 months ago) by sjg
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320
Changes since 1.217: +7 -3 lines
Diff to previous 1.217 (colored)

loadfile: in the mmap case ensures that the buffer ends with \n
do the same for the non-mmap case - avoids core dump.

Revision 1.214.2.1 / (download) - annotate - [select for diffs], Sat Jan 7 08:56:58 2017 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.214: +5 -5 lines
Diff to previous 1.214 (colored)

Sync with HEAD.  (Note that most of these changes are simply $NetBSD$
tag issues.)

Revision 1.217 / (download) - annotate - [select for diffs], Fri Dec 9 22:56:21 2016 UTC (4 years, 10 months ago) by sjg
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.216: +4 -4 lines
Diff to previous 1.216 (colored)

Avoid coredump for

(FOO) = fu

reported by Ori Bernstein

Revision 1.216 / (download) - annotate - [select for diffs], Wed Dec 7 15:00:46 2016 UTC (4 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.215: +4 -4 lines
Diff to previous 1.215 (colored)

Refactor and simplify objdir setting code.

Revision 1.215 / (download) - annotate - [select for diffs], Fri Aug 26 23:28:39 2016 UTC (5 years, 1 month ago) by dholland
Branch: MAIN
CVS Tags: pgoyette-localcount-20161104, localcount-20160914
Changes since 1.214: +11 -4 lines
Diff to previous 1.214 (colored)

Add a .DELETE_ON_ERROR: magic target that causes *failed* targets as
well as *interrupted* targets to be deleted. The name and behavior of
the variable matches gmake.

Also fix a glitch in newline output on error in compat mode that I
discovered while doing it.

Closes PR 51376.

Revision 1.214 / (download) - annotate - [select for diffs], Wed Apr 6 09:57:00 2016 UTC (5 years, 6 months ago) by gson
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726
Branch point for: pgoyette-localcount
Changes since 1.213: +6 -6 lines
Diff to previous 1.213 (colored)

Fully avoid the nonstandard types u_char, u_int, and u_long, which
were only used inconsistently in a few places anyway.

Revision 1.213 / (download) - annotate - [select for diffs], Fri Mar 11 13:54:47 2016 UTC (5 years, 7 months ago) by matthias
Branch: MAIN
Changes since 1.212: +4 -3 lines
Diff to previous 1.212 (colored)

make parsing of library member targets work. So

lib.a(member.o): something
	cp something member.o
	ar r lib.a member.o
	rm member.o

will work now.

Revision 1.212 / (download) - annotate - [select for diffs], Fri Feb 19 06:19:06 2016 UTC (5 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.211: +4 -4 lines
Diff to previous 1.211 (colored)

Initialize curFile->depending in Parse_SetInput.

Revision 1.211 / (download) - annotate - [select for diffs], Thu Feb 18 18:29:14 2016 UTC (5 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.210: +12 -11 lines
Diff to previous 1.210 (colored)

Collapse the 3 boolean parameter to 1 flags parameter. No functional change.

Revision 1.210 / (download) - annotate - [select for diffs], Thu Feb 18 05:02:49 2016 UTC (5 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.209: +12 -7 lines
Diff to previous 1.209 (colored)

Add support for .dinclude

Like .sinclude missing file will be ignored.
Like .depend stale dependencies will be ignored.
Allows better implementation of auto depend.

Reviewed by: christos
Requested by: Bryan Drewery at FreeBSD.

Revision 1.209 / (download) - annotate - [select for diffs], Sun Jan 17 17:45:21 2016 UTC (5 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.208: +6 -9 lines
Diff to previous 1.208 (colored)

remove free NULL checks (Tilman Sauerbeck)

Revision 1.208 / (download) - annotate - [select for diffs], Sun Jan 17 15:32:38 2016 UTC (5 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.207: +3 -4 lines
Diff to previous 1.207 (colored)

provide missing FD_CLOEXEC for the havenots.

Revision 1.207 / (download) - annotate - [select for diffs], Sat Jan 9 00:55:17 2016 UTC (5 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.206: +11 -11 lines
Diff to previous 1.206 (colored)

Preserve $$ in := assignments..

FOO=\$$CRAP
BAR:=${FOO}

all:
	echo ${FOO}
	echo ${BAR}

Revision 1.206 / (download) - annotate - [select for diffs], Thu Nov 26 00:23:04 2015 UTC (5 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.205: +7 -3 lines
Diff to previous 1.205 (colored)

ParseTrackInput: do not access beyond end of buffer.

Detected by Address Sanitizer - dim at FreeBSD.org

Revision 1.205 / (download) - annotate - [select for diffs], Sun Oct 11 04:51:24 2015 UTC (6 years ago) by sjg
Branch: MAIN
Changes since 1.204: +11 -11 lines
Diff to previous 1.204 (colored)

Add Boolean wantit to Var_Parse and Var_Subst

wantit will be FALSE when we are just consuming to discard
in which case we skip "expensive" things like Cmd_Exec.

Reviewed by: christos

Revision 1.204 / (download) - annotate - [select for diffs], Thu Sep 18 08:06:13 2014 UTC (7 years, 1 month ago) by dholland
Branch: MAIN
Changes since 1.203: +40 -7 lines
Diff to previous 1.203 (colored)

Comments, and one very minor tidyup.

Revision 1.203 / (download) - annotate - [select for diffs], Sun Sep 7 20:55:34 2014 UTC (7 years, 1 month ago) by joerg
Branch: MAIN
Changes since 1.202: +92 -197 lines
Diff to previous 1.202 (colored)

Revert all make changes except the unit tests to the state of three
weeks ago. Individual changes can be reapplied after review.

Revision 1.202 / (download) - annotate - [select for diffs], Fri Aug 29 09:27:43 2014 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.201: +4 -7 lines
Diff to previous 1.201 (colored)

undo eating the trailing backslash now that the shell has been fixed.

Revision 1.201 / (download) - annotate - [select for diffs], Thu Aug 28 14:39:13 2014 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.200: +7 -4 lines
Diff to previous 1.200 (colored)

don't leave trailing backlashes on commands, just like gmake does. What does
POSIX have to say?

Revision 1.200 / (download) - annotate - [select for diffs], Sat Aug 23 15:05:40 2014 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.199: +161 -72 lines
Diff to previous 1.199 (colored)

PR/46096: Jarmo Jaakkola: fix many problems with dependencies (PR 49086)

Quite extensive rewrite of the Suff module.  Some ripple effects into
Parse and Targ modules too.

Dependency searches in general were made to honor explicit rules so
implicit and explicit sources are no longer applied on targets that
do not invoke a transformation rule.

Archive member dependency search was rewritten.  Explicit rules now
work properly and $(.TARGET) is set correctly.  POSIX semantics for
lib(member.o) and .s1.a rules are supported.

.SUFFIXES list maintenance was rewritten so that scanning of existing
rules works when suffixes are added and that clearing the suffix list
removes single suffix rules too.  Transformation rule nodes are now
mixed with regular nodes so they are available as regular targets too
if needed (especially after the known suffixes are cleared).

The .NULL target was documented in the manual page, especially to
warn against using it when a single suffix rule would work.
A deprecation warning was also added to the manual and make also
warns the user if it encounters .NULL.

Search for suffix rules no longer allows the explicit dependencies
to override the selected transformation rule.  A check is made in
the search that the transformation that would be tried does not
already exist in the chain.  This prevents getting stuck in an infinite
loop under specific circumstances.  Local variables are now set
before node's children are expanded so dynamic sources work in
multi-stage transformations.  Make_HandleUse() no longer expands
the added children for transformation nodes, preventing triple
expansion and allowing the Suff module to properly postpone their
expansion until proper values are set for the local variables.

Directory prefix is no longer removed from $(.PREFIX) if the target
is found via directory search.

The last rule defined is now used instead of the first one (POSIX
requirement) in case a rule is defined multiple times.  Everything
defined in the first instance is undone, but things added "globally"
are honored.  To implement this, each node tracks attribute bits
which have been set by special targets (global) instead of special
sources (local).  They also track dependencies that were added by
a rule with commands (local) instead of rule with no commands (global).

New attribute, OP_FROM_SYS_MK is introduced.  It is set on all targets
found in system makefiles so that they are not eligible to become
the main target.  We cannot just set OP_NOTMAIN because it is one of
the attributes inherited from transformation and .USE rules and would
make any eligible target that uses a built-in inference rule ineligible.

The $(.IMPSRC) local variable now works like in gmake: it is set to
the first prerequisite for explicit rules.  For implicit rules it
is still the implied source.

The manual page is improved regarding the fixed features.  Test cases
for the fixed problems are added.

Other improvements in the Suff module include:
  - better debug messages for transformation rule search (length of
    the chain is now visualized by indentation)
  - Suff structures are created, destroyed and moved around by a set
    of maintenance functions so their reference counts are easier
    to track (this also gets rid of a lot of code duplication)
  - some unreasonably long functions were split into smaller ones
  - many local variables had their names changed to describe their
    purpose instead of their type

Revision 1.199 / (download) - annotate - [select for diffs], Sat Aug 23 14:50:24 2014 UTC (7 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.198: +39 -23 lines
Diff to previous 1.198 (colored)

PR/49085: Jarmo Jaakkola: fix several parsing errors

Don't exit from var.c:Var_Parse() before possible modifiers are handled
on D and F modified versions of local variables.  Properly expand $(?D)
and $(?F) too.

Make line continuations in rule's commands POSIX compliant.

Fix the syntax error caused by lib(member) as the last target before
a dependency operator.

Document the line continuation change in the manual page.  Also talk
more about the POSIX style local variables and their modifiers.

Add tests covering the fixed problems into d_posix.mk.  The test is
a known failure at the moment because of PR 49086 and PR 49092.

[XXX: unconverted tests]

Revision 1.185.2.2 / (download) - annotate - [select for diffs], Wed Aug 20 00:05:00 2014 UTC (7 years, 2 months ago) by tls
Branch: tls-maxphys
Changes since 1.185.2.1: +105 -12 lines
Diff to previous 1.185.2.1 (colored) to branchpoint 1.185 (colored) next main 1.186 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.194.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:58:27 2014 UTC (7 years, 2 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.194: +42 -4 lines
Diff to previous 1.194 (colored) next main 1.195 (colored)

Rebase.

Revision 1.198 / (download) - annotate - [select for diffs], Wed Jul 16 19:31:11 2014 UTC (7 years, 3 months ago) by justin
Branch: MAIN
CVS Tags: tls-maxphys-base, tls-earlyentropy-base, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7
Changes since 1.197: +4 -4 lines
Diff to previous 1.197 (colored)

Avoid use of __arraycount in tools as not portable

Revision 1.197 / (download) - annotate - [select for diffs], Wed Jul 16 18:58:07 2014 UTC (7 years, 3 months ago) by justin
Branch: MAIN
Changes since 1.196: +5 -4 lines
Diff to previous 1.196 (colored)

Remove an accidental C99-ism in tools which needs to be portable

Revision 1.196 / (download) - annotate - [select for diffs], Wed Jul 16 16:52:59 2014 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.195: +5 -8 lines
Diff to previous 1.195 (colored)

remove debugging

Revision 1.195 / (download) - annotate - [select for diffs], Wed Jul 16 15:33:41 2014 UTC (7 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.194: +44 -4 lines
Diff to previous 1.194 (colored)

PR/48367: David A. Holland: Mark possible submake nodes so that we can
avoid closing the job pipe on exec for them in order to make recursive
makes work in parallel.

Revision 1.179.2.5 / (download) - annotate - [select for diffs], Thu May 22 11:42:46 2014 UTC (7 years, 4 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.179.2.4: +127 -52 lines
Diff to previous 1.179.2.4 (colored) to branchpoint 1.179 (colored) next main 1.180 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.194 / (download) - annotate - [select for diffs], Sat Feb 15 00:17:17 2014 UTC (7 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base9, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: tls-earlyentropy
Changes since 1.193: +6 -5 lines
Diff to previous 1.193 (colored)

delete the correct variables on eof
fix typo in comment (from sjg)

Revision 1.193 / (download) - annotate - [select for diffs], Fri Jan 10 16:12:52 2014 UTC (7 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.192: +51 -12 lines
Diff to previous 1.192 (colored)

add .INCLUDEDFROM{FILE,DIR}

Revision 1.192 / (download) - annotate - [select for diffs], Fri Oct 18 20:47:06 2013 UTC (8 years ago) by christos
Branch: MAIN
Changes since 1.191: +4 -5 lines
Diff to previous 1.191 (colored)

fix unused variable warnings

Revision 1.191 / (download) - annotate - [select for diffs], Wed Aug 28 21:56:49 2013 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.190: +9 -3 lines
Diff to previous 1.190 (colored)

Fix parsing of SUNSHCMD style :sh = assigments.

Submitted by: Will Andrews at freebsd.org

Revision 1.190 / (download) - annotate - [select for diffs], Sat Aug 10 21:20:03 2013 UTC (8 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.189: +13 -3 lines
Diff to previous 1.189 (colored)

ParseGetLine: don't treat a zero byte as end of buffer if P_end says it isn't.
Consume up to next newline, and issue a parse warning.
If no newline found before P_end, carry on as before.

Revision 1.185.2.1 / (download) - annotate - [select for diffs], Sun Jun 23 06:29:00 2013 UTC (8 years, 3 months ago) by tls
Branch: tls-maxphys
Changes since 1.185: +61 -41 lines
Diff to previous 1.185 (colored)

resync from head

Revision 1.189 / (download) - annotate - [select for diffs], Tue Jun 18 19:31:27 2013 UTC (8 years, 4 months ago) by sjg
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.188: +7 -5 lines
Diff to previous 1.188 (colored)

Fix use after free bug.
Parse_SetInput:
curFile->fname was using the buffer passed to it - which ReadMakefile frees.
This change makes the comment in ParseEOF about leaking curFile->fname true.

Revision 1.188 / (download) - annotate - [select for diffs], Fri Mar 22 16:07:59 2013 UTC (8 years, 6 months ago) by sjg
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver
Changes since 1.187: +4 -3 lines
Diff to previous 1.187 (colored)

ParseGmakeExport: terminate variable at '=', or setenv(3) will fail
on some systems.

Revision 1.187 / (download) - annotate - [select for diffs], Tue Mar 5 22:01:44 2013 UTC (8 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.186: +46 -41 lines
Diff to previous 1.186 (colored)

Add a .STALE special target that gets invoked when dependency files contain
stail entries.

Revision 1.186 / (download) - annotate - [select for diffs], Tue Mar 5 02:04:11 2013 UTC (8 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.185: +15 -3 lines
Diff to previous 1.185 (colored)

Keep track of the location where a dependency is defined, so we can report
about it.

Revision 1.179.2.4 / (download) - annotate - [select for diffs], Tue Oct 30 19:00:22 2012 UTC (8 years, 11 months ago) by yamt
Branch: yamt-pagecache
CVS Tags: yamt-pagecache-tag8
Changes since 1.179.2.3: +5 -5 lines
Diff to previous 1.179.2.3 (colored) to branchpoint 1.179 (colored)

sync with head

Revision 1.185 / (download) - annotate - [select for diffs], Tue Jun 12 19:21:51 2012 UTC (9 years, 4 months ago) by joerg
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, dholland-make-base
Branch point for: tls-maxphys
Changes since 1.184: +5 -5 lines
Diff to previous 1.184 (colored)

Replace __dead, __unused and the various printf format attributes
with versions prefixed by MAKE_ATTR_* to avoid modifying the
implementation namespace. Make sure they are available in all places
using nonints.h to fix bootstrap on Linux.

Revision 1.179.2.3 / (download) - annotate - [select for diffs], Wed May 23 10:08:26 2012 UTC (9 years, 4 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.179.2.2: +8 -9 lines
Diff to previous 1.179.2.2 (colored) to branchpoint 1.179 (colored)

sync with head.

Revision 1.184 / (download) - annotate - [select for diffs], Tue Apr 24 20:12:16 2012 UTC (9 years, 5 months ago) by sjg
Branch: MAIN
CVS Tags: yamt-pagecache-base5
Changes since 1.183: +34 -4 lines
Diff to previous 1.183 (colored)

Restore previous behavior - supressing duplicate entries in
.MAKE.MAKEFILES - it is more efficient.

Revision 1.183 / (download) - annotate - [select for diffs], Fri Apr 20 05:33:42 2012 UTC (9 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.182: +9 -40 lines
Diff to previous 1.182 (colored)

Fix some typos in/around ParseGmakeExport.
Remove the suppresssion of duplicate entries in .MAKE.MAKEFILES

Revision 1.179.2.2 / (download) - annotate - [select for diffs], Tue Apr 17 00:09:35 2012 UTC (9 years, 6 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.179.2.1: +69 -4 lines
Diff to previous 1.179.2.1 (colored) to branchpoint 1.179 (colored)

sync with head

Revision 1.182 / (download) - annotate - [select for diffs], Sat Mar 31 00:12:24 2012 UTC (9 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.181: +66 -3 lines
Diff to previous 1.181 (colored)

Add a gmake inspired export command

Revision 1.181 / (download) - annotate - [select for diffs], Sat Mar 24 20:28:41 2012 UTC (9 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.180: +6 -4 lines
Diff to previous 1.180 (colored)

Avoid the need to escape the # in :[#] when parsing conditionals.

Revision 1.179.2.1 / (download) - annotate - [select for diffs], Thu Nov 10 14:31:54 2011 UTC (9 years, 11 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.179: +15 -11 lines
Diff to previous 1.179 (colored)

sync with head

Revision 1.180 / (download) - annotate - [select for diffs], Sun Nov 6 19:46:56 2011 UTC (9 years, 11 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus
Changes since 1.179: +15 -11 lines
Diff to previous 1.179 (colored)

add debugging for parsedir and parsefile

Revision 1.179 / (download) - annotate - [select for diffs], Wed Aug 31 16:24:57 2011 UTC (10 years, 1 month ago) by plunky
Branch: MAIN
CVS Tags: yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.178: +5 -5 lines
Diff to previous 1.178 (colored)

NULL does not need a cast

Revision 1.178 / (download) - annotate - [select for diffs], Tue May 17 21:56:51 2011 UTC (10 years, 5 months ago) by dsl
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp
Changes since 1.177: +11 -3 lines
Diff to previous 1.177 (colored)

If a makefile if a multiple of the page size and doesn't end with a
newline, then it all goes horribly wrong when make tries to terminate
the last input line.
This was all ok before the mmap changes (rev 1.169) because the last
32 bytes of the input buffer were never read into.
The non-mmap case has a similar problem.
Bug found because my .depend files don't have a newline at the end of
the .OPTIO|NAL line (don't know if that is a local change).

Revision 1.173.2.1 / (download) - annotate - [select for diffs], Sat Mar 5 15:10:59 2011 UTC (10 years, 7 months ago) by bouyer
Branch: bouyer-quota2
Changes since 1.173: +9 -6 lines
Diff to previous 1.173 (colored) next main 1.174 (colored)

Sync with HEAD

Revision 1.177 / (download) - annotate - [select for diffs], Thu Mar 3 14:53:02 2011 UTC (10 years, 7 months ago) by nakayama
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.176: +6 -3 lines
Diff to previous 1.176 (colored)

Fix build on Solaris 10.

Revision 1.176 / (download) - annotate - [select for diffs], Sun Feb 20 23:12:09 2011 UTC (10 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.175: +4 -4 lines
Diff to previous 1.175 (colored)

Use the current directory at start time for .PARSEDIR, if the filename
contains no /.

Revision 1.175 / (download) - annotate - [select for diffs], Sun Feb 20 20:17:35 2011 UTC (10 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.174: +4 -4 lines
Diff to previous 1.174 (colored)

Remove the extra blank line after "Fatal errors encountered -- cannot
continue". This has been there since 1.1 but I don't think it was
intentional. If anyone actually cares about the blank line being there
for some reason, go ahead and revert this change...

Revision 1.174 / (download) - annotate - [select for diffs], Sun Feb 20 20:15:36 2011 UTC (10 years, 7 months ago) by dholland
Branch: MAIN
Changes since 1.173: +4 -4 lines
Diff to previous 1.173 (colored)

Remove stray extra newline in error message.

Revision 1.173 / (download) - annotate - [select for diffs], Sat Dec 25 21:39:11 2010 UTC (10 years, 9 months ago) by dholland
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-base
Branch point for: bouyer-quota2
Changes since 1.172: +4 -4 lines
Diff to previous 1.172 (colored)

erm. fix previous...

Revision 1.172 / (download) - annotate - [select for diffs], Sat Dec 25 20:46:18 2010 UTC (10 years, 9 months ago) by dholland
Branch: MAIN
Changes since 1.171: +7 -5 lines
Diff to previous 1.171 (colored)

Maybe fix a problem that appeared on loonix.

Revision 1.171 / (download) - annotate - [select for diffs], Sat Dec 25 17:19:04 2010 UTC (10 years, 9 months ago) by dholland
Branch: MAIN
Changes since 1.170: +4 -3 lines
Diff to previous 1.170 (colored)

Uses stat; needs sys/stat.h. No idea what's pulling it in implicitly on
NetBSD so I didn't notice. Woops. Noted by Kurt Schreiner on current-users.

Revision 1.170 / (download) - annotate - [select for diffs], Sat Dec 25 04:57:07 2010 UTC (10 years, 9 months ago) by dholland
Branch: MAIN
Changes since 1.169: +265 -103 lines
Diff to previous 1.169 (colored)

Begin cleanup of the make parser: separate out the logic for reading files
from the parsing goo. This will now use mmap for reading if it works and
fall back to read only for pipes and such. Step 1 of a cleanup program
proposed without objection on tech-toolchain.

Revision 1.169 / (download) - annotate - [select for diffs], Mon Dec 13 05:01:56 2010 UTC (10 years, 10 months ago) by dholland
Branch: MAIN
Changes since 1.168: +4 -4 lines
Diff to previous 1.168 (colored)

typo in comment

Revision 1.168 / (download) - annotate - [select for diffs], Mon Dec 13 03:36:39 2010 UTC (10 years, 10 months ago) by dholland
Branch: MAIN
Changes since 1.167: +4 -4 lines
Diff to previous 1.167 (colored)

Tables used by parser logic should be const.

Revision 1.167 / (download) - annotate - [select for diffs], Mon Dec 13 03:35:13 2010 UTC (10 years, 10 months ago) by dholland
Branch: MAIN
Changes since 1.166: +3 -5 lines
Diff to previous 1.166 (colored)

Remove stray extern definition that's already in jobs.h.

Revision 1.166 / (download) - annotate - [select for diffs], Mon Dec 13 03:32:25 2010 UTC (10 years, 10 months ago) by dholland
Branch: MAIN
Changes since 1.165: +81 -36 lines
Diff to previous 1.165 (colored)

Cosmetic: declare types before variables, group variables by role,
update some comments, format comments properly, etc. No functional
change intended.

Revision 1.165 / (download) - annotate - [select for diffs], Mon Sep 13 15:36:57 2010 UTC (11 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.164: +9 -3 lines
Diff to previous 1.164 (colored)

Add meta.c which implements "meta" mode for make.
In this mode, a .meta file is created for each target, capturing
the expanded commands used, any command output, and if filemon(9)
is available, a record of system calls which are of interest.
Not enabled unless USE_META=yes is set when building make.
Also, if FILEMON_H exists, meta.c will be compiled to use filemon(9).

Revision 1.164 / (download) - annotate - [select for diffs], Mon May 24 21:04:49 2010 UTC (11 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.163: +12 -9 lines
Diff to previous 1.163 (colored)

Don't missinterpret targets that start with .info

Revision 1.163 / (download) - annotate - [select for diffs], Thu Apr 29 23:12:21 2010 UTC (11 years, 5 months ago) by sjg
Branch: MAIN
Changes since 1.162: +6 -3 lines
Diff to previous 1.162 (colored)

fflush stdout, before writing to stderr.

Revision 1.162 / (download) - annotate - [select for diffs], Thu Apr 8 17:41:29 2010 UTC (11 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.161: +8 -3 lines
Diff to previous 1.161 (colored)

Process .ERROR the same as .BEGIN, .END etc
so that it cannot be the default target.
Add unit-tests for .info - .error, and .ERROR.

Revision 1.161 / (download) - annotate - [select for diffs], Wed Apr 7 00:11:27 2010 UTC (11 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.160: +54 -5 lines
Diff to previous 1.160 (colored)

Add:

.error "message"
.warning "message"
	based on FreeBSD implementation.
	add .info while were at it.

.ERROR:	a target to run on error.
	We pass the failing GNode to PrintOnError so it can set
	.ERROR_TARGET.

.MAKE.MAKEFILE_PREFERENCE
	As a means to control make's list of prefered makefile names.
	(Default: "makefile Makefile")

.MAKE.DEPENDFILE
	Names the file to read dependencies from
	(Default ".depend")

.MAKE.MODE
	Processed after all makefiles are read.
	Can put make into "compat" mode (more to come).

Fix:

compat.c: Error code should not be sent to debug_file.
Make_DoAllVar: use DONE_ALLSRC to avoid processing a node multiple times.
ReadMakefile: we can simply use doing_depend to control setting MAKEFILE.

Revision 1.160 / (download) - annotate - [select for diffs], Thu Nov 19 00:30:25 2009 UTC (11 years, 11 months ago) by sjg
Branch: MAIN
CVS Tags: matt-premerge-20091211
Changes since 1.159: +6 -3 lines
Diff to previous 1.159 (colored)

Add .unexport - the exact opposite of .export
and .unexport-env which unexport's all previously .export'd globals
as well as clearing environ[].
Allow's sys.mk near total controll.

Reviewed by: apb

Revision 1.159 / (download) - annotate - [select for diffs], Fri Nov 6 20:20:56 2009 UTC (11 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.158: +10 -6 lines
Diff to previous 1.158 (colored)

Report lines that ought to contain a ':' operator but start with a '.'
as "Unknown directive" sinze they are more likely to be .elseif (etc).
Lets me close PR/37222!

Revision 1.158 / (download) - annotate - [select for diffs], Wed Oct 7 16:40:30 2009 UTC (12 years ago) by sjg
Branch: MAIN
Changes since 1.157: +25 -10 lines
Diff to previous 1.157 (colored)

The parser used to break dependency lines at ';' without regard
for substitution patterns.  This (perhaps coupled with the
new handling of .for variables in ${:U<value>...) caused interesting
results for lines like:

.for file in ${LIST}
for-subst:       ${file:S;^;${here}/;g}

add a unit-test to keep an eye on this.

Revision 1.157 / (download) - annotate - [select for diffs], Fri Jan 23 21:26:30 2009 UTC (12 years, 8 months ago) by dsl
Branch: MAIN
CVS Tags: jym-xensuspend-nbase, jym-xensuspend-base, jym-xensuspend
Changes since 1.156: +17 -17 lines
Diff to previous 1.156 (colored)

Change 'ClientData' to 'void *' so that relevant parameters can
be made 'const void *'.

Revision 1.156 / (download) - annotate - [select for diffs], Fri Jan 16 20:50:24 2009 UTC (12 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.155: +14 -19 lines
Diff to previous 1.155 (colored)

Parse_Error() really doesn't need to cruft up a dummy structure for curFile.
It only needs the 'fname' and 'lineno' fields - so just use NULL/0 when
curFile is NULL.

Revision 1.155 / (download) - annotate - [select for diffs], Sun Jan 11 15:50:06 2009 UTC (12 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.154: +47 -21 lines
Diff to previous 1.154 (colored)

Instead of stashing the body of every iteration of a .for loop, pass
Parse_SetInput() the name of a function to get the loop data blocks.
This should only be a change to the program logic.

Revision 1.154 / (download) - annotate - [select for diffs], Thu Jan 8 21:12:09 2009 UTC (12 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.153: +25 -64 lines
Diff to previous 1.153 (colored)

Fix PR bin/1443 properly!
Ignore '=' and ' ' inside {} and () when looking for an assignment operator.
Also require the operator be immediately after any whitespace.
XXX mismatched (){} in variable modifiers will not DTRT.

Revision 1.153 / (download) - annotate - [select for diffs], Sun Jan 4 20:17:36 2009 UTC (12 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.152: +16 -5 lines
Diff to previous 1.152 (colored)

Count () and {} when looking to the '=' that terminates the variable being
assigned to.
Should fix:  A.${B:S/=//} = c

Revision 1.152 / (download) - annotate - [select for diffs], Sat Dec 13 15:19:29 2008 UTC (12 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.151: +23 -23 lines
Diff to previous 1.151 (colored)

Use NULL instead of -1 cast to the relavant type (usually via NIL).
This was a suggestion from christos - so blame him if there is a deep
reason for using -1 :-)

Revision 1.151 / (download) - annotate - [select for diffs], Sat Nov 29 17:50:11 2008 UTC (12 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.150: +14 -6 lines
Diff to previous 1.150 (colored)

Split For_Eval() into two functions.
For_Eval() is now only called for the first line of a .for.
For_Accum() is called for the subsequent lines.
Stops any problems with forLevel being left invalid after an error.
Use a return value of -1 from For_Eval() to mean 'skip input line' to stop
a .for line with a syntax error being reparsed by make.

Revision 1.148.2.2 / (download) - annotate - [select for diffs], Sun Nov 23 18:33:32 2008 UTC (12 years, 10 months ago) by bouyer
Branch: netbsd-5
CVS Tags: netbsd-5-2-RELEASE, netbsd-5-2-RC1, netbsd-5-2-3-RELEASE, netbsd-5-2-2-RELEASE, netbsd-5-2-1-RELEASE, netbsd-5-2, netbsd-5-1-RELEASE, netbsd-5-1-RC4, netbsd-5-1-RC3, netbsd-5-1-RC2, netbsd-5-1-RC1, netbsd-5-1-5-RELEASE, netbsd-5-1-4-RELEASE, netbsd-5-1-3-RELEASE, netbsd-5-1-2-RELEASE, netbsd-5-1-1-RELEASE, netbsd-5-1, netbsd-5-0-RELEASE, netbsd-5-0-RC4, netbsd-5-0-RC3, netbsd-5-0-RC2, netbsd-5-0-RC1, netbsd-5-0-2-RELEASE, netbsd-5-0-1-RELEASE, netbsd-5-0, matt-nb5-pq3-base, matt-nb5-pq3, matt-nb5-mips64-u2-k2-k4-k7-k8-k9, matt-nb5-mips64-u1-k1-k5, matt-nb5-mips64-premerge-20101231, matt-nb5-mips64-premerge-20091211, matt-nb5-mips64-k15, matt-nb5-mips64, matt-nb4-mips64-k7-u2a-k9b
Changes since 1.148.2.1: +4 -4 lines
Diff to previous 1.148.2.1 (colored) to branchpoint 1.148 (colored) next main 1.149 (colored)

Pull up following revision(s) (requested by dsl in ticket #117):
	usr.bin/make/parse.c: revision 1.150
intFile.fd should be initialised to -1, not 0.

Revision 1.148.2.1 / (download) - annotate - [select for diffs], Sun Nov 23 18:31:28 2008 UTC (12 years, 10 months ago) by bouyer
Branch: netbsd-5
Changes since 1.148: +4 -6 lines
Diff to previous 1.148 (colored)

Pull up following revision(s) (requested by dsl in ticket #116):
	usr.bin/make/parse.c: revision 1.149
avoid using c99 struct named initializers because this is a host tool and
needs to be compiled by a host compiler which might not be c99 compliant.

Revision 1.120.2.5 / (download) - annotate - [select for diffs], Sun Nov 23 18:20:39 2008 UTC (12 years, 10 months ago) by bouyer
Branch: netbsd-4
Changes since 1.120.2.4: +1 -0 lines
Diff to previous 1.120.2.4 (colored) to branchpoint 1.120 (colored) next main 1.121 (colored)

Pull up following revision(s) (requested by dsl in ticket #1240):
	usr.bin/make/parse.c: revision 1.146
PR/38840: Pierre Pronchery: make crashes while parsing long lines in Makefiles

Revision 1.120.2.4 / (download) - annotate - [select for diffs], Sun Nov 23 18:17:04 2008 UTC (12 years, 10 months ago) by bouyer
Branch: netbsd-4
Changes since 1.120.2.3: +4 -3 lines
Diff to previous 1.120.2.3 (colored) to branchpoint 1.120 (colored)

Pull up following revision(s) (requested by dsl in ticket #1239):
	usr.bin/make/parse.c: revision 1.143
When we extend the buffer used to read makefiles (in order to read lines
longer than 32k) remember the new length so we DTRT for lines longer than 64k.
Should fix PR/37684

Revision 1.150 / (download) - annotate - [select for diffs], Wed Nov 12 15:56:57 2008 UTC (12 years, 11 months ago) by apb
Branch: MAIN
Changes since 1.149: +4 -4 lines
Diff to previous 1.149 (colored)

intFile.fd should be initialised to -1, not 0.

Revision 1.149 / (download) - annotate - [select for diffs], Wed Nov 12 15:45:32 2008 UTC (12 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.148: +4 -6 lines
Diff to previous 1.148 (colored)

avoid using c99 struct named initializers because this is a host tool and
needs to be compiled by a host compiler which might not be c99 compliant.

Revision 1.148 / (download) - annotate - [select for diffs], Wed Oct 29 15:37:08 2008 UTC (12 years, 11 months ago) by sjg
Branch: MAIN
CVS Tags: netbsd-5-base
Branch point for: netbsd-5
Changes since 1.147: +41 -22 lines
Diff to previous 1.147 (colored)

If Parse_Error is called after curFile is invalid, set it to a dummy
to avoid seg-fault.  Also the NULL filename will cause ParseVErrorInternal
to skip trying to report file and line number info.

If CondToken is called outside the context of a .if etc, variables in
the expression being parsed will already be expanded, so allow for
an unqouted number to jump us back into the compare logic.
This allows ${${SomeNumber:U42} > 0:?True:False} to work anywhere.

Job_Finish should process postCommands if it has commands or children.

Revision 1.147 / (download) - annotate - [select for diffs], Mon Oct 6 22:09:21 2008 UTC (13 years ago) by joerg
Branch: MAIN
CVS Tags: matt-mips64-base2
Changes since 1.146: +11 -11 lines
Diff to previous 1.146 (colored)

Don't use emalloc and friends directly, but call them consistently
bmake_malloc and friends. Implement them via macros for the native case
and provide fallback implementations otherwise. Avoid polluting the
namespace by not defining enomem globally. Don't bother to provide
strdup and strndup, they were only used for the estrdup and estrndup
comapt code.

This addresses the presence of emalloc in system libraries on A/UX and
resulted strange issues as reported by Timothy E. Larson.

Revision 1.145.6.1 / (download) - annotate - [select for diffs], Mon Jun 23 04:32:11 2008 UTC (13 years, 3 months ago) by wrstuden
Branch: wrstuden-revivesa
Changes since 1.145: +4 -3 lines
Diff to previous 1.145 (colored) next main 1.146 (colored)

Sync w/ -current. 34 merge conflicts to follow.

Revision 1.145.4.1 / (download) - annotate - [select for diffs], Wed Jun 4 02:05:58 2008 UTC (13 years, 4 months ago) by yamt
Branch: yamt-pf42
Changes since 1.145: +4 -3 lines
Diff to previous 1.145 (colored) next main 1.146 (colored)

sync with head

Revision 1.146 / (download) - annotate - [select for diffs], Tue Jun 3 13:02:28 2008 UTC (13 years, 4 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-base4, yamt-pf42-base3, wrstuden-revivesa-base-3, wrstuden-revivesa-base-2, wrstuden-revivesa-base-1, wrstuden-revivesa-base
Changes since 1.145: +4 -3 lines
Diff to previous 1.145 (colored)

PR/38840: Pierre Pronchery: make crashes while parsing long lines in Makefiles

Revision 1.145 / (download) - annotate - [select for diffs], Fri Feb 15 21:29:50 2008 UTC (13 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pf42-baseX, yamt-pf42-base2, yamt-pf42-base, matt-armv6-nbase, keiichi-mipv6-nbase, keiichi-mipv6-base, keiichi-mipv6, hpcarm-cleanup-nbase, hpcarm-cleanup-base
Branch point for: yamt-pf42, wrstuden-revivesa
Changes since 1.144: +15 -15 lines
Diff to previous 1.144 (colored)

back all changes out until I fix it properly.

Revision 1.144 / (download) - annotate - [select for diffs], Thu Feb 14 22:11:20 2008 UTC (13 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: christos-broken
Changes since 1.143: +18 -18 lines
Diff to previous 1.143 (colored)

- use pid_t/size_t as appropriate instead of int.
- use %ld to print pids.
- fix a bit of lint.
- WARNS=4

Revision 1.134.4.2 / (download) - annotate - [select for diffs], Wed Jan 9 02:00:48 2008 UTC (13 years, 9 months ago) by matt
Branch: matt-armv6
Changes since 1.134.4.1: +4 -3 lines
Diff to previous 1.134.4.1 (colored) to branchpoint 1.134 (colored) next main 1.135 (colored)

sync with HEAD

Revision 1.143 / (download) - annotate - [select for diffs], Thu Jan 3 22:14:53 2008 UTC (13 years, 9 months ago) by dsl
Branch: MAIN
CVS Tags: matt-armv6-base
Changes since 1.142: +4 -3 lines
Diff to previous 1.142 (colored)

When we extend the buffer used to read makefiles (in order to read lines
longer than 32k) remember the new length so we DTRT for lines longer than 64k.
Should fix PR/37684

Revision 1.134.4.1 / (download) - annotate - [select for diffs], Tue Nov 6 23:36:02 2007 UTC (13 years, 11 months ago) by matt
Branch: matt-armv6
CVS Tags: matt-armv6-prevmlocking
Changes since 1.134: +80 -27 lines
Diff to previous 1.134 (colored)

sync with HEAD

Revision 1.142 / (download) - annotate - [select for diffs], Mon Oct 22 15:36:13 2007 UTC (13 years, 11 months ago) by sjg
Branch: MAIN
CVS Tags: cube-autoconf-base, cube-autoconf
Changes since 1.141: +19 -8 lines
Diff to previous 1.141 (colored)

Allow .PATH<suffix> to be used for .include "".

Revision 1.141 / (download) - annotate - [select for diffs], Sat Oct 13 18:28:35 2007 UTC (14 years ago) by christos
Branch: MAIN
Changes since 1.140: +4 -4 lines
Diff to previous 1.140 (colored)

strlen returns size_t

Revision 1.140 / (download) - annotate - [select for diffs], Sat Oct 13 11:08:05 2007 UTC (14 years ago) by dsl
Branch: MAIN
Changes since 1.139: +22 -22 lines
Diff to previous 1.139 (colored)

When processing .include "../../foo.mk" lexically process the leading ../
against the directory name of the makefile being processed.
Shortens a lot of pathnames (especially in pkgsrc) and significantly
reduces the number of duplicate entries in .MAKE.MAKEFILES

Revision 1.139 / (download) - annotate - [select for diffs], Fri Oct 12 23:38:27 2007 UTC (14 years ago) by dsl
Branch: MAIN
Changes since 1.138: +14 -23 lines
Diff to previous 1.138 (colored)

If we are going to save the names of all opened makefiles, do so when files
are first processed, not for every line of every loop inside the file.
When (attempting) to check for duplicate names, use the spaces between names
as separators rather than using strstr() - which is slow and wont find
duplicates after an incorect early match.
However the duplicate check is rather broken (especially for pkgsrc) where
names like ../../devel/atk/../../devel/glib2/../../devel/gettext-lib/ \
../../devel/gettext-lib/../../mk/buildlink3/../../mk/bsd.prefs.mk
which need (some form of) realpath() processing.
'cd pkgsrc/xaa/gtk2; make show-var VARNAME=.MAKE.MAKEFILES' shows the problem.

Revision 1.138 / (download) - annotate - [select for diffs], Fri Oct 12 23:13:16 2007 UTC (14 years ago) by christos
Branch: MAIN
Changes since 1.137: +5 -6 lines
Diff to previous 1.137 (colored)

static a const string.

Revision 1.137 / (download) - annotate - [select for diffs], Mon Oct 8 20:26:36 2007 UTC (14 years ago) by sjg
Branch: MAIN
Changes since 1.136: +46 -3 lines
Diff to previous 1.136 (colored)

Use .MAKE.MAKEFILES to track all the makefiles that have been read
so they can be used in dependency rules.

Revision 1.136 / (download) - annotate - [select for diffs], Fri Oct 5 15:27:45 2007 UTC (14 years ago) by sjg
Branch: MAIN
Changes since 1.135: +11 -4 lines
Diff to previous 1.135 (colored)

Add the ability to .export variables to the environment.

Revision 1.135 / (download) - annotate - [select for diffs], Mon Oct 1 22:14:11 2007 UTC (14 years ago) by sjg
Branch: MAIN
Changes since 1.134: +5 -3 lines
Diff to previous 1.134 (colored)

Add the ability to tweak the token output before targets in job mode.
Eg.
.MAKE.JOB.PREFIX=${.newline}---${.MAKE:T}[${.MAKE.PID}]
would produce
---make[1234] target ---

Revision 1.120.2.2.2.1 / (download) - annotate - [select for diffs], Mon Sep 3 07:05:31 2007 UTC (14 years, 1 month ago) by wrstuden
Branch: wrstuden-fixsa
Changes since 1.120.2.2: +381 -469 lines
Diff to previous 1.120.2.2 (colored) next main 1.120.2.3 (colored)

Sync w/ NetBSD-4-RC_1

Revision 1.120.2.3 / (download) - annotate - [select for diffs], Tue Jun 5 20:53:30 2007 UTC (14 years, 4 months ago) by bouyer
Branch: netbsd-4
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0
Changes since 1.120.2.2: +381 -469 lines
Diff to previous 1.120.2.2 (colored) to branchpoint 1.120 (colored)

Apply patch (requested by tron in ticket #696):
	usr.bin/make/compat.c		patch
	usr.bin/make/cond.c		patch
	usr.bin/make/dir.c		patch
	usr.bin/make/for.c		patch
	usr.bin/make/main.c		patch
	usr.bin/make/make.1		patch
	usr.bin/make/make.c		patch
	usr.bin/make/make.h		patch
	usr.bin/make/nonints.h		patch
	usr.bin/make/parse.c		patch
	usr.bin/make/str.c		patch
	usr.bin/make/targ.c		patch
	usr.bin/make/util.c		patch
	usr.bin/make/var.c		patch

Synchronize make(1) with HEAD branch to increase perfomance and
improve stability.

Revision 1.134 / (download) - annotate - [select for diffs], Wed May 23 19:03:56 2007 UTC (14 years, 4 months ago) by dsl
Branch: MAIN
CVS Tags: matt-mips64-base, matt-mips64, hpcarm-cleanup
Branch point for: matt-armv6
Changes since 1.133: +3 -8 lines
Diff to previous 1.133 (colored)

Delete some comments that refer to long-extinct code.

Revision 1.120.2.2 / (download) - annotate - [select for diffs], Sun May 6 22:08:42 2007 UTC (14 years, 5 months ago) by snj
Branch: netbsd-4
Branch point for: wrstuden-fixsa
Changes since 1.120.2.1: +5 -4 lines
Diff to previous 1.120.2.1 (colored) to branchpoint 1.120 (colored)

Pull up following revision(s) (requested by dsl in ticket #479):
	usr.bin/make/parse.c: revision 1.129 via patch
Avoid coredumping. Found by accidentally running make instead of gmake
in java's control/make directory.

Revision 1.133 / (download) - annotate - [select for diffs], Sat Feb 24 17:55:54 2007 UTC (14 years, 7 months ago) by dsl
Branch: MAIN
Changes since 1.132: +6 -6 lines
Diff to previous 1.132 (colored)

Don't increment 'cp' twice when looking for commands following ';' on a
dependency line.
This makes the line "foo:;echo bar" not try to execute "cho bar", and the
line "baz:;" not treat the rest of the makefile as commands.
Pointed out by Takahiro Kambe on current-users.

Revision 1.132 / (download) - annotate - [select for diffs], Sun Feb 4 19:23:49 2007 UTC (14 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.131: +12 -12 lines
Diff to previous 1.131 (colored)

Add code to ensure that .if/.endif are correctly nested with .for/.endfor
and also include files don't have mismatched .if/.endif
It has been suggested that make used to have this test, but I can't
remember removing any code that might have performed it.

Revision 1.131 / (download) - annotate - [select for diffs], Wed Jan 24 21:43:01 2007 UTC (14 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.130: +14 -13 lines
Diff to previous 1.130 (colored)

Check of open conditionals before we trash 'curFile' - so we can actually
report the filename of the error (without core dumping!).
Also fix tests for reporting errors to the debug_file, and don't add $PWD
to (stdin).

Revision 1.130 / (download) - annotate - [select for diffs], Thu Jan 18 20:22:44 2007 UTC (14 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.129: +5 -5 lines
Diff to previous 1.129 (colored)

Don't delete '\' from before '#' in shell command lines.
Probably fixes build of pkgsrc:editors/xemacs.
Pointed out by Richard Earnshaw.

Revision 1.129 / (download) - annotate - [select for diffs], Mon Jan 15 01:26:32 2007 UTC (14 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.128: +8 -6 lines
Diff to previous 1.128 (colored)

Avoid coredumping. Found by accidentally running make instead of gmake
in java's control/make directory.

Revision 1.128 / (download) - annotate - [select for diffs], Tue Jan 2 23:22:37 2007 UTC (14 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.127: +4 -7 lines
Diff to previous 1.127 (colored)

Don't delete whitespace before a "\\\n" sequence. Somewhere I'd misread
the required behaviour and replaced it with something more sensible - except
for makefiles that contain "\n\t\\\n shell command"...

Revision 1.127 / (download) - annotate - [select for diffs], Mon Jan 1 21:47:32 2007 UTC (14 years, 9 months ago) by dsl
Branch: MAIN
Changes since 1.126: +299 -382 lines
Diff to previous 1.126 (colored)

Rework the code that separates the makefile into lines.
Instead of copying the file byte by byte into an expanding line buffer, just
scan the file buffer for (unescaped) newlines.
Escaped newlines (etc) are processed by modifying the file buffer later.
Speeds up 'nbmake obj' by a factor of 2.
I suspect it will do wonders for parts of pkgsrc as well, since it largely
eliminates cpu cycles from the false part of .ifs.

Revision 1.120.2.1 / (download) - annotate - [select for diffs], Wed Dec 20 22:42:11 2006 UTC (14 years, 10 months ago) by bouyer
Branch: netbsd-4
Changes since 1.120: +294 -419 lines
Diff to previous 1.120 (colored)

Pull up following revision(s) (requested by dsl in ticket #285):
	usr.bin/make/cond.c: revision 1.36
	usr.bin/make/parse.c: revision 1.121-1.124
	usr.bin/make/make.h: revision 1.65
	usr.bin/make/targ.c: revision 1.46
	usr.bin/make/main.c: revision 1.138-1.139
Simplify the code that processes .if lines.
It doesn't need a two-dimensional array to remember the states of .if lines.
It would be even simpler if we didn't try to detect .else and .elif lines
that follow .else lines.
Unfortunately this isn't the code that is stupendously slow...
Unknot this code slightly by avoiding 'break/return; else' and by putting
the short parts of some conditionals first.
First step towards speeding up the parsing of makefiles (esp. the unwanted
parts of .if clauses).
There should be no changes to the logic.
There really is no point calling estrdup() to get a copy of the makefile name
into every 'gnode' (aka target), instead just copy a pointer to the string
and avoid freeing the original name when we close the file.
I can't imagine any makefile set where this gives a larger footprint!
Add anewline to the end of the error message output when the debug log
file cannot be opened.
Put the big block of code that was common to ParseDoInclude() and
ParseTraditionalInclude() into a separate routine.
Fix the 'use after free' and 'free on item not malloced' that got added
to ParseTraditionalInclude() in Feb 2006 (rev 1.111).
Kill the 'PTR' struct and put both its members into IFile.
Remove the parameter from ParseEOF(), 1 of the 3 calls passed the wrong value!
Fortunately another test stopped anything nasty happening, we'll use that
test instead.
Revert part of a recent commit.
ParseEOF() shouldn't close the original file.
Some minor changes:
- Only test 'printVars' once.
  Has side effect of not trying to find the 'main' target for '-V varname'.
- Only reap the single child process in Cmd_Exec(),
  I think this is for 'xx != cmd' so probobably no other children should exist.
- Don't read and parse .depend if '-r' and '-V varname' are set.
  I suspect that .depend shouldn't affect the output of any -V command...

Revision 1.126 / (download) - annotate - [select for diffs], Mon Dec 18 15:06:16 2006 UTC (14 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.125: +3 -11 lines
Diff to previous 1.125 (colored)

From Anon Ymous:
Removed two "(void)&" constructs as there is no setjmp() or vfork() insight.
Flagged a few parameters __unused so this will compile with -Wextra now.

Revision 1.125 / (download) - annotate - [select for diffs], Sat Dec 16 08:59:29 2006 UTC (14 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.124: +114 -105 lines
Diff to previous 1.124 (colored)

Use open/read/close instead of stdio for makefiles.
Commons up the code for reading files and buffers, and allows a further
change where we don't copy the data out of the buffer when generating 'lines.
This will speed up makefile parsing (esp .if clauses).

Revision 1.124 / (download) - annotate - [select for diffs], Thu Dec 7 21:34:16 2006 UTC (14 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.123: +10 -9 lines
Diff to previous 1.123 (colored)

Revert part of a recent commit.
ParseEOF() shouldn't close the original file.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Dec 7 21:07:01 2006 UTC (14 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.122: +87 -196 lines
Diff to previous 1.122 (colored)

Put the big block of code that was common to ParseDoInclude() and
ParseTraditionalInclude() into a separate routine.
Fix the 'use after free' and 'free on item not malloced' that got added
to ParseTraditionalInclude() in Feb 2006 (rev 1.111).
Kill the 'PTR' struct and put both its members into IFile.
Remove the parameter from ParseEOF(), 1 of the 3 calls passed the wrong value!
Fortunately another test stopped anything nasty happening, we'll use that
test instead.

Revision 1.122 / (download) - annotate - [select for diffs], Mon Dec 4 21:34:47 2006 UTC (14 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.121: +27 -21 lines
Diff to previous 1.121 (colored)

There really is no point calling estrdup() to get a copy of the makefile name
into every 'gnode' (aka target), instead just copy a pointer to the string
and avoid freeing the original name when we close the file.
I can't imagine any makefile set where this gives a larger footprint!

Revision 1.121 / (download) - annotate - [select for diffs], Sun Dec 3 20:40:44 2006 UTC (14 years, 10 months ago) by dsl
Branch: MAIN
Changes since 1.120: +188 -211 lines
Diff to previous 1.120 (colored)

Unknot this code slightly by avoiding 'break/return; else' and by putting
the short parts of some conditionals first.
First step towards speeding up the parsing of makefiles (esp. the unwanted
parts of .if clauses).
There should be no changes to the logic.

Revision 1.120 / (download) - annotate - [select for diffs], Fri Nov 17 22:07:39 2006 UTC (14 years, 11 months ago) by dsl
Branch: MAIN
CVS Tags: netbsd-4-base
Branch point for: netbsd-4
Changes since 1.119: +37 -212 lines
Diff to previous 1.119 (colored)

A rather large rototil in the way the parallel make code schedules jobs.
This gives a considerable speedup in the processing of .WAIT and .ORDER.
Both .WAIT and .ORDER stop both the commands of the node, and its dependant
nodes being built until the LH nodes are complete.
.WAIT only applies to the dependency line on which it appears, whereas
.ORDER applies globally between the two nodes.
In both cases dependant nodes can be built because other targets need them.
make now processes the target list left to right, scheduling child nodes
as they are needed to make other nodes (instead of attempting to generate
a bottom-up dependency graph at the start).  This means that 'make -j1'
will tend to build in the same order as a non-parallel make.
Note that:
    all: x y
    x: a .WAIT b
    y: b .WAIT a
does not generate a dependency loop.
But
    x: y
    .ORDER y x
does (unless something elswhere causes 'y' to be built).

Revision 1.119 / (download) - annotate - [select for diffs], Fri Oct 27 21:00:19 2006 UTC (14 years, 11 months ago) by dsl
Branch: MAIN
Changes since 1.118: +37 -37 lines
Diff to previous 1.118 (colored)

Since 'ClientData' is 'void *', nuke almost all the (ClientData) casts.

Revision 1.118 / (download) - annotate - [select for diffs], Sun Oct 15 21:17:27 2006 UTC (15 years ago) by dsl
Branch: MAIN
Changes since 1.117: +45 -21 lines
Diff to previous 1.117 (colored)

Add some more explanitory comments.
Rename 'allsrc' to 'curSrcs' so that the variable passed to ParseDoSrc (etc)
has the same name as the local in the calling routine, rather than a name
that seems to imply a more global and persistent list.

Revision 1.117 / (download) - annotate - [select for diffs], Sun Oct 15 18:08:14 2006 UTC (15 years ago) by dsl
Branch: MAIN
Changes since 1.116: +87 -85 lines
Diff to previous 1.116 (colored)

Change a 'while' loop to a 'for' loop so we can add 'free(line)' into the
loop continue part.  Remove the 'free(line)' from teh end of the loop body,
change the gotos into continues and collapse out some 'else if's.
All in the name of code transparency.  No functional changes.

Revision 1.116 / (download) - annotate - [select for diffs], Sun Oct 15 08:38:22 2006 UTC (15 years ago) by dsl
Branch: MAIN
Changes since 1.115: +11 -11 lines
Diff to previous 1.115 (colored)

Output all debug trace output through 'debug_file' defaulting to 'stdout'.
(Almost all the debug output went there, but some went to stderr.)
Split the parsing of -d (debug flags) out into its own routine.
Allow the output filename to be changed by specifying -dF<file> to create
a log file, or -dF+<file> to append to it. <file> may be stdout or stderr.
Also change so that -d-<flags> acts on <flags> locally but doesn't copy
them to MAKEFLAGS so they aren't inherited by child makes.
I'm not 100% happy with the command line syntax for the above, so they are
currently undocumented.

Revision 1.115 / (download) - annotate - [select for diffs], Sat Aug 26 18:17:42 2006 UTC (15 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.114: +10 -10 lines
Diff to previous 1.114 (colored)

More programs using efun.

Revision 1.114 / (download) - annotate - [select for diffs], Fri Mar 31 21:58:08 2006 UTC (15 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: chap-midi-nbase, chap-midi-base, chap-midi, abandoned-netbsd-4-base, abandoned-netbsd-4
Changes since 1.113: +7 -9 lines
Diff to previous 1.113 (colored)

Add some coverity allocation comments, and change the way the allocator
functions work. When they allocate storage that needs to be freed, instead
of setting a boolean, set the pointer to be freed. Plug some more memory
leaks found by inspection.

Revision 1.113 / (download) - annotate - [select for diffs], Fri Mar 31 21:05:34 2006 UTC (15 years, 6 months ago) by dsl
Branch: MAIN
Changes since 1.112: +4 -4 lines
Diff to previous 1.112 (colored)

There is no need to count jobs and job tokens.
If we don't create the job pipe, use the '-j n' option to limit the number
of tokens we will remove from the pipe.

Revision 1.112 / (download) - annotate - [select for diffs], Fri Mar 31 20:30:46 2006 UTC (15 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.111: +14 -10 lines
Diff to previous 1.111 (colored)

Coverity CID 544: Fix memory leak.

Revision 1.111 / (download) - annotate - [select for diffs], Tue Mar 28 17:41:35 2006 UTC (15 years, 6 months ago) by ginsbach
Branch: MAIN
Changes since 1.110: +13 -9 lines
Diff to previous 1.110 (colored)

- Change where variable substitution is done when processing traditional
  include statements so that if a variable expands to more than one file
  name make will "do the right thing".
- Add additional debug print

Reviewed by christos.

Revision 1.110 / (download) - annotate - [select for diffs], Sun Feb 26 22:45:46 2006 UTC (15 years, 7 months ago) by apb
Branch: MAIN
Changes since 1.109: +6 -3 lines
Diff to previous 1.109 (colored)

Make ".WAIT" apply recursively to all children of nodes on the right
hand side of the .WAIT, except when the recursive interpretation would
cause a cycle in the dependency graph.

Discussed in tech-toolchain.  Reviewed by christos, sjg.

Revision 1.109 / (download) - annotate - [select for diffs], Sat Feb 11 20:59:49 2006 UTC (15 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.108: +30 -14 lines
Diff to previous 1.108 (colored)

Add some more debug prints.

Revision 1.108 / (download) - annotate - [select for diffs], Sun Jan 22 19:54:55 2006 UTC (15 years, 8 months ago) by dsl
Branch: MAIN
Changes since 1.107: +13 -6 lines
Diff to previous 1.107 (colored)

Make .NOTPARALLEL stop the job engine issuing more than one token (instead
of trying to de-jobify the make.
You can now put .NOTPARALLEL in a submake of a recursive make (where it is
using a job-token pipe from the outer make and have it only run a single job.
You can also specify .NOTPARRALEL in the root makefile of a large recursive
make and have the submakes run multiple commands.
Add some diagnostics printfs (enabled with -dp) to the parser.

Revision 1.107 / (download) - annotate - [select for diffs], Sat Dec 24 20:52:20 2005 UTC (15 years, 9 months ago) by perry
Branch: MAIN
Changes since 1.106: +5 -5 lines
Diff to previous 1.106 (colored)

Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.

Revision 1.106 / (download) - annotate - [select for diffs], Tue Aug 9 21:36:42 2005 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.105: +4 -4 lines
Diff to previous 1.105 (colored)

Add typedefs for DuplicateProc and FreeProc from Max Okumoto.

Revision 1.105 / (download) - annotate - [select for diffs], Mon Aug 8 16:42:54 2005 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.104: +25 -25 lines
Diff to previous 1.104 (colored)

From Max Okumoto:
- Remove casts to NULL.
- Remove space between cast and object.

Revision 1.104 / (download) - annotate - [select for diffs], Fri Aug 5 00:53:18 2005 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.103: +8 -8 lines
Diff to previous 1.103 (colored)

More KNF cleanups from Max Okumoto

Revision 1.103 / (download) - annotate - [select for diffs], Mon Jul 25 22:55:58 2005 UTC (16 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.102: +46 -46 lines
Diff to previous 1.102 (colored)

Whitespace KNF cleanup from Max Okumoto

Revision 1.97.2.3 / (download) - annotate - [select for diffs], Sat Jul 2 16:23:07 2005 UTC (16 years, 3 months ago) by tron
Branch: netbsd-3
CVS Tags: netbsd-3-1-RELEASE, netbsd-3-1-RC4, netbsd-3-1-RC3, netbsd-3-1-RC2, netbsd-3-1-RC1, netbsd-3-1-1-RELEASE, netbsd-3-1, netbsd-3-0-RELEASE, netbsd-3-0-RC6, netbsd-3-0-RC5, netbsd-3-0-RC4, netbsd-3-0-RC3, netbsd-3-0-RC2, netbsd-3-0-RC1, netbsd-3-0-3-RELEASE, netbsd-3-0-2-RELEASE, netbsd-3-0-1-RELEASE, netbsd-3-0
Changes since 1.97.2.2: +7 -0 lines
Diff to previous 1.97.2.2 (colored) to branchpoint 1.97 (colored) next main 1.98 (colored)

Pull up revision 1.102 (requested by rpaulo in ticket #491):
PR standards/17732: make doesn't honour escaped comment lines. Now with
a real fix.
Ok'ed by sjg and hubertf.

Revision 1.102 / (download) - annotate - [select for diffs], Sat Jun 18 14:32:04 2005 UTC (16 years, 4 months ago) by rpaulo
Branch: MAIN
Changes since 1.101: +10 -3 lines
Diff to previous 1.101 (colored)

PR standards/17732: make doesn't honour escaped comment lines. Now with
a real fix.
Ok'ed by sjg and hubertf.

Revision 1.101 / (download) - annotate - [select for diffs], Thu Jun 16 14:54:10 2005 UTC (16 years, 4 months ago) by rpaulo
Branch: MAIN
Changes since 1.100: +0 -8 lines
Diff to previous 1.100 (colored)

Back it out while I'm working on a real fix without introducing new bugs.

Revision 1.97.2.2 / (download) - annotate - [select for diffs], Thu Jun 16 09:53:24 2005 UTC (16 years, 4 months ago) by tron
Branch: netbsd-3
Changes since 1.97.2.1: +0 -8 lines
Diff to previous 1.97.2.1 (colored) to branchpoint 1.97 (colored)

Backout ticket 458, it causes PR toolchain/30536.

Revision 1.97.2.1 / (download) - annotate - [select for diffs], Thu Jun 16 09:35:23 2005 UTC (16 years, 4 months ago) by tron
Branch: netbsd-3
Changes since 1.97: +11 -3 lines
Diff to previous 1.97 (colored)

Pull up revision 1.100 (requested by rpaulo in ticket #458):
PR bin/17732: Allow make to understand escaped comments.
Approved by sjg, christos and hubertf.

Revision 1.100 / (download) - annotate - [select for diffs], Wed Jun 15 22:26:54 2005 UTC (16 years, 4 months ago) by rpaulo
Branch: MAIN
Changes since 1.99: +11 -3 lines
Diff to previous 1.99 (colored)

PR bin/17732: Allow make to understand escaped comments.
Approved by sjg, christos and hubertf.

Revision 1.99 / (download) - annotate - [select for diffs], Sun May 8 00:38:48 2005 UTC (16 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.98: +4 -9 lines
Diff to previous 1.98 (colored)

Now that dependencies in .BEGIN, .END, and .INTERRUPT work, allow them.

Revision 1.98 / (download) - annotate - [select for diffs], Sun May 1 01:25:36 2005 UTC (16 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.97: +10 -5 lines
Diff to previous 1.97 (colored)

Don't accept dependencies for .BEGIN, .END, and .INTERRUPT since they
don't make sense or work anyway.

Revision 1.97 / (download) - annotate - [select for diffs], Wed Feb 16 15:11:52 2005 UTC (16 years, 8 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-3-base
Branch point for: netbsd-3
Changes since 1.96: +84 -84 lines
Diff to previous 1.96 (colored)

PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]

Revision 1.95.2.1 / (download) - annotate - [select for diffs], Mon May 10 15:42:45 2004 UTC (17 years, 5 months ago) by tron
Branch: netbsd-2-0
CVS Tags: netbsd-2-base, netbsd-2-1-RELEASE, netbsd-2-1-RC6, netbsd-2-1-RC5, netbsd-2-1-RC4, netbsd-2-1-RC3, netbsd-2-1-RC2, netbsd-2-1-RC1, netbsd-2-1, netbsd-2-0-RELEASE, netbsd-2-0-RC5, netbsd-2-0-RC4, netbsd-2-0-RC3, netbsd-2-0-RC2, netbsd-2-0-RC1, netbsd-2-0-3-RELEASE, netbsd-2-0-2-RELEASE, netbsd-2-0-1-RELEASE, netbsd-2
Changes since 1.95: +4 -4 lines
Diff to previous 1.95 (colored) next main 1.96 (colored)

Pull up revision 1.96 (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

Revision 1.96 / (download) - annotate - [select for diffs], Fri May 7 00:04:40 2004 UTC (17 years, 5 months ago) by ross
Branch: MAIN
Changes since 1.95: +4 -4 lines
Diff to previous 1.95 (colored)

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

Revision 1.95 / (download) - annotate - [select for diffs], Sat Mar 6 03:57:07 2004 UTC (17 years, 7 months ago) by enami
Branch: MAIN
CVS Tags: netbsd-2-0-base
Branch point for: netbsd-2-0
Changes since 1.94: +18 -12 lines
Diff to previous 1.94 (colored)

Print useful line number on error while executing .for directive.

Revision 1.94 / (download) - annotate - [select for diffs], Thu Aug 7 11:14:56 2003 UTC (18 years, 2 months ago) by agc
Branch: MAIN
Changes since 1.93: +33 -3 lines
Diff to previous 1.93 (colored)

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.

Revision 1.93 / (download) - annotate - [select for diffs], Mon Jul 14 18:19:13 2003 UTC (18 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.92: +15 -13 lines
Diff to previous 1.92 (colored)

Pass WARNS=3

Revision 1.92 / (download) - annotate - [select for diffs], Sun Mar 23 22:48:35 2003 UTC (18 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.91: +6 -4 lines
Diff to previous 1.91 (colored)

Comment in ParseDoSrc was no longer accurate.
Explain the difference between handling of src node
in ParseDoSpecialSrc cf. ParseDoSrc.

Revision 1.91 / (download) - annotate - [select for diffs], Sun Mar 23 05:11:22 2003 UTC (18 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.90: +4 -4 lines
Diff to previous 1.90 (colored)

We are supposed to pass the node for our expanded src to ParseAddDep
for each entry in allsrc.  Just like ParseDoSrc.  The only difference
in handling these special expanded srcs in in the call to ParseLinkSrc.

Revision 1.90 / (download) - annotate - [select for diffs], Sat Mar 22 23:41:02 2003 UTC (18 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.89: +31 -7 lines
Diff to previous 1.89 (colored)

ParseDoSpecialSrc: since we're already being called for each target
make it depend only on the expansion of src that matches.
Otherwise given:

a b c:  ${.TARGET}.x

a b and c will each depend on a.x, b.x and c.x

Further, we only _need_ to do ParseDoSpecialSrc if a .WAIT appears
in the source list - so establish that up front.

Revision 1.89 / (download) - annotate - [select for diffs], Fri Mar 21 19:14:53 2003 UTC (18 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.88: +10 -3 lines
Diff to previous 1.88 (colored)

don't mess with suffix rules.

Revision 1.88 / (download) - annotate - [select for diffs], Fri Mar 21 16:48:21 2003 UTC (18 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.87: +4 -4 lines
Diff to previous 1.87 (colored)

Missed a s/tn->name/pref/

Revision 1.87 / (download) - annotate - [select for diffs], Fri Mar 21 15:52:57 2003 UTC (18 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.86: +79 -7 lines
Diff to previous 1.86 (colored)

Add ParseDoSpecialSrc() to handle srcs that refer to ${.TARGET} etc.
These are expanded for each target (set in its own context) and
ParseDoSrc() is then called for the expanded src.

PR: 20828
Reviewed by: christos

Revision 1.86 / (download) - annotate - [select for diffs], Sun Dec 1 05:53:30 2002 UTC (18 years, 10 months ago) by sjg
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.85: +10 -10 lines
Diff to previous 1.85 (colored)

Parse_DoVar: don't free cp until we are done with it!

Reviewed by: hannken

Revision 1.85 / (download) - annotate - [select for diffs], Tue Nov 26 06:13:01 2002 UTC (18 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.84: +15 -3 lines
Diff to previous 1.84 (colored)

Whenever we update .PATH, set the variable ${.PATH} to reflect the
search list that will be used.  Thus 'dot' and 'cur' will appear in
${.PATH} either at the start or end depending on .DOTLAST even though
they are not strictly in dirSearchPath.

When .CURDIR is assigned to - re-set the 'cur' Path.

Finally, when checking subdirs, look in 'dot' and 'cur' (first or last
depending on .DOTLAST) just as we do in other situations.

Revision 1.84 / (download) - annotate - [select for diffs], Sat Jun 15 18:24:57 2002 UTC (19 years, 4 months ago) by wiz
Branch: MAIN
Changes since 1.83: +119 -150 lines
Diff to previous 1.83 (colored)

Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.

Revision 1.83 / (download) - annotate - [select for diffs], Wed Mar 20 18:10:31 2002 UTC (19 years, 7 months ago) by pk
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.82: +5 -3 lines
Diff to previous 1.82 (colored)

Xref: parse.c, rev 1.46; make.c, rev 1.23

In these revisions `::' dependency handling was simplified by not linking
the cohort nodes into the dependency graph. This broke dependency checking
on all but the first instance of a `::' target since all of the cohort nodes
now just form a collection of disconnected dependency graphs.

Fix this by keeping a back-reference in each cohort to its leader (the
first instance of a :: node with the same name) and a count of the number
of cohorts that need to be made before dependent nodes are scheduled.

Classically, we'd need six centurions for cohort, but in this case one
suffices...

Revision 1.82 / (download) - annotate - [select for diffs], Thu Feb 21 22:21:34 2002 UTC (19 years, 8 months ago) by reinoud
Branch: MAIN
Changes since 1.81: +70 -76 lines
Diff to previous 1.81 (colored)

Pull every file parsing context into one structure instead of using a few
file global variables... adding an extra context variable is thus allmost
trivial now.

Revision 1.81 / (download) - annotate - [select for diffs], Sun Feb 17 23:53:46 2002 UTC (19 years, 8 months ago) by pk
Branch: MAIN
Changes since 1.80: +4 -3 lines
Diff to previous 1.80 (colored)

Add the default main target to the ${.TARGETS} variable, too.

Revision 1.80 / (download) - annotate - [select for diffs], Mon Feb 4 17:24:56 2002 UTC (19 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.79: +3 -5 lines
Diff to previous 1.79 (colored)

Remove OP_NOSUFF, fix OP_MADE in compat mode [from pk], and make the OP_MADE
comment reflect reality.

Revision 1.79 / (download) - annotate - [select for diffs], Sun Feb 3 21:41:44 2002 UTC (19 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.78: +5 -3 lines
Diff to previous 1.78 (colored)

Bring down the number of stat(2) system calls from 682 to 294. This change
adds a .NOSUFF directive that has been applied to targets that have been
already made, and are not supposed to have suffix rules applied to them.

Revision 1.78 / (download) - annotate - [select for diffs], Sun Jan 27 01:50:55 2002 UTC (19 years, 8 months ago) by reinoud
Branch: MAIN
Changes since 1.77: +8 -11 lines
Diff to previous 1.77 (colored)

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.

Revision 1.77 / (download) - annotate - [select for diffs], Sat Jan 26 20:42:14 2002 UTC (19 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.76: +50 -14 lines
Diff to previous 1.76 (colored)

Process escaped characters properly. Now:

foo\:bar:
	touch $@

works. Of course I am lazy right now, and I am not removing the '\' escapes
so the output looks fine, but it is functionally correct.

Revision 1.76 / (download) - annotate - [select for diffs], Thu Jan 24 01:39:03 2002 UTC (19 years, 8 months ago) by reinoud
Branch: MAIN
Changes since 1.75: +19 -20 lines
Diff to previous 1.75 (colored)

Small update to make(1) to let it follow more its own guidelines ! ... This
patch makes sure that files included using ".include <bsd.own.mk>" are
really looked for in the system make file directory or in the specified -m
paths instead of allways looking in the other -I and .PATH specified paths
... This speeds up the make a few procents at times for all the system make
files are now found directly instead of searching several paths, saving a
lot of stat() calls.

The number of stat calls is still exorbirant hight though... 910 or so for
making `make' alone ....

Revision 1.75 / (download) - annotate - [select for diffs], Wed Oct 31 03:59:42 2001 UTC (19 years, 11 months ago) by tv
Branch: MAIN
Changes since 1.74: +13 -5 lines
Diff to previous 1.74 (colored)

Overhaul the initialization and handling of .OBJDIR:

* Replace chdir_verify_path() with Main_SetObjdir(), which can be called
  externally, and can take a "const char *".  (There's a lot of non-const
  "char *" passing around in var.c of what should be const strings....)

* Rewrite the initial "find my .OBJDIR" code to make use of the new
  function.  This still functions as it had in the past, but the comment
  above this block was changed to reflect reality:  if MAKEOBJDIRPREFIX
  or MAKEOBJDIR are set in the environment, then *only that value* is
  tried; make does not fall back to obj.MACHINE, obj, and /usr/obj/`pwd`
  as it would without these env vars set.

* Add a new special target, .OBJDIR:, which when parsed will cause make to
  change to a new object directory and reset .OBJDIR, and PWD in the
  environment.  This will allow some makefiles (mainly, src/tools)
  to override the default objdir semantics in order to add custom logic.

Revision 1.74 / (download) - annotate - [select for diffs], Wed Oct 31 01:15:57 2001 UTC (19 years, 11 months ago) by tv
Branch: MAIN
Changes since 1.73: +10 -6 lines
Diff to previous 1.73 (colored)

Allow "-m" to be used in a .MAKEFLAGS: special target and get it to work.
(This splits out the "default system include paths" into its own Lst
variable, and uses it only if sysIncPath is empty.  This allows sysIncPath
to be filled in by the Makefile itself.)

Revision 1.73 / (download) - annotate - [select for diffs], Mon Sep 24 13:22:35 2001 UTC (20 years ago) by wiz
Branch: MAIN
Changes since 1.72: +3 -4 lines
Diff to previous 1.72 (colored)

va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.

Revision 1.72 / (download) - annotate - [select for diffs], Mon Aug 20 12:00:55 2001 UTC (20 years, 2 months ago) by wiz
Branch: MAIN
Changes since 1.71: +4 -4 lines
Diff to previous 1.71 (colored)

precede, not preceed.

Revision 1.71 / (download) - annotate - [select for diffs], Tue Jul 3 18:08:51 2001 UTC (20 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.70: +4 -3 lines
Diff to previous 1.70 (colored)

add .USEBEFORE Attribute

Revision 1.70 / (download) - annotate - [select for diffs], Tue Jun 12 23:36:18 2001 UTC (20 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.69: +12 -12 lines
Diff to previous 1.69 (colored)

Add 4th arg (flags) to Var_Set so that VarLoopExpand can tell it not
to export interator variables when using context VAR_CMD.

Reviewed: christos

Revision 1.69 / (download) - annotate - [select for diffs], Sun Jun 10 02:31:00 2001 UTC (20 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.68: +5 -5 lines
Diff to previous 1.68 (colored)

Simplify the exporting of VAR_CMD's via MAKEFLAGS.
We now just list the names of such variables in .MAKEOVERRIDES.
When we come to export MAKEFLAGS we quote the value of each exported variable
using :Q, using: ${.MAKEOVERRIDES:O:u:@v@$v=${$v:Q}@}
The :O:u suppresses duplicate names.
Also modifed Parse_DoVar to re-export MAKEFLAGS whenever .MAKEOVERRIDES
is assigned to so .MAKEOVERRIDES+= PATH will export PATH=${PATH:Q}
to the environment, while .MAKEOVERRIDES= will disable export of VAR_CMD's.

Revision 1.68 / (download) - annotate - [select for diffs], Sat Jun 9 05:22:47 2001 UTC (20 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.67: +5 -3 lines
Diff to previous 1.67 (colored)

Modify handling of command line variable assignments and their exporting
via MAKEFLAGS.  Instead of appending them directly to .MAKEFLAGS, put
them in .MAKEOVERRIDES (and ensure they are quoted).  This is now done
in Var_Set when it exports VAR_CMD's.
Use ExportMAKEFLAGS() to export MAKEFLAGS, using the combined content
of .MAKEFLAGS and .MAKEOVERRIDES (with duplicate supression).
If .MAKEFLAGS is assigned to in a Makefile, ExportMAKEFLAGS is called again.
This allows a line like:
.MAKEOVERRIDES=
to effectively stop the exporting of the command line vars in MAKEFLAGS.

Revision 1.67 / (download) - annotate - [select for diffs], Sat Jun 2 18:04:44 2001 UTC (20 years, 4 months ago) by sommerfeld
Branch: MAIN
Changes since 1.66: +4 -4 lines
Diff to previous 1.66 (colored)

Avoid being overly specific since the unresolved merge conflict tags
we detect could have come from something other than cvs.

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jun 2 16:17:08 2001 UTC (20 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.65: +5 -4 lines
Diff to previous 1.65 (colored)

mention `cvs' in the the previous hack so that the clueless get a clue.

Revision 1.65 / (download) - annotate - [select for diffs], Sat Jun 2 14:25:23 2001 UTC (20 years, 4 months ago) by sommerfeld
Branch: MAIN
Changes since 1.64: +11 -5 lines
Diff to previous 1.64 (colored)

Gratuitous make(1) hack of the morning: if operator-less lines start
with merge delimeters (<<<<<<, ======, >>>>>>), report "Makefile
contains unresolved merge conflict" rather than "Need an operator".

Revision 1.64 / (download) - annotate - [select for diffs], Fri Jun 1 20:33:38 2001 UTC (20 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.63: +4 -3 lines
Diff to previous 1.63 (colored)

A number of semi-related changes.
1. make -dx turns on DEBUG_SHELL which causes sh -x to be used where
   possible.
2. PrintOnError() is now called when make is stopping due to an error.
   This routine reports the curdir and the value of any variables listed
   in MAKE_PRINT_VAR_ON_ERROR.
3. Variables set via command line, are propagated to child-makes via
   MAKEFLAGS.  This behaviour appears to be necessary for POSIX (according
   to the GNU folk anyway).
4. Do not reset MAKEFILE when reading ".depend" as this rather eliminates the
   usefulness of ${MAKEFILE}.
5. Added ${.newline} as a simple means of being able to include \n in the
   result of a :@ loop expansion.
6. Set ${MAKE_VERSION} if defined.  Need to come up with a useful value.

Reviewed: christos

Revision 1.63 / (download) - annotate - [select for diffs], Fri Feb 23 21:11:38 2001 UTC (20 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.62: +15 -7 lines
Diff to previous 1.62 (colored)

PR/12251: Thomas Klausner: Make core dumps on unclosed conditional.
Well, it should say 'make core-dumps on any error on the primary makefile'.
This was a result of the new changes to print the path to the parsed
Makefile... Made the code a lot more conservative, plus prepended <progname>:
to each message.

Revision 1.62 / (download) - annotate - [select for diffs], Sun Jan 14 20:54:16 2001 UTC (20 years, 9 months ago) by mycroft
Branch: MAIN
Changes since 1.61: +8 -6 lines
Diff to previous 1.61 (colored)

Once again, do the warning in a format that doesn't completely blow, and that
corresponds with text in the man page.  Also split it into 2 pieces that can
both be used with, e.g., C-x` in Emacs.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Jan 14 06:02:25 2001 UTC (20 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.60: +7 -7 lines
Diff to previous 1.60 (colored)

convert error messages into english

Revision 1.60 / (download) - annotate - [select for diffs], Sun Jan 14 05:41:08 2001 UTC (20 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.59: +11 -3 lines
Diff to previous 1.59 (colored)

We cannot override commands yet, ignore the additional sets for now.
This will be reverted when the tree is fixed.

Revision 1.59 / (download) - annotate - [select for diffs], Sun Jan 14 05:34:06 2001 UTC (20 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.58: +32 -8 lines
Diff to previous 1.58 (colored)

- make the second list of commands override the first like gmake does
- remember where the first command definition occured so that we can debug
  things.

Revision 1.58 / (download) - annotate - [select for diffs], Sat Jan 13 20:36:58 2001 UTC (20 years, 9 months ago) by cgd
Branch: MAIN
Changes since 1.57: +1 -3 lines
Diff to previous 1.57 (colored)

back out the change in rev 1.57.  it was misguided; see discussion
on current-users (subject "build problem - multibyte.c").

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jan 12 09:27:44 2001 UTC (20 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.56: +6 -4 lines
Diff to previous 1.56 (colored)

only print the 'duplicate script for target' warning if
parseWarnFatal is on

Revision 1.56 / (download) - annotate - [select for diffs], Wed Jan 10 15:54:00 2001 UTC (20 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.55: +16 -6 lines
Diff to previous 1.55 (colored)

PR/11800: Chris Demetriou: Add -W flag to exit on parse warnings.
While I am here, s/make:.*"/%s:\1", progname/

Revision 1.55 / (download) - annotate - [select for diffs], Sun Jan 7 06:08:33 2001 UTC (20 years, 9 months ago) by sjg
Branch: MAIN
Changes since 1.54: +18 -4 lines
Diff to previous 1.54 (colored)

Always try an give the absolute pathname of the Makefile that we got an error in.
Use .PARSEDIR if set and not '.', otherwise .CURDIR to qualify the Makefile's path.

Revision 1.54 / (download) - annotate - [select for diffs], Tue Dec 5 17:07:01 2000 UTC (20 years, 10 months ago) by sommerfeld
Branch: MAIN
Changes since 1.53: +4 -4 lines
Diff to previous 1.53 (colored)

Boolean consistancy (use TRUE, not 1)

Revision 1.41.2.2 / (download) - annotate - [select for diffs], Thu Oct 19 16:31:52 2000 UTC (21 years ago) by he
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH003
Changes since 1.41.2.1: +7 -5 lines
Diff to previous 1.41.2.1 (colored) to branchpoint 1.41 (colored) next main 1.42 (colored)

Pull up revision 1.53 (requested by he):
  Format string cleanup.

Revision 1.52.2.1 / (download) - annotate - [select for diffs], Wed Oct 18 01:32:46 2000 UTC (21 years ago) by tv
Branch: netbsd-1-5
CVS Tags: netbsd-1-5-RELEASE, netbsd-1-5-PATCH003, netbsd-1-5-PATCH002, netbsd-1-5-PATCH001, netbsd-1-5-BETA2, netbsd-1-5-BETA
Changes since 1.52: +7 -5 lines
Diff to previous 1.52 (colored) next main 1.53 (colored)

Pullup usr.bin string format fixes [is].
See "cvs log" for explicit revision numbers per file, from sommerfeld.

Revision 1.53 / (download) - annotate - [select for diffs], Wed Oct 11 14:46:12 2000 UTC (21 years ago) by is
Branch: MAIN
Changes since 1.52: +7 -5 lines
Diff to previous 1.52 (colored)

More format string cleanup by sommerfeld.

Revision 1.48.2.1 / (download) - annotate - [select for diffs], Fri Jun 23 16:39:44 2000 UTC (21 years, 4 months ago) by minoura
Branch: minoura-xpg4dl
Changes since 1.48: +7 -9 lines
Diff to previous 1.48 (colored) next main 1.49 (colored)

Sync w/ netbsd-1-5-base.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jun 11 07:39:53 2000 UTC (21 years, 4 months ago) by mycroft
Branch: MAIN
CVS Tags: netbsd-1-5-base, netbsd-1-5-ALPHA2
Branch point for: netbsd-1-5
Changes since 1.51: +7 -9 lines
Diff to previous 1.51 (colored)

Readd optimization last night.  Problems earlier were partially due to the
arguments names on one function being swapped (by a previous author).

Do not do any duplicate suppression when a source list is created.  Instead:
* OP_MADE protects against trying to make the source multiple times.
* A new OP_MARK flag is introduced to suppress duplicates while expanding
  the .ALLSRC variable and .USE targets.
This turns the O(n^2) insertion into O(n) in most cases.

This is tested with a `make build' and some special test cases.

Revision 1.51 / (download) - annotate - [select for diffs], Sat Jun 10 22:28:34 2000 UTC (21 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.50: +9 -7 lines
Diff to previous 1.50 (colored)

Back out last night's optimization for now.

Revision 1.50 / (download) - annotate - [select for diffs], Sat Jun 10 21:44:08 2000 UTC (21 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.49: +7 -13 lines
Diff to previous 1.49 (colored)

Introduce an OP_MARK bit, and use it to suppress duplicates during .ALLSRC
and .USE expansion.  Also, remove some more Lst_Member() checks that are now
redundant.

Revision 1.49 / (download) - annotate - [select for diffs], Sat Jun 10 13:48:48 2000 UTC (21 years, 4 months ago) by mycroft
Branch: MAIN
Changes since 1.48: +7 -3 lines
Diff to previous 1.48 (colored)

Nuke an `optimization' that made source list creation O(n^2).  This may cause
more memory to be used with stupid Makefiles, but it saves a fair amount of
time (~13% just for libc) with sane ones.

Revision 1.48 / (download) - annotate - [select for diffs], Thu May 11 08:22:40 2000 UTC (21 years, 5 months ago) by sjg
Branch: MAIN
CVS Tags: minoura-xpg4dl-base
Branch point for: minoura-xpg4dl
Changes since 1.47: +14 -3 lines
Diff to previous 1.47 (colored)

allow .POSIX to define %POSIX as in FreeBSD

Revision 1.47 / (download) - annotate - [select for diffs], Thu Sep 16 00:54:15 1999 UTC (22 years, 1 month ago) by mycroft
Branch: MAIN
CVS Tags: wrstuden-devbsize-base, wrstuden-devbsize-19991221, wrstuden-devbsize, comdex-fall-1999-base, comdex-fall-1999
Changes since 1.46: +5 -5 lines
Diff to previous 1.46 (colored)

Some minor cleanup of :: tests.

Revision 1.46 / (download) - annotate - [select for diffs], Wed Sep 15 10:47:44 1999 UTC (22 years, 1 month ago) by mycroft
Branch: MAIN
Changes since 1.45: +17 -40 lines
Diff to previous 1.45 (colored)

Rework how :: dependencies are handled.
Build a list of `cohorts' as before, but do *not* link each one into all the
parent nodes; instead, copy the `cohort' lists into the stream of targets to
be built inside Make_ExpandUse().  Also do the attribute propagation as a
separate pass after parsing.
This eliminates several O(n^2) algorithms.

Revision 1.45 / (download) - annotate - [select for diffs], Wed Sep 15 08:43:22 1999 UTC (22 years, 1 month ago) by mycroft
Branch: MAIN
Changes since 1.44: +11 -3 lines
Diff to previous 1.44 (colored)

Don't bother iterating through all the data structures to free(3) everything
right before exiting.
(The code is still present, `#ifdef CLEANUP', in case someone needs it...)

Revision 1.44 / (download) - annotate - [select for diffs], Mon Aug 9 21:06:28 1999 UTC (22 years, 2 months ago) by aidan
Branch: MAIN
Changes since 1.43: +46 -3 lines
Diff to previous 1.43 (colored)

Added .PARSEDIR and .PARSEFILE variables to make(1).

Revision 1.43 / (download) - annotate - [select for diffs], Wed Aug 4 02:54:57 1999 UTC (22 years, 2 months ago) by ross
Branch: MAIN
Changes since 1.42: +5 -5 lines
Diff to previous 1.42 (colored)

Trivial speed hack.

Revision 1.41.2.1 / (download) - annotate - [select for diffs], Mon Jun 21 16:37:31 1999 UTC (22 years, 4 months ago) by perry
Branch: netbsd-1-4
CVS Tags: netbsd-1-4-PATCH002, netbsd-1-4-PATCH001
Changes since 1.41: +11 -3 lines
Diff to previous 1.41 (colored)

pullup 1.41->1.42 (christos)

Revision 1.42 / (download) - annotate - [select for diffs], Wed Jun 2 18:47:11 1999 UTC (22 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.41: +11 -3 lines
Diff to previous 1.41 (colored)

Fix awful bug where:

	V := $V foo
	V := $V bar

would report that variable V is recursive...

Revision 1.41 / (download) - annotate - [select for diffs], Tue Nov 17 23:56:23 1998 UTC (22 years, 11 months ago) by ross
Branch: MAIN
CVS Tags: netbsd-1-4-base, netbsd-1-4-RELEASE
Branch point for: netbsd-1-4
Changes since 1.40: +4 -4 lines
Diff to previous 1.40 (colored)

Fix a bug that apparently prevented, since day 1, the .-include / .sinclude
feature from ever working. Also, fix the man page that incorrectly described
the syntax of the feature that didn't work.

Revision 1.40 / (download) - annotate - [select for diffs], Fri Nov 6 23:31:09 1998 UTC (22 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.39: +16 -16 lines
Diff to previous 1.39 (colored)

- full prototypes
- more conservative printf
- char -> unsigned char

Revision 1.39 / (download) - annotate - [select for diffs], Fri Sep 18 20:15:36 1998 UTC (23 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.38: +5 -6 lines
Diff to previous 1.38 (colored)

PR/6174: ITOH Yasufumi: Purify bug and a compile error in utility code.

Revision 1.38 / (download) - annotate - [select for diffs], Thu Aug 6 13:42:22 1998 UTC (23 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.37: +206 -116 lines
Diff to previous 1.37 (colored)

- Add {.,}[s-]include for silent include file failures
- Make traditional include statement include more than one file if present
  on the line.

Keeping up with the other's :-)

Revision 1.36.2.1 / (download) - annotate - [select for diffs], Fri May 8 06:12:08 1998 UTC (23 years, 5 months ago) by mycroft
Branch: netbsd-1-3
CVS Tags: netbsd-1-3-PATCH003-CANDIDATE2, netbsd-1-3-PATCH003-CANDIDATE1, netbsd-1-3-PATCH003-CANDIDATE0, netbsd-1-3-PATCH003, netbsd-1-3-PATCH002
Changes since 1.36: +9 -9 lines
Diff to previous 1.36 (colored) next main 1.37 (colored)

Sync with trunk, per request of christos.

Revision 1.37 / (download) - annotate - [select for diffs], Mon Mar 23 08:52:48 1998 UTC (23 years, 7 months ago) by fair
Branch: MAIN
Changes since 1.36: +9 -9 lines
Diff to previous 1.36 (colored)

patch from PR#3573 to rename a variable "main" to "mainList"

Revision 1.36 / (download) - annotate - [select for diffs], Sun Sep 28 03:31:09 1997 UTC (24 years ago) by lukem
Branch: MAIN
CVS Tags: netbsd-1-3-base, netbsd-1-3-RELEASE, netbsd-1-3-PATCH001, netbsd-1-3-BETA
Branch point for: netbsd-1-3
Changes since 1.35: +6 -2 lines
Diff to previous 1.35 (colored)

wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jul 11 20:17:37 1997 UTC (24 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.34: +5 -5 lines
Diff to previous 1.34 (colored)

#if __STDC__ -> #ifdef __STDC__

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jul 1 21:17:34 1997 UTC (24 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.33: +3 -2 lines
Diff to previous 1.33 (colored)

Add WARNS=1
RCSID police

Revision 1.33 / (download) - annotate - [select for diffs], Fri May 9 04:08:26 1997 UTC (24 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.32: +12 -2 lines
Diff to previous 1.32 (colored)

Make sure to propagate OP_PHONY to all cohorts that already existed.

Revision 1.32 / (download) - annotate - [select for diffs], Thu May 8 21:24:48 1997 UTC (24 years, 5 months ago) by gwr
Branch: MAIN
Changes since 1.31: +7 -4 lines
Diff to previous 1.31 (colored)

Add the new .NOPATH feature which can be used to disable .PATH search
for particular targets, i.e. .depend, objects, etc.  (from Christos).

Revision 1.31 / (download) - annotate - [select for diffs], Wed May 7 13:12:33 1997 UTC (24 years, 5 months ago) by mycroft
Branch: MAIN
Changes since 1.30: +3 -3 lines
Diff to previous 1.30 (colored)

Copy the .PHONY attribute to the cohorts of a double dependency.

Revision 1.30 / (download) - annotate - [select for diffs], Fri May 2 14:24:30 1997 UTC (24 years, 5 months ago) by christos
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

- Target searching addition:
	Make used to only use the search path for nodes that were pure
	sources (not targets of other sources). This has been corrected
	and now gnu-autoconf generated Makefiles work in directories other
	than the source one.

- Suffix transformation rescanning:
	Suffix transformations (.c.o:; cc ...) were only recognized in
	the past when both suffixes were members of the suffix list.
	Thus a sequence like:
		.z.b:
			echo ${.TARGET}
		.SUFFIXES: .z
	would cause .z.b: to be inserted as a regular target (and the main
	target in this case). Other make programs always add rules that
	start with a period in the transformation list and never consider
	them as targets. We cannot do that (consider .depend files) so we
	resort to scanning the list of the current targets every time a
	suffix gets added, and we mutate existing targets that are now
	valid transformation rules into transformation rules. If the
	transformed target was also the main target, we set the main target
	to be the next target in the targets list.

Revision 1.29 / (download) - annotate - [select for diffs], Mon Mar 10 21:20:04 1997 UTC (24 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.28: +3 -2 lines
Diff to previous 1.28 (colored)

Add a .MADE directive to indicated that the children of a target are
up-to-date, even when they are not. This is to simulate our current
make install behavior with proper dependencies.

Revision 1.22.4.1 / (download) - annotate - [select for diffs], Sun Jan 26 05:51:48 1997 UTC (24 years, 8 months ago) by rat
Branch: netbsd-1-2
CVS Tags: netbsd-1-2-PATCH001
Changes since 1.22: +149 -260 lines
Diff to previous 1.22 (colored) next main 1.23 (colored)

Update make(1) from trunk, by request from Christos Zoulas.  Fixes many bugs.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Dec 31 17:55:28 1996 UTC (24 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

add a missing 'static' decl.

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Sat Dec 28 04:41:13 1996 UTC (24 years, 9 months ago) by tls
Branch: WFJ-920714, CSRG
CVS Tags: lite-2
Changes since 1.1.1.1: +643 -194 lines
Diff to previous 1.1.1.1 (colored)

Import 4.4BSD-Lite2 sources onto CSRG branch (already merged at head)

Revision 1.27 / (download) - annotate - [select for diffs], Wed Nov 6 17:59:20 1996 UTC (24 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.26: +100 -119 lines
Diff to previous 1.26 (colored)

- Merge in FreeBSD and Lite2 changes.
- Fix bug where a non-archive target with a .a suffix would always
  be considered to be out of date, since it does not have a TOC.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Sep 27 02:36:58 1996 UTC (25 years ago) by thorpej
Branch: MAIN
Changes since 1.25: +3 -3 lines
Diff to previous 1.25 (colored)

Fix extra "make:" and newline in error message.
From enami tsugutomo <enami@ba2.so-net.or.jp>, PR #2651.

Revision 1.25 / (download) - annotate - [select for diffs], Fri Sep 13 04:22:09 1996 UTC (25 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.24: +14 -7 lines
Diff to previous 1.24 (colored)

- Fix bug where the first line after a conditionally skipped was not ready
  in its entirety if it contained a continuation.
- Print the whole error line, not just the first 20 characters of it.

Revision 1.24 / (download) - annotate - [select for diffs], Tue Aug 13 16:42:13 1996 UTC (25 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.23: +6 -6 lines
Diff to previous 1.23 (colored)

Add estrdup(), a checked version of strdup and use it.

Revision 1.23 / (download) - annotate - [select for diffs], Tue May 28 23:34:46 1996 UTC (25 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.22: +44 -143 lines
Diff to previous 1.22 (colored)

- Move -D flags from Makefile to config.h and explain what they do. Add
  -Wall -Wno-unused to CFLAGS. Add new define SYSVVARSUB to enable SysV
  style variable substitutions and enable them.
- Add SunOS style command substitutions via SUNSHCMD
- Fix core dump with '{variable = value'

Revision 1.22 / (download) - annotate - [select for diffs], Fri Mar 15 21:52:41 1996 UTC (25 years, 7 months ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-2-base, netbsd-1-2-RELEASE, netbsd-1-2-BETA
Branch point for: netbsd-1-2
Changes since 1.21: +5 -2 lines
Diff to previous 1.21 (colored)

Add PHONY attribute and target. This is the first step to cleanup the
xinstall and xlint crud.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Mar 6 00:15:23 1996 UTC (25 years, 7 months ago) by christos
Branch: MAIN
Changes since 1.20: +2 -21 lines
Diff to previous 1.20 (colored)

Fix PR/2118; apply sysincludes patch.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Feb 17 13:28:09 1996 UTC (25 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.19: +4 -3 lines
Diff to previous 1.19 (colored)

if PR/2090, sysvinclude too optimistic, did not check for space after the
include keyword

Revision 1.19 / (download) - annotate - [select for diffs], Wed Feb 7 23:04:04 1996 UTC (25 years, 8 months ago) by thorpej
Branch: MAIN
Changes since 1.18: +9 -5 lines
Diff to previous 1.18 (colored)

In ParseDoInclude(), make a temporary copy of the current file name
while searching for ""-type include files, since the current file name
might not be a writeable string.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Dec 16 05:03:13 1995 UTC (25 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.17: +89 -16 lines
Diff to previous 1.17 (colored)

- Added .WAIT to synchronize between sources like other pmake variants.
- Updated documentation to include .ORDER .PARALLEL .NO_PARALLEL .NONPARALLEL

Revision 1.17 / (download) - annotate - [select for diffs], Thu Nov 2 23:55:03 1995 UTC (25 years, 11 months ago) by christos
Branch: MAIN
Changes since 1.16: +7 -3 lines
Diff to previous 1.16 (colored)

Minor:
    - ${.PREFIX} should never contain a full pathname
    - Fixed gcc -Wall warnings
Major:
    - compatMake is now FALSE. This means that we are now running in
      full pmake mode:
	  * rules on dependency lines can be executed in parallel and or
	    out of sequence:

	    foo: bar baz

	    can fire the rule for baz before the rule for bar is fired.
	    To enforce bar to be fired before baz, another rule needs to be
	    added. [bar: baz]
	  * adjacent shell commands in a target are now executed by a single
	    invocation of the shell, not one invocation of the shell per line
      (compatMake can be turned off using the -B flag)
    - The -j flag now works... I.e. make -j 4 will fork up to four jobs in
      parallel when it can. The target name is printed before each burst
      of output caused by the target execution as '--- target ---', when j > 1
    - I have changed all the Makefiles so that they work with make -j N, and
      I have tested the whole netbsd by:
	  'make -j 4 cleandir; make -j 4 depend; make -j 4; make -j 4 install'
    - I have not compiled or tested this version of make with -DREMOTE.

Revision 1.16 / (download) - annotate - [select for diffs], Sun Sep 10 03:58:16 1995 UTC (26 years, 1 month ago) by christos
Branch: MAIN
CVS Tags: netbsd-1-1-base, netbsd-1-1-RELEASE, netbsd-1-1-PATCH001, netbsd-1-1
Changes since 1.15: +51 -40 lines
Diff to previous 1.15 (colored)

Fix PR/1443:
Dependency rules with `=' in the lhs are parsed as variable assignments.
E.g., the following Makefile fails:

A=a b c d
all: $(A:%=%b)
$(A:%=%b):
	@echo $@

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 14 15:19:48 1995 UTC (26 years, 4 months ago) by christos
Branch: MAIN
Changes since 1.14: +7 -2 lines
Diff to previous 1.14 (colored)

- $NetBSD$ rcsids
- Fixed so that .[A-Z]* targets that do not match keywords are ignored as
  Posix mandates
- Added .PHONY target keyword

Revision 1.14 / (download) - annotate - [select for diffs], Mon May 15 13:10:10 1995 UTC (26 years, 5 months ago) by ws
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Sort keyword table correctly, so binary search really works

Revision 1.13 / (download) - annotate - [select for diffs], Wed Feb 8 04:36:41 1995 UTC (26 years, 8 months ago) by christos
Branch: MAIN
Changes since 1.12: +4 -3 lines
Diff to previous 1.12 (colored)

Fixed so that orphan tabs are ignored. Should close PR760.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jan 6 19:57:31 1995 UTC (26 years, 9 months ago) by christos
Branch: MAIN
Changes since 1.11: +17 -1 lines
Diff to previous 1.11 (colored)

Fixes from Paul Borman (prb@bsdi.com)
1. Honor environment variable $MACHINE if set over uname.machine
2. archives with :: are always out of date, even when they have no children.
3. VAR= a b c     # comment, gets the trailing blanks trimmed, unless
   escaped by \. I'll have to read the posix manul to make sure that it
   is ok to handle escapes here.

Revision 1.11 / (download) - annotate - [select for diffs], Tue Oct 18 20:36:26 1994 UTC (27 years ago) by mycroft
Branch: MAIN
Changes since 1.10: +11 -5 lines
Diff to previous 1.10 (colored)

Deal with lines that contain only spaces, per PR 515, but implemented
differently.

Revision 1.10 / (download) - annotate - [select for diffs], Tue Oct 18 20:16:13 1994 UTC (27 years ago) by mycroft
Branch: MAIN
Changes since 1.9: +1 -5 lines
Diff to previous 1.9 (colored)

Remove an outdated comment that is very confusing.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Jun 6 22:45:39 1994 UTC (27 years, 4 months ago) by jtc
Branch: MAIN
CVS Tags: netbsd-1-0-base, netbsd-1-0-RELEASE, netbsd-1-0-PATCH1, netbsd-1-0-PATCH06, netbsd-1-0-PATCH05, netbsd-1-0-PATCH04, netbsd-1-0-PATCH03, netbsd-1-0-PATCH02, netbsd-1-0-PATCH0, netbsd-1-0
Changes since 1.8: +85 -52 lines
Diff to previous 1.8 (colored)

Fixes from Christos Zoulas, who used purify, objectcenter and testcenter
to find memory leaks and illegal memory accesses.

Revision 1.8 / (download) - annotate - [select for diffs], Sat May 21 16:36:01 1994 UTC (27 years, 5 months ago) by jtc
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

Fix from Thorsten Lockert: don't ignore \ before # characters
in strings (Fixes bug 255).

Revision 1.7 / (download) - annotate - [select for diffs], Mon Mar 7 22:22:05 1994 UTC (27 years, 7 months ago) by cgd
Branch: MAIN
Changes since 1.6: +21 -2 lines
Diff to previous 1.6 (colored)

kill some warnings, from Christos.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Mar 5 01:58:23 1994 UTC (27 years, 7 months ago) by jtc
Branch: MAIN
Changes since 1.5: +4 -9 lines
Diff to previous 1.5 (colored)

Apply fix that was lost when Christos Zoulas' changes were integrated:
  Shell commands start with tabs, not whitespace.  Pmake's
  POSIX behavior must have been derrived from an early draft.

Revision 1.5 / (download) - annotate - [select for diffs], Sat Mar 5 00:35:04 1994 UTC (27 years, 7 months ago) by cgd
Branch: MAIN
Changes since 1.4: +478 -136 lines
Diff to previous 1.4 (colored)

fixes/improvements from Christos Zoulas <christos@deshaw.com>.

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jan 13 21:01:59 1994 UTC (27 years, 9 months ago) by jtc
Branch: MAIN
Changes since 1.3: +5 -2 lines
Diff to previous 1.3 (colored)

Include appropriate header files to bring prototypes into scope.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Dec 17 23:52:04 1993 UTC (27 years, 10 months ago) by jtc
Branch: MAIN
Changes since 1.2: +4 -9 lines
Diff to previous 1.2 (colored)

Fix bug #47.  Shell commands start with tabs, not whitespace.  Pmake's
POSIX behavior must have been derrived from an early draft.

Revision 1.2 / (download) - annotate - [select for diffs], Sun Aug 1 18:11:44 1993 UTC (28 years, 2 months ago) by mycroft
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

Add RCS identifiers.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Sun Mar 21 09:45:37 1993 UTC (28 years, 7 months ago) by cgd
Branch: WFJ-920714, CSRG
CVS Tags: patchkit-0-2-2, netbsd-alpha-1, netbsd-0-9-base, netbsd-0-9-RELEASE, netbsd-0-9-BETA, netbsd-0-9-ALPHA2, netbsd-0-9-ALPHA, netbsd-0-9, netbsd-0-8, WFJ-386bsd-01
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of 386bsd-0.1 sources

Revision 1.1 / (download) - annotate - [select for diffs], Sun Mar 21 09:45:37 1993 UTC (28 years, 7 months ago) by cgd
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>