Handling of struct initializers changed.

Break conditionals with || at the end.
This commit is contained in:
Johanne Schock 2020-03-12 21:11:12 +01:00 committed by patacongo
parent 4686d7cf57
commit 645cf6d547

View File

@ -751,7 +751,8 @@ int main(int argc, char **argv, char **envp)
* another right brace, or a pre-processor directive like #endif * another right brace, or a pre-processor directive like #endif
*/ */
if (strchr(line, '}') == NULL && line[n] != '#' && if (dnest == 0 &&
strchr(line, '}') == NULL && line[n] != '#' &&
strncmp(&line[n], "else", 4) != 0 && strncmp(&line[n], "else", 4) != 0 &&
strncmp(&line[n], "while", 5) != 0 && strncmp(&line[n], "while", 5) != 0 &&
strncmp(&line[n], "break", 5) != 0) strncmp(&line[n], "break", 5) != 0)
@ -967,8 +968,8 @@ int main(int argc, char **argv, char **envp)
rhcomment = -1; rhcomment = -1;
if (ncomment > 0 && (!strncmp(&line[ii], "if", 2) if (ncomment > 0 && (strncmp(&line[ii], "if", 2) == 0 ||
|| !strncmp(&line[ii], "el", 2))) strncmp(&line[ii], "el", 2) == 0))
{ {
/* in #if... and #el.. */ /* in #if... and #el.. */
@ -1608,7 +1609,7 @@ int main(int argc, char **argv, char **envp)
{ {
/* REVISIT: dnest is always > 0 here if bfunctions == false */ /* REVISIT: dnest is always > 0 here if bfunctions == false */
if (dnest == 0 || !bfunctions) if (dnest == 0 || !bfunctions || lineno == rbrace_lineno)
{ {
ERROR("Left bracket not on separate line", lineno, ERROR("Left bracket not on separate line", lineno,
n); n);
@ -1754,6 +1755,13 @@ int main(int argc, char **argv, char **envp)
lineno, endx); lineno, endx);
} }
} }
else if (line[endx] == '=')
{
/* There's a struct initialization following */
check_spaces_leftright(line, lineno, endx, endx);
dnest = 1;
}
else else
{ {
ERROR("Garbage follows right bracket", ERROR("Garbage follows right bracket",