re PR fortran/44054 (Handle -Werror, -Werror=, -fdiagnostics-show-option, !GCC$ diagnostic (pragmas) and color)

gcc/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* diagnostic.c (default_diagnostic_finalizer): Move caret printing
	 to here ...
	(diagnostic_report_diagnostic): ... from here.
	* toplev.c (general_init): Move code to c-family.

gcc/cp/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* error.c (cp_diagnostic_finalizer): Delete.
	(init_error): Do not set diagnostic_finalizer here.

gcc/c-family/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* c-opts.c: Include tree-diagnostics.h.
	(c_diagnostic_finalizer): New.
	(c_common_initialize_diagnostics): Use it.

gcc/fortran/ChangeLog:

2014-08-21  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR fortran/44054
	* error.c (gfc_diagnostic_finalizer): Call default finalizer.

From-SVN: r214245
This commit is contained in:
Manuel López-Ibáñez 2014-08-20 23:07:29 +00:00
parent 22e6bd6f6c
commit 18767f6502
9 changed files with 50 additions and 23 deletions

View File

@ -1,3 +1,11 @@
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* diagnostic.c (default_diagnostic_finalizer): Move caret printing
to here ...
(diagnostic_report_diagnostic): ... from here.
* toplev.c (general_init): Move code to c-family.
2014-08-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
* df.h (web_entry_base): Replace existing struct web_entry with a

View File

@ -1,3 +1,10 @@
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* c-opts.c: Include tree-diagnostics.h.
(c_diagnostic_finalizer): New.
(c_common_initialize_diagnostics): Use it.
2014-08-20 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR preprocessor/51303

View File

@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see
#include "toplev.h"
#include "langhooks.h"
#include "diagnostic.h"
#include "tree-diagnostic.h" /* for virt_loc_aware_diagnostic_finalizer */
#include "intl.h"
#include "cppdefault.h"
#include "incpath.h"
@ -164,6 +165,19 @@ c_common_option_lang_mask (void)
return lang_flags[c_language];
}
/* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */
static void
c_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic)
{
diagnostic_show_locus (context, diagnostic);
/* By default print macro expansion contexts in the diagnostic
finalizer -- for tokens resulting from macro expansion. */
virt_loc_aware_diagnostic_finalizer (context, diagnostic);
pp_destroy_prefix (context->printer);
pp_newline_and_flush (context->printer);
}
/* Common diagnostics initialization. */
void
c_common_initialize_diagnostics (diagnostic_context *context)
@ -179,7 +193,7 @@ c_common_initialize_diagnostics (diagnostic_context *context)
diagnostic message. */
diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
}
diagnostic_finalizer (context) = c_diagnostic_finalizer;
context->opt_permissive = OPT_fpermissive;
}

View File

@ -1,3 +1,9 @@
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* error.c (cp_diagnostic_finalizer): Delete.
(init_error): Do not set diagnostic_finalizer here.
2014-08-19 Marek Polacek <polacek@redhat.com>
PR c++/62153

View File

@ -99,7 +99,6 @@ static void print_instantiation_partial_context (diagnostic_context *,
struct tinst_level *,
location_t);
static void cp_diagnostic_starter (diagnostic_context *, diagnostic_info *);
static void cp_diagnostic_finalizer (diagnostic_context *, diagnostic_info *);
static void cp_print_error_function (diagnostic_context *, diagnostic_info *);
static bool cp_printer (pretty_printer *, text_info *, const char *,
@ -109,7 +108,7 @@ void
init_error (void)
{
diagnostic_starter (global_dc) = cp_diagnostic_starter;
diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
/* diagnostic_finalizer is already c_diagnostic_finalizer. */
diagnostic_format_decoder (global_dc) = cp_printer;
new (cxx_pp) cxx_pretty_printer ();
@ -3041,14 +3040,6 @@ cp_diagnostic_starter (diagnostic_context *context,
diagnostic));
}
static void
cp_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic)
{
virt_loc_aware_diagnostic_finalizer (context, diagnostic);
pp_destroy_prefix (context->printer);
}
/* Print current function onto BUFFER, in the process of reporting
a diagnostic message. Called from cp_diagnostic_starter. */
static void

View File

@ -554,9 +554,12 @@ default_diagnostic_starter (diagnostic_context *context,
}
void
default_diagnostic_finalizer (diagnostic_context *context ATTRIBUTE_UNUSED,
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
default_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic)
{
diagnostic_show_locus (context, diagnostic);
pp_destroy_prefix (context->printer);
pp_newline_and_flush (context->printer);
}
/* Interface to specify diagnostic kind overrides. Returns the
@ -805,10 +808,7 @@ diagnostic_report_diagnostic (diagnostic_context *context,
pp_format (context->printer, &diagnostic->message);
(*diagnostic_starter (context)) (context, diagnostic);
pp_output_formatted_text (context->printer);
diagnostic_show_locus (context, diagnostic);
(*diagnostic_finalizer (context)) (context, diagnostic);
pp_destroy_prefix (context->printer);
pp_newline_and_flush (context->printer);
diagnostic_action_after_output (context, diagnostic);
diagnostic->message.format_spec = saved_format_spec;
diagnostic->x_data = NULL;

View File

@ -1,3 +1,8 @@
2014-08-21 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/44054
* error.c (gfc_diagnostic_finalizer): Call default finalizer.
2014-08-20 Joost VandeVondele <Joost.VandeVondele@mat.ethz.ch>
* options.c (gfc_init_options_struct): assert that the frontend sets

View File

@ -1016,9 +1016,10 @@ gfc_diagnostic_starter (diagnostic_context *context,
}
static void
gfc_diagnostic_finalizer (diagnostic_context *context ATTRIBUTE_UNUSED,
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
gfc_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic)
{
default_diagnostic_finalizer(context, diagnostic);
}
/* Give a warning about the command-line. */

View File

@ -1115,11 +1115,6 @@ general_init (const char *argv0)
/* Set a default printer. Language specific initializations will
override it later. */
tree_diagnostics_defaults (global_dc);
/* FIXME: This should probably be moved to C-family
language-specific initializations. */
/* By default print macro expansion contexts in the diagnostic
finalizer -- for tokens resulting from macro expansion. */
diagnostic_finalizer (global_dc) = virt_loc_aware_diagnostic_finalizer;
global_dc->show_caret
= global_options_init.x_flag_diagnostics_show_caret;