Description: fix FTBFS on GCC-14 As of version 14, GCC no longer allows implicitly casting all pointer types to all pointer types. This often happens in callback functions that have more specific argument types than the function pointer they are assigned to [1]. . For btyacc, this happens when using strcmp directly as the comparison function for bsearch. This patch addresses this problem by creating a wrapper function that takes the expected arguments, and casts them appropriately before calling strcmp. . [1] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types Author: David da Silva Polverari Bug-Debian: https://bugs.debian.org/1074856 Forwarded: no Last-Update: 2025-03-06 --- a/reader.c +++ b/reader.c @@ -48,6 +48,14 @@ char line_format[] = "#line %d \"%s\"\n"; +/* + * wrapper function to avoid implicit type conversion on bsearch invocation + */ +static int strcmp_wrapper(const void *s1, const void *s2) +{ + return strcmp((const char *)s1, (const char *)s2); +} + int cachec(int c) { assert(cinc >= 0); @@ -291,7 +299,7 @@ cachec(NUL); if ((key = bsearch(cache, keywords, sizeof(keywords)/sizeof(*key), - sizeof(*key), strcmp))) + sizeof(*key), strcmp_wrapper))) return key->token; } else { ++cptr;