]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid...
authorKevin P. Fleming <kpfleming@digium.com>
Sat, 29 Nov 2008 16:58:29 +0000 (16:58 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Sat, 29 Nov 2008 16:58:29 +0000 (16:58 +0000)
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: https://origsvn.digium.com/svn/asterisk/branches/1.4@159808 65c4cc65-6c06-0410-ace0-fbb531ad65f3

35 files changed:
Makefile
channels/chan_agent.c
channels/chan_iax2.c
channels/chan_misdn.c
channels/chan_sip.c
channels/chan_vpb.cc
configure
configure.ac
include/asterisk/channel.h
include/asterisk/cli.h
include/asterisk/devicestate.h
include/asterisk/dundi.h
include/asterisk/linkedlists.h
include/asterisk/lock.h
include/asterisk/logger.h
include/asterisk/manager.h
include/asterisk/module.h
include/asterisk/res_odbc.h
include/asterisk/stringfields.h
include/asterisk/strings.h
include/asterisk/threadstorage.h
include/asterisk/utils.h
include/jitterbuf.h
main/ast_expr2.c
main/dns.c
main/enum.c
main/jitterbuf.c
main/logger.c
main/srv.c
makeopts.in
res/res_agi.c
res/res_features.c
utils/astman.c
utils/check_expr.c
utils/frame.c

index 16b69e60770a37a744316f989f08debb245bafd3..185e58f88d456ea7230b3f12591b100a73fbfa3f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -204,7 +204,14 @@ endif
 ASTCFLAGS+=-Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG)
 
 ifeq ($(AST_DEVMODE),yes)
-  ASTCFLAGS+=-Werror  -Wunused $(AST_DECLARATION_AFTER_STATEMENT)
+  ASTCFLAGS+=-Werror
+  ASTCFLAGS+=-Wunused
+  ASTCFLAGS+=$(AST_DECLARATION_AFTER_STATEMENT)
+  ASTCFLAGS+=$(AST_FORTIFY_SOURCE)
+# ASTCFLAGS+=-Wundef 
+  ASTCFLAGS+=-Wformat -Wformat-security
+  ASTCFLAGS+=-Wmissing-format-attribute
+# ASTCFLAGS+=-Wformat=2
 endif
 
 ifneq ($(findstring BSD,$(OSARCH)),)
index 0e266fa5dfaf103fd582bc9276e07546a6f4ca0f..c15137bba37f97f935c5908c16b8ff484017a22e 100644 (file)
@@ -1035,7 +1035,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
        }
 #endif 
        if (p->pending)
-               tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
+               tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/P%s-%d", p->agent, (int) ast_random() & 0xffff);
        else
                tmp = ast_channel_alloc(0, state, 0, 0, "", p->chan ? p->chan->exten:"", p->chan ? p->chan->context:"", 0, "Agent/%s", p->agent);
        if (!tmp) {
index 4d9165cac8318fb289efa764d796b8b246247f38..f0c6cfe2325589900ae8016cdbe1768a3f9dd790 100644 (file)
@@ -770,7 +770,7 @@ static void iax_error_output(const char *data)
        ast_log(LOG_WARNING, "%s", data);
 }
 
-static void jb_error_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_error_output(const char *fmt, ...)
 {
        va_list args;
        char buf[1024];
@@ -782,7 +782,7 @@ static void jb_error_output(const char *fmt, ...)
        ast_log(LOG_ERROR, "%s", buf);
 }
 
-static void jb_warning_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_warning_output(const char *fmt, ...)
 {
        va_list args;
        char buf[1024];
@@ -794,7 +794,7 @@ static void jb_warning_output(const char *fmt, ...)
        ast_log(LOG_WARNING, "%s", buf);
 }
 
