History log of /src/usr.bin/xlint/lint1/mem1.c |
Revision | | Date | Author | Comments |
1.77 |
| 03-Dec-2023 |
rillig | lint: in declarations, replace tab with space
Previously, in some cases, the keywords 'const' or 'struct' were followed by a tab, which doesn't make sense.
No functional change.
|
1.76 |
| 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.75 |
| 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.74 |
| 12-Aug-2023 |
rillig | lint: for each record in the output file, write the newline immediately
There's no point delaying the '\n' until the next line is written.
|
1.73 |
| 30-Jul-2023 |
rillig | lint: in memory debug mode, log the type of the nodes
First log all objects to be freed, then free them all at once. This allows cross references from the objects of a block independent of their allocation order.
|
1.72 |
| 29-Jul-2023 |
rillig | lint: fix use-after-free in memory debug mode
A node may be allocated before its type. Since the objects are freed in reverse allocation order, the type cannot be accessed anymore when the node is freed.
|
1.71 |
| 15-Jul-2023 |
rillig | lint: extend debug logging for memory management
|
1.70 |
| 15-Jul-2023 |
rillig | lint: add detailed logging for finding memory allocation bugs
|
1.69 |
| 15-Jul-2023 |
rillig | lint: add debug logging for memory management and the symbol table
|
1.68 |
| 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.67 |
| 09-Jul-2023 |
rillig | lint: miscellaneous cleanup
|
1.66 |
| 30-Jun-2023 |
rillig | lint: clean up tree.c
No functional change.
|
1.65 |
| 11-Apr-2023 |
rillig | lint: condense code
No functional change.
|
1.64 |
| 13-Jan-2023 |
rillig | lint: remove custom memory allocator
Besides adding complexity, the custom memory allocator didn't invalidate freed memory, which made it harder to find possible use-after-free bugs.
|
1.63 |
| 20-May-2022 |
rillig | lint: use __RCSID in lint mode as well
Since 1995-10-02, lint supports __asm statements and __asm modifiers.
No binary change.
|
1.62 |
| 02-Apr-2022 |
rillig | lint: use appropriate alignment on both the host and target platform
|
1.61 |
| 27-Feb-2022 |
rillig | lint: clean up code for handling filenames
No functional change.
|
1.60 |
| 27-Feb-2022 |
rillig | lint: encode lifetime of allocated memory in the function names
No functional change.
|
1.59 |
| 27-Feb-2022 |
rillig | lint: clean up memory allocation
No functional change.
|
1.58 |
| 27-Feb-2022 |
rillig | lint: remove custom free list for memory blocks
Trust the system memory allocator to do its thing, including marking the memory as fresh or freed. One less thing to worry about.
|
1.57 |
| 25-Dec-2021 |
rillig | lint: don't try to trick mathematics by defining ZERO to a nonzero value
No binary change.
|
1.56 |
| 21-Dec-2021 |
rillig | lint: invert condition in build_name
No functional change.
|
1.55 |
| 16-Nov-2021 |
rillig | lint: fix check for function calls in strict bool mode
Previously, if a function call occurred in the controlling expression, its return type could be any scalar, not just bool. This was against the goal of strict bool mode, which makes bool a separate and incompabile type to all other types. For example, it would allow controlling expressions like 'strcmp(a, b)' without the usual '!= 0', but only if at least one of 'a' and 'b' came from a macro definition from a system header.
The fix is that the decision of whether the type of the controlling expression may be scalar is no longer based on the operand types but on the main operator of the controlling expression.
|
1.54 |
| 16-Nov-2021 |
rillig | lint: remove outdated comment
The bug has been fixed in cgram.y 1.369 a few minutes ago.
|
1.53 |
| 16-Nov-2021 |
rillig | tests/lint: explain the missing error message in strict bool mode
There are 2 separate bugs that lead to the missing error message.
The first bug is that when parsing a name, the information about whether that name comes from a system header is not properly recorded for the last token before switching from or to a system header.
The second bug is that for determining whether the type of a function call expression is relaxed, the types of the function call arguments are taken into account, even though the type only depends on the function itself. The same idea applies to the operators '<<' and '>>', as their result type only depends on the left operand, at least since C90.
|
1.52 |
| 31-Aug-2021 |
rillig | lint: fix memory allocation (since 2021-08-28)
In mem1.c 1.50 and mem2.c 1.13 from 2021-08-28, I accidentally changed the initialization of mblklen from round_up to round_down, trying to avoid a division instruction.
On NetBSD x86_64 this resulted in a few more malloc calls, but on Cygwin with its 64k pagesize, mblklen became 0. Later, the function xalloc in lint2 called xalloc(mblklen) and blindly assumed that the returned memory would be large enough. This in turn led to out-of-bounds memory access and crashes. Lint1 was not affected since it adjust mblklen during runtime if it gets too small.
|
1.51 |
| 28-Aug-2021 |
rillig | lint: explicitly ignore return value of some function calls
This fixes the warning from lint2 that these functions return values which are sometimes ignored.
The remaining calls to fprintf that ignore the return value come from scan.c. Lint does not currently detect the auto-generated portions of that file and the interesting ones since it assumes that scan.c is the main filename, see expr_zalloc_tnode.
No functional change.
|
1.50 |
| 28-Aug-2021 |
rillig | lint: use 'unsigned int' for bit-size of types
Lint does not need to support any types larger than 256 MB since they don't occur in practice. Practically, such large types have never been supported at all since the function type_size_in_bits used int for the internal calculations, resulting in overflows.
|
1.49 |
| 10-Aug-2021 |
rillig | lint: remove redundant function prototypes
|
1.48 |
| 10-Aug-2021 |
rillig | lint: clean up comments
|
1.47 |
| 01-Aug-2021 |
rillig | lint: unexport nomem
No functional change.
|
1.46 |
| 01-Aug-2021 |
rillig | lint: remove xmapalloc
Just trust the standard malloc to be smart enough.
No functional change.
|
1.45 |
| 04-Jul-2021 |
rillig | lint: in strict bool mode, allow mixed types in generated C code
This allows flex lexers to be run through lint in strict bool mode.
|
1.44 |
| 20-Jun-2021 |
rillig | lint: sprinkle const in memory management
No functional change.
|
1.43 |
| 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.42 |
| 02-Apr-2021 |
rillig | lint: rename members of struct memory_block
No functional change.
|
1.41 |
| 02-Apr-2021 |
rillig | lint: name memory allocation functions consistently
No functional change.
|
1.40 |
| 02-Apr-2021 |
rillig | lint: rename getnode to expr_zalloc_tnode
The new name highlights that the returned memory is only valid in the scope of the current expression. This was misleading before since the other related functions all have a 't' (probably for 'temporary') in their names.
Also encode in the function name that the returned memory is zeroed out as that could not be inferred from the old name.
No functional change.
|
1.39 |
| 02-Apr-2021 |
rillig | lint: extract filename ID counter into separate function
No functional change.
|
1.38 |
| 02-Apr-2021 |
rillig | lint: rename mbl to memory_block
No functional change.
|
1.37 |
| 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.36 |
| 27-Mar-2021 |
rillig | lint: clean up code for filename management
In add_directory_replacement, the expression 'r->repl - r->orig' looked strange, as if two pointers into separate objects were subtracted.
The code was probably optimized to a particular compiler on a particular platform to generate fast and simple code. Since compilers have made considerable progress over the last 25 years, optimize the code for human legibility instead. The compilers will somehow cope with that.
No functional change.
|
1.35 |
| 27-Mar-2021 |
rillig | lint: rename filename_replacement.len to orig_len
No functional change.
|
1.34 |
| 27-Mar-2021 |
rillig | lint: rename global variables in filename management
No functional change.
|
1.33 |
| 27-Mar-2021 |
rillig | lint: rename srchfn to search_filename, return const value
No functional change.
|
1.32 |
| 27-Mar-2021 |
rillig | lint: rename types in filename management
No functional change.
|
1.31 |
| 27-Mar-2021 |
rillig | lint: reduce indentation in fnnalloc
No functional change.
|
1.30 |
| 27-Mar-2021 |
rillig | lint: rename fnaddreplsrcdir to something less cryptic
No functional change.
|
1.29 |
| 27-Mar-2021 |
rillig | lint: remove unused fnalloc
|
1.28 |
| 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.27 |
| 17-Mar-2021 |
rillig | lint: rename 'blklev' to 'block_level'
No functional change.
|
1.26 |
| 21-Feb-2021 |
rillig | lint: clean up comments in mem1.c
The comment for tgetblk had been misplaced.
|
1.25 |
| 23-Jan-2021 |
rillig | lint: fix two wrong error messages in strict bool mode
The strict bool mode gets complicated because for system headers the rules need to be relaxed since they cannot be changed easily, often not at all.
Still, if lint validates a program in strict bool mode, that program must run with equal behavior regarding boolean expressions even on a pre-C99 platform.
|
1.24 |
| 18-Jan-2021 |
rillig | lint: clean up code (mostly comments)
|
1.23 |
| 16-Jan-2021 |
rillig | lint: replace 0 and 1 with false and true, where appropriate
Change in behavior: Passing the option -h exactly 4294967296 times or any multiple thereof is no longer equivalent to passing it never at all, it is now equivalent to passing it once. See main2.c, hflag++ for the actual change.
Other than that, no functional change intended.
A very large portion of the code already conformed to the requirements of the strict bool mode. The only missing thing was using the constant literals false and true instead of 0 and 1. For sure there are some integer literals left that can be converted. For now, all literals that appeared in the form " = 0" or " = 1" have been replaced.
|
1.22 |
| 04-Jan-2021 |
rillig | lint: reduce comment for xgetblk to the actually interesting part
|
1.21 |
| 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.20 |
| 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.19 |
| 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.18 |
| 24-Dec-2016 |
christos | Add -R (source filename remapping) for MKREPRO
|
1.17 |
| 18-Apr-2014 |
christos | branches: 1.17.6; only fill memory with junk if BLKDEBUG
|
1.16 |
| 17-Apr-2014 |
christos | Trash freed memory so we catch bad uses.
|
1.15 |
| 24-Jun-2011 |
christos | branches: 1.15.2; 1.15.8; 1.15.18; Always use our own align macro and explain a bit more why this is bogus.
|
1.14 |
| 17-Jan-2011 |
christos | PR/44235: Valeriy E. Ushakov: Don't pick up a block from the free list if it is not big enough, allocate a new one. XXX: this is inefficient, but at least it does not end up corrupting memory.
|
1.13 |
| 05-Aug-2009 |
wiz | Fix typos in comment.
|
1.12 |
| 15-Apr-2009 |
christos | Lukemify (WARNS=4)
|
1.11 |
| 20-Jun-2004 |
jmc | branches: 1.11.36; Completely rework how tools/compat is done. Purge all uses/references to _NETBSD_SOURCE as this makes cross building from older/newer versions of NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to only use POSIX code in all places (or when reasonable test w. configure and provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86 NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
|
1.10 |
| 21-Oct-2003 |
christos | branches: 1.10.2; PR/23219: Dan McMahill: Make this compile on system that don't have MAP_ANON. Centralize the mmap allocations in a new function, xmapalloc() that handles this.
|
1.9 |
| 20-Jan-2003 |
simonb | The Double-Semi-Colon Police.
|
1.8 |
| 28-Jun-2002 |
jmc | Change xgetblk to detect cases where the requested size is more than mblklen. (generally it's 20k). Adjust mblklen temporarily to the size of the block required and allocate one. This avoids coredumps when mapping in identifiers that have huge values. (In my example it was a char[] for a 640k pixmap).
|
1.7 |
| 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.6 |
| 29-Jan-2002 |
tv | Remove #include <err.h> (now in lint.h).
|
1.5 |
| 28-May-2001 |
lukem | cleanup (prior to more adding more features): - convert to ANSI KNF - remove trailing whitespace - translate some comments from german into english
code compiles and runs clean, and tested by running "make lint" against xlint source using previous and this lint produces same results.
|
1.4 |
| 13-Mar-2000 |
soren | Fix doubled 'the's.
|
1.3 |
| 22-Feb-1998 |
christos | WARNSify
|
1.2 |
| 03-Jul-1995 |
cgd | RCS id cleanup
|
1.1 |
| 03-Jul-1995 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.1 |
| 03-Jul-1995 |
cgd | lint(1) implementation, by Jochen Pohl. named 'xlint' for a similar reason to why 'install' is named 'xinstall'.
|
1.10.2.1 |
| 22-Jun-2004 |
tron | Pull up revision 1.11 (requested by jmc in ticket #527): Completely rework how tools/compat is done. Purge all uses/references to _NETBSD_SOURCE as this makes cross building from older/newer versions of NetBSD harder, not easier (and also makes the resulting tools 'different') Wrap all required code with the inclusion of nbtool_config.h, attempt to only use POSIX code in all places (or when reasonable test w. configure and provide definitions: ala u_int, etc). Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86 NetBSD current (x86 and amd64) and Solaris 9. Fixes PR's: PR#17762 PR#25944
|
1.11.36.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
|
1.15.18.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.15.8.1 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.15.2.1 |
| 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.17.6.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|