From 6df0ae5c1fb6b780874f859e9c1be89c5ee881ac Mon Sep 17 00:00:00 2001 From: Matthew Jordan <mjordan@digium.com> Date: Wed, 14 Mar 2012 14:40:44 +0000 Subject: [PATCH] Force non-inlining of ao2_iterator_destroy when TEST_FRAMEWORK is enabled In r357272, astobj2 was changed to automatically enable REF_DEBUG when the TEST_FRAMEWORK flag was enabled. Unfortunately, some compilers (gcc 4.5.1 at least) will attempt to inline ao2_iterator_destroy in handle_astobj2_test. This by itself is not a problem; unfortunately, the compiler believes that there is a code path wherein an object allocated on the stack will be free'd. As warnings are treated as errors, this prevents compilation of astobj2. This patch works around that by adding the noinline attribue to ao2_iterator_destroy, but only if the TEST_FRAMEWORK flag is enabled. Preventing inlining is only needed for the test method defined in astobj2, which is also only enabled if TEST_FRAMEWORK is enabled. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@359306 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/astobj2.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h index 738b773cb3..b6bea649e6 100644 --- a/include/asterisk/astobj2.h +++ b/include/asterisk/astobj2.h @@ -1297,8 +1297,11 @@ struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags); * and any other resources it may be holding. * */ +#if defined(TEST_FRAMEWORK) +void ao2_iterator_destroy(struct ao2_iterator *i) __attribute__((noinline)); +#else void ao2_iterator_destroy(struct ao2_iterator *i); - +#endif #ifdef REF_DEBUG #define ao2_t_iterator_next(iter, tag) __ao2_iterator_next_debug((iter), (tag), __FILE__, __LINE__, __PRETTY_FUNCTION__) -- GitLab