]> git.saurik.com Git - bison.git/blobdiff - src/complain.c
(add_param): New function.
[bison.git] / src / complain.c
index 01cda949f4ddd58591569c834d7e800b66eb54e3..7d2f0c55646ec4571d77f89ef8f69c97a1f4e813 100644 (file)
@@ -29,8 +29,6 @@
 #if STDC_HEADERS || _LIBC
 # include <stdlib.h>
 # include <string.h>
-#else
-void exit ();
 #endif
 
 #include "complain.h"
@@ -83,11 +81,11 @@ private_strerror (int errnum)
 # endif /* HAVE_STRERROR */
 #endif /* not _LIBC */
 
-/* This variable is incremented each time `warn' is called.  */
-unsigned int warn_message_count;
+/* This variable is set each time `warn' is called.  */
+bool warning_issued;
 
-/* This variable is incremented each time `complain' is called.  */
-unsigned int complain_message_count;
+/* This variable is set each time `complain' is called.  */
+bool complaint_issued;
 
 \f
 /*--------------------------------.
@@ -108,7 +106,7 @@ warn_at (location_t location, const char *message, ...)
   vfprintf (stderr, message, args);
   va_end (args);
 
-  ++warn_message_count;
+  warning_issued = true;
   putc ('\n', stderr);
   fflush (stderr);
 }
@@ -119,13 +117,13 @@ warn (const char *message, ...)
   va_list args;
 
   fflush (stdout);
-  fprintf (stderr, "%s: %s", infile ? infile : program_name, _("warning: "));
+  fprintf (stderr, "%s: %s", current_file ? current_file : program_name, _("warning: "));
 
   va_start (args, message);
   vfprintf (stderr, message, args);
   va_end (args);
 
-  ++warn_message_count;
+  warning_issued = true;
   putc ('\n', stderr);
   fflush (stderr);
 }
@@ -147,7 +145,7 @@ complain_at (location_t location, const char *message, ...)
   vfprintf (stderr, message, args);
   va_end (args);
 
-  ++complain_message_count;
+  complaint_issued = true;
   putc ('\n', stderr);
   fflush (stderr);
 }
@@ -158,13 +156,13 @@ complain (const char *message, ...)
   va_list args;
 
   fflush (stdout);
-  fprintf (stderr, "%s: ", infile ? infile : program_name);
+  fprintf (stderr, "%s: ", current_file ? current_file : program_name);
 
   va_start (args, message);
   vfprintf (stderr, message, args);
   va_end (args);
 
-  ++complain_message_count;
+  complaint_issued = true;
   putc ('\n', stderr);
   fflush (stderr);
 }
@@ -188,7 +186,7 @@ fatal_at (location_t location, const char *message, ...)
   va_end (args);
   putc ('\n', stderr);
   fflush (stderr);
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 
 void
@@ -197,7 +195,7 @@ fatal (const char *message, ...)
   va_list args;
 
   fflush (stdout);
-  fprintf (stderr, "%s: ", infile ? infile : program_name);
+  fprintf (stderr, "%s: ", current_file ? current_file : program_name);
 
   fputs (_("fatal error: "), stderr);
 
@@ -206,5 +204,5 @@ fatal (const char *message, ...)
   va_end (args);
   putc ('\n', stderr);
   fflush (stderr);
-  exit (1);
+  exit (EXIT_FAILURE);
 }