[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFULd4aDuPA3rig9BzD_P1Y62S0Y5Yv_8AxpjtwTddv4OPNoHg@mail.gmail.com>
Date: Mon, 27 Jan 2025 00:27:40 +0100
From: Uros Bizjak <ubizjak@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
mm-commits@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [GIT PULL] MM updates for 6.14-rc1
On Sun, Jan 26, 2025 at 11:00 PM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Sun, 26 Jan 2025 at 11:47, Uros Bizjak <ubizjak@...il.com> wrote:
> >
> > > #if __clang_major__ >= 19
> > > # define CC_HAS_TYPEOF_UNQUAL 1
> > > #endif
> >
> > It is available in gcc-14.
>
> Ok, let's take that approach, instead of messing with CONFIG_CC_HAS_xyz.
Please find attached an incremental patch that implements the proposed approach.
The detection is put in include/linux/compiler.h where we can
consolidate checks for both compilers:
--cut here--
/*
* Declare compiler support for __typeof_unqual__() operator.
*
* bindgen uses LLVM even if our C compiler is gcc, so we cannot
* rely on the auto-detected CONFIG_CC_HAS_TYPEOF_UNQUAL.
*
* XXX: Remove test for __CHECKER__ once
* sparse learns about __typeof_unqual__.
*/
#if ((defined(__GNUC__) && __GNUC__ >= 14) || \
(defined(__clang__) && __clang_major__ >= 19)) && \
!defined(__CHECKER__)
# define CC_HAS_TYPEOF_UNQUAL 1
#endif
/*
* Define TYPEOF_UNQUAL() to use __typeof_unqual__() as typeof
* operator when available, to return an unqualified type of the exp.
*/
#if defined(CC_HAS_TYPEOF_UNQUAL)
# define TYPEOF_UNQUAL(exp) __typeof_unqual__(exp)
#else
# define TYPEOF_UNQUAL(exp) __typeof__(exp)
#endif
--cut here--
The above also consolidates checks for __CHECKER__, resulting in a
much simpler compile check in arch/x86/include/percpu.h.
I have tested the new patch series with a bunch of compilers, works as
expected, but it is getting a bit late here. I'll resend the series
tomorrow, after some more testing.
Uros.
View attachment "p.diff.txt" of type "text/plain" (2416 bytes)
Powered by blists - more mailing lists