[Bf-blender-cvs] [c9ae9e14839] master: Cleanup: suppress dangling-pointer warning for GCC 12.1+
Campbell Barton
noreply at git.blender.org
Wed May 18 10:08:49 CEST 2022
Commit: c9ae9e148397f234d6d1dc1119800ddf3fc2e351
Author: Campbell Barton
Date: Wed May 18 18:06:56 2022 +1000
Branches: master
https://developer.blender.org/rBc9ae9e148397f234d6d1dc1119800ddf3fc2e351
Cleanup: suppress dangling-pointer warning for GCC 12.1+
===================================================================
M source/blender/blenlib/intern/listbase.c
===================================================================
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c
index e2044955e48..3932e5eb051 100644
--- a/source/blender/blenlib/intern/listbase.c
+++ b/source/blender/blenlib/intern/listbase.c
@@ -193,9 +193,19 @@ void BLI_listbases_swaplinks(ListBase *listbasea, ListBase *listbaseb, void *vli
return;
}
+ /* The reference to `linkc` assigns NULL, not a dangling pointer so it can be ignored. */
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 1201 /* gcc12.1+ only */
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
+
/* Temporary link to use as placeholder of the links positions */
BLI_insertlinkafter(listbasea, linka, &linkc);
+#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 1201 /* gcc12.1+ only */
+# pragma GCC diagnostic pop
+#endif
+
/* Bring linka into linkb position */
BLI_remlink(listbasea, linka);
BLI_insertlinkafter(listbaseb, linkb, linka);
More information about the Bf-blender-cvs
mailing list