gfortran.h (gfc_current_locus, [...]): Remove.
authorTobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>
Thu, 27 May 2004 12:35:12 +0000 (14:35 +0200)
committerTobias Schlüter <tobi@gcc.gnu.org>
Thu, 27 May 2004 12:35:12 +0000 (14:35 +0200)
* 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

16 files changed:
gcc/fortran/ChangeLog
gcc/fortran/array.c
gcc/fortran/decl.c
gcc/fortran/error.c
gcc/fortran/expr.c
gcc/fortran/gfortran.h
gcc/fortran/interface.c
gcc/fortran/io.c
gcc/fortran/match.c
gcc/fortran/matchexp.c
gcc/fortran/module.c
gcc/fortran/parse.c
gcc/fortran/primary.c
gcc/fortran/scanner.c
gcc/fortran/st.c
gcc/fortran/symbol.c

index c98b1d5..69fa1f5 100644 (file)
@@ -1,3 +1,57 @@
+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>
 
        * io.c (format_asterisk): Silence compiler warnings by correcting
index e2eac02..bfe8aaf 100644 (file)
@@ -77,7 +77,7 @@ match_subscript (gfc_array_ref * ar, int init)
 
   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;
 
   /* 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)
 
   memset (ar, '\0', sizeof (ar));
 
-  ar->where = *gfc_current_locus ();
+  ar->where = gfc_current_locus;
   ar->as = as;
 
   if (gfc_match_char ('(') != MATCH_YES)
@@ -743,7 +743,7 @@ match_array_list (gfc_constructor ** result)
   match m;
   int n;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   if (gfc_match_char ('(') == MATCH_NO)
     return MATCH_NO;
@@ -809,7 +809,7 @@ match_array_list (gfc_constructor ** result)
   e->value.constructor = head;
 
   p = gfc_get_constructor ();
-  p->where = *gfc_current_locus ();
+  p->where = gfc_current_locus;
   p->iterator = gfc_get_iterator ();
   *p->iterator = iter;
 
@@ -825,7 +825,7 @@ syntax:
 cleanup:
   gfc_free_constructor (head);
   gfc_free_iterator (&iter, 0);
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return m;
 }
 
@@ -849,7 +849,7 @@ match_array_cons_element (gfc_constructor ** result)
     return m;
 
   p = gfc_get_constructor ();
-  p->where = *gfc_current_locus ();
+  p->where = gfc_current_locus;
   p->expr = expr;
 
   *result = p;
@@ -870,7 +870,7 @@ gfc_match_array_constructor (gfc_expr ** result)
   if (gfc_match (" (/") == MATCH_NO)
     return MATCH_NO;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   head = tail = NULL;
 
   if (gfc_match (" /)") == MATCH_YES)
index 84547a4..69b1cfd 100644 (file)
@@ -423,7 +423,7 @@ gfc_match_null (gfc_expr ** result)
     return MATCH_ERROR;
 
   e = gfc_get_expr ();
-  e->where = *gfc_current_locus ();
+  e->where = gfc_current_locus;
   e->expr_type = EXPR_NULL;
   e->ts.type = BT_UNKNOWN;
 
@@ -459,7 +459,7 @@ variable_decl (void)
   if (m != MATCH_YES)
     goto cleanup;
 
-  var_locus = *gfc_current_locus ();
+  var_locus = gfc_current_locus;
 
   /* Now we could see the optional array spec. or character length.  */
   m = gfc_match_array_spec (&as);
@@ -659,7 +659,7 @@ gfc_match_kind_spec (gfc_typespec * ts)
   m = MATCH_NO;
   e = NULL;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   if (gfc_match_char ('(') == MATCH_NO)
     return MATCH_NO;
@@ -711,7 +711,7 @@ gfc_match_kind_spec (gfc_typespec * ts)
 
 no_match:
   gfc_free_expr (e);
-  gfc_set_locus (&where);
+  gfc_current_locus = where;
   return m;
 }
 
@@ -1028,7 +1028,7 @@ match_attr_spec (void)
   try t;
 
   gfc_clear_attr (&current_attr);
-  start = *gfc_current_locus ();
+  start = gfc_current_locus;
 
   current_as = NULL;
   colon_seen = 0;
@@ -1044,7 +1044,7 @@ match_attr_spec (void)
        break;
 
       seen[d]++;
-      seen_at[d] = *gfc_current_locus ();
+      seen_at[d] = gfc_current_locus;
 
       if (d == DECL_DIMENSION)
        {
@@ -1218,7 +1218,7 @@ match_attr_spec (void)
   return MATCH_YES;
 
 cleanup:
-  gfc_set_locus (&start);
+  gfc_current_locus = start;
   gfc_free_array_spec (current_as);
   current_as = NULL;
   return m;
@@ -1558,18 +1558,18 @@ gfc_match_function_decl (void)
 
   gfc_clear_ts (&current_ts);
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   m = match_prefix (&current_ts);
   if (m != MATCH_YES)
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return m;
     }
 
   if (gfc_match ("function% %n", name) != MATCH_YES)
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return MATCH_NO;
     }
 
@@ -1630,7 +1630,7 @@ gfc_match_function_decl (void)
   return MATCH_YES;
 
 cleanup:
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return m;
 }
 
@@ -1790,7 +1790,7 @@ gfc_match_end (gfc_statement * st)
   const char *target;
   match m;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
   if (gfc_match ("end") != MATCH_YES)
     return MATCH_NO;
 
@@ -1943,7 +1943,7 @@ syntax:
   gfc_syntax_error (*st);
 
 cleanup:
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return MATCH_ERROR;
 }
 
@@ -1971,7 +1971,7 @@ attr_decl1 (void)
   if (find_special (name, &sym))
     return MATCH_ERROR;
 
-  var_locus = *gfc_current_locus ();
+  var_locus = gfc_current_locus;
 
   /* Deal with possible array specification for certain attributes.  */
   if (current_attr.dimension
@@ -2423,7 +2423,7 @@ gfc_match_save (void)
       switch (m)
        {
        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;
          goto next_item;
 
index b7b0fdb..aab196f 100644 (file)
@@ -338,7 +338,7 @@ error_print (const char *type, const char *format0, va_list argp)
 
            case 'C':
              if (c == 'C')
-               loc = gfc_current_locus ();
+               loc = &gfc_current_locus;
 
              if (have_l1)
                {
@@ -652,7 +652,7 @@ gfc_internal_error (const char *format, ...)
 
   va_start (argp, format);
 
-  show_loci (gfc_current_locus (), NULL);
+  show_loci (&gfc_current_locus, NULL);
   error_printf ("Internal Error at (1):");
 
   error_print ("", format, argp);
index 122ba38..6abc924 100644 (file)
@@ -477,7 +477,7 @@ gfc_int_expr (int i)
   p->ts.type = BT_INTEGER;
   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);
 
   return p;
@@ -498,7 +498,7 @@ gfc_logical_expr (int i, locus * where)
   p->ts.kind = gfc_default_logical_kind ();
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
   p->where = *where;
   p->value.logical = i;
 
index 782e1f7..0384fe4 100644 (file)
@@ -1289,9 +1289,6 @@ void gfc_add_include_path (const char *);
 void gfc_release_include_path (void);
 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_eof (void);
 int gfc_at_bol (void);
@@ -1309,7 +1306,7 @@ try gfc_new_file (const char *, gfc_source_form);
 
 extern gfc_source_form gfc_current_form;
 extern char *gfc_source_file;
-/* extern locus gfc_current_locus; */
+extern locus gfc_current_locus;
 
 /* misc.c */
 void *gfc_getmem (size_t) ATTRIBUTE_MALLOC;
index 2610be5..a3c3acc 100644 (file)
@@ -1833,7 +1833,7 @@ gfc_add_interface (gfc_symbol * new)
 
   intr = gfc_get_interface ();
   intr->sym = new;
-  intr->where = *gfc_current_locus ();
+  intr->where = gfc_current_locus;
 
   intr->next = *head;
   *head = intr;
index 9e860d8..56cbe87 100644 (file)
@@ -819,7 +819,7 @@ gfc_match_format (void)
   mode = MODE_FORMAT;
   format_length = 0;
 
-  start = *gfc_current_locus ();
+  start = gfc_current_locus;
 
   if (check_format () == FAILURE)
     return MATCH_ERROR;
@@ -833,7 +833,7 @@ gfc_match_format (void)
   /* The label doesn't get created until after the statement is done
      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.op = EXEC_NOP;
@@ -1480,7 +1480,7 @@ match_dt_format (gfc_dt * dt)
   gfc_expr *e;
   gfc_st_label *label;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   if (gfc_match_char ('*') == MATCH_YES)
     {
@@ -1520,7 +1520,7 @@ match_dt_format (gfc_dt * dt)
       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;
 
@@ -1617,13 +1617,13 @@ match_dt_element (io_kind k, gfc_dt * dt)
 
   m = match_ltag (&tag_end, &dt->end);
   if (m == MATCH_YES)
-    dt->end_where = *gfc_current_locus ();
+    dt->end_where = gfc_current_locus;
   if (m != MATCH_NO)
     return m;
 
   m = match_ltag (&tag_eor, &dt->eor);
   if (m == MATCH_YES)
-    dt->eor_where = *gfc_current_locus ();
+    dt->eor_where = gfc_current_locus;
   if (m != MATCH_NO)
     return m;
 
@@ -1818,7 +1818,7 @@ match_io_iterator (io_kind k, gfc_code ** result)
 
   iter = NULL;
   head = NULL;
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   if (gfc_match_char ('(') != MATCH_YES)
     return MATCH_NO;
@@ -1885,7 +1885,7 @@ syntax:
 cleanup:
   gfc_free_iterator (iter, 1);
   gfc_free_statements (head);
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return m;
 }
 
@@ -2093,7 +2093,7 @@ match_io (io_kind k)
   if (m == MATCH_ERROR)
     goto cleanup;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   if (gfc_match_name (name) == MATCH_YES
       && !gfc_find_symbol (name, NULL, 1, &sym)
@@ -2108,7 +2108,7 @@ match_io (io_kind k)
       goto next;
     }
 
-  gfc_set_locus (&where);
+  gfc_current_locus = where;
 
   goto loop;                   /* No matches, try regular elements */
 
index 6c7251f..79a7e4c 100644 (file)
@@ -80,12 +80,12 @@ gfc_match_space (void)
   if (gfc_current_form == FORM_FIXED)
     return MATCH_YES;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   c = gfc_next_char ();
   if (!gfc_is_whitespace (c))
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return MATCH_NO;
     }
 
@@ -109,7 +109,7 @@ gfc_match_eos (void)
 
   for (;;)
     {
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
       gfc_gobble_whitespace ();
 
       c = gfc_next_char ();
@@ -135,7 +135,7 @@ gfc_match_eos (void)
       break;
     }
 
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return (flag) ? MATCH_YES : MATCH_NO;
 }
 
