+2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/53061
+ * doc/invoke.texi (fmessage-length): Update text to match reality.
+
2014-10-26 Richard Sandiford <richard.sandiford@arm.com>
* config/microblaze/microblaze.c: Include rtl-iter.h.
+2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/53061
+ * c-opts.c (c_common_diagnostics_set_defaults): Renamed from
+ c_common_initialize_diagnostics.
+ * c-common.h: Likewise.
+
2014-10-24 Marek Polacek <polacek@redhat.com>
PR c/56980
extern const unsigned int c_family_lang_mask;
extern unsigned int c_common_option_lang_mask (void);
-extern void c_common_initialize_diagnostics (diagnostic_context *);
+extern void c_common_diagnostics_set_defaults (diagnostic_context *);
extern bool c_common_complain_wrong_lang_p (const struct cl_option *);
extern void c_common_init_options_struct (struct gcc_options *);
extern void c_common_init_options (unsigned int, struct cl_decoded_option *);
pp_newline_and_flush (context->printer);
}
-/* Common diagnostics initialization. */
+/* Common default settings for diagnostics. */
void
-c_common_initialize_diagnostics (diagnostic_context *context)
+c_common_diagnostics_set_defaults (diagnostic_context *context)
{
- /* This is conditionalized only because that is the way the front
- ends used to do it. Maybe this should be unconditional? */
- if (c_dialect_cxx ())
- {
- /* By default wrap lines at 80 characters. Is getenv
- ("COLUMNS") preferable? */
- diagnostic_line_cutoff (context) = 80;
- /* By default, emit location information once for every
- diagnostic message. */
- diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
- }
diagnostic_finalizer (context) = c_diagnostic_finalizer;
context->opt_permissive = OPT_fpermissive;
}
+2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/53061
+ * c-objc-common.c (c_objc_common_init): Do not do diagnostics
+ initialization here...
+ (c_initialize_diagnostics): ... but here. Set defaults after
+ building pretty-printer.
+
2014-10-23 Marek Polacek <polacek@redhat.com>
PR c/63626
{
c_init_decl_processing ();
- if (c_common_init () == false)
- return false;
-
- /* These were not defined in the Objective-C front end, but I'm
- putting them here anyway. The diagnostic format decoder might
- want an enhanced ObjC implementation. */
- diagnostic_format_decoder (global_dc) = &c_tree_printer;
-
- return true;
+ return c_common_init ();
}
/* Called during diagnostic message formatting process to print a
void
c_initialize_diagnostics (diagnostic_context *context)
{
- c_common_initialize_diagnostics (context);
-
pretty_printer *base = context->printer;
c_pretty_printer *pp = XNEW (c_pretty_printer);
context->printer = new (pp) c_pretty_printer ();
/* It is safe to free this object because it was previously XNEW()'d. */
base->~pretty_printer ();
XDELETE (base);
+
+ c_common_diagnostics_set_defaults (context);
+ diagnostic_format_decoder (context) = &c_tree_printer;
}
int
+2014-10-26 Manuel López-Ibáñez <manu@gcc.gnu.org>
+
+ PR c++/53061
+ * cp-objcp-common.c: Do not include new.
+ (cxx_initialize_diagnostics): Move from here to ...
+ * error.c (cxx_initialize_diagnostics): : ... here. Move
+ diagnostics initialization here from init_error.
+ (cxx_pp): Use a real pointer not a macro.
+ (init_error): Just initialize cxx_pp.
+ * cxx-pretty-print.c (cxx_pretty_printer::cxx_pretty_printer): Do
+ not set maximum line length.
+
2014-10-23 Jonathan Wakely <jwakely@redhat.com>
PR c++/63619
#include "cxx-pretty-print.h"
#include "cp-objcp-common.h"
-#include <new> // For placement new.
-
/* Special routine to get the alias set for C++. */
alias_set_type
return false;
}
-/* Construct a C++-aware pretty-printer for CONTEXT. It is assumed
- that CONTEXT->printer is an already constructed basic pretty_printer. */
-void
-cxx_initialize_diagnostics (diagnostic_context *context)
-{
- c_common_initialize_diagnostics (context);
-
- pretty_printer *base = context->printer;
- cxx_pretty_printer *pp = XNEW (cxx_pretty_printer);
- context->printer = new (pp) cxx_pretty_printer ();
-
- /* It is safe to free this object because it was previously XNEW()'d. */
- base->~pretty_printer ();
- XDELETE (base);
-}
-
/* This compares two types for equivalence ("compatible" in C-based languages).
This routine should only return 1 if it is sure. It should not be used
in contexts where erroneously returning 0 causes problems. */
: c_pretty_printer (),
enclosing_scope (global_namespace)
{
- pp_set_line_maximum_length (this, 0);
-
type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
}
#define pp_separate_with_comma(PP) pp_cxx_separate_with (PP, ',')
#define pp_separate_with_semicolon(PP) pp_cxx_separate_with (PP, ';')
-/* The global buffer where we dump everything. It is there only for
- transitional purpose. It is expected, in the near future, to be
- completely removed. */
+/* cxx_pp is a C++ front-end-specific pretty printer: this is where we
+ dump C++ ASTs as strings. It is mostly used only by the various
+ tree -> string functions that are occasionally called from the
+ debugger or by the front-end for things like
+ __PRETTY_FUNCTION__. */
static cxx_pretty_printer scratch_pretty_printer;
-#define cxx_pp (&scratch_pretty_printer)
+static cxx_pretty_printer * cxx_pp = &scratch_pretty_printer;
/* Translate if being used for diagnostics, but not for dump files or
__PRETTY_FUNCTION. */
static bool cp_printer (pretty_printer *, text_info *, const char *,
int, bool, bool, bool);
+/* CONTEXT->printer is a basic pretty printer that was constructed
+ presumably by diagnostic_initialize(), called early in the
+ compiler's initialization process (in general_init) Before the FE
+ is initialized. This (C++) FE-specific diagnostic initializer is
+ thus replacing the basic pretty printer with one that has C++-aware
+ capacities. */
+
void
-init_error (void)
+cxx_initialize_diagnostics (diagnostic_context *context)
{
- diagnostic_starter (global_dc) = cp_diagnostic_starter;
+ pretty_printer *base = context->printer;
+ cxx_pretty_printer *pp = XNEW (cxx_pretty_printer);
+ context->printer = new (pp) cxx_pretty_printer ();
+
+ /* It is safe to free this object because it was previously XNEW()'d. */
+ base->~pretty_printer ();
+ XDELETE (base);
+
+ c_common_diagnostics_set_defaults (context);
+ diagnostic_starter (context) = cp_diagnostic_starter;
/* diagnostic_finalizer is already c_diagnostic_finalizer. */
- diagnostic_format_decoder (global_dc) = cp_printer;
+ diagnostic_format_decoder (context) = cp_printer;
+}
+/* Initialize the global cxx_pp that is used as the memory store for
+ the string representation of C++ AST. See the description of
+ cxx_pp above. */
+
+void
+init_error (void)
+{
new (cxx_pp) cxx_pretty_printer ();
}
@table @gcctabopt
@item -fmessage-length=@var{n}
@opindex fmessage-length
-Try to format error messages so that they fit on lines of about @var{n}
-characters. The default is 72 characters for @command{g++} and 0 for the rest of
-the front ends supported by GCC@. If @var{n} is zero, then no
-line-wrapping is done; each error message appears on a single
-line.
+Try to format error messages so that they fit on lines of about
+@var{n} characters. If @var{n} is zero, then no line-wrapping will be
+done; each error message will appear on a single line. This is the
+default for all front ends.
@item -fdiagnostics-show-location=once
@opindex fdiagnostics-show-location