From d7177ab25e9cfef12aa2b0e2a2f68d7f3c81735a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tobias=20Schl=C3=BCter?= Date: Tue, 31 Aug 2004 16:06:48 +0200 Subject: [PATCH] trans-decl.c, [...]: Replace all occurences of 'gfc_strlen_type_node' by 'gfc_charlen_type_node'. fortran/ * trans-decl.c, trans-expr.c, trans-io.c, trans-types.c: Replace all occurences of 'gfc_strlen_type_node' by 'gfc_charlen_type_node'. * trans-types.h: Same. Also update comment accordingly. libgfortran/ * libgfortran.h: Replace 'gfc_strlen_type' by 'gfc_charlen_type'. Update comment accordingly. * intrinsics/args.c, intrinsics/env.c, io/io.h, io/transfer.c: Replace all occurences of 'gfc_strlen_type' by 'gfc_charlen_type'. From-SVN: r86828 --- gcc/fortran/ChangeLog | 7 +++++ gcc/fortran/trans-array.c | 2 +- gcc/fortran/trans-const.c | 2 +- gcc/fortran/trans-decl.c | 48 +++++++++++++++++------------------ gcc/fortran/trans-expr.c | 24 +++++++++--------- gcc/fortran/trans-io.c | 2 +- gcc/fortran/trans-types.c | 8 +++--- gcc/fortran/trans-types.h | 7 +++-- libgfortran/ChangeLog | 7 +++++ libgfortran/intrinsics/args.c | 12 ++++----- libgfortran/intrinsics/env.c | 12 ++++----- libgfortran/io/io.h | 2 +- libgfortran/io/transfer.c | 2 +- libgfortran/libgfortran.h | 4 +-- 14 files changed, 76 insertions(+), 63 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 191ed703371..74ada4c8a35 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2004-08-31 Tobias Schlueter + + * trans-decl.c, trans-expr.c, trans-io.c, trans-types.c: Replace + all occurences of 'gfc_strlen_type_node' by + 'gfc_charlen_type_node'. + * trans-types.h: Same. Also update comment accordingly. + 2004-08-31 Tobias Schlueter * primary.c: Update copyright boilerplate to say GCC. diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 1aa1a67e315..4ba5e8c4652 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1072,7 +1072,7 @@ get_array_ctor_strlen (gfc_constructor * c, tree * len) { case EXPR_CONSTANT: if (!(*len && INTEGER_CST_P (*len))) - *len = build_int_cstu (gfc_strlen_type_node, + *len = build_int_cstu (gfc_charlen_type_node, c->expr->value.character.length); break; diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index 10f701aeb6f..670e2f5df9c 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -85,7 +85,7 @@ gfc_build_string_const (int length, const char *s) len = build_int_cst (NULL_TREE, length); TREE_TYPE (str) = build_array_type (gfc_character1_type_node, - build_range_type (gfc_strlen_type_node, + build_range_type (gfc_charlen_type_node, integer_one_node, len)); return str; } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 7ceebcce93c..730448a6595 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -670,7 +670,7 @@ gfc_create_string_length (gfc_symbol * sym) strcpy (&name[1], sym->name); name[0] = '.'; length = build_decl (VAR_DECL, get_identifier (name), - gfc_strlen_type_node); + gfc_charlen_type_node); DECL_ARTIFICIAL (length) = 1; TREE_USED (length) = 1; gfc_defer_symbol_init (sym); @@ -781,7 +781,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) { gfc_allocate_lang_decl (decl); GFC_DECL_ASSIGN (decl) = 1; - length = gfc_create_var (gfc_strlen_type_node, sym->name); + length = gfc_create_var (gfc_charlen_type_node, sym->name); GFC_DECL_STRING_LEN (decl) = length; GFC_DECL_ASSIGN_ADDR (decl) = gfc_create_var (pvoid_type_node, sym->name); /* TODO: Need to check we don't change TREE_STATIC (decl) later. */ @@ -1130,7 +1130,7 @@ create_function_arglist (gfc_symbol * sym) /* Length of character result. */ type = TREE_VALUE (typelist); - assert (type == gfc_strlen_type_node); + assert (type == gfc_charlen_type_node); length = build_decl (PARM_DECL, get_identifier (".__result"), @@ -1192,7 +1192,7 @@ create_function_arglist (gfc_symbol * sym) parm = f->sym->backend_decl; type = TREE_VALUE (typelist); - assert (type == gfc_strlen_type_node); + assert (type == gfc_charlen_type_node); strcpy (&name[1], f->sym->name); name[0] = '_'; @@ -1383,7 +1383,7 @@ build_entry_thunks (gfc_namespace * ns) args = tree_cons (NULL_TREE, null_pointer_node, args); if (formal->sym->ts.type == BT_CHARACTER) { - tmp = convert (gfc_strlen_type_node, integer_zero_node); + tmp = convert (gfc_charlen_type_node, integer_zero_node); string_args = tree_cons (NULL_TREE, tmp, string_args); } } @@ -1572,58 +1572,58 @@ gfc_build_intrinsic_function_decls (void) gfc_build_library_function_decl (get_identifier (PREFIX("copy_string")), void_type_node, 4, - gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node); + gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_compare_string = gfc_build_library_function_decl (get_identifier (PREFIX("compare_string")), gfc_int4_type_node, 4, - gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node); + gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_concat_string = gfc_build_library_function_decl (get_identifier (PREFIX("concat_string")), void_type_node, 6, - gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node); + gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_string_len_trim = gfc_build_library_function_decl (get_identifier (PREFIX("string_len_trim")), gfc_int4_type_node, - 2, gfc_strlen_type_node, + 2, gfc_charlen_type_node, pchar_type_node); gfor_fndecl_string_index = gfc_build_library_function_decl (get_identifier (PREFIX("string_index")), gfc_int4_type_node, - 5, gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node, + 5, gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node, gfc_logical4_type_node); gfor_fndecl_string_scan = gfc_build_library_function_decl (get_identifier (PREFIX("string_scan")), gfc_int4_type_node, - 5, gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node, + 5, gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node, gfc_logical4_type_node); gfor_fndecl_string_verify = gfc_build_library_function_decl (get_identifier (PREFIX("string_verify")), gfc_int4_type_node, - 5, gfc_strlen_type_node, pchar_type_node, - gfc_strlen_type_node, pchar_type_node, + 5, gfc_charlen_type_node, pchar_type_node, + gfc_charlen_type_node, pchar_type_node, gfc_logical4_type_node); gfor_fndecl_string_trim = gfc_build_library_function_decl (get_identifier (PREFIX("string_trim")), void_type_node, 4, - build_pointer_type (gfc_strlen_type_node), + build_pointer_type (gfc_charlen_type_node), ppvoid_type_node, - gfc_strlen_type_node, + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_string_repeat = @@ -1631,7 +1631,7 @@ gfc_build_intrinsic_function_decls (void) void_type_node, 4, pchar_type_node, - gfc_strlen_type_node, + gfc_charlen_type_node, pchar_type_node, gfc_int4_type_node); @@ -1640,14 +1640,14 @@ gfc_build_intrinsic_function_decls (void) void_type_node, 3, pchar_type_node, - gfc_strlen_type_node, pchar_type_node); + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_adjustr = gfc_build_library_function_decl (get_identifier (PREFIX("adjustr")), void_type_node, 3, pchar_type_node, - gfc_strlen_type_node, pchar_type_node); + gfc_charlen_type_node, pchar_type_node); gfor_fndecl_si_kind = gfc_build_library_function_decl (get_identifier ("selected_int_kind"), diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 3884c012970..94653c95a54 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -151,7 +151,7 @@ gfc_trans_init_string_length (gfc_charlen * cl, stmtblock_t * pblock) tree tmp; gfc_init_se (&se, NULL); - gfc_conv_expr_type (&se, cl->length, gfc_strlen_type_node); + gfc_conv_expr_type (&se, cl->length, gfc_charlen_type_node); gfc_add_block_to_block (pblock, &se.pre); tmp = cl->backend_decl; @@ -173,7 +173,7 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind) var = NULL_TREE; gfc_init_se (&start, se); - gfc_conv_expr_type (&start, ref->u.ss.start, gfc_strlen_type_node); + gfc_conv_expr_type (&start, ref->u.ss.start, gfc_charlen_type_node); gfc_add_block_to_block (&se->pre, &start.pre); if (integer_onep (start.expr)) @@ -195,14 +195,14 @@ gfc_conv_substring (gfc_se * se, gfc_ref * ref, int kind) end.expr = se->string_length; else { - gfc_conv_expr_type (&end, ref->u.ss.end, gfc_strlen_type_node); + gfc_conv_expr_type (&end, ref->u.ss.end, gfc_charlen_type_node); gfc_add_block_to_block (&se->pre, &end.pre); } tmp = - build2 (MINUS_EXPR, gfc_strlen_type_node, - fold_convert (gfc_strlen_type_node, integer_one_node), + build2 (MINUS_EXPR, gfc_charlen_type_node, + fold_convert (gfc_charlen_type_node, integer_one_node), start.expr); - tmp = build2 (PLUS_EXPR, gfc_strlen_type_node, end.expr, tmp); + tmp = build2 (PLUS_EXPR, gfc_charlen_type_node, end.expr, tmp); se->string_length = fold (tmp); } @@ -688,14 +688,14 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) tree tmp; tree args; - if (TREE_TYPE (len) != gfc_strlen_type_node) + if (TREE_TYPE (len) != gfc_charlen_type_node) abort (); if (gfc_can_put_var_on_stack (len)) { /* Create a temporary variable to hold the result. */ - tmp = fold (build2 (MINUS_EXPR, gfc_strlen_type_node, len, - convert (gfc_strlen_type_node, + tmp = fold (build2 (MINUS_EXPR, gfc_charlen_type_node, len, + convert (gfc_charlen_type_node, integer_one_node))); tmp = build_range_type (gfc_array_index_type, gfc_index_zero_node, tmp); tmp = build_array_type (gfc_character1_type_node, tmp); @@ -1067,8 +1067,8 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, var = gfc_conv_string_tmp (se, type, len); arglist = gfc_chainon_list (arglist, var); - arglist = gfc_chainon_list (arglist, convert (gfc_strlen_type_node, - len)); + arglist = gfc_chainon_list (arglist, + convert (gfc_charlen_type_node, len)); } else /* TODO: derived type function return values. */ abort (); @@ -1101,7 +1101,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, { stringargs = gfc_chainon_list (stringargs, - convert (gfc_strlen_type_node, + convert (gfc_charlen_type_node, integer_zero_node)); } } diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 56023b6fc69..d1bf736c0e7 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -333,7 +333,7 @@ gfc_build_io_library_fndecls (void) void_type_node, 5, pvoid_type_node, pvoid_type_node, gfc_int4_type_node, gfc_int4_type_node, - gfc_strlen_type_node); + gfc_charlen_type_node); iocall_set_nml_val_complex = gfc_build_library_function_decl (get_identifier (PREFIX("st_set_nml_var_complex")), void_type_node, 4, diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index faa8ecfed37..f65a9d71c21 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -55,7 +55,7 @@ tree pvoid_type_node; tree ppvoid_type_node; tree pchar_type_node; tree gfc_character1_type_node; -tree gfc_strlen_type_node; +tree gfc_charlen_type_node; static GTY(()) tree gfc_desc_dim_type; static GTY(()) tree gfc_max_array_element_size; @@ -541,7 +541,7 @@ gfc_init_types (void) boolean_false_node = build_int_cst (boolean_type_node, 0); /* ??? Shouldn't this be based on gfc_index_integer_kind or so? */ - gfc_strlen_type_node = gfc_get_int_type (4); + gfc_charlen_type_node = gfc_get_int_type (4); } /* Get the type node for the given type and kind. */ @@ -1502,7 +1502,7 @@ gfc_get_function_type (gfc_symbol * sym) typelist = gfc_chainon_list (typelist, type); if (arg->ts.type == BT_CHARACTER) - typelist = gfc_chainon_list (typelist, gfc_strlen_type_node); + typelist = gfc_chainon_list (typelist, gfc_charlen_type_node); } /* Build the argument types for the function. */ @@ -1551,7 +1551,7 @@ gfc_get_function_type (gfc_symbol * sym) /* Add hidden string length parameters. */ while (nstr--) - typelist = gfc_chainon_list (typelist, gfc_strlen_type_node); + typelist = gfc_chainon_list (typelist, gfc_charlen_type_node); typelist = gfc_chainon_list (typelist, void_type_node); diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h index 6e92359de39..7a57961941d 100644 --- a/gcc/fortran/trans-types.h +++ b/gcc/fortran/trans-types.h @@ -45,12 +45,11 @@ extern GTY(()) tree gfc_character1_type_node; extern GTY(()) tree ppvoid_type_node; extern GTY(()) tree pvoid_type_node; extern GTY(()) tree pchar_type_node; -/* This is the type used to hold string lengths. It has nothing to do with - the C strlen(3) function. It must be the same as the corresponding - definition in gfortran.h. */ +/* This is the type used to hold the lengths of character variables. + It must be the same as the corresponding definition in gfortran.h. */ /* TODO: This is still hardcoded as kind=4 in some bits of the compiler and runtime library. */ -extern GTY(()) tree gfc_strlen_type_node; +extern GTY(()) tree gfc_charlen_type_node; /* be-function.c */ void gfc_convert_function_code (gfc_namespace *); diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 49af8438bf2..ecc104e5ffc 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2004-08-31 Tobias Schlueter + + * libgfortran.h: Replace 'gfc_strlen_type' by + 'gfc_charlen_type'. Update comment accordingly. + * intrinsics/args.c, intrinsics/env.c, io/io.h, io/transfer.c: + Replace all occurences of 'gfc_strlen_type' by 'gfc_charlen_type'. + 2004-08-31 Paul Brook * libgfortran.h: Add comments. diff --git a/libgfortran/intrinsics/args.c b/libgfortran/intrinsics/args.c index caa55d46d8b..984fa91d352 100644 --- a/libgfortran/intrinsics/args.c +++ b/libgfortran/intrinsics/args.c @@ -29,7 +29,7 @@ Boston, MA 02111-1307, USA. */ /* Get a commandline argument. */ void -prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_strlen_type val_len) +prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_charlen_type val_len) { int argc; int arglen; @@ -55,7 +55,7 @@ prefix(getarg_i4) (GFC_INTEGER_4 *pos, char *val, gfc_strlen_type val_len) /* INTEGER*8 wrapper of getarg. */ void -prefix(getarg_i8) (GFC_INTEGER_8 *pos, char *val, gfc_strlen_type val_len) +prefix(getarg_i8) (GFC_INTEGER_8 *pos, char *val, gfc_charlen_type val_len) { GFC_INTEGER_4 pos4; @@ -103,7 +103,7 @@ prefix(get_command_argument_i4) (GFC_INTEGER_4 *number, char *value, GFC_INTEGER_4 *length, GFC_INTEGER_4 *status, - gfc_strlen_type value_len) + gfc_charlen_type value_len) { int argc, arglen = 0, stat_flag = GFC_GC_SUCCESS; char **argv; @@ -155,7 +155,7 @@ prefix(get_command_argument_i8) (GFC_INTEGER_8 *number, char *value, GFC_INTEGER_8 *length, GFC_INTEGER_8 *status, - gfc_strlen_type value_len) + gfc_charlen_type value_len) { GFC_INTEGER_4 number4; GFC_INTEGER_4 length4; @@ -177,7 +177,7 @@ void prefix(get_command_i4) (char *command, GFC_INTEGER_4 *length, GFC_INTEGER_4 *status, - gfc_strlen_type command_len) + gfc_charlen_type command_len) { int i, argc, arglen, thisarg; int stat_flag = GFC_GC_SUCCESS; @@ -237,7 +237,7 @@ void prefix(get_command_i8) (char *command, GFC_INTEGER_8 *length, GFC_INTEGER_8 *status, - gfc_strlen_type command_len) + gfc_charlen_type command_len) { GFC_INTEGER_4 length4; GFC_INTEGER_4 status4; diff --git a/libgfortran/intrinsics/env.c b/libgfortran/intrinsics/env.c index 9898471844a..6695d5b9cf6 100644 --- a/libgfortran/intrinsics/env.c +++ b/libgfortran/intrinsics/env.c @@ -34,8 +34,8 @@ Boston, MA 02111-1307, USA. */ void prefix(getenv) (char * name, char * value, - gfc_strlen_type name_len, - gfc_strlen_type value_len) + gfc_charlen_type name_len, + gfc_charlen_type value_len) { /* Make a null-terminated copy of the name string so that c library @@ -99,8 +99,8 @@ prefix(get_environment_variable_i4) GFC_INTEGER_4 *length, GFC_INTEGER_4 *status, GFC_LOGICAL_4 *trim_name, - gfc_strlen_type name_len, - gfc_strlen_type value_len) + gfc_charlen_type name_len, + gfc_charlen_type value_len) { int stat = GFC_SUCCESS, res_len = 0; char name_nt[name_len+1], *res; @@ -164,8 +164,8 @@ prefix(get_environment_variable_i8) GFC_INTEGER_8 *length, GFC_INTEGER_8 *status, GFC_LOGICAL_8 *trim_name, - gfc_strlen_type name_len, - gfc_strlen_type value_len) + gfc_charlen_type name_len, + gfc_charlen_type value_len) { GFC_INTEGER_4 length4, status4; GFC_LOGICAL_4 trim_name4; diff --git a/libgfortran/io/io.h b/libgfortran/io/io.h index d2c15af7ec7..e910fa58780 100644 --- a/libgfortran/io/io.h +++ b/libgfortran/io/io.h @@ -549,7 +549,7 @@ void st_set_nml_var_int (void * , char * , int , int ); void st_set_nml_var_float (void * , char * , int , int ); #define st_set_nml_var_char prefix(st_set_nml_var_char) -void st_set_nml_var_char (void * , char * , int , int, gfc_strlen_type); +void st_set_nml_var_char (void * , char * , int , int, gfc_charlen_type); #define st_set_nml_var_complex prefix(st_set_nml_var_complex) void st_set_nml_var_complex (void * , char * , int , int ); diff --git a/libgfortran/io/transfer.c b/libgfortran/io/transfer.c index 3800d0b90cb..5d4dcd592a0 100644 --- a/libgfortran/io/transfer.c +++ b/libgfortran/io/transfer.c @@ -1578,7 +1578,7 @@ st_set_nml_var_float (void * var_addr, char * var_name, int var_name_len, void st_set_nml_var_char (void * var_addr, char * var_name, int var_name_len, - int kind, gfc_strlen_type string_length) + int kind, gfc_charlen_type string_length) { st_set_nml_var (var_addr, var_name, var_name_len, kind, BT_CHARACTER, diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index 28197033b33..463cd60348f 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -91,8 +91,8 @@ typedef complex double GFC_COMPLEX_8; by the compiler. */ /* The type used of array indices, amongst other things. */ typedef size_t index_type; -/* The type used for string lengths. Nothing to do with strlen(3). */ -typedef GFC_INTEGER_4 gfc_strlen_type; +/* The type used for the lengths of character variables. */ +typedef GFC_INTEGER_4 gfc_charlen_type; /* This will be 0 on little-endian machines and one on big-endian machines. */ #define l8_to_l4_offset prefix(l8_to_l4_offset) -- 2.30.2