AP_Mission: Use a static assert to check content size

This commit is contained in:
Michael du Breuil 2017-08-28 23:21:20 -07:00 committed by Francisco Ferreira
parent a2002180ee
commit db6d8c9c43
1 changed files with 2 additions and 4 deletions

View File

@ -41,10 +41,8 @@ void AP_Mission::init()
// command list will be cleared if they do not match // command list will be cleared if they do not match
check_eeprom_version(); check_eeprom_version();
// prevent an easy programming error, this will be optimised out // changes in Content size break the storage
if (sizeof(union Content) != 12) { static_assert(sizeof(union Content) == 12, "AP_Mission: Content must be 12 bytes");
AP_HAL::panic("AP_Mission Content must be 12 bytes");
}
_last_change_time_ms = AP_HAL::millis(); _last_change_time_ms = AP_HAL::millis();
} }