add macros for the pure and const attributes to compiler.h, in case they ever

need to be handled differently for a specific compiler


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@38454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-07-28 22:50:54 +00:00
parent d6246e579f
commit 450db95711
3 changed files with 16 additions and 10 deletions

View File

@@ -141,6 +141,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/monitor.h" #include "asterisk/monitor.h"
#include "asterisk/localtime.h" #include "asterisk/localtime.h"
#include "asterisk/abstract_jb.h" #include "asterisk/abstract_jb.h"
#include "asterisk/compiler.h"
#ifndef FALSE #ifndef FALSE
#define FALSE 0 #define FALSE 0
@@ -1286,8 +1287,8 @@ static void sip_poke_all_peers(void);
/*--- Applications, functions, CLI and manager command helpers */ /*--- Applications, functions, CLI and manager command helpers */
static const char *sip_nat_mode(const struct sip_pvt *p); static const char *sip_nat_mode(const struct sip_pvt *p);
static int sip_show_inuse(int fd, int argc, char *argv[]); static int sip_show_inuse(int fd, int argc, char *argv[]);
static char *transfermode2str(enum transfermodes mode) __attribute__ ((const)); static char *transfermode2str(enum transfermodes mode) attribute_const;
static char *nat2str(int nat) __attribute__ ((const)); static char *nat2str(int nat) attribute_const;
static int peer_status(struct sip_peer *peer, char *status, int statuslen); static int peer_status(struct sip_peer *peer, char *status, int statuslen);
static int sip_show_users(int fd, int argc, char *argv[]); static int sip_show_users(int fd, int argc, char *argv[]);
static int _sip_show_peers(int fd, int *total, struct mansession *s, struct message *m, int argc, char *argv[]); static int _sip_show_peers(int fd, int *total, struct mansession *s, struct message *m, int argc, char *argv[]);
@@ -1295,8 +1296,8 @@ static int manager_sip_show_peers( struct mansession *s, struct message *m );
static int sip_show_peers(int fd, int argc, char *argv[]); static int sip_show_peers(int fd, int argc, char *argv[]);
static int sip_show_objects(int fd, int argc, char *argv[]); static int sip_show_objects(int fd, int argc, char *argv[]);
static void print_group(int fd, unsigned int group, int crlf); static void print_group(int fd, unsigned int group, int crlf);
static const char *dtmfmode2str(int mode) __attribute__ ((const)); static const char *dtmfmode2str(int mode) attribute_const;
static const char *insecure2str(int port, int invite) __attribute__ ((const)); static const char *insecure2str(int port, int invite) attribute_const;
static void cleanup_stale_contexts(char *new, char *old); static void cleanup_stale_contexts(char *new, char *old);
static void print_codec_to_cli(int fd, struct ast_codec_pref *pref); static void print_codec_to_cli(int fd, struct ast_codec_pref *pref);
static const char *domain_mode_to_text(const enum domain_mode mode); static const char *domain_mode_to_text(const enum domain_mode mode);
@@ -1308,7 +1309,7 @@ static int _sip_show_peer(int type, int fd, struct mansession *s, struct message
static int sip_show_user(int fd, int argc, char *argv[]); static int sip_show_user(int fd, int argc, char *argv[]);
static int sip_show_registry(int fd, int argc, char *argv[]); static int sip_show_registry(int fd, int argc, char *argv[]);
static int sip_show_settings(int fd, int argc, char *argv[]); static int sip_show_settings(int fd, int argc, char *argv[]);
static const char *subscription_type2str(enum subscriptiontype subtype) __attribute__ ((pure)); static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype); static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
static int __sip_show_channels(int fd, int argc, char *argv[], int subscriptions); static int __sip_show_channels(int fd, int argc, char *argv[], int subscriptions);
static int sip_show_channels(int fd, int argc, char *argv[]); static int sip_show_channels(int fd, int argc, char *argv[]);
@@ -1384,7 +1385,7 @@ static int sip_prune_realtime(int fd, int argc, char *argv[]);
static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us); static int ast_sip_ouraddrfor(struct in_addr *them, struct in_addr *us);
static void sip_registry_destroy(struct sip_registry *reg); static void sip_registry_destroy(struct sip_registry *reg);
static int sip_register(char *value, int lineno); static int sip_register(char *value, int lineno);
static char *regstate2str(enum sipregistrystate regstate) __attribute__ ((const)); static char *regstate2str(enum sipregistrystate regstate) attribute_const;
static int sip_reregister(void *data); static int sip_reregister(void *data);
static int __sip_do_register(struct sip_registry *r); static int __sip_do_register(struct sip_registry *r);
static int sip_reg_timeout(void *data); static int sip_reg_timeout(void *data);
@@ -1401,7 +1402,7 @@ static int find_sip_method(const char *msg);
static unsigned int parse_sip_options(struct sip_pvt *pvt, const char *supported); static unsigned int parse_sip_options(struct sip_pvt *pvt, const char *supported);
static void parse_request(struct sip_request *req); static void parse_request(struct sip_request *req);
static const char *get_header(const struct sip_request *req, const char *name); static const char *get_header(const struct sip_request *req, const char *name);
static char *referstatus2str(enum referstatus rstatus) __attribute__ ((pure)); static char *referstatus2str(enum referstatus rstatus) attribute_pure;
static int method_match(enum sipmethod id, const char *name); static int method_match(enum sipmethod id, const char *name);
static void parse_copy(struct sip_request *dst, const struct sip_request *src); static void parse_copy(struct sip_request *dst, const struct sip_request *src);
static char *get_in_brackets(char *tmp); static char *get_in_brackets(char *tmp);

View File

@@ -116,6 +116,7 @@ extern "C" {
#include "asterisk/utils.h" #include "asterisk/utils.h"
#include "asterisk/linkedlists.h" #include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h" #include "asterisk/stringfields.h"
#include "asterisk/compiler.h"
#define AST_MAX_FDS 8 #define AST_MAX_FDS 8
@@ -955,14 +956,14 @@ int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clo
* Give a name to a cause code * Give a name to a cause code
* Returns the text form of the binary cause code given * Returns the text form of the binary cause code given
*/ */
const char *ast_cause2str(int state) __attribute__ ((pure)); const char *ast_cause2str(int state) attribute_pure;
/*! Convert the string form of a cause code to a number */ /*! Convert the string form of a cause code to a number */
/*! /*!
* \param name string form of the cause * \param name string form of the cause
* Returns the cause code * Returns the cause code
*/ */
int ast_str2cause(const char *name) __attribute__ ((pure)); int ast_str2cause(const char *name) attribute_pure;
/*! Gives the string form of a given channel state */ /*! Gives the string form of a given channel state */
/*! /*!
@@ -979,7 +980,7 @@ char *ast_state2str(int state);
* See above * See above
* Returns the text form of the binary transfer capbility * Returns the text form of the binary transfer capbility
*/ */
char *ast_transfercapability2str(int transfercapability) __attribute__ ((const)); char *ast_transfercapability2str(int transfercapability) attribute_const;
/* Options: Some low-level drivers may implement "options" allowing fine tuning of the /* Options: Some low-level drivers may implement "options" allowing fine tuning of the
low level channel. See frame.h for options. Note that many channel drivers may support low level channel. See frame.h for options. Note that many channel drivers may support

View File

@@ -30,4 +30,8 @@
#define force_inline inline __attribute__((always_inline)) #define force_inline inline __attribute__((always_inline))
#endif #endif
#define attribute_pure __attribute__((pure))
#define attribute_const __attribute__((const))
#endif /* _ASTERISK_COMPILER_H */ #endif /* _ASTERISK_COMPILER_H */