aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/io.c
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2007-07-04 01:08:48 +0000
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2007-07-04 01:08:48 +0000
commit2305fa31840fb5300228837afda1039ed825eebe (patch)
tree27e9aa18518d080c17965ae93f7bbbccaab9f703 /gcc/fortran/io.c
parentf01d40db560f6b6dcb4737a82da71438e995cb10 (diff)
downloadgcc-2305fa31840fb5300228837afda1039ed825eebe.zip
gcc-2305fa31840fb5300228837afda1039ed825eebe.tar.gz
gcc-2305fa31840fb5300228837afda1039ed825eebe.tar.bz2
re PR fortran/32545 (Give an (compile time) error not a warning for wrong edit format statements)
2007-07-03 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/32545 * io.c (check_format): Always call gfc_error for errors. (check_format_string): Change type of this function to try and return the result of check_format. (check_io_constraints): Return MATCH_ERROR if check_format_string returns FAILURE. 2007-07-03 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/32612 * decl.c (get_proc_name): Include attr->mod_proc in check for error. From-SVN: r126295
Diffstat (limited to 'gcc/fortran/io.c')
-rw-r--r--gcc/fortran/io.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index e8f4deb..7f5e575 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -842,20 +842,10 @@ extension_optional_comma:
goto format_item;
syntax:
- /* Something went wrong. If the format we're checking is a string,
- generate a warning, since the program is correct. If the format
- is in a FORMAT statement, this messes up parsing, which is an
- error. */
- if (mode != MODE_STRING)
- gfc_error ("%s in format string at %C", error);
- else
- {
- gfc_warning ("%s in format string at %C", error);
-
- /* TODO: More elaborate measures are needed to show where a problem
- is within a format string that has been calculated. */
- }
+ gfc_error ("%s in format string at %C", error);
+ /* TODO: More elaborate measures are needed to show where a problem
+ is within a format string that has been calculated. */
rv = FAILURE;
finished:
@@ -866,12 +856,12 @@ finished:
/* Given an expression node that is a constant string, see if it looks
like a format string. */
-static void
+static try
check_format_string (gfc_expr *e, bool is_input)
{
mode = MODE_STRING;
format_string = e->value.character.string;
- check_format (is_input);
+ return check_format (is_input);
}
@@ -2752,8 +2742,9 @@ if (condition) \
}
expr = dt->format_expr;
- if (expr != NULL && expr->expr_type == EXPR_CONSTANT)
- check_format_string (expr, k == M_READ);
+ if (expr != NULL && expr->expr_type == EXPR_CONSTANT
+ && check_format_string (expr, k == M_READ) == FAILURE)
+ return MATCH_ERROR;
return m;
}