[asterisk-commits] tilghman: trunk r123988 - in /trunk: ./ include/asterisk/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 19 12:55:35 CDT 2008
Author: tilghman
Date: Thu Jun 19 12:55:34 2008
New Revision: 123988
URL: http://svn.digium.com/view/asterisk?view=rev&rev=123988
Log:
Detect if the installed gcc version supports the warn_unused_result attribute.
Reported by mvanbaak via IRC -dev.
Modified:
trunk/configure
trunk/configure.ac
trunk/include/asterisk/autoconfig.h.in
trunk/include/asterisk/compiler.h
trunk/include/asterisk/logger.h
trunk/include/asterisk/sched.h
Modified: trunk/configure.ac
URL: http://svn.digium.com/view/asterisk/trunk/configure.ac?view=diff&rev=123988&r1=123987&r2=123988
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Jun 19 12:55:34 2008
@@ -441,6 +441,7 @@
AST_GCC_ATTRIBUTE(always_inline)
AST_GCC_ATTRIBUTE(deprecated)
AST_GCC_ATTRIBUTE(sentinel)
+AST_GCC_ATTRIBUTE(warn_unused_result)
AC_MSG_CHECKING(for -ffunction-sections support)
saved_CFLAGS="${CFLAGS}"
Modified: trunk/include/asterisk/autoconfig.h.in
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/autoconfig.h.in?view=diff&rev=123988&r1=123987&r2=123988
==============================================================================
--- trunk/include/asterisk/autoconfig.h.in (original)
+++ trunk/include/asterisk/autoconfig.h.in Thu Jun 19 12:55:34 2008
@@ -112,6 +112,10 @@
/* Define to 1 if your GCC C compiler supports the 'unused' attribute. */
#undef HAVE_ATTRIBUTE_unused
+
+/* Define to 1 if your GCC C compiler supports the 'warn_unused_result'
+ attribute. */
+#undef HAVE_ATTRIBUTE_warn_unused_result
/* Define this to indicate the ${BKTR_DESCRIP} library */
#undef HAVE_BKTR
Modified: trunk/include/asterisk/compiler.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/compiler.h?view=diff&rev=123988&r1=123987&r2=123988
==============================================================================
--- trunk/include/asterisk/compiler.h (original)
+++ trunk/include/asterisk/compiler.h Thu Jun 19 12:55:34 2008
@@ -59,4 +59,10 @@
#define attribute_sentinel
#endif
+#ifdef HAVE_ATTRIBUTE_warn_unused_result
+#define attribute_warn_unused_result __attribute__((warn_unused_result))
+#else
+#define attribute_warn_unused_result
+#endif
+
#endif /* _ASTERISK_COMPILER_H */
Modified: trunk/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/logger.h?view=diff&rev=123988&r1=123987&r2=123988
==============================================================================
--- trunk/include/asterisk/logger.h (original)
+++ trunk/include/asterisk/logger.h Thu Jun 19 12:55:34 2008
@@ -83,8 +83,8 @@
void ast_child_verbose(int level, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
-int ast_register_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
-int ast_unregister_verbose(void (*verboser)(const char *string)) __attribute__((warn_unused_result));
+int ast_register_verbose(void (*verboser)(const char *string)) attribute_warn_unused_result;
+int ast_unregister_verbose(void (*verboser)(const char *string)) attribute_warn_unused_result;
void ast_console_puts(const char *string);
Modified: trunk/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/sched.h?view=diff&rev=123988&r1=123987&r2=123988
==============================================================================
--- trunk/include/asterisk/sched.h (original)
+++ trunk/include/asterisk/sched.h Thu Jun 19 12:55:34 2008
@@ -149,7 +149,7 @@
* \param data data to pass to the callback
* \return Returns a schedule item ID on success, -1 on failure
*/
-int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data) __attribute__((warn_unused_result));
+int ast_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result;
/*!
* \brief replace a scheduler entry
@@ -162,7 +162,7 @@
* \retval -1 failure
* \retval otherwise, returns scheduled item ID
*/
-int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data) __attribute__((warn_unused_result));
+int ast_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data) attribute_warn_unused_result;
/*!Adds a scheduled event with rescheduling support
* \param con Scheduler context to add
@@ -177,7 +177,7 @@
* If callback returns 0, no further events will be re-scheduled
* \return Returns a schedule item ID on success, -1 on failure
*/
-int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) __attribute__((warn_unused_result));
+int ast_sched_add_variable(struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) attribute_warn_unused_result;
/*!
* \brief replace a scheduler entry
@@ -190,7 +190,7 @@
* \retval -1 failure
* \retval otherwise, returns scheduled item ID
*/
-int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) __attribute__((warn_unused_result));
+int ast_sched_replace_variable(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) attribute_warn_unused_result;
/*! \brief Find a sched structure and return the data field associated with it.
@@ -210,7 +210,7 @@
* \param id ID of the scheduled item to delete
* \return Returns 0 on success, -1 on failure
*/
-int ast_sched_del(struct sched_context *con, int id) __attribute__((warn_unused_result));
+int ast_sched_del(struct sched_context *con, int id) attribute_warn_unused_result;
/*! \brief Determines number of seconds until the next outstanding event to take place
* Determine the number of seconds until the next outstanding event
@@ -221,7 +221,7 @@
* \return Returns "-1" if there is nothing there are no scheduled events
* (and thus the poll should not timeout)
*/
-int ast_sched_wait(struct sched_context *con) __attribute__((warn_unused_result));
+int ast_sched_wait(struct sched_context *con) attribute_warn_unused_result;
/*! \brief Runs the queue
* \param con Scheduling context to run
More information about the asterisk-commits
mailing list