https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100020
Bug ID: 100020
Summary: RFE: Wmisleading-indentation (or similar warning) for
certain missing semicolons?
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dmalcolm at gcc dot gnu.org
Target Milestone: ---
>From a discussion on Freenode's #gcc:
https://git.sr.ht/~rkta/irssi/commit/76c00f5ee29df9f66a4162891d41515ebc829f4b
@@ 307,6 307,8 @@ void printtext(void *server, const char *target, int level,
const char *text, ..
g_return_if_fail(text != NULL);
format_create_dest(&dest, server, target, level, NULL);
+ if (!dest.window)
+ return
va_start(va, text);
printtext_dest_args(&dest, text, va);
Spot the mistake?
The compiler "sees" it as:
if (!dest.window)
return va_start(va, text);
and chaos ensues.
This feels a lot like -Wmisleading-indentation, in that it's a case where how
the parser is "seeing" the code is very different from how a human reader might
see the code.
I'm not sure if it should be part of -Wmisleading-indentation or a separate
warning, but it seemed promising in terms of helping the user avoid a 2 hour
debugging session...