summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-03-14 14:40:44 +0000
committerMatthew Jordan <mjordan@digium.com>2012-03-14 14:40:44 +0000
commit6df0ae5c1fb6b780874f859e9c1be89c5ee881ac (patch)
treed04fc4cc05cdbd6dcd889d95ebc198a2b72cf84f /include
parent00b270833f3d5a58ab2acbcce1c5a16b0330aaeb (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/astobj2.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h
index 738b773cb..b6bea649e 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__)