Clang build issue: gallium swraster does not conform with c2x standard
System information
System uname: Linux-5.15.75-gentoo-clang-x86_64-AMD_A8-7600_Radeon_R7,_10_Compute_Cores_4C+6G-with-glibc2.36
OS : gentoo Linux
GPU: Advanced Micro Devices, Inc. [AMD/ATI] Kaveri [Radeon R7 Graphics]
Mesa version: 22.2.3
Compiler toolchain version: LLVM/Clang 15.0.3
Issue
Trying to build mesa 22.2.3 the following Gentoo configuration:
USE="-X clang -d3d9 -debug gles1 gles2 libcxx llvm lm-sensors -lto opencl osmesa proprietary-codecs (-selinux) -test -unwind vaapi -valgrind -vdpau vulkan -vulkan-overlay -wayland -xa -xvmc zink zstd" CPU_FLAGS_X86="sse2" VIDEO_CARDS="-d3d12 (-freedreno) -intel (-lima) -nouveau (-panfrost) -r300 r600 radeon radeonsi (-v3d) (-vc4) virgl (-vivante) -vmware"
CFLAGS=" -march=native -O2 -pipe -fomit-frame-pointer -fstack-protector-all -fs
tack-clash-protection -Wclobbered -Wno-aggressive-loop-optimizations -Wstrict-
aliasing -Wuninitialized -flarge-source-files -fsplit-loops -funswitch-loops -fl
oop-block -fira-hoist-pressure -fira-loop-pressure -fsched-pressure -fsched-spec
-load -flto -g0 -fdiagnostics-color=always "
LDFLAGS=" -march=native -O2 -pipe -fomit-frame-pointer -fstack-protector-all -fstack-clash-protection -Wclobbered -Wno-aggressive-loop-optimizations -Wstrict-aliasing -Wuninitialized -flarge-source-files -fsplit-loops -funswitch-loops -floop-block -fira-hoist-pressure -fira-loop-pressure -fsched-pressure -fsched-spec-load -flto -g0 -fdiagnostics-color=always -fuse-linker-plugin -Wl,--hash-style=gnu"
stops with error while compiling src/gallium/auxiliary/pipe-loader/pipe_loader_sw.c with multiple errors: "passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x" at every sdev->ws = sdev->dd->winsys[i].create_winsys() call
A quite easy patch (created using standard unified diff), properly casting the callback function pointers is proposed to solve this issue: mesa-22.2.3-swrast_clang.patch
Edited by David Heidelberg