This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/69415] -Wmisleading-indentation warns on "if (__b < __a) return __b; return __a;"
- From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 21 Jan 2016 18:49:59 +0000
- Subject: [Bug c/69415] -Wmisleading-indentation warns on "if (__b < __a) return __b; return __a;"
- Auto-submitted: auto-generated
- References: <bug-69415-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69415
--- Comment #8 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #6)
> Also happens when building LLVM:
>
> 268 case lltok::kw_attributes: if (ParseUnnamedAttrGrp()) return true;
> break;
>
> 269 case lltok::kw_uselistorder: if (ParseUseListOrder()) return true;
> break;
>
> 270 case lltok::kw_uselistorder_bb:
>
> 271 if (ParseUseListOrderBB()) return
> true; break;
>
> were gcc warn for the third case.
>
> I think the warning should be disabled for one-liners in general.
IIRC, currently we warn for one-liners if the "if/else/for/while" is the first
thing on the line, but not if there's other non-whitespace beforehand.
This is why the above doesn't get a warning for lines 268 and 259, but does at
line 271.