mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
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:
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
@@ -1086,8 +1086,7 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
|
||||
case HLSL_TYPE_BOOL:
|
||||
return !!value->u;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1104,10 +1103,10 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
|
||||
case HLSL_IR_STORE:
|
||||
WARN("Invalid node type %s.\n", hlsl_node_type_to_string(node->type));
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(0);
|
||||
return 0;
|
||||
default:
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
static bool expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
|
||||
@@ -2510,8 +2509,7 @@ static unsigned int hlsl_offset_dim_count(enum hlsl_sampler_dim dim)
|
||||
/* Offset parameters not supported for these types. */
|
||||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
return 0;
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user