Commit 63645982 by Tobias Schlüter Committed by Tobias Schlüter

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
parent a4171ce1
2004-05-27 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
* 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.
2004-05-26 Roger Sayle <roger@eyesopen.com> 2004-05-26 Roger Sayle <roger@eyesopen.com>
* io.c (format_asterisk): Silence compiler warnings by correcting * io.c (format_asterisk): Silence compiler warnings by correcting
......
...@@ -77,7 +77,7 @@ match_subscript (gfc_array_ref * ar, int init) ...@@ -77,7 +77,7 @@ match_subscript (gfc_array_ref * ar, int init)
i = ar->dimen; i = ar->dimen;
ar->c_where[i] = *gfc_current_locus (); ar->c_where[i] = gfc_current_locus;
ar->start[i] = ar->end[i] = ar->stride[i] = NULL; ar->start[i] = ar->end[i] = ar->stride[i] = NULL;
/* We can't be sure of the difference between DIMEN_ELEMENT and /* We can't be sure of the difference between DIMEN_ELEMENT and
...@@ -143,7 +143,7 @@ gfc_match_array_ref (gfc_array_ref * ar, gfc_array_spec * as, int init) ...@@ -143,7 +143,7 @@ gfc_match_array_ref (gfc_array_ref * ar, gfc_array_spec * as, int init)
memset (ar, '\0', sizeof (ar)); memset (ar, '\0', sizeof (ar));
ar->where = *gfc_current_locus (); ar->where = gfc_current_locus;
ar->as = as; ar->as = as;
if (gfc_match_char ('(') != MATCH_YES) if (gfc_match_char ('(') != MATCH_YES)
...@@ -743,7 +743,7 @@ match_array_list (gfc_constructor ** result) ...@@ -743,7 +743,7 @@ match_array_list (gfc_constructor ** result)
match m; match m;
int n; int n;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (gfc_match_char ('(') == MATCH_NO) if (gfc_match_char ('(') == MATCH_NO)
return MATCH_NO; return MATCH_NO;
...@@ -809,7 +809,7 @@ match_array_list (gfc_constructor ** result) ...@@ -809,7 +809,7 @@ match_array_list (gfc_constructor ** result)
e->value.constructor = head; e->value.constructor = head;
p = gfc_get_constructor (); p = gfc_get_constructor ();
p->where = *gfc_current_locus (); p->where = gfc_current_locus;
p->iterator = gfc_get_iterator (); p->iterator = gfc_get_iterator ();
*p->iterator = iter; *p->iterator = iter;
...@@ -825,7 +825,7 @@ syntax: ...@@ -825,7 +825,7 @@ syntax:
cleanup: cleanup:
gfc_free_constructor (head); gfc_free_constructor (head);
gfc_free_iterator (&iter, 0); gfc_free_iterator (&iter, 0);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
...@@ -849,7 +849,7 @@ match_array_cons_element (gfc_constructor ** result) ...@@ -849,7 +849,7 @@ match_array_cons_element (gfc_constructor ** result)
return m; return m;
p = gfc_get_constructor (); p = gfc_get_constructor ();
p->where = *gfc_current_locus (); p->where = gfc_current_locus;
p->expr = expr; p->expr = expr;
*result = p; *result = p;
...@@ -870,7 +870,7 @@ gfc_match_array_constructor (gfc_expr ** result) ...@@ -870,7 +870,7 @@ gfc_match_array_constructor (gfc_expr ** result)
if (gfc_match (" (/") == MATCH_NO) if (gfc_match (" (/") == MATCH_NO)
return MATCH_NO; return MATCH_NO;
where = *gfc_current_locus (); where = gfc_current_locus;
head = tail = NULL; head = tail = NULL;
if (gfc_match (" /)") == MATCH_YES) if (gfc_match (" /)") == MATCH_YES)
......
...@@ -423,7 +423,7 @@ gfc_match_null (gfc_expr ** result) ...@@ -423,7 +423,7 @@ gfc_match_null (gfc_expr ** result)
return MATCH_ERROR; return MATCH_ERROR;
e = gfc_get_expr (); e = gfc_get_expr ();
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
e->expr_type = EXPR_NULL; e->expr_type = EXPR_NULL;
e->ts.type = BT_UNKNOWN; e->ts.type = BT_UNKNOWN;
...@@ -459,7 +459,7 @@ variable_decl (void) ...@@ -459,7 +459,7 @@ variable_decl (void)
if (m != MATCH_YES) if (m != MATCH_YES)
goto cleanup; goto cleanup;
var_locus = *gfc_current_locus (); var_locus = gfc_current_locus;
/* Now we could see the optional array spec. or character length. */ /* Now we could see the optional array spec. or character length. */
m = gfc_match_array_spec (&as); m = gfc_match_array_spec (&as);
...@@ -659,7 +659,7 @@ gfc_match_kind_spec (gfc_typespec * ts) ...@@ -659,7 +659,7 @@ gfc_match_kind_spec (gfc_typespec * ts)
m = MATCH_NO; m = MATCH_NO;
e = NULL; e = NULL;
where = *gfc_current_locus (); where = gfc_current_locus;
if (gfc_match_char ('(') == MATCH_NO) if (gfc_match_char ('(') == MATCH_NO)
return MATCH_NO; return MATCH_NO;
...@@ -711,7 +711,7 @@ gfc_match_kind_spec (gfc_typespec * ts) ...@@ -711,7 +711,7 @@ gfc_match_kind_spec (gfc_typespec * ts)
no_match: no_match:
gfc_free_expr (e); gfc_free_expr (e);
gfc_set_locus (&where); gfc_current_locus = where;
return m; return m;
} }
...@@ -1028,7 +1028,7 @@ match_attr_spec (void) ...@@ -1028,7 +1028,7 @@ match_attr_spec (void)
try t; try t;
gfc_clear_attr (&current_attr); gfc_clear_attr (&current_attr);
start = *gfc_current_locus (); start = gfc_current_locus;
current_as = NULL; current_as = NULL;
colon_seen = 0; colon_seen = 0;
...@@ -1044,7 +1044,7 @@ match_attr_spec (void) ...@@ -1044,7 +1044,7 @@ match_attr_spec (void)
break; break;
seen[d]++; seen[d]++;
seen_at[d] = *gfc_current_locus (); seen_at[d] = gfc_current_locus;
if (d == DECL_DIMENSION) if (d == DECL_DIMENSION)
{ {
...@@ -1218,7 +1218,7 @@ match_attr_spec (void) ...@@ -1218,7 +1218,7 @@ match_attr_spec (void)
return MATCH_YES; return MATCH_YES;
cleanup: cleanup:
gfc_set_locus (&start); gfc_current_locus = start;
gfc_free_array_spec (current_as); gfc_free_array_spec (current_as);
current_as = NULL; current_as = NULL;
return m; return m;
...@@ -1558,18 +1558,18 @@ gfc_match_function_decl (void) ...@@ -1558,18 +1558,18 @@ gfc_match_function_decl (void)
gfc_clear_ts (&current_ts); gfc_clear_ts (&current_ts);
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
m = match_prefix (&current_ts); m = match_prefix (&current_ts);
if (m != MATCH_YES) if (m != MATCH_YES)
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
if (gfc_match ("function% %n", name) != MATCH_YES) if (gfc_match ("function% %n", name) != MATCH_YES)
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -1630,7 +1630,7 @@ gfc_match_function_decl (void) ...@@ -1630,7 +1630,7 @@ gfc_match_function_decl (void)
return MATCH_YES; return MATCH_YES;
cleanup: cleanup:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
...@@ -1790,7 +1790,7 @@ gfc_match_end (gfc_statement * st) ...@@ -1790,7 +1790,7 @@ gfc_match_end (gfc_statement * st)
const char *target; const char *target;
match m; match m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (gfc_match ("end") != MATCH_YES) if (gfc_match ("end") != MATCH_YES)
return MATCH_NO; return MATCH_NO;
...@@ -1943,7 +1943,7 @@ syntax: ...@@ -1943,7 +1943,7 @@ syntax:
gfc_syntax_error (*st); gfc_syntax_error (*st);
cleanup: cleanup:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -1971,7 +1971,7 @@ attr_decl1 (void) ...@@ -1971,7 +1971,7 @@ attr_decl1 (void)
if (find_special (name, &sym)) if (find_special (name, &sym))
return MATCH_ERROR; return MATCH_ERROR;
var_locus = *gfc_current_locus (); var_locus = gfc_current_locus;
/* Deal with possible array specification for certain attributes. */ /* Deal with possible array specification for certain attributes. */
if (current_attr.dimension if (current_attr.dimension
...@@ -2423,7 +2423,7 @@ gfc_match_save (void) ...@@ -2423,7 +2423,7 @@ gfc_match_save (void)
switch (m) switch (m)
{ {
case MATCH_YES: case MATCH_YES:
if (gfc_add_save (&sym->attr, gfc_current_locus ()) == FAILURE) if (gfc_add_save (&sym->attr, &gfc_current_locus) == FAILURE)
return MATCH_ERROR; return MATCH_ERROR;
goto next_item; goto next_item;
......
...@@ -338,7 +338,7 @@ error_print (const char *type, const char *format0, va_list argp) ...@@ -338,7 +338,7 @@ error_print (const char *type, const char *format0, va_list argp)
case 'C': case 'C':
if (c == 'C') if (c == 'C')
loc = gfc_current_locus (); loc = &gfc_current_locus;
if (have_l1) if (have_l1)
{ {
...@@ -652,7 +652,7 @@ gfc_internal_error (const char *format, ...) ...@@ -652,7 +652,7 @@ gfc_internal_error (const char *format, ...)
va_start (argp, format); va_start (argp, format);
show_loci (gfc_current_locus (), NULL); show_loci (&gfc_current_locus, NULL);
error_printf ("Internal Error at (1):"); error_printf ("Internal Error at (1):");
error_print ("", format, argp); error_print ("", format, argp);
......
...@@ -477,7 +477,7 @@ gfc_int_expr (int i) ...@@ -477,7 +477,7 @@ gfc_int_expr (int i)
p->ts.type = BT_INTEGER; p->ts.type = BT_INTEGER;
p->ts.kind = gfc_default_integer_kind (); p->ts.kind = gfc_default_integer_kind ();
p->where = *gfc_current_locus (); p->where = gfc_current_locus;
mpz_init_set_si (p->value.integer, i); mpz_init_set_si (p->value.integer, i);
return p; return p;
...@@ -498,7 +498,7 @@ gfc_logical_expr (int i, locus * where) ...@@ -498,7 +498,7 @@ gfc_logical_expr (int i, locus * where)
p->ts.kind = gfc_default_logical_kind (); p->ts.kind = gfc_default_logical_kind ();
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
p->where = *where; p->where = *where;
p->value.logical = i; p->value.logical = i;
......
...@@ -1289,9 +1289,6 @@ void gfc_add_include_path (const char *); ...@@ -1289,9 +1289,6 @@ void gfc_add_include_path (const char *);
void gfc_release_include_path (void); void gfc_release_include_path (void);
FILE *gfc_open_included_file (const char *); FILE *gfc_open_included_file (const char *);
locus *gfc_current_locus (void);
void gfc_set_locus (locus *);
int gfc_at_end (void); int gfc_at_end (void);
int gfc_at_eof (void); int gfc_at_eof (void);
int gfc_at_bol (void); int gfc_at_bol (void);
...@@ -1309,7 +1306,7 @@ try gfc_new_file (const char *, gfc_source_form); ...@@ -1309,7 +1306,7 @@ try gfc_new_file (const char *, gfc_source_form);
extern gfc_source_form gfc_current_form; extern gfc_source_form gfc_current_form;
extern char *gfc_source_file; extern char *gfc_source_file;
/* extern locus gfc_current_locus; */ extern locus gfc_current_locus;
/* misc.c */ /* misc.c */
void *gfc_getmem (size_t) ATTRIBUTE_MALLOC; void *gfc_getmem (size_t) ATTRIBUTE_MALLOC;
......
...@@ -1833,7 +1833,7 @@ gfc_add_interface (gfc_symbol * new) ...@@ -1833,7 +1833,7 @@ gfc_add_interface (gfc_symbol * new)
intr = gfc_get_interface (); intr = gfc_get_interface ();
intr->sym = new; intr->sym = new;
intr->where = *gfc_current_locus (); intr->where = gfc_current_locus;
intr->next = *head; intr->next = *head;
*head = intr; *head = intr;
......
...@@ -819,7 +819,7 @@ gfc_match_format (void) ...@@ -819,7 +819,7 @@ gfc_match_format (void)
mode = MODE_FORMAT; mode = MODE_FORMAT;
format_length = 0; format_length = 0;
start = *gfc_current_locus (); start = gfc_current_locus;
if (check_format () == FAILURE) if (check_format () == FAILURE)
return MATCH_ERROR; return MATCH_ERROR;
...@@ -833,7 +833,7 @@ gfc_match_format (void) ...@@ -833,7 +833,7 @@ gfc_match_format (void)
/* The label doesn't get created until after the statement is done /* The label doesn't get created until after the statement is done
being matched, so we have to leave the string for later. */ being matched, so we have to leave the string for later. */
gfc_set_locus (&start); /* Back to the beginning */ gfc_current_locus = start; /* Back to the beginning */
new_st.loc = start; new_st.loc = start;
new_st.op = EXEC_NOP; new_st.op = EXEC_NOP;
...@@ -1480,7 +1480,7 @@ match_dt_format (gfc_dt * dt) ...@@ -1480,7 +1480,7 @@ match_dt_format (gfc_dt * dt)
gfc_expr *e; gfc_expr *e;
gfc_st_label *label; gfc_st_label *label;
where = *gfc_current_locus (); where = gfc_current_locus;
if (gfc_match_char ('*') == MATCH_YES) if (gfc_match_char ('*') == MATCH_YES)
{ {
...@@ -1520,7 +1520,7 @@ match_dt_format (gfc_dt * dt) ...@@ -1520,7 +1520,7 @@ match_dt_format (gfc_dt * dt)
return MATCH_YES; return MATCH_YES;
} }
gfc_set_locus (&where); /* The only case where we have to restore */ gfc_current_locus = where; /* The only case where we have to restore */
return MATCH_NO; return MATCH_NO;
...@@ -1617,13 +1617,13 @@ match_dt_element (io_kind k, gfc_dt * dt) ...@@ -1617,13 +1617,13 @@ match_dt_element (io_kind k, gfc_dt * dt)
m = match_ltag (&tag_end, &dt->end); m = match_ltag (&tag_end, &dt->end);
if (m == MATCH_YES) if (m == MATCH_YES)
dt->end_where = *gfc_current_locus (); dt->end_where = gfc_current_locus;
if (m != MATCH_NO) if (m != MATCH_NO)
return m; return m;
m = match_ltag (&tag_eor, &dt->eor); m = match_ltag (&tag_eor, &dt->eor);
if (m == MATCH_YES) if (m == MATCH_YES)
dt->eor_where = *gfc_current_locus (); dt->eor_where = gfc_current_locus;
if (m != MATCH_NO) if (m != MATCH_NO)
return m; return m;
...@@ -1818,7 +1818,7 @@ match_io_iterator (io_kind k, gfc_code ** result) ...@@ -1818,7 +1818,7 @@ match_io_iterator (io_kind k, gfc_code ** result)
iter = NULL; iter = NULL;
head = NULL; head = NULL;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (gfc_match_char ('(') != MATCH_YES) if (gfc_match_char ('(') != MATCH_YES)
return MATCH_NO; return MATCH_NO;
...@@ -1885,7 +1885,7 @@ syntax: ...@@ -1885,7 +1885,7 @@ syntax:
cleanup: cleanup:
gfc_free_iterator (iter, 1); gfc_free_iterator (iter, 1);
gfc_free_statements (head); gfc_free_statements (head);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
...@@ -2093,7 +2093,7 @@ match_io (io_kind k) ...@@ -2093,7 +2093,7 @@ match_io (io_kind k)
if (m == MATCH_ERROR) if (m == MATCH_ERROR)
goto cleanup; goto cleanup;
where = *gfc_current_locus (); where = gfc_current_locus;
if (gfc_match_name (name) == MATCH_YES if (gfc_match_name (name) == MATCH_YES
&& !gfc_find_symbol (name, NULL, 1, &sym) && !gfc_find_symbol (name, NULL, 1, &sym)
...@@ -2108,7 +2108,7 @@ match_io (io_kind k) ...@@ -2108,7 +2108,7 @@ match_io (io_kind k)
goto next; goto next;
} }
gfc_set_locus (&where); gfc_current_locus = where;
goto loop; /* No matches, try regular elements */ goto loop; /* No matches, try regular elements */
......
...@@ -80,12 +80,12 @@ gfc_match_space (void) ...@@ -80,12 +80,12 @@ gfc_match_space (void)
if (gfc_current_form == FORM_FIXED) if (gfc_current_form == FORM_FIXED)
return MATCH_YES; return MATCH_YES;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (!gfc_is_whitespace (c)) if (!gfc_is_whitespace (c))
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -109,7 +109,7 @@ gfc_match_eos (void) ...@@ -109,7 +109,7 @@ gfc_match_eos (void)
for (;;) for (;;)
{ {
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
c = gfc_next_char (); c = gfc_next_char ();
...@@ -135,7 +135,7 @@ gfc_match_eos (void) ...@@ -135,7 +135,7 @@ gfc_match_eos (void)
break; break;
} }
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return (flag) ? MATCH_YES : MATCH_NO; return (flag) ? MATCH_YES : MATCH_NO;
} }
...@@ -151,14 +151,14 @@ gfc_match_small_literal_int (int *value) ...@@ -151,14 +151,14 @@ gfc_match_small_literal_int (int *value)
char c; char c;
int i; int i;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
c = gfc_next_char (); c = gfc_next_char ();
if (!ISDIGIT (c)) if (!ISDIGIT (c))
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -166,7 +166,7 @@ gfc_match_small_literal_int (int *value) ...@@ -166,7 +166,7 @@ gfc_match_small_literal_int (int *value)
for (;;) for (;;)
{ {
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (!ISDIGIT (c)) if (!ISDIGIT (c))
...@@ -181,7 +181,7 @@ gfc_match_small_literal_int (int *value) ...@@ -181,7 +181,7 @@ gfc_match_small_literal_int (int *value)
} }
} }
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
*value = i; *value = i;
return MATCH_YES; return MATCH_YES;
...@@ -227,7 +227,7 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero) ...@@ -227,7 +227,7 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero)
match m; match m;
int i; int i;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
m = gfc_match_small_literal_int (&i); m = gfc_match_small_literal_int (&i);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -240,7 +240,7 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero) ...@@ -240,7 +240,7 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero)
} }
gfc_error ("Statement label at %C is out of range"); gfc_error ("Statement label at %C is out of range");
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -320,7 +320,7 @@ gfc_match_strings (mstring * a) ...@@ -320,7 +320,7 @@ gfc_match_strings (mstring * a)
no_match = p->tag; no_match = p->tag;
best_match = NULL; best_match = NULL;
match_loc = *gfc_current_locus (); match_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
...@@ -356,7 +356,7 @@ gfc_match_strings (mstring * a) ...@@ -356,7 +356,7 @@ gfc_match_strings (mstring * a)
if (*p->mp == '\0') if (*p->mp == '\0')
{ {
/* Found a match. */ /* Found a match. */
match_loc = *gfc_current_locus (); match_loc = gfc_current_locus;
best_match = p; best_match = p;
possibles--; possibles--;
p->mp = NULL; p->mp = NULL;
...@@ -364,7 +364,7 @@ gfc_match_strings (mstring * a) ...@@ -364,7 +364,7 @@ gfc_match_strings (mstring * a)
} }
} }
gfc_set_locus (&match_loc); gfc_current_locus = match_loc;
return (best_match == NULL) ? no_match : best_match->tag; return (best_match == NULL) ? no_match : best_match->tag;
} }
...@@ -379,13 +379,13 @@ gfc_match_name (char *buffer) ...@@ -379,13 +379,13 @@ gfc_match_name (char *buffer)
locus old_loc; locus old_loc;
int i, c; int i, c;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
c = gfc_next_char (); c = gfc_next_char ();
if (!ISALPHA (c)) if (!ISALPHA (c))
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -401,7 +401,7 @@ gfc_match_name (char *buffer) ...@@ -401,7 +401,7 @@ gfc_match_name (char *buffer)
return MATCH_ERROR; return MATCH_ERROR;
} }
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
} }
while (ISALNUM (c) while (ISALNUM (c)
...@@ -409,7 +409,7 @@ gfc_match_name (char *buffer) ...@@ -409,7 +409,7 @@ gfc_match_name (char *buffer)
|| (gfc_option.flag_dollar_ok && c == '$')); || (gfc_option.flag_dollar_ok && c == '$'));
buffer[i] = '\0'; buffer[i] = '\0';
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_YES; return MATCH_YES;
} }
...@@ -495,9 +495,9 @@ gfc_match_iterator (gfc_iterator * iter, int init_flag) ...@@ -495,9 +495,9 @@ gfc_match_iterator (gfc_iterator * iter, int init_flag)
/* Match the start of an iterator without affecting the symbol /* Match the start of an iterator without affecting the symbol
table. */ table. */
start = *gfc_current_locus (); start = gfc_current_locus;
m = gfc_match (" %n =", name); m = gfc_match (" %n =", name);
gfc_set_locus (&start); gfc_current_locus = start;
if (m != MATCH_YES) if (m != MATCH_YES)
return MATCH_NO; return MATCH_NO;
...@@ -586,13 +586,13 @@ gfc_match_char (char c) ...@@ -586,13 +586,13 @@ gfc_match_char (char c)
{ {
locus where; locus where;
where = *gfc_current_locus (); where = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
if (gfc_next_char () == c) if (gfc_next_char () == c)
return MATCH_YES; return MATCH_YES;
gfc_set_locus (&where); gfc_current_locus = where;
return MATCH_NO; return MATCH_NO;
} }
...@@ -624,7 +624,7 @@ gfc_match (const char *target, ...) ...@@ -624,7 +624,7 @@ gfc_match (const char *target, ...)
void **vp; void **vp;
const char *p; const char *p;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
va_start (argp, target); va_start (argp, target);
m = MATCH_NO; m = MATCH_NO;
matches = 0; matches = 0;
...@@ -750,7 +750,7 @@ not_yes: ...@@ -750,7 +750,7 @@ not_yes:
if (m != MATCH_YES) if (m != MATCH_YES)
{ {
/* Clean up after a failed match. */ /* Clean up after a failed match. */
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
va_start (argp, target); va_start (argp, target);
p = target; p = target;
...@@ -832,7 +832,7 @@ gfc_match_assignment (void) ...@@ -832,7 +832,7 @@ gfc_match_assignment (void)
locus old_loc; locus old_loc;
match m; match m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
lvalue = rvalue = NULL; lvalue = rvalue = NULL;
m = gfc_match (" %v =", &lvalue); m = gfc_match (" %v =", &lvalue);
...@@ -852,7 +852,7 @@ gfc_match_assignment (void) ...@@ -852,7 +852,7 @@ gfc_match_assignment (void)
return MATCH_YES; return MATCH_YES;
cleanup: cleanup:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_free_expr (lvalue); gfc_free_expr (lvalue);
gfc_free_expr (rvalue); gfc_free_expr (rvalue);
return m; return m;
...@@ -868,7 +868,7 @@ gfc_match_pointer_assignment (void) ...@@ -868,7 +868,7 @@ gfc_match_pointer_assignment (void)
locus old_loc; locus old_loc;
match m; match m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
lvalue = rvalue = NULL; lvalue = rvalue = NULL;
...@@ -890,7 +890,7 @@ gfc_match_pointer_assignment (void) ...@@ -890,7 +890,7 @@ gfc_match_pointer_assignment (void)
return MATCH_YES; return MATCH_YES;
cleanup: cleanup:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_free_expr (lvalue); gfc_free_expr (lvalue);
gfc_free_expr (rvalue); gfc_free_expr (rvalue);
return m; return m;
...@@ -920,7 +920,7 @@ gfc_match_if (gfc_statement * if_type) ...@@ -920,7 +920,7 @@ gfc_match_if (gfc_statement * if_type)
if (n == MATCH_ERROR) if (n == MATCH_ERROR)
return n; return n;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
m = gfc_match (" if ( %e", &expr); m = gfc_match (" if ( %e", &expr);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -996,7 +996,7 @@ gfc_match_if (gfc_statement * if_type) ...@@ -996,7 +996,7 @@ gfc_match_if (gfc_statement * if_type)
gfc_free_expr (expr); gfc_free_expr (expr);
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_match (" if ( %e ) ", &expr); /* Guaranteed to match */ gfc_match (" if ( %e ) ", &expr); /* Guaranteed to match */
...@@ -1006,7 +1006,7 @@ gfc_match_if (gfc_statement * if_type) ...@@ -1006,7 +1006,7 @@ gfc_match_if (gfc_statement * if_type)
gfc_free_expr (expr); gfc_free_expr (expr);
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_match (" if ( %e ) ", &expr); /* Guaranteed to match */ gfc_match (" if ( %e ) ", &expr); /* Guaranteed to match */
...@@ -1066,7 +1066,7 @@ got_match: ...@@ -1066,7 +1066,7 @@ got_match:
p = gfc_get_code (); p = gfc_get_code ();
p->next = gfc_get_code (); p->next = gfc_get_code ();
*p->next = new_st; *p->next = new_st;
p->next->loc = *gfc_current_locus (); p->next->loc = gfc_current_locus;
p->expr = expr; p->expr = expr;
p->op = EXEC_IF; p->op = EXEC_IF;
...@@ -1182,7 +1182,7 @@ gfc_match_do (void) ...@@ -1182,7 +1182,7 @@ gfc_match_do (void)
gfc_st_label *label; gfc_st_label *label;
match m; match m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
label = NULL; label = NULL;
iter.var = iter.start = iter.end = iter.step = NULL; iter.var = iter.start = iter.end = iter.step = NULL;
...@@ -1222,7 +1222,7 @@ gfc_match_do (void) ...@@ -1222,7 +1222,7 @@ gfc_match_do (void)
/* The abortive DO WHILE may have done something to the symbol /* The abortive DO WHILE may have done something to the symbol
table, so we start over: */ table, so we start over: */
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_match_label (); /* This won't error */ gfc_match_label (); /* This won't error */
gfc_match (" do "); /* This will work */ gfc_match (" do "); /* This will work */
...@@ -1780,7 +1780,7 @@ gfc_match_nullify (void) ...@@ -1780,7 +1780,7 @@ gfc_match_nullify (void)
/* build ' => NULL() ' */ /* build ' => NULL() ' */
e = gfc_get_expr (); e = gfc_get_expr ();
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
e->expr_type = EXPR_NULL; e->expr_type = EXPR_NULL;
e->ts.type = BT_UNKNOWN; e->ts.type = BT_UNKNOWN;
...@@ -2006,7 +2006,7 @@ gfc_match_call (void) ...@@ -2006,7 +2006,7 @@ gfc_match_call (void)
c->expr->expr_type = EXPR_VARIABLE; c->expr->expr_type = EXPR_VARIABLE;
c->expr->symtree = select_st; c->expr->symtree = select_st;
c->expr->ts = select_sym->ts; c->expr->ts = select_sym->ts;
c->expr->where = *gfc_current_locus (); c->expr->where = gfc_current_locus;
i = 0; i = 0;
for (a = arglist; a; a = a->next) for (a = arglist; a; a = a->next)
...@@ -2069,7 +2069,7 @@ match_implicit_range (gfc_typespec * ts) ...@@ -2069,7 +2069,7 @@ match_implicit_range (gfc_typespec * ts)
int c, c1, c2, inner; int c, c1, c2, inner;
locus cur_loc; locus cur_loc;
cur_loc = *gfc_current_locus (); cur_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
c = gfc_next_char (); c = gfc_next_char ();
...@@ -2140,7 +2140,7 @@ match_implicit_range (gfc_typespec * ts) ...@@ -2140,7 +2140,7 @@ match_implicit_range (gfc_typespec * ts)
bad: bad:
gfc_syntax_error (ST_IMPLICIT); gfc_syntax_error (ST_IMPLICIT);
gfc_set_locus (&cur_loc); gfc_current_locus = cur_loc;
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -2191,7 +2191,7 @@ gfc_match_implicit (void) ...@@ -2191,7 +2191,7 @@ gfc_match_implicit (void)
if (m == MATCH_NO) if (m == MATCH_NO)
goto syntax; goto syntax;
cur_loc = *gfc_current_locus (); cur_loc = gfc_current_locus;
m = match_implicit_range (&ts); m = match_implicit_range (&ts);
if (m == MATCH_YES) if (m == MATCH_YES)
...@@ -2202,7 +2202,7 @@ gfc_match_implicit (void) ...@@ -2202,7 +2202,7 @@ gfc_match_implicit (void)
if ((c == '\n') || (c == ',')) if ((c == '\n') || (c == ','))
continue; continue;
gfc_set_locus (&cur_loc); gfc_current_locus = cur_loc;
} }
/* Last chance -- check <TYPE> (<KIND>) (<RANGE>). */ /* Last chance -- check <TYPE> (<KIND>) (<RANGE>). */
...@@ -3026,7 +3026,7 @@ gfc_match_data (void) ...@@ -3026,7 +3026,7 @@ gfc_match_data (void)
for (;;) for (;;)
{ {
new = gfc_get_data (); new = gfc_get_data ();
new->where = *gfc_current_locus (); new->where = gfc_current_locus;
m = top_var_list (new); m = top_var_list (new);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -3098,7 +3098,7 @@ match_case_selector (gfc_case ** cp) ...@@ -3098,7 +3098,7 @@ match_case_selector (gfc_case ** cp)
match m; match m;
c = gfc_get_case (); c = gfc_get_case ();
c->where = *gfc_current_locus (); c->where = gfc_current_locus;
if (gfc_match_char (':') == MATCH_YES) if (gfc_match_char (':') == MATCH_YES)
{ {
...@@ -3219,7 +3219,7 @@ gfc_match_case (void) ...@@ -3219,7 +3219,7 @@ gfc_match_case (void)
new_st.op = EXEC_SELECT; new_st.op = EXEC_SELECT;
c = gfc_get_case (); c = gfc_get_case ();
c->where = *gfc_current_locus (); c->where = gfc_current_locus;
new_st.ext.case_list = c; new_st.ext.case_list = c;
return MATCH_YES; return MATCH_YES;
} }
...@@ -3417,7 +3417,7 @@ match_forall_iterator (gfc_forall_iterator ** result) ...@@ -3417,7 +3417,7 @@ match_forall_iterator (gfc_forall_iterator ** result)
locus where; locus where;
match m; match m;
where = *gfc_current_locus (); where = gfc_current_locus;
iter = gfc_getmem (sizeof (gfc_forall_iterator)); iter = gfc_getmem (sizeof (gfc_forall_iterator));
m = gfc_match_variable (&iter->var, 0); m = gfc_match_variable (&iter->var, 0);
...@@ -3464,7 +3464,7 @@ syntax: ...@@ -3464,7 +3464,7 @@ syntax:
m = MATCH_ERROR; m = MATCH_ERROR;
cleanup: cleanup:
gfc_set_locus (&where); gfc_current_locus = where;
gfc_free_forall_iterator (iter); gfc_free_forall_iterator (iter);
return m; return m;
} }
......
...@@ -46,7 +46,7 @@ gfc_match_defined_op_name (char *result, int error_flag) ...@@ -46,7 +46,7 @@ gfc_match_defined_op_name (char *result, int error_flag)
match m; match m;
int i; int i;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
m = gfc_match (" . %n .", name); m = gfc_match (" . %n .", name);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -59,7 +59,7 @@ gfc_match_defined_op_name (char *result, int error_flag) ...@@ -59,7 +59,7 @@ gfc_match_defined_op_name (char *result, int error_flag)
{ {
if (error_flag) if (error_flag)
goto error; goto error;
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -81,7 +81,7 @@ error: ...@@ -81,7 +81,7 @@ error:
gfc_error ("The name '%s' cannot be used as a defined operator at %C", gfc_error ("The name '%s' cannot be used as a defined operator at %C",
name); name);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -113,11 +113,11 @@ next_operator (gfc_intrinsic_op t) ...@@ -113,11 +113,11 @@ next_operator (gfc_intrinsic_op t)
gfc_intrinsic_op u; gfc_intrinsic_op u;
locus old_loc; locus old_loc;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (gfc_match_intrinsic_op (&u) == MATCH_YES && t == u) if (gfc_match_intrinsic_op (&u) == MATCH_YES && t == u)
return 1; return 1;
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return 0; return 0;
} }
...@@ -199,7 +199,7 @@ match_level_1 (gfc_expr ** result) ...@@ -199,7 +199,7 @@ match_level_1 (gfc_expr ** result)
locus where; locus where;
match m; match m;
where = *gfc_current_locus (); where = gfc_current_locus;
uop = NULL; uop = NULL;
m = match_defined_operator (&uop); m = match_defined_operator (&uop);
if (m == MATCH_ERROR) if (m == MATCH_ERROR)
...@@ -271,7 +271,7 @@ match_mult_operand (gfc_expr ** result) ...@@ -271,7 +271,7 @@ match_mult_operand (gfc_expr ** result)
return MATCH_YES; return MATCH_YES;
} }
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_ext_mult_operand (&exp); m = match_ext_mult_operand (&exp);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -305,7 +305,7 @@ match_ext_mult_operand (gfc_expr ** result) ...@@ -305,7 +305,7 @@ match_ext_mult_operand (gfc_expr ** result)
match m; match m;
int i; int i;
where = *gfc_current_locus (); where = gfc_current_locus;
i = match_add_op (); i = match_add_op ();
if (i == 0) if (i == 0)
...@@ -353,7 +353,7 @@ match_add_operand (gfc_expr ** result) ...@@ -353,7 +353,7 @@ match_add_operand (gfc_expr ** result)
{ {
/* Build up a string of products or quotients. */ /* Build up a string of products or quotients. */
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (next_operator (INTRINSIC_TIMES)) if (next_operator (INTRINSIC_TIMES))
i = INTRINSIC_TIMES; i = INTRINSIC_TIMES;
...@@ -365,12 +365,12 @@ match_add_operand (gfc_expr ** result) ...@@ -365,12 +365,12 @@ match_add_operand (gfc_expr ** result)
break; break;
} }
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_ext_mult_operand (&e); m = match_ext_mult_operand (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
break; break;
} }
...@@ -409,7 +409,7 @@ match_ext_add_operand (gfc_expr ** result) ...@@ -409,7 +409,7 @@ match_ext_add_operand (gfc_expr ** result)
match m; match m;
int i; int i;
where = *gfc_current_locus (); where = gfc_current_locus;
i = match_add_op (); i = match_add_op ();
if (i == 0) if (i == 0)
...@@ -451,7 +451,7 @@ match_level_2 (gfc_expr ** result) ...@@ -451,7 +451,7 @@ match_level_2 (gfc_expr ** result)
match m; match m;
int i; int i;
where = *gfc_current_locus (); where = gfc_current_locus;
i = match_add_op (); i = match_add_op ();
if (i != 0) if (i != 0)
...@@ -491,7 +491,7 @@ match_level_2 (gfc_expr ** result) ...@@ -491,7 +491,7 @@ match_level_2 (gfc_expr ** result)
for (;;) for (;;)
{ {
where = *gfc_current_locus (); where = gfc_current_locus;
i = match_add_op (); i = match_add_op ();
if (i == 0) if (i == 0)
break; break;
...@@ -544,7 +544,7 @@ match_level_3 (gfc_expr ** result) ...@@ -544,7 +544,7 @@ match_level_3 (gfc_expr ** result)
if (!next_operator (INTRINSIC_CONCAT)) if (!next_operator (INTRINSIC_CONCAT))
break; break;
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_level_2 (&e); m = match_level_2 (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -587,7 +587,7 @@ match_level_4 (gfc_expr ** result) ...@@ -587,7 +587,7 @@ match_level_4 (gfc_expr ** result)
if (m != MATCH_YES) if (m != MATCH_YES)
return m; return m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
if (gfc_match_intrinsic_op (&i) != MATCH_YES) if (gfc_match_intrinsic_op (&i) != MATCH_YES)
{ {
...@@ -598,12 +598,12 @@ match_level_4 (gfc_expr ** result) ...@@ -598,12 +598,12 @@ match_level_4 (gfc_expr ** result)
if (i != INTRINSIC_EQ && i != INTRINSIC_NE && i != INTRINSIC_GE if (i != INTRINSIC_EQ && i != INTRINSIC_NE && i != INTRINSIC_GE
&& i != INTRINSIC_LE && i != INTRINSIC_LT && i != INTRINSIC_GT) && i != INTRINSIC_LE && i != INTRINSIC_LT && i != INTRINSIC_GT)
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
*result = left; *result = left;
return MATCH_YES; return MATCH_YES;
} }
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_level_3 (&right); m = match_level_3 (&right);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -667,7 +667,7 @@ match_and_operand (gfc_expr ** result) ...@@ -667,7 +667,7 @@ match_and_operand (gfc_expr ** result)
int i; int i;
i = next_operator (INTRINSIC_NOT); i = next_operator (INTRINSIC_NOT);
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_level_4 (&e); m = match_level_4 (&e);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -706,7 +706,7 @@ match_or_operand (gfc_expr ** result) ...@@ -706,7 +706,7 @@ match_or_operand (gfc_expr ** result)
{ {
if (!next_operator (INTRINSIC_AND)) if (!next_operator (INTRINSIC_AND))
break; break;
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_and_operand (&e); m = match_and_operand (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -749,7 +749,7 @@ match_equiv_operand (gfc_expr ** result) ...@@ -749,7 +749,7 @@ match_equiv_operand (gfc_expr ** result)
{ {
if (!next_operator (INTRINSIC_OR)) if (!next_operator (INTRINSIC_OR))
break; break;
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_or_operand (&e); m = match_or_operand (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -803,7 +803,7 @@ match_level_5 (gfc_expr ** result) ...@@ -803,7 +803,7 @@ match_level_5 (gfc_expr ** result)
break; break;
} }
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_equiv_operand (&e); m = match_equiv_operand (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
...@@ -861,7 +861,7 @@ gfc_match_expr (gfc_expr ** result) ...@@ -861,7 +861,7 @@ gfc_match_expr (gfc_expr ** result)
return MATCH_ERROR; return MATCH_ERROR;
} }
where = *gfc_current_locus (); where = gfc_current_locus;
m = match_level_5 (&e); m = match_level_5 (&e);
if (m == MATCH_NO) if (m == MATCH_NO)
......
...@@ -506,7 +506,7 @@ gfc_match_use (void) ...@@ -506,7 +506,7 @@ gfc_match_use (void)
{ {
/* Get a new rename struct and add it to the rename list. */ /* Get a new rename struct and add it to the rename list. */
new = gfc_get_use_rename (); new = gfc_get_use_rename ();
new->where = *gfc_current_locus (); new->where = gfc_current_locus;
new->found = 0; new->found = 0;
if (gfc_rename_list == NULL) if (gfc_rename_list == NULL)
...@@ -1766,10 +1766,10 @@ mio_array_ref (gfc_array_ref * ar) ...@@ -1766,10 +1766,10 @@ mio_array_ref (gfc_array_ref * ar)
if (iomode == IO_INPUT) if (iomode == IO_INPUT)
{ {
ar->where = *gfc_current_locus (); ar->where = gfc_current_locus;
for (i = 0; i < ar->dimen; i++) for (i = 0; i < ar->dimen; i++)
ar->c_where[i] = *gfc_current_locus (); ar->c_where[i] = gfc_current_locus;
} }
mio_rparen (); mio_rparen ();
...@@ -2401,7 +2401,7 @@ mio_expr (gfc_expr ** ep) ...@@ -2401,7 +2401,7 @@ mio_expr (gfc_expr ** ep)
bad_module ("Expected expression type"); bad_module ("Expected expression type");
e = *ep = gfc_get_expr (); e = *ep = gfc_get_expr ();
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
e->expr_type = (expr_t) find_enum (expr_types); e->expr_type = (expr_t) find_enum (expr_types);
} }
......
...@@ -66,7 +66,7 @@ match_word (const char *str, match (*subr) (void), locus * old_locus) ...@@ -66,7 +66,7 @@ match_word (const char *str, match (*subr) (void), locus * old_locus)
if (m != MATCH_YES) if (m != MATCH_YES)
{ {
gfc_set_locus (old_locus); gfc_current_locus = *old_locus;
reject_statement (); reject_statement ();
} }
...@@ -101,7 +101,7 @@ decode_statement (void) ...@@ -101,7 +101,7 @@ decode_statement (void)
if (gfc_match_eos () == MATCH_YES) if (gfc_match_eos () == MATCH_YES)
return ST_NONE; return ST_NONE;
old_locus = *gfc_current_locus (); old_locus = gfc_current_locus;
/* Try matching a data declaration or function declaration. The /* Try matching a data declaration or function declaration. The
input "REALFUNCTIONA(N)" can mean several things in different input "REALFUNCTIONA(N)" can mean several things in different
...@@ -118,7 +118,7 @@ decode_statement (void) ...@@ -118,7 +118,7 @@ decode_statement (void)
reject_statement (); reject_statement ();
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
} }
/* Match statements whose error messages are meant to be overwritten /* Match statements whose error messages are meant to be overwritten
...@@ -136,7 +136,7 @@ decode_statement (void) ...@@ -136,7 +136,7 @@ decode_statement (void)
if (gfc_match_subroutine () == MATCH_YES) if (gfc_match_subroutine () == MATCH_YES)
return ST_SUBROUTINE; return ST_SUBROUTINE;
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
/* Check for the IF, DO, SELECT, WHERE and FORALL statements, which /* Check for the IF, DO, SELECT, WHERE and FORALL statements, which
might begin with a block label. The match functions for these might begin with a block label. The match functions for these
...@@ -146,17 +146,17 @@ decode_statement (void) ...@@ -146,17 +146,17 @@ decode_statement (void)
if (gfc_match_if (&st) == MATCH_YES) if (gfc_match_if (&st) == MATCH_YES)
return st; return st;
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
if (gfc_match_where (&st) == MATCH_YES) if (gfc_match_where (&st) == MATCH_YES)
return st; return st;
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
if (gfc_match_forall (&st) == MATCH_YES) if (gfc_match_forall (&st) == MATCH_YES)
return st; return st;
gfc_undo_symbols (); gfc_undo_symbols ();
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
match (NULL, gfc_match_do, ST_DO); match (NULL, gfc_match_do, ST_DO);
match (NULL, gfc_match_select, ST_SELECT_CASE); match (NULL, gfc_match_select, ST_SELECT_CASE);
...@@ -327,7 +327,7 @@ next_free (void) ...@@ -327,7 +327,7 @@ next_free (void)
} }
else else
{ {
label_locus = *gfc_current_locus (); label_locus = gfc_current_locus;
if (gfc_statement_label->value == 0) if (gfc_statement_label->value == 0)
{ {
...@@ -394,7 +394,7 @@ next_fixed (void) ...@@ -394,7 +394,7 @@ next_fixed (void)
case '8': case '8':
case '9': case '9':
label = label * 10 + c - '0'; label = label * 10 + c - '0';
label_locus = *gfc_current_locus (); label_locus = gfc_current_locus;
digit_flag = 1; digit_flag = 1;
break; break;
...@@ -440,14 +440,14 @@ next_fixed (void) ...@@ -440,14 +440,14 @@ next_fixed (void)
do do
{ {
loc = *gfc_current_locus (); loc = gfc_current_locus;
c = gfc_next_char_literal (0); c = gfc_next_char_literal (0);
} }
while (gfc_is_whitespace (c)); while (gfc_is_whitespace (c));
if (c == '!') if (c == '!')
goto blank_line; goto blank_line;
gfc_set_locus (&loc); gfc_current_locus = loc;
if (gfc_match_eos () == MATCH_YES) if (gfc_match_eos () == MATCH_YES)
goto blank_line; goto blank_line;
...@@ -606,7 +606,7 @@ add_statement (void) ...@@ -606,7 +606,7 @@ add_statement (void)
p = gfc_get_code (); p = gfc_get_code ();
*p = new_st; *p = new_st;
p->loc = *gfc_current_locus (); p->loc = gfc_current_locus;
if (gfc_state_stack->head == NULL) if (gfc_state_stack->head == NULL)
gfc_state_stack->head = p; gfc_state_stack->head = p;
...@@ -1237,7 +1237,7 @@ verify_st_order (st_state * p, gfc_statement st) ...@@ -1237,7 +1237,7 @@ verify_st_order (st_state * p, gfc_statement st)
} }
/* All is well, record the statement in case we need it next time. */ /* All is well, record the statement in case we need it next time. */
p->where = *gfc_current_locus (); p->where = gfc_current_locus;
p->last_statement = st; p->last_statement = st;
return SUCCESS; return SUCCESS;
...@@ -1811,7 +1811,7 @@ parse_if_block (void) ...@@ -1811,7 +1811,7 @@ parse_if_block (void)
} }
seen_else = 1; seen_else = 1;
else_locus = *gfc_current_locus (); else_locus = gfc_current_locus;
d = new_level (gfc_state_stack->head); d = new_level (gfc_state_stack->head);
d->op = EXEC_IF; d->op = EXEC_IF;
...@@ -2411,7 +2411,7 @@ loop: ...@@ -2411,7 +2411,7 @@ loop:
if (seen_program) if (seen_program)
goto duplicate_main; goto duplicate_main;
seen_program = 1; seen_program = 1;
prog_locus = *gfc_current_locus (); prog_locus = gfc_current_locus;
push_state (&s, COMP_PROGRAM, gfc_new_block); push_state (&s, COMP_PROGRAM, gfc_new_block);
accept_statement (st); accept_statement (st);
...@@ -2449,7 +2449,7 @@ loop: ...@@ -2449,7 +2449,7 @@ loop:
if (seen_program) if (seen_program)
goto duplicate_main; goto duplicate_main;
seen_program = 1; seen_program = 1;
prog_locus = *gfc_current_locus (); prog_locus = gfc_current_locus;
push_state (&s, COMP_PROGRAM, gfc_new_block); push_state (&s, COMP_PROGRAM, gfc_new_block);
parse_progunit (st); parse_progunit (st);
......
...@@ -159,7 +159,7 @@ match_digits (int signflag, int radix, char *buffer) ...@@ -159,7 +159,7 @@ match_digits (int signflag, int radix, char *buffer)
for (;;) for (;;)
{ {
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (!check_digit (c, radix)) if (!check_digit (c, radix))
...@@ -170,7 +170,7 @@ match_digits (int signflag, int radix, char *buffer) ...@@ -170,7 +170,7 @@ match_digits (int signflag, int radix, char *buffer)
length++; length++;
} }
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return length; return length;
} }
...@@ -187,11 +187,11 @@ match_integer_constant (gfc_expr ** result, int signflag) ...@@ -187,11 +187,11 @@ match_integer_constant (gfc_expr ** result, int signflag)
char *buffer; char *buffer;
gfc_expr *e; gfc_expr *e;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
length = match_digits (signflag, 10, NULL); length = match_digits (signflag, 10, NULL);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
if (length == -1) if (length == -1)
return MATCH_NO; return MATCH_NO;
...@@ -214,7 +214,7 @@ match_integer_constant (gfc_expr ** result, int signflag) ...@@ -214,7 +214,7 @@ match_integer_constant (gfc_expr ** result, int signflag)
return MATCH_ERROR; 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) if (gfc_range_check (e) != ARITH_OK)
{ {
...@@ -241,7 +241,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -241,7 +241,7 @@ match_boz_constant (gfc_expr ** result)
gfc_expr *e; gfc_expr *e;
const char *rname; const char *rname;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
switch (gfc_next_char ()) switch (gfc_next_char ())
...@@ -276,7 +276,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -276,7 +276,7 @@ match_boz_constant (gfc_expr ** result)
if (delim != '\'' && delim != '\"') if (delim != '\'' && delim != '\"')
goto backup; goto backup;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
length = match_digits (0, radix, NULL); length = match_digits (0, radix, NULL);
if (length == -1) if (length == -1)
...@@ -291,7 +291,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -291,7 +291,7 @@ match_boz_constant (gfc_expr ** result)
return MATCH_ERROR; return MATCH_ERROR;
} }
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
buffer = alloca (length + 1); buffer = alloca (length + 1);
memset (buffer, '\0', length + 1); memset (buffer, '\0', length + 1);
...@@ -300,7 +300,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -300,7 +300,7 @@ match_boz_constant (gfc_expr ** result)
gfc_next_char (); gfc_next_char ();
e = gfc_convert_integer (buffer, gfc_default_integer_kind (), radix, e = gfc_convert_integer (buffer, gfc_default_integer_kind (), radix,
gfc_current_locus ()); &gfc_current_locus);
if (gfc_range_check (e) != ARITH_OK) if (gfc_range_check (e) != ARITH_OK)
{ {
...@@ -314,7 +314,7 @@ match_boz_constant (gfc_expr ** result) ...@@ -314,7 +314,7 @@ match_boz_constant (gfc_expr ** result)
return MATCH_YES; return MATCH_YES;
backup: backup:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -329,7 +329,7 @@ match_real_constant (gfc_expr ** result, int signflag) ...@@ -329,7 +329,7 @@ match_real_constant (gfc_expr ** result, int signflag)
char *p, *buffer; char *p, *buffer;
gfc_expr *e; gfc_expr *e;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
e = NULL; e = NULL;
...@@ -355,7 +355,7 @@ match_real_constant (gfc_expr ** result, int signflag) ...@@ -355,7 +355,7 @@ match_real_constant (gfc_expr ** result, int signflag)
goto done; goto done;
/* Check to see if "." goes with a following operator like ".eq.". */ /* 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 (); c = gfc_next_char ();
if (c == 'e' || c == 'd' || c == 'q') if (c == 'e' || c == 'd' || c == 'q')
...@@ -368,7 +368,7 @@ match_real_constant (gfc_expr ** result, int signflag) ...@@ -368,7 +368,7 @@ match_real_constant (gfc_expr ** result, int signflag)
if (ISALPHA (c)) if (ISALPHA (c))
goto done; /* Distinguish 1.e9 from 1.eq.2 */ goto done; /* Distinguish 1.e9 from 1.eq.2 */
gfc_set_locus (&temp_loc); gfc_current_locus = temp_loc;
seen_dp = 1; seen_dp = 1;
continue; continue;
} }
...@@ -401,7 +401,7 @@ match_real_constant (gfc_expr ** result, int signflag) ...@@ -401,7 +401,7 @@ match_real_constant (gfc_expr ** result, int signflag)
/* TODO: seen_digits is always true at this point */ /* TODO: seen_digits is always true at this point */
if (!seen_digits) if (!seen_digits)
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; /* ".e" can be something else */ return MATCH_NO; /* ".e" can be something else */
} }
...@@ -419,12 +419,12 @@ done: ...@@ -419,12 +419,12 @@ done:
/* See what we've got! */ /* See what we've got! */
if (!seen_digits || (!seen_dp && exp_char == ' ')) if (!seen_digits || (!seen_dp && exp_char == ' '))
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
/* Convert the number. */ /* Convert the number. */
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
buffer = alloca (count + 1); buffer = alloca (count + 1);
...@@ -478,7 +478,7 @@ done: ...@@ -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)) switch (gfc_range_check (e))
{ {
...@@ -520,7 +520,7 @@ match_substring (gfc_charlen * cl, int init, gfc_ref ** result) ...@@ -520,7 +520,7 @@ match_substring (gfc_charlen * cl, int init, gfc_ref ** result)
start = NULL; start = NULL;
end = NULL; end = NULL;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
m = gfc_match_char ('('); m = gfc_match_char ('(');
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -589,7 +589,7 @@ cleanup: ...@@ -589,7 +589,7 @@ cleanup:
gfc_free_expr (start); gfc_free_expr (start);
gfc_free_expr (end); gfc_free_expr (end);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
...@@ -617,7 +617,7 @@ next_string_char (char delimiter) ...@@ -617,7 +617,7 @@ next_string_char (char delimiter)
if (c == '\\') if (c == '\\')
{ {
old_locus = *gfc_current_locus (); old_locus = gfc_current_locus;
switch (gfc_next_char_literal (1)) switch (gfc_next_char_literal (1))
{ {
...@@ -648,7 +648,7 @@ next_string_char (char delimiter) ...@@ -648,7 +648,7 @@ next_string_char (char delimiter)
default: default:
/* Unknown backslash codes are simply not expanded */ /* Unknown backslash codes are simply not expanded */
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
break; break;
} }
} }
...@@ -656,12 +656,12 @@ next_string_char (char delimiter) ...@@ -656,12 +656,12 @@ next_string_char (char delimiter)
if (c != delimiter) if (c != delimiter)
return c; return c;
old_locus = *gfc_current_locus (); old_locus = gfc_current_locus;
c = gfc_next_char_literal (1); c = gfc_next_char_literal (1);
if (c == delimiter) if (c == delimiter)
return c; return c;
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
return -1; return -1;
} }
...@@ -696,7 +696,7 @@ match_charkind_name (char *name) ...@@ -696,7 +696,7 @@ match_charkind_name (char *name)
for (;;) for (;;)
{ {
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (c == '_') if (c == '_')
...@@ -705,7 +705,7 @@ match_charkind_name (char *name) ...@@ -705,7 +705,7 @@ match_charkind_name (char *name)
if (peek == '\'' || peek == '\"') if (peek == '\'' || peek == '\"')
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
*name = '\0'; *name = '\0';
return MATCH_YES; return MATCH_YES;
} }
...@@ -743,11 +743,11 @@ match_string_constant (gfc_expr ** result) ...@@ -743,11 +743,11 @@ match_string_constant (gfc_expr ** result)
const char *q; const char *q;
match m; match m;
old_locus = *gfc_current_locus (); old_locus = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
start_locus = *gfc_current_locus (); start_locus = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (c == '\'' || c == '"') if (c == '\'' || c == '"')
...@@ -771,7 +771,7 @@ match_string_constant (gfc_expr ** result) ...@@ -771,7 +771,7 @@ match_string_constant (gfc_expr ** result)
} }
else else
{ {
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
m = match_charkind_name (name); m = match_charkind_name (name);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -796,7 +796,7 @@ match_string_constant (gfc_expr ** result) ...@@ -796,7 +796,7 @@ match_string_constant (gfc_expr ** result)
goto no_match; goto no_match;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
start_locus = *gfc_current_locus (); start_locus = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
if (c != '\'' && c != '"') if (c != '\'' && c != '"')
...@@ -834,7 +834,7 @@ got_delim: ...@@ -834,7 +834,7 @@ got_delim:
break; break;
if (c == -2) if (c == -2)
{ {
gfc_set_locus (&start_locus); gfc_current_locus = start_locus;
gfc_error ("Unterminated character constant beginning at %C"); gfc_error ("Unterminated character constant beginning at %C");
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -853,7 +853,7 @@ got_delim: ...@@ -853,7 +853,7 @@ got_delim:
e->value.character.string = p = gfc_getmem (length + 1); e->value.character.string = p = gfc_getmem (length + 1);
e->value.character.length = length; e->value.character.length = length;
gfc_set_locus (&start_locus); gfc_current_locus = start_locus;
gfc_next_char (); /* Skip delimiter */ gfc_next_char (); /* Skip delimiter */
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
...@@ -872,7 +872,7 @@ got_delim: ...@@ -872,7 +872,7 @@ got_delim:
return MATCH_YES; return MATCH_YES;
no_match: no_match:
gfc_set_locus (&old_locus); gfc_current_locus = old_locus;
return MATCH_NO; return MATCH_NO;
} }
...@@ -910,7 +910,7 @@ match_logical_constant (gfc_expr ** result) ...@@ -910,7 +910,7 @@ match_logical_constant (gfc_expr ** result)
e->value.logical = i; e->value.logical = i;
e->ts.type = BT_LOGICAL; e->ts.type = BT_LOGICAL;
e->ts.kind = kind; e->ts.kind = kind;
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
*result = e; *result = e;
return MATCH_YES; return MATCH_YES;
...@@ -999,7 +999,7 @@ match_const_complex_part (gfc_expr ** result) ...@@ -999,7 +999,7 @@ match_const_complex_part (gfc_expr ** result)
char *p, c, exp_char, *buffer; char *p, c, exp_char, *buffer;
locus old_loc; locus old_loc;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
seen_dp = 0; seen_dp = 0;
...@@ -1064,7 +1064,7 @@ done: ...@@ -1064,7 +1064,7 @@ done:
goto no_match; goto no_match;
/* Convert the number. */ /* Convert the number. */
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
buffer = alloca (count + 1); buffer = alloca (count + 1);
...@@ -1121,11 +1121,11 @@ done: ...@@ -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; return MATCH_YES;
no_match: no_match:
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_NO; return MATCH_NO;
} }
...@@ -1157,7 +1157,7 @@ match_complex_constant (gfc_expr ** result) ...@@ -1157,7 +1157,7 @@ match_complex_constant (gfc_expr ** result)
int kind; int kind;
match m; match m;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
real = imag = e = NULL; real = imag = e = NULL;
m = gfc_match_char ('('); m = gfc_match_char ('(');
...@@ -1210,7 +1210,7 @@ match_complex_constant (gfc_expr ** result) ...@@ -1210,7 +1210,7 @@ match_complex_constant (gfc_expr ** result)
gfc_convert_type (imag, &target, 2); gfc_convert_type (imag, &target, 2);
e = gfc_convert_complex (real, imag, kind); e = gfc_convert_complex (real, imag, kind);
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
gfc_free_expr (real); gfc_free_expr (real);
gfc_free_expr (imag); gfc_free_expr (imag);
...@@ -1226,7 +1226,7 @@ cleanup: ...@@ -1226,7 +1226,7 @@ cleanup:
gfc_free_expr (e); gfc_free_expr (e);
gfc_free_expr (real); gfc_free_expr (real);
gfc_free_expr (imag); gfc_free_expr (imag);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return m; return m;
} }
...@@ -1284,7 +1284,7 @@ match_actual_arg (gfc_expr ** result) ...@@ -1284,7 +1284,7 @@ match_actual_arg (gfc_expr ** result)
gfc_expr *e; gfc_expr *e;
int c; int c;
where = *gfc_current_locus (); where = gfc_current_locus;
switch (gfc_match_name (name)) switch (gfc_match_name (name))
{ {
...@@ -1295,10 +1295,10 @@ match_actual_arg (gfc_expr ** result) ...@@ -1295,10 +1295,10 @@ match_actual_arg (gfc_expr ** result)
break; break;
case MATCH_YES: case MATCH_YES:
w = *gfc_current_locus (); w = gfc_current_locus;
gfc_gobble_whitespace (); gfc_gobble_whitespace ();
c = gfc_next_char (); c = gfc_next_char ();
gfc_set_locus (&w); gfc_current_locus = w;
if (c != ',' && c != ')') if (c != ',' && c != ')')
break; break;
...@@ -1343,7 +1343,7 @@ match_actual_arg (gfc_expr ** result) ...@@ -1343,7 +1343,7 @@ match_actual_arg (gfc_expr ** result)
return MATCH_YES; return MATCH_YES;
} }
gfc_set_locus (&where); gfc_current_locus = where;
return gfc_match_expr (result); return gfc_match_expr (result);
} }
...@@ -1358,7 +1358,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base) ...@@ -1358,7 +1358,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base)
locus name_locus; locus name_locus;
match m; match m;
name_locus = *gfc_current_locus (); name_locus = gfc_current_locus;
m = gfc_match_name (name); m = gfc_match_name (name);
if (m != MATCH_YES) if (m != MATCH_YES)
...@@ -1391,7 +1391,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base) ...@@ -1391,7 +1391,7 @@ match_keyword_arg (gfc_actual_arglist * actual, gfc_actual_arglist * base)
return MATCH_YES; return MATCH_YES;
cleanup: cleanup:
gfc_set_locus (&name_locus); gfc_current_locus = name_locus;
return m; return m;
} }
...@@ -1412,7 +1412,7 @@ gfc_match_actual_arglist (int sub_flag, gfc_actual_arglist ** argp) ...@@ -1412,7 +1412,7 @@ gfc_match_actual_arglist (int sub_flag, gfc_actual_arglist ** argp)
match m; match m;
*argp = tail = NULL; *argp = tail = NULL;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
seen_keyword = 0; seen_keyword = 0;
...@@ -1496,7 +1496,7 @@ syntax: ...@@ -1496,7 +1496,7 @@ syntax:
cleanup: cleanup:
gfc_free_actual_arglist (head); gfc_free_actual_arglist (head);
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return MATCH_ERROR; return MATCH_ERROR;
} }
...@@ -1766,7 +1766,7 @@ gfc_match_structure_constructor (gfc_symbol * sym, gfc_expr ** result) ...@@ -1766,7 +1766,7 @@ gfc_match_structure_constructor (gfc_symbol * sym, gfc_expr ** result)
if (gfc_match_char ('(') != MATCH_YES) if (gfc_match_char ('(') != MATCH_YES)
goto syntax; goto syntax;
where = *gfc_current_locus (); where = gfc_current_locus;
gfc_find_component (sym, NULL); gfc_find_component (sym, NULL);
...@@ -1862,7 +1862,7 @@ gfc_match_rvalue (gfc_expr ** result) ...@@ -1862,7 +1862,7 @@ gfc_match_rvalue (gfc_expr ** result)
sym = symtree->n.sym; sym = symtree->n.sym;
e = NULL; e = NULL;
where = *gfc_current_locus (); where = gfc_current_locus;
gfc_set_sym_referenced (sym); gfc_set_sym_referenced (sym);
...@@ -1975,7 +1975,7 @@ gfc_match_rvalue (gfc_expr ** result) ...@@ -1975,7 +1975,7 @@ gfc_match_rvalue (gfc_expr ** result)
e->symtree = symtree; e->symtree = symtree;
e->expr_type = EXPR_FUNCTION; e->expr_type = EXPR_FUNCTION;
e->value.function.actual = actual_arglist; e->value.function.actual = actual_arglist;
e->where = *gfc_current_locus (); e->where = gfc_current_locus;
if (sym->as != NULL) if (sym->as != NULL)
e->rank = sym->as->rank; e->rank = sym->as->rank;
...@@ -2154,7 +2154,7 @@ gfc_match_variable (gfc_expr ** result, int equiv_flag) ...@@ -2154,7 +2154,7 @@ gfc_match_variable (gfc_expr ** result, int equiv_flag)
m = gfc_match_sym_tree (&st, 1); m = gfc_match_sym_tree (&st, 1);
if (m != MATCH_YES) if (m != MATCH_YES)
return m; return m;
where = *gfc_current_locus (); where = gfc_current_locus;
sym = st->n.sym; sym = st->n.sym;
gfc_set_sym_referenced (sym); gfc_set_sym_referenced (sym);
......
...@@ -67,7 +67,7 @@ static int continue_flag, end_flag; ...@@ -67,7 +67,7 @@ static int continue_flag, end_flag;
gfc_source_form gfc_current_form; gfc_source_form gfc_current_form;
static gfc_linebuf *line_head, *line_tail; static gfc_linebuf *line_head, *line_tail;
locus gfc_current_locus1; locus gfc_current_locus;
char *gfc_source_file; char *gfc_source_file;
...@@ -191,28 +191,6 @@ gfc_open_included_file (const char *name) ...@@ -191,28 +191,6 @@ gfc_open_included_file (const char *name)
return NULL; return NULL;
} }
/* Return a pointer to the current locus. */
locus *
gfc_current_locus (void)
{
return &gfc_current_locus1;
}
/* Let a caller move the current read pointer (backwards). */
void
gfc_set_locus (locus * lp)
{
gfc_current_locus1 = *lp;
}
/* Test to see if we're at the end of the main source file. */ /* Test to see if we're at the end of the main source file. */
int int
...@@ -235,7 +213,7 @@ gfc_at_eof (void) ...@@ -235,7 +213,7 @@ gfc_at_eof (void)
if (line_head == NULL) if (line_head == NULL)
return 1; /* Null file */ return 1; /* Null file */
if (gfc_current_locus1.lb == NULL) if (gfc_current_locus.lb == NULL)
return 1; return 1;
return 0; return 0;
...@@ -250,7 +228,7 @@ gfc_at_bol (void) ...@@ -250,7 +228,7 @@ gfc_at_bol (void)
if (gfc_at_eof ()) if (gfc_at_eof ())
return 1; return 1;
return (gfc_current_locus1.nextc == gfc_current_locus1.lb->line); return (gfc_current_locus.nextc == gfc_current_locus.lb->line);
} }
...@@ -263,7 +241,7 @@ gfc_at_eol (void) ...@@ -263,7 +241,7 @@ gfc_at_eol (void)
if (gfc_at_eof ()) if (gfc_at_eof ())
return 1; return 1;
return (*gfc_current_locus1.nextc == '\0'); return (*gfc_current_locus.nextc == '\0');
} }
...@@ -275,19 +253,19 @@ gfc_advance_line (void) ...@@ -275,19 +253,19 @@ gfc_advance_line (void)
if (gfc_at_end ()) if (gfc_at_end ())
return; return;
if (gfc_current_locus1.lb == NULL) if (gfc_current_locus.lb == NULL)
{ {
end_flag = 1; end_flag = 1;
return; return;
} }
gfc_current_locus1.lb = gfc_current_locus1.lb->next; gfc_current_locus.lb = gfc_current_locus.lb->next;
if (gfc_current_locus1.lb != NULL) if (gfc_current_locus.lb != NULL)
gfc_current_locus1.nextc = gfc_current_locus1.lb->line; gfc_current_locus.nextc = gfc_current_locus.lb->line;
else else
{ {
gfc_current_locus1.nextc = NULL; gfc_current_locus.nextc = NULL;
end_flag = 1; end_flag = 1;
} }
} }
...@@ -307,13 +285,13 @@ next_char (void) ...@@ -307,13 +285,13 @@ next_char (void)
{ {
int c; int c;
if (gfc_current_locus1.nextc == NULL) if (gfc_current_locus.nextc == NULL)
return '\n'; return '\n';
c = *gfc_current_locus1.nextc++; c = *gfc_current_locus.nextc++;
if (c == '\0') if (c == '\0')
{ {
gfc_current_locus1.nextc--; /* Remain on this line. */ gfc_current_locus.nextc--; /* Remain on this line. */
c = '\n'; c = '\n';
} }
...@@ -351,7 +329,7 @@ skip_free_comments (void) ...@@ -351,7 +329,7 @@ skip_free_comments (void)
for (;;) for (;;)
{ {
start = gfc_current_locus1; start = gfc_current_locus;
if (gfc_at_eof ()) if (gfc_at_eof ())
break; break;
...@@ -376,7 +354,7 @@ skip_free_comments (void) ...@@ -376,7 +354,7 @@ skip_free_comments (void)
break; break;
} }
gfc_set_locus (&start); gfc_current_locus = start;
} }
...@@ -393,7 +371,7 @@ skip_fixed_comments (void) ...@@ -393,7 +371,7 @@ skip_fixed_comments (void)
for (;;) for (;;)
{ {
start = gfc_current_locus1; start = gfc_current_locus;
if (gfc_at_eof ()) if (gfc_at_eof ())
break; break;
...@@ -433,7 +411,7 @@ skip_fixed_comments (void) ...@@ -433,7 +411,7 @@ skip_fixed_comments (void)
break; break;
} }
gfc_set_locus (&start); gfc_current_locus = start;
} }
...@@ -491,7 +469,7 @@ restart: ...@@ -491,7 +469,7 @@ restart:
/* If the next nonblank character is a ! or \n, we've got a /* If the next nonblank character is a ! or \n, we've got a
continuation line. */ continuation line. */
old_loc = gfc_current_locus1; old_loc = gfc_current_locus;
c = next_char (); c = next_char ();
while (gfc_is_whitespace (c)) while (gfc_is_whitespace (c))
...@@ -502,14 +480,14 @@ restart: ...@@ -502,14 +480,14 @@ restart:
if (in_string && c != '\n') if (in_string && c != '\n')
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
c = '&'; c = '&';
goto done; goto done;
} }
if (c != '!' && c != '\n') if (c != '!' && c != '\n')
{ {
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
c = '&'; c = '&';
goto done; goto done;
} }
...@@ -529,14 +507,14 @@ restart: ...@@ -529,14 +507,14 @@ restart:
reading starts at the next character, otherwise we must back reading starts at the next character, otherwise we must back
up to where the whitespace started and resume from there. */ up to where the whitespace started and resume from there. */
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
c = next_char (); c = next_char ();
while (gfc_is_whitespace (c)) while (gfc_is_whitespace (c))
c = next_char (); c = next_char ();
if (c != '&') if (c != '&')
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
} }
else else
...@@ -556,7 +534,7 @@ restart: ...@@ -556,7 +534,7 @@ restart:
goto done; goto done;
continue_flag = 1; continue_flag = 1;
old_loc = *gfc_current_locus (); old_loc = gfc_current_locus;
gfc_advance_line (); gfc_advance_line ();
gfc_skip_comments (); gfc_skip_comments ();
...@@ -580,7 +558,7 @@ restart: ...@@ -580,7 +558,7 @@ restart:
not_continuation: not_continuation:
c = '\n'; c = '\n';
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
done: done:
continue_flag = 0; continue_flag = 0;
...@@ -614,9 +592,9 @@ gfc_peek_char (void) ...@@ -614,9 +592,9 @@ gfc_peek_char (void)
locus old_loc; locus old_loc;
int c; int c;
old_loc = gfc_current_locus1; old_loc = gfc_current_locus;
c = gfc_next_char (); c = gfc_next_char ();
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
return c; return c;
} }
...@@ -684,12 +662,12 @@ gfc_gobble_whitespace (void) ...@@ -684,12 +662,12 @@ gfc_gobble_whitespace (void)
do do
{ {
old_loc = gfc_current_locus1; old_loc = gfc_current_locus;
c = gfc_next_char_literal (0); c = gfc_next_char_literal (0);
} }
while (gfc_is_whitespace (c)); while (gfc_is_whitespace (c));
gfc_set_locus (&old_loc); gfc_current_locus = old_loc;
} }
...@@ -1123,8 +1101,8 @@ gfc_new_file (const char *filename, gfc_source_form form) ...@@ -1123,8 +1101,8 @@ gfc_new_file (const char *filename, gfc_source_form form)
result = load_file (gfc_source_file, true); result = load_file (gfc_source_file, true);
gfc_current_locus1.lb = line_head; gfc_current_locus.lb = line_head;
gfc_current_locus1.nextc = (line_head == NULL) ? NULL : line_head->line; gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line;
#if 0 /* Debugging aid. */ #if 0 /* Debugging aid. */
for (; line_head; line_head = line_head->next) for (; line_head; line_head = line_head->next)
......
...@@ -50,7 +50,7 @@ gfc_get_code (void) ...@@ -50,7 +50,7 @@ gfc_get_code (void)
gfc_code *c; gfc_code *c;
c = gfc_getmem (sizeof (gfc_code)); c = gfc_getmem (sizeof (gfc_code));
c->loc = *gfc_current_locus (); c->loc = gfc_current_locus;
return c; return c;
} }
......
...@@ -272,7 +272,7 @@ check_conflict (symbol_attribute * attr, locus * where) ...@@ -272,7 +272,7 @@ check_conflict (symbol_attribute * attr, locus * where)
const char *a1, *a2; const char *a1, *a2;
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
if (attr->pointer && attr->intent != INTENT_UNKNOWN) if (attr->pointer && attr->intent != INTENT_UNKNOWN)
{ {
...@@ -484,7 +484,7 @@ check_used (symbol_attribute * attr, locus * where) ...@@ -484,7 +484,7 @@ check_used (symbol_attribute * attr, locus * where)
return 0; return 0;
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("Cannot change attributes of USE-associated symbol at %L", gfc_error ("Cannot change attributes of USE-associated symbol at %L",
where); where);
...@@ -506,7 +506,7 @@ check_done (symbol_attribute * attr, locus * where) ...@@ -506,7 +506,7 @@ check_done (symbol_attribute * attr, locus * where)
return 0; return 0;
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("Cannot change attributes of symbol at %L" gfc_error ("Cannot change attributes of symbol at %L"
" after it has been used", where); " after it has been used", where);
...@@ -522,7 +522,7 @@ duplicate_attr (const char *attr, locus * where) ...@@ -522,7 +522,7 @@ duplicate_attr (const char *attr, locus * where)
{ {
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("Duplicate %s attribute specified at %L", attr, where); gfc_error ("Duplicate %s attribute specified at %L", attr, where);
} }
...@@ -886,7 +886,7 @@ gfc_add_flavor (symbol_attribute * attr, sym_flavor f, locus * where) ...@@ -886,7 +886,7 @@ gfc_add_flavor (symbol_attribute * attr, sym_flavor f, locus * where)
if (attr->flavor != FL_UNKNOWN) if (attr->flavor != FL_UNKNOWN)
{ {
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("%s attribute conflicts with %s attribute at %L", gfc_error ("%s attribute conflicts with %s attribute at %L",
gfc_code2string (flavors, attr->flavor), gfc_code2string (flavors, attr->flavor),
...@@ -913,7 +913,7 @@ gfc_add_procedure (symbol_attribute * attr, procedure_type t, locus * where) ...@@ -913,7 +913,7 @@ gfc_add_procedure (symbol_attribute * attr, procedure_type t, locus * where)
return FAILURE; return FAILURE;
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
if (attr->proc != PROC_UNKNOWN) if (attr->proc != PROC_UNKNOWN)
{ {
...@@ -951,7 +951,7 @@ gfc_add_intent (symbol_attribute * attr, sym_intent intent, locus * where) ...@@ -951,7 +951,7 @@ gfc_add_intent (symbol_attribute * attr, sym_intent intent, locus * where)
} }
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("INTENT (%s) conflicts with INTENT(%s) at %L", gfc_error ("INTENT (%s) conflicts with INTENT(%s) at %L",
gfc_intent_string (attr->intent), gfc_intent_string (attr->intent),
...@@ -974,7 +974,7 @@ gfc_add_access (symbol_attribute * attr, gfc_access access, locus * where) ...@@ -974,7 +974,7 @@ gfc_add_access (symbol_attribute * attr, gfc_access access, locus * where)
} }
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
gfc_error ("ACCESS specification at %L was already specified", where); gfc_error ("ACCESS specification at %L was already specified", where);
return FAILURE; return FAILURE;
...@@ -990,7 +990,7 @@ gfc_add_explicit_interface (gfc_symbol * sym, ifsrc source, ...@@ -990,7 +990,7 @@ gfc_add_explicit_interface (gfc_symbol * sym, ifsrc source,
return FAILURE; return FAILURE;
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
if (sym->attr.if_source != IFSRC_UNKNOWN if (sym->attr.if_source != IFSRC_UNKNOWN
&& sym->attr.if_source != IFSRC_DECL) && sym->attr.if_source != IFSRC_DECL)
...@@ -1019,7 +1019,7 @@ gfc_add_type (gfc_symbol * sym, gfc_typespec * ts, locus * where) ...@@ -1019,7 +1019,7 @@ gfc_add_type (gfc_symbol * sym, gfc_typespec * ts, locus * where)
return FAILURE;*/ return FAILURE;*/
if (where == NULL) if (where == NULL)
where = gfc_current_locus (); where = &gfc_current_locus;
if (sym->ts.type != BT_UNKNOWN) if (sym->ts.type != BT_UNKNOWN)
{ {
...@@ -1221,7 +1221,7 @@ gfc_add_component (gfc_symbol * sym, const char *name, gfc_component ** componen ...@@ -1221,7 +1221,7 @@ gfc_add_component (gfc_symbol * sym, const char *name, gfc_component ** componen
tail->next = p; tail->next = p;
strcpy (p->name, name); strcpy (p->name, name);
p->loc = *gfc_current_locus (); p->loc = gfc_current_locus;
*component = p; *component = p;
return SUCCESS; return SUCCESS;
...@@ -1565,7 +1565,7 @@ gfc_reference_st_label (gfc_st_label * lp, gfc_sl_type type) ...@@ -1565,7 +1565,7 @@ gfc_reference_st_label (gfc_st_label * lp, gfc_sl_type type)
else else
{ {
label_type = lp->referenced; label_type = lp->referenced;
lp->where = *gfc_current_locus (); lp->where = gfc_current_locus;
} }
if (label_type == ST_LABEL_FORMAT && type == ST_LABEL_TARGET) if (label_type == ST_LABEL_FORMAT && type == ST_LABEL_TARGET)
...@@ -1811,7 +1811,7 @@ gfc_new_symbol (const char *name, gfc_namespace * ns) ...@@ -1811,7 +1811,7 @@ gfc_new_symbol (const char *name, gfc_namespace * ns)
gfc_clear_attr (&p->attr); gfc_clear_attr (&p->attr);
p->ns = ns; p->ns = ns;
p->declared_at = *gfc_current_locus (); p->declared_at = gfc_current_locus;
if (strlen (name) > GFC_MAX_SYMBOL_LEN) if (strlen (name) > GFC_MAX_SYMBOL_LEN)
gfc_internal_error ("new_symbol(): Symbol name too long"); gfc_internal_error ("new_symbol(): Symbol name too long");
......
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