-static void jb_debug_output(const char *fmt, ...)
+static void __attribute__((format(printf, 1, 2))) jb_debug_output(const char *fmt, ...)
 {
        va_list args;
        char buf[1024];
index 9ea54bac12bd10473cc3295d8ab5e6834b2fb25e..9acbde1c79af717ec4a812aa0d6a0551987dc61f 100644 (file)
@@ -291,7 +291,7 @@ static pthread_t misdn_tasks_thread;
 static int *misdn_ports;
 
 static void chan_misdn_log(int level, int port, char *tmpl, ...)
-       __attribute__ ((format (printf, 3, 4)));
+       __attribute__((format(printf, 3, 4)));
 
 static struct ast_channel *misdn_new(struct chan_list *cl, int state,  char *exten, char *callerid, int format, int port, int c);
 static void send_digit_to_chan(struct chan_list *cl, char digit );
index 0afe2d596707c88a1a29b9c76e3bf9605d762408..0eb2336d107627d5355eef5ff7eae39243fb503f 100644 (file)
@@ -1813,7 +1813,7 @@ static void build_via(struct sip_pvt *p)
 
        /* z9hG4bK is a magic cookie.  See RFC 3261 section 8.1.1.7 */
        ast_string_field_build(p, via, "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x%s",
-                        ast_inet_ntoa(p->ourip), ourport, p->branch, rport);
+                              ast_inet_ntoa(p->ourip), ourport, (int) p->branch, rport);
 }
 
 /*! \brief NAT fix - decide which IP address to use for ASterisk server?
@@ -1859,10 +1859,10 @@ static enum sip_result ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *
 #define append_history(p, event, fmt , args... )       append_history_full(p, "%-15s " fmt, event, ## args)
 
 static void append_history_full(struct sip_pvt *p, const char *fmt, ...)
-       __attribute__ ((format (printf, 2, 3)));
+       __attribute__((format(printf, 2, 3)));
 
 /*! \brief Append to SIP dialog history with arg list  */
-static void append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
+static void __attribute__((format(printf, 2, 0))) append_history_va(struct sip_pvt *p, const char *fmt, va_list ap)
 {
        char buf[80], *c = buf; /* max history length */
        struct sip_history *hist;
index 359a4ddf05edcc3a1f6b6d5994101b0fe69a5001..56467a6ce313c4de160d16efb5185a590c578d1f 100644 (file)
@@ -2495,7 +2495,7 @@ static struct ast_channel *vpb_new(struct vpb_pvt *me, enum ast_channel_state st
        }
        ast_verb(4, "%s: New call for context [%s]\n", me->dev, context);
            
-       tmp = ast_channel_alloc(1, state, 0, 0, "", me->ext, me->context, 0, me->dev);
+       tmp = ast_channel_alloc(1, state, 0, 0, "", me->ext, me->context, 0, "%s", me->dev);
        if (tmp) {
                if (use_ast_ind == 1){
                        tmp->tech = &vpb_tech_indicate;
index 9490cde37d335eaa879d0d0a3680b0fd2ece568f..fc40eb4ab4185be9d7ee21801a5e51b9dfdd3333 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.ac Revision: 151241 .
+# From configure.ac Revision: 159025 .
 # Guess values for system-dependent variables and create Makefiles.
 # Generated by GNU Autoconf 2.61 for asterisk 1.4.
 #
@@ -887,6 +887,7 @@ POW_LIB
 GC_CFLAGS
 GC_LDFLAGS
 AST_DECLARATION_AFTER_STATEMENT
+AST_FORTIFY_SOURCE
 AST_NO_STRICT_OVERFLOW
 PBX_DAHDI_TRANSCODE
 GSM_INTERNAL
@@ -15383,6 +15384,19 @@ echo "${ECHO_T}no" >&6; }
 fi
 
 
+{ echo "$as_me:$LINENO: checking for _FORTIFY_SOURCE support" >&5
+echo $ECHO_N "checking for _FORTIFY_SOURCE support... $ECHO_C" >&6; }
+if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+   { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+   AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
+else
+   { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+   AST_FORTIFY_SOURCE=
+fi
+
+
 { echo "$as_me:$LINENO: checking for -fno-strict-overflow" >&5
 echo $ECHO_N "checking for -fno-strict-overflow... $ECHO_C" >&6; }
 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
@@ -32482,6 +32496,7 @@ POW_LIB!$POW_LIB$ac_delim
 GC_CFLAGS!$GC_CFLAGS$ac_delim
 GC_LDFLAGS!$GC_LDFLAGS$ac_delim
 AST_DECLARATION_AFTER_STATEMENT!$AST_DECLARATION_AFTER_STATEMENT$ac_delim
+AST_FORTIFY_SOURCE!$AST_FORTIFY_SOURCE$ac_delim
 AST_NO_STRICT_OVERFLOW!$AST_NO_STRICT_OVERFLOW$ac_delim
 PBX_DAHDI_TRANSCODE!$PBX_DAHDI_TRANSCODE$ac_delim
 GSM_INTERNAL!$GSM_INTERNAL$ac_delim
@@ -32504,7 +32519,6 @@ PBX_ZAPTEL_VLDTMF!$PBX_ZAPTEL_VLDTMF$ac_delim
 EDITLINE_LIB!$EDITLINE_LIB$ac_delim
 PBX_H323!$PBX_H323$ac_delim
 PBX_IXJUSER!$PBX_IXJUSER$ac_delim
-GTKCONFIG!$GTKCONFIG$ac_delim
 _ACEOF
 
   if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -32546,6 +32560,7 @@ _ACEOF
 ac_delim='%!_!# '
 for ac_last_try in false false false false false :; do
   cat >conf$$subs.sed <<_ACEOF
+GTKCONFIG!$GTKCONFIG$ac_delim
 PBX_GTK!$PBX_GTK$ac_delim
 GTK_INCLUDE!$GTK_INCLUDE$ac_delim
 GTK_LIB!$GTK_LIB$ac_delim
@@ -32557,7 +32572,7 @@ CURL_CONFIG!$CURL_CONFIG$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 10; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
index 01b2c4058fa0e900f58183a4a74c1497d0680baa..44fff243ecdea11b14b08fe39142fb73db941c0e 100644 (file)
@@ -351,18 +351,28 @@ if $(${CC} -Wdeclaration-after-statement -S -o /dev/null -xc /dev/null > /dev/nu
    AC_MSG_RESULT(yes)
    AST_DECLARATION_AFTER_STATEMENT=-Wdeclaration-after-statement
 else
-       AC_MSG_RESULT(no)
-       AST_DECLARATION_AFTER_STATEMENT=
+   AC_MSG_RESULT(no)
+   AST_DECLARATION_AFTER_STATEMENT=
 fi
 AC_SUBST(AST_DECLARATION_AFTER_STATEMENT)
 
+AC_MSG_CHECKING(for _FORTIFY_SOURCE support)
+if $(${CC} -D_FORTIFY_SOURCE=2 -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
+   AC_MSG_RESULT(yes)
+   AST_FORTIFY_SOURCE=-D_FORTIFY_SOURCE=2
+else
+   AC_MSG_RESULT(no)
+   AST_FORTIFY_SOURCE=
+fi
+AC_SUBST(AST_FORTIFY_SOURCE)
+
 AC_MSG_CHECKING(for -fno-strict-overflow)
 if $(${CC} -O2 -fno-strict-overflow -S -o /dev/null -xc /dev/null > /dev/null 2>&1); then
    AC_MSG_RESULT(yes)
    AST_NO_STRICT_OVERFLOW=-fno-strict-overflow
 else
-       AC_MSG_RESULT(no)
-       AST_NO_STRICT_OVERFLOW=
+   AC_MSG_RESULT(no)
+   AST_NO_STRICT_OVERFLOW=
 fi
 AC_SUBST(AST_NO_STRICT_OVERFLOW)
 
index ea4dac2bc3acd10c6a668b82526c64410e6e7946..a550101ea0ca7cd665bb4e17df9a44cbaad49dbe 100644 (file)
@@ -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 */
index 9a7b53a3659b42fdaa20403d5d5c70c3cfe6179b..13d6fdd84bc72c493eaa2261ceb7a5904f4471dd 100644 (file)
@@ -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
index ed9022fbd96763f9a71a70ce5ea5ea41ff080a70..561bd2cb4652570580a9ca071047536350f8f177 100644 (file)
@@ -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 
index 9290536d6859b089231382c38d98e0fd86b10905..09dcea9ee79b668a52759fc990d1a97d0aed2e1b 100644 (file)
@@ -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)
index a8d90ecbe6daa41fe7134e586fdc69ece3c1b4b9..e7511fd8a2b601613973dc5202ef484cb42346c8 100644 (file)
@@ -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);                                 \
 }                                                                       \
index 3e684f838ebc09c68f8521fc2e7545a82e92237d..bcf802451ede244afbe706439865d25faed43bdc 100644 (file)
@@ -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); \
 }
index 58bf1804b64859ea986b17f4bbecf96e3b11dd1e..af0bb3c01ef3dca0bbedcdc41c338a541e20433e 100644 (file)
@@ -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));
index cc4e971c9658d3e9caaecfa2198dde63f2fb5086..34ae432359bf2383e1e7c216667538e1eca34eca 100644 (file)
@@ -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);
index 4c1e40b1dba8a2f335b16458142fb97152a7455d..27eae4abe9bbb4cb0f733e0c7eb43092d0e7e5b0 100644 (file)
@@ -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); \
        } \
index 4d023c0666ceecf2d5536b0fd6ea627e6ab90b9b..4fbe007c4a49dd873d996fbc3a66806981a84f0c 100644 (file)
@@ -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.
index d8d257f956e4531e87c536720901f6e9474d266f..97e65532da6bd2cf9c1f8fd803f81ff79f3b8830 100644 (file)
@@ -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
index 70517a4d6444607633a09ff2c01203a5a2880713..a7e2fa4babae43d05e8f67cb916b76644948a68d 100644 (file)
@@ -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 */
 /*!
index 59bd8cd72b50ef52be73bc96b9277a1b4c430e37..2934a320bb9682026f65e22a7bcf610bbd9ad915 100644 (file)
@@ -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, ...),
 {
index 4e4d9d5ee0e2d665d6d47919cad156ea90a5b3f4..7b7378530063043589fe495dad3ebf55c6af7ea4 100644 (file)
@@ -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;
 
index dac903e83548dd94ae479821137896c7f6ae6a7a..45ec06f2d2d31cc6fc6665aaaf614a4d84bade8b 100644 (file)
@@ -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
 }
index 9133e76ea2185f7b1365d1c254276044940a3709..66a680b5642ccb217c384fcc4eff485a60de46c5 100644 (file)
@@ -179,7 +179,7 @@ enum valtype {
 } ;
 
 #ifdef STANDALONE
-void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
 #endif
 
 struct val {
index d57e6227aa9821394367314bca0cf1f8bfbfca3e..dc0d3c81824b13a8985a81edd6fd8726a1be22db 100644 (file)
@@ -148,7 +148,7 @@ struct dn_answer {
        unsigned short class;
        unsigned int ttl;
        unsigned short size;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 static int skip_name(unsigned char *s, int len)
 {
index aece8e5728e57074e0825b8f360f1548864efffd..3fa0bb977e074af2ccd23e15b3358aca82708fc4 100644 (file)
@@ -92,7 +92,7 @@ AST_MUTEX_DEFINE_STATIC(enumlock);
 struct naptr {
        unsigned short order;
        unsigned short pref;
-} __attribute__ ((__packed__));
+} __attribute__((__packed__));
 
 /*! \brief Parse NAPTR record information elements */
 static unsigned int parse_ie(char *data, unsigned int maxdatalen, unsigned char *src, unsigned int srclen)
index 2b081704abcad65019f8411912b63bb315eb6724..849cffab534ac6ebe4c095aa34a349df73078d12 100644 (file)
@@ -565,7 +565,7 @@ static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, long now,
 
        /* if a hard clamp was requested, use it */
        if ((jb->info.conf.max_jitterbuf) && ((jb->info.target - jb->info.min) > jb->info.conf.max_jitterbuf)) {
-               jb_dbg("clamping target from %d to %d\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
+               jb_dbg("clamping target from %ld to %ld\n", (jb->info.target - jb->info.min), jb->info.conf.max_jitterbuf);
                jb->info.target = jb->info.min + jb->info.conf.max_jitterbuf;
        }
 
index 8f6ebaf80d2de2f50d5b765870c4546047b3b488..0d1ef4b71f704865ccbf51af897945a36a45fd86 100644 (file)
@@ -655,7 +655,7 @@ void close_logger(void)
        return;
 }
 
-static void ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) 
+static void __attribute__((format(printf, 5, 0))) ast_log_vsyslog(int level, const char *file, int line, const char *function, const char *fmt, va_list args) 
 {
        char buf[BUFSIZ];
        char *s;
index 97ad43cff4af25db6cd885ef88b37c7cda43f8aa..cf99ef3ec653f19595f5702c8fe0837b1a6fe93a 100644 (file)
@@ -77,7 +77,7 @@ static int parse_srv(unsigned char *answer, int len, unsigned char *msg, struct
                unsigned short priority;
                unsigned short weight;
                unsigned short port;
-       } __attribute__ ((__packed__)) *srv = (struct srv *) answer;
+       } __attribute__((__packed__)) *srv = (struct srv *) answer;
 
        int res = 0;
        char repl[256] = "";
index eb54b59e3e6599ed52d5d008b8d5a3c49cb55fac..790ba6e864408e3a2f66bbf3903e560ba7613b0d 100644 (file)
@@ -63,6 +63,7 @@ AST_DEVMODE=@AST_DEVMODE@
 
 AST_DECLARATION_AFTER_STATEMENT=@AST_DECLARATION_AFTER_STATEMENT@
 AST_NO_STRICT_OVERFLOW=@AST_NO_STRICT_OVERFLOW@
+AST_FORTIFY_SOURCE=@AST_FORTIFY_SOURCE@
 
 ASOUND_INCLUDE=@ALSA_INCLUDE@
 ASOUND_LIB=@ALSA_LIB@
index a2ff4ef3e5b8a7a7e606dddc3b41f7d047108e7a..1119a2d6153c63c19aa7db0c1f2b344d085bbefb 100644 (file)
@@ -119,7 +119,7 @@ enum agi_result {
        AGI_RESULT_HANGUP
 };
 
-static int agi_debug_cli(int fd, char *fmt, ...)
+static int __attribute__((format(printf, 2, 3))) agi_debug_cli(int fd, char *fmt, ...)
 {
        char *stuff;
        int res = 0;
@@ -1815,7 +1815,7 @@ static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf)
                switch(res) {
                case RESULT_SHOWUSAGE:
                        fdprintf(agi->fd, "520-Invalid command syntax.  Proper usage follows:\n");
-                       fdprintf(agi->fd, c->usage);
+                       fdprintf(agi->fd, "%s", c->usage);
                        fdprintf(agi->fd, "520 End of proper usage.\n");
                        break;
                case AST_PBX_KEEPALIVE:
index ad165b036c2fb0c716f9b463d7fb040c48e55bae..d3aeeee01c3b7ea28ba13fe05276b43ae9a0bc78 100644 (file)
@@ -198,7 +198,7 @@ static void check_goto_on_transfer(struct ast_channel *chan)
 
        goto_on_transfer = ast_strdupa(val);
 
-       if (!(xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, chan->name)))
+       if (!(xferchan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, "%s", chan->name)))
                return;
 
        for (x = goto_on_transfer; x && *x; x++) {
index 757421725202d9de5ed320054c5debfce732e345..ae2444ae75a2193cbb5bcc405ecc6a138ea3d25c 100644 (file)
@@ -140,7 +140,7 @@ static void del_chan(char *name)
        AST_LIST_TRAVERSE_SAFE_END
 }
 
-static void fdprintf(int fd, char *fmt, ...)
+static void __attribute__((format(printf, 2, 3))) fdprintf(int fd, char *fmt, ...)
 {
        char stuff[4096];
        va_list ap;
@@ -397,7 +397,7 @@ static struct message *wait_for_response(int timeout)
        return NULL;
 }
 
-static int manager_action(char *action, char *fmt, ...)
+static int __attribute__((format(printf, 2, 3))) manager_action(char *action, char *fmt, ...)
 {
        struct ast_mansession *s;
        char tmp[4096];
@@ -459,7 +459,7 @@ static int hide_doing(void)
 static void try_status(void)
 {
        struct message *m;
-       manager_action("Status", "");
+       manager_action("Status", "%s", "");
        m = wait_for_response(10000);
        if (!m) {
                show_message("Status Failed", "Timeout waiting for response");
index df1765db121961b13e678e89bed812dbb5ed53c2..d3dcc5d198aad1b3afd42c462a0d25aad9cab752 100644 (file)
@@ -41,7 +41,7 @@ struct varz *global_varlist;
 
 /* Our own version of ast_log, since the expr parser uses it. */
 
-void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((format (printf,5,6)));
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...) __attribute__((format(printf,5,6)));
 
 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
 {
index 52f2d498e43697b080903ef989f6d06c6de44d5f..bdc65e12f6683e2d440d40cd1dfdd074e9fd3574 100644 (file)
@@ -968,7 +968,7 @@ int workloop( FILE *theinfile, FILE *theoutfile,
   return TRUE;      /* Input file done with, no errors. */
 }
 
-int chat( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) chat( const char *format, ...)
 {
     va_list ap;
     int result = 0;
@@ -983,7 +983,7 @@ int chat( const char *format, ...)
 }
 
 
-int inform( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) inform( const char *format, ...)
 {
     va_list ap;
     int result = 0;
@@ -997,7 +997,7 @@ int inform( const char *format, ...)
     return result;
 }
 
-int error( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) error( const char *format, ...)
 {
     va_list ap;
     int result;
@@ -1008,7 +1008,7 @@ int error( const char *format, ...)
     return result;
 }
 
-void fatalerror( const char *format, ...)
+void __attribute__((format(printf, 1, 2))) fatalerror( const char *format, ...)
 {
     va_list ap;
 
@@ -1024,7 +1024,7 @@ void fatalperror( const char *string)
   myexit( 1);
 }
 
-int say( const char *format, ...)
+int __attribute__((format(printf, 1, 2))) say( const char *format, ...)
 {
     va_list ap;
     int result;