Commit Graph

16790 Commits

Author SHA1 Message Date
rillig
836dfa4dee lint: combine duplicate case branches in popdecl
This works around GCC 9, which didn't see that the following statement
cannot terminate normally, even though 0 is obviously a constant expression
and assert_failed is marked as __attribute__((__noreturn__)).

	do {
		if (!(0))
			assert_failed(...);
	} while (0)
2021-01-01 14:11:20 +00:00
kre
d3bf6df7dc Build breakage fix (hopefully) - brain dead gcc. NFCI. 2021-01-01 13:43:34 +00:00
rillig
c4649232b6 lint: rename styp and utyp 2021-01-01 11:58:03 +00:00
rillig
d7a1ba0dec lint: remove NTSPEC from enum tspec_t
The number of elements in an enumeration is not a valid enum constant of
that enumeration itself.
2021-01-01 11:51:15 +00:00
rillig
f78ee5c0ea lint: add missing redundant messages in source code 2021-01-01 11:41:01 +00:00
rillig
cc7508a53e lint: complete message 203 for case labels 2021-01-01 11:14:06 +00:00
rillig
ffe80b8ff2 lint: rename tokens for left and right parentheses 2021-01-01 11:09:40 +00:00
rillig
124253e8af lint: extract main part of case_label into separate function 2021-01-01 11:01:03 +00:00
rillig
620f102450 lint: split label handling into separate functions
The only thing these cases have in common is the name "label" and the
"reached = 1" assignment.  That's not reason enough to combine
completely unrelated functions.
2021-01-01 10:55:27 +00:00
rillig
cca12cba58 lint: replace simple LERROR with lint_assert 2021-01-01 09:28:22 +00:00
rillig
194bb9b625 lint: replace some more LERROR with lint_assert 2021-01-01 09:11:40 +00:00
rillig
259b122f43 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.
2021-01-01 01:42:55 +00:00
rillig
15ccb490cc lint: clean up warn_incompatible_types
Splitting the code arbitrarily in separate phases made the code harder
to understand, both for humans as well as automated tools.

One of these tools, check-msgs.lua, couldn't check whether the comments
match the actual messages, and of course, the comments were wrong.
There was no good reason to deviate from the pattern followed by all the
rest of the code.
2021-01-01 01:38:14 +00:00
rillig
5cf99a8e7a lint: remove redundant printf arguments 2021-01-01 01:29:30 +00:00
rillig
6451720632 lint: align comments with actual message, in the lexer and parser 2021-01-01 01:26:02 +00:00
rillig
e93292def1 lint: fix segmentation fault when checking returned enum types (211) 2021-01-01 01:07:07 +00:00
rillig
d4b0f2fea7 lint: align comments in code with actual messages
Redundancy is bad.  Especially in this case, separating the format
strings from the actual arguments prevents the compiler from
cross-checking them.
2021-01-01 00:00:24 +00:00
rillig
2e28c52323 lint: check messages and their IDs for consistency 2020-12-31 22:48:33 +00:00
rillig
ee607e0b85 lint: check that in "if (cond)", cond is scalar 2020-12-31 18:51:28 +00:00
rillig
71c58e78f7 make(1): replace pointers in controlling conditions with booleans 2020-12-31 17:39:36 +00:00
rillig
fbeb97dcac lint: in mkops, replace printf with println
One less backslash per line of code.
2020-12-31 16:19:05 +00:00
rillig
b543b80840 make(1): add test for common and edge cases in .for loop expansion 2020-12-31 14:26:37 +00:00
rillig
9bb16cf29a make(1): fix undefined behavior in SubstVarLong
A memcmp implementation that would check the start and end pointers
first would have detected this possible out-of-bounds memory read.
2020-12-31 14:10:04 +00:00
rillig
ed7360f574 make(1): make control flow in SubstVarLong of .for loops more obvious 2020-12-31 13:56:56 +00:00
rillig
b7e7440cce make(1): clean up SubstVarShort in .for loops
This function does not need to advance the parsing position, which
removes duplicate code.
2020-12-31 13:37:33 +00:00
rillig
5241bad0bc make(1): add tests for extreme edge cases of .for loop expansion 2020-12-31 13:23:43 +00:00
rillig
2d213f3153 make(1): move detailed comment to ForSubstBody 2020-12-31 04:38:55 +00:00
rillig
3d3af52337 make(1): extract ForSubstBody from ForReadMore
This leaves ForReadMore with the single responsibility of interfacing
with ReadMoreProc in Parse_SetInput.
2020-12-31 04:31:36 +00:00
ginsbach
1008587cd2 PR/55891 supress displaying separator when numbers supressed
Fix based on patch provided by Kobayashi Takashi. This brings nl(1) further
in to POSIX compliance. Verified behavior with classic SysV nl(1) and GNU
nl(1). There could still be edge cases here not specified by POSIX.
2020-12-31 04:07:37 +00:00
rillig
99d6ebe6e9 make(1): rename ech to endc
Focusing on the "end" is more important than on the data type "ch".
2020-12-31 03:49:36 +00:00
rillig
492172e6c9 make(1): inline variable in ForReadMore
This variable was intended to help the compilers produce efficient code
by avoiding a duplicate memory read.  As it turned out, GCC 5.5 doesn't
need this help, and probably newer compilers don't need it either.  Well
done, GCC, keeping track of the memory locations even if the pointer to
it changes in the middle.
2020-12-31 03:33:10 +00:00
rillig
4f94a06e63 make(1): clean up ForReadMore
After the previous clean up in for.c 1.123 from 2020-12-30, GCC 5.5 did
not inline the function SubstVarLong anymore since it was now called
from 2 places.  GCC didn't notice that the function call was essentially
the same since in differed only in the end character.

