PR 51808 Constify binding_label.

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.

From-SVN: r183679
This commit is contained in:
Janne Blomqvist 2012-01-29 21:01:09 +02:00
parent 9e85a9fd0d
commit 9975a30b5c
7 changed files with 27 additions and 12 deletions

View File

@ -1,3 +1,17 @@
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

View 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;

View 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 **);

View 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;

View 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 *);

View 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;

View 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;