Skip to content

Commit

Permalink
fix inline functions to comply with gnu11
Browse files Browse the repository at this point in the history
The new gcc 5.1 version uses by default gnu11 standard, which behaves a bit
differently with inline functions (more details here:
https://gcc.gnu.org/gcc-5/porting_to.html)

Closes #555
  • Loading branch information
razvancrainea committed Jul 7, 2015
1 parent 912b0d1 commit 35ae885
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 47 deletions.
3 changes: 2 additions & 1 deletion Makefile.defs
Expand Up @@ -390,9 +390,10 @@ ifneq (,$(findstring gcc, $(CC_LONGVER)))
sed -e 's/[^0-9]*-\(.*\)/\1/'| \
sed -e 's/\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/' )
#transform gcc version into 2.9x, 3.x or 4.x
#XXX: for now treag 5.x the same as 4.x
CC_CLASS=$(shell echo "$(CC_SHORTVER)" | \
sed -e 's/2\.9.*/2.9x/' -e 's/3\.[0-9]/3.x/' \
-e 's/4\.[0-9]/4.x/')
-e 's/4\.[0-9]/4.x/' -e 's/5\.[0-9]/4.x/')
endif

ifneq (, $(findstring Sun, $(CC_LONGVER)))
Expand Down
18 changes: 9 additions & 9 deletions context.h
Expand Up @@ -67,19 +67,19 @@ context_p context_alloc(void);
*
* - they reserve and return a position in the context buffer of the given type
*/
inline int context_register_int(enum osips_context type);
inline int context_register_str(enum osips_context type);
inline int context_register_ptr(enum osips_context type);
extern inline int context_register_int(enum osips_context type);
extern inline int context_register_str(enum osips_context type);
extern inline int context_register_ptr(enum osips_context type);

