Commit 7aa6e855 authored by Daniel Agar's avatar Daniel Agar Committed by Lorenz Meier
Browse files

enable Wshadow

parent e61f517b
......@@ -541,8 +541,9 @@ function(px4_add_common_flags)
-Wall
-Werror
-Wextra
-Wpacked
-Wno-sign-compare
#-Wshadow # very verbose due to eigen
-Wshadow
-Wfloat-equal
-Wpointer-arith
-Wmissing-declarations
......
......@@ -116,7 +116,7 @@ private:
int _gpio_fd;
int _polarity;
int _mode;
int _mode;
float _activation_time;
float _interval;
float _distance;
......@@ -229,9 +229,9 @@ CameraTrigger::CameraTrigger() :
i++;
}
struct camera_trigger_s trigger = {};
struct camera_trigger_s camera_trigger = {};
_trigger_pub = orb_advertise(ORB_ID(camera_trigger), &trigger);
_trigger_pub = orb_advertise(ORB_ID(camera_trigger), &camera_trigger);
}
CameraTrigger::~CameraTrigger()
......
......@@ -383,8 +383,7 @@ PWMSim::task_main()
_armed_sub = orb_subscribe(ORB_ID(actuator_armed));
/* advertise the mixed control outputs */
actuator_outputs_s outputs;
memset(&outputs, 0, sizeof(outputs));
actuator_outputs_s outputs = {};
/* advertise the mixed control outputs, insist on the first group output */
_outputs_pub = orb_advertise(ORB_ID(actuator_outputs), &outputs);
......@@ -483,7 +482,6 @@ PWMSim::task_main()
}
/* do mixing */
actuator_outputs_s outputs = {};
num_outputs = _mixers->mix(&outputs.output[0], num_outputs, NULL);
outputs.noutputs = num_outputs;
outputs.timestamp = hrt_absolute_time();
......
......@@ -861,17 +861,17 @@ PX4FMU::fill_rc_in(uint16_t raw_rc_count,
/* set RSSI if analog RSSI input is present */
if (_analog_rc_rssi_stable) {
float rssi = ((_analog_rc_rssi_volt - 0.2f) / 3.0f) * 100.0f;
float rssi_analog = ((_analog_rc_rssi_volt - 0.2f) / 3.0f) * 100.0f;
if (rssi > 100.0f) {
rssi = 100.0f;
if (rssi_analog > 100.0f) {
rssi_analog = 100.0f;
}
if (rssi < 0.0f) {
rssi = 0.0f;
if (rssi_analog < 0.0f) {
rssi_analog = 0.0f;
}
_rc_in.rssi = rssi;
_rc_in.rssi = rssi_analog;
} else {
_rc_in.rssi = 255;
......
......@@ -35,6 +35,8 @@ px4_add_module(
MAIN snapdragon_rc_pwm
COMPILE_FLAGS
-Os
-Wno-attributes
-Wno-packed
SRCS
snapdragon_rc_pwm.cpp
DEPENDS
......
......@@ -36,6 +36,8 @@ px4_add_module(
STACK_MAIN 4096
STACK_MAX 2450
COMPILE_FLAGS
-Wno-attributes
-Wno-packed
-Os
SRCS
commander.cpp
......
......@@ -1700,7 +1700,7 @@ int commander_thread_main(int argc, char *argv[])
!armed.armed) {
bool chAirspeed = false;
bool hotplug_timeout = hrt_elapsed_time(&commander_boot_timestamp) > HOTPLUG_SENS_TIMEOUT;
hotplug_timeout = hrt_elapsed_time(&commander_boot_timestamp) > HOTPLUG_SENS_TIMEOUT;
/* Perform airspeed check only if circuit breaker is not
* engaged and it's not a rotary wing
......@@ -2874,7 +2874,7 @@ check_valid(hrt_abstime timestamp, hrt_abstime timeout, bool valid_in, bool *val
}
void
control_status_leds(vehicle_status_s *status_local, const actuator_armed_s *actuator_armed, bool changed, battery_status_s *battery)
control_status_leds(vehicle_status_s *status_local, const actuator_armed_s *actuator_armed, bool changed, battery_status_s *battery_status)
{
/* driving rgbled */
if (changed) {
......@@ -2907,9 +2907,9 @@ control_status_leds(vehicle_status_s *status_local, const actuator_armed_s *actu
/* set color */
if (status.failsafe) {
rgbled_set_color(RGBLED_COLOR_PURPLE);
} else if (battery->warning == battery_status_s::BATTERY_WARNING_LOW) {
} else if (battery_status->warning == battery_status_s::BATTERY_WARNING_LOW) {
rgbled_set_color(RGBLED_COLOR_AMBER);
} else if (battery->warning == battery_status_s::BATTERY_WARNING_CRITICAL) {
} else if (battery_status->warning == battery_status_s::BATTERY_WARNING_CRITICAL) {
rgbled_set_color(RGBLED_COLOR_RED);
} else {
if (status_flags.condition_home_position_valid && status_flags.condition_global_position_valid) {
......
......@@ -81,7 +81,7 @@ int device_prio_max = 0;
int32_t device_id_primary = 0;
static unsigned _last_mag_progress = 0;
calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t (&device_ids)[max_mags]);
calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub);
/// Data passed to calibration worker routine
typedef struct {
......@@ -117,7 +117,7 @@ int do_mag_calibration(orb_advert_t *mavlink_log_pub)
char str[30];
for (size_t i=0; i<max_mags; i++) {
for (size_t i=0; i < max_mags; i++) {
device_ids[i] = 0; // signals no mag
}
......@@ -202,7 +202,7 @@ int do_mag_calibration(orb_advert_t *mavlink_log_pub)
// Calibrate all mags at the same time
if (result == OK) {
switch (mag_calibrate_all(mavlink_log_pub, device_ids)) {
switch (mag_calibrate_all(mavlink_log_pub)) {
case calibrate_return_cancelled:
// Cancel message already displayed, we're done here
result = ERROR;
......@@ -435,7 +435,7 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
return result;
}
calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t (&device_ids)[max_mags])
calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub)
{
calibrate_return result = calibrate_return_ok;
......
......@@ -182,13 +182,13 @@ MavlinkParametersManager::handle_message(const mavlink_message_t *msg)
uint32_t hash = param_hash_check();
/* build the one-off response message */
mavlink_param_value_t msg;
msg.param_count = param_count_used();
msg.param_index = -1;
strncpy(msg.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN);
msg.param_type = MAV_PARAM_TYPE_UINT32;
memcpy(&msg.param_value, &hash, sizeof(hash));
_mavlink->send_message(MAVLINK_MSG_ID_PARAM_VALUE, &msg);
mavlink_param_value_t param_value;
param_value.param_count = param_count_used();
param_value.param_index = -1;
strncpy(param_value.param_id, HASH_PARAM, MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN);
param_value.param_type = MAV_PARAM_TYPE_UINT32;
memcpy(&param_value.param_value, &hash, sizeof(hash));
_mavlink->send_message(MAVLINK_MSG_ID_PARAM_VALUE, &param_value);
} else {
/* local name buffer to enforce null-terminated string */
char name[MAVLINK_MSG_PARAM_VALUE_FIELD_PARAM_ID_LEN + 1];
......
......@@ -181,14 +181,14 @@ int uORBTest::UnitTest::test_unadvertise()
}
//try to advertise and see whether we get the right instance
int instance[4];
int instance_test[4];
struct orb_test t;
for (int i = 0; i < 4; ++i) {
_pfd[i] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance[i], ORB_PRIO_MAX);
_pfd[i] = orb_advertise_multi(ORB_ID(orb_multitest), &t, &instance_test[i], ORB_PRIO_MAX);
if (instance[i] != i) {
return test_fail("got wrong instance (should be %i, is %i)", i, instance[i]);
if (instance_test[i] != i) {
return test_fail("got wrong instance (should be %i, is %i)", i, instance_test[i]);
}
}
......
......@@ -59,6 +59,8 @@ px4_add_module(
STACK_MAIN 3200
STACK_MAX 1500
COMPILE_FLAGS
-Wno-attributes
-Wno-packed
-Wno-deprecated-declarations
-Os
SRCS
......
......@@ -33,6 +33,8 @@
px4_add_module(
MODULE platforms__posix__drivers__accelsim
MAIN accelsim
COMPILE_FLAGS
-Wno-packed
SRCS
accelsim.cpp
DEPENDS
......
......@@ -34,6 +34,7 @@ px4_add_module(
MODULE platforms__posix__drivers__airspeedsim
MAIN measairspeedsim
COMPILE_FLAGS
-Wno-packed
-Os
SRCS
airspeedsim.cpp
......
......@@ -34,6 +34,7 @@ px4_add_module(
MODULE platforms__posix__drivers__barosim
MAIN barosim
COMPILE_FLAGS
-Wno-packed
-Os
SRCS
baro.cpp
......
......@@ -34,6 +34,7 @@ px4_add_module(
MODULE platforms__posix__drivers__gpssim
MAIN gpssim
COMPILE_FLAGS
-Wno-packed
-Os
SRCS
gpssim.cpp
......
......@@ -35,6 +35,7 @@ px4_add_module(
MAIN gyrosim
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-packed
-Os
SRCS
gyrosim.cpp
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment