This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/RFC] observer tests & GCC 3.4


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?

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* 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.

Index: observer.c
===================================================================
RCS file: /cvs/src/src/gdb/observer.c,v
retrieving revision 1.3
diff -u -p -r1.3 observer.c
--- observer.c 18 Mar 2003 18:05:50 -0000 1.3
+++ observer.c 11 Dec 2003 13:52:40 -0000
@@ -191,30 +191,30 @@ observer_notify_normal_stop (void)
   generic_observer_notify (normal_stop_subject, NULL);
 }
 
-/* The following code is only used to unit-test the observers from
-   our testsuite.  DO NOT USE IT within observer.c!  */
+/* The following code is only used to unit-test the observers from our
+   testsuite.  DO NOT USE IT within observer.c (or anywhere else for
+   that matter)!  */
 
-/* Since this code will not be used within GDB, it will trigger
-   a warning if we decide to compile with -Wunused-function.
-   This is ok for now.  (brobecker 2003-03-18)  */
+/* If we define these variables and functions as `static', the
+   compiler will optimize them out.  */
  
-static int observer_test_first_observer = 0;
-static int observer_test_second_observer = 0;
-static int observer_test_third_observer = 0;
+int observer_test_first_observer = 0;
+int observer_test_second_observer = 0;
+int observer_test_third_observer = 0;
 
-static void
+void
 observer_test_first_notification_function (void)
 {
   observer_test_first_observer++;
 }
 
-static void
+void
 observer_test_second_notification_function (void)
 {
   observer_test_second_observer++;
 }
 
-static void
+void
 observer_test_third_notification_function (void)
 {
   observer_test_third_observer++;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]