aboutsummaryrefslogtreecommitdiff
path: root/gcc/treelang
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <rafael.espindola@gmail.com>2005-09-23 14:45:21 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-09-23 14:45:21 +0000
commit9304100dbfd990b391236e4fd870e19a77344d52 (patch)
tree0e46b6dcf5a261d368604577f4140439da0e388d /gcc/treelang
parent9c6fdb4671edffacf155232f55f38cc0e47b2e95 (diff)
downloadgcc-9304100dbfd990b391236e4fd870e19a77344d52.zip
gcc-9304100dbfd990b391236e4fd870e19a77344d52.tar.gz
gcc-9304100dbfd990b391236e4fd870e19a77344d52.tar.bz2
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
Diffstat (limited to 'gcc/treelang')
-rw-r--r--gcc/treelang/ChangeLog11
-rw-r--r--gcc/treelang/parse.y165
2 files changed, 94 insertions, 82 deletions
diff --git a/gcc/treelang/ChangeLog b/gcc/treelang/ChangeLog
index 46f8872..4505683 100644
--- a/gcc/treelang/ChangeLog
+++ b/gcc/treelang/ChangeLog
@@ -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
diff --git a/gcc/treelang/parse.y b/gcc/treelang/parse.y
index 3256c57..740237c 100644
--- a/gcc/treelang/parse.y
+++ b/gcc/treelang/parse.y
@@ -1,5 +1,5 @@
/* -*- c -*- emacs mode c */
-/* TREELANG Compiler parser.
+/* TREELANG Compiler parser.
---------------------------------------------------------------------
@@ -23,7 +23,7 @@ Boston, MA 02110-1301, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
-what you give them. Help stamp out software-hoarding!
+what you give them. Help stamp out software-hoarding!
---------------------------------------------------------------------
@@ -34,7 +34,7 @@ the GCC compiler. */
*****************
There are no conflicts in this grammar. Please keep it that way. */
-%{
+%{
#include "config.h"
#include "system.h"
#include "coretypes.h"
@@ -47,7 +47,7 @@ the GCC compiler. */
#include "toplev.h"
#define YYDEBUG 1
-#define YYPRINT(file, type, value) print_token (file, type, value)
+#define YYPRINT(file, type, value) print_token (file, type, value)
#define YYERROR_VERBOSE YES
/* My yylex routine used to intercept calls to flex generated code, to
@@ -55,7 +55,7 @@ the GCC compiler. */
int yylex (void);
static inline int my_yylex (void);
- /* Call lex, but ensure time is charged to TV_LEX. */
+ /* Call lex, but ensure time is charged to TV_LEX. */
static inline int
my_yylex (void)
{
@@ -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. */
@@ -143,8 +143,8 @@ the GCC compiler. */
%token PROD_VARIABLE_REFERENCE_EXPRESSION
%token PROD_PARAMETER
%token PROD_FUNCTION_INVOCATION
-%expect 0
-%%
+%expect 0
+%%
file:
/* Nil. */ {
@@ -179,15 +179,15 @@ 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);
SYMBOL_TABLE_NAME (prod) = tok;
EXPRESSION_TYPE (prod) = $2;
VAR_INIT (prod) = $4;
- NUMERIC_TYPE (prod) =
- NUMERIC_TYPE (( (struct prod_token_parm_item*)EXPRESSION_TYPE (prod)));
+ NUMERIC_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;
@@ -210,12 +211,12 @@ 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,
+ (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,
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,20 +266,20 @@ 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)));
- PARAMETERS (prod) = reverse_prod_list ($5);
+ 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;
set_storage (prod);
switch (STORAGE_CLASS (prod))
- {
+ {
case STATIC_STORAGE:
case EXTERNAL_DEFINITION_STORAGE:
case EXTERNAL_REFERENCE_STORAGE:
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;
@@ -304,8 +305,8 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
this_parms->tp.par.variable_name =
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)));
+ this_parms->type = NUMERIC_TYPE
+ (( (struct prod_token_parm_item *)EXPRESSION_TYPE (this_parm_var)));
if (last_parms)
{
last_parms->tp.par.next = this_parms;
@@ -316,8 +317,8 @@ storage typename NAME LEFT_PARENTHESIS parameters_opt RIGHT_PARENTHESIS SEMICOLO
first_parms = this_parms;
last_parms = this_parms;
}
- this_parms->tp.par.where_to_put_var_tree =
- & (( (struct prod_token_parm_item*)VARIABLE (this_parm))->tp.pro.code);
+ this_parms->tp.par.where_to_put_var_tree =
+ & (((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. */
@@ -559,7 +560,7 @@ expression_opt:
struct prod_token_parm_item *exp;
exp = $1;
gcc_assert (exp->tp.pro.code);
-
+
$$ = $1;
}
;
@@ -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;
@@ -627,7 +628,7 @@ NAME LEFT_PARENTHESIS expressions_with_commas_opt RIGHT_PARENTHESIS {
int exp_count;
tree parms;
tree type;
-
+
tok = $1;
prod = make_production (PROD_FUNCTION_INVOCATION, tok);
SYMBOL_TABLE_NAME (prod) = tok;
@@ -637,14 +638,14 @@ 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;
}
EXPRESSION_TYPE (prod) = EXPRESSION_TYPE (proto);
NUMERIC_TYPE (prod) = NUMERIC_TYPE (proto);
/* Count the expressions and ensure they match the prototype. */
- for (exp_proto_count = 0, exp_proto = PARAMETERS (proto);
+ for (exp_proto_count = 0, exp_proto = PARAMETERS (proto);
exp_proto; exp_proto = exp_proto->tp.pro.next)
exp_proto_count++;
@@ -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;
}
@@ -683,7 +684,7 @@ NAME LEFT_PARENTHESIS expressions_with_commas_opt RIGHT_PARENTHESIS {
}
;
-expressions_with_commas_opt:
+expressions_with_commas_opt:
/* Nil. */ {
$$ = 0
}
@@ -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;
}
@@ -731,7 +732,7 @@ NAME {
if (!NUMERIC_TYPE (prod))
YYERROR;
OP1 (prod) = $1;
-
+
prod->tp.pro.code =
tree_code_get_expression (EXP_REFERENCE, type,
symbol_table_entry->tp.pro.code, NULL, NULL,
@@ -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;
@@ -802,18 +803,18 @@ reverse_prod_list (struct prod_token_parm_item *old_first)
struct prod_token_parm_item *current;
struct prod_token_parm_item *next;
struct prod_token_parm_item *prev = NULL;
-
+
current = old_first;
prev = NULL;
- while (current)
+ while (current)
{
gcc_assert (current->category == production_category);
next = current->tp.pro.next;
current->tp.pro.next = prev;
prev = current;
- current = next;
+ current = next;
}
return prev;
}
@@ -824,14 +825,14 @@ 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);
}
/* Check TYPE1 and TYPE2 which are integral types. Return the lowest
common type (min is signed int). */
-static int
+static int
get_common_type (struct prod_token_parm_item *type1,
struct prod_token_parm_item *type2)
{
@@ -847,7 +848,7 @@ get_common_type (struct prod_token_parm_item *type1,
OK else 0. Must be exact match - same name unless it is an
integral type. */
-static int
+static int
check_type_match (int type_num, struct prod_token_parm_item *exp)
{
switch (type_num)
@@ -863,17 +864,17 @@ check_type_match (int type_num, struct prod_token_parm_item *exp)
case SIGNED_CHAR:
case UNSIGNED_CHAR:
return 1;
-
+
case VOID_TYPE:
- default:
+ default:
gcc_unreachable ();
}
break;
-
+
case VOID_TYPE:
default:
gcc_unreachable ();
-
+
}
}
@@ -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;
@@ -921,7 +922,7 @@ make_plus_expression (struct prod_token_parm_item* tok,
OP1 (prod) = op1;
OP2 (prod) = op2;
-
+
prod->tp.pro.code = tree_code_get_expression (prod_code, type,
op1->tp.pro.code,
op2->tp.pro.code, NULL,
@@ -936,18 +937,18 @@ 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)
{
case STATIC:
STORAGE_CLASS (prod) = STATIC_STORAGE;
break;
-
+
case AUTOMATIC:
STORAGE_CLASS (prod) = AUTOMATIC_STORAGE;
break;
-
+
case EXTERNAL_DEFINITION:
STORAGE_CLASS (prod) = EXTERNAL_DEFINITION_STORAGE;
break;