aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-const.c
diff options
context:
space:
mode:
authorTobias Schlüter <tobi@gcc.gnu.org>2004-10-04 22:55:49 +0200
committerTobias Schlüter <tobi@gcc.gnu.org>2004-10-04 22:55:49 +0200
commit95638988cb96e12a6472bfdde500fa5105d7c251 (patch)
tree3bc67b7ed0b9882c2945e7136e69be9b705e553d /gcc/fortran/trans-const.c
parentee569894e73717bcc0ee7598a0fd250d0e07b50f (diff)
downloadgcc-95638988cb96e12a6472bfdde500fa5105d7c251.zip
gcc-95638988cb96e12a6472bfdde500fa5105d7c251.tar.gz
gcc-95638988cb96e12a6472bfdde500fa5105d7c251.tar.bz2
trans-const.c (gfc_build_cstring_const): New function.
* trans-const.c (gfc_build_cstring_const): New function. (gfc_init_cst): Use new function. * trans-const.h (gfc_build_cstring_const): Add prototype. * trans-io.c (set_string, set_error_locus): Use new function. * trans-stmt.c (gfc_trans_goto): Use new function. From-SVN: r88528
Diffstat (limited to 'gcc/fortran/trans-const.c')
-rw-r--r--gcc/fortran/trans-const.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c
index e3c5850..c0572da 100644
--- a/gcc/fortran/trans-const.c
+++ b/gcc/fortran/trans-const.c
@@ -89,6 +89,14 @@ gfc_build_string_const (int length, const char *s)
return str;
}
+/* Build a Fortran character constant from a zero-terminated string. */
+
+tree
+gfc_build_cstring_const (const char *s)
+{
+ return gfc_build_string_const (strlen (s) + 1, s);
+}
+
/* Return a string constant with the given length. Used for static
initializers. The constant will be padded or truncated to match
length. */
@@ -147,17 +155,16 @@ gfc_init_constants (void)
for (n = 0; n <= GFC_MAX_DIMENSIONS; n++)
gfc_rank_cst[n] = build_int_cst (gfc_array_index_type, n);
- gfc_strconst_bounds = gfc_build_string_const (21, "Array bound mismatch");
+ gfc_strconst_bounds = gfc_build_cstring_const ("Array bound mismatch");
gfc_strconst_fault =
- gfc_build_string_const (30, "Array reference out of bounds");
+ gfc_build_cstring_const ("Array reference out of bounds");
gfc_strconst_wrong_return =
- gfc_build_string_const (32, "Incorrect function return value");
+ gfc_build_cstring_const ("Incorrect function return value");
gfc_strconst_current_filename =
- gfc_build_string_const (strlen (gfc_option.source) + 1,
- gfc_option.source);
+ gfc_build_cstring_const (gfc_option.source);
}
/* Converts a GMP integer into a backend tree node. */