summaryrefslogtreecommitdiff
path: root/gcc/diagnostic.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-24 18:55:44 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-05-24 18:55:44 +0000
commit2c2efebb71479d67bce6320b015253bb408a3496 (patch)
treed6028a1f52919db5575cd7449139f2ab89757163 /gcc/diagnostic.c
parentf955934c261dc2757b87671643376e05b9387009 (diff)
downloadgcc-2c2efebb71479d67bce6320b015253bb408a3496.tar.gz
* diagnostic.c: Don't include flags.h.
(pedantic_warning_kind, permissive_error_kind): Take diagnostic context parameters. Check flags in the context passed as a parameter. (diagnostic_build_prefix): Add context parameter. Check show_column flag in context. (diagnostic_action_after_output): Check fatal_errors flag in context. (diagnostic_report_current_module): Check show_column flag in context. (default_diagnostic_starter): Update call to diagnostic_build_prefix. (diagnostic_report_diagnostic): Pass context to pedantic_warning_kind. (emit_diagnostic): Pass context to permissive_error_kind. (permerror): Pass context to permissive_error_kind. * diagnostic.h (struct diagnostic_context): Add show_column, pedantic_errors, permissive and fatal_errors fields. (diagnostic_build_prefix): Update prototype. * langhooks.c * toplev.c (process_options): Set flags in global_dc from flag_show_column, flag_pedantic_errors, flag_permissive, flag_fatal_errors. * tree-diagnostic.c (default_tree_diagnostic_starter): Update call to diagnostic_build_prefix. * Makefile.in (diagnostic.o): Update dependencies. cp: * error.c (cp_diagnostic_starter): Update call to diagnostic_build_prefix. (cp_print_error_function, print_instantiation_partial_context_line): Check show_column flag in context. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/diagnostic.c')
-rw-r--r--gcc/diagnostic.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index eee97cecd33..7757ace11b0 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "version.h"
-#include "flags.h"
#include "input.h"
#include "toplev.h"
#include "intl.h"
@@ -35,8 +34,9 @@ along with GCC; see the file COPYING3. If not see
#include "opts.h"
#include "plugin.h"
-#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
-#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
+#define pedantic_warning_kind(DC) \
+ ((DC)->pedantic_errors ? DK_ERROR : DK_WARNING)
+#define permissive_error_kind(DC) ((DC)->permissive ? DK_WARNING : DK_ERROR)
/* Prototypes. */
static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
@@ -156,7 +156,8 @@ diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid,
/* Return a malloc'd string describing a location. The caller is
responsible for freeing the memory. */
char *
-diagnostic_build_prefix (diagnostic_info *diagnostic)
+diagnostic_build_prefix (diagnostic_context *context,
+ diagnostic_info *diagnostic)
{
static const char *const diagnostic_kind_text[] = {
#define DEFINE_DIAGNOSTIC_KIND(K, T) (T),
@@ -173,7 +174,7 @@ diagnostic_build_prefix (diagnostic_info *diagnostic)
return
(s.file == NULL
? build_message_string ("%s: %s", progname, text)
- : flag_show_column
+ : context->show_column
? build_message_string ("%s:%d:%d: %s", s.file, s.line, s.column, text)
: build_message_string ("%s:%d: %s", s.file, s.line, text));
}
@@ -196,7 +197,7 @@ diagnostic_action_after_output (diagnostic_context *context,
case DK_SORRY:
if (context->abort_on_error)
real_abort ();
- if (flag_fatal_errors)
+ if (context->fatal_errors)
{
fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n");
diagnostic_finish (context);
@@ -246,7 +247,7 @@ diagnostic_report_current_module (diagnostic_context *context)
if (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (line_table, map);
- if (flag_show_column)
+ if (context->show_column)
pp_verbatim (context->printer,
"In file included from %s:%d:%d",
map->to_file,
@@ -273,7 +274,8 @@ default_diagnostic_starter (diagnostic_context *context,
diagnostic_info *diagnostic)
{
diagnostic_report_current_module (context);
- pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
+ pp_set_prefix (context->printer, diagnostic_build_prefix (context,
+ diagnostic));
}
void
@@ -326,7 +328,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
if (diagnostic->kind == DK_PEDWARN)
{
- diagnostic->kind = pedantic_warning_kind ();
+ diagnostic->kind = pedantic_warning_kind (context);
/* We do this to avoid giving the message for -pedantic-errors. */
orig_diag_kind = diagnostic->kind;
}
@@ -524,7 +526,7 @@ emit_diagnostic (diagnostic_t kind, location_t location, int opt,
if (kind == DK_PERMERROR)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
- permissive_error_kind ());
+ permissive_error_kind (global_dc));
diagnostic.option_index = OPT_fpermissive;
}
else {
@@ -643,7 +645,7 @@ permerror (location_t location, const char *gmsgid, ...)
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
- permissive_error_kind ());
+ permissive_error_kind (global_dc));
diagnostic.option_index = OPT_fpermissive;
va_end (ap);
return report_diagnostic (&diagnostic);