aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-09-03 16:44:15 +0000
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2007-09-03 16:44:15 +0000
commitd74b97cc7e574d56c7542f40a76b151e7088829b (patch)
tree50eb90c08b7f37c0d1ff93a565a55dd6872e3e21 /gcc
parent4392a547f5434b483090f592c6a723a4377b8535 (diff)
downloadgcc-d74b97cc7e574d56c7542f40a76b151e7088829b.zip
gcc-d74b97cc7e574d56c7542f40a76b151e7088829b.tar.gz
gcc-d74b97cc7e574d56c7542f40a76b151e7088829b.tar.bz2
re PR fortran/31675 (Fortran front-end and libgfortran should have a common header file)
PR fortran/31675 * libgfortran.h: New file. * iso-fortran-env.def: Use macros in the new header instead of hardcoded integer constants. * Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add fortran/libgfortran.h. * gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert, ioerror_codes): Remove. * trans.c (ERROR_ALLOCATION): Remove. (gfc_call_malloc, gfc_allocate_with_status, gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION. * trans-types.h (GFC_DTYPE_*): Remove. * trans-decl.c (gfc_generate_function_code): Use GFC_CONVERT_NATIVE instead of CONVERT_NATIVE. * trans-io.c (set_parameter_value, set_parameter_ref): Use LIBERROR_* macros instead of IOERROR_ macros. * trans-intrinsic.c (gfc_conv_intrinsic_function): Use LIBERROR_END and LIBERROR_EOR instead of hardcoded constants. * options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of CONVERT_NATIVE. (gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*. * libgfortran.h: Include gcc/fortran/libgfortran.h. Remove M_PI, GFC_MAX_DIMENSIONS, GFC_DTYPE_*, GFC_NUM_RANK_BITS, error_codes, GFC_STD_*, GFC_FPE_* and unit_convert. * runtime/environ.c (variable_table): Use GFC_*_UNIT_NUMBER instead of hardcoded constants. (do_parse, init_unformatted): Use GFC_CONVERT_* macros instead of CONVERT_*. * runtime/string.c (find_option): Use LIBERROR_BAD_OPTION instead of ERROR_BAD_OPTION. * runtime/error.c (translate_error, generate_error): Use LIBERROR_* macros instead of ERROR_*. * io/file_pos.c (formatted_backspace, unformatted_backspace, st_backspace, st_rewind, st_flush): Rename macros. * io/open.c (convert_opt, edit_modes, new_unit, already_open, st_open): Likewise. * io/close.c (st_close): Likewise. * io/list_read.c (next_char, convert_integer, parse_repeat, read_logical, read_integer, read_character, parse_real, check_type, list_formatted_read_scalar, namelist_read, nml_err_ret): Likewise. * io/read.c (convert_real, read_l, read_decimal, read_radix, read_f): Likewise. * io/inquire.c (inquire_via_unit): Likewise. * io/unit.c (get_internal_unit): Likewise. * io/transfer.c (read_sf, read_block, read_block_direct, write_block, write_buf, unformatted_read, unformatted_write, formatted_transfer_scalar, us_read, us_write, data_transfer_init, skip_record, next_record_r, write_us_marker, next_record_w_unf, next_record_w, finalize_transfer, st_read, st_write_done): Likewise. * io/format.c (format_error): Likewise. From-SVN: r128050
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog24
-rw-r--r--gcc/fortran/Make-lang.in6
-rw-r--r--gcc/fortran/gfortran.h65
-rw-r--r--gcc/fortran/iso-fortran-env.def10
-rw-r--r--gcc/fortran/libgfortran.h108
-rw-r--r--gcc/fortran/options.c10
-rw-r--r--gcc/fortran/trans-decl.c2
-rw-r--r--gcc/fortran/trans-intrinsic.c4
-rw-r--r--gcc/fortran/trans-io.c27
-rw-r--r--gcc/fortran/trans-types.h16
-rw-r--r--gcc/fortran/trans.c17
11 files changed, 168 insertions, 121 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 3b3d469..ce57c13 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,27 @@
+2007-09-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/31675
+ * libgfortran.h: New file.
+ * iso-fortran-env.def: Use macros in the new header instead of
+ hardcoded integer constants.
+ * Make-lang.in (F95_PARSER_OBJS, GFORTRAN_TRANS_DEPS): Add
+ fortran/libgfortran.h.
+ * gfortran.h (GFC_STD_*, GFC_FPE_*, options_convert,
+ ioerror_codes): Remove.
+ * trans.c (ERROR_ALLOCATION): Remove.
+ (gfc_call_malloc, gfc_allocate_with_status,
+ gfc_allocate_array_with_status): Use LIBERROR_ALLOCATION.
+ * trans-types.h (GFC_DTYPE_*): Remove.
+ * trans-decl.c (gfc_generate_function_code): Use
+ GFC_CONVERT_NATIVE instead of CONVERT_NATIVE.
+ * trans-io.c (set_parameter_value, set_parameter_ref): Use
+ LIBERROR_* macros instead of IOERROR_ macros.
+ * trans-intrinsic.c (gfc_conv_intrinsic_function): Use
+ LIBERROR_END and LIBERROR_EOR instead of hardcoded constants.
+ * options.c (gfc_init_options): Use GFC_CONVERT_NATIVE instead of
+ CONVERT_NATIVE.
+ (gfc_handle_option): Use GFC_CONVERT_* macros instead of CONVERT_*.
+
2007-09-02 Steven G. Kargl <kargl@gcc.gnu.org>
* invoke.texi: Fix the -frange-checking option entry.
diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in
index 30320a8..c217b02 100644
--- a/gcc/fortran/Make-lang.in
+++ b/gcc/fortran/Make-lang.in
@@ -289,14 +289,16 @@ fortran.stagefeedback: stageprofile-start
# which objects depend on what. FIXME
# TODO: Add dependencies on the backend/tree header files
-$(F95_PARSER_OBJS): fortran/gfortran.h fortran/intrinsic.h fortran/match.h \
+$(F95_PARSER_OBJS): fortran/gfortran.h fortran/libgfortran.h \
+ fortran/intrinsic.h fortran/match.h \
fortran/parse.h fortran/arith.h fortran/target-memory.h \
$(CONFIG_H) $(SYSTEM_H) $(TM_H) $(TM_P_H) coretypes.h \
$(RTL_H) $(TREE_H) $(TREE_DUMP_H) $(GGC_H) $(EXPR_H) \
$(FLAGS_H) output.h $(DIAGNOSTIC_H) errors.h $(FUNCTION_H)
fortran/openmp.o: pointer-set.h $(TARGET_H) toplev.h
-GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/intrinsic.h fortran/trans-array.h \
+GFORTRAN_TRANS_DEPS = fortran/gfortran.h fortran/libgfortran.h \
+ fortran/intrinsic.h fortran/trans-array.h \
fortran/trans-const.h fortran/trans-const.h fortran/trans.h \
fortran/trans-stmt.h fortran/trans-types.h \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) coretypes.h $(GGC_H)
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 5c8c56d..b9c6c31 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -28,6 +28,11 @@ along with GCC; see the file COPYING3. If not see
multiple header files. Besides, Microsoft's winnt.h was 250k last
time I looked, so by comparison this is perfectly reasonable. */
+/* Declarations common to the front-end and library are put in
+ libgfortran/libgfortran_frontend.h */
+#include "libgfortran.h"
+
+
#include "system.h"
#include "intl.h"
#include "coretypes.h"
@@ -57,7 +62,6 @@ char *alloca ();
#define GFC_MAX_SYMBOL_LEN 63 /* Must be at least 63 for F2003. */
#define GFC_MAX_BINDING_LABEL_LEN 126 /* (2 * GFC_MAX_SYMBOL_LEN) */
#define GFC_MAX_LINE 132 /* Characters beyond this are not seen. */
-#define GFC_MAX_DIMENSIONS 7 /* Maximum dimensions in an array. */
#define GFC_LETTERS 26 /* Number of letters in the alphabet. */
#define MAX_SUBRECORD_LENGTH 2147483639 /* 2**31-9 */
@@ -96,33 +100,6 @@ typedef struct
mstring;
-/* Flags to specify which standard/extension contains a feature. */
-#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
-#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
-#define GFC_STD_F2003 (1<<4) /* New in F2003. */
-/* Note that no additional features were deleted or made obsolescent
- in F2003. */
-#define GFC_STD_F95 (1<<3) /* New in F95. */
-#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
-#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
-#define GFC_STD_F77 (1<<0) /* Included in F77, but not
- deleted or obsolescent in
- later standards. */
-
-/* Bitmasks for the various FPE that can be enabled. */
-#define GFC_FPE_INVALID (1<<0)
-#define GFC_FPE_DENORMAL (1<<1)
-#define GFC_FPE_ZERO (1<<2)
-#define GFC_FPE_OVERFLOW (1<<3)
-#define GFC_FPE_UNDERFLOW (1<<4)
-#define GFC_FPE_PRECISION (1<<5)
-
-/* Keep this in sync with libgfortran/io/io.h ! */
-
-typedef enum
- { CONVERT_NATIVE=0, CONVERT_SWAP, CONVERT_BIG, CONVERT_LITTLE }
-options_convert;
-
/*************************** Enums *****************************/
@@ -532,38 +509,6 @@ enum gfc_isym_id
};
typedef enum gfc_isym_id gfc_isym_id;
-/* Runtime errors. The EOR and EOF errors are required to be negative.
- These codes must be kept synchronized with their equivalents in
- libgfortran/libgfortran.h . */
-
-typedef enum
-{
- IOERROR_FIRST = -3, /* Marker for the first error. */
- IOERROR_EOR = -2,
- IOERROR_END = -1,
- IOERROR_OK = 0, /* Indicates success, must be zero. */
- IOERROR_OS = 5000, /* Operating system error, more info in errno. */
- IOERROR_OPTION_CONFLICT,
- IOERROR_BAD_OPTION,
- IOERROR_MISSING_OPTION,
- IOERROR_ALREADY_OPEN,
- IOERROR_BAD_UNIT,
- IOERROR_FORMAT,
- IOERROR_BAD_ACTION,
- IOERROR_ENDFILE,
- IOERROR_BAD_US,
- IOERROR_READ_VALUE,
- IOERROR_READ_OVERFLOW,
- IOERROR_INTERNAL,
- IOERROR_INTERNAL_UNIT,
- IOERROR_ALLOCATION,
- IOERROR_DIRECT_EOR,
- IOERROR_SHORT_RECORD,
- IOERROR_CORRUPT_FILE,
- IOERROR_LAST /* Not a real error, the last error # + 1. */
-}
-ioerror_codes;
-
/************************* Structures *****************************/
diff --git a/gcc/fortran/iso-fortran-env.def b/gcc/fortran/iso-fortran-env.def
index c45f7a5..8ef5597 100644
--- a/gcc/fortran/iso-fortran-env.def
+++ b/gcc/fortran/iso-fortran-env.def
@@ -26,11 +26,11 @@ along with GCC; see the file COPYING3. If not see
NAMED_INTCST (ISOFORTRANENV_CHARACTER_STORAGE_SIZE, "character_storage_size", \
gfc_character_storage_size)
-NAMED_INTCST (ISOFORTRANENV_ERROR_UNIT, "error_unit", 0)
+NAMED_INTCST (ISOFORTRANENV_ERROR_UNIT, "error_unit", GFC_STDERR_UNIT_NUMBER)
NAMED_INTCST (ISOFORTRANENV_FILE_STORAGE_SIZE, "file_storage_size", 8)
-NAMED_INTCST (ISOFORTRANENV_INPUT_UNIT, "input_unit", 5)
-NAMED_INTCST (ISOFORTRANENV_IOSTAT_END, "iostat_end", -1)
-NAMED_INTCST (ISOFORTRANENV_IOSTAT_EOR, "iostat_eor", -2)
+NAMED_INTCST (ISOFORTRANENV_INPUT_UNIT, "input_unit", GFC_STDIN_UNIT_NUMBER)
+NAMED_INTCST (ISOFORTRANENV_IOSTAT_END, "iostat_end", LIBERROR_END)
+NAMED_INTCST (ISOFORTRANENV_IOSTAT_EOR, "iostat_eor", LIBERROR_EOR)
NAMED_INTCST (ISOFORTRANENV_NUMERIC_STORAGE_SIZE, "numeric_storage_size", \
gfc_numeric_storage_size)
-NAMED_INTCST (ISOFORTRANENV_OUTPUT_UNIT, "output_unit", 6)
+NAMED_INTCST (ISOFORTRANENV_OUTPUT_UNIT, "output_unit", GFC_STDOUT_UNIT_NUMBER)
diff --git a/gcc/fortran/libgfortran.h b/gcc/fortran/libgfortran.h
new file mode 100644
index 0000000..d9bfa05
--- /dev/null
+++ b/gcc/fortran/libgfortran.h
@@ -0,0 +1,108 @@
+/* Header file to the Fortran front-end and runtime library
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+
+/* Flags to specify which standard/extension contains a feature.
+ Note that no features were obsoleted nor deleted in F2003. */
+#define GFC_STD_LEGACY (1<<6) /* Backward compatibility. */
+#define GFC_STD_GNU (1<<5) /* GNU Fortran extension. */
+#define GFC_STD_F2003 (1<<4) /* New in F2003. */
+#define GFC_STD_F95 (1<<3) /* New in F95. */
+#define GFC_STD_F95_DEL (1<<2) /* Deleted in F95. */
+#define GFC_STD_F95_OBS (1<<1) /* Obsolescent in F95. */
+#define GFC_STD_F77 (1<<0) /* Included in F77, but not deleted or
+ obsolescent in later standards. */
+
+
+/* Bitmasks for the various FPE that can be enabled. */
+#define GFC_FPE_INVALID (1<<0)
+#define GFC_FPE_DENORMAL (1<<1)
+#define GFC_FPE_ZERO (1<<2)
+#define GFC_FPE_OVERFLOW (1<<3)
+#define GFC_FPE_UNDERFLOW (1<<4)
+#define GFC_FPE_PRECISION (1<<5)
+
+
+/* Possible values for the CONVERT I/O specifier. */
+typedef enum
+{
+ GFC_CONVERT_NONE = -1,
+ GFC_CONVERT_NATIVE = 0,
+ GFC_CONVERT_SWAP,
+ GFC_CONVERT_BIG,
+ GFC_CONVERT_LITTLE
+}
+unit_convert;
+
+
+/* Runtime errors. */
+typedef enum
+{
+ LIBERROR_FIRST = -3, /* Marker for the first error. */
+ LIBERROR_EOR = -2, /* End of record, must be negative. */
+ LIBERROR_END = -1, /* End of file, must be negative. */
+ LIBERROR_OK = 0, /* Indicates success, must be zero. */
+ LIBERROR_OS = 5000, /* OS error, more info in errno. */
+ LIBERROR_OPTION_CONFLICT,
+ LIBERROR_BAD_OPTION,
+ LIBERROR_MISSING_OPTION,
+ LIBERROR_ALREADY_OPEN,
+ LIBERROR_BAD_UNIT,
+ LIBERROR_FORMAT,
+ LIBERROR_BAD_ACTION,
+ LIBERROR_ENDFILE,
+ LIBERROR_BAD_US,
+ LIBERROR_READ_VALUE,
+ LIBERROR_READ_OVERFLOW,
+ LIBERROR_INTERNAL,
+ LIBERROR_INTERNAL_UNIT,
+ LIBERROR_ALLOCATION,
+ LIBERROR_DIRECT_EOR,
+ LIBERROR_SHORT_RECORD,
+ LIBERROR_CORRUPT_FILE,
+ LIBERROR_LAST /* Not a real error, the last error # + 1. */
+}
+libgfortran_error_codes;
+
+
+/* Default unit number for preconnected standard input and output. */
+#define GFC_STDIN_UNIT_NUMBER 5
+#define GFC_STDOUT_UNIT_NUMBER 6
+#define GFC_STDERR_UNIT_NUMBER 0
+
+
+#define GFC_MAX_DIMENSIONS 7
+
+#define GFC_DTYPE_RANK_MASK 0x07
+#define GFC_DTYPE_TYPE_SHIFT 3
+#define GFC_DTYPE_TYPE_MASK 0x38
+#define GFC_DTYPE_SIZE_SHIFT 6
+
+enum
+{
+ GFC_DTYPE_UNKNOWN = 0,
+ GFC_DTYPE_INTEGER,
+ /* TODO: recognize logical types. */
+ GFC_DTYPE_LOGICAL,
+ GFC_DTYPE_REAL,
+ GFC_DTYPE_COMPLEX,
+ GFC_DTYPE_DERIVED,
+ GFC_DTYPE_CHARACTER
+};
+
diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c
index 3ab7362..a68c3be 100644
--- a/gcc/fortran/options.c
+++ b/gcc/fortran/options.c
@@ -62,7 +62,7 @@ gfc_init_options (unsigned int argc ATTRIBUTE_UNUSED,
gfc_option.max_continue_free = 39;
gfc_option.max_identifier_length = GFC_MAX_SYMBOL_LEN;
gfc_option.max_subrecord_length = 0;
- gfc_option.convert = CONVERT_NATIVE;
+ gfc_option.convert = GFC_CONVERT_NATIVE;
gfc_option.record_marker = 0;
gfc_option.verbose = 0;
@@ -704,19 +704,19 @@ gfc_handle_option (size_t scode, const char *arg, int value)
break;
case OPT_fconvert_little_endian:
- gfc_option.convert = CONVERT_LITTLE;
+ gfc_option.convert = GFC_CONVERT_LITTLE;
break;
case OPT_fconvert_big_endian:
- gfc_option.convert = CONVERT_BIG;
+ gfc_option.convert = GFC_CONVERT_BIG;
break;
case OPT_fconvert_native:
- gfc_option.convert = CONVERT_NATIVE;
+ gfc_option.convert = GFC_CONVERT_NATIVE;
break;
case OPT_fconvert_swap:
- gfc_option.convert = CONVERT_SWAP;
+ gfc_option.convert = GFC_CONVERT_SWAP;
break;
case OPT_frecord_marker_4:
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 109a187..0b70903 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3212,7 +3212,7 @@ gfc_generate_function_code (gfc_namespace * ns)
/* If this is the main program and an -fconvert option was provided,
add a call to set_convert. */
- if (sym->attr.is_main_program && gfc_option.convert != CONVERT_NATIVE)
+ if (sym->attr.is_main_program && gfc_option.convert != GFC_CONVERT_NATIVE)
{
tmp = build_call_expr (gfor_fndecl_set_convert, 1,
build_int_cst (integer_type_node,
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index 3c43a84..ebe8555 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -3928,11 +3928,11 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr)
break;
case GFC_ISYM_IS_IOSTAT_END:
- gfc_conv_has_intvalue (se, expr, -1);
+ gfc_conv_has_intvalue (se, expr, LIBERROR_END);
break;
case GFC_ISYM_IS_IOSTAT_EOR:
- gfc_conv_has_intvalue (se, expr, -2);
+ gfc_conv_has_intvalue (se, expr, LIBERROR_EOR);
break;
case GFC_ISYM_ISNAN:
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c
index 80646cd..289c2d2 100644
--- a/gcc/fortran/trans-io.c
+++ b/gcc/fortran/trans-io.c
@@ -457,18 +457,15 @@ set_parameter_value (stmtblock_t *block, tree var, enum iofield type,
if (type == IOPARM_common_unit && e->ts.kind != 4)
{
tree cond, max;
- ioerror_codes bad_unit;
int i;
- bad_unit = IOERROR_BAD_UNIT;
-
/* Don't evaluate the UNIT number multiple times. */
se.expr = gfc_evaluate_now (se.expr, &se.pre);
/* UNIT numbers should be nonnegative. */
cond = fold_build2 (LT_EXPR, boolean_type_node, se.expr,
build_int_cst (TREE_TYPE (se.expr),0));
- gfc_trans_io_runtime_check (cond, var, bad_unit,
+ gfc_trans_io_runtime_check (cond, var, LIBERROR_BAD_UNIT,
"Negative unit number in I/O statement",
&se.pre);
@@ -477,7 +474,7 @@ set_parameter_value (stmtblock_t *block, tree var, enum iofield type,
max = gfc_conv_mpz_to_tree (gfc_integer_kinds[i].huge, 4);
cond = fold_build2 (GT_EXPR, boolean_type_node, se.expr,
fold_convert (TREE_TYPE (se.expr), max));
- gfc_trans_io_runtime_check (cond, var, bad_unit,
+ gfc_trans_io_runtime_check (cond, var, LIBERROR_BAD_UNIT,
"Unit number in I/O statement too large",
&se.pre);
@@ -519,14 +516,10 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock,
addr = convert (TREE_TYPE (p->field), build_fold_addr_expr (se.expr));
/* If this is for the iostat variable initialize the
- user variable to IOERROR_OK which is zero. */
+ user variable to LIBERROR_OK which is zero. */
if (type == IOPARM_common_iostat)
- {
- ioerror_codes ok;
- ok = IOERROR_OK;
- gfc_add_modify_expr (block, se.expr,
- build_int_cst (TREE_TYPE (se.expr), ok));
- }
+ gfc_add_modify_expr (block, se.expr,
+ build_int_cst (TREE_TYPE (se.expr), LIBERROR_OK));
}
else
{
@@ -537,14 +530,10 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock,
st_parameter_field[type].name);
/* If this is for the iostat variable, initialize the
- user variable to IOERROR_OK which is zero. */
+ user variable to LIBERROR_OK which is zero. */
if (type == IOPARM_common_iostat)
- {
- ioerror_codes ok;
- ok = IOERROR_OK;
- gfc_add_modify_expr (block, tmpvar,
- build_int_cst (TREE_TYPE (tmpvar), ok));
- }
+ gfc_add_modify_expr (block, tmpvar,
+ build_int_cst (TREE_TYPE (tmpvar), LIBERROR_OK));
addr = build_fold_addr_expr (tmpvar);
/* After the I/O operation, we set the variable from the temporary. */
diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h
index 0650d7e..7a0e9bf 100644
--- a/gcc/fortran/trans-types.h
+++ b/gcc/fortran/trans-types.h
@@ -24,22 +24,6 @@ along with GCC; see the file COPYING3. If not see
#ifndef GFC_BACKEND_H
#define GFC_BACKEND_H
-#define GFC_DTYPE_RANK_MASK 0x07
-#define GFC_DTYPE_TYPE_SHIFT 3
-#define GFC_DTYPE_TYPE_MASK 0x38
-#define GFC_DTYPE_SIZE_SHIFT 6
-
-enum
-{
- GFC_DTYPE_UNKNOWN = 0,
- GFC_DTYPE_INTEGER,
- GFC_DTYPE_LOGICAL,
- GFC_DTYPE_REAL,
- GFC_DTYPE_COMPLEX,
- GFC_DTYPE_DERIVED,
- GFC_DTYPE_CHARACTER
-};
-
extern GTY(()) tree gfc_array_index_type;
extern GTY(()) tree gfc_array_range_type;
extern GTY(()) tree gfc_character1_type_node;
diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c
index 1113e80..b9fd2df 100644
--- a/gcc/fortran/trans.c
+++ b/gcc/fortran/trans.c
@@ -473,11 +473,6 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
return res;
}
-/* The status variable of allocate statement is set to ERROR_ALLOCATION
- when the allocation wasn't successful. This value needs to be kept in
- sync with libgfortran/libgfortran.h. */
-#define ERROR_ALLOCATION 5014
-
/* Allocate memory, using an optional status argument.
This function follows the following pseudo-code:
@@ -495,7 +490,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
{
if (stat)
{
- *stat = ERROR_ALLOCATION;
+ *stat = LIBERROR_ALLOCATION;
newmem = NULL;
}
else
@@ -508,7 +503,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size)
if (newmem == NULL)
{
if (stat)
- *stat = ERROR_ALLOCATION;
+ *stat = LIBERROR_ALLOCATION;
else
runtime_error ("Out of memory");
}
@@ -558,7 +553,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
gfc_start_block (&set_status_block);
gfc_add_modify_expr (&set_status_block,
build1 (INDIRECT_REF, status_type, status),
- build_int_cst (status_type, ERROR_ALLOCATION));
+ build_int_cst (status_type, LIBERROR_ALLOCATION));
gfc_add_modify_expr (&set_status_block, res,
build_int_cst (pvoid_type_node, 0));
@@ -589,7 +584,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
build_int_cst (status_type, 0));
tmp2 = fold_build2 (MODIFY_EXPR, status_type,
build1 (INDIRECT_REF, status_type, status),
- build_int_cst (status_type, ERROR_ALLOCATION));
+ build_int_cst (status_type, LIBERROR_ALLOCATION));
tmp = fold_build3 (COND_EXPR, void_type_node, cond, tmp,
tmp2);
}
@@ -627,7 +622,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status)
{
free (mem);
mem = allocate (size, stat);
- *stat = ERROR_ALLOCATION;
+ *stat = LIBERROR_ALLOCATION;
return mem;
}
else
@@ -675,7 +670,7 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size,
gfc_add_modify_expr (&set_status_block,
build1 (INDIRECT_REF, status_type, status),
- build_int_cst (status_type, ERROR_ALLOCATION));
+ build_int_cst (status_type, LIBERROR_ALLOCATION));
tmp = fold_build2 (EQ_EXPR, boolean_type_node, status,
build_int_cst (status_type, 0));