Commit 1eaeb178 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Stricter compilation options + new compilation error fixes.

parent 0285a4fb
......@@ -193,7 +193,7 @@ else()
list(APPEND STRICT_OPTIONS_CPP "-Wno-error=unknown-warning-option" "-Qunused-arguments" "-Wno-tautological-compare" "-Wno-unused-function" "-Wno-array-bounds")
endif()
if(ENABLE_STRICT)
list(APPEND STRICT_OPTIONS_CPP "-Werror" "-Wno-error=unknown-pragmas" "-Wuninitialized" "-fno-strict-aliasing")
list(APPEND STRICT_OPTIONS_CPP "-Werror" "-Wextra" "-Wno-unused-parameter" "-Wno-error=unknown-pragmas" "-Wuninitialized" "-fno-strict-aliasing")
list(APPEND STRICT_OPTIONS_C "-Wdeclaration-after-statement" "-Wstrict-prototypes")
endif()
# this warning is generated by antlr so ignore it for now
......
......@@ -128,7 +128,7 @@ case "$target_os" in
esac
if test "$strict" = "true"; then
STRICT_OPTIONS="$STRICT_OPTIONS -Werror -Wno-error=unknown-pragmas -Wuninitialized -Wno-error=strict-prototypes"
STRICT_OPTIONS="$STRICT_OPTIONS -Werror -Wextra -Wno-unused-parameter -Wno-error=unknown-pragmas -Wuninitialized -Wno-error=strict-prototypes"
fi
dnl because of antlr3 we must accept a few warnings...
......
......@@ -27,6 +27,8 @@
* typedefs, macros and functions for object definition and manipulation.
*/
#define BELLE_SIP_DEFAULT_BUFSIZE_HINT 0
#define BELLE_SIP_TYPE_ID(_type) _type##_id
typedef unsigned int belle_sip_type_id_t;
......@@ -78,7 +80,8 @@ typedef unsigned int belle_sip_type_id_t;
BELLE_SIP_VPTR_INIT(object_type,parent_type,unowned), \
(belle_sip_object_destroy_t)destroy, \
(belle_sip_object_clone_t)clone, \
(belle_sip_object_marshal_t)marshal\
(belle_sip_object_marshal_t)marshal,\
BELLE_SIP_DEFAULT_BUFSIZE_HINT\
}; \
BELLE_SIP_OBJECT_VPTR_TYPE(object_type) * BELLE_SIP_OBJECT_GET_VPTR_FUNC(object_type)(void){\
return &BELLE_SIP_OBJECT_VPTR_NAME(object_type); \
......
......@@ -185,6 +185,10 @@ if(MSVC)
get_source_file_property(SIP_MESSAGE_PARSER_COMPILE_FLAGS grammars/belle_sip_messageParser.c COMPILE_FLAGS)
set(SIP_MESSAGE_PARSER_COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS} /wd4267") # Disable "possible loss of data" warnings
set_source_files_properties(grammars/belle_sip_messageParser.c PROPERTIES COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS}")
else()
get_source_file_property(SIP_MESSAGE_PARSER_COMPILE_FLAGS grammars/belle_sip_messageParser.c COMPILE_FLAGS)
set(SIP_MESSAGE_PARSER_COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS} -Wno-sign-compare")
set_source_files_properties(grammars/belle_sip_messageParser.c PROPERTIES COMPILE_FLAGS "${SIP_MESSAGE_PARSER_COMPILE_FLAGS}")
endif()
string(REPLACE ";" " " LINK_FLAGS_STR "${LINK_FLAGS}")
......
......@@ -213,7 +213,8 @@ belle_sip_object_vptr_t belle_sip_object_t_vptr={
NULL,
_belle_sip_object_uninit,
_belle_sip_object_clone,
_belle_object_marshal
_belle_object_marshal,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
};
belle_sip_object_vptr_t *belle_sip_object_t_vptr_get(void){
......
......@@ -253,7 +253,7 @@ static struct dns_resolv_conf *resconf(belle_sip_simple_resolver_context_t *ctx)
char ip[64];
char serv[10];
int using_ipv6=FALSE;
int i;
size_t i;
belle_sip_message("Resolver is using DNS server(s):");
for(i=0;i<sizeof(ctx->resconf->nameserver)/sizeof(ctx->resconf->nameserver[0]);++i){
......@@ -455,7 +455,7 @@ static int resolver_process_data(belle_sip_simple_resolver_context_t *ctx, unsig
simulated_timeout=1;
}
if (simulated_timeout || ((revents & BELLE_SIP_EVENT_TIMEOUT) && (belle_sip_time_ms()-ctx->start_time>=timeout))) {
if (simulated_timeout || ((revents & BELLE_SIP_EVENT_TIMEOUT) && ((int)(belle_sip_time_ms()-ctx->start_time)>=timeout))) {
belle_sip_error("%s timed-out", __FUNCTION__);
notify_results(ctx);
return BELLE_SIP_STOP;
......@@ -813,7 +813,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_resolver_context_t)
BELLE_SIP_VPTR_INIT(belle_sip_resolver_context_t,belle_sip_source_t,TRUE),
(belle_sip_object_destroy_t) NULL,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
......@@ -826,7 +827,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_simple_resolver_context_t)
BELLE_SIP_VPTR_INIT(belle_sip_simple_resolver_context_t,belle_sip_resolver_context_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_simple_resolver_context_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
simple_resolver_cancel
}
......@@ -839,7 +841,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_dual_resolver_context_t)
BELLE_SIP_VPTR_INIT(belle_sip_dual_resolver_context_t,belle_sip_resolver_context_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_dual_resolver_context_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
dual_resolver_cancel
}
......@@ -852,7 +855,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_combined_resolver_context_t)
BELLE_SIP_VPTR_INIT(belle_sip_combined_resolver_context_t,belle_sip_resolver_context_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_combined_resolver_context_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
combined_resolver_cancel
}
......
......@@ -73,6 +73,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_body_handler_t)
(belle_sip_object_destroy_t) belle_sip_body_handler_destroy,
(belle_sip_object_clone_t) belle_sip_body_handler_clone,
(belle_sip_object_marshal_t) belle_sip_body_handler_marshal,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL, /* begin_transfer */
NULL, /* end_transfer */
......@@ -212,7 +213,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_memory_body_handler_t)
BELLE_SIP_VPTR_INIT(belle_sip_memory_body_handler_t,belle_sip_body_handler_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_memory_body_handler_destroy,
(belle_sip_object_clone_t)belle_sip_memory_body_handler_clone,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL,
NULL,
......@@ -408,7 +410,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_user_body_handler_t)
BELLE_SIP_VPTR_INIT(belle_sip_user_body_handler_t,belle_sip_body_handler_t,TRUE),
(belle_sip_object_destroy_t) NULL,
(belle_sip_object_clone_t)belle_sip_user_body_handler_clone,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL,
NULL,
......@@ -479,10 +482,6 @@ static int belle_sip_file_body_handler_send_chunk(belle_sip_body_handler_t *base
return BELLE_SIP_STOP;
}
size_t_ret = fread(buf, 1, to_send, f);
if (size_t_ret < 0) {
fclose(f);
return BELLE_SIP_STOP;
}
*size = size_t_ret;
fclose(f);
return (((obj->base.expected_size - offset) == *size) || (*size == 0)) ? BELLE_SIP_STOP : BELLE_SIP_CONTINUE;
......@@ -495,7 +494,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_file_body_handler_t)
BELLE_SIP_VPTR_INIT(belle_sip_file_body_handler_t,belle_sip_body_handler_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_file_body_handler_destroy,
(belle_sip_object_clone_t)belle_sip_file_body_handler_clone,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL,
NULL,
......@@ -639,7 +639,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_multipart_body_handler_t)
BELLE_SIP_VPTR_INIT(belle_sip_multipart_body_handler_t,belle_sip_body_handler_t,TRUE),
(belle_sip_object_destroy_t) belle_sip_multipart_body_handler_destroy,
(belle_sip_object_clone_t)belle_sip_multipart_body_handler_clone,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
belle_sip_multipart_body_handler_begin_transfer,
belle_sip_multipart_body_handler_end_transfer,
......
......@@ -148,7 +148,14 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_channel_t)
(belle_sip_object_destroy_t)belle_sip_channel_destroy,
NULL, /*clone*/
NULL, /*marshal*/
}
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL, /* transport */
0, /* reliable */
NULL, /* connect */
NULL, /* channel_send */
NULL, /* channel_recv */
NULL /* close */
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
static void fix_incoming_via(belle_sip_request_t *msg, const struct addrinfo* origin){
......@@ -994,7 +1001,7 @@ static void belle_sip_channel_handle_error(belle_sip_channel_t *obj){
int belle_sip_channel_notify_timeout(belle_sip_channel_t *obj){
const int too_long=60;
if (belle_sip_time_ms() - obj->last_recv_time>=(too_long * 1000)){
if ((int)(belle_sip_time_ms() - obj->last_recv_time) >= (too_long * 1000)){
belle_sip_message("A timeout related to this channel occured and no message received during last %i seconds. This channel is suspect, moving to error state",too_long);
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
return TRUE;
......
......@@ -58,7 +58,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_dialog_t)
BELLE_SIP_VPTR_INIT(belle_sip_dialog_t, belle_sip_object_t,TRUE),
(belle_sip_object_destroy_t)belle_sip_dialog_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
const char* belle_sip_dialog_state_to_string(const belle_sip_dialog_state_t state) {
......
......@@ -196,7 +196,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_ict_t)
BELLE_SIP_VPTR_INIT(belle_sip_ict_t,belle_sip_client_transaction_t,TRUE),
(belle_sip_object_destroy_t)ict_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
(void (*)(belle_sip_transaction_t*))on_ict_terminate
},
......
......@@ -173,7 +173,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_ist_t)
BELLE_SIP_VPTR_INIT(belle_sip_ist_t,belle_sip_server_transaction_t,TRUE),
(belle_sip_object_destroy_t)ist_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
(void (*)(belle_sip_transaction_t *))ist_on_terminate
},
......
......@@ -105,7 +105,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_listening_point_t)
BELLE_SIP_VPTR_INIT(belle_sip_listening_point_t, belle_sip_object_t,FALSE),
(belle_sip_object_destroy_t)belle_sip_listening_point_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL,
NULL
......@@ -210,7 +211,7 @@ void belle_sip_listening_point_set_keep_alive(belle_sip_listening_point_t *lp,in
}
int belle_sip_listening_point_get_keep_alive(const belle_sip_listening_point_t *lp) {
return lp->keep_alive_timer?belle_sip_source_get_timeout(lp->keep_alive_timer):-1;
return lp->keep_alive_timer?(int)belle_sip_source_get_timeout(lp->keep_alive_timer):-1;
}
void belle_sip_listening_point_set_channel_listener(belle_sip_listening_point_t *lp,belle_sip_channel_listener_t* channel_listener) {
......
......@@ -157,7 +157,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_nict_t)
BELLE_SIP_VPTR_INIT(belle_sip_nict_t,belle_sip_client_transaction_t,TRUE),
(belle_sip_object_destroy_t)nict_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
(void (*)(belle_sip_transaction_t *))nict_on_terminate
},
......
......@@ -103,7 +103,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_nist_t)
BELLE_SIP_VPTR_INIT(belle_sip_nist_t,belle_sip_server_transaction_t,TRUE),
(belle_sip_object_destroy_t)nist_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
(void (*)(belle_sip_transaction_t *))nist_on_terminate
},
......
......@@ -156,8 +156,10 @@ static void on_channel_state_changed(belle_sip_channel_listener_t *l, belle_sip_
BELLE_SIP_IMPLEMENT_INTERFACE_BEGIN(belle_sip_transaction_t,belle_sip_channel_listener_t)
on_channel_state_changed,
NULL,
NULL
NULL, /* on_message_headers */
NULL, /* on_message */
NULL, /* on_sending */
NULL /* on_auth_requested */
BELLE_SIP_IMPLEMENT_INTERFACE_END
BELLE_SIP_DECLARE_IMPLEMENTED_INTERFACES_1(belle_sip_transaction_t, belle_sip_channel_listener_t);
......@@ -168,6 +170,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_transaction_t)
(belle_sip_object_destroy_t) transaction_destroy,
NULL,/*no clone*/
NULL,/*no marshal*/
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL /*on_terminate*/
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
......@@ -287,10 +290,13 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_server_transaction_t)
BELLE_SIP_VPTR_INIT(belle_sip_server_transaction_t,belle_sip_transaction_t,FALSE),
(belle_sip_object_destroy_t) server_transaction_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL
}
},
NULL, /* send_new_response */
NULL /* on_request_retransmission */
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
void belle_sip_server_transaction_init(belle_sip_server_transaction_t *t, belle_sip_provider_t *prov,belle_sip_request_t *req){
......@@ -596,7 +602,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_client_transaction_t)
BELLE_SIP_VPTR_INIT(belle_sip_client_transaction_t,belle_sip_transaction_t,FALSE),
(belle_sip_object_destroy_t)client_transaction_destroy,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
NULL
},
......
......@@ -154,7 +154,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_stream_channel_t)
BELLE_SIP_VPTR_INIT(belle_sip_stream_channel_t,belle_sip_channel_t,FALSE),
(belle_sip_object_destroy_t)stream_channel_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
"TCP",
1, /*is_reliable*/
......
......@@ -51,7 +51,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_stream_listening_point_t)
BELLE_SIP_VPTR_INIT(belle_sip_stream_listening_point_t, belle_sip_listening_point_t,TRUE),
(belle_sip_object_destroy_t)belle_sip_stream_listening_point_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
"TCP",
stream_create_channel
......
......@@ -455,7 +455,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_tls_channel_t)
BELLE_SIP_VPTR_INIT(belle_sip_tls_channel_t,belle_sip_stream_channel_t,FALSE),
(belle_sip_object_destroy_t)tls_channel_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
"TLS",
1, /*is_reliable*/
......
......@@ -38,7 +38,8 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_tls_listening_point_t)
BELLE_SIP_VPTR_INIT(belle_sip_tls_listening_point_t, belle_sip_stream_listening_point_t,TRUE),
(belle_sip_object_destroy_t)belle_sip_tls_listening_point_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
"TLS",
tls_create_channel
......
......@@ -87,14 +87,15 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_udp_channel_t)
BELLE_SIP_VPTR_INIT(belle_sip_udp_channel_t,belle_sip_channel_t,FALSE),
(belle_sip_object_destroy_t)udp_channel_uninit,
NULL,
NULL
NULL,
BELLE_SIP_DEFAULT_BUFSIZE_HINT
},
"UDP",
0, /*is_reliable*/
udp_channel_connect,
udp_channel_send,
udp_channel_recv
/*no close method*/
udp_channel_recv,
NULL /*no close method*/
}
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment