maint: syntax-check: prohibit-operator-at-eol
* cfg.mk (sc_prohibit_operator_at_end_of_line): Copied from coreutils' cfg.mk. * sed/execute.c (do_subst,execute_program): Adjust as needed.
This commit is contained in:
1 parent
4766cf6717
commit
a2cda80ecd
2 files changed
+17
-4
No files matched your search
@@ -287,6 +287,18 @@ sc_prohibit_test_empty:
|
||||
halt='use `compare /dev/null ...`, not `test -s ...` in tests/' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# With split lines, don't leave an operator at end of line.
|
||||
# Instead, put it on the following line, where it is more apparent.
|
||||
# Don't bother checking for "*" at end of line, since it provokes
|
||||
# far too many false positives, matching constructs like "TYPE *".
|
||||
# Similarly, omit "=" (initializers).
|
||||
binop_re_ ?= [-/+^!<>]|[-/+*^!<>=]=|&&?|\|\|?|<<=?|>>=?
|
||||
sc_prohibit_operator_at_end_of_line:
|
||||
@prohibit='. ($(binop_re_))$$' \
|
||||
in_vc_files='\.[chly]$$' \
|
||||
halt='found operator at end of line' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
update-copyright-env = \
|
||||
UPDATE_COPYRIGHT_USE_INTERVALS=2 \
|
||||
UPDATE_COPYRIGHT_MAX_LINE_LENGTH=79
|
||||
|
||||
+5
-4
@@ -1140,8 +1140,8 @@ do_subst (struct subst *sub)
|
||||
s_accum.active into line.text (for huge lines). See comment above
|
||||
for 'g' as to while the third argument is incorrect anyway. */
|
||||
line_exchange (&line, &s_accum, true);
|
||||
if (line.length &&
|
||||
line.active[line.length - 1] == buffer_delimiter)
|
||||
if (line.length
|
||||
&& line.active[line.length - 1] == buffer_delimiter)
|
||||
line.length--;
|
||||
}
|
||||
else
|
||||
@@ -1373,8 +1373,9 @@ execute_program (struct vector *vec, struct input *input)
|
||||
if (!cmd_length)
|
||||
{
|
||||
/* Store into pattern space for plain `e' commands */
|
||||
if (s_accum.length &&
|
||||
s_accum.active[s_accum.length - 1] == buffer_delimiter)
|
||||
if (s_accum.length
|
||||
&& (s_accum.active[s_accum.length - 1]
|
||||
== buffer_delimiter))
|
||||
s_accum.length--;
|
||||
|
||||
/* Exchange line and s_accum. This can be much
|
||||
|
||||
Reference in new issue
Block a user