public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106528] New: Double semi-colon causes -Wmisleading-identation to not emit warning
@ 2022-08-04 18:21 baker.dylan.c at gmail dot com
  0 siblings, 0 replies; only message in thread
From: baker.dylan.c at gmail dot com @ 2022-08-04 18:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106528

            Bug ID: 106528
           Summary: Double semi-colon causes -Wmisleading-identation to
                    not emit warning
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baker.dylan.c at gmail dot com
  Target Milestone: ---

A double semi-colon will cause the misleading-indentation warning to miss that
a second indented statement is not part by the condiational block.

#include <stdio.h>

int main(void) {
    if (1)
        printf("%s", "true);;
        return 0;
    return 1;

Removing the extranious semi-colon from the printf() call will correct the
problem and gcc will emit a warning as expected.

I've tested with 11.3.1 and 12.1.0, and with clang 14, which has the same
behavior. This was noticed through a macro that adds a semi-colon in the macro
definition, and then has a semi-colon following the call to the macro.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-04 18:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 18:21 [Bug c/106528] New: Double semi-colon causes -Wmisleading-identation to not emit warning baker.dylan.c at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).