Skip to content

Commit

Permalink
mavlink update to latest and enable address-of-packed-member warning
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar authored and bkueng committed Mar 14, 2019
1 parent f8ae8ba commit f3533d3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 0 additions & 5 deletions cmake/px4_add_common_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ function(px4_add_common_flags)
add_compile_options(
-Qunused-arguments

-Wno-address-of-packed-member # TODO: fix and enable (mavlink, etc)
-Wno-unknown-warning-option
-Wno-unused-const-variable
-Wno-varargs
Expand All @@ -113,10 +112,6 @@ function(px4_add_common_flags)
add_compile_options(-fdiagnostics-color=always)
endif()

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9)
add_compile_options(-Wno-address-of-packed-member) # TODO: fix and enable (mavlink, etc)
endif()

add_compile_options(
-fno-builtin-printf
-fno-strength-reduce
Expand Down
10 changes: 7 additions & 3 deletions src/modules/mavlink/mavlink_parameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ MavlinkParametersManager::send_uavcan()
msg.param_value = value.real_value;

} else {
int32_t val;
val = (int32_t)value.int_value;
int32_t val = (int32_t)value.int_value;
memcpy(&msg.param_value, &val, sizeof(int32_t));
msg.param_type = MAVLINK_TYPE_INT32_T;
}
Expand Down Expand Up @@ -545,14 +544,19 @@ MavlinkParametersManager::send_param(param_t param, int component_id)
* get param value, since MAVLink encodes float and int params in the same
* space during transmission, copy param onto float val_buf
*/
if (param_get(param, &msg.param_value) != OK) {
float param_value{};

if (param_get(param, &param_value) != OK) {
return 2;
}

msg.param_value = param_value;

msg.param_count = param_count_used();
msg.param_index = param_get_used_index(param);

#if defined(__GNUC__) && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
/*
Expand Down

0 comments on commit f3533d3

Please sign in to comment.