Patchwork [rft] Don't mess with debug_hooks in objc

login
register
mail settings
Submitter Steven Bosscher
Date July 14, 2012, 7:21 p.m.
Message ID <CABu31nN-LmGc8oYNAwEtPmUX7snoM_+RLevkMSa8pVqtYe+haA@mail.gmail.com>
Download mbox | patch
Permalink /patch/171014/
State New
Headers show

Comments

Steven Bosscher - July 14, 2012, 7:21 p.m.
Hello,

There is code in objc-act.c to save and restore debug hooks to work
around a problem with the C front end.

The C front end calls debug hooks before they have been initialized.
This is a problem for dbxout, so there is code in dbxout.c to handle
the problem, see dbxout.c:preinit_symbols. This work-around code was
introduced in r77730.

In parallel, Apple was working on the big ObjC/ObjC++ merge (r87168),
and apparently they worked around the same problem all over again.
That look unnecessary to me.

Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk?

Ciao!
Steven


objc/
        * objc-act.c: Do not include debug.h.
        (synth_module_prologue): Do not save/restore write_symbols
        and debug_hooks.
Mike Stump - July 16, 2012, 4:35 p.m.
On Jul 14, 2012, at 12:21 PM, Steven Bosscher wrote:
> There is code in objc-act.c to save and restore debug hooks to work
> around a problem with the C front end.

> OK for trunk?

Ok.  [ Thanks for waiting, I wanted to ponder this for a day or two... ]

Patch

Index: objc/objc-act.c
===================================================================
--- objc/objc-act.c     (revision 189469)
+++ objc/objc-act.c     (working copy)
@@ -45,7 +45,6 @@  along with GCC; see the file COPYING3.
 #include "function.h"
 #include "toplev.h"
 #include "ggc.h"
-#include "debug.h"
 #include "c-family/c-target.h"
 #include "diagnostic-core.h"
 #include "intl.h"
@@ -2904,13 +2903,6 @@  static void
 synth_module_prologue (void)
 {
   tree type;
-  enum debug_info_type save_write_symbols = write_symbols;
-  const struct gcc_debug_hooks *const save_hooks = debug_hooks;
-
-  /* Suppress outputting debug symbols, because
-     dbxout_init hasn't been called yet.  */
-  write_symbols = NO_DEBUG;
-  debug_hooks = &do_nothing_debug_hooks;

 #ifdef OBJCPLUS
   push_lang_context (lang_name_c); /* extern "C" */
@@ -2997,9 +2989,6 @@  synth_module_prologue (void)
 #ifdef OBJCPLUS
   pop_lang_context ();
 #endif
-
-  write_symbols = save_write_symbols;
-  debug_hooks = save_hooks;
 }

 /* --- const strings --- */