From 80ef0dee023715f810b076ec50aff7970be705f8 Mon Sep 17 00:00:00 2001 From: Gedare Bloom Date: Mon, 28 Oct 2024 23:11:06 -0600 Subject: [PATCH] score: ignore -Wdanglingpointer= in _User_extensions_Iterate --- cpukit/score/src/userextiterate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cpukit/score/src/userextiterate.c b/cpukit/score/src/userextiterate.c index cae76d173c..248b9a3067 100644 --- a/cpukit/score/src/userextiterate.c +++ b/cpukit/score/src/userextiterate.c @@ -202,12 +202,24 @@ void _User_extensions_Iterate( _User_extensions_Acquire( &lock_context ); + /* + * Ignore this warning: + * + * - storing the address of local variable 'iter' ... [-Wdangling-pointer=] + * + * We store the local variable &iter.Iterator here on the + * &User_extensions_List.Iterators, and then remove it from the list below + * at the call to _Chain_Iterator_destroy(). So it is not left dangling. + */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdangling-pointer=" _Chain_Iterator_initialize( &_User_extensions_List.Active, &_User_extensions_List.Iterators, &iter.Iterator, direction ); + #pragma GCC diagnostic pop if ( executing != NULL ) { iter.previous = executing->last_user_extensions_iterator;