#include "getargs.h"
bool complaint_issued;
+static unsigned *indent_ptr = 0;
\f
const char *prefix,
const char *message, va_list args)
{
+ unsigned pos = 0;
+
if (loc)
- location_print (stderr, *loc);
+ pos += location_print (stderr, *loc);
else
- fputs (current_file ? current_file : program_name, stderr);
- fputs (": ", stderr);
+ pos += fprintf(stderr, "%s", current_file ? current_file : program_name);
+ pos += fprintf(stderr, ": ");
+
+ if (indent_ptr)
+ {
+ if (!*indent_ptr)
+ *indent_ptr = pos;
+ else if (*indent_ptr > pos)
+ fprintf (stderr, "%*s", *indent_ptr - pos, "");
+ indent_ptr = 0;
+ }
if (prefix)
fprintf (stderr, "%s: ", prefix);
vfprintf (stderr, message, args);
- va_end (args);
putc ('\n', stderr);
fflush (stderr);
}
va_list args; \
va_start (args, Message); \
error_message (Loc, Prefix, Message, args); \
+ va_end (args); \
}
ERROR_MESSAGE (&loc, _("warning"), message);
}
+void
+warn_at_indent (location loc, unsigned *indent,
+ const char *message, ...)
+{
+ set_warning_issued ();
+ indent_ptr = indent;
+ ERROR_MESSAGE (&loc, _("warning"), message);
+}
+
void
warn (const char *message, ...)
{
complaint_issued = true;
}
+void
+complain_at_indent (location loc, unsigned *indent,
+ const char *message, ...)
+{
+ indent_ptr = indent;
+ ERROR_MESSAGE (&loc, NULL, message);
+ complaint_issued = true;
+}
+
void
complain (const char *message, ...)
{