]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
pybind: fix callback function type compatibility for GCC 14/15 64176/head
authorKefu Chai <tchaikov@gmail.com>
Wed, 25 Jun 2025 11:58:42 +0000 (19:58 +0800)
committerKefu Chai <tchaikov@gmail.com>
Wed, 25 Jun 2025 13:02:09 +0000 (21:02 +0800)
commita2e52d3e1b93235a8c3a2aaeb400fcd800f12920
tree638bce91fa4cc2c3eb6c843d40a5b767a5d692e1
parent668dc293ec2f9b1181ba9046feb76584905a61b1
pybind: fix callback function type compatibility for GCC 14/15

The callback function types in Cython source files were inconsistent
with the corresponding librados and librgw API declarations, causing
build failures with GCC 14 and 15.

GCC 14 introduced stricter pointer type checking and no longer allows
implicit casting between incompatible pointer types. This resulted in
-Wincompatible-pointer-types errors where char** arguments were passed
to functions expecting const char* const*.

Example error:

```
      rados.c: In function ‘__pyx_pf_5rados_12OmapIterator_4__next__’:
      rados.c:32423:76: error: passing argument 2 of ‘__pyx_f_5rados_rados_omap_get_next’ from incompatible pointer type [-Wincompatible-pointer-types]
      32423 |         __pyx_t_1 = __pyx_f_5rados_rados_omap_get_next(__pyx_v_self->ctx, (&__pyx_v_key_), (&__pyx_v_val_), (&__pyx_v_len_)); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 1394, __pyx_L4_error)
            |                                                                           ~^~~~~~~~~~~~~~
            |                                                                            |
            |                                                                            char **
      rados.c:9172:141: note: expected ‘const char * const*’ but argument is of type ‘char **’
       9172 | static int __pyx_f_5rados_rados_omap_get_next(CYTHON_UNUSED __pyx_t_5rados_rados_omap_iter_t __pyx_v_iter, CYTHON_UNUSED char const *const *__pyx_v_key, CYTHON_UNUSED char const *const *__pyx_v_val, CYTHON_UNUSED size_t *__pyx_v_len) {
            |                                                                                                                                             ^
      rados.c:32423:93: error: passing argument 3 of ‘__pyx_f_5rados_rados_omap_get_next’ from incompatible pointer type [-Wincompatible-pointer-types]
      32423 |         __pyx_t_1 = __pyx_f_5rados_rados_omap_get_next(__pyx_v_self->ctx, (&__pyx_v_key_), (&__pyx_v_val_), (&__pyx_v_len_)); if (unlikely(__pyx_t_1 == ((int)-1) && __Pyx_ErrOccurredWithGIL())) __PYX_ERR(0, 1394, __pyx_L4_error)
            |                                                                                            ~^~~~~~~~~~~~~~
            |                                                                                             |
            |                                                                                             char **
      rados.c:9172:187: note: expected ‘const char * const*’ but argument is of type ‘char **’
       9172 | static int __pyx_f_5rados_rados_omap_get_next(CYTHON_UNUSED __pyx_t_5rados_rados_omap_iter_t __pyx_v_iter, CYTHON_UNUSED char const *const *__pyx_v_key, CYTHON_UNUSED char const *const *__pyx_v_val, CYTHON_UNUSED size_t *__pyx_v_len) {
            |                                                                                                                                                                                           ^
      error: command '/usr/bin/gcc' failed with exit code 1`
```

This change corrects the mock function implementations used during Sphinx
documentation builds to match the actual API signatures. The public API
remains unchanged to avoid requiring a major version bump.

See also
https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/pybind/rados/mock_rados.pxi
src/pybind/rgw/c_rgw.pxd
src/pybind/rgw/mock_rgw.pxi
src/pybind/rgw/rgw.pyx