All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-kbuild@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kbuild: Enable -Wenum-conversion by default
Date: Wed, 5 Jul 2023 09:20:26 -0700	[thread overview]
Message-ID: <20230705162026.GA2951@dev-arch.thelio-3990X> (raw)
In-Reply-To: <20230704221951.7396-1-bp@alien8.de>

On Wed, Jul 05, 2023 at 12:19:51AM +0200, Borislav Petkov wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.de>
> 
> This diagnostic checks whether there is a type mismatch when
> converting enums (assign an enum of type A to an enum of type B, for
> example) and it caught a legit issue recently. The reason it didn't show
> is because that warning is enabled only with -Wextra with GCC. Clang,
> however, enables it by default.
> 
> GCC folks were considering enabling it by default but it was too noisy
> back then:
> 
>   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78736
> 
> Now that due to clang all those warnings have been fixed, enable it with
> GCC too.
> 
> allmodconfig tests done with: x86, arm{,64}, powerpc{,64}, riscv
> crossbuilds.
> 
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>

Yes please :)

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

> ---
>  Makefile | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Makefile b/Makefile
> index 7a5a175f708f..428132b3d6dd 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1082,6 +1082,9 @@ KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)
>  # Require designated initializers for all marked structures
>  KBUILD_CFLAGS   += $(call cc-option,-Werror=designated-init)
>  
> +# Warn if there is an enum types mismatch
> +KBUILD_CFLAGS	+= $(call cc-option,-Wenum-conversion)
> +
>  # change __FILE__ to the relative path from the srctree
>  KBUILD_CPPFLAGS += $(call cc-option,-fmacro-prefix-map=$(srctree)/=)
>  
> -- 
> 2.41.0
> 

  reply	other threads:[~2023-07-05 16:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 22:19 [PATCH] kbuild: Enable -Wenum-conversion by default Borislav Petkov
2023-07-05 16:20 ` Nathan Chancellor [this message]
2023-07-15  5:46   ` Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230705162026.GA2951@dev-arch.thelio-3990X \
    --to=nathan@kernel.org \
    --cc=bp@alien8.de \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.