glsl: Annotate _mesa_glsl_error() with PRINTFLIKE
And fix all the errors it found. Note that for the unsized array error, we will print the toplevel type -- so that the fact that an inner array is unsized can be seen. Reviewed-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25200>
This commit is contained in:
@@ -1537,8 +1537,8 @@ ast_expression::do_hir(exec_list *instructions,
|
||||
*/
|
||||
|
||||
if (op[0]->type == glsl_type::void_type || op[1]->type == glsl_type::void_type) {
|
||||
_mesa_glsl_error(& loc, state, "`%s': wrong operand types: "
|
||||
"no operation `%1$s' exists that takes a left-hand "
|
||||
_mesa_glsl_error(& loc, state, "wrong operand types: "
|
||||
"no operation `%s' exists that takes a left-hand "
|
||||
"operand of type 'void' or a right operand of type "
|
||||
"'void'", (this->oper == ast_equal) ? "==" : "!=");
|
||||
error_emitted = true;
|
||||
@@ -3676,14 +3676,15 @@ static inline void
|
||||
validate_array_dimensions(const glsl_type *t,
|
||||
struct _mesa_glsl_parse_state *state,
|
||||
YYLTYPE *loc) {
|
||||
const glsl_type *top = t;
|
||||
if (t->is_array()) {
|
||||
t = t->fields.array;
|
||||
while (t->is_array()) {
|
||||
if (t->is_unsized_array()) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"only the outermost array dimension can "
|
||||
"be unsized",
|
||||
t->name);
|
||||
"be unsized, but got %s",
|
||||
top->name);
|
||||
break;
|
||||
}
|
||||
t = t->fields.array;
|
||||
|
@@ -1800,7 +1800,7 @@ layout_qualifier_id:
|
||||
if (!state->has_geometry_shader()) {
|
||||
_mesa_glsl_error(& @3, state,
|
||||
"#version 150 max_vertices qualifier "
|
||||
"specified", $3);
|
||||
"specified");
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -77,7 +77,7 @@ typedef struct YYLTYPE {
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
|
||||
const char *fmt, ...);
|
||||
const char *fmt, ...) PRINTFLIKE(3, 4);
|
||||
|
||||
|
||||
struct _mesa_glsl_parse_state {
|
||||
|
Reference in New Issue
Block a user