X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/23eb2a692f2e966c840d5f953de4bf8e26d71225..eb1b07409f0ccad9970c8a60ded9f2a56d205b9c:/src/complain.c diff --git a/src/complain.c b/src/complain.c index f3cd0ec1..910b4110 100644 --- a/src/complain.c +++ b/src/complain.c @@ -28,10 +28,7 @@ #include "complain.h" #include "files.h" - -/* The calling program should define program_name and set it to the - name of the executing program. */ -extern char *program_name; +#include "getargs.h" bool complaint_issued; @@ -79,15 +76,29 @@ error_message (location *loc, | Report a warning, and proceed. | `--------------------------------*/ +static void +set_warning_issued (void) +{ + static bool warning_issued = false; + if (!warning_issued && (warnings_flag & warnings_error)) + { + fprintf (stderr, "%s: warnings being treated as errors\n", program_name); + complaint_issued = true; + } + warning_issued = true; +} + void warn_at (location loc, const char *message, ...) { + set_warning_issued (); ERROR_MESSAGE (&loc, _("warning"), message); } void warn (const char *message, ...) { + set_warning_issued (); ERROR_MESSAGE (NULL, _("warning"), message); }