aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>2004-05-27 14:35:12 +0200
committerTobias Schlüter <tobi@gcc.gnu.org>2004-05-27 14:35:12 +0200
commit63645982e7f5d9d95f152052431db81c2f119a15 (patch)
tree3c7af6dcd25c3b7df4df9f719eb578e68eb49801 /gcc/fortran/primary.c
parenta4171ce18efea96907998485b2a71e3d4f9dde4f (diff)
downloadgcc-63645982e7f5d9d95f152052431db81c2f119a15.zip
gcc-63645982e7f5d9d95f152052431db81c2f119a15.tar.gz
gcc-63645982e7f5d9d95f152052431db81c2f119a15.tar.bz2
gfortran.h (gfc_current_locus, [...]): Remove.
* gfortran.h (gfc_current_locus, gfc_set_locus): Remove. (gfc_current_locus): Declare new global variable. * scanner.c (gfc_current_locus, gfc_set_locus): Remove. (gfc_current_locus1): Rename ... (gfc_current_locus): ... to this. (gfc_at_eof, gfc_at_bol, gfc_at_eol, gfc_advance_line, next_char, skip_fixed_comments, skip_free_comments, gfc_next_char_literal, gfc_peek_char, gfc_gobble_whitespace, gfc_new_file): Use gfc_current_locus instead of gfc_current_locus1, gfc_set_locus() and gfc_current_locus(), respectively. * array.c (match_subscript, gfc_match_array_ref, match_array_list, match_array_cons_element, gfc_match_array_constructor): Read/modify gfc_current_locus instead of calling gfc_set_locus() and gfc_current_locus(). * decl.c (gfc_match_null, variable_decl, gfc_match_kind_spec, match_attr_spec, gfc_match_function_decl, gfc_match_end, attr_decl1, gfc_match_save): Likewise. * error.c (error_print, gfc_internal_error): Likewise. * expr.c (gfc_int_expr, gfc_default_logical_kind): Likewise. * interface.c (gfc_add_interface): Likewise. * io.c (gfc_match_format, match_dt_format, match_dt_element, match_io_iterator, match_io): Likewise. * match.c (gfc_match_space, gfc_match_eos, gfc_match_small_literal_int, gfc_match_st_label, gfc_match_strings, gfc_match_name, gfc_match_iterator, gfc_match_char, gfc_match, gfc_match_assignment, gfc_match_pointer_assignment, gfc_match_if, gfc_match_do, gfc_match_nullify, gfc_match_call, match_implicit_range, gfc_match_implicit, gfc_match_data, match_case_selector, gfc_match_case, match_forall_iterator): Likewise. * matchexp.c (gfc_match_defined_op_name, next_operator, match_level_1, match_mult_operand, match_ext_mult_operand, match_add_operand, match_ext_add_operand, match_level_2, match_level_3, match_level_4, match_and_operand, match_or_operand, match_equiv_operand, match_level_5, gfc_match_expr): Likewise. * module.c (gfc_match_use, mio_array_ref, mio_expr): Likewise. * parse.c (match_word, decode_statement, next_free, next_fixed, add_statement, verify_st_order, parse_if_block, gfc_parse_file): Likewise. * primary.c (match_digits, match_integer_constant, match_boz_constant, match_real_constant, match_substring, next_string_char, match_charkind_name, match_string_constant, match_logical_constant, match_const_complex_part, match_complex_constant, match_actual_arg, match_keyword_arg, gfc_match_actual_arglist, gfc_match_structure_constructor, gfc_match_rvalue, gfc_match_variable): Likewise. * st.c (gfc_get_code): Likewise. * symbol.c (check_conflict, check_used, check_done, duplicate_attr, add_flavor, gfc_add_procedure, gfc_add_intent, gfc_add_access, gfc_add_explicit_interface, gfc_add_type, gfc_add_component, gfc_reference_st_label, gfc_new_symbol): Likewise. From-SVN: r82320
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c104
1 files changed, 52 insertions, 52 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index a55c5aa..e1f4049 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -159,7 +159,7 @@ match_digits (int signflag, int radix, char *buffer)
for (;;)
{
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
c = gfc_next_char ();
if (!check_digit (c, radix))
@@ -170,7 +170,7 @@ match_digits (int signflag, int radix, char *buffer)
length++;
}
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return length;
}
@@ -187,11 +187,11 @@ match_integer_constant (gfc_expr ** result, int signflag)
char *buffer;
gfc_expr *e;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
gfc_gobble_whitespace ();
length = match_digits (signflag, 10, NULL);
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
if (length == -1)
return MATCH_NO;
@@ -214,7 +214,7 @@ match_integer_constant (gfc_expr ** result, int signflag)
return MATCH_ERROR;
}
- e = gfc_convert_integer (buffer, kind, 10, gfc_current_locus ());
+ e = gfc_convert_integer (buffer, kind, 10, &gfc_current_locus);
if (gfc_range_check (e) != ARITH_OK)
{
@@ -241,7 +241,7 @@ match_boz_constant (gfc_expr ** result)
gfc_expr *e;
const char *rname;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
gfc_gobble_whitespace ();
switch (gfc_next_char ())
@@ -276,7 +276,7 @@ match_boz_constant (gfc_expr ** result)
if (delim != '\'' && delim != '\"')
goto backup;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
length = match_digits (0, radix, NULL);
if (length == -1)
@@ -291,7 +291,7 @@ match_boz_constant (gfc_expr ** result)
return MATCH_ERROR;
}
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
buffer = alloca (length + 1);
memset (buffer, '\0', length + 1);
@@ -300,7 +300,7 @@ match_boz_constant (gfc_expr ** result)
gfc_next_char ();
e = gfc_convert_integer (buffer, gfc_default_integer_kind (), radix,
- gfc_current_locus ());
+ &gfc_current_locus);
if (gfc_range_check (e) != ARITH_OK)
{
@@ -314,7 +314,7 @@ match_boz_constant (gfc_expr ** result)
return MATCH_YES;
backup:
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return MATCH_NO;
}
@@ -329,7 +329,7 @@ match_real_constant (gfc_expr ** result, int signflag)
char *p, *buffer;
gfc_expr *e;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
gfc_gobble_whitespace ();
e = NULL;
@@ -355,7 +355,7 @@ match_real_constant (gfc_expr ** result, int signflag)
goto done;
/* Check to see if "." goes with a following operator like ".eq.". */
- temp_loc = *gfc_current_locus ();
+ temp_loc = gfc_current_locus;
c = gfc_next_char ();
if (c == 'e' || c == 'd' || c == 'q')
@@ -368,7 +368,7 @@ match_real_constant (gfc_expr ** result, int signflag)
if (ISALPHA (c))
goto done; /* Distinguish 1.e9 from 1.eq.2 */
- gfc_set_locus (&temp_loc);
+ gfc_current_locus = temp_loc;
seen_dp = 1;
continue;
}
@@ -401,7 +401,7 @@ match_real_constant (gfc_expr ** result, int signflag)
/* TODO: seen_digits is always true at this point */
if (!seen_digits)
{
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return MATCH_NO; /* ".e" can be something else */
}
@@ -419,12 +419,12 @@ done:
/* See what we've got! */
if (!seen_digits || (!seen_dp && exp_char == ' '))
{
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return MATCH_NO;
}
/* Convert the number. */
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
gfc_gobble_whitespace ();
buffer = alloca (count + 1);
@@ -478,7 +478,7 @@ done:
}
}
- e = gfc_convert_real (buffer, kind, gfc_current_locus ());
+ e = gfc_convert_real (buffer, kind, &gfc_current_locus);
switch (gfc_range_check (e))
{
@@ -520,7 +520,7 @@ match_substring (gfc_charlen * cl, int init, gfc_ref ** result)
start = NULL;
end = NULL;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
m = gfc_match_char ('(');
if (m != MATCH_YES)
@@ -589,7 +589,7 @@ cleanup:
gfc_free_expr (start);
gfc_free_expr (end);
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return m;
}
@@ -617,7 +617,7 @@ next_string_char (char delimiter)
if (c == '\\')
{
- old_locus = *gfc_current_locus ();
+ old_locus = gfc_current_locus;
switch (gfc_next_char_literal (1))
{
@@ -648,7 +648,7 @@ next_string_char (char delimiter)
default:
/* Unknown backslash codes are simply not expanded */
- gfc_set_locus (&old_locus);
+ gfc_current_locus = old_locus;
break;
}
}
@@ -656,12 +656,12 @@ next_string_char (char delimiter)
if (c != delimiter)
return c;
- old_locus = *gfc_current_locus ();
+ old_locus = gfc_current_locus;
c = gfc_next_char_literal (1);
if (c == delimiter)
return c;
- gfc_set_locus (&old_locus);
+ gfc_current_locus = old_locus;
return -1;
}
@@ -696,7 +696,7 @@ match_charkind_name (char *name)
for (;;)
{
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
c = gfc_next_char ();
if (c == '_')
@@ -705,7 +705,7 @@ match_charkind_name (char *name)
if (peek == '\'' || peek == '\"')
{
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
*name = '\0';
return MATCH_YES;
}
@@ -743,11 +743,11 @@ match_string_constant (gfc_expr ** result)
const char *q;
match m;
- old_locus = *gfc_current_locus ();
+ old_locus = gfc_current_locus;
gfc_gobble_whitespace ();
- start_locus = *gfc_current_locus ();
+ start_locus = gfc_current_locus;
c = gfc_next_char ();
if (c == '\'' || c == '"')
@@ -771,7 +771,7 @@ match_string_constant (gfc_expr ** result)
}
else
{
- gfc_set_locus (&old_locus);
+ gfc_current_locus = old_locus;
m = match_charkind_name (name);
if (m != MATCH_YES)
@@ -796,7 +796,7 @@ match_string_constant (gfc_expr ** result)
goto no_match;
gfc_gobble_whitespace ();
- start_locus = *gfc_current_locus ();
+ start_locus = gfc_current_locus;
c = gfc_next_char ();
if (c != '\'' && c != '"')
@@ -834,7 +834,7 @@ got_delim:
break;
if (c == -2)
{
- gfc_set_locus (&start_locus);
+ gfc_current_locus = start_locus;
gfc_error ("Unterminated character constant beginning at %C");
return MATCH_ERROR;
}
@@ -853,7 +853,7 @@ got_delim:
e->value.character.string = p = gfc_getmem (length + 1);
e->value.character.length = length;
- gfc_set_locus (&start_locus);
+ gfc_current_locus = start_locus;
gfc_next_char (); /* Skip delimiter */
for (i = 0; i < length; i++)
@@ -872,7 +872,7 @@ got_delim:
return MATCH_YES;
no_match:
- gfc_set_locus (&old_locus);
+ gfc_current_locus = old_locus;
return MATCH_NO;
}
@@ -910,7 +910,7 @@ match_logical_constant (gfc_expr ** result)
e->value.logical = i;
e->ts.type = BT_LOGICAL;
e->ts.kind = kind;
- e->where = *gfc_current_locus ();
+ e->where = gfc_current_locus;
*result = e;
return MATCH_YES;
@@ -999,7 +999,7 @@ match_const_complex_part (gfc_expr ** result)
char *p, c, exp_char, *buffer;
locus old_loc;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
gfc_gobble_whitespace ();
seen_dp = 0;
@@ -1064,7 +1064,7 @@ done:
goto no_match;
/* Convert the number. */
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
gfc_gobble_whitespace ();
buffer = alloca (count + 1);
@@ -1121,11 +1121,11 @@ done:
}
}
- *result = gfc_convert_real (buffer, kind, gfc_current_locus ());
+ *result = gfc_convert_real (buffer, kind, &gfc_current_locus);
return MATCH_YES;
no_match:
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return MATCH_NO;
}
@@ -1157,7 +1157,7 @@ match_complex_constant (gfc_expr ** result)
int kind;
match m;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
real = imag = e = NULL;
m = gfc_match_char ('(');
@@ -1210,7 +1210,7 @@ match_complex_constant (gfc_expr ** result)
gfc_convert_type (imag, &target, 2);
e = gfc_convert_complex (real, imag, kind);
- e->where = *gfc_current_locus ();
+ e->where = gfc_current_locus;
gfc_free_expr (real);
gfc_free_expr (imag);
@@ -1226,7 +1226,7 @@ cleanup:
gfc_free_expr (e);
gfc_free_expr (real);
gfc_free_expr (imag);
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return m;
}
@@ -1284,7 +1284,7 @@ match_actual_arg (gfc_expr ** result)
gfc_expr *e;
int c;
- where = *gfc_current_locus ();
+ where = gfc_current_locus;
switch (gfc_match_name (name))
{
@@ -1295,10 +1295,10 @@ match_actual_arg (gfc_expr ** result)
break;
case MATCH_YES:
- w = *gfc_current_locus ();
+ w = gfc_current_locus;
gfc_gobble_whitespace ();
c = gfc_next_char ();
- gfc_set_locus (&w);
+ gfc_current_locus = w;
if (c != ',' && c != ')')
break;
@@ -1343,7 +1343,7 @@ match_actual_arg (gfc_expr ** result)
return MATCH_YES;
}
- gfc_set_locus (&where);
+ gfc_current_locus = where;
return gfc_match_expr (result);
}
@@ -1358,7 +1358,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base)
locus name_locus;
match m;
- name_locus = *gfc_current_locus ();
+ name_locus = gfc_current_locus;
m = gfc_match_name (name);
if (m != MATCH_YES)
@@ -1391,7 +1391,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base)
return MATCH_YES;
cleanup:
- gfc_set_locus (&name_locus);
+ gfc_current_locus = name_locus;
return m;
}
@@ -1412,7 +1412,7 @@ gfc_match_actual_arglist (int sub_flag, gfc_actual_arglist ** argp)
match m;
*argp = tail = NULL;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
seen_keyword = 0;
@@ -1496,7 +1496,7 @@ syntax:
cleanup:
gfc_free_actual_arglist (head);
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return MATCH_ERROR;
}
@@ -1766,7 +1766,7 @@ gfc_match_structure_constructor (gfc_symbol * sym, gfc_expr ** result)
if (gfc_match_char ('(') != MATCH_YES)
goto syntax;
- where = *gfc_current_locus ();
+ where = gfc_current_locus;
gfc_find_component (sym, NULL);
@@ -1862,7 +1862,7 @@ gfc_match_rvalue (gfc_expr ** result)
sym = symtree->n.sym;
e = NULL;
- where = *gfc_current_locus ();
+ where = gfc_current_locus;
gfc_set_sym_referenced (sym);
@@ -1975,7 +1975,7 @@ gfc_match_rvalue (gfc_expr ** result)
e->symtree = symtree;
e->expr_type = EXPR_FUNCTION;
e->value.function.actual = actual_arglist;
- e->where = *gfc_current_locus ();
+ e->where = gfc_current_locus;
if (sym->as != NULL)
e->rank = sym->as->rank;
@@ -2154,7 +2154,7 @@ gfc_match_variable (gfc_expr ** result, int equiv_flag)
m = gfc_match_sym_tree (&st, 1);
if (m != MATCH_YES)
return m;
- where = *gfc_current_locus ();
+ where = gfc_current_locus;
sym = st->n.sym;
gfc_set_sym_referenced (sym);