The NetBSD Project

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

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

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.207 / (download) - annotate - [select for diffs], Sun Dec 17 09:02:26 2023 UTC (3 months, 4 weeks ago) by rillig
Branch: MAIN
CVS Tags: HEAD
Changes since 1.206: +3 -3 lines
Diff to previous 1.206 (colored)

make: clean up unused return value of str2Lst_Append

No functional change.

Revision 1.206 / (download) - annotate - [select for diffs], Sat Aug 19 00:09:17 2023 UTC (7 months, 4 weeks ago) by sjg
Branch: MAIN
Changes since 1.205: +8 -1 lines
Diff to previous 1.205 (colored)

meta_ignore: check metaIgnorePaths on raw path

Some path prefixes can trigger automount, if we want to ignore them
it might be best to check metaIgnorePaths before we call realpath.
If the raw path does not match, check again after realpath.

Revision 1.205 / (download) - annotate - [select for diffs], Tue Mar 28 14:39:31 2023 UTC (12 months, 2 weeks ago) by rillig
Branch: MAIN
Changes since 1.204: +1 -3 lines
Diff to previous 1.204 (colored)

make: declare all common symbols in headers, unexport others

No functional change.

Revision 1.204 / (download) - annotate - [select for diffs], Tue Feb 28 06:04:28 2023 UTC (13 months, 2 weeks ago) by sjg
Branch: MAIN
Changes since 1.203: +8 -3 lines
Diff to previous 1.203 (colored)

Use inline function rather that macro BM

Revision 1.203 / (download) - annotate - [select for diffs], Sat Feb 25 22:52:21 2023 UTC (13 months, 2 weeks ago) by sjg
Branch: MAIN
Changes since 1.202: +12 -42 lines
Diff to previous 1.202 (colored)

meta.c: use macro to access job->bm

and if job is NULL use Mybm.

No functional change.

Revision 1.202 / (download) - annotate - [select for diffs], Tue Feb 14 21:38:31 2023 UTC (14 months ago) by rillig
Branch: MAIN
Changes since 1.201: +15 -15 lines
Diff to previous 1.201 (colored)

make: clean up calls to Var_Subst

None of the calls to Var_Subst used the return value, and the return
value was always VPR_OK.

No functional change.

Revision 1.201 / (download) - annotate - [select for diffs], Wed Sep 28 16:34:47 2022 UTC (18 months, 2 weeks ago) by sjg
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10-0-RELEASE, netbsd-10-0-RC6, netbsd-10-0-RC5, netbsd-10-0-RC4, netbsd-10-0-RC3, netbsd-10-0-RC2, netbsd-10-0-RC1, netbsd-10
Changes since 1.200: +20 -14 lines
Diff to previous 1.200 (colored)

Don't ignore return from snprintf or getcwd

Revision 1.200 / (download) - annotate - [select for diffs], Fri Apr 15 12:28:16 2022 UTC (2 years ago) by rillig
Branch: MAIN
Changes since 1.199: +9 -11 lines
Diff to previous 1.199 (colored)

make: do not use __CONCAT and __STRING in meta_needed

Using __CONCAT for identifiers makes it impossible to find their usages
easily, as could be seen in targ.c 1.22 from 2001-07-03.  It also
requires that the parts of the identifier are not macros themselves.

No binary change.

