summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Oltmann <thomas.oltmann.hhg@gmail.com>2022-01-07 14:40:10 +0100
committerMattias Andrée <maandree@kth.se>2022-01-07 14:57:59 +0100
commit7e54065eb147ba61b5c4b0ca81bd3980a91bf22d (patch)
tree5e98c4146f61ccc0c4b22581cea6b60421594129
parentUse c99 instead of nonportable cc -std=c99 (diff)
downloadmakel-7e54065eb147ba61b5c4b0ca81bd3980a91bf22d.tar.gz
makel-7e54065eb147ba61b5c4b0ca81bd3980a91bf22d.tar.bz2
makel-7e54065eb147ba61b5c4b0ca81bd3980a91bf22d.tar.xz
Fixed line continuation checks.
The checks for line continuation starting on an empty line, ending on an empty line, and ending on EOF were broken because of logic errors in said checks, as well as an accidental negation in is_line_blank().
-rw-r--r--makel.c5
-rw-r--r--text.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/makel.c b/makel.c
index e68f68a..83142bc 100644
--- a/makel.c
+++ b/makel.c
@@ -49,13 +49,14 @@ check_line_continuations(struct line *lines, size_t nlines)
}
if (!lines[i].continuation_joiner &&
- i && lines[i - 1].continuation_joiner) {
+ i && lines[i - 1].continuation_joiner &&
+ is_line_blank(&lines[i])) {
warnf_confusing(WC_CONTINUATION_TO_BLANK,
"%s:%zu: terminal line continuation to blank line, can cause confusion",
lines[i].path, lines[i].lineno);
}
- if (!lines[i].continuation_joiner && lines[i].eof) {
+ if (lines[i].continuation_joiner && lines[i].eof) {
warnf_unspecified(WC_EOF_LINE_CONTINUATION,
"%s:%zu: line continuation at end of file, causes unspecified behaviour%s",
lines[i].path, lines[i].lineno,
diff --git a/text.c b/text.c
index 440ed7d..c7b75b2 100644
--- a/text.c
+++ b/text.c
@@ -163,5 +163,5 @@ is_line_blank(struct line *line)
char *s = line->data;
while (isspace(*s))
s++;
- return !!*s;
+ return !*s;
}