All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	clang-built-linux@googlegroups.com,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
Date: Mon, 16 Nov 2020 00:25:15 -0600	[thread overview]
Message-ID: <20201116062515.GA7265@embeddedor> (raw)
In-Reply-To: <20201116043532.4032932-2-ndesaulniers@google.com>

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks, Nick.
--
Gustavo

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: clang-built-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Paul Mackerras <paulus@samba.org>,
	Nathan Chancellor <natechancellor@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
Date: Mon, 16 Nov 2020 00:25:15 -0600	[thread overview]
Message-ID: <20201116062515.GA7265@embeddedor> (raw)
In-Reply-To: <20201116043532.4032932-2-ndesaulniers@google.com>

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks, Nick.
--
Gustavo

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

  reply	other threads:[~2020-11-16  6:25 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  4:35 [PATCH 0/3] PPC: Fix -Wimplicit-fallthrough for clang Nick Desaulniers
2020-11-16  4:35 ` Nick Desaulniers
2020-11-16  4:35 ` [PATCH 1/3] powerpc: boot: include compiler_attributes.h Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:25   ` Gustavo A. R. Silva [this message]
2020-11-16  6:25     ` Gustavo A. R. Silva
2020-11-16 11:24   ` Miguel Ojeda
2020-11-16 11:24     ` Miguel Ojeda
2020-11-17  3:01   ` Nathan Chancellor
2020-11-17  3:01     ` Nathan Chancellor
2020-11-17 22:30   ` Arvind Sankar
2020-11-17 22:30     ` Arvind Sankar
2020-11-17 23:46   ` Michael Ellerman
2020-11-17 23:46     ` Michael Ellerman
2020-11-16  4:35 ` [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/" Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:26   ` Gustavo A. R. Silva
2020-11-16  6:26     ` Gustavo A. R. Silva
2020-11-16 11:18     ` Miguel Ojeda
2020-11-16 11:18       ` Miguel Ojeda
2020-11-16 11:26   ` Miguel Ojeda
2020-11-16 11:26     ` Miguel Ojeda
2020-11-16 11:49   ` kernel test robot
2020-11-16 11:49     ` kernel test robot
2020-11-16 11:49     ` kernel test robot
2020-11-17  3:02   ` Nathan Chancellor
2020-11-17  3:02     ` Nathan Chancellor
2020-11-17 19:10     ` Nick Desaulniers
2020-11-17 19:10       ` Nick Desaulniers
2020-11-17 22:16       ` Gustavo A. R. Silva
2020-11-17 22:16         ` Gustavo A. R. Silva
2020-11-17 22:28         ` Nick Desaulniers
2020-11-17 22:28           ` Nick Desaulniers
2020-11-17 23:45           ` Gustavo A. R. Silva
2020-11-17 23:45             ` Gustavo A. R. Silva
2020-11-17 23:48         ` Michael Ellerman
2020-11-17 23:48           ` Michael Ellerman
2020-11-16  4:35 ` [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:28   ` Gustavo A. R. Silva
2020-11-16  6:28     ` Gustavo A. R. Silva
2020-11-16 11:33   ` Miguel Ojeda
2020-11-16 11:33     ` Miguel Ojeda
2020-11-17  3:02   ` Nathan Chancellor
2020-11-17  3:02     ` Nathan Chancellor
2020-11-17 23:46   ` Michael Ellerman
2020-11-17 23:46     ` Michael Ellerman

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=20201116062515.GA7265@embeddedor \
    --to=gustavoars@kernel.org \
    --cc=benh@kernel.crashing.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=paulus@samba.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.