Revision 1.199 / (download) - annotate - [select for diffs], Fri Mar 4 23:17:16 2022 UTC (2 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.198: +5 -5 lines
Diff to previous 1.198 (colored)

Fix some unused warnings

Revision 1.198 / (download) - annotate - [select for diffs], Wed Feb 9 21:28:57 2022 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.197: +2 -3 lines
Diff to previous 1.197 (colored)

make: remove redundant conditions

A line starting with '======' is parsed as a variable assignment, with
an empty variable name and a value starting with '=====', making that
condition unreachable.

No functional change.

Revision 1.197 / (download) - annotate - [select for diffs], Tue Feb 8 22:36:02 2022 UTC (2 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.196: +10 -15 lines
Diff to previous 1.196 (colored)

Use a variable to store command line to be filtered.

This avoids any nasty side effects from content of command line.

Reviewed by: rillig

Revision 1.196 / (download) - annotate - [select for diffs], Fri Feb 4 23:22:19 2022 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.195: +17 -17 lines
Diff to previous 1.195 (colored)

make: use unsigned int for line numbers everywhere

Previously, some line numbers were stored as signed int while others
were stored as size_t.  Since line numbers are never negative, use an
unsigned type.  Since the maximum file size for makefiles is 1 GB (see
loadfile), unsigned int is large enough even on 64-bit platforms.

Using a single data types reduces the number of type conversions.  Using
unsigned int improves compatibility with C90 (printf %u instead of %zu),
which is needed by bmake, which is derived from usr.bin/make.

No functional change.

Revision 1.195 / (download) - annotate - [select for diffs], Thu Jan 27 06:02:59 2022 UTC (2 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.194: +8 -4 lines
Diff to previous 1.194 (colored)

Allow local variable assignments in dependency lines

The variable is set in the context of the target.
This syntax has been supported by gmake for ~ever.
If necessary a makefile can set .MAKE.TARGET_LOCAL_VARIABLES=false
to disable this.

Expose GetBooleanExpr so parse.c can use it.

Revision 1.194 / (download) - annotate - [select for diffs], Wed Jan 26 12:41:26 2022 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.193: +18 -21 lines
Diff to previous 1.193 (colored)

make: clean up eat_dots for meta mode, part 2

At least on OpenBSD, "If the src and dst strings overlap, the behavior
is undefined" (since 2013-09-25), so rather use memmove instead.

Keep all other bugs for now, for example "/a/b//../" is reduced to
"/a/b/" instead of the correct "/a/", and for repeated "/././././" in
long paths, the performance is quadratic instead of linear.

Inline the two calls to eat_dots, turning the first into a two-liner.

Revision 1.193 / (download) - annotate - [select for diffs], Wed Jan 26 12:16:03 2022 UTC (2 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.192: +5 -20 lines
Diff to previous 1.192 (colored)

make: clean up eat_dots for meta mode

No binary change.

Revision 1.192 / (download) - annotate - [select for diffs], Sat Jan 15 19:34:07 2022 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.191: +4 -17 lines
Diff to previous 1.191 (colored)

make: replace Var_Value with Var_Exists where applicable

The latter function already existed in 1993, no idea why it was not
used.

No functional change.

Revision 1.191 / (download) - annotate - [select for diffs], Sat Jan 15 19:05:23 2022 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.190: +9 -9 lines
Diff to previous 1.190 (colored)

make: remove unnecessary functions for expanding variable names

In meta mode, the affected variable patterns do not contain a '$'.

Outside of meta mode, Global_SetExpand was only called a single time, so
inline that call.

No functional change.

Revision 1.190 / (download) - annotate - [select for diffs], Sat Jan 15 18:34:41 2022 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.189: +4 -11 lines
Diff to previous 1.189 (colored)

make: merge duplicate code for expanding variable expressions

No functional change.

Revision 1.189 / (download) - annotate - [select for diffs], Sat Jan 15 09:08:57 2022 UTC (2 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.188: +2 -2 lines
Diff to previous 1.188 (colored)

make: remove trailing whitespace in meta.c

Revision 1.188 / (download) - annotate - [select for diffs], Fri Jan 14 18:43:23 2022 UTC (2 years, 3 months ago) by sjg
Branch: MAIN
Changes since 1.187: +4 -4 lines
Diff to previous 1.187 (colored)

meta_cmd_cmp: use bool for once

Just use Buf_Init() some mallocs will be inevitable.

Revision 1.187 / (download) - annotate - [select for diffs], Thu Jan 13 04:51:50 2022 UTC (2 years, 3 months ago) by sjg
Branch: MAIN
Changes since 1.186: +44 -2 lines
Diff to previous 1.186 (colored)

meta.c: add .MAKE.META.CMP_FILTER

On rare occasions it is useful to be able to filter command lines
before comparison.

Revision 1.186 / (download) - annotate - [select for diffs], Mon Dec 13 01:51:12 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.185: +2 -2 lines
Diff to previous 1.185 (colored)

make: fix indentation in meta.c

Revision 1.185 / (download) - annotate - [select for diffs], Sat Nov 27 22:04:02 2021 UTC (2 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.184: +3 -3 lines
Diff to previous 1.184 (colored)

make: remove CONSTCOND comments, lint no longer needs them

Revision 1.184 / (download) - annotate - [select for diffs], Sun Oct 24 18:45:46 2021 UTC (2 years, 5 months ago) by sjg
Branch: MAIN
Changes since 1.183: +14 -8 lines
Diff to previous 1.183 (colored)

Do not ignore write failures.

We should not ignore failure to write to cmdFILE,
meta files and filemon.

Reviewed by: rillig

Revision 1.183 / (download) - annotate - [select for diffs], Thu Aug 19 15:50:30 2021 UTC (2 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.182: +10 -10 lines
Diff to previous 1.182 (colored)

make: fix lint warning about strrchr discarding 'const'

No functional change.

Revision 1.182 / (download) - annotate - [select for diffs], Sat Aug 14 13:04:00 2021 UTC (2 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.181: +2 -3 lines
Diff to previous 1.181 (colored)

make: fix lint warning about strchr removing 'const'

No functional change.

Revision 1.181 / (download) - annotate - [select for diffs], Sun Apr 4 10:05:08 2021 UTC (3 years 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.180: +2 -2 lines
Diff to previous 1.180 (colored)

make: rename a few functions to be more descriptive

No functional change.

Revision 1.180 / (download) - annotate - [select for diffs], Sat Apr 3 11:08:40 2021 UTC (3 years ago) by rillig
Branch: MAIN
Changes since 1.179: +86 -86 lines
Diff to previous 1.179 (colored)

make: use C99 bool type instead of defining its own

No functional change.

Revision 1.179 / (download) - annotate - [select for diffs], Mon Mar 15 12:15:03 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.178: +2 -2 lines
Diff to previous 1.178 (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.178 / (download) - annotate - [select for diffs], Mon Feb 22 23:21:33 2021 UTC (3 years, 1 month ago) by rillig
Branch: MAIN
Changes since 1.177: +10 -8 lines
Diff to previous 1.177 (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.177 / (download) - annotate - [select for diffs], Fri Feb 5 19:19:17 2021 UTC (3 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.176: +5 -2 lines
Diff to previous 1.176 (colored)

Avoid strdup in mkTempFile

Require caller to pass a buffer and size if they
want the tempfile not unlinked.

Add Job_TempFile to handle blocking signals around
call to mkTempFile, so that meta_open_filemon can use it
in jobs mode.

Revision 1.176 / (download) - annotate - [select for diffs], Fri Feb 5 05:15:12 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.175: +20 -14 lines
Diff to previous 1.175 (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.175 / (download) - annotate - [select for diffs], Thu Feb 4 21:33:14 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.174: +11 -11 lines
Diff to previous 1.174 (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.174 / (download) - annotate - [select for diffs], Wed Feb 3 15:08:17 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.173: +3 -3 lines
Diff to previous 1.173 (colored)

make: rename Var_Delete to Var_DeleteExpand, Var_DeleteVar to Var_Delete

The function names now follow the naming scheme from the other functions
that handle variables.

There are several calls that remain syntactically unchanged but that
omit the call to strchr('$') now.  Since all these calls use constant
variable names, there is no functional change.

Revision 1.173 / (download) - annotate - [select for diffs], Wed Feb 3 13:53:12 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.172: +5 -5 lines
Diff to previous 1.172 (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.172 / (download) - annotate - [select for diffs], Wed Feb 3 08:08:18 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.171: +6 -6 lines
Diff to previous 1.171 (colored)

make: replace Global_SetExpand with Global_Set for constant names

Revision 1.171 / (download) - annotate - [select for diffs], Wed Feb 3 08:00:36 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.170: +19 -19 lines
Diff to previous 1.170 (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.170 / (download) - annotate - [select for diffs], Mon Feb 1 21:32:54 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.169: +2 -2 lines
Diff to previous 1.169 (colored)

make: clean up comments

Revision 1.169 / (download) - annotate - [select for diffs], Sat Jan 16 20:49:31 2021 UTC (3 years, 2 months ago) by rillig
Branch: MAIN
Changes since 1.168: +3 -3 lines
Diff to previous 1.168 (colored)

make(1): fix a few inconsistencies for lint's strict bool mode

Revision 1.168 / (download) - annotate - [select for diffs], Sun Jan 10 21:20:46 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.167: +15 -14 lines
Diff to previous 1.167 (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.167 / (download) - annotate - [select for diffs], Sat Jan 9 16:06:09 2021 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.166: +3 -3 lines
Diff to previous 1.166 (colored)

make(1): fix lint warnings

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

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

Revision 1.165 / (download) - annotate - [select for diffs], Tue Dec 22 22:31:50 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.164: +2 -2 lines
Diff to previous 1.164 (colored)

make(1): fix return type of macro DEBUG

This macro was supposed to return a boolean expression all the time, it
just hadn't been implemented this way.  This resulted in wrong output
for the test sh-flags, in compilation modes -DUSE_UCHAR_BOOLEAN and
-DUSE_CHAR_BOOLEAN, since in ParseCommandFlags, the expression
DEBUG(LOUD) didn't fit into a boolean.

Revision 1.164 / (download) - annotate - [select for diffs], Sun Dec 20 22:36:40 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.163: +5 -4 lines
Diff to previous 1.163 (colored)

make(1): fix undefined behavior in meta_oodate

Do not increment a null pointer.

Do not assign to a variable twice in the same statement.  To be fair,
this may be safe because of the sequence point when the function is
called, but anyway, it looks too close to undefined behavior.

Revision 1.163 / (download) - annotate - [select for diffs], Sun Dec 20 22:12:36 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.162: +12 -10 lines
Diff to previous 1.162 (colored)

make(1): reduce scope of cp in meta_oodate

That function is way too long (550 lines) and has too creative variable
names such as fname, fname1, fname2, fname3.

Revision 1.162 / (download) - annotate - [select for diffs], Sun Dec 20 22:02:54 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.161: +2 -2 lines
Diff to previous 1.161 (colored)

make(1): fix declared variable type in printCMDs

No functional changes since StringListNode and GNodeListNode are both
typedefs of a simple generic ListNode.

Revision 1.161 / (download) - annotate - [select for diffs], Sun Dec 20 14:32:13 2020 UTC (3 years, 3 months ago) by rillig
Branch: MAIN
Changes since 1.160: +30 -34 lines
Diff to previous 1.160 (colored)

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

Revision 1.160 / (download) - annotate - [select for diffs], Sun Dec 13 21:27:45 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.159: +3 -2 lines
Diff to previous 1.159 (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.159 / (download) - annotate - [select for diffs], Sun Dec 13 20:14:48 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.158: +2 -6 lines
Diff to previous 1.158 (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.158 / (download) - annotate - [select for diffs], Thu Dec 10 20:49:11 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.157: +3 -5 lines
Diff to previous 1.157 (colored)

make(1): split JobFlags into separate fields

Having all these flags in a single bitmask makes it harder to see where
exactly they can possibly be used since their state could also be
modified using the unsuspicious job->flags = 0.  Using individual names
just leaves the single memset, and that is only used during
initialization.

Revision 1.157 / (download) - annotate - [select for diffs], Sat Dec 5 17:46:41 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.156: +4 -4 lines
Diff to previous 1.156 (colored)

make(1): remove unused parameter from meta_needed

Revision 1.156 / (download) - annotate - [select for diffs], Sun Nov 29 21:31:55 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.155: +10 -10 lines
Diff to previous 1.155 (colored)

make(1): reduce memory allocation in meta_oodate

Revision 1.155 / (download) - annotate - [select for diffs], Sun Nov 29 21:28:06 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.154: +10 -14 lines
Diff to previous 1.154 (colored)

make(1): reduce memory allocation in meta mode

Revision 1.154 / (download) - annotate - [select for diffs], Sun Nov 29 09:27:40 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.153: +3 -3 lines
Diff to previous 1.153 (colored)

make(1): use space instead of tab for preprocessor directives

Revision 1.153 / (download) - annotate - [select for diffs], Sat Nov 28 18:55:52 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.152: +5 -5 lines
Diff to previous 1.152 (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.152 / (download) - annotate - [select for diffs], Sat Nov 28 10:28:53 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.151: +9 -9 lines
Diff to previous 1.151 (colored)

make(1): rename parameter in meta_needed and meta_create

It conflicts with the global variable in dir.c when make is built in
all-in-one mode.

Revision 1.151 / (download) - annotate - [select for diffs], Sat Nov 28 10:25:45 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.150: +4 -4 lines
Diff to previous 1.150 (colored)

make(1): fix local variable name in meta_create

Revision 1.150 / (download) - annotate - [select for diffs], Fri Nov 27 08:18:14 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.149: +18 -25 lines
Diff to previous 1.149 (colored)

make(1): inline meta_file_t for printCMD

This struct had only been necessary as long as printCMD was a callback
to Lst_ForEach or Lst_ForEachUntil.

Revision 1.149 / (download) - annotate - [select for diffs], Fri Nov 27 08:07:26 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.148: +34 -17 lines
Diff to previous 1.148 (colored)

make(1): inline Lst_ForEachUntil in meta mode

This means no more unnecessary void pointers in function signatures and
no more abstraction level at checking a single element of a list.  In
most cases it is more appropriate to define a function that operates on
the list as a whole, thereby hiding implementation details like the
ListNode from the caller.

Revision 1.148 / (download) - annotate - [select for diffs], Mon Nov 23 23:44:03 2020 UTC (3 years, 4 months ago) by rillig
Branch: MAIN
Changes since 1.147: +8 -10 lines
Diff to previous 1.147 (colored)

make(1): remove redundant null check from meta_needed

The result of bmake_realloc can never be NULL.

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

make(1): use comparisons in boolean expressions

The generated code stays exactly the same.

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

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

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

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

Revision 1.144 / (download) - annotate - [select for diffs], Sun Nov 15 12:02:44 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.143: +2 -1 lines
Diff to previous 1.143 (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.143 / (download) - annotate - [select for diffs], Sat Nov 14 19:24:24 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.142: +10 -10 lines
Diff to previous 1.142 (colored)

make(1): remove redundant struct make_stat

In the cache for stat(2) and lstat(2), only one of the two timestamps
was ever used.  To prevent a result from stat(2) leaking into the cache
for lstat(2), there have been two completely separate caches all the
time.  Using different fields in the struct was therefore unnecessary.

By removing the redundant field, the internal struct in the cache is the
same as the external struct.  This makes one of them redundant, thus
struct make_stat has been renamed to cached_stat, which better describes
its purpose, and the internal struct cache_st has been removed.

Just as before, the cache prevents any direct access to its internal
data.  When passing it to the caller, it is copied.

Just as before, the field names of struct cached_stat cannot correspond
to those from struct stat, since the latter are often defined as macros.
Therefore they are prefixed with cst instead of st.

The redundancy had been added on 2020-06-05.

Revision 1.142 / (download) - annotate - [select for diffs], Sat Nov 14 17:39:59 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (colored)

make(1): remove redundant parameter from str2Lst_Append

Revision 1.141 / (download) - annotate - [select for diffs], Sun Nov 8 15:07:37 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.140: +10 -10 lines
Diff to previous 1.140 (colored)

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

Revision 1.140 / (download) - annotate - [select for diffs], Sat Nov 7 21:26:43 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.139: +5 -3 lines
Diff to previous 1.139 (colored)

make(1): fix inconsistent indentation after #ifdef

Combining #ifdef with regular if-then-else calls for trouble.

Revision 1.139 / (download) - annotate - [select for diffs], Sat Nov 7 10:16:19 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.138: +7 -7 lines
Diff to previous 1.138 (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.138 / (download) - annotate - [select for diffs], Thu Nov 5 17:27:16 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.137: +29 -29 lines
Diff to previous 1.137 (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.137 / (download) - annotate - [select for diffs], Wed Nov 4 13:27:00 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.136: +1 -2 lines
Diff to previous 1.136 (colored)

make(1): remove mistyped extern variable

Robust programs don't have extern variable declarations in .c files, as
that risks incomatible definitions that are not detected by the compiler
and invoke undefined behavior.  Make make a little more robust.

Revision 1.136 / (download) - annotate - [select for diffs], Sat Oct 31 12:04:24 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.135: +7 -16 lines
Diff to previous 1.135 (colored)

make(1): make memory allocation simpler in meta_create and meta_oodate

Since there is only a single variable left that needs to be freed at the
end (and probably never actually needs to be freed since nobody defines
an environment variable named .OBJDIR), there is no need to loop over
these variables.

Revision 1.135 / (download) - annotate - [select for diffs], Sat Oct 31 11:54:33 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.134: +5 -7 lines
Diff to previous 1.134 (colored)

make(1): do not look up local variables like .TARGET anywhere else

Nobody defines a global variable named .TARGET since that would have
many unpredictable effects, applying to all targets at once.

Nobody defines an environment variable named .TARGET since that's
against the naming conventions for environment variables and would have
the same effect.

Because of this, there is no point looking up the variables that are
local to a GNode anywhere else.  This means they cannot come from the
environment and thus their value doesn't need to be freed after use,
which makes the code simpler.

The newly added accessor functions in make.h refer to external
functions, but since that header is not used anywhere outside of
usr.bin/make, it doesn't matter.  Between 2020-08-25 and 2020-10-30,
that header had been referenced by usr.bin/xinstall.

Revision 1.134 / (download) - annotate - [select for diffs], Sat Oct 31 09:57:47 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.133: +3 -3 lines
Diff to previous 1.133 (colored)

make(1): fix indentation in source code

Revision 1.133 / (download) - annotate - [select for diffs], Fri Oct 30 20:30:44 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.132: +16 -13 lines
Diff to previous 1.132 (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.132 / (download) - annotate - [select for diffs], Fri Oct 30 15:39:17 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.131: +5 -5 lines
Diff to previous 1.131 (colored)

make(1): fix indentation in source code

Revision 1.131 / (download) - annotate - [select for diffs], Sun Oct 25 21:51:49 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

make(1): add GNode_Path to access the path of a GNode

Revision 1.130 / (download) - annotate - [select for diffs], Sat Oct 24 10:32:25 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.129: +15 -14 lines
Diff to previous 1.129 (colored)

make(1): inline Lst_Find in meta_oodate

Revision 1.129 / (download) - annotate - [select for diffs], Sat Oct 24 10:17:21 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.128: +11 -19 lines
Diff to previous 1.128 (colored)

make(1): make Lst_RemoveIf simpler in meta_oodate

Using Lst_Find and Lst_FindFrom to implement Lst_RemoveIf was a bad
idea.  It made the code much more complicated than necessary.  There is
no predefined Lst_RemoveIf, but that can be implemented easily.  By
inlining the list handling, path_match does not need void pointers
anymore.

Freeing the path from the missingFiles list had been implemented in a
surprisingly complicated way, intermangling it unnecessarily with the
list operations, even though these are completely independent.

Revision 1.128 / (download) - annotate - [select for diffs], Sat Oct 24 04:31:53 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.127: +4 -4 lines
Diff to previous 1.127 (colored)

make(1): remove redundant parameter from meta_name

Revision 1.127 / (download) - annotate - [select for diffs], Mon Oct 19 21:57:37 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.126: +5 -5 lines
Diff to previous 1.126 (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.126 / (download) - annotate - [select for diffs], Mon Oct 19 20:41:53 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.125: +12 -5 lines
Diff to previous 1.125 (colored)

make(1): remove void pointers from printCMD

Revision 1.125 / (download) - annotate - [select for diffs], Sun Oct 18 13:02:10 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.124: +4 -4 lines
Diff to previous 1.124 (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.124 / (download) - annotate - [select for diffs], Sun Oct 18 11:54:43 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.123: +15 -14 lines
Diff to previous 1.123 (colored)

make(1): prepare for WARNS=6

The FD_* macros from sys/sys/fd_set.h use signed integers on NetBSD 8
and thus produce conversion errors.  On NetBSD 9, these macros are fixed
to use 1U instead of 1.

Revision 1.123 / (download) - annotate - [select for diffs], Sun Oct 18 07:46:04 2020 UTC (3 years, 5 months ago) by rillig
Branch: MAIN
Changes since 1.122: +3 -6 lines
Diff to previous 1.122 (colored)

make(1): replace execError with execDie

All calls to this function were followed by _exit(1).

Revision 1.122 / (download) - annotate - [select for diffs], Mon Sep 28 22:23:35 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.121: +15 -16 lines
Diff to previous 1.121 (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.121 / (download) - annotate - [select for diffs], Mon Sep 28 20:46:11 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.120: +34 -54 lines
Diff to previous 1.120 (colored)

make(1): make debugging code shorter

Revision 1.120 / (download) - annotate - [select for diffs], Sat Sep 26 17:15:20 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.119: +3 -3 lines
Diff to previous 1.119 (colored)

make(1): inline and remove LstNode_Prev and LstNode_Next

These functions made the code larger than necessary.  The prev and next
fields are published intentionally since navigating in a doubly-linked
list is simple to do and there is no need to wrap this in a layer of
function calls, not even syntactically.  (On the execution level, the
function calls had been inlined anyway.)

Revision 1.119 / (download) - annotate - [select for diffs], Thu Sep 24 07:53:32 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.118: +3 -4 lines
Diff to previous 1.118 (colored)

make(1): migrate printCMD in meta mode to Lst_ForEach

Revision 1.118 / (download) - annotate - [select for diffs], Thu Sep 24 07:11:29 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.117: +6 -6 lines
Diff to previous 1.117 (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.117 / (download) - annotate - [select for diffs], Tue Sep 22 20:19:46 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.116: +23 -13 lines
Diff to previous 1.116 (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.116 / (download) - annotate - [select for diffs], Tue Sep 22 04:05:41 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.115: +4 -4 lines
Diff to previous 1.115 (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.115 / (download) - annotate - [select for diffs], Mon Sep 21 17:44:25 2020 UTC (3 years, 6 months ago) by rillig
Branch: MAIN
Changes since 1.114: +16 -15 lines
Diff to previous 1.114 (colored)

make(1): add specific typedefs for lists

These typedefs are only intended to help human readers, they do not
provide any type-safety.  They also make the pointers explicit, which
had been hidden before by the typedef for Lst and LstNode.  Typing a few
'*' is less work than finding out which of the many types are pointers
and which aren't.

In meta.c, the variable "ln" served two completely different purposes,
which have been split again.  Register allocation is the job of the
compiler, not of the human source code reader.

Revision 1.114 / (download) - annotate - [select for diffs], Sat Sep 12 14:41:00 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)

make(1): fix inconsistent code indentation

Revision 1.113 / (download) - annotate - [select for diffs], Wed Sep 2 04:08:54 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.112: +11 -10 lines
Diff to previous 1.112 (colored)

make(1): reduce number of stat fields returned by cached_stat

Only st_mtime and st_mode are actually filled, the remaining fields had
been set to zero.  To prevent these from ever being accessed, a custom
struct make_stat replaces the previously used struct stat.

The fields in struct make_stat are intentionally named different from
the fields in struct stat because NetBSD and some other operating
systems define st_mtime as a macro, and that would not work in a field
declaration.

Revision 1.112 / (download) - annotate - [select for diffs], Sun Aug 30 11:15:05 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.111: +4 -4 lines
Diff to previous 1.111 (colored)

make(1): rename Lst_Datum to LstNode_Datum

Revision 1.111 / (download) - annotate - [select for diffs], Sat Aug 29 13:16:54 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.110: +6 -10 lines
Diff to previous 1.110 (colored)

make(1): trust that Var_Subst never returns NULL

It really never does, and it doesn't even report errors.  It just
returns the content of the buffer, up to the first parse error.

Revision 1.110 / (download) - annotate - [select for diffs], Sat Aug 29 10:41:12 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.109: +5 -4 lines
Diff to previous 1.109 (colored)

make(1): rename LstNode functions to match their type

Revision 1.109 / (download) - annotate - [select for diffs], Sat Aug 29 10:12:06 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.108: +5 -5 lines
Diff to previous 1.108 (colored)

make(1): rename Lst_FindB back to Lst_Find

The migration from "comparison function" to "match function" is done,
the "B" in the names is no longer needed.

Revision 1.108 / (download) - annotate - [select for diffs], Sat Aug 29 10:06:23 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.107: +14 -33 lines
Diff to previous 1.107 (colored)

make(1): migrate remaining Lst_Find to Lst_FindB

While here, rename SuffSuffIsSuffix to SuffSuffGetSuffix since a
function named "is" should return a boolean, not a string pointer.

Revision 1.107 / (download) - annotate - [select for diffs], Fri Aug 28 06:47:14 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.106: +6 -3 lines
Diff to previous 1.106 (colored)

make(1): fix the other assertion from Lst_FindFrom

When I migrated the Lst_FindFrom to the strict API variant, I forgot
that Lst_FindFrom requires both arguments (list and node) to be
non-null.  I had only checked that the list is non-null.

There are only very few calls to Lst_FindFrom, and they are all ok now.

Revision 1.106 / (download) - annotate - [select for diffs], Fri Aug 28 04:48:57 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.105: +24 -24 lines
Diff to previous 1.105 (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.105 / (download) - annotate - [select for diffs], Fri Aug 28 04:28:45 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.104: +5 -5 lines
Diff to previous 1.104 (colored)

make(1): migrate Lst_Find to Lst_FindS

Revision 1.104 / (download) - annotate - [select for diffs], Fri Aug 28 04:14:31 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.103: +3 -3 lines
Diff to previous 1.103 (colored)

make(1): migrate Lst_First to Lst_FirstS

Revision 1.103 / (download) - annotate - [select for diffs], Thu Aug 27 19:15:35 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.102: +5 -5 lines
Diff to previous 1.102 (colored)

make(1): migrate Lst_IsEmpty to Lst_IsEmptyS

Revision 1.102 / (download) - annotate - [select for diffs], Thu Aug 27 07:00:29 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.101: +3 -3 lines
Diff to previous 1.101 (colored)

make(1): migrate Lst_Succ to Lst_SuccS

Revision 1.101 / (download) - annotate - [select for diffs], Thu Aug 27 06:53:57 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.100: +5 -5 lines
Diff to previous 1.100 (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.100 / (download) - annotate - [select for diffs], Wed Aug 26 22:55:46 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.99: +6 -4 lines
Diff to previous 1.99 (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.99 / (download) - annotate - [select for diffs], Sun Aug 23 16:58:02 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.98: +6 -6 lines
Diff to previous 1.98 (colored)

make(1): reverse order of the Lst_Find parameters

The other callbacks all have (function, param), only the Lst_Find had
(param, function), which was inconsistent.

Revision 1.98 / (download) - annotate - [select for diffs], Sun Aug 23 16:43:34 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

make(1): define aliases for function types in list processing

This makes the prototypes of the functions clearer.

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

make(1): fix indentation

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

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

Revision 1.95 / (download) - annotate - [select for diffs], Sat Aug 22 13:28:20 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.94: +3 -3 lines
Diff to previous 1.94 (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.94 / (download) - annotate - [select for diffs], Fri Aug 21 03:36:03 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

make(1): make list library code stricter

Up to now, the list library didn't distinguish between programming
mistakes (violations of invariants, illegal parameter values) and
actually interesting situations like "element not found in list".

The current code contains many branches for conditions that are neither
exercised by the unit tests nor by real-world usage.  There is no point
in keeping this unnecessary code.

The list functions will be migrated from their lenient variants to the
stricter variants in small parts, each function getting the S suffix
when it is made strict, to avoid any confusion about how strict a
particular function is.  When all functions have been migrated, they
will be renamed back to their original names.

While here, the comments of the functions are cleaned up since they
mention irrelevant implementation details in the API comments, as well
as "side effects" that are really main effects.

Revision 1.93 / (download) - annotate - [select for diffs], Fri Aug 21 02:20:47 2020 UTC (3 years, 7 months ago) by rillig
Branch: MAIN
Changes since 1.92: +4 -4 lines
Diff to previous 1.92 (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.92 / (download) - annotate - [select for diffs], Mon Aug 3 20:26:09 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.91: +6 -3 lines
Diff to previous 1.91 (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.91 / (download) - annotate - [select for diffs], Sat Aug 1 09:55:00 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.90: +8 -8 lines
Diff to previous 1.90 (colored)

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

Revision 1.90 / (download) - annotate - [select for diffs], Sat Aug 1 09:25:36 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.89: +3 -3 lines
Diff to previous 1.89 (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.89 / (download) - annotate - [select for diffs], Tue Jul 28 16:42:22 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.88: +11 -12 lines
Diff to previous 1.88 (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.88 / (download) - annotate - [select for diffs], Sun Jul 19 12:35:30 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.87: +3 -6 lines
Diff to previous 1.87 (colored)

make(1): clean up unnecessary snprintf and multi-line function calls

Revision 1.87 / (download) - annotate - [select for diffs], Sun Jul 19 12:26:17 2020 UTC (3 years, 8 months ago) by rillig
Branch: MAIN
Changes since 1.86: +10 -10 lines
Diff to previous 1.86 (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.86 / (download) - annotate - [select for diffs], Sat Jul 11 00:39:53 2020 UTC (3 years, 9 months ago) by sjg
Branch: MAIN
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

meta_oodate: if target is explicitly .META missing is oodate

If a .meta file is missing for a target marked .META
it is out-of-date

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jul 3 08:13:23 2020 UTC (3 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.84: +20 -20 lines
Diff to previous 1.84 (colored)

make(1): remove trailing whitespace

Revision 1.84 / (download) - annotate - [select for diffs], Fri Jul 3 08:02:55 2020 UTC (3 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.83: +5 -5 lines
Diff to previous 1.83 (colored)

make(1): remove redundant parentheses around return values

Revision 1.83 / (download) - annotate - [select for diffs], Thu Jul 2 15:47:38 2020 UTC (3 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.82: +15 -15 lines
Diff to previous 1.82 (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.82 / (download) - annotate - [select for diffs], Thu Jun 25 15:45:37 2020 UTC (3 years, 9 months ago) by sjg
Branch: MAIN
Changes since 1.81: +12 -8 lines
Diff to previous 1.81 (colored)

filemon_read: report error if lseek fails

Reviewed by: riastradh

Revision 1.81 / (download) - annotate - [select for diffs], Fri Apr 3 03:32:28 2020 UTC (4 years ago) by sjg
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

CHECK_VALID_META is too agressive for CMD check.

An empty CMD is perfectly valid.
So using CHECK_VALID_META results in too much rebuilding.

Revision 1.80 / (download) - annotate - [select for diffs], Wed Mar 18 23:53:02 2020 UTC (4 years ago) by sjg
Branch: MAIN
Changes since 1.79: +3 -1 lines
Diff to previous 1.79 (colored)

Check for meta file corruption earlier and more often.

Revision 1.79 / (download) - annotate - [select for diffs], Wed Feb 12 16:50:37 2020 UTC (4 years, 2 months ago) by sjg
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp
Changes since 1.78: +5 -1 lines
Diff to previous 1.78 (colored)

meta_compat_parent check for USE_FILEMON

patch from Soeren Tempel

Revision 1.78 / (download) - annotate - [select for diffs], Thu Feb 6 01:13:19 2020 UTC (4 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.77: +9 -10 lines
Diff to previous 1.77 (colored)

Fix meta_compat mode.

We need to call meta_job_output() from meta_compat_parent()
Also, the need for extra fds for meta mode only applies when
using filemon_ktrace.c.
Since we hope to see more interfaces like that, test for
USE_FILEMON_DEV being not defined.

Reviewed by: riastradh

Revision 1.77 / (download) - annotate - [select for diffs], Wed Jan 22 21:04:29 2020 UTC (4 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.76: +6 -4 lines
Diff to previous 1.76 (colored)

Check for filemon valid.

If meta_needed() returns FALSE, mfp and filemon will be NULL
in which case we should not call filemon_*().

Revision 1.76 / (download) - annotate - [select for diffs], Wed Jan 22 00:26:45 2020 UTC (4 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.75: +6 -3 lines
Diff to previous 1.75 (colored)

meta.c: report OODATE value if not empty

When a target is out-of-date per normal make rules
.OODATE will be non-empty, report this in .meta file
to help clarify why target was updated.

Revision 1.75 / (download) - annotate - [select for diffs], Sun Jan 19 19:49:37 2020 UTC (4 years, 2 months ago) by riastradh
Branch: MAIN
Changes since 1.74: +4 -4 lines
Diff to previous 1.74 (colored)

Per sjg's suggestion, split filemon API into separate back ends.

By default we use the ktrace back end, but the /dev/filemon back end
is available as a compile-time option, by setting USE_FILEMON=dev in
make.  sjg raised concerns about ktrace performance and would like to
continue using /dev/filemon on FreeBSD (which has seen more
maintenance kernel-side) without forking make.

Revision 1.74 / (download) - annotate - [select for diffs], Sun Jan 19 19:42:32 2020 UTC (4 years, 2 months ago) by riastradh
Branch: MAIN
Changes since 1.73: +129 -41 lines
Diff to previous 1.73 (colored)

Reimplement make(1) meta mode without filemon(4).

Revision 1.73 / (download) - annotate - [select for diffs], Thu Dec 19 07:14:07 2019 UTC (4 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.72: +164 -2 lines
Diff to previous 1.72 (colored)

Revert the filemon removal in bmake, as pointed out by maya we do care
about not introducing divergence with FreeBSD, and the cost of unused
is acceptable here.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Dec 18 10:30:23 2019 UTC (4 years, 3 months ago) by martin
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Fix the build

Revision 1.71 / (download) - annotate - [select for diffs], Wed Dec 18 07:37:19 2019 UTC (4 years, 3 months ago) by maxv
Branch: MAIN
Changes since 1.70: +1 -163 lines
Diff to previous 1.70 (colored)

Retire filemon, discussed on tech-kern@.

Revision 1.70 / (download) - annotate - [select for diffs], Tue Feb 13 19:37:30 2018 UTC (6 years, 2 months ago) by sjg
Branch: MAIN
CVS Tags: phil-wifi-base, phil-wifi-20191119, phil-wifi-20190609, pgoyette-compat-merge-20190127, pgoyette-compat-base, pgoyette-compat-20190127, pgoyette-compat-20190118, pgoyette-compat-1226, 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, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315, pgoyette-compat, netbsd-9-base, netbsd-9-3-RELEASE, netbsd-9-2-RELEASE, netbsd-9-1-RELEASE, netbsd-9-0-RELEASE, netbsd-9-0-RC2, netbsd-9-0-RC1, netbsd-9
Branch point for: phil-wifi
Changes since 1.69: +3 -1 lines
Diff to previous 1.69 (colored)

Avoid unused variable warning

Revision 1.69 / (download) - annotate - [select for diffs], Thu Aug 10 21:07:48 2017 UTC (6 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.68: +10 -3 lines
Diff to previous 1.68 (colored)

Avoid full path meta file names for subdir of .OBJDIR

Revision 1.68 / (download) - annotate - [select for diffs], Sun Jul 9 04:54:00 2017 UTC (6 years, 9 months ago) by sjg
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646
Changes since 1.67: +11 -8 lines
Diff to previous 1.67 (colored)

Ensure that command output is always followed by newline,
even when filemon is not being used.

Tweak MAKE_META_IGNORE_PATTERNS matching to avoid using path name
with :L as it does not handle ':' in path names.

fgetLine: an extra check to avoid shrinking the buffer.

Revision 1.67 / (download) - annotate - [select for diffs], Wed Aug 17 15:52:42 2016 UTC (7 years, 8 months ago) by sjg
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, pgoyette-localcount-20170320, pgoyette-localcount-20170107, pgoyette-localcount-20161104, 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, localcount-20160914, bouyer-socketcan-base1, bouyer-socketcan-base, bouyer-socketcan
Changes since 1.66: +67 -52 lines
Diff to previous 1.66 (colored)

Refactor the handling of .MAKE.META.IGNORE_* to meta_ignore()
so that we can call it before adding paths to missingFiles.
Ie. do not track files we have been told to ignore.

Revision 1.66 / (download) - annotate - [select for diffs], Mon Aug 15 19:20:17 2016 UTC (7 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.65: +30 -1 lines
Diff to previous 1.65 (colored)

Add .MAKE.META.IGNORE_FILTER to allow more complicated filtering of filemon data.

The filter is applied to paths Read or Excuted, and if it expands to
nothing, the entry is skipped.

For example; dirdeps.mk can set this to:

.MAKE.META.IGNORE_FILTER = M*/${.MAKE.DEPENDFILE_PREFIX}*

when checking if DIRDEPS_CACHE is up to date, where only Makefile.depend*
are of interest.

Revision 1.65 / (download) - annotate - [select for diffs], Wed Aug 10 18:49:40 2016 UTC (7 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.64: +5 -3 lines
Diff to previous 1.64 (colored)

Use Lst_FindFrom and Lst_Succ(ln) to find next entry in missingFiles.

Revision 1.64 / (download) - annotate - [select for diffs], Wed Aug 10 18:25:00 2016 UTC (7 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.63: +39 -7 lines
Diff to previous 1.63 (colored)

Linux filemon only records D some/dir for rm -rf
rather than D entries for each file removed.
Thus we need a loop to remove all matching missingFiles entries

Revision 1.63 / (download) - annotate - [select for diffs], Wed Jun 29 22:10:08 2016 UTC (7 years, 9 months ago) by sjg
Branch: MAIN
CVS Tags: pgoyette-localcount-base, pgoyette-localcount-20160806, pgoyette-localcount-20160726, pgoyette-localcount
Changes since 1.62: +2 -1 lines
Diff to previous 1.62 (colored)

meta_compat_parent: fflush each line

Revision 1.62 / (download) - annotate - [select for diffs], Tue Jun 14 18:16:06 2016 UTC (7 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.61: +2 -1 lines
Diff to previous 1.61 (colored)

meta_oodate: set needOODATE if oodate due to missing .meta file.

Revision 1.61 / (download) - annotate - [select for diffs], Tue Jun 7 00:40:00 2016 UTC (7 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.60: +5 -5 lines
Diff to previous 1.60 (colored)

Extend the mtimes cache used by dir.c so it can be used by others.

We store both st_mtime and st_mode, since some callers care about the
later.

Reviewed by: christos

Revision 1.60 / (download) - annotate - [select for diffs], Sat Jun 4 22:17:14 2016 UTC (7 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.59: +18 -9 lines
Diff to previous 1.59 (colored)

meta_oodate even when missing-meta is true, we do not make a target in
.CURDIR out of date just because of a missing meta file.

Also we can only be missing filemon data if we had a meta file.

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jun 3 01:21:59 2016 UTC (7 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.58: +5 -5 lines
Diff to previous 1.58 (colored)

Add cached_realpath()

realpath(3) is expensive, and meta mode at least uses it extensively.
We use cached_realpath() to save the result of successful calls to
realpath(3) in a private variable context.

This improves the worst case performance (eg examining libc with
nothing to do) by a factor of 4.

Reviewed by: christos

Revision 1.58 / (download) - annotate - [select for diffs], Fri Jun 3 01:16:27 2016 UTC (7 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.57: +108 -76 lines
Diff to previous 1.57 (colored)

Refactor the logic for deciding when a .meta file is needed.

Both meta_create() and meta_oodate() now share meta_needed()
to indicate if a .meta file is needed.

This allows for deciding that missing .meta file is cause of out-of-date.
The new knob 'missing-meta' controlls this, and is off by default
since the side effect files of generators like yacc will typically need
.NOMETA to avoid problems.

This however makes it much easier for folk to switch back and forth
with meta mode (eg. FreeBSD's normal build can leverage meta mode for
improved reliablility without need to clean).

Also if .MAKE.MODE does not contain 'nofilemon', the knob
'missing-filemon' allows control as to whether missing filemon data
should cause the target to be out-of-date.
Again off by default.

Revision 1.57 / (download) - annotate - [select for diffs], Thu May 12 20:28:34 2016 UTC (7 years, 11 months ago) by sjg
Branch: MAIN
Changes since 1.56: +27 -11 lines
Diff to previous 1.56 (colored)

Propagate errors from filemon.

If we encounter errors producing a .meta file,
we should not consider the target completed successfully.

Revision 1.56 / (download) - annotate - [select for diffs], Tue May 10 23:45:45 2016 UTC (7 years, 11 months ago) by sjg
Branch: MAIN
Changes since 1.55: +34 -2 lines
Diff to previous 1.55 (colored)

Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.

Revision 1.55 / (download) - annotate - [select for diffs], Tue May 10 00:02:31 2016 UTC (7 years, 11 months ago) by sjg
Branch: MAIN
Changes since 1.54: +9 -7 lines
Diff to previous 1.54 (colored)

Apply realpath() to p before matching against metaIgnorePaths.

Revision 1.54 / (download) - annotate - [select for diffs], Fri Mar 11 07:01:21 2016 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.53: +5 -5 lines
Diff to previous 1.53 (colored)

Handle missing file for Read the same as for Write, since if it
is Deleted we don't care.

Patch from Bryan Drewery.

Revision 1.53 / (download) - annotate - [select for diffs], Mon Mar 7 21:45:43 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.52: +19 -10 lines
Diff to previous 1.52 (colored)

str2Lst_Append tokenizes the string and uses it in the list so we can't
free the string afterwards. Keep a copy of it and cleanup at the end.

Revision 1.52 / (download) - annotate - [select for diffs], Sat Feb 27 16:20:06 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

CID 1025009: Fix wrong code (NULL deref)

Revision 1.51 / (download) - annotate - [select for diffs], Sat Feb 27 16:18:47 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.50: +3 -1 lines
Diff to previous 1.50 (colored)

CID 1025008: Free memory returned by Var_Subst

Revision 1.50 / (download) - annotate - [select for diffs], Sat Feb 27 16:17:26 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.49: +4 -2 lines
Diff to previous 1.49 (colored)

CID 1025007: Don't leak missingFiles

Revision 1.49 / (download) - annotate - [select for diffs], Sat Feb 27 16:14:23 2016 UTC (8 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.48: +2 -2 lines
Diff to previous 1.48 (colored)

CID 1025006: pbm can't be NULL at this point.

Revision 1.48 / (download) - annotate - [select for diffs], Sat Feb 27 00:13:21 2016 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.47: +2 -5 lines
Diff to previous 1.47 (colored)

Let makefiles decide if depend file gets a meta file

Revision 1.47 / (download) - annotate - [select for diffs], Thu Feb 18 20:33:40 2016 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.46: +8 -8 lines
Diff to previous 1.46 (colored)

Adapt to changed Var_Subst()

Revision 1.46 / (download) - annotate - [select for diffs], Thu Feb 18 05:40:50 2016 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.45: +8 -8 lines
Diff to previous 1.45 (colored)

Actually FALSE as last arg to Var_Subst makes more sense

Revision 1.45 / (download) - annotate - [select for diffs], Thu Feb 18 05:01:39 2016 UTC (8 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.44: +8 -8 lines
Diff to previous 1.44 (colored)

Adapt to new Var_Subst prototype

Revision 1.44 / (download) - annotate - [select for diffs], Sun Jan 17 17:45:21 2016 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.43: +8 -15 lines
Diff to previous 1.43 (colored)

remove free NULL checks (Tilman Sauerbeck)

Revision 1.43 / (download) - annotate - [select for diffs], Sun Jan 17 15:32:38 2016 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.42: +1 -2 lines
Diff to previous 1.42 (colored)

provide missing FD_CLOEXEC for the havenots.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jan 17 15:30:23 2016 UTC (8 years, 3 months ago) by christos
Branch: MAIN
Changes since 1.41: +5 -5 lines
Diff to previous 1.41 (colored)

Use FD_CLOEXEC (Tilman Sauerbeck)

Revision 1.41 / (download) - annotate - [select for diffs], Mon Nov 30 23:37:56 2015 UTC (8 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.40: +3 -2 lines
Diff to previous 1.40 (colored)

Use lstat(2) if we have a link, incase it is a symlink.

Patch from bdrewery at FreeBSD.org

Revision 1.40 / (download) - annotate - [select for diffs], Sun Oct 11 04:51:24 2015 UTC (8 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.39: +11 -8 lines
Diff to previous 1.39 (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.39 / (download) - annotate - [select for diffs], Sat Oct 10 03:58:59 2015 UTC (8 years, 6 months ago) by sjg
Branch: MAIN
Changes since 1.38: +1 -11 lines
Diff to previous 1.38 (colored)

Do not hard-code ingnoring of makeDependfile

Revision 1.38 / (download) - annotate - [select for diffs], Sat Apr 11 05:24:30 2015 UTC (9 years ago) by sjg
Branch: MAIN
Changes since 1.37: +50 -10 lines
Diff to previous 1.37 (colored)

Use separate vars to track cwd and last dir a process read.

Revision 1.37 / (download) - annotate - [select for diffs], Wed Apr 1 01:03:55 2015 UTC (9 years ago) by sjg
Branch: MAIN
Changes since 1.36: +10 -6 lines
Diff to previous 1.36 (colored)

Close child's reference to meta file.

Revision 1.36 / (download) - annotate - [select for diffs], Thu Nov 6 01:36:57 2014 UTC (9 years, 5 months ago) by sjg
Branch: MAIN
Changes since 1.35: +2 -2 lines
Diff to previous 1.35 (colored)

Ensure -- filemon is at start of line

Revision 1.35 / (download) - annotate - [select for diffs], Mon Oct 20 23:22:57 2014 UTC (9 years, 5 months ago) by sjg
Branch: MAIN
Changes since 1.34: +5 -8 lines
Diff to previous 1.34 (colored)

Use read and fwrite rather than fgets and printf when reading filemon data.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Oct 18 08:33:30 2014 UTC (9 years, 6 months ago) by snj
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored)

src is too big these days to tolerate superfluous apostrophes.  It's
"its", people!

Revision 1.33 / (download) - annotate - [select for diffs], Tue Oct 1 05:37:17 2013 UTC (10 years, 6 months ago) by sjg
Branch: MAIN
CVS Tags: yamt-pagecache-base9, tls-maxphys-base, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, 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.32: +61 -18 lines
Diff to previous 1.32 (colored)

meta_oodate: 'L'ink and 'M'ove entries need extra processing.
The src of a Link should be treated as a file Read
while the target a file Written.
The src of a Move is like a file Deleted
and the target like a file Written.

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jun 25 00:20:54 2013 UTC (10 years, 9 months ago) by sjg
Branch: MAIN
CVS Tags: riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2
Changes since 1.31: +26 -19 lines
Diff to previous 1.31 (colored)

Add .MAKE.META.IGNORE_PATHS to facilitate local additions to the paths
which should be ignored by meta_oodate().

Revision 1.31 / (download) - annotate - [select for diffs], Mon Jun 24 21:16:02 2013 UTC (10 years, 9 months ago) by sjg
Branch: MAIN
Changes since 1.30: +5 -1 lines
Diff to previous 1.30 (colored)

Ignore any files in /proc/

Revision 1.30 / (download) - annotate - [select for diffs], Thu May 16 21:56:56 2013 UTC (10 years, 11 months ago) by sjg
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

New compiler doesn't like foo()

Revision 1.29 / (download) - annotate - [select for diffs], Sun Mar 31 05:49:51 2013 UTC (11 years ago) by sjg
Branch: MAIN
Changes since 1.28: +14 -12 lines
Diff to previous 1.28 (colored)

Refine the effect of .OODATE on command comparison.
Rather than apply it to the whole script, just the current command line
is affected.   This allows a trick like ${.OODATE:M.NOMETA_CMP}
to cause command comparison to be supressed for one command only.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Mar 23 23:39:47 2013 UTC (11 years ago) by sjg
Branch: MAIN
Changes since 1.27: +2 -1 lines
Diff to previous 1.27 (colored)

After removing an entry from missingFiles,
set ln=NULL after Lst_Remove() to make it clear we won't use it
after this point.

Revision 1.27 / (download) - annotate - [select for diffs], Sat Mar 23 05:31:29 2013 UTC (11 years ago) by sjg
Branch: MAIN
CVS Tags: agc-symver-base, agc-symver
Changes since 1.26: +18 -2 lines
Diff to previous 1.26 (colored)

If built with filemon support, set .MAKE.PATH_FILEMON to _PATH_FILEMON
so that makefiles can test for it.

Revision 1.26 / (download) - annotate - [select for diffs], Sat Jan 19 04:23:37 2013 UTC (11 years, 2 months ago) by sjg
Branch: MAIN
CVS Tags: yamt-pagecache-base8, dholland-make-base
Changes since 1.25: +14 -12 lines
Diff to previous 1.25 (colored)

meta_oodate: rename ignoreOODATE to needOODATE.
if target uses ${.OODATE} in its script;
1. we canno compare commands
2. if we decide it is out-of-date .OODATE must not be empty.
   The only option is to set it to .ALLSRC

Revision 1.25 / (download) - annotate - [select for diffs], Wed Jun 27 17:22:58 2012 UTC (11 years, 9 months ago) by sjg
Branch: MAIN
CVS Tags: yamt-pagecache-base7, yamt-pagecache-base6
Branch point for: tls-maxphys
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

gcc 4.2 doesn't like externs inside functions

Revision 1.24 / (download) - annotate - [select for diffs], Wed Sep 21 14:30:47 2011 UTC (12 years, 6 months ago) by christos
Branch: MAIN
CVS Tags: yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, 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
Branch point for: yamt-pagecache
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

PR/45383: Henning Petersen: Swapped lseek args

Revision 1.23 / (download) - annotate - [select for diffs], Fri Sep 2 16:26:21 2011 UTC (12 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.22: +11 -1 lines
Diff to previous 1.22 (colored)

meta_oodate should ignore makeDependfile

Revision 1.22 / (download) - annotate - [select for diffs], Sun Aug 28 03:54:07 2011 UTC (12 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.21: +10 -2 lines
Diff to previous 1.21 (colored)

In meta mode, we create .meta files for most targets.
These capture all the interesting data - useful for debugging.
In such cases there is no need to replicate commands in the build log.
Rather than run the entire build .SILENT, allow meta mode to set that flag
per target iff a .meta file is created.
Normal behavior is retained for targets where no .meta file is created,
ensuring that no build data is lost.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Aug 18 00:00:21 2011 UTC (12 years, 8 months ago) by sjg
Branch: MAIN
Changes since 1.20: +7 -1 lines
Diff to previous 1.20 (colored)

If a target is explicitly flagged .META,
a missing .meta file means it is out-of-date.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jun 22 21:13:12 2011 UTC (12 years, 9 months ago) by sjg
Branch: MAIN
Changes since 1.19: +20 -3 lines
Diff to previous 1.19 (colored)

After each strsep(&p) check that p is valid.
If not the .meta file is corrupted (build interrupted?)
issue a warning and declare target oodate.

Revision 1.19 / (download) - annotate - [select for diffs], Sat Jun 11 02:10:48 2011 UTC (12 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

Use %zu rather than cast

Revision 1.18 / (download) - annotate - [select for diffs], Fri Jun 10 23:57:39 2011 UTC (12 years, 10 months ago) by sjg
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

size_t on amd64 doesn't like %u, use a cast.

Revision 1.17 / (download) - annotate - [select for diffs], Wed May 4 20:38:32 2011 UTC (12 years, 11 months ago) by sjg
Branch: MAIN
CVS Tags: cherry-xenmp-base
Branch point for: cherry-xenmp
Changes since 1.16: +108 -2 lines
Diff to previous 1.16 (colored)

Add .MAKE.META.BAILIWICK - to identify the scope of make's control.
meta_oodate: if a file that was written or linked within our bailiwick,
but outside of .OBJDIR is missing, add it to missingFiles.
If we get to the end of the .meta file without seeing it [re]moved,
then consider the target out-of-date.

Revision 1.16 / (download) - annotate - [select for diffs], Thu Mar 31 06:50:43 2011 UTC (13 years ago) by sjg
Branch: MAIN
Changes since 1.15: +2 -1 lines
Diff to previous 1.15 (colored)

Call meta_job_finish() from meta_job_error(), so that if
the .ERROR target copies the .meta file, it has been completed.
meta_job_finish() is safe to call again.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Mar 30 22:03:49 2011 UTC (13 years ago) by sjg
Branch: MAIN
Changes since 1.14: +2 -0 lines
Diff to previous 1.14 (colored)

Add NetBSD tags

Revision 1.14 / (download) - annotate - [select for diffs], Tue Mar 29 17:29:20 2011 UTC (13 years ago) by sjg
Branch: MAIN
Changes since 1.13: +9 -10 lines
Diff to previous 1.13 (colored)

Check for extra commands as soon as we reach CWD,
so we return faster (if oodate) and give a more accurate debug message.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Mar 27 19:47:46 2011 UTC (13 years ago) by sjg
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Use curdirOk as the token

Revision 1.12 / (download) - annotate - [select for diffs], Sun Mar 27 19:39:21 2011 UTC (13 years ago) by sjg
Branch: MAIN
Changes since 1.11: +19 -1 lines
Diff to previous 1.11 (colored)

When .MAKE.MODE inlcudes 'meta'; 'curdir=true' enables creating .meta
files in .CURDIR - such as when running make in .OBJDIR with a generated
makefile.

Revision 1.11 / (download) - annotate - [select for diffs], Sun Mar 6 17:41:11 2011 UTC (13 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.10: +9 -8 lines
Diff to previous 1.10 (colored)

Only need to getcwd() once

Revision 1.10 / (download) - annotate - [select for diffs], Sun Mar 6 04:34:25 2011 UTC (13 years, 1 month ago) by sjg
Branch: MAIN
Changes since 1.9: +1 -1 lines
Diff to previous 1.9 (colored)

CWD should be compared against cwd

Revision 1.9 / (download) - annotate - [select for diffs], Fri Mar 4 04:55:51 2011 UTC (13 years, 1 month ago) by sjg
Branch: MAIN
CVS Tags: bouyer-quota2-nbase
Changes since 1.8: +2 -8 lines
Diff to previous 1.8 (colored)

main.c now exports curdir[] so we can use it.

Revision 1.8 / (download) - annotate - [select for diffs], Sun Feb 13 21:22:41 2011 UTC (13 years, 2 months ago) by sjg
Branch: MAIN
CVS Tags: bouyer-quota2-base
Changes since 1.7: +71 -2 lines
Diff to previous 1.7 (colored)

When making a target that involves creating itermediate dirs,
realpath() will fail until after those dirs exist.
Try to ensure the same meta file name is used regardless.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Feb 8 05:29:13 2011 UTC (13 years, 2 months ago) by sjg
Branch: MAIN
Changes since 1.6: +18 -2 lines
Diff to previous 1.6 (colored)

tmplen should be static

Revision 1.6 / (download) - annotate - [select for diffs], Wed Dec 15 23:03:35 2010 UTC (13 years, 4 months ago) by sjg
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231
Branch point for: bouyer-quota2
Changes since 1.5: +2 -1 lines
Diff to previous 1.5 (colored)

Invalidate meta_fname when we finish a job, so that in compat
mode, we do not report a previous .meta file as being involved
in an error.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Dec 9 22:30:17 2010 UTC (13 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.4: +153 -31 lines
Diff to previous 1.4 (colored)

meta_oodate(): we should track 'latestdir' on a per process basis.
Also, only consider target out of date if a not-found file is outside
'CWD'.  Ignore anything in "/tmp/" or tmpdir.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Nov 27 05:02:35 2010 UTC (13 years, 4 months ago) by sjg
Branch: MAIN
Changes since 1.3: +21 -7 lines
Diff to previous 1.3 (colored)

When a source file moves, make will ignore the stale dependency,
but if the file in question is one that needs to be compiled (.c or .cc),
it still hands the bogus name to the compiler.

If Dir_MTime() cannot find such a file (gn->iParents is not empty),
see if the basename can be found via .PATH, and if so set gn->path to
the found file.   This prevents the stale path being given to the
compiler.

In meta_oodate(), if a referenced file no longer exists, consider the
target out-of-date.

Also, if meta_oodate() decides a target is out-of-date, and it
it uses .OODATE in its commands, we need .OODATE recomputed.
Undo our call to Make_DoAllVar() so that the call from Make_OODate()
will do the right thing.

Revision 1.3 / (download) - annotate - [select for diffs], Mon Sep 13 21:31:59 2010 UTC (13 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.2: +3 -0 lines
Diff to previous 1.2 (colored)

tools/make/buildmake.sh compiles *.c, make sure meta.c does nothing
unless USE_META is defined.

Revision 1.2 / (download) - annotate - [select for diffs], Mon Sep 13 20:34:21 2010 UTC (13 years, 7 months ago) by sjg
Branch: MAIN
Changes since 1.1: +6 -2 lines
Diff to previous 1.1 (colored)

We do not need filemon(9) to have a .meta file

Revision 1.1 / (download) - annotate - [select for diffs], Mon Sep 13 15:36:57 2010 UTC (13 years, 7 months ago) by sjg
Branch: MAIN

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).

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>