History log of /src/usr.bin/xlint/lint1/emit1.c |
Revision | | Date | Author | Comments |
1.96 |
| 29-Aug-2024 |
rillig | lint: support GCC's __auto_type
Fixes PR toolchain/58654.
|
1.95 |
| 12-May-2024 |
rillig | branches: 1.95.2; lint: add wrapper for <ctype.h> functions, for strict bool mode
When using the Clang preprocessor (with MKLLVM=yes), the preprocessor output does not indicate which tokens come from a system header and which tokens come from the user code. Lint's strict bool mode relies on this information to treat the character classification functions from <ctype.h> as if their return type were bool instead of int.
These wrapper functions are only used when their argument is indeed a 'char', but not when the argument might be 'EOF or representable as an unsigned char', such as when reading a byte from the input.
|
1.94 |
| 27-Mar-2024 |
rillig | lint: clean up; extend overflow test
|
1.93 |
| 19-Mar-2024 |
rillig | lint: keep invalid arguments in function calls
Previously, arguments of incomplete type or 'void' cleared all arguments of the function call expression, requiring extra checks in later checks.
Invalid function calls are now exported to the .ln files, but that's irrelevant in practice as these invalid function calls make lint1 fail, after which xlint removes the .ln file.
|
1.92 |
| 09-Mar-2024 |
rillig | lint: inline accessor macros for tnode_t
|
1.91 |
| 09-Mar-2024 |
rillig | lint: inline accessor macros for type_t
|
1.90 |
| 03-Mar-2024 |
rillig | lint: clean up string parsing and snprintb check
|
1.89 |
| 02-Mar-2024 |
rillig | lint: remove custom wrappers around <ctype.h> functions
|
1.88 |
| 01-Mar-2024 |
rillig | lint: fix misleading initializer for string iterator
The field 'start' marks the start of the previous matching character, not the current iterator position.
No binary change.
|
1.87 |
| 08-Feb-2024 |
rillig | lint: clean up redundant braces
No functional change.
|
1.86 |
| 05-Feb-2024 |
rillig | lint: make function call arguments directly accessible
Previously, the arguments of a function call expression were arranged in a linear tree structure, from right to left. To allow easier access to the arguments, store them in an array instead.
|
1.85 |
| 03-Feb-2024 |
rillig | lint: keep strings in their source representation
This allows further analysis depending on whether individual characters are escaped as octal, hexadecimal or not at all.
|
1.84 |
| 03-Feb-2024 |
rillig | lint: clean up comments, reduce scope of variables
|
1.83 |
| 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.82 |
| 29-Jan-2024 |
rillig | lint: do not remember content of wide string literals
The plain char literals are needed for checking printf/scanf format strings; lint has no similar check for wide strings. These format strings are checked by modern compilers, making this check less relevant.
|
1.81 |
| 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.80 |
| 03-Dec-2023 |
rillig | lint: re-wrap comments
No functional change.
|
1.79 |
| 03-Dec-2023 |
rillig | lint: indent statement continuations consistently
No binary change.
|
1.78 |
| 02-Dec-2023 |
rillig | lint: remove redundant empty lines
No functional change.
|
1.77 |
| 13-Sep-2023 |
rillig | lint: prevent invalid memory access when checking an expression
In check_expr_misc, the left and right operands of an expression were accessed even in the case of CON (constant), STRING (string literal) and NAME (identifier), which led to invalid values in pointer variables. These invalid values were not used though, but technically they invoked undefined behavior.
Precede each access to the operands with a check that the expression indeed has operands, except in those cases where the operand is known to have operands by only looking at the code of the current function.
|
1.76 |
| 12-Aug-2023 |
rillig | lint: clean up comments
There's no output buffer anymore.
|
1.75 |
| 12-Aug-2023 |
rillig | lint: remove redundant comments
|
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 |
| 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.72 |
| 13-Jul-2023 |
rillig | lint: indent copyright lines consistently
|
1.71 |
| 02-Jul-2023 |
rillig | lint: rename 'quad' to 'signed int' or 'unsigned int'
No functional change.
|
1.70 |
| 29-Jun-2023 |
rillig | lint: clean up initialization of type properties
No functional change.
|
1.69 |
| 24-Jun-2023 |
rillig | lint: reduce memory allocations
The type val_t has the same size as the tn_s member in the same union.
No functional change.
|
1.68 |
| 09-Jun-2023 |
rillig | lint: miscellaneous clean-ups
No binary change, except for line numbers in assertions.
|
1.67 |
| 09-Jun-2023 |
rillig | lint: indent local variables consistently
No binary change.
|
1.66 |
| 22-Apr-2023 |
rillig | lint: rename type_t.t_str to t_sou
The name 't_str' could have meant 'string' or 'struct'. Since both struct and union types have members, rename it to 't_sou'.
No functional change.
|
1.65 |
| 02-Feb-2023 |
rillig | lint: clean up
In symtab_search, most of the conditions were redundant, so remove them.
In read_byte, using CHAR_MASK was conceptually wrong, as that constant is from the target platform while the lexical analysis happens on the host platform. It was unnecessary as well, as a hypothetical host platform with 36-bit chars might encode the characters from the basic source character set as numbers higher than 0x0_0000_00ff. Since lint assumes that both the source character set as well as the execution character set are the same and based on 8-bit bytes, nothing changes.
No functional change.
|
1.64 |
| 01-Oct-2022 |
rillig | lint: add hyphen to adjective 'old-style'
|
1.63 |
| 21-Jun-2022 |
rillig | lint: use is_struct_or_union instead of comparing twice
No functional change.
|
1.62 |
| 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.61 |
| 27-Feb-2022 |
rillig | lint: merge duplicate code for handling plain and wide strings
No functional change. As before, the string literals "1" "2" "3" are not concatenated from left to right, instead concatenation starts with "23" and then proceeds to "123".
|
1.60 |
| 28-Nov-2021 |
rillig | lint: do not export unnamed objects to the .ln file
Since these objects are unnamed, they cannot be referenced by other files or even create name clashes.
Seen in usr.sbin/cpuctl/aarch64.c, reported by Christos.
|
1.59 |
| 12-Sep-2021 |
rillig | lint: un-abbreviate rvused and rvdisc
No functional change.
|
1.58 |
| 04-Sep-2021 |
rillig | lint: inline local variables in outtype
No functional change.
|
1.57 |
| 04-Sep-2021 |
rillig | lint: clean up outfstrg, which writes format strings
Most characters don't need outqchar, a simple outchar is often enough.
Since '\0' is not a digit, there is no need to check for that.
No functional change.
|
1.56 |
| 04-Sep-2021 |
rillig | lint: move outqchar from common to lint1
|
1.55 |
| 04-Sep-2021 |
rillig | lint: use 'char' as type for passing characters to functions
No functional change.
|
1.54 |
| 02-Sep-2021 |
rillig | lint: fix typo in assertion
|
1.53 |
| 31-Aug-2021 |
rillig | lint: reduce verbose switch statement to table lookup
No functional change.
|
1.52 |
| 30-Aug-2021 |
rillig | tests/lint: test varargs, printflike, scanflike
|
1.51 |
| 28-Aug-2021 |
rillig | lint: un-abbreviate unsigned integer types
No functional change.
|
1.50 |
| 23-Aug-2021 |
rillig | lint: remove unnecessary width parameter for msb
No functional change.
|
1.49 |
| 19-Aug-2021 |
rillig | lint: change return type of 'msb' from int to bool
No functional change.
|
1.48 |
| 08-Aug-2021 |
rillig | lint: condense code for writing the .ln files
No functional change.
|
1.47 |
| 31-Jul-2021 |
rillig | lint: improve support for __int128_t and __uint128_t
For the .ln files, I chose the letter 'J' to represent the 128-bit integer types since it is close to 'I' for int. The naming of 'L' for 'long' is obvious, but 'Q' for 64-bit integers is a quad-16-bit word, which is an unusual measurement unit nowadays. One benefit of choosing 'J' is that the next letter, 'K' can then be used for 256-bit integer types.
Support for 128-bit integer types is still very basic. Plus, it is only supported on LP64 platforms, which means that lint cannot be cross-compiled to check for an LP64 platform while running on an ILP32 platform.
|
1.46 |
| 15-Jul-2021 |
rillig | lint: replace call to ttos with type_name
Since tyname.c 1.20 from 2021-01-02, type_name is as simple to use as ttos and more expressive. It can also be called multiple times without invalidating the returned strings.
Used only in debug mode.
|
1.45 |
| 05-Jul-2021 |
rillig | lint: fix type warnings in emit1.c
The plain character strings in strg_t are saved as an array of unsigned char. When such a character is passed to ch_isdigit, it requires a cast. This is exactly the situation that ch_isdigit tried to avoid in the first place.
No functional change.
|
1.44 |
| 18-Apr-2021 |
rillig | lint: test emitting of symbol information in the .ln files
Even though the new test is quite large, it didn't find any bugs in the code. The only thing I'm unsure about is why static functions are exported as well, since they are supposed to be local to the translation unit.
|
1.43 |
| 27-Mar-2021 |
rillig | lint: rename filename management functions
No functional change.
|
1.42 |
| 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.41 |
| 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.40 |
| 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.39 |
| 17-Jan-2021 |
rillig | lint: rename operator AMPER to ADDR
There is no operator called 'ampersand'. The ampersand sign is merely the textual representation of both the operator ADDR and the operator BITAND.
|
1.38 |
| 16-Jan-2021 |
rillig | lint: replace integer constant expressions with true and false
LINTFLAGS=-gST make lint, with manual review.
The error messages from lint are all correct, they are not complete though. The return value of a function returning bool may still be compared to the integer 0.
|
1.37 |
| 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.36 |
| 11-Jan-2021 |
rillig | lint: sprinkle a few const modifiers throughout the code
|
1.35 |
| 10-Jan-2021 |
rillig | lint: rename type classification macros
The previous names tspec_is_int and tspec_is_uint were confusing because there are actually tspec_t constants called INT and UINT, these classification macros return true for other integer types as well, though.
While here, remove the prefix "tspec_" from these macros. It wasn't as helpful as intended, in many cases it was obviously redundant, when it was called as tspec_is_integer(tn->tn_type->t_tspec).
No functional change.
|
1.34 |
| 04-Jan-2021 |
rillig | lint: fix typos and other minor stylistic issues
|
1.33 |
| 03-Jan-2021 |
rillig | lint: rename prflstrg to printflike_argnum, likewise for scflstrg
|
1.32 |
| 02-Jan-2021 |
rillig | lint: fix lint warning 161 "constant in conditional context"
|
1.31 |
| 01-Jan-2021 |
rillig | lint: replace simple LERROR with lint_assert
|
1.30 |
| 01-Jan-2021 |
rillig | lint: replace some more LERROR with lint_assert
|
1.29 |
| 30-Dec-2020 |
rillig | lint: un-abbreviate s_dpos, s_spos and s_upos
|
1.28 |
| 30-Dec-2020 |
rillig | lint: un-abbreviate parenthesized and _strg
|
1.27 |
| 30-Dec-2020 |
rillig | lint: rename more _nxt members to _next
|
1.26 |
| 30-Dec-2020 |
rillig | lint: rename s_nxt to s_next
|
1.25 |
| 29-Dec-2020 |
rillig | lint: fix typo in comments
|
1.24 |
| 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.23 |
| 28-Dec-2020 |
rillig | lint: spell check
|
1.22 |
| 28-Dec-2020 |
rillig | lint: rename tspec macros
|
1.21 |
| 28-Dec-2020 |
rillig | lint1: remove trailing whitespace
|
1.20 |
| 26-Dec-2017 |
christos | Don't print duplicate definitions for inline symbols.
|
1.19 |
| 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.18 |
| 26-Apr-2008 |
christos | Fix complex double to be '\0' instead of 'u', from Nicolas Joly.
|
1.17 |
| 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.16 |
| 24-Sep-2005 |
perry | branches: 1.16.20; in several comments: implizit -> implicit explizit -> explicit
|
1.15 |
| 12-Sep-2004 |
yamt | recognize _Bool.
|
1.14 |
| 20-Jun-2004 |
jmc | 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.13 |
| 13-Sep-2002 |
christos | branches: 1.13.2; Minimize diffs with my C99 capable version [this commit does not include C99 support.
- turn lerror() into a macro so that the filename and the line number of the error are printed before we abort. - recurse in type printing to provide the proper type name.
|
1.12 |
| 05-Feb-2002 |
thorpej | Replace u_quad_t with uint64_t and quad_t with int64_t, and use <inttypes.h> to get those type definitions. These types are more portable, and a little more sane to do autoconf tests for.
|
1.11 |
| 31-Jan-2002 |
tv | Protect __RCSID and __COPYRIGHT from being invoked if not defined.
|
1.10 |
| 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.9 |
| 24-Feb-2001 |
cgd | fix broken NetBSD RCS id tags
|
1.8 |
| 14-Jun-2000 |
cgd | fix up NetBSD RCS Ids to match the standard, and the leading comment as to match as well. No functional changes.
|
1.7 |
| 22-Feb-1998 |
christos | branches: 1.7.8; WARNSify
|
1.6 |
| 03-Nov-1997 |
cgd | implement (hack in) symbol (function and variable) renaming, so that the function renaming tricks currently needed by libc can be tolerated by lint. This needs some cleanup, but it appears to work.
|
1.5 |
| 22-Dec-1996 |
cgd | branches: 1.5.2; * recognize that pointers to identical unnamed and untyped structs, unions, and enums are, in fact, identical. This is done by tagging each of unnamed and untyped structure, union and enum with a unique position of creation, which is used as a unique identifier that when determine whether or not a pair of structures, unions, or enums are identical.
|
1.4 |
| 02-Oct-1995 |
jpo | prototypes override old style function definitions this is a gnu extension to ansi c
|
1.3 |
| 02-Oct-1995 |
jpo | added inline keywords "inline" is enabled by -g, "__inline" and "__inline__" are always available
|
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.5.2.1 |
| 04-Nov-1997 |
thorpej | Pull up from trunk: make renaming work and other minor fixes.
|
1.7.8.1 |
| 23-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.13.2.1 |
| 22-Jun-2004 |
tron | Pull up revision 1.14 (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.16.20.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.95.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|