Commit 4d7899fe authored by Paul Berry's avatar Paul Berry

glsl: Be consistent about '\n', '.', and capitalization in errors/warnings.

The majority of calls to _mesa_glsl_error(), _mesa_glsl_warning(), and
_mesa_glsl_parse_state::check_version() use a message that begins with
a lower case letter and ends without a period.  This patch makes all
messages follow that convention.

Also, error/warning messages shouldn't end in '\n', since
_mesa_glsl_msg() automatically adds '\n' at the end of the message.
Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
parent 8c3d3622
......@@ -626,7 +626,7 @@ process_vec_mat_constructor(exec_list *instructions,
* int i = { 1 }; // illegal, i is not an aggregate"
*/
if (constructor_type->vector_elements <= 1) {
_mesa_glsl_error(loc, state, "Aggregates can only initialize vectors, "
_mesa_glsl_error(loc, state, "aggregates can only initialize vectors, "
"matrices, arrays, and structs");
return ir_rvalue::error_value(ctx);
}
......
This diff is collapsed.
......@@ -129,7 +129,7 @@ ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
if ((this->flags.i & q.flags.i & ~(ubo_mat_mask.flags.i |
ubo_layout_mask.flags.i)) != 0) {
_mesa_glsl_error(loc, state,
"duplicate layout qualifiers used\n");
"duplicate layout qualifiers used");
return false;
}
......
......@@ -77,7 +77,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
} else if (yyextra->is_version(reserved_glsl, \
reserved_glsl_es)) { \
_mesa_glsl_error(yylloc, yyextra, \
"Illegal use of reserved word `%s'", yytext); \
"illegal use of reserved word `%s'", yytext); \
return ERROR_TOK; \
} else { \
yylval->identifier = strdup(yytext); \
......@@ -93,7 +93,7 @@ static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
do { \
if (yyextra->is_version(0, 300)) { \
_mesa_glsl_error(yylloc, yyextra, \
"Illegal use of reserved word `%s'", yytext); \
"illegal use of reserved word `%s'", yytext); \
return ERROR_TOK; \
} else { \
return token; \
......@@ -124,10 +124,10 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
/* Note that signed 0xffffffff is valid, not out of range! */
if (state->is_version(130, 300)) {
_mesa_glsl_error(lloc, state,
"Literal value `%s' out of range", text);
"literal value `%s' out of range", text);
} else {
_mesa_glsl_warning(lloc, state,
"Literal value `%s' out of range", text);
"literal value `%s' out of range", text);
}
} else if (base == 10 && !is_uint && (unsigned)value > (unsigned)INT_MAX + 1) {
/* Tries to catch unintentionally providing a negative value.
......@@ -135,7 +135,7 @@ literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
* want to warn for INT_MAX.
*/
_mesa_glsl_warning(lloc, state,
"Signed literal value `%s' is interpreted as %d",
"signed literal value `%s' is interpreted as %d",
text, lval->n);
}
return is_uint ? UINTCONSTANT : INTCONSTANT;
......
This diff is collapsed.
......@@ -204,7 +204,7 @@ _mesa_glsl_parse_state::check_version(unsigned required_glsl_version,
requirement_string = ralloc_asprintf(this, " (%s required)",
glsl_es_version_string);
}
_mesa_glsl_error(locp, this, "%s in %s%s.",
_mesa_glsl_error(locp, this, "%s in %s%s",
problem, this->get_version_string(),
requirement_string);
......@@ -234,15 +234,15 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
*/
} else if (strcmp(ident, "compatibility") == 0) {
_mesa_glsl_error(locp, this,
"The compatibility profile is not supported.\n");
"the compatibility profile is not supported");
} else {
_mesa_glsl_error(locp, this,
"\"%s\" is not a valid shading language profile; "
"if present, it must be \"core\".\n", ident);
"if present, it must be \"core\"", ident);
}
} else {
_mesa_glsl_error(locp, this,
"Illegal text following version number\n");
"illegal text following version number");
}
}
......@@ -251,7 +251,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
if (es_token_present) {
_mesa_glsl_error(locp, this,
"GLSL 1.00 ES should be selected using "
"`#version 100'\n");
"`#version 100'");
} else {
this->es_shader = true;
}
......@@ -270,7 +270,7 @@ _mesa_glsl_parse_state::process_version_directive(YYLTYPE *locp, int version,
if (!supported) {
_mesa_glsl_error(locp, this, "%s is not supported. "
"Supported versions are: %s\n",
"Supported versions are: %s",
this->get_version_string(),
this->supported_version_string);
......@@ -621,14 +621,14 @@ _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
behavior = extension_disable;
} else {
_mesa_glsl_error(behavior_locp, state,
"Unknown extension behavior `%s'",
"unknown extension behavior `%s'",
behavior_string);
return false;
}
if (strcmp(name, "all") == 0) {
if ((behavior == extension_enable) || (behavior == extension_require)) {
_mesa_glsl_error(name_locp, state, "Cannot %s all extensions",
_mesa_glsl_error(name_locp, state, "cannot %s all extensions",
(behavior == extension_enable)
? "enable" : "require");
return false;
......
......@@ -53,13 +53,13 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
expr->primary_expression.identifier);
if (result->type->is_error()) {
_mesa_glsl_error(& loc, state, "Cannot access field `%s' of "
_mesa_glsl_error(& loc, state, "cannot access field `%s' of "
"structure",
expr->primary_expression.identifier);
}
} else if (expr->subexpressions[1] != NULL) {
/* Handle "method calls" in GLSL 1.20 - namely, array.length() */
state->check_version(120, 300, &loc, "Methods not supported");
state->check_version(120, 300, &loc, "methods not supported");
ast_expression *call = expr->subexpressions[1];
assert(call->oper == ast_function_call);
......@@ -69,11 +69,11 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
if (strcmp(method, "length") == 0) {
if (!call->expressions.is_empty())
_mesa_glsl_error(&loc, state, "length method takes no arguments.");
_mesa_glsl_error(&loc, state, "length method takes no arguments");
if (op->type->is_array()) {
if (op->type->array_size() == 0)
_mesa_glsl_error(&loc, state, "length called on unsized array.");
_mesa_glsl_error(&loc, state, "length called on unsized array");
result = new(ctx) ir_constant(op->type->array_size());
} else if (op->type->is_vector()) {
......@@ -82,7 +82,7 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
result = new(ctx) ir_constant((int) op->type->vector_elements);
} else {
_mesa_glsl_error(&loc, state, "length method on matrix only available"
"with ARB_shading_language_420pack.");
"with ARB_shading_language_420pack");
}
} else if (op->type->is_matrix()) {
if (state->ARB_shading_language_420pack_enable) {
......@@ -90,11 +90,11 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
result = new(ctx) ir_constant((int) op->type->matrix_columns);
} else {
_mesa_glsl_error(&loc, state, "length method on matrix only available"
"with ARB_shading_language_420pack.");
"with ARB_shading_language_420pack");
}
}
} else {
_mesa_glsl_error(&loc, state, "Unknown method: `%s'.", method);
_mesa_glsl_error(&loc, state, "unknown method: `%s'", method);
}
} else if (op->type->is_vector() ||
(state->ARB_shading_language_420pack_enable &&
......@@ -109,12 +109,12 @@ _mesa_ast_field_selection_to_hir(const ast_expression *expr,
* FINISHME: ir_swizzle::create. This allows the generation of more
* FINISHME: specific error messages.
*/
_mesa_glsl_error(& loc, state, "Invalid swizzle / mask `%s'",
_mesa_glsl_error(& loc, state, "invalid swizzle / mask `%s'",
expr->primary_expression.identifier);
}
} else {
_mesa_glsl_error(& loc, state, "Cannot access field `%s' of "
"non-structure / non-vector.",
_mesa_glsl_error(& loc, state, "cannot access field `%s' of "
"non-structure / non-vector",
expr->primary_expression.identifier);
}
......
......@@ -298,7 +298,7 @@ emit_errors_unlinked(const void *key, void *data, void *closure)
memset(&loc, 0, sizeof(loc));
_mesa_glsl_error(&loc, state,
"function `%s' has static recursion.",
"function `%s' has static recursion",
proto);
ralloc_free(proto);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment