From d68bb3b678e867c69a99f97e26b72715e2b8e57f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 18 May 2020 21:42:17 +0200 Subject: build: Add support for GCC 10 GCC 10 defaults to -fno-common, so some variables that were defined in the headers needed to be declared "extern". The GCC 10 static analyzer can now be invoked using the DebugAnalyzer build option. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- CMakeLists.txt | 6 ++++-- src/ipcpd/broadcast/main.c | 2 ++ src/ipcpd/eth/eth.c | 2 ++ src/ipcpd/ipcp.h | 2 +- src/ipcpd/local/main.c | 2 ++ src/ipcpd/udp/main.c | 2 ++ src/ipcpd/unicast/dir.c | 1 + src/ipcpd/unicast/main.c | 2 ++ src/ipcpd/unicast/pol/alternate_pff.h | 2 +- src/ipcpd/unicast/pol/flat.h | 2 +- src/ipcpd/unicast/pol/link_state.h | 2 +- src/ipcpd/unicast/pol/multipath_pff.h | 2 +- src/ipcpd/unicast/pol/simple_pff.h | 2 +- 13 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 535a0540..a8310274 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ include(GNUInstallDirs) set(PACKAGE_VERSION_MAJOR 0) set(PACKAGE_VERSION_MINOR 17) -set(PACKAGE_VERSION_PATCH 4) +set(PACKAGE_VERSION_PATCH 5) set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") @@ -20,7 +20,7 @@ set(PACKAGE_VERSION if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING - "Build type (Release, Debug, DebugASan, DebugTSan, DebugLSan)" FORCE) + "Build type (Release, Debug, DebugASan, DebugTSan, DebugLSan, DebugAnalyzer)" FORCE) endif() if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) @@ -98,6 +98,8 @@ elseif (CMAKE_BUILD_TYPE STREQUAL "DebugTSan") test_and_set_c_compiler_flag_global(-fsanitize=thread) elseif (CMAKE_BUILD_TYPE STREQUAL "DebugLSan") test_and_set_c_compiler_flag_global(-fsanitize=leak) +elseif (CMAKE_BUILD_TYPE STREQUAL "DebugAnalyzer") + test_and_set_c_compiler_flag_global(-fanalyzer) endif () configure_file("${CMAKE_CURRENT_SOURCE_DIR}/ouroboros-dev.pc.in" diff --git a/src/ipcpd/broadcast/main.c b/src/ipcpd/broadcast/main.c index 120b2bf1..fd2c32dd 100644 --- a/src/ipcpd/broadcast/main.c +++ b/src/ipcpd/broadcast/main.c @@ -53,6 +53,8 @@ #define THIS_TYPE IPCP_BROADCAST +struct ipcp ipcpi; + static int initialize_components(const struct ipcp_config * conf) { ipcpi.layer_name = strdup(conf->layer_info.layer_name); diff --git a/src/ipcpd/eth/eth.c b/src/ipcpd/eth/eth.c index 6b17912b..618ba44f 100644 --- a/src/ipcpd/eth/eth.c +++ b/src/ipcpd/eth/eth.c @@ -145,6 +145,8 @@ #define NAME_QUERY_REQ 2 #define NAME_QUERY_REPLY 3 +struct ipcp ipcpi; + struct mgmt_msg { #if defined(BUILD_ETH_DIX) uint16_t seid; diff --git a/src/ipcpd/ipcp.h b/src/ipcpd/ipcp.h index 02c74f50..84e0386a 100644 --- a/src/ipcpd/ipcp.h +++ b/src/ipcpd/ipcp.h @@ -79,7 +79,7 @@ struct ipcp_ops { #define ipcp_dir_hash_strlen() (hash_len(ipcpi.dir_hash_algo) * 2) #define ipcp_dir_hash_len() (hash_len(ipcpi.dir_hash_algo)) -struct ipcp { +extern struct ipcp { pid_t irmd_pid; char * name; diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c index fcf51626..48c2f67b 100644 --- a/src/ipcpd/local/main.c +++ b/src/ipcpd/local/main.c @@ -51,6 +51,8 @@ #define THIS_TYPE IPCP_LOCAL #define ALLOC_TIMEOUT 10 /* ms */ +struct ipcp ipcpi; + struct { struct shim_data * shim_data; diff --git a/src/ipcpd/udp/main.c b/src/ipcpd/udp/main.c index 04c21a8b..c59ea36d 100644 --- a/src/ipcpd/udp/main.c +++ b/src/ipcpd/udp/main.c @@ -77,6 +77,8 @@ #define MGMT_FRAME_SIZE (sizeof(struct mgmt_msg)) #define MGMT_FRAME_BUF_SIZE 2048 +struct ipcp ipcpi; + /* Keep order for alignment. */ struct mgmt_msg { uint32_t eid; diff --git a/src/ipcpd/unicast/dir.c b/src/ipcpd/unicast/dir.c index 43ee94f0..b99380fe 100644 --- a/src/ipcpd/unicast/dir.c +++ b/src/ipcpd/unicast/dir.c @@ -45,6 +45,7 @@ #define KAD_B (hash_len(ipcpi.dir_hash_algo) * CHAR_BIT) +struct ipcp icpci; struct dht * dht; int dir_init(void) diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c index 43052209..0ab37d25 100644 --- a/src/ipcpd/unicast/main.c +++ b/src/ipcpd/unicast/main.c @@ -55,6 +55,8 @@ #define THIS_TYPE IPCP_UNICAST +struct ipcp ipcpi; + static int initialize_components(const struct ipcp_config * conf) { ipcpi.layer_name = strdup(conf->layer_info.layer_name); diff --git a/src/ipcpd/unicast/pol/alternate_pff.h b/src/ipcpd/unicast/pol/alternate_pff.h index 5e5fca3d..b3d9c83c 100644 --- a/src/ipcpd/unicast/pol/alternate_pff.h +++ b/src/ipcpd/unicast/pol/alternate_pff.h @@ -56,6 +56,6 @@ int alternate_flow_state_change(struct pff_i * pff_i, int fd, bool up); -struct pol_pff_ops alternate_pff_ops; +extern struct pol_pff_ops alternate_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_ALTERNATE_PFF_H */ diff --git a/src/ipcpd/unicast/pol/flat.h b/src/ipcpd/unicast/pol/flat.h index 54460bb3..a542d7b7 100644 --- a/src/ipcpd/unicast/pol/flat.h +++ b/src/ipcpd/unicast/pol/flat.h @@ -31,6 +31,6 @@ int flat_fini(void); uint64_t flat_address(void); -struct pol_addr_auth_ops flat_ops; +extern struct pol_addr_auth_ops flat_ops; #endif /* OUROBOROS_IPCPD_UNICAST_FLAT_H */ diff --git a/src/ipcpd/unicast/pol/link_state.h b/src/ipcpd/unicast/pol/link_state.h index 9d4858e1..9a1ada1b 100644 --- a/src/ipcpd/unicast/pol/link_state.h +++ b/src/ipcpd/unicast/pol/link_state.h @@ -36,6 +36,6 @@ struct routing_i * link_state_routing_i_create(struct pff * pff); void link_state_routing_i_destroy(struct routing_i * instance); -struct pol_routing_ops link_state_ops; +extern struct pol_routing_ops link_state_ops; #endif /* OUROBOROS_IPCPD_UNICAST_POL_LINK_STATE_H */ diff --git a/src/ipcpd/unicast/pol/multipath_pff.h b/src/ipcpd/unicast/pol/multipath_pff.h index a8ee088f..ecbb664a 100644 --- a/src/ipcpd/unicast/pol/multipath_pff.h +++ b/src/ipcpd/unicast/pol/multipath_pff.h @@ -53,6 +53,6 @@ void multipath_pff_flush(struct pff_i * pff_i); int multipath_pff_nhop(struct pff_i * pff_i, uint64_t addr); -struct pol_pff_ops multipath_pff_ops; +extern struct pol_pff_ops multipath_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_MULTIPATH_PFF_H */ diff --git a/src/ipcpd/unicast/pol/simple_pff.h b/src/ipcpd/unicast/pol/simple_pff.h index 2dfce45c..5c972347 100644 --- a/src/ipcpd/unicast/pol/simple_pff.h +++ b/src/ipcpd/unicast/pol/simple_pff.h @@ -52,6 +52,6 @@ void simple_pff_flush(struct pff_i * pff_i); int simple_pff_nhop(struct pff_i * pff_i, uint64_t addr); -struct pol_pff_ops simple_pff_ops; +extern struct pol_pff_ops simple_pff_ops; #endif /* OUROBOROS_IPCPD_UNICAST_SIMPLE_PFF_H */ -- cgit v1.2.3