Commit Graph

289317 Commits

Author SHA1 Message Date
oster 6b2ddebee8 Move case 'l' to be in sorted order. No functional change. 2021-08-01 20:26:53 +00:00
rillig f4aacdc985 lint: clean up debug logging in the C grammar 2021-08-01 19:18:10 +00:00
rillig a11f7ac3ff lint: merge duplicate debugging code
The functions 'debug_node' and 'display_expression' were similar enough
to be merged.

Migrate debug_node to use the existing debug logging functions.

Remove the now unused option 'd' from the options string.
2021-08-01 19:11:54 +00:00
rillig f8d01ed580 lint: remove option -d, clean up debug logging
The command line option -d was not used by /usr/bin/lint, and it only
triggered a handful of debug messages.  Move this debug logging over to
the compile-time -DDEBUG setting.

Move display_expression further up to avoid the forward declaration.
2021-08-01 18:37:29 +00:00
rillig 86a595a37f lint: make xasprintf simpler
No functional change.
2021-08-01 18:13:53 +00:00
rillig cd66f68dee lint: unexport nomem
No functional change.
2021-08-01 18:07:35 +00:00
andvar 8179431272 fix typo in definition: s/threshhold/threshold/ 2021-08-01 18:02:22 +00:00
rillig fdcb9d74e4 lint: remove xmapalloc
Just trust the standard malloc to be smart enough.

No functional change.
2021-08-01 17:59:47 +00:00
rillig c8782a7cbc tests/lint: test the usual arithmetic conversions in traditional C 2021-08-01 16:29:28 +00:00
tnn 25e0fac49a ssdfb(4): add an iic fdt attachment example also 2021-08-01 16:17:05 +00:00
andvar c651c20bd5 fix syntax error and typo in overwritten. 2021-08-01 15:52:11 +00:00
tnn 2a55bc0beb ssdfb(4): nix BUGS section, add EXAMPLES section 2021-08-01 15:35:47 +00:00
andvar 4b2769fe52 fix typos in word "otherwise". 2021-08-01 15:29:29 +00:00
tnn eafe2c2fde ssdfb: support the 4-wire SPI interface 2021-08-01 14:56:18 +00:00
rillig d9bdf0a3b8 tests/lint: re-add the test for __uint128_t 2021-08-01 14:51:41 +00:00
rillig 05d4ee4022 lint: remove unreachable code from usual arithmetic conversions 2021-08-01 14:45:39 +00:00
rillig 6400299a82 tests/lint: fully cover the usual arithmetic conversions 2021-08-01 14:42:21 +00:00
rillig f33386540b lint: fix usual arithmetic conversions for 128-bit integer types 2021-08-01 13:49:17 +00:00
rillig c574d0575e lint: demonstrate wrong integer conversion for __uint128_t 2021-08-01 13:45:14 +00:00
rillig 5489342aeb tests/lint: test the usual arithmetic conversions
The function 'balance' does not mention __uint128_t and nevertheless
works as expected.  Need to investigate further.
2021-08-01 13:31:48 +00:00
rillig 7b590daa93 tests/lint: document why lint does not check _Generic selections 2021-08-01 13:09:38 +00:00
rillig 653952f0ab lint: remove hash value from symbol buffer
Conceptually, a symbol buffer does not need to remember its hash value
since that belongs to the symbol table.  This makes the code for the
symbol table simpler.  The number of hash calculations increases by
about 5%, which is negligible.

No functional change.
2021-08-01 08:03:43 +00:00
rillig e2febd0a7c lint: merge duplicate code for removing a symbol from the table
No functional change.
2021-08-01 07:46:51 +00:00
rillig a3ba24d77a lint: extract duplicate code for modifying the symbol table
No functional change.
2021-08-01 06:58:58 +00:00
rillig b25dbe034a lint: add debug logging for symbol table, clean up debug logging
When I tried to fix msg_115, I quickly ran into a segmentation fault,
probably related to the symbol table.  To better understand this part,
log insertions and deletions.

The other debug log messages do not need to mention the current file
position anymore, this is what lex_next_line takes care of since scan.l
1.113 from 2021-01-05.
2021-08-01 06:40:37 +00:00
rillig c790f31b75 tests/make: split tests for the variable modifier ':O'
The tests for parse errors are now in varmod-order, which lets the other
tests focus on the desired behavior of the modifiers.
2021-07-31 20:55:45 +00:00
andvar e16cbc3889 s/dependend/dependent/ 2021-07-31 20:51:32 +00:00
andvar 40be87ae1d s/threshhold/threshold 2021-07-31 20:29:36 +00:00
rillig 89727fbc98 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.
2021-07-31 19:52:44 +00:00
rillig b344f57d7d lint: initialize shared types in the same order as in tspec_t
This makes it easier to see whether there are any types missing, such as
__uint128_t.

No functional change.
2021-07-31 19:20:59 +00:00
rillig 6e400373b9 lint: do not evaluate arguments of debug_step
To analyze the unexpected test failure of op_shl_lp64, I had reverted
debug_step to evaluate its arguments.  I then accidentally committed
that without running the tests again.