@@ -151,14 +151,14 @@ gfc_match_small_literal_int (int *value)
   char c;
   int i;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   gfc_gobble_whitespace ();
   c = gfc_next_char ();
 
   if (!ISDIGIT (c))
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return MATCH_NO;
     }
 
@@ -166,7 +166,7 @@ gfc_match_small_literal_int (int *value)
 
   for (;;)
     {
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
       c = gfc_next_char ();
 
       if (!ISDIGIT (c))
@@ -181,7 +181,7 @@ gfc_match_small_literal_int (int *value)
        }
     }
 
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   *value = i;
   return MATCH_YES;
@@ -227,7 +227,7 @@ gfc_match_st_label (gfc_st_label ** label, int allow_zero)
   match m;
   int i;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   m = gfc_match_small_literal_int (&i);
   if (m != MATCH_YES)
@@ -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_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return MATCH_ERROR;
 }
 
@@ -320,7 +320,7 @@ gfc_match_strings (mstring * a)
   no_match = p->tag;
 
   best_match = NULL;
-  match_loc = *gfc_current_locus ();
+  match_loc = gfc_current_locus;
 
   gfc_gobble_whitespace ();
 
@@ -356,7 +356,7 @@ gfc_match_strings (mstring * a)
          if (*p->mp == '\0')
            {
              /* Found a match.  */
-             match_loc = *gfc_current_locus ();
+             match_loc = gfc_current_locus;
              best_match = p;
              possibles--;
              p->mp = NULL;
@@ -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;
 }
@@ -379,13 +379,13 @@ gfc_match_name (char *buffer)
   locus old_loc;
   int i, c;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
   gfc_gobble_whitespace ();
 
   c = gfc_next_char ();
   if (!ISALPHA (c))
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return MATCH_NO;
     }
 
@@ -401,7 +401,7 @@ gfc_match_name (char *buffer)
          return MATCH_ERROR;
        }
 
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
       c = gfc_next_char ();
     }
   while (ISALNUM (c)
@@ -409,7 +409,7 @@ gfc_match_name (char *buffer)
         || (gfc_option.flag_dollar_ok && c == '$'));
 
   buffer[i] = '\0';
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   return MATCH_YES;
 }
@@ -495,9 +495,9 @@ gfc_match_iterator (gfc_iterator * iter, int init_flag)
   /* Match the start of an iterator without affecting the symbol
      table.  */
 
-  start = *gfc_current_locus ();
+  start = gfc_current_locus;
   m = gfc_match (" %n =", name);
-  gfc_set_locus (&start);
+  gfc_current_locus = start;
 
   if (m != MATCH_YES)
     return MATCH_NO;
@@ -586,13 +586,13 @@ gfc_match_char (char c)
 {
   locus where;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   gfc_gobble_whitespace ();
 
   if (gfc_next_char () == c)
     return MATCH_YES;
 
-  gfc_set_locus (&where);
+  gfc_current_locus = where;
   return MATCH_NO;
 }
 
@@ -624,7 +624,7 @@ gfc_match (const char *target, ...)
   void **vp;
   const char *p;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
   va_start (argp, target);
   m = MATCH_NO;
   matches = 0;
@@ -750,7 +750,7 @@ not_yes:
   if (m != MATCH_YES)
     {
       /* Clean up after a failed match.  */
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       va_start (argp, target);
 
       p = target;
@@ -832,7 +832,7 @@ gfc_match_assignment (void)
   locus old_loc;
   match m;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   lvalue = rvalue = NULL;
   m = gfc_match (" %v =", &lvalue);
@@ -852,7 +852,7 @@ gfc_match_assignment (void)
   return MATCH_YES;
 
 cleanup:
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   gfc_free_expr (lvalue);
   gfc_free_expr (rvalue);
   return m;
@@ -868,7 +868,7 @@ gfc_match_pointer_assignment (void)
   locus old_loc;
   match m;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   lvalue = rvalue = NULL;
 
@@ -890,7 +890,7 @@ gfc_match_pointer_assignment (void)
   return MATCH_YES;
 
 cleanup:
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   gfc_free_expr (lvalue);
   gfc_free_expr (rvalue);
   return m;
@@ -920,7 +920,7 @@ gfc_match_if (gfc_statement * if_type)
   if (n == MATCH_ERROR)
     return n;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   m = gfc_match (" if ( %e", &expr);
   if (m != MATCH_YES)
@@ -996,7 +996,7 @@ gfc_match_if (gfc_statement * if_type)
 
   gfc_free_expr (expr);
   gfc_undo_symbols ();
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   gfc_match (" if ( %e ) ", &expr);    /* Guaranteed to match */
 
@@ -1006,7 +1006,7 @@ gfc_match_if (gfc_statement * if_type)
 
   gfc_free_expr (expr);
   gfc_undo_symbols ();
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   gfc_match (" if ( %e ) ", &expr);    /* Guaranteed to match */
 
@@ -1066,7 +1066,7 @@ got_match:
   p = gfc_get_code ();
   p->next = gfc_get_code ();
   *p->next = new_st;
-  p->next->loc = *gfc_current_locus ();
+  p->next->loc = gfc_current_locus;
 
   p->expr = expr;
   p->op = EXEC_IF;
@@ -1182,7 +1182,7 @@ gfc_match_do (void)
   gfc_st_label *label;
   match m;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   label = NULL;
   iter.var = iter.start = iter.end = iter.step = NULL;
@@ -1222,7 +1222,7 @@ gfc_match_do (void)
   /* The abortive DO WHILE may have done something to the symbol
      table, so we start over: */
   gfc_undo_symbols ();
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   gfc_match_label ();          /* This won't error */
   gfc_match (" do ");          /* This will work */
@@ -1780,7 +1780,7 @@ gfc_match_nullify (void)
 
       /* build ' => NULL() ' */
       e = gfc_get_expr ();
-      e->where = *gfc_current_locus ();
+      e->where = gfc_current_locus;
       e->expr_type = EXPR_NULL;
       e->ts.type = BT_UNKNOWN;
 
@@ -1985,7 +1985,7 @@ gfc_match_call (void)
   i = 0;
   for (a = arglist; a; a = a->next)
     if (a->expr == NULL)
-      i = 1;
+       i = 1;
 
   if (i)
     {
@@ -2006,7 +2006,7 @@ gfc_match_call (void)
       c->expr->expr_type = EXPR_VARIABLE;
       c->expr->symtree = select_st;
       c->expr->ts = select_sym->ts;
-      c->expr->where = *gfc_current_locus ();
+      c->expr->where = gfc_current_locus;
 
       i = 0;
       for (a = arglist; a; a = a->next)
@@ -2069,7 +2069,7 @@ match_implicit_range (gfc_typespec * ts)
   int c, c1, c2, inner;
   locus cur_loc;
 
-  cur_loc = *gfc_current_locus ();
+  cur_loc = gfc_current_locus;
 
   gfc_gobble_whitespace ();
   c = gfc_next_char ();
@@ -2140,7 +2140,7 @@ match_implicit_range (gfc_typespec * ts)
 bad:
   gfc_syntax_error (ST_IMPLICIT);
 
-  gfc_set_locus (&cur_loc);
+  gfc_current_locus = cur_loc;
   return MATCH_ERROR;
 }
 
@@ -2191,7 +2191,7 @@ gfc_match_implicit (void)
       if (m == MATCH_NO)
        goto syntax;
 
-      cur_loc = *gfc_current_locus ();
+      cur_loc = gfc_current_locus;
       m = match_implicit_range (&ts);
 
       if (m == MATCH_YES)
@@ -2202,7 +2202,7 @@ gfc_match_implicit (void)
          if ((c == '\n') || (c == ','))
            continue;
 
-         gfc_set_locus (&cur_loc);
+         gfc_current_locus = cur_loc;
        }
 
       /* Last chance -- check <TYPE> (<KIND>) (<RANGE>).  */
@@ -3026,7 +3026,7 @@ gfc_match_data (void)
   for (;;)
     {
       new = gfc_get_data ();
-      new->where = *gfc_current_locus ();
+      new->where = gfc_current_locus;
 
       m = top_var_list (new);
       if (m != MATCH_YES)
@@ -3098,7 +3098,7 @@ match_case_selector (gfc_case ** cp)
   match m;
 
   c = gfc_get_case ();
-  c->where = *gfc_current_locus ();
+  c->where = gfc_current_locus;
 
   if (gfc_match_char (':') == MATCH_YES)
     {
@@ -3219,7 +3219,7 @@ gfc_match_case (void)
 
       new_st.op = EXEC_SELECT;
       c = gfc_get_case ();
-      c->where = *gfc_current_locus ();
+      c->where = gfc_current_locus;
       new_st.ext.case_list = c;
       return MATCH_YES;
     }
@@ -3417,7 +3417,7 @@ match_forall_iterator (gfc_forall_iterator ** result)
   locus where;
   match m;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   iter = gfc_getmem (sizeof (gfc_forall_iterator));
 
   m = gfc_match_variable (&iter->var, 0);
@@ -3464,7 +3464,7 @@ syntax:
   m = MATCH_ERROR;
 
 cleanup:
-  gfc_set_locus (&where);
+  gfc_current_locus = where;
   gfc_free_forall_iterator (iter);
   return m;
 }
index 539a91a..1035e88 100644 (file)
@@ -46,7 +46,7 @@ gfc_match_defined_op_name (char *result, int error_flag)
   match m;
   int i;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   m = gfc_match (" . %n .", name);
   if (m != MATCH_YES)
@@ -59,7 +59,7 @@ gfc_match_defined_op_name (char *result, int error_flag)
     {
       if (error_flag)
        goto error;
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       return MATCH_NO;
     }
 
@@ -81,7 +81,7 @@ error:
   gfc_error ("The name '%s' cannot be used as a defined operator at %C",
             name);
 
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return MATCH_ERROR;
 }
 
@@ -113,11 +113,11 @@ next_operator (gfc_intrinsic_op t)
   gfc_intrinsic_op u;
   locus old_loc;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
   if (gfc_match_intrinsic_op (&u) == MATCH_YES && t == u)
     return 1;
 
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
   return 0;
 }
 
@@ -199,7 +199,7 @@ match_level_1 (gfc_expr ** result)
   locus where;
   match m;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   uop = NULL;
   m = match_defined_operator (&uop);
   if (m == MATCH_ERROR)
@@ -271,7 +271,7 @@ match_mult_operand (gfc_expr ** result)
       return MATCH_YES;
     }
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   m = match_ext_mult_operand (&exp);
   if (m == MATCH_NO)
@@ -305,7 +305,7 @@ match_ext_mult_operand (gfc_expr ** result)
   match m;
   int i;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   i = match_add_op ();
 
   if (i == 0)
@@ -353,7 +353,7 @@ match_add_operand (gfc_expr ** result)
     {
       /* Build up a string of products or quotients.  */
 
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
 
       if (next_operator (INTRINSIC_TIMES))
        i = INTRINSIC_TIMES;
@@ -365,12 +365,12 @@ match_add_operand (gfc_expr ** result)
            break;
        }
 
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_ext_mult_operand (&e);
       if (m == MATCH_NO)
        {
-         gfc_set_locus (&old_loc);
+         gfc_current_locus = old_loc;
          break;
        }
 
@@ -409,7 +409,7 @@ match_ext_add_operand (gfc_expr ** result)
   match m;
   int i;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   i = match_add_op ();
 
   if (i == 0)
@@ -451,7 +451,7 @@ match_level_2 (gfc_expr ** result)
   match m;
   int i;
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
   i = match_add_op ();
 
   if (i != 0)
@@ -491,7 +491,7 @@ match_level_2 (gfc_expr ** result)
 
   for (;;)
     {
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
       i = match_add_op ();
       if (i == 0)
        break;
@@ -544,7 +544,7 @@ match_level_3 (gfc_expr ** result)
       if (!next_operator (INTRINSIC_CONCAT))
        break;
 
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_level_2 (&e);
       if (m == MATCH_NO)
@@ -587,7 +587,7 @@ match_level_4 (gfc_expr ** result)
   if (m != MATCH_YES)
     return m;
 
-  old_loc = *gfc_current_locus ();
+  old_loc = gfc_current_locus;
 
   if (gfc_match_intrinsic_op (&i) != MATCH_YES)
     {
@@ -598,12 +598,12 @@ match_level_4 (gfc_expr ** result)
   if (i != INTRINSIC_EQ && i != INTRINSIC_NE && i != INTRINSIC_GE
       && i != INTRINSIC_LE && i != INTRINSIC_LT && i != INTRINSIC_GT)
     {
-      gfc_set_locus (&old_loc);
+      gfc_current_locus = old_loc;
       *result = left;
       return MATCH_YES;
     }
 
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   m = match_level_3 (&right);
   if (m == MATCH_NO)
@@ -667,7 +667,7 @@ match_and_operand (gfc_expr ** result)
   int i;
 
   i = next_operator (INTRINSIC_NOT);
-  where = *gfc_current_locus ();
+  where = gfc_current_locus;
 
   m = match_level_4 (&e);
   if (m != MATCH_YES)
@@ -706,7 +706,7 @@ match_or_operand (gfc_expr ** result)
     {
       if (!next_operator (INTRINSIC_AND))
        break;
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_and_operand (&e);
       if (m == MATCH_NO)
@@ -749,7 +749,7 @@ match_equiv_operand (gfc_expr ** result)
     {
       if (!next_operator (INTRINSIC_OR))
        break;
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_or_operand (&e);
       if (m == MATCH_NO)
@@ -803,7 +803,7 @@ match_level_5 (gfc_expr ** result)
            break;
        }
 
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_equiv_operand (&e);
       if (m == MATCH_NO)
@@ -861,7 +861,7 @@ gfc_match_expr (gfc_expr ** result)
          return MATCH_ERROR;
        }
 
-      where = *gfc_current_locus ();
+      where = gfc_current_locus;
 
       m = match_level_5 (&e);
       if (m == MATCH_NO)
index 1143705..09f9452 100644 (file)
@@ -506,7 +506,7 @@ gfc_match_use (void)
     {
       /* Get a new rename struct and add it to the rename list.  */
       new = gfc_get_use_rename ();
-      new->where = *gfc_current_locus ();
+      new->where = gfc_current_locus;
       new->found = 0;
 
       if (gfc_rename_list == NULL)
@@ -1766,10 +1766,10 @@ mio_array_ref (gfc_array_ref * ar)
 
   if (iomode == IO_INPUT)
     {
-      ar->where = *gfc_current_locus ();
+      ar->where = gfc_current_locus;
 
       for (i = 0; i < ar->dimen; i++)
-       ar->c_where[i] = *gfc_current_locus ();
+       ar->c_where[i] = gfc_current_locus;
     }
 
   mio_rparen ();
@@ -2401,7 +2401,7 @@ mio_expr (gfc_expr ** ep)
        bad_module ("Expected expression type");
 
       e = *ep = gfc_get_expr ();
-      e->where = *gfc_current_locus ();
+      e->where = gfc_current_locus;
       e->expr_type = (expr_t) find_enum (expr_types);
     }
 
index dea613b..8b8aa5a 100644 (file)
@@ -66,7 +66,7 @@ match_word (const char *str, match (*subr) (void), locus * old_locus)
 
   if (m != MATCH_YES)
     {
-      gfc_set_locus (old_locus);
+      gfc_current_locus = *old_locus;
       reject_statement ();
     }
 
@@ -101,7 +101,7 @@ decode_statement (void)
   if (gfc_match_eos () == MATCH_YES)
     return ST_NONE;
 
-  old_locus = *gfc_current_locus ();
+  old_locus = gfc_current_locus;
 
   /* Try matching a data declaration or function declaration. The
       input "REALFUNCTIONA(N)" can mean several things in different
@@ -118,7 +118,7 @@ decode_statement (void)
        reject_statement ();
 
       gfc_undo_symbols ();
-      gfc_set_locus (&old_locus);
+      gfc_current_locus = old_locus;
     }
 
   /* Match statements whose error messages are meant to be overwritten
@@ -136,7 +136,7 @@ decode_statement (void)
   if (gfc_match_subroutine () == MATCH_YES)
     return ST_SUBROUTINE;
   gfc_undo_symbols ();
-  gfc_set_locus (&old_locus);
+  gfc_current_locus = old_locus;
 
   /* Check for the IF, DO, SELECT, WHERE and FORALL statements, which
      might begin with a block label.  The match functions for these
@@ -146,17 +146,17 @@ decode_statement (void)
   if (gfc_match_if (&st) == MATCH_YES)
     return st;
   gfc_undo_symbols ();
-  gfc_set_locus (&old_locus);
+  gfc_current_locus = old_locus;
 
   if (gfc_match_where (&st) == MATCH_YES)
     return st;
   gfc_undo_symbols ();
-  gfc_set_locus (&old_locus);
+  gfc_current_locus = old_locus;
 
   if (gfc_match_forall (&st) == MATCH_YES)
     return st;
   gfc_undo_symbols ();
-  gfc_set_locus (&old_locus);
+  gfc_current_locus = old_locus;
 
   match (NULL, gfc_match_do, ST_DO);
   match (NULL, gfc_match_select, ST_SELECT_CASE);
@@ -327,7 +327,7 @@ next_free (void)
        }
       else
        {
-         label_locus = *gfc_current_locus ();
+         label_locus = gfc_current_locus;
 
          if (gfc_statement_label->value == 0)
            {
@@ -394,7 +394,7 @@ next_fixed (void)
        case '8':
        case '9':
          label = label * 10 + c - '0';
-         label_locus = *gfc_current_locus ();
+         label_locus = gfc_current_locus;
          digit_flag = 1;
          break;
 
@@ -440,14 +440,14 @@ next_fixed (void)
 
   do
     {
-      loc = *gfc_current_locus ();
+      loc = gfc_current_locus;
       c = gfc_next_char_literal (0);
     }
   while (gfc_is_whitespace (c));
 
   if (c == '!')
     goto blank_line;
-  gfc_set_locus (&loc);
+  gfc_current_locus = loc;
 
   if (gfc_match_eos () == MATCH_YES)
     goto blank_line;
@@ -606,7 +606,7 @@ add_statement (void)
   p = gfc_get_code ();
   *p = new_st;
 
-  p->loc = *gfc_current_locus ();
+  p->loc = gfc_current_locus;
 
   if (gfc_state_stack->head == NULL)
     gfc_state_stack->head = p;
@@ -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.  */
-  p->where = *gfc_current_locus ();
+  p->where = gfc_current_locus;
   p->last_statement = st;
   return SUCCESS;
 
@@ -1811,7 +1811,7 @@ parse_if_block (void)
            }
 
          seen_else = 1;
-         else_locus = *gfc_current_locus ();
+         else_locus = gfc_current_locus;
 
          d = new_level (gfc_state_stack->head);
          d->op = EXEC_IF;
@@ -2411,7 +2411,7 @@ loop:
       if (seen_program)
        goto duplicate_main;
       seen_program = 1;
-      prog_locus = *gfc_current_locus ();
+      prog_locus = gfc_current_locus;
 
       push_state (&s, COMP_PROGRAM, gfc_new_block);
       accept_statement (st);
@@ -2449,7 +2449,7 @@ loop:
       if (seen_program)
        goto duplicate_main;
       seen_program = 1;
-      prog_locus = *gfc_current_locus ();
+      prog_locus = gfc_current_locus;
 
       push_state (&s, COMP_PROGRAM, gfc_new_block);
       parse_progunit (st);
index a55c5aa..e1f4049 100644 (file)
@@ -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);
index a16c274..b280e14 100644 (file)
@@ -67,7 +67,7 @@ static int continue_flag, end_flag;
 gfc_source_form gfc_current_form;
 static gfc_linebuf *line_head, *line_tail;
        
-locus gfc_current_locus1;
+locus gfc_current_locus;
 char *gfc_source_file;
       
 
@@ -191,28 +191,6 @@ gfc_open_included_file (const char *name)
   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.  */
 
 int
@@ -235,7 +213,7 @@ gfc_at_eof (void)
   if (line_head == NULL)
     return 1;                  /* Null file */
 
-  if (gfc_current_locus1.lb == NULL)
+  if (gfc_current_locus.lb == NULL)
     return 1;
 
   return 0;
@@ -250,7 +228,7 @@ gfc_at_bol (void)
   if (gfc_at_eof ())
     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)
   if (gfc_at_eof ())
     return 1;
 
-  return (*gfc_current_locus1.nextc == '\0');
+  return (*gfc_current_locus.nextc == '\0');
 }
 
 
@@ -275,19 +253,19 @@ gfc_advance_line (void)
   if (gfc_at_end ())
     return;
 
-  if (gfc_current_locus1.lb == NULL) 
+  if (gfc_current_locus.lb == NULL) 
     {
       end_flag = 1;
       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)         
-    gfc_current_locus1.nextc = gfc_current_locus1.lb->line;
+  if (gfc_current_locus.lb != NULL)         
+    gfc_current_locus.nextc = gfc_current_locus.lb->line;
   else 
     {
-      gfc_current_locus1.nextc = NULL;
+      gfc_current_locus.nextc = NULL;
       end_flag = 1;
     }       
 }
@@ -307,13 +285,13 @@ next_char (void)
 {
   int c;
   
-  if (gfc_current_locus1.nextc == NULL)
+  if (gfc_current_locus.nextc == NULL)
     return '\n';
 
-  c = *gfc_current_locus1.nextc++;
+  c = *gfc_current_locus.nextc++;
   if (c == '\0')
     {
-      gfc_current_locus1.nextc--; /* Remain on this line.  */
+      gfc_current_locus.nextc--; /* Remain on this line.  */
       c = '\n';
     }
 
@@ -351,7 +329,7 @@ skip_free_comments (void)
 
   for (;;)
     {
-      start = gfc_current_locus1;
+      start = gfc_current_locus;
       if (gfc_at_eof ())
        break;
 
@@ -376,7 +354,7 @@ skip_free_comments (void)
       break;
     }
 
-  gfc_set_locus (&start);
+  gfc_current_locus = start;
 }
 
 
@@ -393,7 +371,7 @@ skip_fixed_comments (void)
 
   for (;;)
     {
-      start = gfc_current_locus1;
+      start = gfc_current_locus;
       if (gfc_at_eof ())
        break;
 
@@ -433,7 +411,7 @@ skip_fixed_comments (void)
       break;
     }
 
-  gfc_set_locus (&start);
+  gfc_current_locus = start;
 }
 
 
@@ -491,7 +469,7 @@ restart:
 
       /* If the next nonblank character is a ! or \n, we've got a
          continuation line. */
-      old_loc = gfc_current_locus1;
+      old_loc = gfc_current_locus;
 
       c = next_char ();
       while (gfc_is_whitespace (c))
@@ -502,14 +480,14 @@ restart:
 
       if (in_string && c != '\n')
        {
-         gfc_set_locus (&old_loc);
+         gfc_current_locus = old_loc;
          c = '&';
          goto done;
        }
 
       if (c != '!' && c != '\n')
        {
-         gfc_set_locus (&old_loc);
+         gfc_current_locus = old_loc;
          c = '&';
          goto done;
        }
@@ -529,14 +507,14 @@ restart:
          reading starts at the next character, otherwise we must back
          up to where the whitespace started and resume from there.  */
 
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
 
       c = next_char ();
       while (gfc_is_whitespace (c))
        c = next_char ();
 
       if (c != '&')
-       gfc_set_locus (&old_loc);
+       gfc_current_locus = old_loc;
 
     }
   else
@@ -556,7 +534,7 @@ restart:
        goto done;
 
       continue_flag = 1;
-      old_loc = *gfc_current_locus ();
+      old_loc = gfc_current_locus;
 
       gfc_advance_line ();
       gfc_skip_comments ();
@@ -580,7 +558,7 @@ restart:
 
 not_continuation:
   c = '\n';
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
 done:
   continue_flag = 0;
@@ -614,9 +592,9 @@ gfc_peek_char (void)
   locus old_loc;
   int c;
 
-  old_loc = gfc_current_locus1;
+  old_loc = gfc_current_locus;
   c = gfc_next_char ();
-  gfc_set_locus (&old_loc);
+  gfc_current_locus = old_loc;
 
   return c;
 }
@@ -684,12 +662,12 @@ gfc_gobble_whitespace (void)
 
   do
     {
-      old_loc = gfc_current_locus1;
+      old_loc = gfc_current_locus;
       c = gfc_next_char_literal (0);
     }
   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)
 
   result = load_file (gfc_source_file, true);
 
-  gfc_current_locus1.lb = line_head;
-  gfc_current_locus1.nextc = (line_head == NULL) ? NULL : line_head->line;
+  gfc_current_locus.lb = line_head;
+  gfc_current_locus.nextc = (line_head == NULL) ? NULL : line_head->line;
 
 #if 0 /* Debugging aid.  */
   for (; line_head; line_head = line_head->next)
index 2e0a989..743769c 100644 (file)
@@ -50,7 +50,7 @@ gfc_get_code (void)
   gfc_code *c;
 
   c = gfc_getmem (sizeof (gfc_code));
-  c->loc = *gfc_current_locus ();
+  c->loc = gfc_current_locus;
   return c;
 }
 
index 0d78c03..6cdd23b 100644 (file)
@@ -272,7 +272,7 @@ check_conflict (symbol_attribute * attr, locus * where)
   const char *a1, *a2;
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   if (attr->pointer && attr->intent != INTENT_UNKNOWN)
     {
@@ -484,7 +484,7 @@ check_used (symbol_attribute * attr, locus * where)
     return 0;
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   gfc_error ("Cannot change attributes of USE-associated symbol at %L",
              where);
@@ -506,7 +506,7 @@ check_done (symbol_attribute * attr, locus * where)
     return 0;
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   gfc_error ("Cannot change attributes of symbol at %L"
              " after it has been used", where);
@@ -522,7 +522,7 @@ duplicate_attr (const char *attr, locus * where)
 {
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   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)
   if (attr->flavor != FL_UNKNOWN)
     {
       if (where == NULL)
-       where = gfc_current_locus ();
+       where = &gfc_current_locus;
 
       gfc_error ("%s attribute conflicts with %s attribute at %L",
                 gfc_code2string (flavors, attr->flavor),
@@ -913,7 +913,7 @@ gfc_add_procedure (symbol_attribute * attr, procedure_type t, locus * where)
     return FAILURE;
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   if (attr->proc != PROC_UNKNOWN)
     {
@@ -951,7 +951,7 @@ gfc_add_intent (symbol_attribute * attr, sym_intent intent, locus * where)
     }
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   gfc_error ("INTENT (%s) conflicts with INTENT(%s) at %L",
             gfc_intent_string (attr->intent),
@@ -974,7 +974,7 @@ gfc_add_access (symbol_attribute * attr, gfc_access access, locus * where)
     }
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
   gfc_error ("ACCESS specification at %L was already specified", where);
 
   return FAILURE;
@@ -990,7 +990,7 @@ gfc_add_explicit_interface (gfc_symbol * sym, ifsrc source,
     return FAILURE;
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   if (sym->attr.if_source != IFSRC_UNKNOWN
       && sym->attr.if_source != IFSRC_DECL)
@@ -1019,7 +1019,7 @@ gfc_add_type (gfc_symbol * sym, gfc_typespec * ts, locus * where)
     return FAILURE;*/
 
   if (where == NULL)
-    where = gfc_current_locus ();
+    where = &gfc_current_locus;
 
   if (sym->ts.type != BT_UNKNOWN)
     {
@@ -1221,7 +1221,7 @@ gfc_add_component (gfc_symbol * sym, const char *name, gfc_component ** componen
     tail->next = p;
 
   strcpy (p->name, name);
-  p->loc = *gfc_current_locus ();
+  p->loc = gfc_current_locus;
 
   *component = p;
   return SUCCESS;
@@ -1565,7 +1565,7 @@ gfc_reference_st_label (gfc_st_label * lp, gfc_sl_type type)
   else
     {
       label_type = lp->referenced;
-      lp->where = *gfc_current_locus ();
+      lp->where = gfc_current_locus;
     }
 
   if (label_type == ST_LABEL_FORMAT && type == ST_LABEL_TARGET)
@@ -1811,7 +1811,7 @@ gfc_new_symbol (const char *name, gfc_namespace * ns)
   gfc_clear_attr (&p->attr);
   p->ns = ns;
 
-  p->declared_at = *gfc_current_locus ();
+  p->declared_at = gfc_current_locus;
 
   if (strlen (name) > GFC_MAX_SYMBOL_LEN)
     gfc_internal_error ("new_symbol(): Symbol name too long");