By combining the cases for ${V} and $(V), the code becomes even shorter
than before, while still being understandable.
2020-12-31 03:19:00 +00:00
rillig
f759c16ed9 make(1): simplify termination condition for .for loop
At this point, the number of iteration items is always a multiple of the
number of iteration variables, which makes any addition more complicated
than absolutely necessary.
2020-12-31 03:10:29 +00:00
rillig
d81f96abfb make(1): add test for error handling and expansion in .for loops 2020-12-31 03:05:12 +00:00
rillig
4c09bc6956 make(1): add test for .endfor without corresponding .for 2020-12-30 14:50:08 +00:00
rillig
b64e9d2c70 make(1): improve .for loop documentation, clean up ForReadMore
The comma expression in ForReadMore may be a nice trick, but it's not as
easy to read as a simple if-then-else chain.  Test for '{' before '('
since BSD makefiles use braces by convention.
2020-12-30 14:28:32 +00:00
rillig
0197fc8fc4 lint: split cluparg into separate functions
That function did more than its short name could express, and the things
it did were not related in any way.
2020-12-30 13:17:42 +00:00
rillig
47bf7e655e lint: replace LERROR with lint_assert
This removes the redundancy of mentioning the function name in the error
message.  This redundancy had been correct in all but 2 cases:
build_real_imag and tsize.
2020-12-30 12:22:51 +00:00
rillig
6bddcb2931 lint: spell check comments 2020-12-30 11:56:10 +00:00
rillig
9db9468642 lint: fix Clang-tidy warning about narrowing conversion 2020-12-30 11:47:15 +00:00
rillig
9ec3ffac74 lint: remove unused macro STRBLEN 2020-12-30 11:43:13 +00:00
rillig
ea78491f30 lint: inline STRUCT_ASSIGN
This had only been necessary for some pre-C90 compilers.
2020-12-30 11:39:55 +00:00
rillig
3bd4b094fc lint: un-abbreviate s_dpos, s_spos and s_upos 2020-12-30 11:14:03 +00:00
rillig
eb502cf640 lint: un-abbreviate s_field, s_keyw and s_xsym 2020-12-30 11:04:48 +00:00
rillig
a2826784dd lint: un-abbreviate parenthesized and _strg 2020-12-30 10:56:51 +00:00
rillig
873deaeeb7 lint: rename remaining _nxt members to _next 2020-12-30 10:49:10 +00:00
rillig
c5b43f746f lint: rename more _nxt members to _next 2020-12-30 10:46:11 +00:00
rillig
a2cbddd569 lint: rename symt_t constants
There's no need to abbreviate them, furthermore FMOS was imprecise.
2020-12-30 10:35:38 +00:00
rillig
95c0030060 lint: rename s_nxt to s_next 2020-12-30 10:26:12 +00:00
rillig
b754dcb0cc make(1): format multi-line comments 2020-12-30 10:03:16 +00:00