linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arch/x86/include/asm/current.h:49:9: error: call to undeclared function '__typeof_unqual__'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
@ 2024-12-18 16:08 Naresh Kamboju
  2024-12-18 16:33 ` Uros Bizjak
  0 siblings, 1 reply; 3+ messages in thread
From: Naresh Kamboju @ 2024-12-18 16:08 UTC (permalink / raw)
  To: rust-for-linux, open list:KERNEL SELFTEST FRAMEWORK, open list,
	lkft-triage
  Cc: Uros Bizjak, Anders Roxell, Dan Carpenter, Arnd Bergmann

The Rust gcc builds failed due to following build warnings / errors on the
x86_64 and arm64 architectures with selftests/rust/config on the Linux
next-20241216...next-20241218.

First seen on the next-20241216 tag.
Good: next-20241213
Bad: next-20241216

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>

Anders bisected this regressions and found,
# first bad commit:
  [20b3c3eccd9361c9976af640be280526bef72248]
  percpu: use TYPEOF_UNQUAL() in variable declarations

Build log:
-------
arch/x86/include/asm/current.h:49:9: error: call to undeclared
function '__typeof_unqual__'; ISO C99 and later do not support
implicit function declarations [-Wimplicit-function-declaration]
arch/x86/include/asm/current.h:49:9: error: expected ';' after expression
arch/x86/include/asm/current.h:49:9: error: use of undeclared
identifier 'pscr_ret__'

Links:
-------
 - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241218/testrun/26395023/suite/build/test/rustgcc-lkftconfig-kselftest/log
 - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241218/testrun/26395032/suite/build/test/rustgcc-lkftconfig-kselftest/log
 - https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241217/testrun/26355712/suite/build/test/rustgcc-lkftconfig-kselftest/history/

metadata:
----
  git describe: next-20241216..next-20241218
  git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
  kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2qNMCRNosQCRWxj5dIUE87pDXos/config
  build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2qNMCRNosQCRWxj5dIUE87pDXos/
  toolchain: 'gcc', 'version': '14'
  arch: arm64, x86
  build name: rustgcc-lkftconfig-kselftest

 --
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arch/x86/include/asm/current.h:49:9: error: call to undeclared function '__typeof_unqual__'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  2024-12-18 16:08 arch/x86/include/asm/current.h:49:9: error: call to undeclared function '__typeof_unqual__'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] Naresh Kamboju
@ 2024-12-18 16:33 ` Uros Bizjak
  2024-12-18 20:14   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2024-12-18 16:33 UTC (permalink / raw)
  To: Naresh Kamboju
  Cc: rust-for-linux, open list:KERNEL SELFTEST FRAMEWORK, open list,
	lkft-triage, Anders Roxell, Dan Carpenter, Arnd Bergmann

On Wed, Dec 18, 2024 at 5:08 PM Naresh Kamboju
<naresh.kamboju@linaro.org> wrote:
>
> The Rust gcc builds failed due to following build warnings / errors on the
> x86_64 and arm64 architectures with selftests/rust/config on the Linux
> next-20241216...next-20241218.
>
> First seen on the next-20241216 tag.
> Good: next-20241213
> Bad: next-20241216
>
> Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
>
> Anders bisected this regressions and found,
> # first bad commit:
>   [20b3c3eccd9361c9976af640be280526bef72248]
>   percpu: use TYPEOF_UNQUAL() in variable declarations
>
> Build log:
> -------
> arch/x86/include/asm/current.h:49:9: error: call to undeclared
> function '__typeof_unqual__'; ISO C99 and later do not support
> implicit function declarations [-Wimplicit-function-declaration]
> arch/x86/include/asm/current.h:49:9: error: expected ';' after expression
> arch/x86/include/asm/current.h:49:9: error: use of undeclared
> identifier 'pscr_ret__'

__typeof_unqual__ is a keyword in c23 (and an extension in gcc-14+ and
clang-19+).

https://en.cppreference.com/w/c/language/typeof
https://learn.microsoft.com/en-us/cpp/c-language/typeof-unqual-c?view=msvc-170

The compiler support is detected in init/Kconfig:

