diff options
author | Joseph Myers <joseph@codesourcery.com> | 2010-05-24 19:55:44 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2010-05-24 19:55:44 +0100 |
commit | 243fbddd9c886159b7461867c84db564e0b5b0b0 (patch) | |
tree | d6028a1f52919db5575cd7449139f2ab89757163 /gcc | |
parent | 611d6f76fe8eae737566fb809f61b0c094ef92c9 (diff) | |
download | gcc-243fbddd9c886159b7461867c84db564e0b5b0b0.zip gcc-243fbddd9c886159b7461867c84db564e0b5b0b0.tar.gz gcc-243fbddd9c886159b7461867c84db564e0b5b0b0.tar.bz2 |
diagnostic.c: Don't include flags.h.
* 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.
From-SVN: r159793
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 29 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/error.c | 11 | ||||
-rw-r--r-- | gcc/diagnostic.c | 24 | ||||
-rw-r--r-- | gcc/diagnostic.h | 14 | ||||
-rw-r--r-- | gcc/langhooks.c | 2 | ||||
-rw-r--r-- | gcc/toplev.c | 5 | ||||
-rw-r--r-- | gcc/tree-diagnostic.c | 3 |
9 files changed, 78 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index def777d..8806178 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,32 @@ +2010-05-24 Joseph Myers <joseph@codesourcery.com> + + * 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. + 2010-05-24 H.J. Lu <hongjiu.lu@intel.com> * config/i386/ia32intrin.h (__crc32q): Define only if diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7f5eba2..ef7a324 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -2735,7 +2735,7 @@ fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ $(GGC_H) $(TM_P_H) langhooks.h $(MD5_H) intl.h $(TARGET_H) \ $(GIMPLE_H) realmpfr.h diagnostic.o : diagnostic.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - version.h $(FLAGS_H) $(INPUT_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) \ + version.h $(INPUT_H) $(TOPLEV_H) intl.h $(DIAGNOSTIC_H) \ diagnostic.def opts.h $(PLUGIN_H) opts.o : opts.c opts.h options.h $(TOPLEV_H) $(CONFIG_H) $(SYSTEM_H) \ coretypes.h $(TREE_H) $(TM_H) langhooks.h $(GGC_H) $(EXPR_H) $(RTL_H) \ diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2a3a8a0..74cb213 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2010-05-24 Joseph Myers <joseph@codesourcery.com> + + * 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. + 2010-05-24 Jason Merrill <jason@redhat.com> PR c++/41510 diff --git a/gcc/cp/error.c b/gcc/cp/error.c index dcdfe89..592f360 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2550,7 +2550,8 @@ cp_diagnostic_starter (diagnostic_context *context, diagnostic_report_current_module (context); cp_print_error_function (context, diagnostic); maybe_print_instantiation_context (context); - pp_base_set_prefix (context->printer, diagnostic_build_prefix (diagnostic)); + pp_base_set_prefix (context->printer, diagnostic_build_prefix (context, + diagnostic)); } static void @@ -2644,7 +2645,7 @@ cp_print_error_function (diagnostic_context *context, pp_base_newline (context->printer); if (s.file != NULL) { - if (flag_show_column && s.column != 0) + if (context->show_column && s.column != 0) pp_printf (context->printer, _(" inlined from %qs at %s:%d:%d"), cxx_printable_name_translate (fndecl, 2), @@ -2750,7 +2751,7 @@ print_instantiation_partial_context_line (diagnostic_context *context, const char *str; str = decl_as_string_translate (t->decl, TFF_DECL_SPECIFIERS | TFF_RETURN_TYPE); - if (flag_show_column) + if (context->show_column) pp_verbatim (context->printer, recursive_p ? _("%s:%d:%d: recursively instantiated from %qs\n") @@ -2765,7 +2766,7 @@ print_instantiation_partial_context_line (diagnostic_context *context, } else { - if (flag_show_column) + if (context->show_column) pp_verbatim (context->printer, recursive_p ? _("%s:%d:%d: recursively instantiated from here") @@ -2816,7 +2817,7 @@ print_instantiation_partial_context (diagnostic_context *context, { expanded_location xloc; xloc = expand_location (loc); - if (flag_show_column) + if (context->show_column) pp_verbatim (context->printer, _("%s:%d:%d: [ skipping %d instantiation contexts ]\n"), xloc.file, xloc.line, xloc.column, skip); diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index eee97ce..7757ace 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); diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 89c1271..1db91c2 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -87,6 +87,18 @@ struct diagnostic_context /* True if we should raise a SIGABRT on errors. */ bool abort_on_error; + /* True if we should show the column number on diagnostics. */ + bool show_column; + + /* True if pedwarns are errors. */ + bool pedantic_errors; + + /* True if permerrors are warnings. */ + bool permissive; + + /* True if errors are fatal. */ + bool fatal_errors; + /* This function is called before any message is printed out. It is responsible for preparing message prefix and such. For example, it might say: @@ -211,7 +223,7 @@ extern void diagnostic_set_info_translated (diagnostic_info *, const char *, extern bool emit_diagnostic (diagnostic_t, location_t, int, const char *, ...) ATTRIBUTE_GCC_DIAG(4,5); #endif -extern char *diagnostic_build_prefix (diagnostic_info *); +extern char *diagnostic_build_prefix (diagnostic_context *, diagnostic_info *); void default_diagnostic_starter (diagnostic_context *, diagnostic_info *); void default_diagnostic_finalizer (diagnostic_context *, diagnostic_info *); diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 37baa27..bdda623 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -426,7 +426,7 @@ lhd_print_error_function (diagnostic_context *context, const char *file, pp_newline (context->printer); if (s.file != NULL) { - if (flag_show_column) + if (context->show_column) pp_printf (context->printer, _(" inlined from %qs at %s:%d:%d"), identifier_to_locale (lang_hooks.decl_printable_name (fndecl, 2)), diff --git a/gcc/toplev.c b/gcc/toplev.c index fcd720d..9d3396b 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1827,6 +1827,11 @@ process_options (void) if (flag_compare_debug) diagnostic_inhibit_notes (global_dc); + global_dc->show_column = flag_show_column; + global_dc->pedantic_errors = flag_pedantic_errors; + global_dc->permissive = flag_permissive; + global_dc->fatal_errors = flag_fatal_errors; + if (flag_section_anchors && !target_supports_section_anchors_p ()) { warning (OPT_fsection_anchors, diff --git a/gcc/tree-diagnostic.c b/gcc/tree-diagnostic.c index 76fd129..b456a2a 100644 --- a/gcc/tree-diagnostic.c +++ b/gcc/tree-diagnostic.c @@ -44,5 +44,6 @@ default_tree_diagnostic_starter (diagnostic_context *context, diagnostic_info *diagnostic) { diagnostic_report_current_function (context, diagnostic); - pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic)); + pp_set_prefix (context->printer, diagnostic_build_prefix (context, + diagnostic)); } |