mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
avoid undefined behavior from UNREACHABLE on reachable code paths (#7555)
* avoid undefined behavior from UNREACHABLE on reachable code paths
UNREACHABLE expands to __assume(false) / __builtin_unreachable() in
release builds, which is undefined behavior if the code is ever actually
reached. Many UNREACHABLE sites only guard against unexpected-but-
possible runtime states (values from tables, mission/save files, network
packets, scripting, or user input), so reaching them should degrade
gracefully rather than invoke UB.
Replace UNREACHABLE with Assertion(false, ...) at all such sites. It
still pops an error in debug builds, but in release it is a harmless
no-op that simply falls through to the following code. Sites that are
genuinely unreachable by local invariants (e.g. a switch over a bounded
random number) are left as UNREACHABLE.
A few converted sites had no safe fall-through -- an uninitialized read,
null dereference, or null call would have followed -- so they also get a
minimal recovery: initialize the value, guard the dereference, return
early, or skip the offending item.
Where the converted site was a simple guard of the form
if (x) { Assertion(false, ...); return; }
hoist the check onto the invariant instead:
Assertion(!x, ...);
if (x) { return; }
This states the expectation directly and shows the offending value in
the debug popup, while keeping the same graceful runtime degradation.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
* addendum
After consultation with Lafiel, use UNREACHABLE in situations that are effectively impossible even if not provably impossible. UNREACHABLE = "this shouldn't ever happen"; Assertion = "if this ever happens, it's a coding error". Also fix a few other sites and change a couple to Warnings.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
1 parent
c05c06db95
commit
bed228d264
85 files changed
+192
-180
No files matched your search
@@ -38,7 +38,7 @@ const TypeDefinition& TypeDefinition::forValueType(ValueType type)
|
||||
case ValueType::String:
|
||||
return s_identifier;
|
||||
default:
|
||||
UNREACHABLE("Invalid value type!");
|
||||
UNREACHABLE("Invalid value type %d!", static_cast<int>(type));
|
||||
return s_integer; // Make compiler happy
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1870,7 +1870,7 @@ void ai_big_strafe()
|
||||
|
||||
/*
|
||||
if ( aip->goal_objnum != aip->target_objnum ) {
|
||||
UNREACHABLE("The goal objnum does not match the target objnum in ai_big_strafe(), please report to the SCP!"); // what is going on here? - Get Alan
|
||||
Assertion(false, "The goal objnum does not match the target objnum in ai_big_strafe(), please report to the SCP!"); // what is going on here? - Get Alan
|
||||
aip->mode = AIM_NONE;
|
||||
return;
|
||||
}
|
||||
|
||||
+9
-9
@@ -2734,8 +2734,8 @@ void ai_evade_object(object *evader, object *evaded)
|
||||
Assert(evader->instance != -1);
|
||||
Assert(Ships[evader->instance].ai_index != -1);
|
||||
|
||||
Assertion(evaded != evader, "Ship %s is trying to evade itself. Please report to the SCP!", Ships[evader->instance].ship_name); // Bogus! Who tried to get me to evade myself! Trace out and fix!
|
||||
if (evaded == evader) {
|
||||
UNREACHABLE("Ship %s is trying to evade itself. Please report to the SCP!", Ships[evader->instance].ship_name); // Bogus! Who tried to get me to evade myself! Trace out and fix!
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4997,8 +4997,8 @@ void ai_waypoints()
|
||||
ai_info *aip = &Ai_info[Ships[Pl_objp->instance].ai_index];
|
||||
|
||||
// sanity checking for stuff that should never happen
|
||||
Assertion(aip->wp_index != INVALID_WAYPOINT_POSITION, "Waypoints should have been started already!");
|
||||
if (aip->wp_index == INVALID_WAYPOINT_POSITION) {
|
||||
UNREACHABLE("Waypoints should have been started already!");
|
||||
ai_start_waypoints(Pl_objp, (aip->wp_list_index < 0) ? 0 : aip->wp_list_index, WPF_REPEAT, 0);
|
||||
}
|
||||
|
||||
@@ -11020,8 +11020,8 @@ void ai_guard()
|
||||
|
||||
guard_objp = &Objects[aip->guard_objnum];
|
||||
|
||||
Assertion(guard_objp != Pl_objp, "The ship %s has been found to be guarding itself in ai_guard. Please report to the SCP!", shipp->ship_name); // This seems illegal. Why is a ship guarding itself?
|
||||
if (guard_objp == Pl_objp) {
|
||||
UNREACHABLE("The ship %s has been found to be guarding itself in ai_guard. Please report to the SCP!", shipp->ship_name); // This seems illegal. Why is a ship guarding itself?
|
||||
aip->guard_objnum = -1;
|
||||
return;
|
||||
}
|
||||
@@ -13889,7 +13889,7 @@ int ai_acquire_emerge_path(object *pl_objp, int parent_objnum, int allowed_path_
|
||||
// Cyborg: to avoid divide by zero and avoid a logic path that should not exist check for 0 allowed paths -- Coverity 1523287
|
||||
if (num_allowed_paths == 0) {
|
||||
bay_path = Ai_last_arrive_path % bay->num_paths;
|
||||
UNREACHABLE("Parent_shipp in ai_acquire_emerge_path somehow does not have any allowed bay paths!");
|
||||
Assertion(false, "Parent_shipp in ai_acquire_emerge_path somehow does not have any allowed bay paths!");
|
||||
} else {
|
||||
// cycle through the allowed paths
|
||||
bay_path = allowed_bay_paths[Ai_last_arrive_path % num_allowed_paths];
|
||||
@@ -14382,7 +14382,7 @@ void ai_execute_behavior(ai_info *aip)
|
||||
ai_lua(aip);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unknown AI Mode! Get a coder!");
|
||||
UNREACHABLE("Unknown AI Mode %d! Get a coder!", aip->mode);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -15022,7 +15022,7 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos)
|
||||
return 1;
|
||||
|
||||
} else {
|
||||
UNREACHABLE("aas_1 has been passed an invalid object type of %d, please report to the SCP!", objp->type);
|
||||
Assertion(false, "aas_1 has been passed an invalid object type of %d, please report to the SCP!", objp->type);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -16398,7 +16398,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, const vec3d *hit_normal)
|
||||
} else if (hit_objp->type == OBJ_SHIP) {
|
||||
objp_hitter = hit_objp;
|
||||
} else {
|
||||
UNREACHABLE("Should never happen.");
|
||||
Assertion(false, "ai_ship_hit has been passed an invalid object type of %d, please report to the SCP!", hit_objp->type);
|
||||
return;
|
||||
}
|
||||
Assert(objp_hitter != nullptr);
|
||||
@@ -16485,7 +16485,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, const vec3d *hit_normal)
|
||||
objp_hitter = hit_objp;
|
||||
hitter_objnum = OBJ_INDEX(hit_objp);
|
||||
} else {
|
||||
UNREACHABLE("ai_ship_hit has been passed an invalid object type of %d, please report to the SCP!", hit_objp->type);
|
||||
Assertion(false, "ai_ship_hit has been passed an invalid object type of %d, please report to the SCP!", hit_objp->type);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16616,7 +16616,7 @@ void ai_ship_hit(object *objp_ship, object *hit_objp, const vec3d *hit_normal)
|
||||
case AIM_LUA:
|
||||
return;
|
||||
default:
|
||||
UNREACHABLE("Unknown AI Mode! Get a coder!");
|
||||
UNREACHABLE("Unknown AI Mode %d! Get a coder!", aip->mode);
|
||||
}
|
||||
|
||||
if (timestamp_elapsed(aip->ok_to_target_timestamp)) {
|
||||
|
||||
+8
-8
@@ -1253,7 +1253,7 @@ void ai_add_goal_sub_sexp( int sexp, ai_goal_type type, ai_info *aip, ai_goal *a
|
||||
} else if ( op == OP_AI_IGNORE_NEW ) {
|
||||
aigp->ai_mode = AI_GOAL_IGNORE_NEW;
|
||||
} else
|
||||
UNREACHABLE("Coding error: unhandled AI goal in ai_add_goal_sub_sexp!");
|
||||
UNREACHABLE("Coding error: unhandled AI goal %d in ai_add_goal_sub_sexp!", op);
|
||||
|
||||
break;
|
||||
|
||||
@@ -2056,7 +2056,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
if (target_ship_entry->shipp()->subsys_info[SUBSYSTEM_TURRET].type_count == 0)
|
||||
return ai_achievability::NOT_ACHIEVABLE;
|
||||
} else {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
Assertion(false, "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
}
|
||||
}
|
||||
@@ -2105,8 +2105,8 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
return ai_achievability::NOT_KNOWN;
|
||||
|
||||
// we must also determine if we're prevented from docking for any reason
|
||||
Assertion(target_ship_entry && target_ship_entry->has_shipp(), "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
if (!target_ship_entry || !target_ship_entry->has_shipp()) {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
}
|
||||
auto goal_objp = target_ship_entry->objp();
|
||||
@@ -2163,7 +2163,7 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
if (aip->goal_objnum != target_ship_entry->objnum)
|
||||
return ai_achievability::NOT_KNOWN;
|
||||
} else {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
Assertion(false, "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
}
|
||||
}
|
||||
@@ -2177,14 +2177,14 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
aigp->ai_submode = ship_find_subsys( target_ship_entry->shipp(), aigp->docker.name );
|
||||
aigp->flags.remove(AI::Goal_Flags::Subsys_needs_fixup);
|
||||
} else {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
Assertion(false, "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
}
|
||||
}
|
||||
} else if ( ((aigp->ai_mode == AI_GOAL_IGNORE) || (aigp->ai_mode == AI_GOAL_IGNORE_NEW)) && (status == SHIP_STATUS_ARRIVED) ) {
|
||||
// for ignoring a ship, call the ai_ignore object function, then declare the goal satisfied
|
||||
Assertion(target_ship_entry && target_ship_entry->has_objp(), "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
if (!target_ship_entry || !target_ship_entry->has_objp()) {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE; // force this goal to be invalid
|
||||
}
|
||||
auto ignored = target_ship_entry->objp();
|
||||
@@ -2233,16 +2233,16 @@ ai_achievability ai_mission_goal_achievable( int objnum, ai_goal *aigp )
|
||||
{
|
||||
// short circuit a couple of cases. Ship not arrived shouldn't happen. Ship gone means
|
||||
// we mark the goal as not achievable.
|
||||
Assertion(status != SHIP_STATUS_NOT_ARRIVED, "Ship %s cannot rearm a target %s that hasn't arrived; get Allender or a SCP member", shipp->ship_name, aigp->target_name); // get Allender. this shouldn't happen!!!
|
||||
if ( status == SHIP_STATUS_NOT_ARRIVED ) {
|
||||
UNREACHABLE("Ship %s cannot rearm a target %s that hasn't arrived; get Allender or a SCP member", shipp->ship_name, aigp->target_name); // get Allender. this shouldn't happen!!!
|
||||
return ai_achievability::NOT_ACHIEVABLE;
|
||||
}
|
||||
|
||||
if ( status == SHIP_STATUS_GONE )
|
||||
return ai_achievability::NOT_ACHIEVABLE;
|
||||
|
||||
Assertion(target_ship_entry && target_ship_entry->has_shipp(), "Target name %s is not an arrived ship!", aigp->target_name);
|
||||
if ( !target_ship_entry || !target_ship_entry->has_shipp() ) {
|
||||
UNREACHABLE("Target name %s is not an arrived ship!", aigp->target_name);
|
||||
return ai_achievability::NOT_ACHIEVABLE;
|
||||
}
|
||||
|
||||
|
||||
@@ -599,8 +599,8 @@ int bm_create_3d(int bpp, int w, int h, int d, void* data) {
|
||||
return -1;
|
||||
|
||||
// make sure that we have valid data
|
||||
Assertion(data != nullptr, "No valid data received for 3D Bitmap creation!");
|
||||
if (data == nullptr) {
|
||||
UNREACHABLE("No valid data received for 3D Bitmap creation!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1210,7 +1210,7 @@ static int bm_load_info(BM_TYPE type, const char *filename, CFILE *img_cfp, int
|
||||
}
|
||||
}
|
||||
else {
|
||||
UNREACHABLE("Unknown file type specified! This is probably a coding error.");
|
||||
UNREACHABLE("Unknown file type %d specified! This is probably a coding error.", type);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -832,7 +832,7 @@ static int cfget_cfile_block()
|
||||
mprintf(("Out of cfile blocks! Currently opened files:\n"));
|
||||
dump_opened_files();
|
||||
|
||||
UNREACHABLE("There are no more free cfile blocks. This means that there are too many files opened by FSO.\n"
|
||||
Warning(LOCATION, "There are no more free cfile blocks. This means that there are too many files opened by FSO.\n"
|
||||
"This is probably caused by a programming or scripting error where a file does not get closed."); // out of free cfile blocks
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ bool control_config_remove_binding(int ctrl, selItem item, bool API_Access)
|
||||
|
||||
default:
|
||||
// Coder forgot to add a case!
|
||||
UNREACHABLE("Unhandled selItem case.");
|
||||
UNREACHABLE("Unhandled selItem case: %i", static_cast<int>(item));
|
||||
}
|
||||
|
||||
if (success)
|
||||
@@ -3120,7 +3120,7 @@ void control_get_axes_readings(int *axis_v, float frame_time)
|
||||
case CC_TYPE_AXIS_BTN_POS:
|
||||
default:
|
||||
//This should never happen, especially with the above Assertion. This is required as incomplete switches on an enum generate warnings
|
||||
UNREACHABLE("Unhandled control item type");
|
||||
UNREACHABLE("Unhandled control item type %d", static_cast<int>(item.type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2388,7 +2388,7 @@ SCP_string ValToCID(CID id) {
|
||||
|
||||
if (it == mCIDNameToVal.cend()) {
|
||||
// Shouldn't happen
|
||||
Error(LOCATION, "Unknown CID value %i", id);
|
||||
UNREACHABLE("Unknown CID value %i", id);
|
||||
return "NONE";
|
||||
|
||||
} else {
|
||||
@@ -2518,9 +2518,11 @@ SCP_string ValToJoy(const CC_bind &bind) {
|
||||
if (it == mAxisNameToVal.end()) {
|
||||
// should never happen
|
||||
UNREACHABLE("Unknown error occured during reverse lookup of joy input string.");
|
||||
} // else print out value
|
||||
|
||||
str = it->first;
|
||||
str = "NONE";
|
||||
} else {
|
||||
// print out value
|
||||
str = it->first;
|
||||
}
|
||||
|
||||
/* } else if (bind.flags & CCF_HAT) {
|
||||
// TODO Still currently encoded as buttons
|
||||
|
||||
@@ -49,7 +49,7 @@ VideoPresenter::VideoPresenter(const MovieProperties& props) : _properties(props
|
||||
material_set_unlit(&_rgb_material, _planeTextureHandles[0], 1.0f, true, false);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(props.pixelFormat));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ void VideoPresenter::uploadVideoFrame(const VideoFramePtr& frame) {
|
||||
bpp = 32;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(_properties.pixelFormat));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void VideoPresenter::displayFrame(float x1, float y1, float x2, float y2, float
|
||||
gr_render_primitives(&_rgb_material, PRIM_TYPE_TRISTRIP, &layout, 0, 4, gr_immediate_buffer_handle, offset);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(_properties.pixelFormat));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ void debris_process_post(object * obj, float frame_time)
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled case %d for electrical arc creation in debris_process_post()!", n);
|
||||
Assertion(false, "Unhandled case %d for electrical arc creation in debris_process_post()!", n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ bool Decal::isValid() const {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
Assertion(false, "Only ships are currently supported for decals!");
|
||||
UNREACHABLE("Only ships are currently supported for decals!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1006,7 +1006,7 @@ int fireball_create(vec3d *pos, int fireball_type, int render_type, int parent_o
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Bad type set in fireball_create");
|
||||
UNREACHABLE("Bad type %d set in fireball_create", new_fireball->fireball_render_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1089,8 +1089,8 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
|
||||
{
|
||||
Assert( red && blue && green );
|
||||
|
||||
Assertion(SCP_vector_inbounds(Fireball_info, idx), "idx is out of bounds!");
|
||||
if (!SCP_vector_inbounds(Fireball_info, idx)) {
|
||||
UNREACHABLE("idx is out of bounds!");
|
||||
|
||||
*red = 1.0f;
|
||||
*green = 1.0f;
|
||||
|
||||
@@ -470,7 +470,7 @@ void parse_helptbl(const char *filename)
|
||||
break;
|
||||
case 4: // $end
|
||||
default:
|
||||
UNREACHABLE("This should never happen.\n");
|
||||
UNREACHABLE("Type %d is not handled by the switch; this is a coding error.", type);
|
||||
break;
|
||||
}
|
||||
} // end while
|
||||
|
||||
@@ -477,7 +477,7 @@ void change_default_detail_level(DefaultDetailPreset preset, DetailSetting selec
|
||||
Detail_defaults[static_cast<int>(preset)].lighting = value;
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid detail selection. Get a coder!");
|
||||
UNREACHABLE("Invalid detail selection %d. Get a coder!", static_cast<int>(selection));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,7 +497,7 @@ void change_default_detail_level(DefaultDetailPreset preset, DetailSetting selec
|
||||
Detail_defaults[static_cast<int>(preset)].weapon_extras = value;
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid detail selection. Get a coder!");
|
||||
UNREACHABLE("Invalid detail selection %d. Get a coder!", static_cast<int>(selection));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ void insertion_sort(array_t& array_base, int array_size, int (*fncompare)(const
|
||||
// allocate space for the element being moved
|
||||
// (Taylor says that for optimization purposes malloc/free should be used rather than vm_malloc/vm_free here)
|
||||
current_buf = new T();
|
||||
Assertion(current_buf != nullptr, "Malloc failed!");
|
||||
if (current_buf == nullptr)
|
||||
{
|
||||
UNREACHABLE("Malloc failed!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ version::version(const SCP_string& semver, int missing) : major(missing), minor(
|
||||
++has_fields;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Version parsing broken, get a coder!");
|
||||
Assertion(false, "Version parsing broken, get a coder!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1549,7 +1549,7 @@ static void gr_init_function_pointers(int mode) {
|
||||
gr_stub_init_function_pointers();
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid graphics mode requested"); // Invalid graphics mode
|
||||
UNREACHABLE("Invalid graphics mode %d requested", mode); // Invalid graphics mode
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ GLenum get_gl_shader_stage(opengl::ShaderStage stage) {
|
||||
case opengl::STAGE_FRAGMENT:
|
||||
return GL_FRAGMENT_SHADER;
|
||||
default:
|
||||
UNREACHABLE("Unhandled shader type found!");
|
||||
UNREACHABLE("Unhandled shader type %d found!", static_cast<int>(stage));
|
||||
return GL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void gr_opengl_deferred_lighting_msaa()
|
||||
msaa_resolve_flags = SDR_FLAG_MSAA_SAMPLES_16;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Disallowed MSAA shader sample count!");
|
||||
Error(LOCATION, "Disallowed MSAA shader sample count %d!", Cmdline_msaa_enabled);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void gr_opengl_deferred_lighting_finish()
|
||||
cylinder_lights.push_back(l);
|
||||
break;
|
||||
case Light_Type::Ambient:
|
||||
UNREACHABLE("Multiple ambient lights are not supported!");
|
||||
Warning(LOCATION, "Multiple ambient lights are not supported!");
|
||||
}
|
||||
}
|
||||
{
|
||||
|
||||
@@ -822,7 +822,7 @@ static void set_fxaa_defines(SCP_stringstream& sflags)
|
||||
sflags << "#define FXAA_QUALITY_SUBPIX 0.33\n";
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled FXAA mode!");
|
||||
UNREACHABLE("Unhandled FXAA mode %d!", static_cast<int>(Gr_aa_mode));
|
||||
}
|
||||
}
|
||||
void set_smaa_defines(SCP_stringstream& sflags)
|
||||
@@ -848,7 +848,7 @@ void set_smaa_defines(SCP_stringstream& sflags)
|
||||
sflags << "#define SMAA_PRESET_ULTRA\n";
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled SMAA mode!");
|
||||
UNREACHABLE("Unhandled SMAA mode %d!", static_cast<int>(Gr_aa_mode));
|
||||
}
|
||||
}
|
||||
void opengl_post_shader_header(SCP_stringstream& sflags, shader_type shader_t, int flags)
|
||||
|
||||
@@ -52,7 +52,7 @@ void gr_opengl_query_value(int obj, QueryType type) {
|
||||
glQueryCounter(slot.name, GL_TIMESTAMP);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(type));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ void opengl_state::BindFrameBuffer(GLuint name, GLenum mode) {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid BindFrameBuffer mode!");
|
||||
UNREACHABLE("Invalid BindFrameBuffer mode %d!", mode);
|
||||
}
|
||||
}
|
||||
void opengl_state::BindFrameBufferBoth(GLuint read, GLuint draw) {
|
||||
|
||||
@@ -113,7 +113,7 @@ static GLenum convertBufferType(BufferType type) {
|
||||
case BufferType::Uniform:
|
||||
return GL_UNIFORM_BUFFER;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(type));
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ static GLenum convertUsageHint(BufferUsageHint usage) {
|
||||
case BufferUsageHint::PersistentMapping:
|
||||
return GL_NONE; // Dummy value
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", static_cast<int>(usage));
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ static GLenum convertStencilOp(const StencilOperation stencil_op) {
|
||||
case StencilOperation::Invert:
|
||||
return GL_INVERT;
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value encountered!");
|
||||
UNREACHABLE("Unhandled enum value %d encountered!", static_cast<int>(stencil_op));
|
||||
return GL_NONE;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ static GLenum convertComparisionFunction(ComparisionFunction func) {
|
||||
mode = GL_NOTEQUAL;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled comparision function value!");
|
||||
UNREACHABLE("Unhandled comparision function value %d!", static_cast<int>(func));
|
||||
mode = GL_ALWAYS;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ BufferType getBufferType(GpuHeap heap_type) {
|
||||
return BufferType::Index;
|
||||
case GpuHeap::NUM_VALUES:
|
||||
default:
|
||||
UNREACHABLE("Invalid heap type detected!");
|
||||
UNREACHABLE("Invalid heap type %d detected!", static_cast<int>(heap_type));
|
||||
return BufferType::Vertex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ size_t getElementSize(uniform_block_type type)
|
||||
return 0;
|
||||
case uniform_block_type::NUM_BLOCK_TYPES:
|
||||
default:
|
||||
UNREACHABLE("Invalid block type encountered!");
|
||||
UNREACHABLE("Invalid block type %d encountered!", static_cast<int>(type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ size_t getHeaderSize(uniform_block_type type)
|
||||
return 0;
|
||||
case uniform_block_type::NUM_BLOCK_TYPES:
|
||||
default:
|
||||
UNREACHABLE("Invalid block type encountered!");
|
||||
UNREACHABLE("Invalid block type %d encountered!", static_cast<int>(type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ void parse_ssm(const char *filename)
|
||||
s->shape = SSM_SHAPE_SPHERE;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Impossible return value from required_string_one_of(); get a coder!\n");
|
||||
UNREACHABLE("Impossible return value from required_string_one_of(); get a coder!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,6 +292,7 @@ void ssm_get_random_start_pos(vec3d *out, const vec3d *start, const matrix *orie
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unknown shape '%d' in SSM type #" SIZE_T_ARG " ('%s'). This should not be possible; get a coder!\n", s->shape, ssm_index, s->name);
|
||||
temp = *start;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -812,8 +812,8 @@ void hud_add_ship_to_escort(int objnum, int supress_feedback)
|
||||
return;
|
||||
}
|
||||
|
||||
Assertion(objnum >= 0, "Invalid objnum passed to hud_add_ship_to_escort()!");
|
||||
if (objnum < 0) {
|
||||
UNREACHABLE("Invalid objnum passed to hud_add_ship_to_escort()!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ void SpaceMouse::poll() {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE("Bad SpaceMouse protocol specified!");
|
||||
UNREACHABLE("Bad SpaceMouse protocol %d specified!", static_cast<int>(m_definition.protocol));
|
||||
}
|
||||
} while (bytes_read > 0);
|
||||
}
|
||||
|
||||
+3
-3
@@ -88,8 +88,8 @@ void timer_start_frame()
|
||||
|
||||
fix timer_get_fixed_seconds()
|
||||
{
|
||||
Assertion(Timer_inited, "Make sure you call timer_init before anything that uses timer functions!");
|
||||
if (!Timer_inited) {
|
||||
UNREACHABLE("Make sure you call timer_init before anything that uses timer functions!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -106,8 +106,8 @@ fix timer_get_approx_seconds()
|
||||
|
||||
int timer_get_seconds()
|
||||
{
|
||||
Assertion(Timer_inited, "Make sure you call timer_init before anything that uses timer functions!");
|
||||
if (!Timer_inited) {
|
||||
UNREACHABLE("Make sure you call timer_init before anything that uses timer functions!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -116,8 +116,8 @@ int timer_get_seconds()
|
||||
|
||||
int timer_get_milliseconds()
|
||||
{
|
||||
Assertion(Timer_inited, "Make sure you call timer_init before anything that uses timer functions!");
|
||||
if (!Timer_inited) {
|
||||
UNREACHABLE("Make sure you call timer_init before anything that uses timer functions!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1202,7 +1202,7 @@ void LabUi::maybe_show_animation_category(const SCP_vector<animation::ModelAnima
|
||||
break;
|
||||
default:
|
||||
// We really shouldn't be here, but just in case
|
||||
Assertion(false, "Unexpected animation trigger type %d", static_cast<int>(trigger_type));
|
||||
UNREACHABLE("Unexpected animation trigger type %d", static_cast<int>(trigger_type));
|
||||
button_label += "Trigger Animation " + std::to_string(count++);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ void LabManager::onFrame(float frametime) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Assertion(false, "Invalid Lab Turret Aim Type!");
|
||||
UNREACHABLE("Invalid Lab Turret Aim Type %d!", static_cast<int>(mode));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ void LabManager::changeDisplayedObject(LabMode mode, int info_index, int subtype
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE("Unhandled lab mode %d", (int)mode);
|
||||
UNREACHABLE("Unhandled lab mode %d", static_cast<int>(mode));
|
||||
ModelFilename = "";
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-2
@@ -301,7 +301,7 @@ float Curve::GetValue(float x_val) const {
|
||||
out = Curves[fl2i(kframe->param1 + 0.5f)].GetValue(t);
|
||||
return kframe->pos.y + out * (next_pos->y - kframe->pos.y);
|
||||
default:
|
||||
UNREACHABLE("Unrecognized curve function");
|
||||
UNREACHABLE("Unrecognized curve function %d", static_cast<int>(kframe->interp_func));
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
@@ -352,7 +352,7 @@ float Curve::GetValueIntegrated(float x_val) const
|
||||
integrated_value += m * (Curves[fl2i(kframe->param1 + 0.5f)].GetValueIntegrated(t) - Curves[fl2i(kframe->param1 + 0.5f)].GetValueIntegrated(0.f));
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unrecognized curve function");
|
||||
UNREACHABLE("Unrecognized curve function %d", static_cast<int>(kframe->interp_func));
|
||||
break;
|
||||
}
|
||||
if (last_keyframe) {
|
||||
|
||||
@@ -1633,7 +1633,7 @@ void options_detail_do_frame()
|
||||
options_force_button_frame(VERY_HIGH_DETAIL_N, 2);
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid preset called for in Options menu");
|
||||
UNREACHABLE("Invalid preset %d called for in Options menu", static_cast<int>(current_preset));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ void mission_campaign_store_goals_and_events()
|
||||
else
|
||||
stored_event.status = static_cast<int>(EventStatus::FAILED);
|
||||
} else
|
||||
UNREACHABLE("Mission event formula should be marked MEF_EVENT_IS_DONE at end-of-mission");
|
||||
Assertion(false, "Mission event formula should be marked MEF_EVENT_IS_DONE at end-of-mission");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ void mission_log_add_entry(LogType type, const char *pname, const char *sname, i
|
||||
if (std::find_if(Log_entries.begin(), Log_entries.end(), [index](const log_entry& le) {
|
||||
return (le.type == LOG_SHIP_DEPARTED) && (le.index == index);
|
||||
}) == Log_entries.end()) {
|
||||
UNREACHABLE("cannot find any departed ships from wing %s that supposedly departed.", Wings[index].name); // get Allender
|
||||
Assertion(false, "cannot find any departed ships from wing %s that supposedly departed.", Wings[index].name); // get Allender
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -719,7 +719,7 @@ void mission_log_init_scrollback(int pw, bool split_string)
|
||||
break;
|
||||
} // matches case statement!
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value!");
|
||||
UNREACHABLE("Unhandled enum value %d!", entry.type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -8230,6 +8230,7 @@ int mission_set_arrival_location(anchor_t anchor, ArrivalLocation location, int
|
||||
vm_vec_negate(&rand_vec);
|
||||
} else {
|
||||
UNREACHABLE("Unknown location type discovered when trying to parse %s -- Please let an SCP coder know!", Ships[shipnum].ship_name);
|
||||
rand_vec = vmd_zero_vector;
|
||||
}
|
||||
|
||||
// add in the radius of the two ships involved. This will make the ship arrive further than
|
||||
@@ -8280,7 +8281,7 @@ void mission_parse_mark_reinforcement_available(const char *name)
|
||||
return;
|
||||
}
|
||||
|
||||
Assertion(false, "Reinforcement '%s' not found!", name);
|
||||
Warning(LOCATION, "Reinforcement '%s' not found!", name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -733,6 +733,8 @@ void Fred_mission_save::save_ai_goals(ai_goal* goalp, int ship)
|
||||
|
||||
default:
|
||||
UNREACHABLE("Goal %d not handled!", goalp[i].ai_mode);
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid)
|
||||
|
||||
@@ -1093,7 +1093,7 @@ int SexpTreeModel::get_modify_variable_type(int parent) const
|
||||
return OPF_AMBIGUOUS;
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("get_modify_variable_type called for operator %d, which is neither modify-variable nor set-variable-by-index", op_const);
|
||||
Assertion(false, "get_modify_variable_type called for operator %d, which is neither modify-variable nor set-variable-by-index", op_const);
|
||||
}
|
||||
|
||||
// if we don't have a valid variable, allow replacement with anything
|
||||
@@ -1109,7 +1109,7 @@ int SexpTreeModel::get_modify_variable_type(int parent) const
|
||||
} else if (var_type & SEXP_VARIABLE_STRING) {
|
||||
return OPF_AMBIGUOUS;
|
||||
} else {
|
||||
UNREACHABLE("Sexp variable '%s' has unrecognized type flags 0x%x", Sexp_variables[sexp_var_index].variable_name, var_type);
|
||||
Assertion(false, "Sexp variable '%s' has unrecognized type flags 0x%x", Sexp_variables[sexp_var_index].variable_name, var_type);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,8 +249,8 @@ void interpolation_manager::add_packet(int objnum, int frame, int packet_timesta
|
||||
// should never replace index 0
|
||||
void interpolation_manager::replace_packet(int index, vec3d* pos, matrix* orient, physics_info* pip)
|
||||
{
|
||||
Assertion(index >= 1, "Invalid replace interpolation packet index! (%d)", index);
|
||||
if (index < 1) {
|
||||
UNREACHABLE("Invalid replace interpolation packet index! (%d)", index);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -2204,8 +2204,8 @@ void send_netgame_descript_packet(net_addr *addr, int code)
|
||||
int packet_size = 0;
|
||||
|
||||
// Get this out of the way, because we don't want to waste our time if the addr is bad.
|
||||
Assertion(addr != nullptr, "Net address not specified!");
|
||||
if (addr == nullptr) {
|
||||
UNREACHABLE("Net address not specified!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ void dead_dock_remove_instance(object *objp, object *other_objp)
|
||||
else
|
||||
{
|
||||
// Trigger assertion. We can recover from this, thankfully
|
||||
UNREACHABLE("Tried to undock an object that isn't dead docked!\n");
|
||||
Assertion(false, "Tried to undock an object that isn't dead docked!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1208,7 +1208,9 @@ void collide_mp_worker_thread(size_t threadIdx) {
|
||||
check_collision = collide_ship_ship_check;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Got non MP-compatible collision type!");
|
||||
UNREACHABLE("Got non MP-compatible collision type %d!", collision_check.ctype);
|
||||
thread.queue_length.fetch_sub(1, std::memory_order_release); // keep the counter balanced
|
||||
continue; // skip the bad pair
|
||||
}
|
||||
|
||||
auto&& [never_check_again, collision_data_maybe, collision_fnc] = check_collision(&collision_check.objs);
|
||||
|
||||
@@ -1025,7 +1025,7 @@ void dock_remove_instance(object *objp, object *other_objp)
|
||||
else
|
||||
{
|
||||
// Trigger an assertion, we can recover from this one, thankfully.
|
||||
UNREACHABLE("Tried to undock an object that isn't docked!\n");
|
||||
Assertion(false, "Tried to undock an object that isn't docked!\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4978,8 +4978,8 @@ int parse_modular_table(const char *name_check, void (*parse_callback)(const cha
|
||||
SCP_vector<SCP_string> tbl_file_names;
|
||||
int i, num_files = 0;
|
||||
|
||||
if ( (name_check == NULL) || (parse_callback == NULL) || ((*name_check) != '*') ) {
|
||||
UNREACHABLE("parse_modular_table() called with invalid arguments; get a coder!\n");
|
||||
Assertion( (name_check != nullptr) && (parse_callback != nullptr) && ((*name_check) == '*'), "parse_modular_table() called with invalid arguments; get a coder!\n");
|
||||
if ( (name_check == nullptr) || (parse_callback == nullptr) || ((*name_check) != '*') ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+21
-19
@@ -2024,7 +2024,7 @@ bool check_container_data_sexp_arg_type(ContainerType con_type, bool is_string,
|
||||
} else if (any(con_type & ContainerType::NUMBER_DATA)) {
|
||||
return is_number;
|
||||
} else {
|
||||
UNREACHABLE("Unknown container data type %d", (int)con_type);
|
||||
UNREACHABLE("Unknown container data type %d", static_cast<int>(con_type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2036,7 +2036,7 @@ bool check_map_container_key_sexp_arg_type(ContainerType con_type, bool is_strin
|
||||
} else if (any(con_type & ContainerType::NUMBER_KEYS)) {
|
||||
return is_number;
|
||||
} else {
|
||||
UNREACHABLE("Unknown map container key type %d", (int)con_type);
|
||||
UNREACHABLE("Unknown map container key type %d", static_cast<int>(con_type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2366,7 +2366,7 @@ int check_sexp_syntax(int node, int desired_return_type, int recursive, int *bad
|
||||
return SEXP_CHECK_WRONG_MAP_KEY_TYPE;
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)data_container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(data_container.type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3361,6 +3361,7 @@ int check_sexp_syntax(int node, int desired_return_type, int recursive, int *bad
|
||||
} else if (desired_argument_type == OPF_EVENT_NAME) {
|
||||
count = count_items_with_string(Campaign.missions[i].events, &mevent::name, CTEXT(node));
|
||||
} else {
|
||||
// constrained by the enclosing case
|
||||
UNREACHABLE("desired_argument_type == %d; expected OPF_GOAL_NAME or OPF_EVENT_NAME", desired_argument_type);
|
||||
}
|
||||
} else if (desired_argument_type == OPF_GOAL_NAME) {
|
||||
@@ -3376,6 +3377,7 @@ int check_sexp_syntax(int node, int desired_return_type, int recursive, int *bad
|
||||
|
||||
count = count_items_with_string(Mission_events, &mission_event::name, CTEXT(node));
|
||||
} else {
|
||||
// constrained by the enclosing case
|
||||
UNREACHABLE("desired_argument_type == %d; expected OPF_GOAL_NAME or OPF_EVENT_NAME", desired_argument_type);
|
||||
}
|
||||
|
||||
@@ -3452,7 +3454,7 @@ int check_sexp_syntax(int node, int desired_return_type, int recursive, int *bad
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
UNREACHABLE("Unhandled case for OPF_DOCKER_POINT/OPF_DOCKEE_POINT");
|
||||
Assertion(false, "Unhandled case for OPF_DOCKER_POINT/OPF_DOCKEE_POINT");
|
||||
}
|
||||
}
|
||||
Assert(ship_node >= 0);
|
||||
@@ -5281,7 +5283,7 @@ void stuff_sexp_text_string(SCP_string &dest, int node, int mode)
|
||||
sprintf(dest, "\"@%s[%s]\" ", var_name, var_contents);
|
||||
}
|
||||
else
|
||||
UNREACHABLE("SEXP variable nodes must be SEXP_ATOM_NUMBER or SEXP_ATOM_STRING!");
|
||||
Assertion(false, "SEXP variable nodes must be SEXP_ATOM_NUMBER or SEXP_ATOM_STRING!");
|
||||
}
|
||||
// not a variable
|
||||
else
|
||||
@@ -7229,7 +7231,7 @@ void eval_object_ship_wing_point_team(object_ship_wing_point_team *oswpt, int no
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled ship registry entry status for %s: %d", ship_entry->name, (int)ship_entry->status);
|
||||
UNREACHABLE("Unhandled ship registry entry status for %s: %d", ship_entry->name, static_cast<int>(ship_entry->status));
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -11150,7 +11152,7 @@ int eval_perform_actions(int n, int op_num)
|
||||
}
|
||||
else
|
||||
{
|
||||
UNREACHABLE("Unsupported SEXP %d!", op_num);
|
||||
Assertion(false, "Unsupported SEXP %d!", op_num);
|
||||
return SEXP_NAN_FOREVER;
|
||||
}
|
||||
|
||||
@@ -12175,7 +12177,7 @@ int eval_for_container(int arg_handler_node, int condition_node, int op_const, b
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled for-container SEXP (%d). Please report!", op_const);
|
||||
Assertion(false, "Unhandled for-container SEXP (%d). Please report!", op_const);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -15066,7 +15068,7 @@ void sexp_explosion_effect(int n)
|
||||
break;
|
||||
|
||||
default:
|
||||
Assertion(false, "Object magically changed type after exploding!");
|
||||
UNREACHABLE("Object magically changed type to %d after exploding!", objp->type);
|
||||
break;
|
||||
}
|
||||
} // end for
|
||||
@@ -19987,7 +19989,7 @@ void sexp_ingame_ship_alt_name_or_display_name_or_callsign(ship *shipp, bool cle
|
||||
shipp->flags.remove(Ship::Ship_Flags::Has_display_name);
|
||||
}
|
||||
else
|
||||
UNREACHABLE("Unhandled op_num %d!", op_num);
|
||||
Assertion(false, "Unhandled op_num %d!", op_num);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -20012,7 +20014,7 @@ void sexp_ingame_ship_alt_name_or_display_name_or_callsign(ship *shipp, bool cle
|
||||
shipp->flags.set(Ship::Ship_Flags::Has_display_name);
|
||||
}
|
||||
else
|
||||
UNREACHABLE("Unhandled op_num %d!", op_num);
|
||||
Assertion(false, "Unhandled op_num %d!", op_num);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
@@ -20031,7 +20033,7 @@ void sexp_parse_ship_alt_name_or_display_name_or_callsign(p_object *parse_obj, b
|
||||
parse_obj->flags.remove(Mission::Parse_Object_Flags::SF_Has_display_name);
|
||||
}
|
||||
else
|
||||
UNREACHABLE("Unhandled op_num %d!", op_num);
|
||||
Assertion(false, "Unhandled op_num %d!", op_num);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -20056,7 +20058,7 @@ void sexp_parse_ship_alt_name_or_display_name_or_callsign(p_object *parse_obj, b
|
||||
parse_obj->flags.set(Mission::Parse_Object_Flags::SF_Has_display_name);
|
||||
}
|
||||
else
|
||||
UNREACHABLE("Unhandled op_num %d!", op_num);
|
||||
Assertion(false, "Unhandled op_num %d!", op_num);
|
||||
}
|
||||
|
||||
// Goober5000
|
||||
@@ -25101,7 +25103,7 @@ int process_special_sexps(int index)
|
||||
return SEXP_FALSE;
|
||||
|
||||
default:
|
||||
Assertion(false, "Special sexp processing code was called for an unsupported node type!");
|
||||
Warning(LOCATION, "special-check SEXP was given an unsupported check number (%d)!", index);
|
||||
}
|
||||
|
||||
return SEXP_FALSE;
|
||||
@@ -32107,7 +32109,7 @@ int query_operator_return_type(int op)
|
||||
return dynamicSEXP->getReturnType();
|
||||
}
|
||||
|
||||
Assertion(false, "query_operator_return_type() called for unsupported operator type %d!", op);
|
||||
UNREACHABLE("query_operator_return_type() called for unsupported operator type %d!", op);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33813,7 +33815,7 @@ int query_operator_argument_type(int op_index, int argnum)
|
||||
case 4:
|
||||
return OPF_BOOL;
|
||||
default:
|
||||
UNREACHABLE("Invalid argnum %d detected!", argnum);
|
||||
Assertion(false, "Invalid argnum %d detected!", argnum);
|
||||
return OPF_NULL;
|
||||
}
|
||||
|
||||
@@ -35022,7 +35024,7 @@ int query_operator_argument_type(int op_index, int argnum)
|
||||
return dynamicSEXP->getArgumentType(argnum);
|
||||
}
|
||||
|
||||
Assertion(false, "query_operator_argument_type(%d, %d) called for unsupported operator type!", op_const, argnum);
|
||||
UNREACHABLE("query_operator_argument_type(%d, %d) called for unsupported operator type!", op_const, argnum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36002,7 +36004,7 @@ int copy_node_to_replacement_args(int node, int container_value_index)
|
||||
Sexp_replacement_arguments.emplace_back(kv_pair.first.c_str(), -1);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
num_args = container.size();
|
||||
@@ -36052,7 +36054,7 @@ int check_dynamic_value_node_type(int node, bool is_string, bool is_number)
|
||||
return SEXP_CHECK_WRONG_CONTAINER_DATA_TYPE;
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unhandled dynamic value node %s. Please report!", Sexp_nodes[node].text);
|
||||
Assertion(false, "Unhandled dynamic value node %s. Please report!", Sexp_nodes[node].text);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -43,7 +43,7 @@ int LuaAISEXP::getArgumentType(int argnum) const {
|
||||
|
||||
int LuaAISEXP::execute(int /*node*/, int /*parent_node*/)
|
||||
{
|
||||
UNREACHABLE("Tried to execute AI Lua SEXP %s! AI-Goal SEXPs should never be run.", _name.c_str());
|
||||
Assertion(false, "Tried to execute AI Lua SEXP %s! AI-Goal SEXPs should never be run.", _name.c_str());
|
||||
return SEXP_CANT_EVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,8 +376,8 @@ luacpp::LuaValue LuaSEXP::sexpToLua(int node, int argnum, int parent_node) const
|
||||
auto text = CTEXT(node);
|
||||
return LuaValue::createValue(_action.getLuaState(), text);
|
||||
} else {
|
||||
UNREACHABLE(
|
||||
"Unhandled argument type! Someone added an argument type but didn't add handling code to execute().");
|
||||
Assertion(false,
|
||||
"Unhandled argument type '%s'! Someone added an argument type but didn't add handling code to execute().", argtype.first.c_str());
|
||||
return LuaValue::createNil(_action.getLuaState());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ int sexp_container::size() const
|
||||
} else if (is_map()) {
|
||||
return (int)map_data.size();
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -205,7 +205,7 @@ const SCP_string &sexp_container::get_value_at_index(int index) const
|
||||
// since map_data uses a custom hash function
|
||||
return std::next(map_data.cbegin(), index)->first;
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name.c_str(), (int)type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name.c_str(), static_cast<int>(type));
|
||||
return *list_data.cbegin(); // gibberish
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ SCP_string sexp_container::apply_list_modifier(ListModifier modifier, int data_i
|
||||
return list_get_at(data_index);
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled list modifier %d. Please report!", (int)modifier);
|
||||
UNREACHABLE("Unhandled list modifier %d. Please report!", static_cast<int>(modifier));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -320,7 +320,7 @@ const char *get_list_modifier_name(const ListModifier modifier)
|
||||
}
|
||||
}
|
||||
|
||||
UNREACHABLE("get_list_modifier_name() given unknown modifier %d", (int)modifier);
|
||||
Assertion(false, "get_list_modifier_name() given unknown modifier %d", static_cast<int>(modifier));
|
||||
return Empty_str;
|
||||
}
|
||||
|
||||
@@ -807,7 +807,7 @@ bool sexp_container_CTEXT_helper(int &node, sexp_container &container, SCP_strin
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!",
|
||||
container.container_name.c_str(),
|
||||
(int)container.type);
|
||||
static_cast<int>(container.type));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -908,7 +908,7 @@ int sexp_is_container_empty(int node)
|
||||
return SEXP_TRUE;
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
return SEXP_FALSE;
|
||||
@@ -931,7 +931,7 @@ int sexp_get_container_size(int node)
|
||||
} else if (container.is_list()) {
|
||||
return (int)container.list_data.size();
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -1405,7 +1405,7 @@ void sexp_clear_container(int node)
|
||||
} else if (container.is_list()) {
|
||||
container.list_data.clear();
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ void sexp_copy_container(int node)
|
||||
add_to_map_internal(dest_container, kv_pair.first, kv_pair.second);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", src_container_name, (int)src_container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", src_container_name, static_cast<int>(src_container.type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1575,7 +1575,7 @@ void sexp_apply_container_filter(int node)
|
||||
container.map_data.erase(filter_data);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1688,7 +1688,7 @@ int collect_container_values(int node,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, (int)container.type);
|
||||
UNREACHABLE("Container %s has invalid type (%d). Please report!", container_name, static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +393,9 @@ auto ParticleEffect::processSourceInternal(float interp, const ParticleSource& s
|
||||
info.use_angle = false;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Rotation type not supported");
|
||||
UNREACHABLE("Rotation type %d not supported", static_cast<int>(m_rotation_type));
|
||||
info.use_angle = Randomize_particle_rotation;
|
||||
break;
|
||||
}
|
||||
|
||||
if (m_particleTrail.isValid()) {
|
||||
|
||||
@@ -158,7 +158,8 @@ namespace particle {
|
||||
volume = std::make_shared<ModelSurfaceVolume>();
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid volume type specified!");
|
||||
Warning(LOCATION, "Invalid volume type specified!");
|
||||
return nullptr;
|
||||
}
|
||||
volume->parse();
|
||||
return volume;
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace particle {
|
||||
|
||||
vec3d sampleRandomPoint(const matrix &orientation, decltype(ParticleEffect::modular_curves_definition)::input_type_t source, float particlesFraction, const EffectHost& host) override;
|
||||
void parse() override {
|
||||
UNREACHABLE("Cannot parse Legacy Particle Volume!");
|
||||
Assertion(false, "Cannot parse Legacy Particle Volume!");
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -1550,7 +1550,7 @@ void pilotfile::csg_read_container(sexp_container& container)
|
||||
container.map_data.emplace(temp_key, temp_buf);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1590,7 +1590,7 @@ void pilotfile::csg_write_container(const sexp_container &container)
|
||||
cfwrite_string_len(key_data.second.c_str(), cfp);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void pilotfile::update_stats_backout(scoring_struct *stats, bool training)
|
||||
if (j >= 0) {
|
||||
p_stats->medals_earned[j].val = std::max(0,p_stats->medals_earned[j].val--);
|
||||
} else {
|
||||
Assertion(true, "Medal '%s' not found, should have been added by pilotfile::update_stats.", Medals[stats->m_medal_earned].name);
|
||||
Assertion(false, "Medal '%s' not found, should have been added by pilotfile::update_stats.", Medals[stats->m_medal_earned].name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ void pilotfile::update_stats_backout(scoring_struct *stats, bool training)
|
||||
if (j >= 0) {
|
||||
p_stats->ship_kills[j].val -= stats->m_okKills[i];
|
||||
} else {
|
||||
UNREACHABLE("Ship kills of '%s' not found, should have been added by pilotfile::update_stats.", Ship_info[i].name);
|
||||
Assertion(false, "Ship kills of '%s' not found, should have been added by pilotfile::update_stats.", Ship_info[i].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ void pilotfile::plr_read_containers()
|
||||
container.map_data.emplace(key, data);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
Assert(container.is_eternal());
|
||||
@@ -457,7 +457,7 @@ void pilotfile::plr_write_containers()
|
||||
++i;
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
handler->endSectionWrite();
|
||||
|
||||
@@ -1313,8 +1313,8 @@ bool popup_conditional_create(int flags, ...)
|
||||
char *format, *s;
|
||||
va_list args;
|
||||
|
||||
Assertion(!Popup_is_active, "Can't create a conditional popup while another popup is open!");
|
||||
if (Popup_is_active) {
|
||||
UNREACHABLE("Can't create a conditional popup while another popup is open!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -535,7 +535,7 @@ int popupdead_do_frame(float /*frametime*/)
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Invalid or unknown popupdead multi type!");
|
||||
UNREACHABLE("Invalid or unknown popupdead multi type %d!", Popupdead_multi_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -83,8 +83,8 @@ int find_prop_empty_slot() {
|
||||
|
||||
prop* prop_id_lookup(int id)
|
||||
{
|
||||
Assertion(id >= 0 && id < static_cast<int>(Props.size()) && Props[id].has_value(), "Could not find prop for id %d", id);
|
||||
if (id < 0 || id >= static_cast<int>(Props.size()) || !Props[id].has_value()) {
|
||||
Assertion(false, "Could not find prop for id %d", id);
|
||||
return nullptr;
|
||||
}
|
||||
return &Props[id].value();
|
||||
@@ -102,8 +102,8 @@ int prop_category_id_lookup(const SCP_string& category)
|
||||
|
||||
prop_category* prop_get_category(int index)
|
||||
{
|
||||
Assertion(SCP_vector_inbounds(Prop_categories, index), "Invalid category index %d", index);
|
||||
if (!SCP_vector_inbounds(Prop_categories, index)) {
|
||||
Assertion(false, "Invalid category index %d", index);
|
||||
return nullptr;
|
||||
}
|
||||
return &Prop_categories[index];
|
||||
@@ -1066,7 +1066,7 @@ int prop_check_collision(object* prop_obj, object* other_obj, vec3d* hitpos, col
|
||||
mc.radius = light_obj->radius;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unknown object type in prop_check_collision");
|
||||
UNREACHABLE("Unknown object type %d in prop_check_collision", light_obj->type);
|
||||
};
|
||||
|
||||
mc_ret_val = model_collide(&mc);
|
||||
|
||||
@@ -62,7 +62,7 @@ bool RocketFileInterface::Seek(FileHandle file, long offset, int origin)
|
||||
cf_seek_mode = CF_SEEK_END;
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid seek mode encountered!");
|
||||
UNREACHABLE("Invalid seek mode %d encountered!", origin);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ int ade_table_entry::SetTable(lua_State* L, int p_amt_ldx, int p_mtb_ldx)
|
||||
}
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled value type '%c'!", Type);
|
||||
Assertion(false, "Unhandled value type '%c'!", Type);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -642,8 +642,8 @@ std::unique_ptr<DocumentationElement> ade_table_entry::ToDocumentationElement(
|
||||
case 's':
|
||||
case 'x':
|
||||
default:
|
||||
UNREACHABLE("Unknown Type %c was used used!", Type);
|
||||
break;
|
||||
Assertion(false, "Unknown Type %c was used used!", Type);
|
||||
return {};
|
||||
}
|
||||
|
||||
if (Name != nullptr) {
|
||||
|
||||
@@ -125,7 +125,7 @@ inline bool get_args_actual(lua_State* /*L*/, get_args_state& state, const char*
|
||||
state.counted_args++;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid format string '%s'!", fmt);
|
||||
Assertion(false, "Invalid format string '%s'!", fmt);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ static int AxisActionInverted_sub(int AxisAction, int ordinal, lua_State* L)
|
||||
bind = &Control_config[AxisAction].second;
|
||||
else
|
||||
{
|
||||
UNREACHABLE("Currently only primary and secondary bindings are supported!");
|
||||
Assertion(false, "Currently only primary and secondary bindings are supported!");
|
||||
return ADE_RETURN_NIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ ADE_FUNC(__call, l_RPC, "[any = nil, enumeration recipient /* RPC_* */]", "Calls
|
||||
recipient_lua = lua_net_reciever::BOTH;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("RPC recipient enum is bad! Get a programmer!");
|
||||
Assertion(false, "RPC recipient enum is bad! Get a programmer!");
|
||||
return ade_set_error(L, "b", false);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ ADE_FUNC(__call, l_RPC, "[any = nil, enumeration recipient /* RPC_* */]", "Calls
|
||||
mode_lua = lua_net_mode::UNRELIABLE;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("RPC mode enum is bad! Get a programmer!");
|
||||
Assertion(false, "RPC mode enum is bad! Get a programmer!");
|
||||
return ade_set_error(L, "b", false);
|
||||
}
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ void ade_output_type_link(FILE* fp, const ade_type_info& type_info)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Assertion(false, "Unhandled type!");
|
||||
UNREACHABLE("Unhandled type %d!", static_cast<int>(type_info.getType()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ static json_t* json_doc_generate_return_type(const scripting::ade_type_info& typ
|
||||
}
|
||||
}
|
||||
|
||||
UNREACHABLE("Unknown type type!");
|
||||
UNREACHABLE("Unknown type type %d!", static_cast<int>(type_info.getType()));
|
||||
return nullptr;
|
||||
}
|
||||
static json_t* json_doc_function_signature(const SCP_vector<scripting::argument_def>& args)
|
||||
|
||||
@@ -176,7 +176,7 @@ SCP_string get_output_type_link(const ade_type_info& type_info, SCP_string neste
|
||||
return get_output_type_link(type_info.elements().front());
|
||||
|
||||
default:
|
||||
Assertion(false, "Unhandled type!");
|
||||
UNREACHABLE("Unhandled type %d!", static_cast<int>(type_info.getType()));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -6029,7 +6029,7 @@ static void parse_ship_values(ship_info* sip, const bool is_template, const bool
|
||||
case -1: // Possible return value if -noparseerrors is used
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("This should never happen.\n"); // Impossible return value from required_string_one_of.
|
||||
UNREACHABLE("This should never happen"); // Impossible return value from required_string_one_of.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9171,7 +9171,7 @@ void wing_maybe_cleanup( wing *wingp, int team )
|
||||
// TODO: I think this Int3() is triggered when a wing whose ships are all docked to ships of another
|
||||
// wing departs. It can be reliably seen in TVWP chapter 1 mission 7, when Torino and Iota wing depart.
|
||||
// Not sure how to fix this. -- Goober5000
|
||||
UNREACHABLE("A ship is still present even though its wing should be gone!");
|
||||
Assertion(false, "A ship %s is still present even though its wing should be gone!", Ships[Objects[so->objnum].instance].ship_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14962,7 +14962,7 @@ bool ship_select_next_primary(object *objp, CycleDirection direction)
|
||||
}
|
||||
else if ( swp->num_primary_banks > MAX_SHIP_PRIMARY_BANKS )
|
||||
{
|
||||
UNREACHABLE("The ship %s has more primary banks than the maximum!", shipp->ship_name);
|
||||
Assertion(false, "The ship %s has more primary banks than the maximum!", shipp->ship_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15267,8 +15267,8 @@ int get_available_secondary_weapons(object *objp, int *outlist, int *outbanklist
|
||||
weapon_range_max = wepp->weapon_range;
|
||||
//If weapon range is not set in the weapon info, derive it
|
||||
if (weapon_range_max >= WEAPON_DEFAULT_TABLED_MAX_RANGE) {
|
||||
Assertion(!wepp->is_beam(), "Since when do we have a beam that is a secondary weapon?");
|
||||
if (wepp->is_beam()) {
|
||||
UNREACHABLE("Since when do we have a beam that is a secondary weapon?");
|
||||
weapon_range_max = wepp->b_info.range;
|
||||
}
|
||||
else {
|
||||
@@ -22339,7 +22339,7 @@ bool ship::is_arriving(ship::warpstage stage, bool dock_leader_or_single) const
|
||||
}
|
||||
|
||||
// should never reach here
|
||||
Assertion(false, "ship::is_arriving didn't handle all possible states; get a coder!");
|
||||
UNREACHABLE("ship::is_arriving didn't handle all possible states; get a coder!");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -2303,7 +2303,7 @@ void shipfx_do_lightning_arcs_frame( ship *shipp )
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unhandled case %d for electrical arc creation in shipfx_do_lightning_arcs_frame()!", n);
|
||||
Assertion(false, "Unhandled case %d for electrical arc creation in shipfx_do_lightning_arcs_frame()!", n);
|
||||
}
|
||||
|
||||
// determine what kind of arc to create
|
||||
|
||||
@@ -103,7 +103,7 @@ AudioProperties getAdjustedAudioProps(const AudioProperties& baseProps)
|
||||
adjusted.format = AV_SAMPLE_FMT_FLT;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled switch value!");
|
||||
UNREACHABLE("Unhandled switch value %d!", bytes_per_sample);
|
||||
adjusted.format = AV_SAMPLE_FMT_NONE;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -638,8 +638,8 @@ sound_handle snd_play(game_snd* gs, float pan, float vol_scale, int priority, bo
|
||||
if (!ds_initialized)
|
||||
return sound_handle::invalid();
|
||||
|
||||
Assertion(gs != nullptr, "gamesnd parameter must not be null!");
|
||||
if (gs == nullptr) {
|
||||
UNREACHABLE("gamesnd parameter must not be null!");
|
||||
return sound_handle::invalid();
|
||||
}
|
||||
if (gs->flags & GAME_SND_NOT_VALID) {
|
||||
@@ -731,8 +731,8 @@ sound_handle snd_play_3d(game_snd* gs, const vec3d* source_pos, const vec3d* lis
|
||||
if (!ds_initialized)
|
||||
return sound_handle::invalid();
|
||||
|
||||
Assertion(gs != nullptr, "gamesnd parameter must not be null!");
|
||||
if (gs == nullptr) {
|
||||
UNREACHABLE("gamesnd parameter must not be null!");
|
||||
return sound_handle::invalid();
|
||||
}
|
||||
if (gs->flags & GAME_SND_NOT_VALID) {
|
||||
@@ -948,8 +948,8 @@ sound_handle snd_play_looping(game_snd* gs, float pan, int /*start_loop*/, int /
|
||||
if (!ds_initialized)
|
||||
return sound_handle::invalid();
|
||||
|
||||
Assertion(gs != nullptr, "gamesnd parameter must not be null!");
|
||||
if (gs == nullptr) {
|
||||
UNREACHABLE("gamesnd parameter must not be null!");
|
||||
return sound_handle::invalid();
|
||||
}
|
||||
if (gs->flags & GAME_SND_NOT_VALID) {
|
||||
|
||||
@@ -24,7 +24,7 @@ const char* getTypeStr(tracing::EventType type) {
|
||||
case EventType::Counter:
|
||||
return "C";
|
||||
default:
|
||||
UNREACHABLE("Invalid enum value!");
|
||||
UNREACHABLE("Invalid enum value %d!", static_cast<int>(type));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ void TraceEventWriter::processEvent(const trace_event* event) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
UNREACHABLE("Unhandled enum value! This function should not have been called with this value!");
|
||||
UNREACHABLE("Unhandled enum value %d! This function should not have been called with this value!", static_cast<int>(event->type));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ void process_gpu_events() {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid event type!");
|
||||
UNREACHABLE("Invalid event type %d!", static_cast<int>(first.base_evt.type));
|
||||
gpu_events.pop();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -616,9 +616,7 @@ private:
|
||||
float result = 1.f;
|
||||
//GCC11+ and Clang will properly unroll this fold expression into a switch-case jumptable
|
||||
bool matched_case = ((idx == input_index ? (result = std::tuple_element_t<idx, input_grabber_tuple>::template grab<std::tuple_element_t<idx, input_tuple_index>::value>(input)), true : false) || ...);
|
||||
if (!matched_case) {
|
||||
UNREACHABLE("Modular Curves requested Input %zu which has no grabber!", input_index);
|
||||
}
|
||||
Assertion(matched_case, "Modular Curves requested Input %zu which has no grabber!", input_index);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ const char* get_encoding_string(Encoding encoding) {
|
||||
return "UTF-8";
|
||||
case Encoding::Encoding_current:
|
||||
default:
|
||||
UNREACHABLE("Unknown encoding type was passed.\n");
|
||||
UNREACHABLE("Unknown encoding type %d was passed.", static_cast<int>(encoding));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ bool beam_has_valid_params(beam_fire_info* fire_info) {
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Unrecognized beam fire method in beam_has_valid_params");
|
||||
UNREACHABLE("Unrecognized beam fire method %d in beam_has_valid_params", fire_info->fire_method);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -356,8 +356,8 @@ int beam_fire(beam_fire_info *fire_info)
|
||||
}
|
||||
|
||||
// make sure the beam_info_index is valid
|
||||
Assertion((fire_info->beam_info_index >= 0) && (fire_info->beam_info_index < weapon_info_size()) && (Weapon_info[fire_info->beam_info_index].wi_flags[Weapon::Info_Flags::Beam]), "beam_info_index (%d) invalid (either <0, >= %d, or not actually a beam)!\n", fire_info->beam_info_index, weapon_info_size());
|
||||
if ((fire_info->beam_info_index < 0) || (fire_info->beam_info_index >= weapon_info_size()) || !(Weapon_info[fire_info->beam_info_index].wi_flags[Weapon::Info_Flags::Beam])) {
|
||||
UNREACHABLE("beam_info_index (%d) invalid (either <0, >= %d, or not actually a beam)!\n", fire_info->beam_info_index, weapon_info_size());
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2539,13 +2539,13 @@ void beam_get_binfo(beam *b, float accuracy, int num_shots, int burst_seed, floa
|
||||
if (b->flags & BF_IS_FIGHTER_BEAM) {
|
||||
orient = b->objp->orient;
|
||||
} else if (b->subsys) {
|
||||
vec3d fvec, uvec, target_pos;
|
||||
vec3d fvec, uvec, target_pos = vmd_zero_vector;
|
||||
if (b->target)
|
||||
target_pos = b->target->pos;
|
||||
else if (b->flags & BF_TARGETING_COORDS)
|
||||
target_pos = b->target_pos1;
|
||||
else
|
||||
UNREACHABLE("Turret beam fired without a target or target coordinates?");
|
||||
Assertion(false, "Turret beam fired without a target or target coordinates?");
|
||||
vm_vec_normalized_dir(&fvec, &target_pos, &turret_point);
|
||||
vm_vec_unrotate(&uvec, &b->subsys->system_info->turret_norm, &b->objp->orient);
|
||||
vm_vector_2_matrix_norm(&orient, &fvec, &uvec);
|
||||
@@ -2968,7 +2968,7 @@ void beam_aim(beam *b)
|
||||
break;
|
||||
|
||||
default:
|
||||
UNREACHABLE("Impossible beam type (%d); get a coder!\n", (int)b->type);
|
||||
UNREACHABLE("Impossible beam type (%d); get a coder!\n", static_cast<int>(b->type));
|
||||
}
|
||||
|
||||
if (!Weapon_info[b->weapon_info_index].wi_flags[Weapon::Info_Flags::No_collide]) {
|
||||
|
||||
@@ -747,7 +747,7 @@ static particle::ParticleEffectHandle convertLegacyPspewBuffer(const pspew_legac
|
||||
absolutePositionVelocityInherit = true;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid PSPEW legacy type!");
|
||||
UNREACHABLE("Invalid PSPEW legacy type %d!", pspew_buffer.particle_spew_type);
|
||||
}
|
||||
|
||||
return particle::ParticleManager::get()->addEffect(particle::ParticleEffect(
|
||||
@@ -5260,7 +5260,8 @@ void weapon_level_init()
|
||||
case LockRestrictionType::CLASS: idx = ship_info_lookup(name); break;
|
||||
case LockRestrictionType::SPECIES: idx = species_info_lookup(name); break;
|
||||
case LockRestrictionType::IFF: idx = iff_lookup(name); break;
|
||||
default: Assertion(false, "Unknown multi lock restriction type %d", (int)pair.first);
|
||||
default:
|
||||
UNREACHABLE("Unknown multi lock restriction type %d", static_cast<int>(pair.first));
|
||||
idx = -1;
|
||||
}
|
||||
if ( idx >= 0 ) {
|
||||
|
||||
@@ -401,7 +401,7 @@ void CAddModifyContainerDlg::OnListerSelectionChange()
|
||||
const SCP_string &key = m_lister_keys[index];
|
||||
update_text_edit_boxes(key, container.map_data.at(key));
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -601,7 +601,7 @@ void CAddModifyContainerDlg::OnContainerUpdate()
|
||||
key_edit->GetWindowText(key_str);
|
||||
container.map_data[SCP_string(key_str)] = data_str;
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
update_data_lister();
|
||||
@@ -755,7 +755,7 @@ void CAddModifyContainerDlg::update_data_lister()
|
||||
return std::atoi(str1.c_str()) < std::atoi(str2.c_str());
|
||||
});
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
for (const auto &key : m_lister_keys) {
|
||||
@@ -763,7 +763,7 @@ void CAddModifyContainerDlg::update_data_lister()
|
||||
m_container_data_lister.AddString(lister_entry.c_str());
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unknown container type %d", (int)container.type);
|
||||
UNREACHABLE("Unknown container type %d", static_cast<int>(container.type));
|
||||
}
|
||||
|
||||
m_container_data_lister.EnableWindow(m_container_data_lister.GetCount() > 0);
|
||||
|
||||
+1
-1
@@ -643,9 +643,9 @@ BOOL CFREDDoc::OnOpenDocument(LPCTSTR pathname)
|
||||
SCP_string created = The_mission.created;
|
||||
CFileLocation res = cf_find_file_location(pathname, CF_TYPE_ANY);
|
||||
time_t modified = res.m_time;
|
||||
Assertion(res.found, "Couldn't find path '%s' even though parse_main() succeeded!", pathname);
|
||||
if (!res.found)
|
||||
{
|
||||
UNREACHABLE("Couldn't find path '%s' even though parse_main() succeeded!", pathname);
|
||||
created = ""; // prevent any backup check from succeeding so we just load the actual specified file
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ void setOGLProperties(const os::ViewPortProperties& props)
|
||||
profile = SDL_GL_CONTEXT_PROFILE_ES;
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Unhandled profile value!");
|
||||
UNREACHABLE("Unhandled profile value %d!", static_cast<int>(props.gl_attributes.profile));
|
||||
return;
|
||||
}
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile);
|
||||
@@ -131,7 +131,7 @@ class SDLWindowViewPort: public os::Viewport {
|
||||
SDL_SetWindowFullscreen(_window, SDL_WINDOW_FULLSCREEN);
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Invalid window state!");
|
||||
UNREACHABLE("Invalid window state %d!", static_cast<int>(state));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3007,7 +3007,7 @@ void say_view_target()
|
||||
}
|
||||
|
||||
default:
|
||||
UNREACHABLE("Trying to view an invalid object!");
|
||||
UNREACHABLE("Trying to view an invalid object %d!", Objects[Player_ai->target_objnum].type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ void ObjectOrientEditorDialogModel::initializeData()
|
||||
_pointToObjectList.emplace_back(ObjectEntry(Props[ptr->instance]->prop_name, OBJ_INDEX(ptr)));
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Unknown object type in Object Orient Dialog!"); // unknown object type
|
||||
UNREACHABLE("Unknown object type %d in Object Orient Dialog!", ptr->type); // unknown object type
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ SCP_vector<SCP_string> VoiceActingManagerModel::fileChoices()
|
||||
out.emplace_back(".wav");
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid file type selected!");
|
||||
UNREACHABLE("Invalid file type %d selected!", i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ SCP_string VoiceActingManagerModel::getSuffixString() const
|
||||
case Suffix::WAV:
|
||||
return ".wav";
|
||||
default:
|
||||
Assertion(false, "Invalid file type selected!");
|
||||
UNREACHABLE("Invalid file type %d selected!", static_cast<int>(_suffix));
|
||||
return ".wav";
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,7 @@ SCP_string VoiceActingManagerModel::generateFilename(ExportSelection sel, int nu
|
||||
prefix += _abbrevMessage;
|
||||
break;
|
||||
default:
|
||||
Assertion(false, "Invalid export selection for filename generation!");
|
||||
UNREACHABLE("Invalid export selection %d for filename generation!", static_cast<int>(sel));
|
||||
prefix = ""; // Fallback, shouldn't happen
|
||||
}
|
||||
|
||||
|
||||
@@ -2607,7 +2607,7 @@ void FredView::handleObjectEditor(int objNum) {
|
||||
on_actionWaypoint_Paths_triggered(false);
|
||||
}
|
||||
} else {
|
||||
UNREACHABLE("Unhandled object type!");
|
||||
Assertion(false, "Unhandled object type %d!", Objects[objNum].type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ void TeamLoadoutDialog::on_copyLoadoutToOtherTeamsButton_clicked()
|
||||
case QMessageBox::Cancel:
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE("Bad return value from confirmation message box in the Loadout dialog editor.");
|
||||
UNREACHABLE("Bad return value %d from confirmation message box in the Loadout dialog editor.", ret);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ int VoiceActingManager::exportSelectionToIndex(ExportSelection sel)
|
||||
case ExportSelection::Messages:
|
||||
return 4;
|
||||
default:
|
||||
Assertion(false, "Invalid export selection!");
|
||||
UNREACHABLE("Invalid export selection %d!", static_cast<int>(sel));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@ int VoiceActingManager::suffixToIndex(Suffix s)
|
||||
case Suffix::OGG:
|
||||
return 1;
|
||||
default:
|
||||
Assertion(false, "Invalid file type selected!");
|
||||
UNREACHABLE("Invalid file type %d selected!", static_cast<int>(s));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -183,7 +183,7 @@ Suffix VoiceActingManager::indexToSuffix(int idx)
|
||||
case 1:
|
||||
return Suffix::OGG;
|
||||
default:
|
||||
Assertion(false, "Invalid file type selected!");
|
||||
UNREACHABLE("Invalid file type %d selected", idx);
|
||||
return Suffix::WAV;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ inline const SeverityInfo& infoFor(ErrorSeverity sev) {
|
||||
case ErrorSeverity::Warning: return severity_info[2];
|
||||
case ErrorSeverity::Potential: return severity_info[3];
|
||||
}
|
||||
UNREACHABLE("Unhandled ErrorSeverity value");
|
||||
UNREACHABLE("Unhandled ErrorSeverity value %d", static_cast<int>(sev));
|
||||
return severity_info[1];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user