Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 880373

Summary: app-arch/cpio-2.13-r3 - obstack.c: error: incompatible function pointer types initializing void
Product: Gentoo Linux Reporter: Toralf Förster <toralf>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal Keywords: PATCH
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://savannah.gnu.org/bugs/index.php?63349
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 870412    
Attachments: emerge-info.txt
app-arch:cpio-2.13-r3:20221108-092752.log
clang.tar.bz2
emerge-history.txt
environment
etc.portage.tar.bz2
logs.tar.bz2
temp.tar.bz2
Change C11 _Noreturn into __attribute__((noreturn)) in obstack.c

Description Toralf Förster gentoo-dev 2022-11-08 09:31:18 UTC
clang -DHAVE_CONFIG_H -I. -I..     -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=implicit-int -c -o xsize.o xsize.c
clang -DHAVE_CONFIG_H -I. -I..     -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=implicit-int -c -o obstack.o obstack.c
clang -DHAVE_CONFIG_H -I. -I..     -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=implicit-int -c -o basename-lgpl.o basename-lgpl.c
clang -DHAVE_CONFIG_H -I. -I..     -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=implicit-int -c -o uinttostr.o uinttostr.c
obstack.c:351:31: error: incompatible function pointer types initializing 'void
      (*)(void) __attribute__((noreturn))' with an expression of type
      'void (void)' [-Werror,-Wincompatible-function-pointer-types]

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_no_multilib-j4-20221108-023017

  -------------------------------------------------------------------

gcc-config -l:
 [1] x86_64-pc-linux-gnu-12 *
clang/llvm (if any):
clang version 15.0.4
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin
Configuration file: /etc/clang/clang.cfg
/usr/lib/llvm/15
15.0.4
Python 3.10.8
Available Rust versions:
  [1]   rust-bin-1.64.0 *
The Glorious Glasgow Haskell Compilation System, version 8.10.6
php cli (if any):
GNU Make 4.4

  HEAD of ::gentoo
commit 5c62c228257b375a4680cb55f3573cbf3d80326c
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Tue Nov 8 09:01:56 2022 +0000

    2022-11-08 09:01:56 UTC

emerge -qpvO app-arch/cpio
[ebuild  N    ] app-arch/cpio-2.13-r3  USE="nls"
Comment 1 Toralf Förster gentoo-dev 2022-11-08 09:31:19 UTC
Created attachment 828957 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-11-08 09:31:21 UTC
Created attachment 828959 [details]
app-arch:cpio-2.13-r3:20221108-092752.log
Comment 3 Toralf Förster gentoo-dev 2022-11-08 09:31:21 UTC
Created attachment 828961 [details]
clang.tar.bz2
Comment 4 Toralf Förster gentoo-dev 2022-11-08 09:31:22 UTC
Created attachment 828963 [details]
emerge-history.txt
Comment 5 Toralf Förster gentoo-dev 2022-11-08 09:31:24 UTC
Created attachment 828965 [details]
environment
Comment 6 Toralf Förster gentoo-dev 2022-11-08 09:31:25 UTC
Created attachment 828967 [details]
etc.portage.tar.bz2
Comment 7 Toralf Förster gentoo-dev 2022-11-08 09:31:26 UTC
Created attachment 828969 [details]
logs.tar.bz2
Comment 8 Toralf Förster gentoo-dev 2022-11-08 09:31:27 UTC
Created attachment 828971 [details]
temp.tar.bz2
Comment 9 Carlos 2022-12-01 01:03:16 UTC
Created attachment 838639 [details, diff]
Change C11 _Noreturn into __attribute__((noreturn)) in obstack.c

Changing '_Noreturn' on line 329 to __attribute_noreturn__ on the declaration of print_and_abort at obstack.c works for me.

Seems Clang doesn't treat C11 _Noreturn as equivalent to __attribute__((noreturn)), while GCC does.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-01 01:18:30 UTC
(In reply to Carlos from comment #9)
> Created attachment 838639 [details, diff] [details, diff]
> Change C11 _Noreturn into __attribute__((noreturn)) in obstack.c
> 
> Changing '_Noreturn' on line 329 to __attribute_noreturn__ on the
> declaration of print_and_abort at obstack.c works for me.
> 
> Seems Clang doesn't treat C11 _Noreturn as equivalent to
> __attribute__((noreturn)), while GCC does.

Could you send the patch upstream to the Savannah link I posted, but also, does this work fine with GCC?

I wonder if we'll need to use a configure check to make this palatable to upstream.

Thanks!
Comment 11 Mazunki Hoksaas 2022-12-01 12:27:30 UTC
The patch compiles on both my clang and my gcc environment. Both with LTO.
Comment 12 Larry the Git Cow gentoo-dev 2023-01-03 03:33:48 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e82c66c6494159d59fe2d771f8eec43748dd869b

commit e82c66c6494159d59fe2d771f8eec43748dd869b
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-03 03:28:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-03 03:33:42 +0000

    app-arch/cpio: fix build w/ clang 16
    
    Closes: https://bugs.gentoo.org/880373
    Signed-off-by: Sam James <sam@gentoo.org>

 .../{cpio-2.13-r4.ebuild => cpio-2.13-r5.ebuild}   |  3 ++-
 ...2.13-wincompatible-function-pointer-types.patch | 23 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)