[pybsddb] berkelydb 18.1.6 compiler error with Clang
H Gohel
hgohel at yahoo.com
Wed Aug 16 03:56:18 CEST 2023
Hello Jesus,
> -----Original Message-----
> From: pybsddb <pybsddb-bounces at jcea.es> On Behalf Of Jesus Cea
>
> I find the discussion confusing and somewhat misleading. I would guess the issue
> is that a pointer to a function is required and we are providing a "function", not a
> pointer to it.
A general search for the warning came up with several results similar to this, and it may help in this case:
https://stackoverflow.com/questions/67036371/how-to-remove-incompatible-function-pointer-types-warning-when-using-the-c-lib
> I don't use CLANG, so I can't test the patch myself, but I wonder if you could try this:
>
> jcea at jcea:/tmp/pybsddb$ hg diff
I applied a similar change to bsddb3 6.2.9 and still received these errors (only relevant compiler output shown):
...
Modules/_bsddb.c:2729:46: error: incompatible function pointer types passing 'int (*)(DB *, const DBT *, const DBT *)' (aka 'int (*)(struct __db *, const struct
__db_dbt *, const struct __db_dbt *)') to parameter of type 'int (*)(DB *, const DBT *, const DBT *, size_t *)' (aka 'int (*)(struct __db *, const struct
__db_dbt *, const struct __db_dbt *, unsigned long long *)') [-Wincompatible-function-pointer-types]
err = self->db->set_bt_compare(self->db, &_db_compareCallback);
^~~~~~~~~~~~~~~~~~~~
...
Modules/_bsddb.c:2851:47: error: incompatible function pointer types passing 'int (*)(DB *, const DBT *, const DBT *)' (aka 'int (*)(struct __db *, const struct
__db_dbt *, const struct __db_dbt *)') to parameter of type 'int (*)(DB *, const DBT *, const DBT *, size_t *)' (aka 'int (*)(struct __db *, const struct
__db_dbt *, const struct __db_dbt *, unsigned long long *)') [-Wincompatible-function-pointer-types]
err = self->db->set_dup_compare(self->db, &_db_dupCompareCallback);
^~~~~~~~~~~~~~~~~~~~~~~
You suggested I build and run the small sample to test clang behavior which I did and it ran perfectly with clang, no errors and it produced the expected output:
$ clang --version
clang version 16.0.5
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/clang64/bin
$ ./test.exe
a) 10 * 2 = 20
b) 7 * 2 = 14
Hope this helps. I think the resolution may be in the thread on StackOverflow?
Regards,
Himanshu
More information about the pybsddb
mailing list