aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-29 16:58:29 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-29 16:58:29 +0000
commit81fa0b3582ba4f23dd3f6bfa576fdd7ac531a127 (patch)
tree2abe23f0b4942edf470a41b1a8cef51a073fc887 /include
parente27acaa5de2958e98e05ddb82231231b73882945 (diff)
update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors
since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them format attributes in a consistent way git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@159808 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/channel.h5
-rw-r--r--include/asterisk/cli.h2
-rw-r--r--include/asterisk/devicestate.h2
-rw-r--r--include/asterisk/dundi.h16
-rw-r--r--include/asterisk/linkedlists.h8
-rw-r--r--include/asterisk/lock.h8
-rw-r--r--include/asterisk/logger.h6
-rw-r--r--include/asterisk/manager.h4
-rw-r--r--include/asterisk/module.h8
-rw-r--r--include/asterisk/res_odbc.h2
-rw-r--r--include/asterisk/stringfields.h4
-rw-r--r--include/asterisk/strings.h4
-rw-r--r--include/asterisk/threadstorage.h10
-rw-r--r--include/asterisk/utils.h4
-rw-r--r--include/jitterbuf.h4
15 files changed, 43 insertions, 44 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index ea4dac2bc..a550101ea 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -627,7 +627,7 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state);
by default set to the "default" context and
extension "s"
*/
-struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const int amaflag, const char *name_fmt, ...);
+struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const int amaflag, const char *name_fmt, ...) __attribute__((format(printf, 9, 10)));
/*! \brief Queue an outgoing frame */
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f);
@@ -1152,8 +1152,7 @@ void ast_set_callerid(struct ast_channel *chan, const char *cidnum, const char *
/*! return a mallocd string with the result of sprintf of the fmt and following args */
-char *ast_safe_string_alloc(const char *fmt, ...);
-
+char __attribute__((format(printf, 1, 2))) *ast_safe_string_alloc(const char *fmt, ...);
/*! Start a tone going */
diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h
index 9a7b53a36..13d6fdd84 100644
--- a/include/asterisk/cli.h
+++ b/include/asterisk/cli.h
@@ -32,7 +32,7 @@ extern "C" {
#include "asterisk/linkedlists.h"
void ast_cli(int fd, char *fmt, ...)
- __attribute__ ((format (printf, 2, 3)));
+ __attribute__((format(printf, 2, 3)));
#define RESULT_SUCCESS 0
#define RESULT_SHOWUSAGE 1
diff --git a/include/asterisk/devicestate.h b/include/asterisk/devicestate.h
index ed9022fbd..561bd2cb4 100644
--- a/include/asterisk/devicestate.h
+++ b/include/asterisk/devicestate.h
@@ -83,7 +83,7 @@ int ast_device_state(const char *device);
* Returns 0 on success, -1 on failure
*/
int ast_device_state_changed(const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__((format(printf, 1, 2)));
/*! \brief Tells Asterisk the State for Device is changed
diff --git a/include/asterisk/dundi.h b/include/asterisk/dundi.h
index 9290536d6..09dcea9ee 100644
--- a/include/asterisk/dundi.h
+++ b/include/asterisk/dundi.h
@@ -31,7 +31,7 @@
/*!\brief A DUNDi Entity ID is essentially a MAC address, brief and unique */
struct _dundi_eid {
unsigned char eid[6];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
typedef struct _dundi_eid dundi_eid;
@@ -43,13 +43,13 @@ struct dundi_hdr {
unsigned char cmdresp; /*!< Command / Response */
unsigned char cmdflags; /*!< Command / Response specific flags*/
unsigned char ies[0];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
struct dundi_ie_hdr {
unsigned char ie;
unsigned char len;
unsigned char iedata[0];
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
#define DUNDI_FLAG_RETRANS (1 << 16) /*!< Applies to dtrans */
#define DUNDI_FLAG_RESERVED (1 << 16) /*!< Applies to strans */
@@ -78,7 +78,7 @@ struct dundi_ie_hdr {
struct dundi_encblock { /*!< AES-128 encrypted block */
unsigned char iv[16]; /*!< Initialization vector of random data */
unsigned char encdata[0]; /*!< Encrypted / compressed data */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
struct dundi_answer {
dundi_eid eid; /*!< Original source of answer */
@@ -86,12 +86,12 @@ struct dundi_answer {
unsigned short flags; /*!< Flags relating to answer */
unsigned short weight; /*!< Weight of answers */
unsigned char data[0]; /*!< Protocol specific URI */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
struct dundi_hint {
unsigned short flags; /*!< Flags relating to answer */
unsigned char data[0]; /*!< For data for hint */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
#define DUNDI_CAUSE_SUCCESS 0 /*!< Success */
#define DUNDI_CAUSE_GENERAL 1 /*!< General unspecified failure */
@@ -105,14 +105,14 @@ struct dundi_hint {
struct dundi_cause {
unsigned char causecode; /*!< Numerical cause (DUNDI_CAUSE_*) */
char desc[0]; /*!< Textual description */
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
struct dundi_peer_status {
unsigned int flags;
unsigned short netlag;
unsigned short querylag;
dundi_eid peereid;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
#define DUNDI_PEER_PRIMARY (1 << 0)
#define DUNDI_PEER_SECONDARY (1 << 1)
diff --git a/include/asterisk/linkedlists.h b/include/asterisk/linkedlists.h
index a8d90ecbe..e7511fd8a 100644
--- a/include/asterisk/linkedlists.h
+++ b/include/asterisk/linkedlists.h
@@ -242,11 +242,11 @@ struct name { \
struct type *last; \
ast_mutex_t lock; \
} name; \
-static void __attribute__ ((constructor)) init_##name(void) \
+static void __attribute__((constructor)) init_##name(void) \
{ \
AST_LIST_HEAD_INIT(&name); \
} \
-static void __attribute__ ((destructor)) fini_##name(void) \
+static void __attribute__((destructor)) fini_##name(void) \
{ \
AST_LIST_HEAD_DESTROY(&name); \
} \
@@ -284,11 +284,11 @@ struct name { \
struct type *last; \
ast_rwlock_t lock; \
} name; \
-static void __attribute__ ((constructor)) init_##name(void) \
+static void __attribute__((constructor)) init_##name(void) \
{ \
AST_RWLIST_HEAD_INIT(&name); \
} \
-static void __attribute__ ((destructor)) fini_##name(void) \
+static void __attribute__((destructor)) fini_##name(void) \
{ \
AST_RWLIST_HEAD_DESTROY(&name); \
} \
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 3e684f838..bcf802451 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -799,14 +799,14 @@ static inline int ast_cond_timedwait(ast_cond_t *cond, ast_mutex_t *t, const str
destructors to destroy mutexes and create it on the fly. */
#define __AST_MUTEX_DEFINE(scope, mutex, init_val, track) \
scope ast_mutex_t mutex = init_val; \
-static void __attribute__ ((constructor)) init_##mutex(void) \
+static void __attribute__((constructor)) init_##mutex(void) \
{ \
if (track) \
ast_mutex_init(&mutex); \
else \
ast_mutex_init_notracking(&mutex); \
} \
-static void __attribute__ ((destructor)) fini_##mutex(void) \
+static void __attribute__((destructor)) fini_##mutex(void) \
{ \
ast_mutex_destroy(&mutex); \
}
@@ -1113,11 +1113,11 @@ static inline int ast_rwlock_trywrlock(ast_rwlock_t *prwlock)
#ifndef HAVE_PTHREAD_RWLOCK_INITIALIZER
#define __AST_RWLOCK_DEFINE(scope, rwlock) \
scope ast_rwlock_t rwlock; \
-static void __attribute__ ((constructor)) init_##rwlock(void) \
+static void __attribute__((constructor)) init_##rwlock(void) \
{ \
ast_rwlock_init(&rwlock); \
} \
-static void __attribute__ ((destructor)) fini_##rwlock(void) \
+static void __attribute__((destructor)) fini_##rwlock(void) \
{ \
ast_rwlock_destroy(&rwlock); \
}
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 58bf1804b..af0bb3c01 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -60,7 +60,7 @@ extern "C" {
\param fmt This is what is important. The format is the same as your favorite breed of printf. You know how that works, right? :-)
*/
void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
- __attribute__ ((format (printf, 5, 6)));
+ __attribute__((format(printf, 5, 6)));
void ast_backtrace(void);
@@ -68,7 +68,7 @@ void ast_backtrace(void);
int logger_reload(void);
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
- __attribute__ ((format (printf, 5, 6)));
+ __attribute__((format(printf, 5, 6)));
/*! Send a verbose message (based on verbose level)
\brief This works like ast_log, but prints verbose messages to the console depending on verbosity level set.
@@ -78,7 +78,7 @@ void ast_queue_log(const char *queuename, const char *callid, const char *agent,
VERBOSE_PREFIX_1 through VERBOSE_PREFIX_3 are defined.
*/
void ast_verbose(const char *fmt, ...)
- __attribute__ ((format (printf, 1, 2)));
+ __attribute__((format(printf, 1, 2)));
int ast_register_verbose(void (*verboser)(const char *string));
int ast_unregister_verbose(void (*verboser)(const char *string));
diff --git a/include/asterisk/manager.h b/include/asterisk/manager.h
index cc4e971c9..34ae43235 100644
--- a/include/asterisk/manager.h
+++ b/include/asterisk/manager.h
@@ -126,7 +126,7 @@ int astman_verify_session_writepermissions(uint32_t ident, int perm);
\param event Event name
\param contents Contents of event
*/
-int __attribute__ ((format (printf, 3,4))) manager_event(int category, const char *event, const char *contents, ...);
+int __attribute__((format(printf, 3,4))) manager_event(int category, const char *event, const char *contents, ...);
/*! Get header from mananger transaction */
const char *astman_get_header(const struct message *m, char *var);
@@ -139,7 +139,7 @@ void astman_send_error(struct mansession *s, const struct message *m, char *erro
void astman_send_response(struct mansession *s, const struct message *m, char *resp, char *msg);
void astman_send_ack(struct mansession *s, const struct message *m, char *msg);
-void __attribute__ ((format (printf, 2, 3))) astman_append(struct mansession *s, const char *fmt, ...);
+void __attribute__((format(printf, 2, 3))) astman_append(struct mansession *s, const char *fmt, ...);
/*! Called by Asterisk initialization */
int init_manager(void);
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index 4c1e40b1d..27eae4abe 100644
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -237,11 +237,11 @@ void ast_module_unref(struct ast_module *);
flags_to_set | AST_MODFLAG_BUILDSUM, \
AST_BUILDOPT_SUM, \
}; \
- static void __attribute__ ((constructor)) __reg_module(void) \
+ static void __attribute__((constructor)) __reg_module(void) \
{ \
ast_module_register(&__mod_info); \
} \
- static void __attribute__ ((destructor)) __unreg_module(void) \
+ static void __attribute__((destructor)) __unreg_module(void) \
{ \
ast_module_unregister(&__mod_info); \
} \
@@ -268,11 +268,11 @@ const static __attribute__((unused)) struct ast_module_info *ast_module_info;
.buildopt_sum = AST_BUILDOPT_SUM, \
fields \
}; \
- static void __attribute__ ((constructor)) __reg_module(void) \
+ static void __attribute__((constructor)) __reg_module(void) \
{ \
ast_module_register(&__mod_info); \
} \
- static void __attribute__ ((destructor)) __unreg_module(void) \
+ static void __attribute__((destructor)) __unreg_module(void) \
{ \
ast_module_unregister(&__mod_info); \
} \
diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h
index 4d023c066..4fbe007c4 100644
--- a/include/asterisk/res_odbc.h
+++ b/include/asterisk/res_odbc.h
@@ -61,7 +61,7 @@ struct odbc_obj {
* This function really only ever worked with MySQL, where the statement handle is
* not prepared on the server. If you are not using MySQL, you should avoid it.
*/
-int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__ ((deprecated));
+int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((deprecated));
/*! \brief Retrieves a connected ODBC object
* \param name The name of the ODBC class for which a connection is needed.
diff --git a/include/asterisk/stringfields.h b/include/asterisk/stringfields.h
index d8d257f95..97e65532d 100644
--- a/include/asterisk/stringfields.h
+++ b/include/asterisk/stringfields.h
@@ -165,7 +165,7 @@ ast_string_field __ast_string_field_alloc_space(struct ast_string_field_mgr *mgr
*/
void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
ast_string_field *fields, int num_fields,
- int index, const char *format, ...);
+ int index, const char *format, ...) __attribute__((format(printf, 5, 6)));
/*!
\internal
@@ -181,7 +181,7 @@ void __ast_string_field_index_build(struct ast_string_field_mgr *mgr,
*/
void __ast_string_field_index_build_va(struct ast_string_field_mgr *mgr,
ast_string_field *fields, int num_fields,
- int index, const char *format, va_list a1, va_list a2);
+ int index, const char *format, va_list a1, va_list a2) __attribute__((format(printf, 5, 0)));
/*!
\brief Declare a string field
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index 70517a4d6..a7e2fa4ba 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -190,7 +190,7 @@ void ast_copy_string(char *dst, const char *src, size_t size),
\param fmt printf-style format string
\return 0 on success, non-zero on failure.
*/
-int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
+int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
/*!
\brief Build a string in a buffer, designed to be called repeatedly
@@ -204,7 +204,7 @@ int ast_build_string(char **buffer, size_t *space, const char *fmt, ...) __attri
\param fmt printf-style format string
\param ap varargs list of arguments for format
*/
-int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap);
+int ast_build_string_va(char **buffer, size_t *space, const char *fmt, va_list ap) __attribute__((format(printf, 3, 0)));
/*! Make sure something is true */
/*!
diff --git a/include/asterisk/threadstorage.h b/include/asterisk/threadstorage.h
index 59bd8cd72..2934a320b 100644
--- a/include/asterisk/threadstorage.h
+++ b/include/asterisk/threadstorage.h
@@ -364,7 +364,7 @@ enum {
* writing over it.
*/
int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len,
- struct ast_threadstorage *ts, int append, const char *fmt, va_list ap);
+ struct ast_threadstorage *ts, int append, const char *fmt, va_list ap) __attribute__((format(printf, 5, 0)));
/*!
* \brief Set a thread locally stored dynamic string using variable arguments
@@ -406,7 +406,7 @@ int ast_dynamic_str_thread_build_va(struct ast_dynamic_str **buf, size_t max_len
* \endcode
*/
AST_INLINE_API(
-int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_set(
+int __attribute__((format(printf, 4, 5))) ast_dynamic_str_thread_set(
struct ast_dynamic_str **buf, size_t max_len,
struct ast_threadstorage *ts, const char *fmt, ...),
{
@@ -429,7 +429,7 @@ int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_set(
* the string, this function appends to the current value.
*/
AST_INLINE_API(
-int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_append(
+int __attribute__((format(printf, 4, 5))) ast_dynamic_str_thread_append(
struct ast_dynamic_str **buf, size_t max_len,
struct ast_threadstorage *ts, const char *fmt, ...),
{
@@ -457,7 +457,7 @@ int __attribute__ ((format (printf, 4, 5))) ast_dynamic_str_thread_append(
* family of functions.
*/
AST_INLINE_API(
-int __attribute__ ((format (printf, 3, 4))) ast_dynamic_str_set(
+int __attribute__((format(printf, 3, 4))) ast_dynamic_str_set(
struct ast_dynamic_str **buf, size_t max_len,
const char *fmt, ...),
{
@@ -480,7 +480,7 @@ int __attribute__ ((format (printf, 3, 4))) ast_dynamic_str_set(
* of setting a new value.
*/
AST_INLINE_API(
-int __attribute__ ((format (printf, 3, 4))) ast_dynamic_str_append(
+int __attribute__((format(printf, 3, 4))) ast_dynamic_str_append(
struct ast_dynamic_str **buf, size_t max_len,
const char *fmt, ...),
{
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index 4e4d9d5ee..7b7378530 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -474,7 +474,7 @@ char * attribute_malloc _ast_strndup(const char *str, size_t len, const char *fi
#define ast_asprintf(ret, fmt, ...) \
_ast_asprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, __VA_ARGS__)
-int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...) __attribute__ ((format (printf, 5, 6)));
+int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, ...) __attribute__((format(printf, 5, 6)));
/*!
* \brief A wrapper for vasprintf()
@@ -488,7 +488,7 @@ int _ast_asprintf(char **ret, const char *file, int lineno, const char *func, co
_ast_vasprintf((ret), __FILE__, __LINE__, __PRETTY_FUNCTION__, (fmt), (ap))
AST_INLINE_API(
-int _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
+int __attribute__((format(printf, 5, 0))) _ast_vasprintf(char **ret, const char *file, int lineno, const char *func, const char *fmt, va_list ap),
{
int res;
diff --git a/include/jitterbuf.h b/include/jitterbuf.h
index dac903e83..45ec06f2d 100644
--- a/include/jitterbuf.h
+++ b/include/jitterbuf.h
@@ -151,8 +151,8 @@ enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats);
/* set jitterbuf conf */
enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf);
-typedef void (*jb_output_function_t)(const char *fmt, ...);
-void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
+typedef void __attribute__((format(printf, 1, 2))) (*jb_output_function_t)(const char *fmt, ...);
+void jb_setoutput(jb_output_function_t err, jb_output_function_t warn, jb_output_function_t dbg);
#ifdef __cplusplus
}