gphoto2
gphoto2 copied to clipboard
Build failure with stricter C compilers (e.g. GCC 14)
Describe the bug
Modern C compilers are becoming stricter with a variety of changes over the last year or so.
GCC 14 in particular (to be released in ~April 2024) fails to build gphoto2-2.2.58 like:
gphoto2-cmd-config.c: In function ‘set_config’:
gphoto2-cmd-config.c:74:42: error: passing argument 4 of ‘newCDKDialog’ from incompatible pointer type [-Wincompatible-pointer-types]
74 | msg, 4, buttons, 2,
| ^~~
| |
| const char **
In file included from /usr/include/cdk.h:40,
from gphoto2-cmd-config.c:36:
/usr/include/cdk/dialog.h:90:17: note: expected ‘char **’ but argument is of type ‘const char **’
90 | CDK_CSTRING2 /* message */,
| ^~~~~~~~~~~~
gphoto2-cmd-config.c:74:50: error: passing argument 6 of ‘newCDKDialog’ from incompatible pointer type [-Wincompatible-pointer-types]
74 | msg, 4, buttons, 2,
| ^~~~~~~
| |
| const char **
/usr/include/cdk/dialog.h:92:17: note: expected ‘char **’ but argument is of type ‘const char **’
92 | CDK_CSTRING2 /* buttons */,
| ^~~~~~~~~~~~
gphoto2-cmd-config.c: In function ‘show_section’:
gphoto2-cmd-config.c:127:32: error: passing argument 8 of ‘newCDKScroll’ from incompatible pointer type [-Wincompatible-pointer-types]
127 | (const char**)items, count, NUMBERS, A_REVERSE, TRUE, FALSE);
| ^~~~~~~~~~~~~~~~~~~
| |
| const char **
/usr/include/cdk/scroll.h:82:17: note: expected ‘char **’ but argument is of type ‘const char **’
82 | CDK_CSTRING2 /* itemList */,
| ^~~~~~~~~~~~
gphoto2-cmd-config.c: In function ‘show_radio’:
gphoto2-cmd-config.c:321:53: error: passing argument 6 of ‘newCDKItemlist’ from incompatible pointer type [-Wincompatible-pointer-types]
321 | title, _("Value: "), (const char**)items, count,
| ^~~~~~~~~~~~~~~~~~~
| |
| const char **
/usr/include/cdk/itemlist.h:86:17: note: expected ‘char **’ but argument is of type ‘const char **’
86 | CDK_CSTRING2 /* itemlist */,
| ^~~~~~~~~~~~
gphoto2-cmd-config.c: In function ‘show_toggle’:
gphoto2-cmd-config.c:378:32: error: passing argument 6 of ‘newCDKItemlist’ from incompatible pointer type [-Wincompatible-pointer-types]
378 | info, 2, 1 - value, TRUE, FALSE);
| ^~~~
| |
| const char **
/usr/include/cdk/itemlist.h:86:17: note: expected ‘char **’ but argument is of type ‘const char **’
86 | CDK_CSTRING2 /* itemlist */,
| ^~~~~~~~~~~~
make[2]: *** [Makefile:797: gphoto2-gphoto2-cmd-config.o] Error 1
Originally reported downstream in Gentoo at https://bugs.gentoo.org/919279.
Name the camera N/A
libgphoto2 and gphoto2 version libgphoto2-2.5.1, gphoto2-2.5.28
To Reproduce
Steps to reproduce the behavior: This can be emulated with -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion
on an older GCC or Clang.
Similar to https://github.com/gphoto/libgphoto2/issues/941.