config CC_HAS_TYPEOF_UNQUAL
    def_bool $(success,echo 'int foo (int a) { __typeof_unqual__(a) b
= a; return b; }' | $(CC) -x c - -S -o /dev/null)

so, if your compiler doesn't support this keyword,
CC_HAS_TYPEOF_UNQUAL should not be enabled and
include/linux/compiler.h should disable usage of __typeof_unqual__:

#if defined(CONFIG_CC_HAS_TYPEOF_UNQUAL) && !defined(__CHECKER__)
# define TYPEOF_UNQUAL(exp) __typeof_unqual__(exp)
#else
# define TYPEOF_UNQUAL(exp) __typeof__(exp)
#endif

Can you please investigate what happens here for your build?

Thanks,
Uros.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: arch/x86/include/asm/current.h:49:9: error: call to undeclared function '__typeof_unqual__'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
  2024-12-18 16:33 ` Uros Bizjak
@ 2024-12-18 20:14   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-12-18 20:14 UTC (permalink / raw)
  To: Uros Bizjak
  Cc: Naresh Kamboju, rust-for-linux,
	open list:KERNEL SELFTEST FRAMEWORK, open list, lkft-triage,
	Anders Roxell, Arnd Bergmann

On Wed, Dec 18, 2024 at 05:33:24PM +0100, Uros Bizjak wrote:
> On Wed, Dec 18, 2024 at 5:08 PM Naresh Kamboju
> <naresh.kamboju@linaro.org> wrote:
> >
> > The Rust gcc builds failed due to following build warnings / errors on the
> > x86_64 and arm64 architectures with selftests/rust/config on the Linux
> > next-20241216...next-20241218.
> >
> > First seen on the next-20241216 tag.
> > Good: next-20241213
> > Bad: next-20241216
> >
> > Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
> >
> > Anders bisected this regressions and found,
> > # first bad commit:
> >   [20b3c3eccd9361c9976af640be280526bef72248]
> >   percpu: use TYPEOF_UNQUAL() in variable declarations
> >
> > Build log:
> > -------
> > arch/x86/include/asm/current.h:49:9: error: call to undeclared
> > function '__typeof_unqual__'; ISO C99 and later do not support
> > implicit function declarations [-Wimplicit-function-declaration]
> > arch/x86/include/asm/current.h:49:9: error: expected ';' after expression
> > arch/x86/include/asm/current.h:49:9: error: use of undeclared
> > identifier 'pscr_ret__'
> 
> __typeof_unqual__ is a keyword in c23 (and an extension in gcc-14+ and
> clang-19+).
> 
> https://en.cppreference.com/w/c/language/typeof
> https://learn.microsoft.com/en-us/cpp/c-language/typeof-unqual-c?view=msvc-170
> 
> The compiler support is detected in init/Kconfig:
> 
> config CC_HAS_TYPEOF_UNQUAL
>     def_bool $(success,echo 'int foo (int a) { __typeof_unqual__(a) b
> = a; return b; }' | $(CC) -x c - -S -o /dev/null)
> 
> so, if your compiler doesn't support this keyword,
> CC_HAS_TYPEOF_UNQUAL should not be enabled and
> include/linux/compiler.h should disable usage of __typeof_unqual__:
> 
> #if defined(CONFIG_CC_HAS_TYPEOF_UNQUAL) && !defined(__CHECKER__)
> # define TYPEOF_UNQUAL(exp) __typeof_unqual__(exp)
> #else
> # define TYPEOF_UNQUAL(exp) __typeof__(exp)
> #endif
> 
> Can you please investigate what happens here for your build?

This is the bindgen program for generating Rust bindings.  Tuxmake is
using bindgen 0.66.1 and I was able to reproduce the failures with
that version inside a container.  I have bindgen 0.70.1 installed on my
system and that seems to parse __typeof_unqual__ okay.

I don't know how bindgen works.  Maybe the Rust developers can comment?

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-18 20:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 16:08 arch/x86/include/asm/current.h:49:9: error: call to undeclared function '__typeof_unqual__'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] Naresh Kamboju
2024-12-18 16:33 ` Uros Bizjak
2024-12-18 20:14   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).