Skip to content
Snippets Groups Projects
Commit 6df0ae5c authored by Matthew Jordan's avatar Matthew Jordan
Browse files

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
parent 00b27083
No related branches found
No related tags found
No related merge requests found
......@@ -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__)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment