mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-22 18:30:37 +01:00
glib-aux: add NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER macro for workaround
New gcc-12.0.1-0.8.fc36 on Fedora rawhide likes to emit false "-Wdangling-pointer" warnings with some g_error() uses. It seems related to g_error()'s `for(;;) ;`. As workaround, add a macro to suppress the warning. But only do that for gcc-12. This bug hopefully gets fixed and we don't want to suppress useful warnings too eagerly. https://bugzilla.redhat.com/show_bug.cgi?id=2056613
This commit is contained in:
parent
cc28aac0de
commit
445dcd9d9b
1 changed files with 12 additions and 0 deletions
|
|
@ -202,6 +202,18 @@ _nm_auto_freev(gpointer ptr)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Seems gcc-12 has a tendency for false-positive -Wdangling-pointer warnings with
|
||||
* g_error()'s `for(;;);`.
|
||||
*
|
||||
* Work around that, but it's only for gcc 12 (for now). */
|
||||
#if defined(__GNUC__) && __GNUC__ == 12
|
||||
#define NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER NM_PRAGMA_WARNING_DISABLE("-Wdangling-pointer")
|
||||
#else
|
||||
#define NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER NM_PRAGMA_DIAGNOSTICS_PUSH
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* NM_G_ERROR_MSG:
|
||||
* @error: (allow-none): the #GError instance
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue