From 45d25371165e85b602c65a73e1545ef04b6123e9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 14 Mar 2022 13:51:29 +0100 Subject: [PATCH] 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 --- src/libnm-glib-aux/nm-macros-internal.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libnm-glib-aux/nm-macros-internal.h b/src/libnm-glib-aux/nm-macros-internal.h index 3ccf9dea22..140104d350 100644 --- a/src/libnm-glib-aux/nm-macros-internal.h +++ b/src/libnm-glib-aux/nm-macros-internal.h @@ -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