error: passing argument 2 of '_tcase_add_test' from incompatible pointer type with check 0.13.0
With check 0.13 libxcb 1.13 fails to build check_all.o
on OpenIndiana (an illumos distribution) with GCC 6.5.0:
newman check_0.13.0 … components x11 libxcb gmake test
(cd /export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86 ; \
/usr/bin/env \
/usr/gnu/bin/make \
check)
make[1]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86'
Making check in src
make[2]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/src'
/usr/gnu/bin/make check-am
make[3]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/src'
make[3]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/src'
make[2]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/src'
Making check in tests
make[2]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
make[3]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
/usr/gnu/bin/make -k check_all
make[4]: Entering directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
CC check_all.o
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:1:0,
from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_all.c:2:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_all.c: In function 'suite_add_test':
/usr/include/check/check.h:252:25: error: passing argument 2 of '_tcase_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
_tcase_add_test((tc),(ttest),(signal), 0, 0, 1)
^
/usr/include/check/check.h:237:31: note: in expansion of macro 'tcase_add_test_raise_signal'
#define tcase_add_test(tc,tf) tcase_add_test_raise_signal(tc,tf,0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_all.c:7:2: note: in expansion of macro 'tcase_add_test'
tcase_add_test(tc, tf);
^~~~~~~~~~~~~~
/usr/include/check/check.h:331:27: note: expected 'const TTest * {aka const struct TTest *}' but argument is of type 'TFun {aka void (*)(int)}'
CK_DLL_EXP void CK_EXPORT _tcase_add_test(TCase * tc, const TTest * ttest,
^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:657: check_all.o] Error 1
CC check_public.o
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c: In function 'public_suite':
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:210:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_unix, "xcb_parse_display unix");
^~~~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:211:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_ip, "xcb_parse_display ip");
^~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:212:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_ipv4, "xcb_parse_display ipv4");
^~~~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:213:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_ipv6, "xcb_parse_display ipv6");
^~~~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:214:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_decnet, "xcb_parse_display decnet");
^~~~~~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:215:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, parse_display_negative, "xcb_parse_display negative");
^~~~~~~~~~~~~~~~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:216:20: error: passing argument 2 of 'suite_add_test' from incompatible pointer type [-Werror=incompatible-pointer-types]
suite_add_test(s, popcount, "xcb_popcount");
^~~~~~~~
In file included from /export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_public.c:4:0:
/export/home/newman/ws/oi-userland/components/x11/libxcb/libxcb-1.13/tests/check_suites.h:3:6: note: expected 'TFun {aka void (*)(int)}' but argument is of type 'const TTest * {aka const struct TTest *}'
void suite_add_test(Suite *s, TFun tf, const char *name);
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:657: check_public.o] Error 1
make[4]: Target 'check_all' not remade because of errors.
make[4]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
make[3]: *** [Makefile:1002: check-am] Error 2
make[3]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
make[2]: *** [Makefile:690: check-recursive] Error 1
make[2]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/tests'
make[1]: *** [Makefile:790: check-recursive] Error 1
make[1]: Leaving directory '/export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86'
gmake: *** [/export/home/newman/ws/oi-userland/make-rules/configure.mk:227: /export/home/newman/ws/oi-userland/components/x11/libxcb/build/i86/.tested] Error 2
It builds and run the tests fine when changing the second parameter of the suite_add_test
function:
--- libxcb-1.13/tests/check_suites.h.old 2020-01-02 08:55:15.071930690 +0000
+++ libxcb-1.13/tests/check_suites.h 2020-01-02 08:55:30.236646501 +0000
@@ -1,4 +1,4 @@
#include <check.h>
-void suite_add_test(Suite *s, TFun tf, const char *name);
+void suite_add_test(Suite *s, const TTest * tf, const char *name);
Suite *public_suite(void);
--- libxcb-1.13/tests/check_all.c.old 2020-01-02 08:55:21.174696665 +0000
+++ libxcb-1.13/tests/check_all.c 2020-01-02 08:55:27.373554315 +0000
@@ -1,7 +1,7 @@
#include <stdlib.h>
#include "check_suites.h"
-void suite_add_test(Suite *s, TFun tf, const char *name)
+void suite_add_test(Suite *s, const TTest * tf, const char *name)
{
TCase *tc = tcase_create(name);
tcase_add_test(tc, tf);