Anyway, the previous commit can now be used as a demonstration that
initdecl is indeed missing the initialization for __uint128_t, which
leads to the internal error in op_shl_lp64.
2021-07-31 19:12:35 +00:00
rillig bbb47da2ee lint: clean up debug logging
The calls to debug_step, unlike printf, don't need a trailing newline.

Remove the debug_step0 macro and its relatives since lint already uses
enough other features from C99 that it essentially requires this
standard, which supports varargs macro arguments.  Among these features
are __func__ and printf("%zu").

In non-debug mode, do not evaluate the arguments of debug_step.
Evaluating the arguments had caused an internal error when running the
test op_shl_lp64.  This is indeed a bug since initdecl should have
initialized the type table for __uint128_t.  This had been forgotten
when support for __uint128_t was added in decl.c 1.69 from 2018-09-07.

No functional change.
2021-07-31 19:07:52 +00:00
rillig de0175e8f1 lint: extract debug logging to separate file
Lint currently has several different kinds of debug log:

* The -DDEBUG log is controlled at compile time.
* The -d command line options enables some other debug logging.
* The -DYYDEBUG log for parsing is controlled at compile time.
* The -y command line option only has an effect in -DYYDEBUG mode.

Extracting the logging into a separate file is a first step towards
unifying these logs and making the code for debug logging stand out less
than the current #ifdef DEBUG.

No functional change.
2021-07-31 18:16:42 +00:00
rillig 535a64a8ac lint: add debugging output for the grammar tokens
No functional change outside debug mode.
2021-07-31 17:09:21 +00:00
andvar 551e3d5fa5 s/propective/prospective 2021-07-31 16:54:37 +00:00
andvar 74bcda346c s/threshhold/threshold 2021-07-31 15:02:54 +00:00
thorpej 84c5c30b63 Fix a silly mistake (missing return) in the DEBUG case of the kernel pmap
case of pmap_extract().
2021-07-31 14:51:25 +00:00
mlelstv ad07108f16 Run devpubd before volume managers and pseudo disks. 2021-07-31 14:47:04 +00:00
andvar 31f72197e0 fix more typos in style found one in file - check/fix them all. 2021-07-31 14:36:33 +00:00
rillig 413d9dbf37 lint: reduce indentation in 'search'
No functional change.
2021-07-31 13:47:19 +00:00
rillig 80a480a84e lint: in has_constant_member, don't reuse variables
No functional change.
2021-07-31 11:37:53 +00:00
tnn 8808569f9c sunxi_platform: declare UART FIFO sizes for SoCs we support 2021-07-31 11:34:40 +00:00
rillig c4f8523995 lint: merge duplicate code for generating unqualified type
This is a preparation for fixing the wrong warnings in msg_115.c.

No functional change.
2021-07-31 11:03:04 +00:00
andvar 6f472043b4 fix typos in comments 2021-07-31 10:12:04 +00:00
rillig 36db97e51f tests/lint: demonstrate more wrong warnings for const struct members
The code 't_const = false' occurs 4 times in the lint code, each
corresponding to one of the wrong warnings in the test.

This bug has been existing at least since 2001.  Back then, the lint
output was:

2001.12.24.20.52.09
| (23): lint error: popctrl() 1
| (15): syntax error [249]
| (19): warning: left operand of 'FARG' must be modifiable lvalue [115]
| (21): syntax error [249]
| (23): warning: function initialize_const_struct_member falls off bottom without returning value [217]
| exit status 1

from 2002.12.06.03.27.39
| (23): lint error: func.c, 168: popctrl()
| (15): warning: left operand of '=' must be modifiable lvalue [115]
| (19): warning: left operand of 'FARG' must be modifiable lvalue [115]
| (21): syntax error [249]
| (23): warning: function initialize_const_struct_member falls off bottom without returning value [217]
| exit status 1
until 2003.10.27.00.12.44
2021-07-31 10:09:03 +00:00
andvar 305be1a432 fix typos in comments 2021-07-31 10:07:22 +00:00
tnn 34ee919920 only read cpr register if we're going to use the value 2021-07-31 10:04:12 +00:00
rillig cc821a91f9 make: fix lint warnings
The string functions from str.h are declared as 'static __unused' when
compiled with GCC, but lint explicitly undefines __GCC__ during
preprocessing.  Therefore, make those functions inline, to prevent
warnings that they are unused.

The macro UNCONST is used in a few places, and (again) since lint
undefines __GCC__, that macro expanded to a simple type cast, which lint
warned about.  To prevent this warning, implement UNCONST as a function
that works everywhere and hides the type cast.

In filemon_open, the code for closing F->in was obviously unreachable.

No functional change.
2021-07-31 09:30:17 +00:00
rillig fe7cbecd8a tests/lint: demonstrate wrong error message for initialization
Seen in usr.bin/make/var.c:4022 in C99 mode, where a ModChain variable
is initialized and two of the members are const-qualified.
2021-07-31 09:14:47 +00:00
rillig 51085f5d8c make: clean up ApplyModifier_Order
No functional change.
2021-07-31 00:17:04 +00:00