All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: cgel.zte@gmail.com
Cc: ndesaulniers@google.com, keescook@chromium.org,
	wang.yong12@zte.com.cn, xu.xin16@zte.com.cn,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	Zeal Robot <zealci@zte.com.cn>
Subject: Re: [PATCH linux-next] tools: compiler-gcc.h::Keep compatible with non-clang compilers.
Date: Fri, 31 Dec 2021 09:54:20 -0700	[thread overview]
Message-ID: <Yc81vBwPo/aHMfXB@archlinux-ax161> (raw)
In-Reply-To: <20211231100833.590691-1-xu.xin16@zte.com.cn>

On Fri, Dec 31, 2021 at 10:08:33AM +0000, cgel.zte@gmail.com wrote:
> From: xu xin <xu.xin16@zte.com.cn>
> 
> When HOSTC = gcc (GCC) 4.8.5, there is an error occurring as follows:
> error: Undefined __has_attribute.
> 
> This problem is introduced by commit d0ee23f9d78be ("tools:
> compiler-gcc.h: Guard error attribute use with __has_attribute").

Yes, sorry for breaking this. It has been discussed here with some ideas
for a resolution but I never got any feedback so I never carried it
through, thank you for picking it up.

https://lore.kernel.org/r/c1b1a299-c60d-28a4-07ab-1ecd211d6da9@i-love.sakura.ne.jp/

This patch should probably be sent straight to Linus next time it is
sent, as he directly applied both my commit and the one that it was
fixing. Nick and I do not pick up patches currently although Kees might
be willing to take this one.

> To solve it, this patch is given to keep the comatibility.

                                               ^ compatibility

Might be worth adding "with older GCC versions" at the end of that
sentence.

> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Co-developed-by: wangyong <wang.yong12@zte.com.cn>
> Signed-off-by: xu xin <xu.xin16@zte.com.cn>
> ---
>  tools/include/linux/compiler-gcc.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
> index 8816f06fc6c7..7da593d3cb91 100644
> --- a/tools/include/linux/compiler-gcc.h
> +++ b/tools/include/linux/compiler-gcc.h
> @@ -16,6 +16,11 @@
>  # define __fallthrough __attribute__ ((fallthrough))
>  #endif
>  
> +
> +#ifndef __has_attribute
> +# define __has_attribute(x) 0  /* Compatibility with non-clang compilers. */

This comment is not really accurate; it implies that clang is the only
one that defines __has_attribute() but GCC 5.x or newer supports
__has_attribute().  A more accurate comment might be:

/* Compatibility with GCC < 5.x */

> +#endif
> +
>  #if __has_attribute(__error__)
>  # define __compiletime_error(message) __attribute__((error(message)))
>  #endif
> -- 
> 2.25.1
> 

      reply	other threads:[~2021-12-31 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-31 10:08 [PATCH linux-next] tools: compiler-gcc.h::Keep compatible with non-clang compilers cgel.zte
2021-12-31 16:54 ` Nathan Chancellor [this message]

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=Yc81vBwPo/aHMfXB@archlinux-ax161 \
    --to=nathan@kernel.org \
    --cc=cgel.zte@gmail.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=ndesaulniers@google.com \
    --cc=wang.yong12@zte.com.cn \
    --cc=xu.xin16@zte.com.cn \
    --cc=zealci@zte.com.cn \
    /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.