mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-29 18:30:11 +01:00
glib-aux: fix compile error for g_steal_pointer() macro
Some compiler versions don't like to dereference and opaque
pointer for typeof:
gcc 8.3.1-5.1.el8 on RHEL:
In file included from ./src/libnm-glib-aux/nm-macros-internal.h:41,
from ./src/libnm-glib-aux/nm-default-glib.h:68,
from ./src/libnm-glib-aux/nm-default-glib-i18n-lib.h:13,
from ./src/libnm-core-impl/nm-default-libnm-core.h:11,
from src/libnm-core-impl/nm-setting-8021x.c:7:
src/libnm-core-impl/nm-setting-8021x.c: In function '_nm_setting_802_1x_cert_value_to_bytes':
./src/libnm-glib-aux/nm-glib.h:417:16: error: dereferencing pointer to incomplete type 'GBytes' {aka 'struct _GBytes'}
typeof(**_pp) *const _p = *_pp; \
^~~~~
src/libnm-core-impl/nm-setting-8021x.c:361:12: note: in expansion of macro 'g_steal_pointer'
return g_steal_pointer(&bytes);
^~~~~~~~~~~~~~~
./src/libnm-glib-aux/nm-glib.h:417:54: error: initialization of 'int * const' from incompatible pointer type 'GBytes *' {aka 'struct _GBytes *'} [-Werror=incompatible-pointer-types]
typeof(**_pp) *const _p = *_pp; \
^
src/libnm-core-impl/nm-setting-8021x.c:361:12: note: in expansion of macro 'g_steal_pointer'
return g_steal_pointer(&bytes);
^~~~~~~~~~~~~~~
./src/libnm-glib-aux/nm-glib.h:415:6: error: returning 'int * const' from a function with incompatible return type 'GBytes *' {aka 'struct _GBytes *'} [-Werror=incompatible-pointer-types]
({ \
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typeof(*(pp)) *const _pp = (pp); \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
typeof(**_pp) *const _p = *_pp; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_nm_unused const void *const _p_type_check = _p; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\
~
*_pp = NULL; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_p; \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
})
~~
src/libnm-core-impl/nm-setting-8021x.c:361:12: note: in expansion of macro 'g_steal_pointer'
return g_steal_pointer(&bytes);
^~~~~~~~~~~~~~~
Fixes: 5bc511203e ('all: make nm_steal_pointer() and g_steal_pointer() more typesafe using typeof()')
This commit is contained in:
parent
4784c7dccd
commit
5de552893d
2 changed files with 4 additions and 4 deletions
|
|
@ -413,8 +413,8 @@ _nm_g_hash_table_get_keys_as_array(GHashTable *hash_table, guint *length)
|
|||
|
||||
#define g_steal_pointer(pp) \
|
||||
({ \
|
||||
typeof(*(pp)) *const _pp = (pp); \
|
||||
typeof(**_pp) *const _p = *_pp; \
|
||||
typeof(*(pp)) *const _pp = (pp); \
|
||||
typeof(*_pp) _p = *_pp; \
|
||||
_nm_unused const void *const _p_type_check = _p; \
|
||||
\
|
||||
*_pp = NULL; \
|
||||
|
|
|
|||
|
|
@ -755,8 +755,8 @@ _nm_auto_fclose(FILE **pfd)
|
|||
|
||||
#define nm_steal_pointer(pp) \
|
||||
({ \
|
||||
typeof(*(pp)) *const _pp = (pp); \
|
||||
typeof(**_pp) *const _p = *_pp; \
|
||||
typeof(*(pp)) *const _pp = (pp); \
|
||||
typeof(*_pp) _p = *_pp; \
|
||||
_nm_unused const void *const _p_type_check = _p; \
|
||||
\
|
||||
*_pp = NULL; \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue