Age | Commit message (Collapse) | Author |
|
|
|
doesn't do [for efficiency reason, hash_interval does not deal with
empty strings not declared as intervals. More recent incarnations of
this code will use Var_Value_interval extensively instead]
Problem found by Peter Stromberg.
|
|
|
|
|
|
though...
Ok'ed miod@.
|
|
${BC_${A}} worked but not ${${A}_BC}.
Noticed by fries@
|
|
|
|
similarly to read_archive.
Note we no longer bother seeking back to the start of the header, as only
ArchTouch accesses that header, and can do the seek itself.
With this, arch handling should be working, more or less.
thanks to Todd, Miod, Naddy for reviewing those patches.
|
|
Hence, read_archive must be very careful to parse stuff correctly: don't
use str* when mem* are appropriate, copy numeric fields and ensure they're
terminated...
|
|
and put it into a specific structure (it is wasteful to keep lugging
SVR4 structures once an archive is parsed).
By tweaking read_archive slightly, we can achieve a nicer interface
to ArchSVR4Entry.
Note a bug in make: ArchFindMember does (currently) not use the SVR4 code,
hence some archive members won't be found in non-caching mode...
|
|
|
|
Its main failing is that ar headers are NOT null terminated.
This code is atrocious. This change starts cleaning that up.
Replace the list of cached archives with a hash,
streamline the logic of ArchMTimeMember,
by taking out the actual function that does the reading (read_archive).
More fixes to come.
|
|
Define two possible interfaces: the classic one,
and the new one (used where available) that depends on timespec.
Better granularity, make is now able to distinguish between files that
were built during the same second.
|
|
and expand it directly, without needing a variable context.
Use it in Var_SubstVar, so that .for loops values don't need to be entered
into any context nor looked up.
This speeds up .for loops some, and avoids nasty variable capture
side-effects.
Ok'd millert@, miod@, naddy@ (naddy spotted a problem with the first
version of that change).
|
|
* Buf_Destroy can be a macro
* X_ instead of _X for struct names, to avoid infringing on the system's
namespace.
* better wildcard detection heuristics
* fix #ifdef CLEANUP code
* a few comments
|
|
us. Need to cache the `next' pointer instead.
Do this manually, as adding a new function for one place in make where it's
needed is a bit icky, especially since suff.c's code might get cleaned up
at some point.
Bug reported by Niels.
|
|
- Some .Nm trimming.
- .Sh AUTHOR -> .Sh AUTHORS
- Other miscellaneous fixes here and there.
|
|
|
|
|
|
Slight optimizations: instead of storing archive members, just keep
the modification time, as we don't care for the rest of the archive
information. Lazily compute mtime, stash ascii date instead, and convert
to mtime when needed (storing an out_of_date value to mark the unconverted
values).
Archive handling is atrocious and need some clean-up.
Thanks to miod@ who took the time to review those patches.
|
|
Replace the time stamp hash in dir.c with an open hashing structure.
In doing so, remove some nasty casts, simplify code a bit:
Dir_MTime can return a modification time, since make does not make
a distinction between out-of-date and non-existent files.
|
|
open hashing.
An interesting optimization is that the open hashing interface is more
fine-grained, hence we can compute the correct hash value at the start
of Dir_FindFile, and reuse it for each hash structure into which we look
(the effect is measurable on large directories along with objdir/VPATH).
Remove a few unnecessary Lst_Open/Lst_Close that serve no purpose except
obfuscating the code.
The interface to dir.h changes slightly, hence tedious includes changes...
|
|
the disk or from a cache.
- use it in Dir_AddDir, and directly to set up dot.
- change Dir_AddDir to use string intervals, as this simplifies
dependend functions.
- set up an open-hashing cache for opened directory names.
- add_dirpath() function in main, to simplify code.
- simplify cleaning-up directories, as Dir_ClearPath is overkill.
|
|
Scrap the list of all targets: it only slows make down.
The only visible difference is that the list of all targets is not
shown in order when debugging.
|
|
|
|
iterate_words: light-weight equivalent to brk_string,
which does not need to copy the string, and does not do \ interpretation
which are only needed for the string.
escape_dup: handles escape sequence in a systematic way.
This speeds up variable modifiers.
This also makes .for loops more consistent, as they use the same definition
of `a word' as the rest of make.
|
|
- UNUSED macro that expands to __attribute__((unused)) for gcc
- move rcsid around so that they can be tagged UNUSED.
- activate -Wunused.
- use UNUSED instead of kludgy junk for function arguments.
- add extern to all extern prototypes.
- update comments in lst.h.
- clean up var.c a little bit, constifying arguments, updating comments...
|
|
Obvious fix.
Problem reported by Gregory Steuck, thanks a lot !
|
|
MAKEFLAGS
|
|
|
|
Code to pass variable definitions to submakes through make flags.
Not activated yet, need to fix src/ first.
|
|
|
|
- need braces, as we don't want to change what $$A means,
- this assumes this kind of construct is very infrequent, thus
this does NOT copy the variable name needlessly.
- the expansion code is in a separate function for clarity.
Reviewed by miod@, as previous patches.
|
|
- simplify Var_Parse: use varfind, then leverage on the result
to recognize `special case' dynamic parsing.
VarModifiers_Apply need to be called on NULL strings, to be able to parse
modifiers applied to non-existent variables.
(Alternately, we could call VarModifiers_Apply on a dummy string, but
this is less efficient).
|
|
This does finally make var handling somewhat readable.
|
|
VarModifiers_apply function.
for env lookup, create variable structure first, so that we can get away
without terminating the variable name in main Var_Parse.
|
|
than 1 or 0.
|
|
intervals, and \\ in intervals.
Accordingly, var.c no longer needs to copy the :Marg to replace \: with :
We don't use fnmatch(3) because of various optimizations which are harder
to achieve in a generic setting.
Also add regression suite for the Str_Match function.
|
|
Replace a few int -> size_t
Reviewed by miod@
|
|
- introduce VarFind_interval function. This avoids having to copy variable
names in VarParse,
- expose internals of VarFind* function (not used yet, but this will avoid
multiple lookups in VarParse),
- constify a few functions.
Reviewed by miod@
|
|
variable substitution is.
|
|
|
|
|
|
Ensure make prints sane error messages when obj/ exists.
|
|
make -n mode.
Currently works only in sequential make mode. In parallel make mode,
it's just a no-op.
Useful to debug recursive Makefiles, and part of POSIX.
|
|
hv is a u_int32_t.
Add __BEGIN_DECLS/__END_DECLS
Remove unused macro (hash_to_info).
Add documentation for the hash functions.
|
|
Also forgot a few CLEANFILES.
|
|
In particular, Dir_MakeFlags is abusing str_concat, and works much better
with buffers.
|
|
There is no code change in this patch, we just move the remaining
`lowparse' functions to the right file, and adjust the interface file
accordingly.
Reviewed by miod@
|
|
This does introduce a proper stack of IFiles to handle included files:
instead of having the current file be a special case, it's also an IFile.
The corresponding code is slightly unobfuscated, removing the error-prone
ParseEOF function, freeing the filename systematically (thus, main.c needs
to strdup stdin), and merging both include functions lookup into one.
The speed gain comes from changing the IFile structure to merge with
fgetln seamlessly.
The low-level parse code is mostly moved to a new file, lowparse.c, to
make things easier to read (see next patch as well).
Accordingly, util.c gains a fgetln.
Note the interaction between Parse_File, Dir_FindFile, and ReadMakefile in
main.c. This patch closes a subtle memory hole (only the Makefile names,
so rather small).
Reviewed by miod@.
|