From eab1ee22545ddc53bbe25ab6c4140f29a8879891 Mon Sep 17 00:00:00 2001 From: Fritz Reese Date: Wed, 2 Nov 2016 14:46:33 +0000 Subject: Allow warning flags to associate through gfc_error. gcc/fortran/ * gfortran.h (gfc_error): New declaration for gfc_error with 'opt'. * error.c (gfc_error): Add optional 'opt' argument. * error.c (gfc_notify_std): Call fully-qualified gfc_error. From-SVN: r241794 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/error.c | 20 +++++++++++++++----- gcc/fortran/gfortran.h | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fd51989..b92928c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-11-02 Fritz Reese + + * gfortran.h (gfc_error): New declaration for gfc_error with 'opt'. + * error.c (gfc_error): Add optional 'opt' argument. + * error.c (gfc_notify_std): Call fully-qualified gfc_error. + 2016-11-01 Thomas Koenig PR fortran/78178 diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index fe91419..0fd8a4e 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -67,7 +67,7 @@ gfc_push_suppress_errors (void) } static void -gfc_error (const char *gmsgid, va_list ap) ATTRIBUTE_GCC_GFC(1,0); +gfc_error (int opt, const char *gmsgid, va_list ap) ATTRIBUTE_GCC_GFC(2,0); static bool gfc_warning (int opt, const char *gmsgid, va_list ap) ATTRIBUTE_GCC_GFC(2,0); @@ -902,7 +902,7 @@ gfc_notify_std (int std, const char *gmsgid, ...) if (warning) gfc_warning (0, buffer, argp); else - gfc_error (buffer, argp); + gfc_error (0, buffer, argp); va_end (argp); return (warning && !warnings_are_errors) ? true : false; @@ -1233,7 +1233,7 @@ gfc_warning_check (void) /* Issue an error. */ static void -gfc_error (const char *gmsgid, va_list ap) +gfc_error (int opt, const char *gmsgid, va_list ap) { va_list argp; va_copy (argp, ap); @@ -1241,7 +1241,7 @@ gfc_error (const char *gmsgid, va_list ap) if (warnings_not_errors) { - gfc_warning (/*opt=*/0, gmsgid, argp); + gfc_warning (opt, gmsgid, argp); va_end (argp); return; } @@ -1289,11 +1289,21 @@ gfc_error (const char *gmsgid, va_list ap) void +gfc_error (int opt, const char *gmsgid, ...) +{ + va_list argp; + va_start (argp, gmsgid); + gfc_error (opt, gmsgid, argp); + va_end (argp); +} + + +void gfc_error (const char *gmsgid, ...) { va_list argp; va_start (argp, gmsgid); - gfc_error (gmsgid, argp); + gfc_error (0, gmsgid, argp); va_end (argp); } diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index ea4437c..b559e8a 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -2730,6 +2730,7 @@ bool gfc_warning_now_at (location_t loc, int opt, const char *gmsgid, ...) void gfc_clear_warning (void); void gfc_warning_check (void); +void gfc_error (int opt, const char *, ...) ATTRIBUTE_GCC_GFC(2,3); void gfc_error (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_error_now (const char *, ...) ATTRIBUTE_GCC_GFC(1,2); void gfc_fatal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_GCC_GFC(1,2); -- cgit v1.1