Home | History | Annotate | Download | only in mkdep
History log of /src/usr.bin/mkdep/findcc.c
RevisionDateAuthorComments
 1.10  20-Aug-2021  rillig mkdep: avoid memory allocation in findcc

This change takes the idea of handling strings as pairs in the form
(start, len) by Robert Elz from
https://mail-index.netbsd.org/source-changes-d/2021/08/20/msg013427.html
and expands it by avoiding one more memory allocation, for iterating the
PATH environment variable.

No functional change.
 1.9  20-Aug-2021  rillig mkdep: make argument of findcc const

Previously, findcc modified its argument string, even though it had been
declared as 'const char *'. This triggered a lint warning that "strchr
effectively discards 'const char *' from argument", in fact, this code
caused the lint check to be implemented in the first place.

The first attempt at fixing it by removing the 'const' from the
parameter type was a bad idea since it made the API of that function
more complicated.

Revert back to making the parameter a 'const char *' and duplicate that
string internally as necessary. Add a few more tests for absolute
pathnames since these had been missing before. There are no tests yet
for snprintf with too long strings, but the current change does not
modify that part of the code.
 1.8  19-Aug-2021  rillig mkdep: fix prototype of findcc

A function that modifies a string argument must not declare that
argument as 'const char *', even if all callers (mkdep and lint) always
pass it a modifiable string.

No functional change.
 1.7  11-Aug-2021  rillig mkdep: document possible undefined behavior

If findcc is called with a constant string, as its prototype suggests,
the process crashes with a segmentation fault. Luckily, neither mkdep
nor lint do that, but the function prototype is nevertheless confusing.
 1.6  04-Sep-2011  joerg ANSIfy + static + __dead
 1.5  12-Apr-2009  lukem fix -Wcast-qual & -Wsign-compare issues
 1.4  21-Jul-2008  lukem branches: 1.4.6;
Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
 1.3  28-Apr-2008  martin branches: 1.3.2;
Remove clause 3 and 4 from TNF licenses
 1.2  27-Oct-2003  lukem branches: 1.2.32;
Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1  14-Jun-2002  simonb Split out the findcc() function that tries to determine the path to
the C compiler so other programs can use it.
 1.2.32.1  18-May-2008  yamt sync with head.
 1.3.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.6.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html

RSS XML Feed