[asterisk-commits] dlee: branch dlee/ASTERISK-22296 r397852 - in /team/dlee/ASTERISK-22296: ./ i...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 28 09:08:03 CDT 2013
Author: dlee
Date: Wed Aug 28 09:07:40 2013
New Revision: 397852
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397852
Log:
Address review feedback.
* Add configure check for compiler attributes
* Used /* SAFE */ convention for strcpy
* Fixed typo in comment
Modified:
team/dlee/ASTERISK-22296/configure
team/dlee/ASTERISK-22296/configure.ac
team/dlee/ASTERISK-22296/include/asterisk/autoconfig.h.in
team/dlee/ASTERISK-22296/include/asterisk/compiler.h
team/dlee/ASTERISK-22296/include/asterisk/optional_api.h
team/dlee/ASTERISK-22296/main/optional_api.c
Modified: team/dlee/ASTERISK-22296/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/configure.ac?view=diff&rev=397852&r1=397851&r2=397852
==============================================================================
--- team/dlee/ASTERISK-22296/configure.ac (original)
+++ team/dlee/ASTERISK-22296/configure.ac Wed Aug 28 09:07:40 2013
@@ -957,6 +957,9 @@
AST_GCC_ATTRIBUTE(deprecated)
AST_GCC_ATTRIBUTE(sentinel)
AST_GCC_ATTRIBUTE(warn_unused_result)
+AST_GCC_ATTRIBUTE(may_alias)
+AST_GCC_ATTRIBUTE(constructor)
+AST_GCC_ATTRIBUTE(destructor)
# Support weak symbols on a platform specific basis. The Mac OS X
# (Darwin) support must be isolated from the other platforms because
Modified: team/dlee/ASTERISK-22296/include/asterisk/autoconfig.h.in
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/include/asterisk/autoconfig.h.in?view=diff&rev=397852&r1=397851&r2=397852
==============================================================================
--- team/dlee/ASTERISK-22296/include/asterisk/autoconfig.h.in (original)
+++ team/dlee/ASTERISK-22296/include/asterisk/autoconfig.h.in Wed Aug 28 09:07:40 2013
@@ -82,11 +82,20 @@
/* Define to 1 if your GCC C compiler supports the 'const' attribute. */
#undef HAVE_ATTRIBUTE_const
+/* Define to 1 if your GCC C compiler supports the 'constructor' attribute. */
+#undef HAVE_ATTRIBUTE_constructor
+
/* Define to 1 if your GCC C compiler supports the 'deprecated' attribute. */
#undef HAVE_ATTRIBUTE_deprecated
+/* Define to 1 if your GCC C compiler supports the 'destructor' attribute. */
+#undef HAVE_ATTRIBUTE_destructor
+
/* Define to 1 if your GCC C compiler supports the 'malloc' attribute. */
#undef HAVE_ATTRIBUTE_malloc
+
+/* Define to 1 if your GCC C compiler supports the 'may_alias' attribute. */
+#undef HAVE_ATTRIBUTE_may_alias
/* Define to 1 if your GCC C compiler supports the 'pure' attribute. */
#undef HAVE_ATTRIBUTE_pure
Modified: team/dlee/ASTERISK-22296/include/asterisk/compiler.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/include/asterisk/compiler.h?view=diff&rev=397852&r1=397851&r2=397852
==============================================================================
--- team/dlee/ASTERISK-22296/include/asterisk/compiler.h (original)
+++ team/dlee/ASTERISK-22296/include/asterisk/compiler.h Wed Aug 28 09:07:40 2013
@@ -71,6 +71,12 @@
#define attribute_warn_unused_result
#endif
+#ifdef HAVE_ATTRIBUTE_may_alias
+#define attribute_may_alias __attribute__((may_alias))
+#else
+#define attribute_may_alias
+#endif
+
/* Some older version of GNU gcc (3.3.5 on OpenBSD 4.3 for example) dont like 'NULL' as sentinel */
#define SENTINEL ((char *)NULL)
Modified: team/dlee/ASTERISK-22296/include/asterisk/optional_api.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/include/asterisk/optional_api.h?view=diff&rev=397852&r1=397851&r2=397852
==============================================================================
--- team/dlee/ASTERISK-22296/include/asterisk/optional_api.h (original)
+++ team/dlee/ASTERISK-22296/include/asterisk/optional_api.h Wed Aug 28 09:07:40 2013
@@ -107,6 +107,10 @@
#if defined(OPTIONAL_API)
+#if !defined(HAVE_ATTRIBUTE_constructor) || !defined(HAVE_ATTRIBUTE_constructor)
+#error OPTIONAL_API requires compiler constructor/destructor support
+#endif
+
/*!
* \internal
* \brief Function pointer to an optional API function.
@@ -115,7 +119,7 @@
* they are cast to this type as needed. We don't use a \c void pointer, because
* technically data and function pointers are incompatible.
*/
-typedef void (*ast_optional_fn)(void) __attribute__((__may_alias__));
+typedef void (*ast_optional_fn)(void) attribute_may_alias;
/*!
* \internal
@@ -172,7 +176,7 @@
* \brief Call at exit to clean up optional_api internals.
*
* Since the optional_api code might run before main() starts, it can't safely
- * register its own cleanup handlers. That has to be done withing main().
+ * register its own cleanup handlers. That has to be done within main().
*/
void optional_api_cleanup(void);
Modified: team/dlee/ASTERISK-22296/main/optional_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22296/main/optional_api.c?view=diff&rev=397852&r1=397851&r2=397852
==============================================================================
--- team/dlee/ASTERISK-22296/main/optional_api.c (original)
+++ team/dlee/ASTERISK-22296/main/optional_api.c Wed Aug 28 09:07:40 2013
@@ -102,8 +102,7 @@
user->optional_ref = optional_ref;
user->stub = stub;
- /* safe strcpy */
- strcpy(user->module, module);
+ strcpy(user->module, module); /* SAFE */
return user;
}
@@ -144,8 +143,7 @@
return NULL;
}
- /* safe strcpy */
- strcpy(api->symname, symname);
+ strcpy(api->symname, symname); /* SAFE */
return api;
}
More information about the asterisk-commits
mailing list