[Top][All Lists]

[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],
void my_callback (const DB_ENV* dbe, const char *errpfx, const char *msg) {}],
[[DB_ENV dbe; dbe.set_errcall(&dbe,&my_callback);]])],
if test "$ac_cv_dbe_set_errcall_accept_dbe" = "yes"; then
[Define to 1 if DB_ENV->set_errcall() accepts DBE])

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")


Sam Steingold ( running w2k
<> <>
<> <> <>
Life is like a diaper -- short and loaded.

reply via email to

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