vkgears fails to build with -fno-builtin-powf or Clang
Affects systems where Clang is default compiler: FreeBSD, OpenBSD, macOS, Android, OpenMandriva, Chimera Linux. Tested with Clang 10-16.
$ export CC=clang
$ meson setup --auto-features=disabled -Dx11=enabled -Dvulkan=enabled /tmp/demos_build
$ meson compile -C /tmp/demos_build
[...]
src/vulkan/vkgears.c:1152:6: error: initializer element is not a compile-time constant
{ G2L(0.8), G2L(0.1), G2L(0.0) },
^~~~~~~~
src/vulkan/vkgears.c:1149:16: note: expanded from macro 'G2L'
#define G2L(x) ((x) < 0.04045 ? (x) / 12.92 : powf(((x) + 0.055) / 1.055, 2.4))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
or
$ export CC=gcc CFLAGS=-fno-builtin-powf
$ meson setup --auto-features=disabled -Dx11=enabled -Dvulkan=enabled /tmp/demos_build
$ meson compile -C /tmp/demos_build
[...]
src/vulkan/vkgears.c:1149:16: error: initializer element is not constant
1149 | #define G2L(x) ((x) < 0.04045 ? (x) / 12.92 : powf(((x) + 0.055) / 1.055, 2.4))
| ^
src/vulkan/vkgears.c:1152:6: note: in expansion of macro 'G2L'
1152 | { G2L(0.8), G2L(0.1), G2L(0.0) },
| ^~~
src/vulkan/vkgears.c:1149:16: note: (near initialization for 'material_colors[0][0]')
1149 | #define G2L(x) ((x) < 0.04045 ? (x) / 12.92 : powf(((x) + 0.055) / 1.055, 2.4))
| ^
src/vulkan/vkgears.c:1152:6: note: in expansion of macro 'G2L'
1152 | { G2L(0.8), G2L(0.1), G2L(0.0) },
| ^~~
[...]
Edited by Jan Beich