]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add PRINTF_FUNCTION specifier to printf like functions to let gcc tell us when we...
authorMichael Jerris <mike@jerris.com>
Tue, 13 Feb 2007 03:17:19 +0000 (03:17 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 13 Feb 2007 03:17:19 +0000 (03:17 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4224 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_console.h
src/include/switch_event.h
src/include/switch_log.h
src/include/switch_platform.h

index 52745b9f6bf6c2a1619a8cede31f27d5bf93e28a..f49a5677f7869625cf8318875c92d5504112ce04 100644 (file)
@@ -62,12 +62,12 @@ SWITCH_DECLARE(void) switch_console_loop(void);
 /*!
   \brief A method akin to printf that allows you to redirect output to a specific console "channel"
 */
-SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, ...);
+SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, char *file, const char *func, int line, char *fmt, ...) PRINTF_FUNCTION(5,6);
 
 /*!
   \brief A method akin to printf for dealing with api streams
 */
-SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, char *fmt, ...);
+SWITCH_DECLARE(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, char *fmt, ...) PRINTF_FUNCTION(2,3);
 SWITCH_END_EXTERN_C
 
 #endif
index 74ce9e30e0c3c04e396b47e5b9c58452634f3472..0c7f8f38b4c464b7d9af3751b220c41f3b21ad29 100644 (file)
@@ -172,7 +172,7 @@ SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
   \param fmt the value of the header (varargs see standard sprintf family)
   \return SWITCH_STATUS_SUCCESS if the header was added
 */
-SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack, char *header_name, char *fmt, ...);
+SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack, char *header_name, char *fmt, ...) PRINTF_FUNCTION(4,5);
 
 /*!
   \brief Destroy an event
@@ -251,7 +251,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, ch
   \return the xml object if the operation was successful
   \note the body supplied by this function will supersede an existing body the event may have
 */
-SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, char *fmt, ...);
+SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, char *fmt, ...) PRINTF_FUNCTION(2,3);
 
 /*!
   \brief Determine if the event system has been initilized
@@ -266,7 +266,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_running(void);
   \return SWITCH_STATUS_SUCCESS if the body was added to the event
   \note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
 */
-SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, char *fmt, ...);
+SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, char *fmt, ...) PRINTF_FUNCTION(2,3);
 
 
 /*!
index 51c42872ba641cdebf7bedc35a2c073cda78eb29..964f00f55793f18849ac893e5f229192876d6e0a 100644 (file)
@@ -94,7 +94,7 @@ SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void);
   \param ... variable args
   \note there are channel macros to supply the first 4 parameters
 */
-SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line, switch_log_level_t level, char *fmt, ...);
+SWITCH_DECLARE(void) switch_log_printf(switch_text_channel_t channel, const char *file, const char *func, int line, switch_log_level_t level, char *fmt, ...) PRINTF_FUNCTION(6,7);
 
 /*! 
   \brief Shut down  the logging engine
index ada22a3d59b8acc337cf700f80aa5f820693547a..fbe656dbfd95b50ea1158f43a03a307e0c0f3cdb 100644 (file)
@@ -161,6 +161,12 @@ typedef unsigned long      in_addr_t;
 #define DoxyDefine(x)
 #endif
 
+#if __GNUC__ >= 3
+#define PRINTF_FUNCTION(fmtstr,vars) __attribute__((format(printf,fmtstr,vars)))
+#else
+#define PRINTF_FUNCTION(fmtstr,vars)
+#endif
+
 SWITCH_END_EXTERN_C
 
 #endif