From 535d30cc9973dd50ad1dca362e74b5cffbefb37f Mon Sep 17 00:00:00 2001 From: Niklas Fischer Date: Thu, 5 May 2016 12:17:56 +0200 Subject: [PATCH 1/3] rename "test" to "tests" target The use of the name "test" for the test target causes a warning when cmake is invoked: CMake Warning (dev) at deps/drive-sdk/CMakeLists.txt:31 (add_custom_target): Policy CMP0037 is not set: Target names should not be reserved and should match a validity pattern. Run "cmake --help-policy CMP0037" for policy details. Use the cmake_policy command to set the policy and suppress this warning. The target name "test" is reserved or not valid for certain CMake features, such as generator expressions, and may result in undefined behavior. This warning is for project developers. Use -Wno-dev to suppress it. By renaming the "test" target to "tests", we can avoid the warning --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f0df49..9983cd0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,4 +28,4 @@ if (BUILD_EXAMPLES) endif () # CTest is flaky - Create a target to run our test suite directly -add_custom_target(test COMMAND ${PROJECT_BINARY_DIR}/test/Test) +add_custom_target(tests COMMAND ${PROJECT_BINARY_DIR}/test/Test) From 5057f4b8c5749009958b8e3a6dbeff079dd1ba2b Mon Sep 17 00:00:00 2001 From: Niklas Fischer Date: Thu, 5 May 2016 12:40:42 +0200 Subject: [PATCH 2/3] fix clang compilation warning (interactive function missing) drive-sdk/examples/vehicle-tool/vehicle_tool.c:159:2: warning: implicit declaration of function 'interactive' is invalid in C99 [-Wimplicit-function-declaration] interactive(opt_src, opt_dst, opt_dst_type, opt_psm); by declaring the interactive function in vehicle_tool.c --- examples/vehicle-tool/vehicle_tool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/vehicle-tool/vehicle_tool.c b/examples/vehicle-tool/vehicle_tool.c index c5ff73e..8015c08 100644 --- a/examples/vehicle-tool/vehicle_tool.c +++ b/examples/vehicle-tool/vehicle_tool.c @@ -138,6 +138,9 @@ static GOptionEntry options[] = { { NULL }, }; +int interactive(const char *src, const char *dst, + const char *dst_type, int psm); + int main(int argc, char *argv[]) { GOptionContext *context; From fc4f948f7908e84fb39e0250b1eb79a017eedc09 Mon Sep 17 00:00:00 2001 From: Niklas Fischer Date: Thu, 5 May 2016 12:43:31 +0200 Subject: [PATCH 3/3] fix clang compilation waring (sizeof char*) drive-sdk/examples/vehicle-tool/vehicle_cmd.c:668:62: warning: 'strncmp' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess] if (strncmp(name, effects_by_name[i], sizeof(effects_by_name[i])) == 0) { and examples/vehicle-tool/vehicle_cmd.c:796:65: warning: 'strncmp' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess] if (strncmp(name, turn_types_by_name[i], sizeof(turn_types_by_name[i])) == 0) { by using strlen instead of sizeof --- examples/vehicle-tool/vehicle_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/vehicle-tool/vehicle_cmd.c b/examples/vehicle-tool/vehicle_cmd.c index 172a922..e8e1f8b 100644 --- a/examples/vehicle-tool/vehicle_cmd.c +++ b/examples/vehicle-tool/vehicle_cmd.c @@ -665,7 +665,7 @@ anki_vehicle_light_effect_t get_effect_by_name(const char *name) uint8_t count = sizeof(effects_by_name)/sizeof(effects_by_name[0]); for (i = 0; i < count; i++) { - if (strncmp(name, effects_by_name[i], sizeof(effects_by_name[i])) == 0) { + if (strncmp(name, effects_by_name[i], strlen(effects_by_name[i])) == 0) { effect = i; break; } @@ -793,7 +793,7 @@ anki_vehicle_turn_type_t get_turn_type_by_name(const char *name) uint8_t count = sizeof(turn_types_by_name)/sizeof(turn_types_by_name[0]); for (i = 0; i < count; i++) { - if (strncmp(name, turn_types_by_name[i], sizeof(turn_types_by_name[i])) == 0) { + if (strncmp(name, turn_types_by_name[i], strlen(turn_types_by_name[i])) == 0) { turn_type = (anki_vehicle_turn_type_t)i; break; }