/* Default error handlers for CPP Library.
- Copyright (C) 1986-2017 Free Software Foundation, Inc.
+ Copyright (C) 1986-2019 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
ATTRIBUTE_FPTR_PRINTF(5,0)
static bool
-cpp_diagnostic_at (cpp_reader * pfile, int level, int reason,
- rich_location *richloc,
+cpp_diagnostic_at (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ enum cpp_warning_reason reason, rich_location *richloc,
const char *msgid, va_list *ap)
{
bool ret;
- if (!pfile->cb.error)
+ if (!pfile->cb.diagnostic)
abort ();
- ret = pfile->cb.error (pfile, level, reason, richloc, _(msgid), ap);
+ ret = pfile->cb.diagnostic (pfile, level, reason, richloc, _(msgid), ap);
return ret;
}
ATTRIBUTE_FPTR_PRINTF(4,0)
static bool
-cpp_diagnostic (cpp_reader * pfile, int level, int reason,
- const char *msgid, va_list *ap)
+cpp_diagnostic (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ enum cpp_warning_reason reason,
+ const char *msgid, va_list *ap)
{
- source_location src_loc;
+ location_t src_loc;
if (CPP_OPTION (pfile, traditional))
{
/* Print a warning or error, depending on the value of LEVEL. */
bool
-cpp_error (cpp_reader * pfile, int level, const char *msgid, ...)
+cpp_error (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
/* Print a warning. The warning reason may be given in REASON. */
bool
-cpp_warning (cpp_reader * pfile, int reason, const char *msgid, ...)
+cpp_warning (cpp_reader * pfile, enum cpp_warning_reason reason,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
/* Print a pedantic warning. The warning reason may be given in REASON. */
bool
-cpp_pedwarning (cpp_reader * pfile, int reason, const char *msgid, ...)
+cpp_pedwarning (cpp_reader * pfile, enum cpp_warning_reason reason,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
given in REASON. */
bool
-cpp_warning_syshdr (cpp_reader * pfile, int reason, const char *msgid, ...)
+cpp_warning_syshdr (cpp_reader * pfile, enum cpp_warning_reason reason,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
ATTRIBUTE_FPTR_PRINTF(6,0)
static bool
-cpp_diagnostic_with_line (cpp_reader * pfile, int level, int reason,
- source_location src_loc, unsigned int column,
- const char *msgid, va_list *ap)
+cpp_diagnostic_with_line (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ enum cpp_warning_reason reason,
+ location_t src_loc, unsigned int column,
+ const char *msgid, va_list *ap)
{
bool ret;
- if (!pfile->cb.error)
+ if (!pfile->cb.diagnostic)
abort ();
rich_location richloc (pfile->line_table, src_loc);
if (column)
richloc.override_column (column);
- ret = pfile->cb.error (pfile, level, reason, &richloc, _(msgid), ap);
+ ret = pfile->cb.diagnostic (pfile, level, reason, &richloc, _(msgid), ap);
return ret;
}
/* Print a warning or error, depending on the value of LEVEL. */
bool
-cpp_error_with_line (cpp_reader *pfile, int level,
- source_location src_loc, unsigned int column,
+cpp_error_with_line (cpp_reader *pfile, enum cpp_diagnostic_level level,
+ location_t src_loc, unsigned int column,
const char *msgid, ...)
{
va_list ap;
/* Print a warning. The warning reason may be given in REASON. */
bool
-cpp_warning_with_line (cpp_reader *pfile, int reason,
- source_location src_loc, unsigned int column,
+cpp_warning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
+ location_t src_loc, unsigned int column,
const char *msgid, ...)
{
va_list ap;
/* Print a pedantic warning. The warning reason may be given in REASON. */
bool
-cpp_pedwarning_with_line (cpp_reader *pfile, int reason,
- source_location src_loc, unsigned int column,
- const char *msgid, ...)
+cpp_pedwarning_with_line (cpp_reader *pfile, enum cpp_warning_reason reason,
+ location_t src_loc, unsigned int column,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
given in REASON. */
bool
-cpp_warning_with_line_syshdr (cpp_reader *pfile, int reason,
- source_location src_loc, unsigned int column,
- const char *msgid, ...)
+cpp_warning_with_line_syshdr (cpp_reader *pfile, enum cpp_warning_reason reason,
+ location_t src_loc, unsigned int column,
+ const char *msgid, ...)
{
va_list ap;
bool ret;
a column override. */
bool
-cpp_error_at (cpp_reader * pfile, int level, source_location src_loc,
- const char *msgid, ...)
+cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ location_t src_loc, const char *msgid, ...)
{
va_list ap;
bool ret;
a column override. */
bool
-cpp_error_at (cpp_reader * pfile, int level, rich_location *richloc,
- const char *msgid, ...)
+cpp_error_at (cpp_reader * pfile, enum cpp_diagnostic_level level,
+ rich_location *richloc, const char *msgid, ...)
{
va_list ap;
bool ret;
information from errno. */
bool
-cpp_errno (cpp_reader *pfile, int level, const char *msgid)
+cpp_errno (cpp_reader *pfile, enum cpp_diagnostic_level level,
+ const char *msgid)
{
return cpp_error (pfile, level, "%s: %s", _(msgid), xstrerror (errno));
}
that is not localized, but "" is replaced with localized "stdout". */
bool
-cpp_errno_filename (cpp_reader *pfile, int level, const char *filename,
- source_location loc)
+cpp_errno_filename (cpp_reader *pfile, enum cpp_diagnostic_level level,
+ const char *filename,
+ location_t loc)
{
if (filename[0] == '\0')
filename = _("stdout");