aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2014-10-26 21:21:58 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2014-10-26 21:21:58 +0000
commitd723bb7c757e0d7d94df7b059f52ad50a2175c50 (patch)
tree37cbb1525929f4ecbfc1d14e764c60d380839efd /gcc/c
parent23487675cd29d1702f44c9bc60885c1602a401f1 (diff)
downloadgcc-d723bb7c757e0d7d94df7b059f52ad50a2175c50.zip
gcc-d723bb7c757e0d7d94df7b059f52ad50a2175c50.tar.gz
gcc-d723bb7c757e0d7d94df7b059f52ad50a2175c50.tar.bz2
In cp/error.c...
In cp/error.c, I separate the initialization of the diagnostic context from the initialization of the scratch pretty-printer (cxx_pp). This was suggested by Gabriel in the last review of the patch and now I realize it was a good idea. Now cxx_initialize_diagnostics is the equivalent version of c_initialize_diagnostics. To avoid having to make extern a bunch of functions, I moved it from cp-objcp-common.c to error.c. I moved the setting of diagnostic_format_decoder (global_dc) = c_tree_printer, from c_objc_common_init to c_initialize_diagnostics, and right after c_common_diagnostics_set_defaults. This mimics what is done in cxx_initialize_diagnostics. Moreover, in both c_initialize_diagnostics and cxx_initialize_diagnostics, the FE-specific pretty-printer is initialized first and then other settings are applied. This does not make a difference right now, but if in the future one wishes to touch something in the pretty-printer, it will not get overriden immediately. In fact, the code I removed in c_common_initialize_diagnostics, which sets line_cutoff to 80, is useless because the pretty-printer created here is actually never used, but overriden by the FE-specific pretty-printers. This also means that doc/invoke.texi was wrong. Finally, it is useless to set the maximum line length to 0 in the constructor of cxx_pretty_printer. It is the default anyway. gcc/c/ChangeLog: 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. gcc/ChangeLog: 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. gcc/cp/ChangeLog: 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. gcc/c-family/ChangeLog: 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. From-SVN: r216720
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog8
-rw-r--r--gcc/c/c-objc-common.c15
2 files changed, 12 insertions, 11 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 9b6c1d5..35d9cee 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/gcc/c/c-objc-common.c b/gcc/c/c-objc-common.c
index 73bb297..12db548 100644
--- a/gcc/c/c-objc-common.c
+++ b/gcc/c/c-objc-common.c
@@ -62,15 +62,7 @@ c_objc_common_init (void)
{
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
@@ -186,8 +178,6 @@ has_c_linkage (const_tree decl ATTRIBUTE_UNUSED)
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 ();
@@ -195,6 +185,9 @@ c_initialize_diagnostics (diagnostic_context *context)
/* 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