glib-aux: restrict NM_PRAGMA_WARNING_DISABLE_DANGLING_POINTER workaround to gcc 12.0.1

This was a bug in gcc 12 (<= 12.0.1). Restrict the macro further
for when we disable the warning.

See-also: https://bugzilla.redhat.com/show_bug.cgi?id=2056613
This commit is contained in:
Thomas Haller 2022-03-14 13:51:29 +01:00
parent 1d6080827b
commit 45d2537116
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -203,10 +203,9 @@ _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
* g_error()'s `for(;;);`. See https://bugzilla.redhat.com/show_bug.cgi?id=2056613 .
* Work around, but only for the affected gcc 12.0.1. */
#if defined(__GNUC__) && __GNUC__ == 12 && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ <= 1
#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