AC_Fence: create and use INTERNAL_ERROR macro so we get line numbers

This commit is contained in:
Peter Barker 2020-04-30 10:40:45 +10:00 committed by Peter Barker
parent 75b5e20c6a
commit 069bd04bdc

View File

@ -59,7 +59,7 @@ bool AC_PolyFence_loader::find_storage_offset_for_seq(const uint16_t seq, uint16
} }
if (entry == nullptr) { if (entry == nullptr) {
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return false; return false;
} }
@ -72,7 +72,7 @@ bool AC_PolyFence_loader::find_storage_offset_for_seq(const uint16_t seq, uint16
case AC_PolyFenceType::CIRCLE_INCLUSION: case AC_PolyFenceType::CIRCLE_INCLUSION:
case AC_PolyFenceType::CIRCLE_EXCLUSION: case AC_PolyFenceType::CIRCLE_EXCLUSION:
if (delta != 0) { if (delta != 0) {
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return false; return false;
} }
break; break;
@ -84,12 +84,12 @@ bool AC_PolyFence_loader::find_storage_offset_for_seq(const uint16_t seq, uint16
break; break;
case AC_PolyFenceType::RETURN_POINT: case AC_PolyFenceType::RETURN_POINT:
if (delta != 0) { if (delta != 0) {
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return false; return false;
} }
break; break;
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return false; return false;
} }
return true; return true;
@ -133,7 +133,7 @@ bool AC_PolyFence_loader::get_item(const uint16_t seq, AC_PolyFenceItem &item)
break; break;
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
// read end-of-storage when I should never do so // read end-of-storage when I should never do so
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return false; return false;
} }
return true; return true;
@ -433,7 +433,7 @@ void AC_PolyFence_loader::scan_eeprom_count_fences(const AC_PolyFenceType type,
_eeprom_fence_count++; _eeprom_fence_count++;
switch (type) { switch (type) {
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break; break;
case AC_PolyFenceType::POLYGON_EXCLUSION: case AC_PolyFenceType::POLYGON_EXCLUSION:
case AC_PolyFenceType::POLYGON_INCLUSION: { case AC_PolyFenceType::POLYGON_INCLUSION: {
@ -460,7 +460,7 @@ bool AC_PolyFence_loader::count_eeprom_fences()
void AC_PolyFence_loader::scan_eeprom_index_fences(const AC_PolyFenceType type, uint16_t read_offset) void AC_PolyFence_loader::scan_eeprom_index_fences(const AC_PolyFenceType type, uint16_t read_offset)
{ {
if (_index == nullptr) { if (_index == nullptr) {
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
return; return;
} }
if (type == AC_PolyFenceType::END_OF_STORAGE) { if (type == AC_PolyFenceType::END_OF_STORAGE) {
@ -471,7 +471,7 @@ void AC_PolyFence_loader::scan_eeprom_index_fences(const AC_PolyFenceType type,
index.storage_offset = read_offset; index.storage_offset = read_offset;
switch (type) { switch (type) {
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break; break;
case AC_PolyFenceType::POLYGON_EXCLUSION: case AC_PolyFenceType::POLYGON_EXCLUSION:
case AC_PolyFenceType::POLYGON_INCLUSION: { case AC_PolyFenceType::POLYGON_INCLUSION: {
@ -595,7 +595,7 @@ uint16_t AC_PolyFence_loader::sum_of_polygon_point_counts_and_returnpoint()
ret += index.count; ret += index.count;
break; break;
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break; break;
} }
} }
@ -966,7 +966,7 @@ uint16_t AC_PolyFence_loader::fence_storage_space_required(const AC_PolyFenceIte
i += new_items[i].vertex_count - 1; // i is incremented down below i += new_items[i].vertex_count - 1; // i is incremented down below
break; break;
case AC_PolyFenceType::END_OF_STORAGE: case AC_PolyFenceType::END_OF_STORAGE:
AP::internalerror().error(AP_InternalError::error_t::flow_of_control); INTERNAL_ERROR(AP_InternalError::error_t::flow_of_control);
break; break;
case AC_PolyFenceType::CIRCLE_INCLUSION: case AC_PolyFenceType::CIRCLE_INCLUSION:
case AC_PolyFenceType::CIRCLE_EXCLUSION: case AC_PolyFenceType::CIRCLE_EXCLUSION: