OSDN Git Service

PR 51808 Constify binding_label.
authorjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Jan 2012 19:01:09 +0000 (19:01 +0000)
committerjb <jb@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 29 Jan 2012 19:01:09 +0000 (19:01 +0000)
2012-01-29  Janne Blomqvist  <jb@gcc.gnu.org>

PR fortran/51808
* decl.c (set_binding_label): Make binding_label argument const.
(curr_binding_label): Constify.
* gfortran.h (gfc_symbol): Constify binding_label.
(gfc_common_head): Likewise.
(get_iso_c_sym): Likewise.
* match.c (gfc_match_name_C): Constify buffer argument.
* match.h (gfc_match_name_C): Likewise.
* resolve.c (set_name_and_label): Constify binding_label argument.
(gfc_iso_c_sub_interface): Constify binding_label variable.
* symbol.c (get_iso_c_sym): Constify binding_label argument.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@183679 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/decl.c
gcc/fortran/gfortran.h
gcc/fortran/match.c
gcc/fortran/match.h
gcc/fortran/resolve.c
gcc/fortran/symbol.c

index 25ba3d3..447479d 100644 (file)
@@ -1,6 +1,20 @@
 2012-01-29  Janne Blomqvist  <jb@gcc.gnu.org>
 
        PR fortran/51808
+       * decl.c (set_binding_label): Make binding_label argument const.
+       (curr_binding_label): Constify.
+       * gfortran.h (gfc_symbol): Constify binding_label.
+       (gfc_common_head): Likewise.
+       (get_iso_c_sym): Likewise.
+       * match.c (gfc_match_name_C): Constify buffer argument.
+       * match.h (gfc_match_name_C): Likewise.
+       * resolve.c (set_name_and_label): Constify binding_label argument.
+       (gfc_iso_c_sub_interface): Constify binding_label variable.
+       * symbol.c (get_iso_c_sym): Constify binding_label argument.
+
+2012-01-29  Janne Blomqvist  <jb@gcc.gnu.org>
+
+       PR fortran/51808
        * decl.c (set_binding_label): Move prototype from match.h to here.
        (curr_binding_label): Make a pointer rather than static array.
        (build_sym): Check sym->binding_label pointer rather than array,
index 0cfb0ef..c87fc1b 100644 (file)
@@ -35,7 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 #define gfc_get_data() XCNEW (gfc_data)
 
 
-static gfc_try set_binding_label (char **, const char *, int);
+static gfc_try set_binding_label (const char **, const char *, int);
 
 
 /* This flag is set if an old-style length selector is matched
@@ -55,7 +55,7 @@ static gfc_array_spec *current_as;
 static int colon_seen;
 
 /* The current binding label (if any).  */
-static char* curr_binding_label;
+static const char* curr_binding_label;
 /* Need to know how many identifiers are on the current data declaration
    line in case we're given the BIND(C) attribute with a NAME= specifier.  */
 static int num_idents_on_line;
@@ -3808,7 +3808,8 @@ cleanup:
    there is more than one argument (num_idents), it is an error.  */
 
 static gfc_try
-set_binding_label (char **dest_label, const char *sym_name, int num_idents)
+set_binding_label (const char **dest_label, const char *sym_name, 
+                  int num_idents)
 {
   if (num_idents > 1 && has_name_equals)
     {
@@ -5713,7 +5714,7 @@ match
 gfc_match_bind_c (gfc_symbol *sym, bool allow_binding_name)
 {
   /* binding label, if exists */   
-  char* binding_label = NULL;
+  const char* binding_label = NULL;
   match double_quote;
   match single_quote;
 
index bf9a1f9..6f49d61 100644 (file)
@@ -1237,7 +1237,7 @@ typedef struct gfc_symbol
 
   /* This may be repetitive, since the typespec now has a binding
      label field.  */
-  char* binding_label;
+  const char* binding_label;
   /* Store a reference to the common_block, if this symbol is in one.  */
   struct gfc_common_head *common_block;
 
@@ -1254,7 +1254,7 @@ typedef struct gfc_common_head
   char use_assoc, saved, threadprivate;
   char name[GFC_MAX_SYMBOL_LEN + 1];
   struct gfc_symbol *head;
-  char* binding_label;
+  const char* binding_label;
   int is_bind_c;
 }
 gfc_common_head;
@@ -2595,7 +2595,7 @@ gfc_try verify_bind_c_sym (gfc_symbol *, gfc_typespec *, int, gfc_common_head *)
 gfc_try verify_bind_c_derived_type (gfc_symbol *);
 gfc_try verify_com_block_vars_c_interop (gfc_common_head *);
 void generate_isocbinding_symbol (const char *, iso_c_binding_symbol, const char *);
-gfc_symbol *get_iso_c_sym (gfc_symbol *, char *, char *, int);
+gfc_symbol *get_iso_c_sym (gfc_symbol *, char *, const char *, int);
 int gfc_get_sym_tree (const char *, gfc_namespace *, gfc_symtree **, bool);
 int gfc_get_ha_symbol (const char *, gfc_symbol **);
 int gfc_get_ha_sym_tree (const char *, gfc_symtree **);
index 3024cc7..89b59bc 100644 (file)
@@ -581,7 +581,7 @@ gfc_match_name (char *buffer)
    we successfully match a C name.  */
 
 match
-gfc_match_name_C (char **buffer)
+gfc_match_name_C (const char **buffer)
 {
   locus old_loc;
   size_t i = 0;
index 642c437..029faf7 100644 (file)
@@ -52,7 +52,7 @@ match gfc_match_label (void);
 match gfc_match_small_int (int *);
 match gfc_match_small_int_expr (int *, gfc_expr **);
 match gfc_match_name (char *);
-match gfc_match_name_C (char **buffer);
+match gfc_match_name_C (const char **buffer);
 match gfc_match_symbol (gfc_symbol **, int);
 match gfc_match_sym_tree (gfc_symtree **, int);
 match gfc_match_intrinsic_op (gfc_intrinsic_op *);
index 30980d2..0560261 100644 (file)
@@ -3356,7 +3356,7 @@ generic:
 
 static void
 set_name_and_label (gfc_code *c, gfc_symbol *sym,
-                    char *name, char **binding_label)
+                    char *name, const char **binding_label)
 {
   gfc_expr *arg = NULL;
   char type;
@@ -3420,7 +3420,7 @@ gfc_iso_c_sub_interface (gfc_code *c, gfc_symbol *sym)
   gfc_symbol *new_sym;
   /* this is fine, since we know the names won't use the max */
   char name[GFC_MAX_SYMBOL_LEN + 1];
-  char* binding_label;
+  const char* binding_label;
   /* default to success; will override if find error */
   match m = MATCH_YES;
 
index e13e1df..0cd7cc8 100644 (file)
@@ -4683,7 +4683,7 @@ generate_isocbinding_symbol (const char *mod_name, iso_c_binding_symbol s,
 
 gfc_symbol *
 get_iso_c_sym (gfc_symbol *old_sym, char *new_name,
-               char *new_binding_label, int add_optional_arg)
+               const char *new_binding_label, int add_optional_arg)
 {
   gfc_symtree *new_symtree = NULL;