mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
parse.y: Changed pointer declaration from "type* var" to "type *var" Removed trailing space.
2005-09-23 Rafael ��vila de Esp��ndola <rafael.espindola@gmail.com> * parse.y : Changed pointer declaration from "type* var" to "type *var" Removed trailing space. Wrap long lines. 2005-09-23 Rafael ��vila de Esp��ndola <rafael.espindola@gmail.com> * parse.y : Fixed two compile warnings in "error" and "warning" invocations. Removed trailing periods in messages. Decapitalized the first word of each. From-SVN: r104569
This commit is contained in:
parent
9c6fdb4671
commit
9304100dbf
@ -1,3 +1,14 @@
|
||||
2005-09-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
|
||||
* parse.y : Changed pointer declaration from "type* var" to "type *var"
|
||||
Removed trailing space. Wrap long lines.
|
||||
|
||||
2005-09-23 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
|
||||
|
||||
* parse.y : Fixed two compile warnings in "error" and "warning"
|
||||
invocations. Removed trailing periods in messages. Decapitalized the
|
||||
first word of each.
|
||||
|
||||
2005-08-07 James A. Morrison <phython@gcc.gnu.org>
|
||||
|
||||
* tree-convert.c (convert): Use fold_build1 instead of
|
||||
|
@ -72,20 +72,20 @@ the GCC compiler. */
|
||||
/* Local prototypes. */
|
||||
static void yyerror (const char *error_message);
|
||||
int yyparse (void);
|
||||
void print_token (FILE * file, unsigned int type ATTRIBUTE_UNUSED,
|
||||
void print_token (FILE *file, unsigned int type ATTRIBUTE_UNUSED,
|
||||
YYSTYPE value);
|
||||
static struct prod_token_parm_item *reverse_prod_list
|
||||
(struct prod_token_parm_item *old_first);
|
||||
static void ensure_not_void (unsigned int type,
|
||||
struct prod_token_parm_item* name);
|
||||
struct prod_token_parm_item *name);
|
||||
static int check_type_match (int type_num, struct prod_token_parm_item *exp);
|
||||
static int get_common_type (struct prod_token_parm_item *type1,
|
||||
struct prod_token_parm_item *type2);
|
||||
static struct prod_token_parm_item *make_integer_constant
|
||||
(struct prod_token_parm_item* value);
|
||||
(struct prod_token_parm_item *value);
|
||||
static struct prod_token_parm_item *make_plus_expression
|
||||
(struct prod_token_parm_item* tok, struct prod_token_parm_item* op1,
|
||||
struct prod_token_parm_item* op2, int type_code, int prod_code);
|
||||
(struct prod_token_parm_item *tok, struct prod_token_parm_item *op1,
|
||||
struct prod_token_parm_item *op2, int type_code, int prod_code);
|
||||
static void set_storage (struct prod_token_parm_item *prod);
|
||||
|
||||
/* File global variables. */
|
||||
@ -179,7 +179,7 @@ variable_def {
|
||||
|
||||
variable_def:
|
||||
storage typename NAME init_opt SEMICOLON {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $3;
|
||||
prod = make_production (PROD_VARIABLE_NAME, tok);
|
||||
@ -187,7 +187,7 @@ storage typename NAME init_opt SEMICOLON {
|
||||
EXPRESSION_TYPE (prod) = $2;
|
||||
VAR_INIT (prod) = $4;
|
||||
NUMERIC_TYPE (prod) =
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item*)EXPRESSION_TYPE (prod)));
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item *)EXPRESSION_TYPE (prod)));
|
||||
ensure_not_void (NUMERIC_TYPE (prod), tok);
|
||||
if (insert_tree_name (prod))
|
||||
{
|
||||
@ -198,10 +198,11 @@ storage typename NAME init_opt SEMICOLON {
|
||||
|
||||
if (VAR_INIT (prod))
|
||||
{
|
||||
gcc_assert (((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code);
|
||||
gcc_assert (((struct prod_token_parm_item *)
|
||||
VAR_INIT (prod))->tp.pro.code);
|
||||
if (STORAGE_CLASS (prod) == EXTERNAL_REFERENCE_STORAGE)
|
||||
{
|
||||
error("%HExternal reference variable %q.*s has an initial value.",
|
||||
error("%Hexternal reference variable %q.*s has an initial value",
|
||||
&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
VAR_INIT (prod) = NULL;
|
||||
@ -211,11 +212,11 @@ storage typename NAME init_opt SEMICOLON {
|
||||
|
||||
prod->tp.pro.code = tree_code_create_variable
|
||||
(STORAGE_CLASS (prod),
|
||||
((struct prod_token_parm_item*)SYMBOL_TABLE_NAME (prod))->tp.tok.chars,
|
||||
((struct prod_token_parm_item*)SYMBOL_TABLE_NAME (prod))->tp.tok.length,
|
||||
((struct prod_token_parm_item *)SYMBOL_TABLE_NAME (prod))->tp.tok.chars,
|
||||
((struct prod_token_parm_item *)SYMBOL_TABLE_NAME (prod))->tp.tok.length,
|
||||
NUMERIC_TYPE (prod),
|
||||
VAR_INIT (prod) ?
|
||||
((struct prod_token_parm_item*)VAR_INIT (prod))->tp.pro.code : NULL,
|
||||
((struct prod_token_parm_item *)VAR_INIT (prod))->tp.pro.code : NULL,
|
||||
tok->tp.tok.location);
|
||||
gcc_assert (prod->tp.pro.code);
|
||||
}
|
||||
@ -230,7 +231,7 @@ STATIC
|
||||
|
||||
parameter:
|
||||
typename NAME {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
struct prod_token_parm_item *prod2;
|
||||
tok = $2;
|
||||
@ -238,7 +239,7 @@ typename NAME {
|
||||
SYMBOL_TABLE_NAME (prod) = $2;
|
||||
EXPRESSION_TYPE (prod) = $1;
|
||||
NUMERIC_TYPE (prod) =
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item*)EXPRESSION_TYPE (prod)));
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item *)EXPRESSION_TYPE (prod)));
|
||||
ensure_not_void (NUMERIC_TYPE (prod), tok);
|
||||
if (insert_tree_name (prod))
|
||||
{
|
||||
@ -252,12 +253,12 @@ typename NAME {
|
||||
|
||||
function_prototype:
|
||||
storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLON {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
struct prod_token_parm_item *type;
|
||||
struct prod_token_parm_item* first_parms;
|
||||
struct prod_token_parm_item* last_parms;
|
||||
struct prod_token_parm_item* this_parms;
|
||||
struct prod_token_parm_item *first_parms;
|
||||
struct prod_token_parm_item *last_parms;
|
||||
struct prod_token_parm_item *this_parms;
|
||||
struct prod_token_parm_item *this_parm;
|
||||
struct prod_token_parm_item *this_parm_var;
|
||||
tok = $3;
|
||||
@ -265,7 +266,7 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
|
||||
SYMBOL_TABLE_NAME (prod) = $3;
|
||||
EXPRESSION_TYPE (prod) = $2;
|
||||
NUMERIC_TYPE (prod) =
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item*)EXPRESSION_TYPE (prod)));
|
||||
NUMERIC_TYPE (( (struct prod_token_parm_item *)EXPRESSION_TYPE (prod)));
|
||||
PARAMETERS (prod) = reverse_prod_list ($5);
|
||||
insert_tree_name (prod);
|
||||
STORAGE_CLASS_TOKEN (prod) = $1;
|
||||
@ -278,7 +279,7 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
|
||||
break;
|
||||
|
||||
case AUTOMATIC_STORAGE:
|
||||
error ("%HFunction %q.*s cannot be automatic.",
|
||||
error ("%Hfunction %q.*s cannot be automatic",
|
||||
&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
break;
|
||||
@ -305,7 +306,7 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
|
||||
this_parm_var->tp.pro.main_token->tp.tok.chars;
|
||||
this_parms->category = parameter_category;
|
||||
this_parms->type = NUMERIC_TYPE
|
||||
(( (struct prod_token_parm_item*)EXPRESSION_TYPE (this_parm_var)));
|
||||
(( (struct prod_token_parm_item *)EXPRESSION_TYPE (this_parm_var)));
|
||||
if (last_parms)
|
||||
{
|
||||
last_parms->tp.par.next = this_parms;
|
||||
@ -317,7 +318,7 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
|
||||
last_parms = this_parms;
|
||||
}
|
||||
this_parms->tp.par.where_to_put_var_tree =
|
||||
& (( (struct prod_token_parm_item*)VARIABLE (this_parm))->tp.pro.code);
|
||||
& (((struct prod_token_parm_item *)VARIABLE (this_parm))->tp.pro.code);
|
||||
}
|
||||
FIRST_PARMS (prod) = first_parms;
|
||||
|
||||
@ -333,8 +334,9 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
|
||||
this_parm;
|
||||
this_parm = this_parm->tp.pro.next)
|
||||
{
|
||||
gcc_assert ((struct prod_token_parm_item*)VARIABLE (this_parm));
|
||||
gcc_assert (((struct prod_token_parm_item*)VARIABLE (this_parm))->tp.pro.code);
|
||||
gcc_assert ((struct prod_token_parm_item *)VARIABLE (this_parm));
|
||||
gcc_assert (((struct prod_token_parm_item *)
|
||||
VARIABLE (this_parm))->tp.pro.code);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -344,14 +346,14 @@ function:
|
||||
NAME LEFT_BRACE {
|
||||
struct prod_token_parm_item *proto;
|
||||
struct prod_token_parm_item search_prod;
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
tok = $1;
|
||||
SYMBOL_TABLE_NAME ((&search_prod)) = tok;
|
||||
search_prod.category = token_category;
|
||||
current_function = proto = lookup_tree_name (&search_prod);
|
||||
if (!proto)
|
||||
{
|
||||
error ("%HNo prototype found for %q.*s", &tok->tp.tok.location,
|
||||
error ("%Hno prototype found for %q.*s", &tok->tp.tok.location,
|
||||
tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
}
|
||||
@ -362,7 +364,7 @@ NAME LEFT_BRACE {
|
||||
}
|
||||
|
||||
variable_defs_opt statements_opt RIGHT_BRACE {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
tok = $1;
|
||||
tree_code_create_function_wrapup (tok->tp.tok.location);
|
||||
current_function = NULL;
|
||||
@ -398,7 +400,7 @@ variable_def {
|
||||
|
||||
typename:
|
||||
INT {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $1;
|
||||
prod = make_production (PROD_TYPE_NAME, tok);
|
||||
@ -407,7 +409,7 @@ INT {
|
||||
$$ = prod;
|
||||
}
|
||||
|UNSIGNED INT {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $1;
|
||||
prod = make_production (PROD_TYPE_NAME, tok);
|
||||
@ -416,7 +418,7 @@ INT {
|
||||
$$ = prod;
|
||||
}
|
||||
|CHAR {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $1;
|
||||
prod = make_production (PROD_TYPE_NAME, tok);
|
||||
@ -425,7 +427,7 @@ INT {
|
||||
$$ = prod;
|
||||
}
|
||||
|UNSIGNED CHAR {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $1;
|
||||
prod = make_production (PROD_TYPE_NAME, tok);
|
||||
@ -434,7 +436,7 @@ INT {
|
||||
$$ = prod;
|
||||
}
|
||||
|VOID {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = $1;
|
||||
prod = make_production (PROD_TYPE_NAME, tok);
|
||||
@ -492,7 +494,7 @@ expression SEMICOLON {
|
||||
|
||||
if_statement:
|
||||
IF LEFT_PARENTHESIS expression RIGHT_PARENTHESIS {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *exp;
|
||||
tok = $1;
|
||||
exp = $3;
|
||||
@ -503,12 +505,12 @@ LEFT_BRACE variable_defs_opt statements_opt RIGHT_BRACE {
|
||||
/* Just let the statements flow. */
|
||||
}
|
||||
ELSE {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
tok = $1;
|
||||
tree_code_if_else (tok->tp.tok.location);
|
||||
}
|
||||
LEFT_BRACE variable_defs_opt statements_opt RIGHT_BRACE {
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
tok = $1;
|
||||
tree_code_if_end (tok->tp.tok.location);
|
||||
}
|
||||
@ -527,14 +529,13 @@ tl_RETURN expression_opt {
|
||||
tree_code_generate_return (type_prod->tp.pro.code, NULL);
|
||||
else
|
||||
{
|
||||
warning (0, "%HRedundant expression in return.",
|
||||
&ret_tok->tp.tok.location, ret_tok->tp.tok.length,
|
||||
ret_tok->tp.tok.chars);
|
||||
warning (0, "%Hredundant expression in return",
|
||||
&ret_tok->tp.tok.location);
|
||||
tree_code_generate_return (type_prod->tp.pro.code, NULL);
|
||||
}
|
||||
else
|
||||
if (exp == NULL)
|
||||
error ("%HExpression missing in return.", &ret_tok->tp.tok.location);
|
||||
error ("%Hexpression missing in return", &ret_tok->tp.tok.location);
|
||||
else
|
||||
{
|
||||
/* Check same type. */
|
||||
@ -617,7 +618,7 @@ INTEGER {
|
||||
function_invocation:
|
||||
NAME LEFT_PARENTHESIS expressions_with_commas_opt RIGHT_PARENTHESIS {
|
||||
struct prod_token_parm_item *prod;
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item search_prod;
|
||||
struct prod_token_parm_item *proto;
|
||||
struct prod_token_parm_item *exp;
|
||||
@ -637,7 +638,7 @@ NAME LEFT_PARENTHESIS expressions_with_commas_opt RIGHT_PARENTHESIS {
|
||||
proto = lookup_tree_name (&search_prod);
|
||||
if (!proto)
|
||||
{
|
||||
error ("%HFunction prototype not found for %q.*%s.",
|
||||
error ("%Hfunction prototype not found for %q.*s",
|
||||
&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
}
|
||||
@ -653,7 +654,7 @@ NAME LEFT_PARENTHESIS expressions_with_commas_opt RIGHT_PARENTHESIS {
|
||||
|
||||
if (exp_count != exp_proto_count)
|
||||
{
|
||||
error ("%HExpression count mismatch %q.*s with prototype.",
|
||||
error ("%Hexpression count mismatch %q.*s with prototype",
|
||||
&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
}
|
||||
@ -711,7 +712,7 @@ NAME {
|
||||
struct prod_token_parm_item search_prod;
|
||||
struct prod_token_parm_item *prod;
|
||||
struct prod_token_parm_item *symbol_table_entry;
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
tree type;
|
||||
|
||||
tok = $1;
|
||||
@ -720,7 +721,7 @@ NAME {
|
||||
symbol_table_entry = lookup_tree_name (&search_prod);
|
||||
if (!symbol_table_entry)
|
||||
{
|
||||
error ("%HVariable %q.*s not defined.",
|
||||
error ("%Hvariable %q.*s not defined",
|
||||
&tok->tp.tok.location, tok->tp.tok.length, tok->tp.tok.chars);
|
||||
YYERROR;
|
||||
}
|
||||
@ -767,7 +768,7 @@ INTEGER {
|
||||
type. */
|
||||
|
||||
void
|
||||
print_token (FILE * file, unsigned int type ATTRIBUTE_UNUSED, YYSTYPE value)
|
||||
print_token (FILE *file, unsigned int type ATTRIBUTE_UNUSED, YYSTYPE value)
|
||||
{
|
||||
struct prod_token_parm_item *tok;
|
||||
unsigned int ix;
|
||||
@ -824,7 +825,7 @@ static void
|
||||
ensure_not_void (unsigned int type, struct prod_token_parm_item* name)
|
||||
{
|
||||
if (type == VOID_TYPE)
|
||||
error ("%HType must not be void in this context.",
|
||||
error ("%Htype must not be void in this context",
|
||||
&name->tp.tok.location);
|
||||
}
|
||||
|
||||
@ -882,7 +883,7 @@ check_type_match (int type_num, struct prod_token_parm_item *exp)
|
||||
static struct prod_token_parm_item *
|
||||
make_integer_constant (struct prod_token_parm_item* value)
|
||||
{
|
||||
struct prod_token_parm_item* tok;
|
||||
struct prod_token_parm_item *tok;
|
||||
struct prod_token_parm_item *prod;
|
||||
tok = value;
|
||||
prod = make_production (PROD_INTEGER_CONSTANT, tok);
|
||||
@ -901,9 +902,9 @@ make_integer_constant (struct prod_token_parm_item* value)
|
||||
and EQUALS expressions. */
|
||||
|
||||
static struct prod_token_parm_item *
|
||||
make_plus_expression (struct prod_token_parm_item* tok,
|
||||
struct prod_token_parm_item* op1,
|
||||
struct prod_token_parm_item* op2,
|
||||
make_plus_expression (struct prod_token_parm_item *tok,
|
||||
struct prod_token_parm_item *op1,
|
||||
struct prod_token_parm_item *op2,
|
||||
int type_code, int prod_code)
|
||||
{
|
||||
struct prod_token_parm_item *prod;
|
||||
@ -936,7 +937,7 @@ make_plus_expression (struct prod_token_parm_item* tok,
|
||||
static void
|
||||
set_storage (struct prod_token_parm_item *prod)
|
||||
{
|
||||
struct prod_token_parm_item* stg_class;
|
||||
struct prod_token_parm_item *stg_class;
|
||||
stg_class = STORAGE_CLASS_TOKEN (prod);
|
||||
switch (stg_class->type)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user