vkd3d: Add a macro to mark unreachable code.

This should silence warnings about some branches non returning any value
without requiring additional "return 0" statement or similar.

Also, in theory this might enable to compiler to optimize the program
a little bit more, though that's unlikely to have any measurable effect.
This commit is contained in:
Giovanni Mascellani
2022-08-31 13:25:24 +02:00
committed by Alexandre Julliard
parent 56b2f56b86
commit d5fd309ef8
Notes: Alexandre Julliard 2022-10-18 00:13:00 +02:00
Approved-by: Zebediah Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/11
10 changed files with 52 additions and 71 deletions

View File

@@ -80,8 +80,7 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str
}
default:
assert(0);
return NULL;
vkd3d_unreachable();
}
if (offset)
@@ -1763,8 +1762,7 @@ static void allocate_const_registers_recurse(struct hlsl_ctx *ctx, struct hlsl_b
return;
default:
assert(0);
return;
vkd3d_unreachable();
}
defs->values[constant->reg.id + y].f[x] = f;
}
@@ -2149,8 +2147,7 @@ bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hl
break;
default:
assert(0);
break;
vkd3d_unreachable();
}
type = hlsl_get_element_type_from_path_index(ctx, type, path_node);