[asterisk-commits] mjordan: trunk r359306 - /trunk/include/asterisk/astobj2.h

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 14 09:40:50 CDT 2012


Author: mjordan
Date: Wed Mar 14 09:40:44 2012
New Revision: 359306

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=359306
Log:
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.

Modified:
    trunk/include/asterisk/astobj2.h

Modified: trunk/include/asterisk/astobj2.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/astobj2.h?view=diff&rev=359306&r1=359305&r2=359306
==============================================================================
--- trunk/include/asterisk/astobj2.h (original)
+++ trunk/include/asterisk/astobj2.h Wed Mar 14 09:40:44 2012
@@ -1297,8 +1297,11 @@
  * 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__)




More information about the asterisk-commits mailing list