OpenBSD CVS

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


[BACK] Up to [local] / src / usr.bin / make

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.30 / (download) - annotate - [select for diffs], Mon Sep 4 11:35:11 2023 UTC (8 months, 2 weeks ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.29: +1 -2 lines
Diff to previous 1.29 (colored)

GC old code that was originally implemented to facilitate adoption by
other BSDs, which never happened, so make things simpler for further
development.

Ditches config.h entirely since it gets reduced to 2 defines.

okay tb@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Jan 13 13:54:44 2020 UTC (4 years, 4 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.28: +10 -1 lines
Diff to previous 1.28 (colored)

introduce a "Buf_Reinit" function for handling static buffers that can
be reused throughout running make.   Instead of recreating buffers of
dubious appropriate size, have one single buffer for various stages of
parsing.

Revision 1.28 / (download) - annotate - [select for diffs], Sat Dec 21 15:26:47 2019 UTC (4 years, 4 months ago) by espie
Branch: MAIN
Changes since 1.27: +26 -33 lines
Diff to previous 1.27 (colored)

tweak buffer handling a bit:
- make BufExpand a real function, zap BufOverflow
- sprinkle assert that justify the arithmetic
- use unsigned constants
- fix a bug in the unlikely condition where Buf_printf would exactly
match the buffer boundary and Buf_Retrieve would be called right after

okay millert@

Revision 1.27 / (download) - annotate - [select for diffs], Wed Apr 29 00:42:12 2015 UTC (9 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.26: +2 -1 lines
Diff to previous 1.26 (colored)

Add missing #include <stdint.h> for SIZE_MAX

Revision 1.26 / (download) - annotate - [select for diffs], Sat Apr 25 15:33:47 2015 UTC (9 years ago) by espie
Branch: MAIN
Changes since 1.25: +15 -2 lines
Diff to previous 1.25 (colored)

add check for overflow while doubling (very unlikely in practice, but still
better style code). Problem noticed by deraadt@ in m4.

okay doug@ deraadt@

Revision 1.25 / (download) - annotate - [select for diffs], Wed Nov 7 14:18:41 2012 UTC (11 years, 6 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.24: +1 -11 lines
Diff to previous 1.24 (colored)

say goodbye to killing trailing spaces.
this was yet another weirdness in our make that isn't shared by
other makes, and that isn't part of any standard.
This means end-of-line spaces in variables ARE significant (spaces
around the equal sign still aren't).

okay sthen@, "sounds fine" deraadt@

Revision 1.24 / (download) - annotate - [select for diffs], Fri Sep 21 07:55:20 2012 UTC (11 years, 7 months ago) by espie
Branch: MAIN
Changes since 1.23: +20 -1 lines
Diff to previous 1.23 (colored)

major overhaul of the way make handle jobs, inspired by dpb:
instead of forking a "job" per target, and having that job further fork
separate commands, have make maintain a list of jobs, indexed by pid
of currently running commands, and handle process termination
continuation-style.  This has lots of benefits:
- make is responsible for most printing, so we no longer need pipes nor
job control: make -j jobs see the tty.
- no more special-casing for jobs that don't really execute anything.
- unify code for make -jn and make -B, including signal handlers and
job waiting.  So make -n, make -q, +cmd now run commands in the same
way in all cases.
- unified more accurate error-reporting, as make knows precisely which
command failed. Commands are tagged with their lines, and we display failing
commands in silent mode.
- fine-grained "expensive" command handling (recursion limiter). Do it
per-command instead of per-target.

Moreover, signal response is now simpler, as we just block the signals
in a small critical sections, test for events, and sigpause (thanks a lot
to guenther@ and millert@), so running make is now almost always paused
without any busy-waiting.

Thanks to everyone who tested and gave input.

Revision 1.23 / (download) - annotate - [select for diffs], Mon Jul 19 19:46:43 2010 UTC (13 years, 10 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.22: +1 -2 lines
Diff to previous 1.22 (colored)

Correct $OpenBSD$ stuff

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jul 19 19:30:37 2010 UTC (13 years, 10 months ago) by espie
Branch: MAIN
Changes since 1.21: +1 -1 lines
Diff to previous 1.21 (colored)

two small changes:
- allow variables in SysV modifiers, as requested by matthieu@
(since recursive variables are an extension, this just extends the
extension)
- variation on :Q  called :QL (quote list), which does quote every character
EXCEPT for whitespace. e.g.,

toto:
	@for i in ${VAR:QL} ...

Revision 1.21 / (download) - annotate - [select for diffs], Tue Jul 24 21:09:07 2007 UTC (16 years, 9 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.20: +30 -30 lines
Diff to previous 1.20 (colored)

reindent (no binary change)

Revision 1.20 / (download) - annotate - [select for diffs], Wed Apr 7 13:11:35 2004 UTC (20 years, 1 month ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.19: +6 -13 lines
Diff to previous 1.19 (colored)

ISO function declarations, trim a few comments, rename a few variables to
more explicit/more consistent names.

okay otto@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jun 3 02:56:11 2003 UTC (20 years, 11 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.18: +2 -6 lines
Diff to previous 1.18 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.18 / (download) - annotate - [select for diffs], Wed May 30 00:43:00 2001 UTC (22 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)

-Wall cleanup, mostly useless otherwise

Revision 1.17 / (download) - annotate - [select for diffs], Tue May 29 12:17:03 2001 UTC (22 years, 11 months ago) by espie
Branch: MAIN
Changes since 1.16: +2 -1 lines
Diff to previous 1.16 (colored)

Blech! gcc is a stupid program. Compiling with -fno-builtin shows lots
of missing function declarations.

Revision 1.16 / (download) - annotate - [select for diffs], Wed May 23 12:34:40 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.15: +12 -19 lines
Diff to previous 1.15 (colored)

Mostly clean-up:
- cut up those huge include files into separate interfaces for all modules.
Put the interface documentation there, and not with the implementation.
- light-weight includes for needed concrete types (lst_t.h, timestamp_t.h).
- cut out some more logically separate parts: cmd_exec, varname, parsevar,
timestamp.
- put all error handling functions together, so that we will be able to
clean them up.
- more systematic naming: functioni  to handle interval, function to handle
string.
- put the init/end code apart to minimize coupling.
- kill weird types like ReturnStatus and Boolean. Use standard bool (with a
fallback for non-iso systems)
- better interface documentation for lots of subsystems.

As a result, make compilation goes somewhat faster (5%, even considering
the largish BSD copyrights to read). The corresponding preprocessed
source goes down from 1,5M to 1M.

A few minor code changes as well: Parse_DoVar is no longer destructive.
Parse_IsVar functionality is folded into Parse_DoVar (as it knows what an
assignment is), a few more interval handling functions. Avoid calling
XXX_End when they do nothing, just #define XXX_End   to nothing.

Parse_DoVar is slightly more general: it will handle compound assignments
as long as they make sense, e.g., VAR +!= cmd
will work.  As a side effect, VAR++=value now triggers an error
(two + in assignment).
- this stuff doesn't occur in portable Makefiles.
- writing VAR++ = value or VAR+ +=value  disambiguates it.
- this is a good thing, it uncovered a bug in bsd.port.mk.

Tested by naddy@. Okayed millert@. I'll handle the fallback if there is
any. This went through a full make build anyways, including isakmpd
(without mickey's custom binutils, as he didn't see fit to share it with me).

Revision 1.15 / (download) - annotate - [select for diffs], Thu May 3 13:41:01 2001 UTC (23 years ago) by espie
Branch: MAIN
Changes since 1.14: +46 -25 lines
Diff to previous 1.14 (colored)

Synch with my current work.
Numerous changes:
- generate can build several tables
- style cleanup
- statistics code
- use variable names throughout (struct Name)
- recursive variables everywhere
- faster parser (pass buffer along instead of allocating multiple copies)
- correct parser. Handles comments everywhere, and ; correctly
- more string intervals
- simplified dir.c, less recursion.
- extended for loops
- sinclude()
- finished removing extra junk from Lst_*
- handles ${@D} and friends in a simpler way
- cleaned up and modular VarModifiers handling.
- recognizes some gnu Makefile usages and errors out about them.

Additionally, some extra functionality is defined by FEATURES. The set of
functionalities is currently hardcoded to OpenBSD defaults, but this may
include support for some NetBSD extensions, like ODE modifiers.

Backed by miod@ and millert@, who finally got sick of my endless patches...

Revision 1.14 / (download) - annotate - [select for diffs], Fri Nov 24 14:27:19 2000 UTC (23 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.13: +3 -11 lines
Diff to previous 1.13 (colored)

Clean-ups:
* 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

Revision 1.13 / (download) - annotate - [select for diffs], Thu Sep 14 13:32:05 2000 UTC (23 years, 8 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.12: +10 -9 lines
Diff to previous 1.12 (colored)

Some systematic clean-up.
- 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...

Revision 1.12 / (download) - annotate - [select for diffs], Thu Dec 16 17:02:45 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.11: +7 -17 lines
Diff to previous 1.11 (colored)

Allocate buffers as static data structures.
This cuts down quite a lot of malloc, since in actual use,
buffer usage is mostly static.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Dec 16 16:46:38 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.10: +25 -101 lines
Diff to previous 1.10 (colored)

Remove redundant fields from struct Buffer.

Revision 1.10 / (download) - annotate - [select for diffs], Thu Dec 16 16:41:41 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.9: +2 -44 lines
Diff to previous 1.9 (colored)

Split Buf_GetAll into Buf_Retrieve/Buf_Size.
(idiotic to retrieve size every time when it's used half the time)

Revision 1.9 / (download) - annotate - [select for diffs], Thu Dec 16 16:27:12 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.8: +30 -57 lines
Diff to previous 1.8 (colored)

Start cleaning up buf.c in earnest.

- Buf_Discard is only used to remove all the bytes in a buffer,
replace with Buf_Reset,
- buffer values are not read unless accessed first through Buf_GetAll,
no need to null-terminate it at every point.
- Buf_Expand need not check if the expansion is needed. That's Buf_AddChar
and Buf_AddChars responsability (otherwise, Buf_AddChar checks twice)
- Buf_Overflow only handles overflow. Adding the character is done in
every case anyway.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Dec 6 22:24:31 1999 UTC (24 years, 5 months ago) by espie
Branch: MAIN
Changes since 1.7: +75 -71 lines
Diff to previous 1.7 (colored)

Clean up buffers interface somewhat:

- buf.c deals exclusively with chars. Be explicit about it, and remove
extraneous dumb casts to char (can hide real type errors).
- buffer sizes are size_t. Note that bp->left can never become NULL.
- Buf_GetAll is happy with a NULL pointer for the size, remove unneeded
extra pointers.
- Propagate size_t to all places where buffer functions are used.

Revision 1.7 / (download) - annotate - [select for diffs], Tue Oct 5 21:59:00 1999 UTC (24 years, 7 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.6: +17 -176 lines
Diff to previous 1.6 (colored)

Kill unused functions Buf_UngetByte, Buf_UngetBytes, Buf_GetByte, Buf_GetBytes.
Replace the buffer reallocation mechanism with something much more
efficient.

Originally from NetBSD. Tweaks to the allocator to first loop finding the
correct size, then reallocate; change the heuristic to double the size
until we're over what's needed by some fixed amount.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Dec 5 00:06:27 1998 UTC (25 years, 5 months ago) by espie
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.5: +0 -0 lines
Diff to previous 1.5 (colored)

Modifications from netbsd:
- don't interfere with MACHINE/MACHINE_ARCH defines for bootstrap
- type clean-up, time_t, and printing `unknown' ints
- fix TARGET/MEMBER bug in archive rules
- memmove...
- cleaner Error handler.
- reentrant brk_string
- .MAKE env variable
- preliminary scaffolding for .NOPATH

Other improvements:
- efree
- shellneed streamlined
- display Stop in .CURDIR after an error.
- document most features and misfeatures.
- add a few OpenBSD notes to the tutorial.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Apr 1 07:28:05 1997 UTC (27 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.4: +4 -4 lines
Diff to previous 1.4 (colored)

Sync with NetBSD (mostly by christos initial substitution/regexp from Der Mouse)

- fix the variable substitution code in make [PR/2748]
      1. change s/a/b/ so that it substitutes the first occurance of the
         pattern on each word, not only the first word.
      2. add flag '1' to the variable substitution so that the substitutions
         get performed only once.

  ***THIS IS AN INCOMPATIBLE CHANGE!***

  Unfortunately there was no way to make things consistent without
  modifying the current behavior. Fortunately none of our Makefiles
  depended on this.

            OLD:

                VAR      = aa1 aa2 aa3 aa4

                S/a/b/   = ba1 aa2 aa3 aa4
                S/a/b/g  = bb1 bb2 bb3 bb4

            NEW:
                VAR      = aa1 aa2 aa3 aa4

                S/a/b/   = ba1 ba2 ba3 ba4
                S/a/b/1  = ba1 aa2 aa3 aa4
                S/a/b/g  = bb1 bb2 bb3 bb4
                S/a/b/1g = bb1 aa2 aa3 aa4
- add regexp variable substitution via 'C/foo/bar/' [PR/2752]
- add variable quoting via the ${VAR:Q} modifier. This is useful when running
  recursive invocations of make(1):

        make VAR=${VAR:Q}

  will always work... (This may prove useful in the kernel builds...) [PR/2981]
- BSD did not traditionally have <sys/cdefs.h>; use BSD4_4 instead and include
  <sys/param.h> to grab it.
- Don't compile the regex code if MAKE_BOOTSTRAP (from gwr)
- Use explicit .c.o rule in Makefile.boot so that the bootstrap process works.
- Use only integral types in procedure arguments. [buf.c buf.h]
- Include <stdlib.h> to get getenv() prototype on SVR4
- if __STDC__ -> ifdef __STDC__ to appease SVR4
- Define const and volatile for non __STDC__
- Implement snprintf() and vsnprintf() for non BSD4_4 systems.
- Make $MACHINE_ARCH settable from the environment.
- Fix .USE directive problems: (reported by cgd)
    1. ${.*} variables did not get expanded in dependencies.
    2. expanded ${.*} variables in .USE dependencies can cause tree
       restructuring; handle it.
    3. in compat mode, expand .USE before evaluating the list of targets,
       instead of doing .USE expansions on demand, because they can cause
       tree restructuring.
- Add a .MADE directive to indicated that the children of a target are
  up-to-date, even when they are not. This is to simulate our current
  make install behavior with proper dependencies.
- Fix problems in the RE substitution error handling.
- Locate all the children of a node marked as MADE.
- Do not compile-in ${MACHINE} (as per NetBSD PR#3386)
- Disable globbing for targets/dependencies when POSIX is defined.
- Fix globbing so that patterns that don't have a matching number of [] or {}
  don't get expanded. (before the [ case got expanded to nothing!) This is
  disabled.
- Make sure that the children of nodes that are marked .MADE, are marked
  UPTODATE and their timestamps are consistent.
- Don't disable wildcards completely; they are used by other Makefiles.

Revision 1.4 / (download) - annotate - [select for diffs], Sat Nov 30 21:08:50 1996 UTC (27 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.3: +34 -9 lines
Diff to previous 1.3 (colored)

Sync with NetBSD:
- 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.
- Fix NetBSD PR #2930: declare missing variable.

Revision 1.3 / (download) - annotate - [select for diffs], Wed Jun 26 05:36:25 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

rcsid

Revision 1.2 / (download) - annotate - [select for diffs], Sun Apr 21 23:43:17 1996 UTC (28 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

sync to netbsd 960418

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:45:41 1995 UTC (28 years, 7 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:45:41 1995 UTC (28 years, 7 months ago) by deraadt
Branch: MAIN

Initial revision

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.