diff --git a/cmake/OS_Detection.cmake b/cmake/OS_Detection.cmake index 91be8d2875b0632188abd79bccef5eeb843a1d35..66f1e57092b61345403a1976454c44da5564a6ad 100644 --- a/cmake/OS_Detection.cmake +++ b/cmake/OS_Detection.cmake @@ -92,15 +92,16 @@ if(UNIX) add_definitions ("-DDAP_OS_LINUX") endif() + set(CFLAGS_WARNINGS "-Wall -Wextra -Werror=sign-compare -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable") if (LINUX) set(CCOPT_SYSTEM "") set(LDOPT_SYSTEM "") if(DAP_DEBUG) - set(_CCOPT "-DDAP_DEBUG -Wall -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -pg -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing") + set(_CCOPT "-DDAP_DEBUG ${CFLAGS_WARNINGS} -pg -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing") set(_LOPT "-pg") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") else() - set(_CCOPT "-Wno-deprecated-declarations -Wno-unused-command-line-argument -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all -std=gnu11") + set(_CCOPT "${CFLAGS_WARNINGS} -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all -std=gnu11") if(NOT DAP_DBG_INFO) set(_CCOPT "${_CCOPT} -Wl,--strip-all") endif() @@ -108,7 +109,7 @@ if(UNIX) elseif (DARWIN) set(CCOPT_SYSTEM "-L/usr/local/lib -L/opt/homebrew/lib -I/opt/homebrew/include -I/usr/local/include") set(LDOPT_SYSTEM "-L/usr/local/lib -L/opt/homebrew/lib -lintl -flat_namespace") - set(CCFLAGS_COMMON "-std=c11 -Wall -Wno-address-of-packed-member -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-parameter") + set(CCFLAGS_COMMON "-std=c11 ${CFLAGS_WARNINGS}") if(DAP_DEBUG) set(_CCOPT "${CCOPT_SYSTEM} -DDAP_DEBUG ${CCFLAGS_COMMON} -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing") set(_LOPT "${LDOPT_SYSTEM}") @@ -122,11 +123,11 @@ if(UNIX) set(CCOPT_SYSTEM "-L/usr/local/lib -I/usr/local/include") set(LDOPT_SYSTEM "-L/usr/local/lib") if(DAP_DEBUG) - set(_CCOPT "${CCOPT_SYSTEM} -DDAP_DEBUG -Wall -Wno-unused-command-line-argument -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -pg -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing") + set(_CCOPT "${CCOPT_SYSTEM} -DDAP_DEBUG ${CFLAGS_WARNINGS} -pg -g3 -ggdb -fno-eliminate-unused-debug-symbols -fno-strict-aliasing") set(_LOPT "-pg ${LDOPT_SYSTEM} ") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg") else() - set(_CCOPT "${CCOPT_SYSTEM} -Wno-deprecated-declarations -Wno-unused-command-line-argument -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -std=gnu11") + set(_CCOPT "${CCOPT_SYSTEM} ${CFLAGS_WARNINGS} -O3 -fPIC -fno-strict-aliasing -fno-ident -ffast-math -ftree-vectorize -fno-asynchronous-unwind-tables -ffunction-sections -std=gnu11") set(_LOPT "${LDOPT_SYSTEM} ") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") endif() @@ -161,11 +162,11 @@ if(WIN32) set(LDOPT_SYSTEM "") if(DAP_DEBUG) - set(_CCOPT "-mconsole -static -Wall -std=gnu11 -Wextra -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -g3 -ggdb -fno-strict-aliasing -fno-eliminate-unused-debug-symbols -pg") + set(_CCOPT "-mconsole -static -std=gnu11 ${CFLAGS_WARNINGS} -g3 -ggdb -fno-strict-aliasing -fno-eliminate-unused-debug-symbols -pg") set(_LOPT "-mconsole -static -pg") else() add_definitions ("-DNDEBUG") - set(_CCOPT "-static -std=gnu11 -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unused-function -Wno-implicit-fallthrough -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -O3 -fno-ident -ffast-math -fno-strict-aliasing -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all") + set(_CCOPT "-static -std=gnu11 ${CFLAGS_WARNINGS} -O3 -fno-ident -ffast-math -fno-strict-aliasing -ftree-vectorize -mfpmath=sse -mmmx -msse2 -fno-asynchronous-unwind-tables -ffunction-sections -Wl,--gc-sections -Wl,--strip-all") endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_CCOPT} ") diff --git a/modules/global-db/dap_chain_global_db_driver_mdbx.c b/modules/global-db/dap_chain_global_db_driver_mdbx.c index ddc692798bd1388b2140eafb4a3c009d8fe05d14..62090f899a9f418aa35cd5c0d77dac569baf49e4 100644 --- a/modules/global-db/dap_chain_global_db_driver_mdbx.c +++ b/modules/global-db/dap_chain_global_db_driver_mdbx.c @@ -227,7 +227,7 @@ MDBX_val l_key_iov, l_data_iov; /* So , at this point we are going to create (if not exist) 'table' for new group */ - if ( (l_rc = strlen(a_group)) > DAP_GLOBAL_DB_GROUP_NAME_SIZE_MAX ) /* Check length of the group name */ + if ( (l_rc = strlen(a_group)) >(int) DAP_GLOBAL_DB_GROUP_NAME_SIZE_MAX ) /* Check length of the group name */ return log_it(L_ERROR, "Group name '%s' is too long (%d>%lu)", a_group, l_rc, DAP_GLOBAL_DB_GROUP_NAME_SIZE_MAX), NULL; if ( !(l_db_ctx = DAP_NEW_Z(dap_db_ctx_t)) ) /* Allocate zeroed memory for new DB context */ @@ -1174,7 +1174,8 @@ struct __record_suffix__ *l_suff; static dap_store_obj_t *s_db_mdbx_read_store_obj(const char *a_group, const char *a_key, size_t *a_count_out) { -int l_rc, l_rc2, l_count_out; +int l_rc, l_rc2; +uint64_t l_count_out; dap_db_ctx_t *l_db_ctx; dap_store_obj_t *l_obj, *l_obj_arr; MDBX_val l_key, l_data; @@ -1249,7 +1250,7 @@ struct __record_suffix__ *l_suff; else if ( !l_stat.ms_entries ) /* Nothing to retrieve , table contains no record */ break; - if ( !(l_count_out = min(l_stat.ms_entries, l_count_out)) ) { + if ( !( l_count_out = min(l_stat.ms_entries, l_count_out)) ) { debug_if(g_dap_global_db_debug_more, L_WARNING, "No object (-s) to be retrieved from the group '%s'", a_group); break; } diff --git a/modules/global-db/dap_global_db.c b/modules/global-db/dap_global_db.c index 11aebae4efaa70903f30a83f701c0785a3572b5f..7d25fe500b502f86547e801d810a6c6bd2527c15 100644 --- a/modules/global-db/dap_global_db.c +++ b/modules/global-db/dap_global_db.c @@ -581,7 +581,7 @@ static bool s_msg_opcode_get_all(struct queue_io_msg * a_msg) // Form objs from store_objs if(l_store_objs){ l_objs = DAP_NEW_Z_SIZE(dap_global_db_obj_t,sizeof(dap_global_db_obj_t)*l_values_count); - for(int i = 0; i < l_values_count; i++){ + for(size_t i = 0; i < l_values_count; i++){ l_objs[i].id = l_store_objs[i].id; l_objs[i].is_pinned = l_store_objs[i].flags & RECORD_PINNED; l_objs[i].key = dap_strdup(l_store_objs[i].key); diff --git a/modules/net/dap_chain_net.c b/modules/net/dap_chain_net.c index 0aed37c104696e4d58758baaec2e4bb8b6398219..b3d28dc5ffbc84c68f6ff44fb260ae9ed754bdc9 100644 --- a/modules/net/dap_chain_net.c +++ b/modules/net/dap_chain_net.c @@ -3577,7 +3577,7 @@ uint256_t dap_chain_net_get_tx_total_value(dap_chain_net_t * a_net, dap_chain_da int l_tx_prev_out_index = l_in_item->header.tx_out_prev_idx; dap_chain_tx_out_t * l_tx_prev_out =(dap_chain_tx_out_t *) dap_chain_datum_tx_item_get(l_tx_prev,&l_tx_prev_out_index, TX_ITEM_TYPE_OUT,NULL); - if( l_tx_prev_out_index == l_in_item->header.tx_out_prev_idx && l_tx_prev_out){ + if( l_tx_prev_out_index == (int) l_in_item->header.tx_out_prev_idx && l_tx_prev_out){ uint256_t l_in_value = l_tx_prev_out->header.value; if(SUM_256_256(l_in_value,l_ret, &l_ret )!= 0) log_it(L_ERROR, "Overflow on inputs values calculation (summing)"); diff --git a/modules/service/vpn/dap_chain_net_vpn_client.c b/modules/service/vpn/dap_chain_net_vpn_client.c index 2daa2932d9cd147aa6c2ad9ebe768dfeb5fe6e93..acc3710bb286e01d0637c45c97753086c8163abd 100644 --- a/modules/service/vpn/dap_chain_net_vpn_client.c +++ b/modules/service/vpn/dap_chain_net_vpn_client.c @@ -487,9 +487,9 @@ char *dap_chain_net_vpn_client_check_result(dap_chain_net_t *a_net, const char* int dap_chain_net_vpn_client_check(dap_chain_net_t *a_net, const char *a_ipv4_str, const char *a_ipv6_str, int a_port, size_t a_data_size_to_send, size_t a_data_size_to_recv, int a_timeout_test_ms) { // default 10k - if(a_data_size_to_send==-1) + if(a_data_size_to_send== (size_t) -1) a_data_size_to_send = 10240; - if(a_data_size_to_recv==-1) + if(a_data_size_to_recv== (size_t) -1) a_data_size_to_recv = 10240; // default 10 sec = 10000 ms if(a_timeout_test_ms==-1)