glsl: Use (const char *) in AST nodes rather than plain (char *).
Nothing actually relied on them being mutable, and there was at least one cast which discarded const qualifiers. The next patch would have introduced many more. Casting away const qualifiers should be avoided if at all possible. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:

committed by
Eric Anholt

parent
68b99be409
commit
b2c0df2b60
@@ -206,7 +206,7 @@ public:
|
|||||||
subexpressions[0] = NULL;
|
subexpressions[0] = NULL;
|
||||||
subexpressions[1] = NULL;
|
subexpressions[1] = NULL;
|
||||||
subexpressions[2] = NULL;
|
subexpressions[2] = NULL;
|
||||||
primary_expression.identifier = (char *) identifier;
|
primary_expression.identifier = identifier;
|
||||||
this->non_lvalue_description = NULL;
|
this->non_lvalue_description = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +222,7 @@ public:
|
|||||||
ast_expression *subexpressions[3];
|
ast_expression *subexpressions[3];
|
||||||
|
|
||||||
union {
|
union {
|
||||||
char *identifier;
|
const char *identifier;
|
||||||
int int_constant;
|
int int_constant;
|
||||||
float float_constant;
|
float float_constant;
|
||||||
unsigned uint_constant;
|
unsigned uint_constant;
|
||||||
@@ -317,11 +317,11 @@ public:
|
|||||||
|
|
||||||
class ast_declaration : public ast_node {
|
class ast_declaration : public ast_node {
|
||||||
public:
|
public:
|
||||||
ast_declaration(char *identifier, int is_array, ast_expression *array_size,
|
ast_declaration(const char *identifier, int is_array, ast_expression *array_size,
|
||||||
ast_expression *initializer);
|
ast_expression *initializer);
|
||||||
virtual void print(void) const;
|
virtual void print(void) const;
|
||||||
|
|
||||||
char *identifier;
|
const char *identifier;
|
||||||
|
|
||||||
int is_array;
|
int is_array;
|
||||||
ast_expression *array_size;
|
ast_expression *array_size;
|
||||||
@@ -407,13 +407,13 @@ struct ast_type_qualifier {
|
|||||||
|
|
||||||
class ast_struct_specifier : public ast_node {
|
class ast_struct_specifier : public ast_node {
|
||||||
public:
|
public:
|
||||||
ast_struct_specifier(char *identifier, ast_node *declarator_list);
|
ast_struct_specifier(const char *identifier, ast_node *declarator_list);
|
||||||
virtual void print(void) const;
|
virtual void print(void) const;
|
||||||
|
|
||||||
virtual ir_rvalue *hir(exec_list *instructions,
|
virtual ir_rvalue *hir(exec_list *instructions,
|
||||||
struct _mesa_glsl_parse_state *state);
|
struct _mesa_glsl_parse_state *state);
|
||||||
|
|
||||||
char *name;
|
const char *name;
|
||||||
exec_list declarations;
|
exec_list declarations;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -568,7 +568,7 @@ public:
|
|||||||
struct _mesa_glsl_parse_state *state);
|
struct _mesa_glsl_parse_state *state);
|
||||||
|
|
||||||
ast_fully_specified_type *type;
|
ast_fully_specified_type *type;
|
||||||
char *identifier;
|
const char *identifier;
|
||||||
int is_array;
|
int is_array;
|
||||||
ast_expression *array_size;
|
ast_expression *array_size;
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ public:
|
|||||||
struct _mesa_glsl_parse_state *state);
|
struct _mesa_glsl_parse_state *state);
|
||||||
|
|
||||||
ast_fully_specified_type *return_type;
|
ast_fully_specified_type *return_type;
|
||||||
char *identifier;
|
const char *identifier;
|
||||||
|
|
||||||
exec_list parameters;
|
exec_list parameters;
|
||||||
|
|
||||||
|
@@ -58,7 +58,7 @@ static void yyerror(YYLTYPE *loc, _mesa_glsl_parse_state *st, const char *msg)
|
|||||||
%union {
|
%union {
|
||||||
int n;
|
int n;
|
||||||
float real;
|
float real;
|
||||||
char *identifier;
|
const char *identifier;
|
||||||
|
|
||||||
struct ast_type_qualifier type_qualifier;
|
struct ast_type_qualifier type_qualifier;
|
||||||
|
|
||||||
|
@@ -713,7 +713,7 @@ ast_declaration::print(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ast_declaration::ast_declaration(char *identifier, int is_array,
|
ast_declaration::ast_declaration(const char *identifier, int is_array,
|
||||||
ast_expression *array_size,
|
ast_expression *array_size,
|
||||||
ast_expression *initializer)
|
ast_expression *initializer)
|
||||||
{
|
{
|
||||||
@@ -979,7 +979,7 @@ ast_struct_specifier::print(void) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ast_struct_specifier::ast_struct_specifier(char *identifier,
|
ast_struct_specifier::ast_struct_specifier(const char *identifier,
|
||||||
ast_node *declarator_list)
|
ast_node *declarator_list)
|
||||||
{
|
{
|
||||||
if (identifier == NULL) {
|
if (identifier == NULL) {
|
||||||
|
Reference in New Issue
Block a user