Use abort() instead of assert(false) for things that should never happen

assert() is compiled out for release builds, but we don't want to
continue running in these impossible situations.

This also resolves the "implicit fallthrough" warnings for the asserts
in switch cases.
This commit is contained in:
James McCoy
2021-01-31 10:43:03 -05:00
parent 035ee868ae
commit 27a7a4d384
22 changed files with 44 additions and 44 deletions

View File

@@ -2521,7 +2521,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock)
break;
}
case VAR_UNKNOWN: {
assert(false);
abort();
}
}
#undef CHANGE_LOCK
@@ -2693,7 +2693,7 @@ bool tv_equal(typval_T *const tv1, typval_T *const tv2, const bool ic,
}
}
assert(false);
abort();
return false;
}
@@ -2746,7 +2746,7 @@ bool tv_check_str_or_nr(const typval_T *const tv)
return false;
}
}
assert(false);
abort();
return false;
}
@@ -2791,7 +2791,7 @@ bool tv_check_num(const typval_T *const tv)
return false;
}
}
assert(false);
abort();
return false;
}
@@ -2836,7 +2836,7 @@ bool tv_check_str(const typval_T *const tv)
return false;
}
}
assert(false);
abort();
return false;
}