[PATCH/RFC] observer tests & GCC 3.4
Thu Dec 11 14:24:00 GMT 2003
On Thu, Dec 11, 2003 at 09:14:16AM -0500, Joel Brobecker wrote:
> > The compiler is getting too smart for its own good again. At the end
> > of observer.c, we have a bit of code that used in the
> > gdb.gdb/observer.exp testcase. Since the variables and functions are
> > declared static, the compiler simply optimizes these out. The
> > attached patch fixes this. Objections?
> Humph. I don't know of any other way to stop GDB from optimizing
> them out, so no objection from me.
You can do it with GCC-isms (the appropriate one in this case is
__attribute__((__used__))), but I think that Mark's solution is a
better one in this case. Making them global ought to fix the problem
for good (since any compiler which supports shared objects will have to
export them, since something like libthread_db might use them).
> > Index: ChangeLog
> > from Mark Kettenis <email@example.com>
> > * observer.c (observer_test_first_observer,
> > observer_test_second_observer, observer_test_third_observer):
> > Don't define as `static'.
> > (observer_test_first_notification_function,
> > observer_test_second_notification_function,
> > observer_test_third_notification_function): Likewise.
MontaVista Software Debian GNU/Linux Developer
More information about the Gdb-patches