[PATCH] D70638: [Diagnostic] add a warning which warns about misleading indentation

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 4 10:28:50 PST 2019


nickdesaulniers added a comment.

In D70638#1768200 <https://reviews.llvm.org/D70638#1768200>, @nathanchance wrote:

> As an FYI, this appears to cause several false positive warnings with the Linux kernel:
>
>   ../drivers/video/fbdev/core/fbmem.c:665:3: warning: misleading indentation; statement is not part of the previous 'else' [-Wmisleading-indentation]
>           if (fb_logo.depth > 4 && depth > 4) {
>           ^
>   ../drivers/video/fbdev/core/fbmem.c:661:2: note: previous statement is here
>           else
>           ^
>   ../drivers/video/fbdev/core/fbmem.c:1075:3: warning: misleading indentation; statement is not part of the previous 'if' [-Wmisleading-indentation]
>           return ret;
>           ^
>   ../drivers/video/fbdev/core/fbmem.c:1072:2: note: previous statement is here
>           if (!ret)
>           ^
>   2 warnings generated.
>
>
> Corresponding to:
>
> https://elixir.bootlin.com/linux/v5.4.1/source/drivers/video/fbdev/core/fbmem.c#L665
>
> and
>
> https://elixir.bootlin.com/linux/v5.4.1/source/drivers/video/fbdev/core/fbmem.c#L1072


IMO that is misleading indentation. A single space followed by a tab? WTF


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70638/new/

https://reviews.llvm.org/D70638





More information about the cfe-commits mailing list