autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

how to check callback prototypes?


From: Sam Steingold
Subject: how to check callback prototypes?
Date: Thu, 14 Jul 2005 12:23:21 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

when I pass a function with a wrong signature as a callback, I get just
a warning from gcc, so the compile succeeds and the test is wrong:

AC_CACHE_CHECK([whether DB_ENV->set_errcall() accepts DBE],
ac_cv_dbe_set_errcall_accept_dbe,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <db.h>
void my_callback (const DB_ENV* dbe, const char *errpfx, const char *msg) {}],
[[DB_ENV dbe; dbe.set_errcall(&dbe,&my_callback);]])],
ac_cv_dbe_set_errcall_accept_dbe=yes,ac_cv_dbe_set_errcall_accept_dbe=no)])
if test "$ac_cv_dbe_set_errcall_accept_dbe" = "yes"; then
AC_DEFINE(HAVE_DBE_SET_ERRCALL_ACCEPT_DBE,1,
[Define to 1 if DB_ENV->set_errcall() accepts DBE])
fi

configure:4658: checking whether DB_ENV->set_errcall() accepts DBE
configure:4681: gcc -c -g -O2  conftest.c >&5
conftest.c: In function `main':
conftest.c:32: warning: passing arg 2 of pointer to function from incompatible 
pointer type
configure:4687: $? = 0
configure:4691: test -z
                         || test ! -s conftest.err
configure:4694: $? = 0
configure:4697: test -s conftest.o
configure:4700: $? = 0
configure:4711: result: yes

I want it to be error because I cannot pass
void my_callback (const DB_ENV* dbe, const char *errpfx, const char *msg);
instead of
void my_callback (const char *errpfx, char *msg);

so: how do I turn the warning into a failed compilation?
(the result: above should be "no", not "yes")

thanks!

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.palestinefacts.org/> <http://www.iris.org.il>
<http://www.mideasttruth.com/> <http://ffii.org/> <http://www.memri.org/>
Life is like a diaper -- short and loaded.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]