inline void context_put_int(enum osips_context type, context_p ctx,
extern inline void context_put_int(enum osips_context type, context_p ctx,
int pos, int data);
inline void context_put_str(enum osips_context type, context_p ctx,
extern inline void context_put_str(enum osips_context type, context_p ctx,
int pos, str *data);
inline void context_put_ptr(enum osips_context type, context_p ctx,
extern inline void context_put_ptr(enum osips_context type, context_p ctx,
int pos, void *data);

inline int context_get_int(enum osips_context type, context_p ctx, int pos);
inline str *context_get_str(enum osips_context type, context_p ctx, int pos);
inline void *context_get_ptr(enum osips_context type, context_p ctx, int pos);
extern inline int context_get_int(enum osips_context type, context_p ctx, int pos);
extern inline str *context_get_str(enum osips_context type, context_p ctx, int pos);
extern inline void *context_get_ptr(enum osips_context type, context_p ctx, int pos);

#endif /* __CONTEXT_H */
2 changes: 1 addition & 1 deletion daemonize.h
Expand Up @@ -36,7 +36,7 @@ int send_status_code(char val);
void clean_write_pipeend(void);
int create_status_pipe(void);
int wait_for_all_children(void);
inline void inc_init_timer(void);
extern inline void inc_init_timer(void);


#define report_failure_status() \
Expand Down
9 changes: 5 additions & 4 deletions db/db_insertq.h
Expand Up @@ -63,10 +63,11 @@ extern gen_lock_t *ql_lock;
int init_ql_support(void);
int ql_row_add(query_list_t *entry,const db_val_t *row,db_val_t ***ins_rows);
int ql_detach_rows_unsafe(query_list_t *entry,db_val_t ***ins_rows);
inline int con_set_inslist(db_func_t *dbf,db_con_t *con,query_list_t **list,
db_key_t *cols,int col_no);
extern inline int con_set_inslist(db_func_t *dbf,db_con_t *con,
query_list_t **list,db_key_t *cols,int col_no);
void ql_timer_routine(unsigned int ticks,void *param);
inline int ql_flush_rows(db_func_t *dbf,db_con_t *conn,query_list_t *entry);
extern inline int ql_flush_rows(db_func_t *dbf,
db_con_t *conn,query_list_t *entry);

#define CON_RESET_INSLIST(con) \
do { \
Expand All @@ -92,7 +93,7 @@ inline int ql_flush_rows(db_func_t *dbf,db_con_t *conn,query_list_t *entry);
lock_release((entry)->lock); \
} while (0)

inline void cleanup_rows(db_val_t **rows);
extern inline void cleanup_rows(db_val_t **rows);
void handle_ql_shutdown(void);

#endif
10 changes: 5 additions & 5 deletions dprint.h
Expand Up @@ -117,21 +117,21 @@ void dprint (char* format, ...);
int str2facility(char *s);

/* set the current and default log levels for all OpenSIPS processes */
inline void set_global_debug_level(int level);
extern inline void set_global_debug_level(int level);

/* set the log level of the current process */
inline void set_proc_debug_level(int level);
extern inline void set_proc_debug_level(int level);

/*
* set the (default) log level of a given process
*
* Note: the index param is not validated!
*/
inline void __set_proc_debug_level(int proc_idx, int level);
inline void __set_proc_default_debug(int proc_idx, int level);
extern inline void __set_proc_debug_level(int proc_idx, int level);
extern inline void __set_proc_default_debug(int proc_idx, int level);

/* changes the logging level to the default value for the current process */
inline void reset_proc_debug_level(void);
extern inline void reset_proc_debug_level(void);

inline static char* dp_time(void)
{
Expand Down
2 changes: 1 addition & 1 deletion mem/meminfo.h
Expand Up @@ -44,7 +44,7 @@ struct mem_info{
// threshold percentage checked
extern long event_pkg_threshold;
// events are used only if STATISTICS are used
inline void pkg_threshold_check(void);
extern inline void pkg_threshold_check(void);
#else
#define pkg_threshold_check()
#endif /* STATISTICS */
Expand Down
4 changes: 2 additions & 2 deletions modules/benchmark/benchmark.h
Expand Up @@ -60,7 +60,7 @@ typedef struct benchmark_timer
struct benchmark_timer *next;
} benchmark_timer_t;

inline int bm_get_time(bm_timeval_t *t)
extern inline int bm_get_time(bm_timeval_t *t)
{
#ifdef BM_CLOCK_REALTIME
if(clock_gettime(CLOCK_REALTIME, t)!=0)
Expand All @@ -75,7 +75,7 @@ inline int bm_get_time(bm_timeval_t *t)
return 0;
}

inline unsigned long long bm_diff_time(bm_timeval_t *t1, bm_timeval_t *t2)
extern inline unsigned long long bm_diff_time(bm_timeval_t *t1, bm_timeval_t *t2)
{
unsigned long long tdiff;

Expand Down
2 changes: 1 addition & 1 deletion modules/cachedb_redis/cachedb_redis_utils.h
Expand Up @@ -29,7 +29,7 @@
#include "cachedb_redis_dbase.h"

int build_cluster_nodes(redis_con *con,char *info,int size);
inline cluster_node *get_redis_connection(redis_con *con,str *key);
extern inline cluster_node *get_redis_connection(redis_con *con,str *key);
void destroy_cluster_nodes(redis_con *con);

#endif
4 changes: 2 additions & 2 deletions modules/compression/compression_helpers.h
Expand Up @@ -41,6 +41,6 @@ int fixup_compression_flags(void**);
int free_whitelist(mc_whitelist_p* whitelist);
int free_hdr_list(struct hdr_field** hdr_lst_p);
int free_hdr_mask(struct hdr_field** hdr_mask);
inline int check_zlib_rc(int rc);
inline int wrap_realloc(str* buf, int new_len);
extern inline int check_zlib_rc(int rc);
extern inline int wrap_realloc(str* buf, int new_len);
#endif
4 changes: 2 additions & 2 deletions modules/dialog/dlg_hash.h
Expand Up @@ -222,8 +222,8 @@ static inline str* dlg_leg_to_uri(struct dlg_cell *dlg,int leg_no)
return &dlg->to_uri;
}

inline void unlink_unsafe_dlg(struct dlg_entry *d_entry, struct dlg_cell *dlg);
inline void destroy_dlg(struct dlg_cell *dlg);
extern inline void unlink_unsafe_dlg(struct dlg_entry *d_entry, struct dlg_cell *dlg);
extern inline void destroy_dlg(struct dlg_cell *dlg);

#define ref_dlg_unsafe(_dlg,_cnt) \
do { \
Expand Down
2 changes: 1 addition & 1 deletion modules/dispatcher/ds_fixups.h
Expand Up @@ -84,7 +84,7 @@ void free_int_list(int_list_t *start, int_list_t *end);

int fixup_get_partition(struct sip_msg *msg, const gpartition_t *gpart,
ds_partition_t **partition);
inline int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param,
extern inline int fixup_get_partition_set(struct sip_msg *msg, const ds_param_t *param,
ds_partition_t **partition, unsigned int *uset);
int fixup_partition_sets(void **param);
int fixup_partition_one_set(void **param);
Expand Down
4 changes: 2 additions & 2 deletions modules/seas/ha.h
Expand Up @@ -58,6 +58,6 @@ char * create_ping_event(int *evt_len,int flags,unsigned int *seqno);
int prepare_ha();
int spawn_pinger();
int print_pingtable(struct ha *ta,int idx,int lock);
inline int init_pingtable(struct ha *table,int timeout,int maxpings);
inline void destroy_pingtable(struct ha *table);
extern inline int init_pingtable(struct ha *table,int timeout,int maxpings);
extern inline void destroy_pingtable(struct ha *table);
#endif
14 changes: 7 additions & 7 deletions modules/seas/statistics.h
Expand Up @@ -69,21 +69,21 @@ extern struct statstable *seas_stats_table;
* Initialize and destroy statistics table
*/
struct statstable* init_seas_stats_table();
inline int stop_stats_server();
inline void destroy_seas_stats_table();
extern inline int stop_stats_server();
extern inline void destroy_seas_stats_table();
/** Statistics server process
* functions
*/
void serve_stats(int fd);
int start_stats_server(char *socket);
inline int print_stats_info(int f,int sock);
extern inline int print_stats_info(int f,int sock);
/**
* Statistics functions
*/
inline void as_relay_stat(struct cell *t);
inline void event_stat(struct cell *t);
inline void action_stat(struct cell *t);
inline void stats_reply();
extern inline void as_relay_stat(struct cell *t);
extern inline void event_stat(struct cell *t);
extern inline void action_stat(struct cell *t);
extern inline void stats_reply();
#define receivedplus() \
do{ \
lock_get(seas_stats_table->mutex); \
Expand Down
6 changes: 3 additions & 3 deletions modules/tm/t_funcs.h
Expand Up @@ -128,9 +128,9 @@ int send_pr_buffer( struct retr_buf *rb, void *buf, int len, void* ctx);
#define unset_timeout(timeout) ((timeout) = 0)
#define is_timeout_set(timeout) ((timeout) != 0)

inline void set_fr_retr(struct retr_buf *rb, int retr );
inline void start_retr(struct retr_buf *rb);
inline void force_retr(struct retr_buf *rb);
extern inline void set_fr_retr(struct retr_buf *rb, int retr );
extern inline void start_retr(struct retr_buf *rb);
extern inline void force_retr(struct retr_buf *rb);

void tm_shutdown();

Expand Down
2 changes: 1 addition & 1 deletion parser/parse_to.h
Expand Up @@ -64,6 +64,6 @@ struct sip_uri *parse_to_uri(struct sip_msg *msg);

void free_to(struct to_body* tb);

inline void free_to_params(struct to_body *tb);
extern inline void free_to_params(struct to_body *tb);

#endif
4 changes: 2 additions & 2 deletions resolve.h
Expand Up @@ -173,9 +173,9 @@ int check_ip_address(struct ip_addr* ip, str *name,
struct hostent* sip_resolvehost(str* name, unsigned short* port,
unsigned short *proto, int is_sips, struct dns_node **dn);

inline struct hostent* resolvehost(char* name, int no_ip_test);
extern inline struct hostent* resolvehost(char* name, int no_ip_test);

inline struct hostent* rev_resolvehost(struct ip_addr *ip);
extern inline struct hostent* rev_resolvehost(struct ip_addr *ip);

/*! \brief free the DNS resolver state machine */
void free_dns_res( struct proxy_l *p );
Expand Down
2 changes: 1 addition & 1 deletion socket_info.h
Expand Up @@ -43,7 +43,7 @@
int add_listen_iface(char* name, unsigned short port, unsigned short proto,
char *adv_name, unsigned short adv_port,
unsigned short children, enum si_flags flags);
inline struct socket_info *
extern inline struct socket_info *
new_sock_info(char* name, unsigned short port, unsigned short proto,
char *adv_name, unsigned short adv_port,
unsigned short children, enum si_flags flags);
Expand Down
4 changes: 2 additions & 2 deletions ut.h
Expand Up @@ -852,7 +852,7 @@ int parse_reply_codes( str *options_reply_codes_str,
void base64encode(unsigned char *out, unsigned char *in, int inlen);
int base64decode(unsigned char *out,unsigned char *in,int len);

inline int calc_base64_encode_len(int len);
inline int calc_max_base64_decode_len(int len);
extern inline int calc_base64_encode_len(int len);
extern inline int calc_max_base64_decode_len(int len);

#endif

0 comments on commit 35ae885

Please sign in to comment.