This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Re: gtk-peer compile fixes for gcc-2.95


Hi,

On Mon, 2004-04-05 at 19:43, Tom Tromey wrote:
> >>>>> "Mark" == Mark Wielaard <mark@klomp.org> writes:
> 
> Mark> The attached patch does that and enables -Wall for GNU Classpath.
> 
> Nice.  I skimmed it and it generally looks fine to me.
> 
> Mark> It fixes all issues found when compiling with -std=c89. Lots in the gtk
> Mark> peers I am afraid. So please yell and scream if this is to intrusive. It
> Mark> would be good if the gtk-peer stuff in libgcj was also compiled with
> Mark> this flag.
> 
> I think it is a requirement, not just nice to have.  Otherwise we're
> going to end up reintroducing code that isn't C89.
> 
> Here's an untested patch for the GUI branch.
> 
> from  Tom Tromey  <tromey@redhat.com>
> 
> 	* Makefile.am (WARNINGS): Added -std=c89.

Thanks for that.

Here is the gtk+ peer part of my patch.
I'll commit this to classpath now.
Could someone commit it to libgcj mainline and/or gui?
(I only have a 3.4 branch checkout on my development machine at the
moment.)

I want to test the other part of my patch first more carefully before
committing to classpath and enabling -std=c89

2004-04-07  Mark Wielaard  <mark@klomp.org>
                                                                                
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c:
        Changed C++ comments into C comments. Removed commented out code.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c:
        Likewise.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c:
        Likewise.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c:
        Likewise.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c:
        Likewise.
        * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c:
        Likewise.
        * native/jni/gtk-peer/gthread-jni.c:
        Likewise.

Cheers,

