Incompatible function pointer types when using read_xdr_file and write_xdr_file
When using read_xdr_file
and write_xdr_file
, Clang 15 complains about incompatible function pointer types. With the current main branch of LLVM that will eventually become Clang 16, this turns to an error. We should fix this issue, to prevent our users for having issues in the future.
Example output with Clang 15:
/bin/sh ../../../libtool --tag=CC --mode=compile clang-15 -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I./../0d -I./../1d -I./../2d -I./../3d -I./../Common -I../../../alberta_util/src -I../../../alberta_util/src -I../Common -I/home/gruenich/alberta3/install/include -DDIM_OF_WORLD=2 -DALBERTA_DEBUG=0 -DALBERTA_PROFILE=0 -Wall -pedantic -std=c11 -O3 -MT ../Common/libalberta_2d_la-macro.lo -MD -MP -MF ../Common/.deps/libalberta_2d_la-macro.Tpo -c -o ../Common/libalberta_2d_la-macro.lo `test -f '../Common/macro.c' || echo './'`../Common/macro.c
libtool: compile: clang-15 -DHAVE_CONFIG_H -I. -I../../.. -I../../../include -I./../0d -I./../1d -I./../2d -I./../3d -I./../Common -I../../../alberta_util/src -I../../../alberta_util/src -I../Common -I/home/gruenich/alberta3/install/include -DDIM_OF_WORLD=2 -DALBERTA_DEBUG=0 -DALBERTA_PROFILE=0 -Wall -pedantic -std=c11 -O3 -MT ../Common/libalberta_2d_la-macro.lo -MD -MP -MF ../Common/.deps/libalberta_2d_la-macro.Tpo -c ../Common/macro.c -fPIC -DPIC -o ../Common/.libs/libalberta_2d_la-macro.o
../Common/macro.c:1077:19: warning: incompatible function pointer types passing 'int (char *, char *, int)' to parameter of type 'int (*)(void *, void *, int)' [-Wincompatible-function-pointer-types]
read_xdr_file, write_xdr_file);
^~~~~~~~~~~~~
/usr/include/rpc/xdr.h:362:14: note: passing argument to parameter here
int (*)(void *, void *, int),
^
../Common/macro.c:1077:34: warning: incompatible function pointer types passing 'int (char *, char *, int)' to parameter of type 'int (*)(void *, void *, int)' [-Wincompatible-function-pointer-types]
read_xdr_file, write_xdr_file);
^~~~~~~~~~~~~~
/usr/include/rpc/xdr.h:363:14: note: passing argument to parameter here
int (*)(void *, void *, int));
^
2 warnings generated.