[asterisk-commits] seanbright: branch group/asterisk-cpp r168506 - /team/group/asterisk-cpp/incl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 12 14:06:44 CST 2009


Author: seanbright
Date: Mon Jan 12 14:06:44 2009
New Revision: 168506

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168506
Log:
Tentative declarations are not supported in C++ so use one of the more
embarassing pieces of code I have ever written to fool it into working.

Modified:
    team/group/asterisk-cpp/include/asterisk/module.h

Modified: team/group/asterisk-cpp/include/asterisk/module.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/module.h?view=diff&rev=168506&r1=168505&r2=168506
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/module.h (original)
+++ team/group/asterisk-cpp/include/asterisk/module.h Mon Jan 12 14:06:44 2009
@@ -236,6 +236,13 @@
 void ast_module_unref(struct ast_module *);
 
 #if defined(__cplusplus) || defined(c_plusplus)
+struct __ast_module_info_initializer {
+   __ast_module_info_initializer();
+};
+
+static const __attribute((unused)) struct ast_module_info *ast_module_info;
+static const __attribute((unused)) __ast_module_info_initializer __ast_module_info_initializer__;
+
 #define AST_MODULE_INFO(keystr, flags_to_set, desc, load_func, unload_func, reload_func)	\
 	static struct ast_module_info __mod_info = {	\
 		NULL,					\
@@ -258,7 +265,10 @@
 	{ \
 		ast_module_unregister(&__mod_info); \
 	} \
-	static const __attribute__((unused)) struct ast_module_info *ast_module_info = &__mod_info
+	__ast_module_info_initializer::__ast_module_info_initializer() { \
+		ast_module_info = &__mod_info;								 \
+	}																 \
+	static const __attribute__((unused)) int __ast_module_info_initializer_dummy__ = 0
 
 #define AST_MODULE_INFO_STANDARD(keystr, desc)		\
 	AST_MODULE_INFO(keystr, AST_MODFLAG_DEFAULT, desc,	\




More information about the asterisk-commits mailing list