aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/error.c
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2009-09-23 21:57:28 +0000
committerCary Coutant <ccoutant@google.com>2009-09-23 21:57:28 +0000
commitebd9739bcfd2dc4c6409fb0b96d95894191b2c28 (patch)
tree64c4afc5e42d0dc9438e2d23f625cb3160e1e0a4 /gcc/fortran/error.c
parent0639e5c9f75c6391211dc74a4a47e9d83c88e8f4 (diff)
Merged revs 144680:151949 from trunk
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/dwarf4@152102 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/error.c')
-rw-r--r--gcc/fortran/error.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c
index 29efbd1fee0..9d5453e4ceb 100644
--- a/gcc/fortran/error.c
+++ b/gcc/fortran/error.c
@@ -32,6 +32,8 @@ along with GCC; see the file COPYING3. If not see
static int suppress_errors = 0;
+static int warnings_not_errors = 0;
+
static int terminal_width, buffer_flag, errors, warnings;
static gfc_error_buf error_buffer, warning_buffer, *cur_error_buffer;
@@ -533,6 +535,7 @@ error_print (const char *type, const char *format0, va_list argp)
case 'u':
arg[pos].type = TYPE_UINTEGER;
+ break;
case 'l':
c = *format++;
@@ -862,6 +865,9 @@ gfc_error (const char *nocmsgid, ...)
{
va_list argp;
+ if (warnings_not_errors)
+ goto warning;
+
if (suppress_errors)
return;
@@ -877,6 +883,30 @@ gfc_error (const char *nocmsgid, ...)
if (buffer_flag == 0)
gfc_increment_error_count();
+
+ return;
+
+warning:
+
+ if (inhibit_warnings)
+ return;
+
+ warning_buffer.flag = 1;
+ warning_buffer.index = 0;
+ cur_error_buffer = &warning_buffer;
+
+ va_start (argp, nocmsgid);
+ error_print (_("Warning:"), _(nocmsgid), argp);
+ va_end (argp);
+
+ error_char ('\0');
+
+ if (buffer_flag == 0)
+ {
+ warnings++;
+ if (warnings_are_errors)
+ gfc_increment_error_count();
+ }
}
@@ -954,6 +984,7 @@ void
gfc_clear_error (void)
{
error_buffer.flag = 0;
+ warnings_not_errors = 0;
}
@@ -1041,3 +1072,12 @@ gfc_get_errors (int *w, int *e)
if (e != NULL)
*e = errors;
}
+
+
+/* Switch errors into warnings. */
+
+void
+gfc_errors_to_warnings (int f)
+{
+ warnings_not_errors = (f == 1) ? 1 : 0;
+}