This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/69415] -Wmisleading-indentation warns on "if (__b < __a) return __b; return __a;"


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]