Mark
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c,v
retrieving revision 1.10
diff -u -r1.10 gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c	29 Mar 2004 07:07:26 -0000	1.10
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtkcheckboxpeer.c -- Native implementation of GtkCheckboxPeer
-   Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -230,7 +230,6 @@
 static void
 item_toggled (GtkToggleButton *item, jobject peer)
 {
-  //g_print ("toggled\n");
   (*gdk_env)->CallVoidMethod (gdk_env, peer,
 			      postItemEventID,
 			      peer,
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c,v
retrieving revision 1.23
diff -u -r1.23 gnu_java_awt_peer_gtk_GtkComponentPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c	29 Mar 2004 07:07:26 -0000	1.23
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtkcomponentpeer.c -- Native implementation of GtkComponentPeer
-   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -610,10 +610,12 @@
 gboolean
 filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
 {
-  // Prevent the default event handler from getting this signal if applicable
-  // FIXME: I came up with these filters by looking for patterns in the unwanted
-  //        expose events that are fed back to us from gtk/X. Perhaps there is
-  //        a way to prevent them from occuring in the first place.
+  /*
+   * Prevent the default event handler from getting this signal if applicable
+   * FIXME: I came up with these filters by looking for patterns in the unwanted
+   *        expose events that are fed back to us from gtk/X. Perhaps there is
+   *        a way to prevent them from occuring in the first place.
+   */
   if (event->type == GDK_EXPOSE && (!GTK_IS_LAYOUT(widget)
                                     || event->any.window != widget->window))
     {
@@ -622,8 +624,8 @@
     }
   else
     {
-      // There may be non-expose events that are triggered while we're
-      // painting a heavyweight peer.
+      /* There may be non-expose events that are triggered while we're
+        painting a heavyweight peer. */
       return pre_event_handler(widget, event, peer);
     }
 }
@@ -641,8 +643,8 @@
 
   gdk_threads_enter ();
 
-  // GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
-  // Events go to the GtkLayout layer, so we filter them there.
+  /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
+     Events go to the GtkLayout layer, so we filter them there. */
   if (GTK_IS_WINDOW(ptr))
     {
       children = gtk_container_get_children(GTK_CONTAINER(ptr));
@@ -685,8 +687,8 @@
 
   gdk_threads_enter ();
 
-  // GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
-  // Events go to the GtkLayout layer, so we filter them there.
+  /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
+     Events go to the GtkLayout layer, so we filter them there. */
   if (GTK_IS_WINDOW(ptr))
     {
       children = gtk_container_get_children(GTK_CONTAINER(ptr));
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c,v
retrieving revision 1.24
diff -u -r1.24 gnu_java_awt_peer_gtk_GtkEvents.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c	29 Mar 2004 07:07:26 -0000	1.24
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtkevents.c -- GDK/GTK event handlers
-   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -934,9 +934,9 @@
 				    click_count,
 				    JNI_FALSE);
 
-	// Generate an AWT click event only if the release occured in the
-	// window it was pressed in, and the mouse has not been dragged since
-	// the last time it was pressed.
+	/* Generate an AWT click event only if the release occured in the
+	   window it was pressed in, and the mouse has not been dragged since
+	   the last time it was pressed. */
 	gdk_window_get_size (event->any.window, &width, &height);
 	if (! hasBeenDragged
 	    && event->button.x >= 0
@@ -1038,11 +1038,11 @@
       break;
     case GDK_EXPOSE:
       {
-        // This filters out unwanted feedback expose events from gtk/X
-        // when we explictly invalidate and update heavyweight components,
-        // thus avoiding an infinite loop.
-        // FIXME: I'm not quite sure why we're getting these expose events. 
-        //        Maybe there is a way to avoid them?
+        /* This filters out unwanted feedback expose events from gtk/X
+           when we explictly invalidate and update heavyweight components,
+           thus avoiding an infinite loop.
+           FIXME: I'm not quite sure why we're getting these expose events. 
+                  Maybe there is a way to avoid them? */
         if((event->any.window == widget->window && event->any.send_event)
            || GTK_IS_LAYOUT(widget))
           {
@@ -1181,7 +1181,6 @@
 			 | GDK_KEY_PRESS_MASK
 			 | GDK_FOCUS_CHANGE_MASK);
 
-  //  g_print("storing obj %p property on window %p\n", obj, window);
   gdk_property_change (window,
 		       addr_atom,
 		       type_atom,
@@ -1196,10 +1195,8 @@
 {
   va_list ap;
   jobject *obj;
-  //void *ptr = NSA_GET_PTR (env, peer_obj);
 
   obj = NSA_GET_GLOBAL_REF (env, peer_obj);
-  //g_print("Connection obj %s\n", gtk_widget_get_name (GTK_WIDGET (ptr)));
   g_assert (obj);
 
   va_start (ap, nwindows);
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c,v
retrieving revision 1.9
diff -u -r1.9 gnu_java_awt_peer_gtk_GtkFileDialogPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c	29 Mar 2004 07:07:27 -0000	1.9
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFileDialogPeer.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtkfiledialogpeer.c -- Native implementation of GtkFileDialogPeer
-   Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -156,7 +156,7 @@
   static jmethodID disposeID;
   void *ptr;
 
-  // We only need this for the case when the user closed the window
+  /* We only need this for the case when the user closed the window. */
   if (responseId != GTK_RESPONSE_DELETE_EVENT)
     return;
 
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c,v
retrieving revision 1.10
diff -u -r1.10 gnu_java_awt_peer_gtk_GtkListPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c	29 Mar 2004 07:07:27 -0000	1.10
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtklistpeer.c -- Native implementation of GtkListPeer
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -324,7 +324,6 @@
 	     GdkEventButton *event __attribute__((unused)), 
 	     jobject peer_obj)
 {
-  //g_print ("select_row\n");
   (*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
 			      postListItemEventID,
 			      row,
@@ -338,7 +337,6 @@
 	       GdkEventButton *event __attribute__((unused)),
 	       jobject peer_obj)
 {
-  //g_print ("unselect_row\n");
   (*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
 			      postListItemEventID,
 			      row,
Index: native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c,v
retrieving revision 1.13
diff -u -r1.13 gnu_java_awt_peer_gtk_GtkTextComponentPeer.c
--- native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c	29 Mar 2004 07:07:27 -0000	1.13
+++ native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextComponentPeer.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gtktextcomponentpeer.c -- Native implementation of GtkTextComponentPeer
-   Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -112,8 +112,8 @@
 {
   void *ptr;
   int pos = 0;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextMark *mark;
   GtkTextIter iter;
@@ -157,8 +157,8 @@
   (JNIEnv *env, jobject obj, jint pos)
 {
   void *ptr;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextIter iter;
 
@@ -198,8 +198,8 @@
 {
   void *ptr;
   int pos = 0;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextIter start;
   GtkTextIter end;
@@ -255,8 +255,8 @@
 {
   void *ptr;
   int pos = 0;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextIter start;
   GtkTextIter end;
@@ -311,8 +311,8 @@
   (JNIEnv *env, jobject obj, jint start, jint end)
 {
   void *ptr;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextIter iter;
 
@@ -357,8 +357,8 @@
   (JNIEnv *env, jobject obj, jboolean state)
 {
   void *ptr;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
 
   ptr = NSA_GET_PTR (env, obj);
 
@@ -396,8 +396,8 @@
   void *ptr;
   char *contents = NULL;
   jstring jcontents;
-  GtkEditable *editable;    // type of GtkEntry    (TextField)
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkEditable *editable;    /* type of GtkEntry    (TextField) */
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
   GtkTextIter start, end;
 
@@ -444,7 +444,7 @@
 {
   void *ptr;
   const char *str;
-  GtkWidget *text = NULL;   // type of GtkTextView (TextArea)
+  GtkWidget *text = NULL;   /* type of GtkTextView (TextArea) */
   GtkTextBuffer *buf;
 
   ptr = NSA_GET_PTR (env, obj);
Index: native/jni/gtk-peer/gthread-jni.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/gtk-peer/gthread-jni.c,v
retrieving revision 1.8
diff -u -r1.8 gthread-jni.c
--- native/jni/gtk-peer/gthread-jni.c	29 Mar 2004 07:07:27 -0000	1.8
+++ native/jni/gtk-peer/gthread-jni.c	7 Apr 2004 20:21:55 -0000
@@ -1,5 +1,5 @@
 /* gthread-jni.c -- JNI threading routines for GLIB
-   Copyright (C) 1998 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -204,7 +204,7 @@
 static gboolean g_mutex_trylock_jni_impl
   (GMutex *mutex __attribute__((unused)))
 {
-  // Shall we implement this in a JikesRVM-specific way under a flag?
+  /* XXX Shall we implement this in a VM-specific way under a flag? */
   return FALSE;
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part


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