Compilation errors on Solaris 2.5.1 & patch...
- From: calex engin umich edu (Chuck Alexander)
- To: gtk-list redhat com
- Subject: Compilation errors on Solaris 2.5.1 & patch...
- Date: Tue, 2 Dec 1997 17:49:59 -0500 (EST)
Hi, gtk'ers...
While building gtk+-971201 on a Solaris 2.5.1 system I ran in to a couple
problems in gdk and gtk. They both caused fatal errors when using Sun's
Pro compiler. With an old (2.4.5) gcc, they both caused warnings to be
issued but compiled anyway. A patch follws, but first the explanations.
The patch is against gtk+-971201.
1) gtk/gtkwidget.c contains these lines:
#include "gtkcontainer.h"
#include "gtkmain.h"
#include "gtkrc.h"
#include "gtkselection.h"
#include "gtksignal.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
#include "gdk/gdk.h"
#include "gdk/gdkx.h"
gdk/gdk.h, which is also included with many of the gtk*.h's, includes
gdktypes.h, which does this:
#ifndef _XLIB_H_
#define XEvent void
#endif
And never undef's the XEvent. But then gdk/gdkx.h includes gdkprivate.h,
which includes X11/Xlib.h, which wants to do this:
typedef union _XEvent {
/* Lotsa union components */
} XEvent;
Which is screwed up by the previous XEvent define in gdk/gdktypes.h.
FYI, when Sun's pro compiler gets to this line in Xlib.h, it dies with this
error:
"/usr/openwin/include/X11/Xlib.h", line 972: invalid type combination
"/usr/openwin/include/X11/Xlib.h", line 972: warning: typedef declares no type name
And gcc 2.4.5 complains thusly:
In file included from ../gdk/gdkprivate.h:22, from ../gdk/gdkx.h:21, from gtkwidget.c:28:
/usr/openwin/include/X11/Xlib.h:972: warning: useless keyword or type name in empty declaration
The following patch a) undef's XEvent after it's used in gdktypes.h (but
only if Xlib.h hasn't been processed), and b) changes the order of the gdk
includes in a few files to ensure that XEvent is defined when it's needed
in the first place.
2) gdk/gdk.c contains these lines (1757-1758):
GdkPoint foo = {xevent->xbutton.x_root,
xevent->xbutton.y_root};
This is a non-constant initializer which Sun's pro compiler can't handle
and gcc 2.4.5 complains about. The patch replaces these lines with:
GdkPoint foo;
foo.x = xevent->xbutton.x_root;
foo.y = xevent->xbutton.y_root;
I'm brand spankin' new to gtk and the gimp so I don't want to submit any
patches to the CVS tree. But if someone who knows what they're doing decides
the patch is OK, would you mind doing the honors?
- Chuck
*** gdk/gdktypes.h.orig Thu Nov 27 00:29:03 1997
--- gdk/gdktypes.h Tue Dec 2 15:08:18 1997
***************
*** 971,976 ****
--- 971,980 ----
XEvent *xevent;
};
+ #ifndef _XLIB_H_
+ #undef XEvent
+ #endif
+
union _GdkEvent
{
GdkEventType type;
*** gtk/gtkwidget.c.orig Fri Nov 28 14:30:51 1997
--- gtk/gtkwidget.c Tue Dec 2 15:03:09 1997
***************
*** 17,22 ****
--- 17,24 ----
*/
#include <stdarg.h>
#include <string.h>
+ #include "gdk/gdkx.h"
+ #include "gdk/gdk.h"
#include "gtkcontainer.h"
#include "gtkmain.h"
#include "gtkrc.h"
***************
*** 24,31 ****
#include "gtksignal.h"
#include "gtkwidget.h"
#include "gtkwindow.h"
- #include "gdk/gdk.h"
- #include "gdk/gdkx.h"
#define WIDGET_CLASS(w) GTK_WIDGET_CLASS (GTK_OBJECT (w)->klass)
--- 26,31 ----
*** gtk/gtkwindow.c.orig Fri Nov 28 14:30:52 1997
--- gtk/gtkwindow.c Tue Dec 2 14:47:33 1997
***************
*** 17,25 ****
*/
#include <string.h>
#include <limits.h>
#include "gdk/gdk.h"
#include "gdk/gdkkeysyms.h"
- #include "gdk/gdkx.h"
#include "gtksignal.h"
#include "gtkwindow.h"
--- 17,25 ----
*/
#include <string.h>
#include <limits.h>
+ #include "gdk/gdkx.h"
#include "gdk/gdk.h"
#include "gdk/gdkkeysyms.h"
#include "gtksignal.h"
#include "gtkwindow.h"
*** gtk/simple.c.orig Tue Nov 25 01:02:11 1997
--- gtk/simple.c Tue Dec 2 14:55:27 1997
***************
*** 1,5 ****
- #include <gtk/gtk.h>
#include <gdk/gdkprivate.h>
void
--- 1,5 ----
#include <gdk/gdkprivate.h>
+ #include <gtk/gtk.h>
void
*** gtk/testgtk.c.orig Tue Nov 25 01:02:15 1997
--- gtk/testgtk.c Tue Dec 2 14:49:59 1997
***************
*** 17,25 ****
*/
#include <stdio.h>
#include <stdlib.h>
- #include "gtk.h"
- #include "../gdk/gdk.h"
#include "../gdk/gdkx.h"
void
--- 17,25 ----
*/
#include <stdio.h>
#include <stdlib.h>
#include "../gdk/gdkx.h"
+ #include "../gdk/gdk.h"
+ #include "gtk.h"
void
*** gdk/gdk.c.orig Fri Nov 28 14:30:33 1997
--- gdk/gdk.c Tue Dec 2 15:27:29 1997
***************
*** 1754,1761 ****
{
if(gdk_dnd.drag_really)
{
! GdkPoint foo = {xevent->xbutton.x_root,
! xevent->xbutton.y_root};
XUngrabPointer(gdk_display, CurrentTime);
if(dnd_drag_target != None)
--- 1754,1762 ----
{
if(gdk_dnd.drag_really)
{
! GdkPoint foo;
! foo.x = xevent->xbutton.x_root;
! foo.y = xevent->xbutton.y_root;
XUngrabPointer(gdk_display, CurrentTime);
if(dnd_drag_target != None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]