From: Fritz Reese Date: Wed, 2 Nov 2016 14:46:33 +0000 (+0000) Subject: Allow warning flags to associate through gfc_error. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eab1ee22545ddc53bbe25ab6c4140f29a8879891;p=gcc.git 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fd51989e402..b92928ce443 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 fe91419ce44..0fd8a4e74e3 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; } @@ -1288,12 +1288,22 @@ 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 ea4437c5d83..b559e8ac5cb 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);