History log of /src/usr.bin/xlint/common/tyname.c |
Revision | | Date | Author | Comments |
1.67 |
| 14-Sep-2025 |
rillig | lint: add more type details to several messages
In most expressions, the integer promotions are performed on the operands, making the actual type different from the "visible" type of an operand. To properly explain the situation, mention the type before the integer promotions in case it differs from the resulting type.
|
1.66 |
| 24-May-2025 |
rillig | lint: constify
|
1.65 |
| 08-Dec-2024 |
rillig | lint: warn about do-while macros that end with a semicolon
|
1.64 |
| 30-Nov-2024 |
rillig | lint: fix type name of prototype function in lint2 messages
Since tyname.c 1.42 from 2021-06-28, when the type names for '(void)' prototypes was fixed for lint1 but not for lint2.
|
1.63 |
| 13-Nov-2024 |
rillig | lint: handle _Noreturn, [[noreturn]] and __attribute__((__noreturn__))
|
1.62 |
| 09-Mar-2024 |
rillig | branches: 1.62.2; lint: inline accessor macros for type_t
|
1.61 |
| 02-Feb-2024 |
rillig | lint: fix debug output for strings, reduce code size
The debug output contained too many newlines.
The buffer functions were built into lint2 even though they weren't used.
Enable the query for invisible characters in string literals, to make sure that a newline in a string literal does not trigger that query.
|
1.60 |
| 01-Feb-2024 |
rillig | lint: reuse buffer editing code across lint1
Fix cat_strings to update the capacity of the buffer, to prevent quadratic runtime when concatenating string literals.
|
1.59 |
| 01-Feb-2024 |
rillig | lint: use standard buffer for storing string values
No functional change.
|
1.58 |
| 20-Jan-2024 |
rillig | lint: unclutter conditional compilation
|
1.57 |
| 02-Aug-2023 |
rillig | lint: distinguish between arguments and parameters
|
1.56 |
| 29-Jun-2023 |
rillig | lint: use standard terminology for bit-field width
No functional change.
|
1.55 |
| 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.54 |
| 18-Feb-2023 |
rillig | lint: replace INTERNAL_ERROR with plain assert
|
1.53 |
| 03-Jul-2022 |
rillig | lint: include the width of bit-fields in the type name
|
1.52 |
| 21-Jun-2022 |
rillig | lint: use is_struct_or_union instead of comparing twice
No functional change.
|
1.51 |
| 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.50 |
| 05-Sep-2021 |
rillig | lint: reduce number of ifdef names
No functional change.
|
1.49 |
| 04-Sep-2021 |
rillig | lint: remove _Complex from tspec_name
That type is only used in the parser; the expression trees use FCOMPLEX, DCOMPLEX or LCOMPLEX instead.
Sort the typeinfo definitions according to their order in tspec_t. Do not add _Complex there since it is not needed. This means that NOTSPEC and COMPLEX would both trigger an internal error.
|
1.48 |
| 04-Sep-2021 |
rillig | lint: remove duplicate code in tspec_name
No functional change.
|
1.47 |
| 04-Sep-2021 |
rillig | lint: reduce indentation in tdeferr
No functional change.
|
1.46 |
| 31-Aug-2021 |
rillig | lint: remove unnecessary switch statement
The switch statement covers only the few structural types, there is no need to list all integer types as well.
No functional change.
|
1.45 |
| 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.44 |
| 03-Aug-2021 |
rillig | lint: clean up and move 'sametype'
This function is only used by lint1. That's good since the lint2 code was completely broken, as it would regard any two struct types as being the same.
Remove the large switch statement since it is unlikely that there will be new type derivations in C anytime soon.
No functional change.
|
1.43 |
| 02-Jul-2021 |
rillig | lint: document lint1_type.t_is_enum
Enum types are subject to implicit conversions, as opposed to struct, union, pointer and function types.
|
1.42 |
| 28-Jun-2021 |
rillig | lint: fix type name for prototype function without parameters
|
1.41 |
| 04-Jun-2021 |
rillig | lint: fix typo in comment
|
1.40 |
| 18-Apr-2021 |
rillig | branches: 1.40.4; lint: remove redundant CONSTCOND
In do-while-0 loops, these are no longer needed since tree.c 1.202 from 2021-01-31.
|
1.39 |
| 10-Apr-2021 |
rillig | lint: use distinct struct tags for type_t in lint1 and lint2
Having two similar but still different definitions of 'struct type' is unnecessarily confusing. Exchange this confusion for 8 lines of straight-forward preprocessing code.
|
1.38 |
| 09-Apr-2021 |
rillig | lint: for structs and unions, include incompleteness in the type name
This mainly helps to assess the situation where lint warns that a pointer cast "may be troublesome", see msg_247.exp.
|
1.37 |
| 02-Apr-2021 |
rillig | lint: add parentheses after sizeof, as required by share/misc/style
No functional change.
|
1.36 |
| 27-Mar-2021 |
rillig | lint: rename LERROR to INTERNAL_ERROR
The '#ifndef' in tyname.c is meant to distinguish between lint1 and lint2, it is not meant to be defined from anywhere outside the lint code itself.
No functional change.
|
1.35 |
| 26-Mar-2021 |
rillig | lint: in malloc calls, use 'sizeof *ptr' instead of 'sizeof(type)'
No functional change.
|
1.34 |
| 07-Mar-2021 |
rillig | lint: in the name of an array type, list the dimension first
before: array of unsigned int[4] now: array[4] of unsigned int
Listing the array dimension first keeps it in contact with the keyword 'array'. This reduces confusion, especially for nested arrays.
|
1.33 |
| 28-Feb-2021 |
rillig | lint: extract type_name_of_array from type_name
No functional change.
|
1.32 |
| 28-Feb-2021 |
rillig | lint: output precise type information for struct/union/enum
Previously, 'typedef enum { E } name' was output as 'name', which omitted the information that this was an enum type. Now it is output as 'enum typedef name'.
Previously, 'typedef struct { int member; } name' was output as 'struct <unnamed>', which omitted the typedef name. Now it is output as 'struct typedef name'.
|
1.31 |
| 21-Feb-2021 |
rillig | lint: add debug logging for initializing an array of unknown size
It is possible that the type name 'array[unknown_size]' may spill into the user-visible diagnostics. The current test suite does not cover such a case. Anyway, saying 'array[unknown_size]' is still better than saying 'array[0]', which would be misleading.
|
1.30 |
| 21-Feb-2021 |
rillig | lint: add type information to message about enum mismatch
|
1.29 |
| 19-Feb-2021 |
rillig | lint: rename t_isenum and t_aincompl to be more expressive
No functional change.
|
1.28 |
| 19-Feb-2021 |
rillig | lint: rename tenum_t and its members to be more expressive
|
1.27 |
| 19-Feb-2021 |
rillig | lint: rename str_t and its members to be more expressive
No functional change.
|
1.26 |
| 26-Jan-2021 |
rillig | lint: remove __noinline attribute from string interning function
I had committed this accidentally while ensuring that the generated code is still efficient even though the source code looks heavy with the double pointer indirection.
|
1.25 |
| 24-Jan-2021 |
rillig | lint: merge duplicate code for interning type names
|
1.24 |
| 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.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: fix typos and other minor stylistic issues
|
1.21 |
| 03-Jan-2021 |
rillig | lint: add detailed type information for functions
|
1.20 |
| 02-Jan-2021 |
rillig | lint: fix buffer truncation for type names
Previously, most type names had been cut off after 63 significant characters. In some cases, 127 characters survived, or 255. And for the debugging messages, sometimes even 1023. This inconsistency was useless.
It was wrong in the first place to make the caller of the function tyname responsible for handling the buffer. That's not something a caller of such a simple function should do. These callers have better things to do.
The API of the new function type_name is as simple as possible.
In the implementation, the name of the type is generated anew each time. I just didn't know whether the type details could change, once the type is initialized, and I didn't want to find out. To be on the safe side, the resulting type name is cached, independently of the type it was generated for. Using a trivial, unbalanced binary tree should be good enough for now.
All this work is necessary to support adding new debug logging, without being distracted by irrelevant implementation details such as these buffer sizes. Adding new debug messages should be fun and easy; up to now, it was overly bureaucratic.
|
1.19 |
| 02-Jan-2021 |
rillig | lint: order tspec_name in the same way as the enum
|
1.18 |
| 01-Jan-2021 |
rillig | lint: rename basic_type_name to tspec_name
The term "basic type" is precisely defined in C99 6.2.5p14, and tspec_t is close to that, but nowhere identical.
|
1.17 |
| 31-Dec-2020 |
rillig | lint: check that in "if (cond)", cond is scalar
|
1.16 |
| 29-Dec-2020 |
rillig | lint: rename functions with very short names
|
1.15 |
| 29-Dec-2020 |
rillig | lint: fix indentation and alignment that used space-tab
|
1.14 |
| 29-Dec-2020 |
rillig | lint: remove redundant parentheses around return value
|
1.13 |
| 07-Sep-2018 |
christos | recognize int128
|
1.12 |
| 19-Aug-2016 |
christos | branches: 1.12.12; 1.12.14; add a type comparison function.
|
1.11 |
| 20-Jun-2012 |
christos | better to print (null) than core-dump
|
1.10 |
| 26-Sep-2008 |
matt | branches: 1.10.2; Add a missing label for LCOMPLEX
|
1.9 |
| 26-Sep-2008 |
matt | Teach lint about long double _Complex (C99)
|
1.8 |
| 01-May-2008 |
christos | fix const and volatile printing in types.
|
1.7 |
| 01-May-2008 |
christos | PR/38543: Valery Ushakov: Don't crash printing anonymous unions. XXX: Type printing is phase2 is buggy since it does not print the qualifiers, but this is for another day.
|
1.6 |
| 28-Apr-2008 |
martin | Remove clause 3 and 4 from TNF licenses
|
1.5 |
| 25-Apr-2008 |
christos | preliminary _Complex support. NB: Does not really understand type conversions between complex and doubles.
|
1.4 |
| 07-Feb-2007 |
hubertf | branches: 1.4.10; Remove unused ctype.h header. Contributed by Slava Semushin <slava.semushin@gmail.com> in private mail.
|
1.3 |
| 17-Apr-2006 |
skrll | Add RCSId.
|
1.2 |
| 14-Jun-2005 |
skd | Deal with void * types. Approved by Christos.
|
1.1 |
| 07-Apr-2005 |
christos | Factor out tyname() so that it can be used both by lint1 and lint2. Since type_t is different between lint1.h and lint2.h include the appropriate file depending on the pass. Make the argument mismatch error print the type names of the types involved. Now that we have a tyname() function we can fix the rest of the pass2 warnings to be more explanatory, but not now.
|
1.4.10.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.10.2.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.12.14.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.12.12.1 |
| 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.40.4.1 |
| 06-Jun-2021 |
cjep | sync with head
|
1.62.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|