CELIX-412: Enables -Wall -Wetra -Werror for c++ compiler
Project: http://git-wip-us.apache.org/repos/asf/celix/repo Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3514629d Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3514629d Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3514629d Branch: refs/heads/master Commit: 3514629db2ddf61038c59fc0941488877a54810f Parents: 74fe6d1 Author: Pepijn Noltes <[email protected]> Authored: Mon Oct 16 20:59:54 2017 +0200 Committer: Pepijn Noltes <[email protected]> Committed: Mon Oct 16 21:00:05 2017 +0200 ---------------------------------------------------------------------- CMakeLists.txt | 2 +- dfi/private/test/dyn_closure_tests.cpp | 8 +-- dfi/private/test/dyn_function_tests.cpp | 2 +- dfi/private/test/dyn_interface_tests.cpp | 2 +- dfi/private/test/dyn_message_tests.cpp | 2 +- dfi/private/test/dyn_type_tests.cpp | 2 +- dfi/private/test/json_rpc_tests.cpp | 8 +-- dfi/private/test/json_serializer_tests.cpp | 2 +- .../private/test/service_registry_test.cpp | 6 +- .../test/service_tracker_customizer_test.cpp | 8 +-- pubsub/deploy/CMakeLists.txt | 64 ++++++++++---------- pubsub/pubsub_admin_udp_mc/CMakeLists.txt | 54 +++++++++-------- 12 files changed, 80 insertions(+), 80 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index b6ef390..9f3023c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ IF (ANDROID) SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall ${CMAKE_C_FLAGS}") ELSE () SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 -Wall -Werror -fPIC ${CMAKE_C_FLAGS}") #TODO add -Wextra - SET(CMAKE_CXX_FLAGS "-std=c++11") #TODO -Wall -Wextra -Werror does not yet work with the unit tests + SET(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Werror") #TODO -Weffc++ SET(CMAKE_C_FLAGS_DEBUG "-g -DDEBUG") SET(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG") ENDIF() http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/dyn_closure_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/dyn_closure_tests.cpp b/dfi/private/test/dyn_closure_tests.cpp index 5f13de4..9c1abe6 100644 --- a/dfi/private/test/dyn_closure_tests.cpp +++ b/dfi/private/test/dyn_closure_tests.cpp @@ -32,7 +32,7 @@ extern "C" { static int g_count; -static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { +static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); @@ -43,7 +43,7 @@ static void stdLog(void *handle, int level, const char *file, int line, const ch } #define EXAMPLE1_DESCRIPTOR "example(III)I" -static void example1_binding(void *userData, void* args[], void *out) { +static void example1_binding(void*, void* args[], void *out) { int32_t a = *((int32_t *)args[0]); int32_t b = *((int32_t *)args[1]); int32_t c = *((int32_t *)args[2]); @@ -58,7 +58,7 @@ struct example2_arg2 { double val2; double val3; }; -void example2_binding(void *userData, void* args[], void *out) { +void example2_binding(void*, void* args[], void *out) { int32_t a = *((int32_t *)args[0]); struct example2_arg2 b = *((struct example2_arg2 *)args[1]); int32_t c = *((int32_t *)args[2]); @@ -75,7 +75,7 @@ struct example3_ret { int32_t min; }; -static void example3_binding(void *userData, void* args[], void *out) { +static void example3_binding(void*, void* args[], void *out) { int32_t a = *((int32_t *)args[0]); int32_t b = *((int32_t *)args[1]); int32_t c = *((int32_t *)args[2]); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/dyn_function_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/dyn_function_tests.cpp b/dfi/private/test/dyn_function_tests.cpp index 34d7116..58ad662 100644 --- a/dfi/private/test/dyn_function_tests.cpp +++ b/dfi/private/test/dyn_function_tests.cpp @@ -30,7 +30,7 @@ extern "C" { #include "dyn_common.h" #include "dyn_function.h" - static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { + static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/dyn_interface_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/dyn_interface_tests.cpp b/dfi/private/test/dyn_interface_tests.cpp index ea578f2..df9752f 100644 --- a/dfi/private/test/dyn_interface_tests.cpp +++ b/dfi/private/test/dyn_interface_tests.cpp @@ -35,7 +35,7 @@ extern "C" { #include "fmemopen.h" #endif - static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { + static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/dyn_message_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/dyn_message_tests.cpp b/dfi/private/test/dyn_message_tests.cpp index f3bbafd..e310537 100644 --- a/dfi/private/test/dyn_message_tests.cpp +++ b/dfi/private/test/dyn_message_tests.cpp @@ -36,7 +36,7 @@ extern "C" { #include "fmemopen.h" #endif -static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { +static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/dyn_type_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/dyn_type_tests.cpp b/dfi/private/test/dyn_type_tests.cpp index e65c2b9..52f9537 100644 --- a/dfi/private/test/dyn_type_tests.cpp +++ b/dfi/private/test/dyn_type_tests.cpp @@ -25,7 +25,7 @@ extern "C" { #include "dyn_common.h" #include "dyn_type.h" - static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { + static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/json_rpc_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/json_rpc_tests.cpp b/dfi/private/test/json_rpc_tests.cpp index 10097ec..bff582e 100644 --- a/dfi/private/test/json_rpc_tests.cpp +++ b/dfi/private/test/json_rpc_tests.cpp @@ -35,7 +35,7 @@ extern "C" { #include "json_serializer.h" #include "json_rpc.h" -static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { +static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); @@ -92,12 +92,12 @@ static void stdLog(void *handle, int level, const char *file, int line, const ch dynFunction_destroy(dynFunc); } - int add(void *handle, double a, double b, double *result) { + int add(void*, double a, double b, double *result) { *result = a + b; return 0; } - int getName_example4(void *handle, char** result) { + int getName_example4(void*, char** result) { *result = strdup("allocatedInFunction"); return 0; } @@ -118,7 +118,7 @@ static void stdLog(void *handle, int level, const char *file, int line, const ch }; - int stats(void *handle, struct tst_seq input, struct tst_StatsResult **out) { + int stats(void*, struct tst_seq input, struct tst_StatsResult **out) { assert(out != NULL); assert(*out == NULL); double total = 0.0; http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/dfi/private/test/json_serializer_tests.cpp ---------------------------------------------------------------------- diff --git a/dfi/private/test/json_serializer_tests.cpp b/dfi/private/test/json_serializer_tests.cpp index bd65b23..a52e4cc 100644 --- a/dfi/private/test/json_serializer_tests.cpp +++ b/dfi/private/test/json_serializer_tests.cpp @@ -32,7 +32,7 @@ extern "C" { #include "dyn_type.h" #include "json_serializer.h" -static void stdLog(void *handle, int level, const char *file, int line, const char *msg, ...) { +static void stdLog(void*, int level, const char *file, int line, const char *msg, ...) { va_list ap; const char *levels[5] = {"NIL", "ERROR", "WARNING", "INFO", "DEBUG"}; fprintf(stderr, "%s: FILE:%s, LINE:%i, MSG:",levels[level], file, line); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/framework/private/test/service_registry_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/service_registry_test.cpp b/framework/private/test/service_registry_test.cpp index e65c707..5adf4f6 100644 --- a/framework/private/test/service_registry_test.cpp +++ b/framework/private/test/service_registry_test.cpp @@ -694,7 +694,7 @@ TEST(service_registry, ungetServiceReference){ count = 5; const char* mod_name = "mod name"; - const char* srv_name = "srv name"; + //const char* srv_name = "srv name"; mock().expectOneCall("serviceReference_getUsageCount") .withParameter("reference", reference) .withOutputParameterReturning("count", &count, sizeof(count)); @@ -749,8 +749,8 @@ TEST(service_registry, clearReferencesFor_1){ service_registration_pt registration = (service_registration_pt) 0x10; service_reference_pt reference = (service_reference_pt) 0x40; bundle_pt bundle = (bundle_pt) 0x70; - module_pt module = (module_pt) 0x80; - const char* modName = "mod name"; + //module_pt module = (module_pt) 0x80; + //const char* modName = "mod name"; hash_map_pt references = hashMap_create(NULL, NULL, NULL, NULL); hashMap_put(references, registration, reference); http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/framework/private/test/service_tracker_customizer_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/service_tracker_customizer_test.cpp b/framework/private/test/service_tracker_customizer_test.cpp index 2c3c4f0..a80cd29 100644 --- a/framework/private/test/service_tracker_customizer_test.cpp +++ b/framework/private/test/service_tracker_customizer_test.cpp @@ -56,16 +56,16 @@ TEST_GROUP(service_tracker_customizer) { }; extern "C" { - celix_status_t serviceTrackerCustomizerTest_addingService(void * handle, service_reference_pt reference, void **service) { + celix_status_t serviceTrackerCustomizerTest_addingService(void*, service_reference_pt, void** ) { return CELIX_SUCCESS; } - celix_status_t serviceTrackerCustomizerTest_addedService(void * handle, service_reference_pt reference, void * service) { + celix_status_t serviceTrackerCustomizerTest_addedService(void*, service_reference_pt, void*) { return CELIX_SUCCESS; } - celix_status_t serviceTrackerCustomizerTest_modifiedService(void * handle, service_reference_pt reference, void * service) { + celix_status_t serviceTrackerCustomizerTest_modifiedService(void*, service_reference_pt, void*) { return CELIX_SUCCESS; } - celix_status_t serviceTrackerCustomizerTest_removedService(void * handle, service_reference_pt reference, void * service) { + celix_status_t serviceTrackerCustomizerTest_removedService(void*, service_reference_pt, void*) { return CELIX_SUCCESS; } } http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/pubsub/deploy/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/deploy/CMakeLists.txt b/pubsub/deploy/CMakeLists.txt index 85b49d2..a787c2b 100644 --- a/pubsub/deploy/CMakeLists.txt +++ b/pubsub/deploy/CMakeLists.txt @@ -19,58 +19,56 @@ find_program(ETCD_CMD NAMES etcd) find_program(XTERM_CMD NAMES xterm) # UDP Multicast -add_deploy("pubsub_publisher_udp_mc" - GROUP "pubsub" - BUNDLES - shell - shell_tui +add_deploy("pubsub_publisher_udp_mc" + GROUP "pubsub" + BUNDLES + shell + shell_tui org.apache.celix.pubsub_serializer.PubSubSerializerJson org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_publisher.PoiPublisher - org.apache.celix.pubsub_publisher.PoiPublisher2 + org.apache.celix.pubsub_topology_manager.PubSubTopologyManager + org.apache.celix.pubsub_admin.PubSubAdminUdpMc + org.apache.celix.pubsub_publisher.PoiPublisher + org.apache.celix.pubsub_publisher.PoiPublisher2 ) -add_deploy("pubsub_subscriber_udp_mc" - GROUP "pubsub" - BUNDLES - shell - shell_tui +add_deploy("pubsub_subscriber_udp_mc" + GROUP "pubsub" + BUNDLES + shell + shell_tui org.apache.celix.pubsub_serializer.PubSubSerializerJson org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_subscriber.PoiSubscriber + org.apache.celix.pubsub_topology_manager.PubSubTopologyManager + org.apache.celix.pubsub_admin.PubSubAdminUdpMc + org.apache.celix.pubsub_subscriber.PoiSubscriber ) -add_deploy("pubsub_subscriber2_udp_mc" - GROUP "pubsub" - BUNDLES - shell - shell_tui +add_deploy("pubsub_subscriber2_udp_mc" + GROUP "pubsub" + BUNDLES + shell + shell_tui org.apache.celix.pubsub_serializer.PubSubSerializerJson org.apache.celix.pubsub_discovery.etcd.PubsubDiscovery - org.apache.celix.pubsub_topology_manager.PubSubTopologyManager - org.apache.celix.pubsub_admin.PubSubAdminUdpMc - org.apache.celix.pubsub_subscriber.PoiSubscriber + org.apache.celix.pubsub_topology_manager.PubSubTopologyManager + org.apache.celix.pubsub_admin.PubSubAdminUdpMc + org.apache.celix.pubsub_subscriber.PoiSubscriber ) if (ETCD_CMD AND XTERM_CMD) #Runtime starting a publish and subscriber for udp mc add_runtime(pubsub_rt_upd_mc - NAME udp_mc - GROUP pubsub - DEPLOYMENTS + NAME udp_mc + GROUP pubsub + DEPLOYMENTS pubsub_publisher_udp_mc pubsub_subscriber_udp_mc pubsub_subscriber2_udp_mc - COMMANDS + COMMANDS etcd - USE_TERM - ) -else () - message(WARNING "Cannot create runtime for pubsub because etcd and/or xterm is not installed") + USE_TERM + ) endif () if (BUILD_PUBSUB_PSA_ZMQ) http://git-wip-us.apache.org/repos/asf/celix/blob/3514629d/pubsub/pubsub_admin_udp_mc/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/pubsub/pubsub_admin_udp_mc/CMakeLists.txt b/pubsub/pubsub_admin_udp_mc/CMakeLists.txt index 9e3f063..9574607 100644 --- a/pubsub/pubsub_admin_udp_mc/CMakeLists.txt +++ b/pubsub/pubsub_admin_udp_mc/CMakeLists.txt @@ -15,34 +15,36 @@ # specific language governing permissions and limitations # under the License. -find_package(Jansson REQUIRED) +if (BUILD_PUBSUB_PSA_UDP_MC) + find_package(Jansson REQUIRED) -include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") -include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include") -include_directories("${PROJECT_SOURCE_DIR}/dfi/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") -include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") -include_directories("private/include") -include_directories("public/include") -include_directories("${JANSSON_INCLUDE_DIR}") + include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") + include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include") + include_directories("${PROJECT_SOURCE_DIR}/dfi/public/include") + include_directories("${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/include") + include_directories("${PROJECT_SOURCE_DIR}/pubsub/api/pubsub") + include_directories("private/include") + include_directories("public/include") + include_directories("${JANSSON_INCLUDE_DIR}") -add_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc - BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_udp_multicast" - VERSION "1.0.0" - SOURCES - private/src/psa_activator.c - private/src/pubsub_admin_impl.c - private/src/topic_subscription.c - private/src/topic_publication.c - private/src/large_udp.c - ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_endpoint.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_admin_match.c - ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c -) + add_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc + BUNDLE_SYMBOLICNAME "apache_celix_pubsub_admin_udp_multicast" + VERSION "1.0.0" + SOURCES + private/src/psa_activator.c + private/src/pubsub_admin_impl.c + private/src/topic_subscription.c + private/src/topic_publication.c + private/src/large_udp.c + ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c + ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_endpoint.c + ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_admin_match.c + ${PROJECT_SOURCE_DIR}/pubsub/pubsub_common/public/src/pubsub_utils.c + ) -set_target_properties(org.apache.celix.pubsub_admin.PubSubAdminUdpMc PROPERTIES INSTALL_RPATH "$ORIGIN") -target_link_libraries(org.apache.celix.pubsub_admin.PubSubAdminUdpMc celix_framework celix_utils celix_dfi) + set_target_properties(org.apache.celix.pubsub_admin.PubSubAdminUdpMc PROPERTIES INSTALL_RPATH "$ORIGIN") + target_link_libraries(org.apache.celix.pubsub_admin.PubSubAdminUdpMc celix_framework celix_utils celix_dfi) -install_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc) + install_bundle(org.apache.celix.pubsub_admin.PubSubAdminUdpMc) +endif()
