History log of /src/usr.bin/make/util.c |
Revision | | Date | Author | Comments |
1.78 |
| 15-Dec-2021 |
rillig | make: format comments according to /usr/share/misc/style
Assisted by indent(1), with manual corrections due to its many remaining bugs.
No functional change.
|
1.77 |
| 15-Dec-2021 |
rillig | make: use consistent indentation for statements and continuations
No binary change, except for line numbers in assertions in suff.c.
|
1.76 |
| 03-Feb-2021 |
rillig | 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.
|
1.75 |
| 03-Feb-2021 |
rillig | make: fix compiler warning about signedness in comparison
|
1.74 |
| 01-Feb-2021 |
rillig | make: replace pre-increment with post-increment or simple addition
The rest of the code already prefers post-increment if there is no actual difference.
|
1.73 |
| 30-Dec-2020 |
rillig | make(1): format multi-line comments
|
1.72 |
| 15-Dec-2020 |
rillig | make(1): indent nonints.h and util.c with tabs instead of spaces
|
1.71 |
| 05-Dec-2020 |
rillig | make(1): refuse to use vsnprintf that is prone to buffer overflows
Several parts of make intentionally depend on the guarantee that snprintf and vsnprintf do not overflow their buffer. If an implementation cannot provide this guarantee, refuse to use it.
|
1.70 |
| 23-Nov-2020 |
rillig | make(1): use comparisons in boolean expressions
The generated code stays exactly the same.
|
1.69 |
| 23-Nov-2020 |
rillig | make(1): align end-of-line comments with tabs
|
1.68 |
| 16-Nov-2020 |
rillig | make(1): use postfix increment where possible
|
1.67 |
| 08-Nov-2020 |
rillig | make(1): use common indentation style for else
|
1.66 |
| 07-Nov-2020 |
rillig | make(1): clean up spacing in fallback implementation of vsnprintf
|
1.65 |
| 05-Nov-2020 |
rillig | make(1): remove redundant parentheses from sizeof operator
The parentheses are only needed if the argument is a type, not an expression.
|
1.64 |
| 06-Oct-2020 |
rillig | make(1): remove incomplete fallback implementation of strftime
The function strftime is available since C89. Any environments older than that are not supported anymore.
|
1.63 |
| 05-Oct-2020 |
rillig | make(1): revert previous commit
It had accidentally reverted all the work from the past few days.
|
1.62 |
| 05-Oct-2020 |
rillig | make(1): fix double-free bug in -DCLEANUP mode (since 2020-10-02)
The bug had been introduced with dir.c 1.155 on 2020-10-02 22:20:25. In that commit, openDirectories was replaced with a combination of a list with a hash table, for more efficient lookup by name.
Upon cleanup, OpenDirs_Done is called, which in turn called Dir_ClearPath. Dir_ClearPath takes full ownership of the given list and empties it. This was no problem before since afterwards the list was empty and calling Lst_Free just frees the remaining list pointer.
With OpenDirs, this list was combined with a hash table, and the hash table contains the list nodes, assuming that the OpenDirs functions have full ownership of both the list and the hash table. This assumption was generally correct, except for the one moment during cleanup where full ownership of the list was passed to Dir_ClearPath, while the hash table still contained pointers to the (now freed) list nodes. This by itself was not a problem since the hash table would be freed afterwards. But as part of Dir_ClearPath, OpenDirs_Remove was called, which looked up the freed directory by name and now found the freed list node, trying to free it again. Boom.
Fixed by replacing the call to Dir_ClearPath with code that only frees the directories, without giving up control over the list.
|
1.61 |
| 03-Oct-2020 |
rillig | make(1): clean up #include sections
|
1.60 |
| 13-Sep-2020 |
rillig | make(1): clean up RCSID blocks
These blocks mostly consisted of redundant structure, following the same #ifndef pattern over and over, with only minimal variation.
It's easier to maintain if the common structure is only written once and encapsulated in a macro.
To avoid "defined but unused" warnings from GCC in the case where MAKE_NATIVE is not defined, I had to add volatile. Adding MAKE_ATTR_UNUSED alone would not preserve the rcsid variable in the resulting binary.
|
1.59 |
| 12-Sep-2020 |
rillig | make(1): add typedef for signal handler
Without this typedef, both the declaration and the definition of bmake_signal were as unreadable as the declaration in the signal(3) manual page.
|
1.58 |
| 01-Aug-2020 |
rillig | make(1): use consistent indentation in source code
Tabs for multiples of 8, then spaces.
The usage string has been kept as-is since the spaces there are indentional and do influence the output.
|
1.57 |
| 03-Jul-2020 |
rillig | make(1): remove trailing whitespace
|
1.56 |
| 03-Jul-2020 |
rillig | make(1): remove redundant parentheses around return values
|
1.55 |
| 07-Jan-2020 |
rillig | usr.bin/make: remove dead code
The preprocessor conditions contradicted each other: __hpux__ or __hpux would need to be defined, and at the same time none of them would need to be defined.
|
1.54 |
| 26-Nov-2013 |
joerg | branches: 1.54.26; Include signal.h early for MiNT and Linux. From pkgsrc.
|
1.53 |
| 04-Jun-2012 |
sjg | branches: 1.53.2; Fix findenv() to fully match name
|
1.52 |
| 04-Jun-2012 |
sjg | Var_UnExport() and setenv() can both realloc environ. Use a common variable (savedEnv) to track that to avoid wasting memory. Also, if providing setenv and unsetenv, do getenv too to ensure a consistent set.
|
1.51 |
| 02-Apr-2011 |
mbalmer | branches: 1.51.4; Declare variable only once. Fixes PR 44795.
|
1.50 |
| 03-Jun-2010 |
sjg | We have required sigaction() for quite a while. Use bmake_signal() - a wrapper around sigaction() rather than signal() to ensure that signals are handled consistently.
|
1.49 |
| 05-May-2010 |
sjg | gcc defines __svr4__ SunPro compiler defines __SVR4 We need to check both to ensure that on SunOS signal is hooked into sigaction - otherwise we do not pass the unit-tests due to missing a SIGCHLD
|
1.48 |
| 29-Jan-2009 |
dholland | Fix flagrantly wrong printf formats in compat strftime.
|
1.47 |
| 13-Dec-2008 |
dsl | Use NULL instead of -1 cast to the relavant type (usually via NIL). This was a suggestion from christos - so blame him if there is a deep reason for using -1 :-)
|
1.46 |
| 31-Oct-2008 |
christos | Don't use putenv() because it is not portable.
|
1.45 |
| 06-Oct-2008 |
joerg | branches: 1.45.2; Don't use emalloc and friends directly, but call them consistently bmake_malloc and friends. Implement them via macros for the native case and provide fallback implementations otherwise. Avoid polluting the namespace by not defining enomem globally. Don't bother to provide strdup and strndup, they were only used for the estrdup and estrndup comapt code.
This addresses the presence of emalloc in system libraries on A/UX and resulted strange issues as reported by Timothy E. Larson.
|
1.44 |
| 15-Feb-2008 |
christos | back all changes out until I fix it properly.
|
1.43 |
| 14-Feb-2008 |
christos | - use pid_t/size_t as appropriate instead of int. - use %ld to print pids. - fix a bit of lint. - WARNS=4
|
1.42 |
| 15-Oct-2007 |
sjg | If we don't have emalloc, we won't have strndup either. Allows building current make on 2.0.
|
1.41 |
| 13-Oct-2007 |
apb | * Convert all uses of strdup() to estrdup(); * Use estrndup() in a few cases where it simplifies the code; * Provide compatibility definitions of strndup and estrndup;
|
1.40 |
| 17-Jan-2007 |
hubertf | branches: 1.40.4; Remove duplicate #includes From Slava Semushin <slava.semushin@gmail.com>, via private mail
|
1.39 |
| 08-Aug-2005 |
christos | branches: 1.39.6; 1.39.8; From Max Okumoto: - Remove casts to NULL. - Remove space between cast and object.
|
1.38 |
| 05-Aug-2005 |
christos | More KNF cleanups from Max Okumoto
|
1.37 |
| 25-Jul-2005 |
christos | Whitespace KNF cleanup from Max Okumoto
|
1.36 |
| 16-Feb-2005 |
christos | PR/29203, PR/29204: Max Okumoto: KNF changes to make [no functional changes]
|
1.35 |
| 07-May-2004 |
ross | Simplify build, no functional changes.
Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when you want things simple, instead add MAKE_NATIVE to get those hugely important features like __RCSID().
It's now possible to build make on some hosts with: cc *.c */*.c
|
1.34 |
| 16-Jul-2003 |
itojun | branches: 1.34.2; we can't use snprintf here, as sizeof(pathname) is unknown
|
1.33 |
| 22-Sep-2002 |
lukem | HP/UX fixes from Giles Lean: - consistently support __hpux (which the HP compilers define) as well as __hpux__ (not sure which compilers set this, but retained anyway) - fix a typo in the definition of signal(). arguably the codebase should just be converted to sigaction()...
|
1.32 |
| 15-Jun-2002 |
wiz | Remove !__STDC__ stuff, de-__P(), ANSIfy, and de-register.
|
1.31 |
| 12-Mar-2002 |
christos | PR/15888: Jarkko Teppo: Problems building on HP/UX 1. Compensate for h-pox assert brain damage where it gets confused by the string in: assert(!memcmp(foo, "in", 2)); I miss the h-pox broken compiler, I had not had to work around it for years. 2. Oh, finally h-pox has random() and utimes(). We don't need our own anymore.
|
1.30 |
| 02-Mar-2002 |
tv | Add <errno.h> to list of includes, from <imago@13thmonkey.org>, in PR toolchain/15386.
|
1.29 |
| 27-Jan-2002 |
reinoud | Fix major bug in make(1) ... due to shadowing of the dotLast path used for the .DOTLAST primitive by a boolean variable with the same name, this whole mechanism was broken ... it doesn't save much stat calls but it was wrong.
Thanks to Jason Thorpe for the other shadow-variable fixing patches he made.
|
1.28 |
| 25-Jan-2002 |
tv | Make util.c replacement functions use autoconf conditionals to probe what is Really available in the host OS.
|
1.27 |
| 11-Dec-2001 |
tv | Add __CYGWIN__ to list of exceptions from homegrown strftime().
(XXX - This should be an inclusive, not exclusive, list. Later, this should be autoconfiscated, but keep the internal implementation, since src/tools/compat isn't necessarily available for use at make's build time.)
|
1.26 |
| 03-Aug-2000 |
christos | PR/10714: SUNAGAWA Keiki: Add newer hpux support, but without removing the old hpux support.
|
1.25 |
| 04-May-2000 |
drochner | support OSF/1
|
1.24 |
| 06-Jan-2000 |
wrstuden | Add a few little changes needed to get this to compile on IRIX 6.4.
|
1.23 |
| 04-Sep-1999 |
christos | PR/8259: Chris Demetriou: Fix stack overflow bugs exposed by the glibc-2.1.1 Makefile. Use snprintf everywhere.
|
1.22 |
| 27-Aug-1999 |
simonb | Don't need strftime() on Ultrix either.
|
1.21 |
| 29-Jun-1999 |
christos | apply solaris fixes
|
1.20 |
| 19-Mar-1999 |
christos | use emalloc() instead of malloc()
|
1.19 |
| 06-Nov-1998 |
christos | - full prototypes - more conservative printf - char -> unsigned char
|
1.18 |
| 18-Oct-1998 |
christos | strftime is not needed for svr4 machines; also fix the prototype footprint.
|
1.17 |
| 18-Sep-1998 |
christos | PR/6174: ITOH Yasufumi: Purify bug and a compile error in utility code.
|
1.16 |
| 04-Feb-1998 |
christos | Y2K fixes: use strftime(), and add a fake strftime() for systems that do not have it.
|
1.15 |
| 28-Sep-1997 |
lukem | branches: 1.15.2; wrap #include <sys/cdefs.h>, __RCSID(...) stuff in #ifndef MAKE_BOOTSTRAP
|
1.14 |
| 11-Jul-1997 |
christos | #if __STDC__ -> #ifdef __STDC__
|
1.13 |
| 11-Jul-1997 |
christos | sprintf -> vsprintf
|
1.12 |
| 01-Jul-1997 |
christos | Add WARNS=1 RCSID police
|
1.11 |
| 07-Jun-1997 |
christos | Apparently, using _doprnt(_IOREAD) to emulate vsnprintf() on SVR4 *sometimes* core-dumps; use sprintf()+strlen() for now.
|
1.10 |
| 31-Dec-1996 |
christos | implement snprintf() and vsnprintf() for non BSD4_4 systems.
|
1.9 |
| 11-Nov-1996 |
christos | Fir PR/2930: declare missing variable.
|
1.8 |
| 06-Nov-1996 |
christos | - Merge in FreeBSD and Lite2 changes. - Fix bug where a non-archive target with a .a suffix would always be considered to be out of date, since it does not have a TOC.
|
1.7 |
| 30-Aug-1996 |
thorpej | Tidy up some RCS ids a bit.
|
1.6 |
| 13-Aug-1996 |
christos | Add strdup() since ultrix is missing it. From Larry Schwimmer <rosebud@cyclone.Stanford.EDU>
|
1.5 |
| 22-Nov-1995 |
christos | branches: 1.5.4; Updates for POSIX/SVR4 compiling:
arch.c: Don't require ranlib stuff. Not everybody has it. dir.c: SunOS-4 != Solaris; change #ifdef sun to #if sun && !__svr4__ job.c, compat.c: Don't use 'union wait', use int and the W*() macros. main.c: Check for uname() == -1; some unames return > 0... util.c, job.c: Add signal() with BSD semantics for svr4, don't use bsd sigmask and friends.
|
1.4 |
| 14-Jun-1995 |
christos | - $NetBSD$ rcsids - Fixed so that .[A-Z]* targets that do not match keywords are ignored as Posix mandates - Added .PHONY target keyword
|
1.3 |
| 23-Sep-1994 |
mycroft | Use getcwd(3), not getwd(3), and remove some old, unused compatibility code.
|
1.2 |
| 09-May-1994 |
glass | bootstrap improvements
|
1.1 |
| 05-Mar-1994 |
cgd | fixes/improvements from Christos Zoulas <christos@deshaw.com>.
|
1.5.4.1 |
| 26-Jan-1997 |
rat | Update make(1) from trunk, by request from Christos Zoulas. Fixes many bugs.
|
1.15.2.1 |
| 08-May-1998 |
mycroft | Sync with trunk, per request of christos.
|
1.34.2.1 |
| 10-May-2004 |
tron | Pull up revision 1.35 (requested by sjg in ticket #282): Simplify build, no functional changes. Instead of adding MAKE_BOOTSTRAP for hosted environments, i.e., when you want things simple, instead add MAKE_NATIVE to get those hugely important features like __RCSID(). It's now possible to build make on some hosts with: cc *.c */*.c
|
1.39.8.1 |
| 03-Sep-2007 |
wrstuden | Sync w/ NetBSD-4-RC_1
|
1.39.6.1 |
| 05-Jun-2007 |
bouyer | Apply patch (requested by tron in ticket #696): usr.bin/make/compat.c patch usr.bin/make/cond.c patch usr.bin/make/dir.c patch usr.bin/make/for.c patch usr.bin/make/main.c patch usr.bin/make/make.1 patch usr.bin/make/make.c patch usr.bin/make/make.h patch usr.bin/make/nonints.h patch usr.bin/make/parse.c patch usr.bin/make/str.c patch usr.bin/make/targ.c patch usr.bin/make/util.c patch usr.bin/make/var.c patch
Synchronize make(1) with HEAD branch to increase perfomance and improve stability.
|
1.40.4.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.45.2.1 |
| 09-Nov-2008 |
snj | Pull up following revision(s) (requested by cube in ticket #38): usr.bin/make/util.c: revision 1.46 Don't use putenv() because it is not portable.
|
1.51.4.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.51.4.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.53.2.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.54.26.1 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|