summaryrefslogtreecommitdiff
path: root/usr.bin/make/arch.c
AgeCommit message (Collapse)Author
2023-02-14make: reduce complexity of evaluating expressionsrillig
No functional change.
2022-12-07make: clean up commentsrillig
2022-09-27make: set WARNS to 6, from the default 5rillig
No binary change on x86_64.
2022-01-15make: merge duplicate code for expanding variable expressionsrillig
No functional change.
2021-12-15make: format comments according to /usr/share/misc/stylerillig
Assisted by indent(1), with manual corrections due to its many remaining bugs. No functional change.
2021-12-15make: use consistent indentation for statements and continuationsrillig
No binary change, except for line numbers in assertions in suff.c.
2021-12-12make: in Arch_ParseArchive, rename libName to librillig
For symmetry with mem. No binary change.
2021-12-12make: in Arch_ParseArchive, replace MFStr with FStrrillig
This was the only use of the type MFStr, which produced the same code as FStr. No binary change.
2021-12-12make: use simpler memory management for parsing archive membersrillig
No functional change.
2021-11-28make: convert GNodeFlags from enum into bit-fieldsrillig
Now that Enum_ToString is implemented for each type separately, it's easy to convert them to bit-fields. This gets rid of the magic numbers 12 for CYCLE and 13 for DONECYCLE that left a suspicious gap in the numbers. This gap was not needed since the code didn't make use of the relative ordering of the enum constants. The effects of this conversion are fewer capital letters in the code, smaller scope for the GNode flags, and clearer code especially when setting a flag back to false. One strange thing is that GCC 10.3.0 doesn't optimize GNodeFlags_IsNone to an single bitmasking instruction, at least on x86_64. Instead it generates a testb instruction for each of the flags, even loading bit 8 separately from the others. Clang 12.0.1 knows this optimization though and generates the obvious sequence of movzwl, testl, jz. No functional change.
2021-08-25make: fix lint warnings on ilp32 platformsrillig
The warnings in arch.c were about conversions from int to long. The warnings in var.c were about conversions from long long to ptrdiff_t. No functional change.
2021-08-14make: add ARGSUSED for lintrillig
2021-08-14make: extract RanlibOODate into separate functionrillig
No functional change.
2021-05-30make: inline str_concat4rillig
This function is only ever used for forming strings of the form "archive(member)". No functional change.
2021-04-03make: use C99 bool type instead of defining its ownrillig
No functional change.
2021-03-15make: replace enum bit-field with struct bit-field for VarEvalFlagsrillig
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.
2021-02-05make: in the Var_ functions, move the scope to the frontrillig
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.
2021-02-04make: rename context and ctxt to scoperillig
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.
2021-02-04make: merge duplicate code in Arch_FindLibrillig
No functional change. Furthermore, this only affects builds that explicitly disable LIBRARIES in config.h.
2021-01-23make(1): rename Dir_Expand to SearchPath_Expandrillig
The main subject of this function is the search path. In this search path the pattern is expanded.
2021-01-09make(1): fix lint warningsrillig
2020-12-30make(1): format multi-line commentsrillig
2020-12-20make(1): eliminate libName_freeIt from Arch_ParseArchiverillig
2020-12-20make(1): return FStr from Var_Parserillig
This reduces the number of variable declarations at the call sites.
2020-12-18make(1): spell nonexistent consistentlyrillig
2020-12-13make(1): add str_basename to reduce duplicate coderillig
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.
2020-12-06make(1): remove comment decorationrillig
2020-12-05make(1): remove redundant assignmentsrillig
2020-12-05make(1): remove unused variable from ArchFindMemberrillig
2020-12-04make(1): improve variable names in Arch_ParseArchiverillig
The variable buf used to be a Buffer, now it is a simple string pointer.
2020-12-04make(1): use consistent variable names for list nodesrillig
2020-11-29make(1): reduce memory allocation for dirSearchPathrillig
2020-11-28make(1): reduce memory allocation in Arch_ParseArchiverillig
2020-11-28make(1): reduce pointer indirection for archivesrillig
2020-11-28make(1): reduce memory allocation for GNode.parents and GNode.childrenrillig
2020-11-23make(1): indent arch.c with tabs instead of spacesrillig
2020-11-14make(1): replace a few HashTable_CreateEntry with HashTable_Setrillig
Instead of HashTable_CreateEntry and HashEntry_Set, several places just need the HashEntry for storing a value in it. This makes the calling code simpler to understand. These parts of the code are already hard enough to understand since they are about memory management and aliasing. Having a too detailed API for the HashTable only distracts from these topics.
2020-11-14make(1): fix typo in commentsrillig
This typo may have been influenced by all the '$' in the code.
2020-11-08make(1): clean up code related to VarEvalFlagsrillig
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.
2020-11-08make(1): change return type of Arch_MTime to voidrillig
This makes it easier to prove that Dir_MTime always returns gn->mtime, without looking at the implementation of Arch_UpdateMTime.
2020-11-08make(1): change return type of Arch_MemberMTime to voidrillig
This makes it easier to prove that Dir_MTime always returns gn->mtime, without looking at the implementation of Arch_UpdateMemberMTime.
2020-11-08make(1): rename Make_OODate to GNode_IsOODaterillig
It doesn't matter which of the make modules is in charge of determining whether a node is out-of-date. Therefore, remove the module name from the function name.
2020-11-07make(1): clean up Arch_LibOODaterillig
2020-11-07make(1): document duplicate code in arch.crillig
2020-11-07make(1): fix function names in archive debug outputrillig
2020-11-07make(1): fix out-of-bounds pointer in ArchStatMember (since 1993-03-21)rillig
2020-11-07make(1): reduce indentation in ArchStatMemberrillig
2020-11-07make(1): replace hashed with cached in commentsrillig
The hash table is just an implementation detail, not worth to be mentioned in comments.
2020-11-07make(1): fix access to undefined memory (since 1994-03-18)rillig
This bug was added in arch.c 1.6, "Do extended-name archives".
2020-11-07make(1): clean up ArchStatMemberrillig
Whether an archive entry is hashed or not is completely irrelevant. The interesting thing is whether it ends up in a cache.