diff src/device-x.c @ 4528:726060ee587c g++-warning-removal-2008-10-28

First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
author Stephen J. Turnbull <stephen@xemacs.org>
date Wed, 29 Oct 2008 04:06:33 +0900
parents fc7067b7f407
children b0d2ace4aed1
line wrap: on
line diff
--- a/src/device-x.c	Wed Oct 29 04:02:05 2008 +0900
+++ b/src/device-x.c	Wed Oct 29 04:06:33 2008 +0900
@@ -79,29 +79,33 @@
 
 Lisp_Object Vx_initial_argv_list; /* #### ugh! */
 
+/* Shut up G++ 4.3. */
+#define Xrm_ODR(option,resource,type,default) \
+  { (String) option, (String) resource, type, default }
+
 static XrmOptionDescRec emacs_options[] =
 {
-  {"-geometry", ".geometry", XrmoptionSepArg, NULL},
-  {"-iconic", ".iconic", XrmoptionNoArg, "yes"},
+  Xrm_ODR ("-geometry", ".geometry", XrmoptionSepArg, NULL),
+  Xrm_ODR ("-iconic", ".iconic", XrmoptionNoArg, (String) "yes"),
 
-  {"-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
-  {"-ib",                    "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL},
-  {"-scrollbar-width",       "*EmacsFrame.scrollBarWidth",      XrmoptionSepArg, NULL},
-  {"-scrollbar-height",      "*EmacsFrame.scrollBarHeight",     XrmoptionSepArg, NULL},
+  Xrm_ODR ("-internal-border-width", "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL),
+  Xrm_ODR ("-ib",                    "*EmacsFrame.internalBorderWidth", XrmoptionSepArg, NULL),
+  Xrm_ODR ("-scrollbar-width",       "*EmacsFrame.scrollBarWidth",      XrmoptionSepArg, NULL),
+  Xrm_ODR ("-scrollbar-height",      "*EmacsFrame.scrollBarHeight",     XrmoptionSepArg, NULL),
 
-  {"-privatecolormap", ".privateColormap", XrmoptionNoArg,  "yes"},
-  {"-visual",   ".EmacsVisual",	    XrmoptionSepArg, NULL},
+  Xrm_ODR ("-privatecolormap", ".privateColormap", XrmoptionNoArg,  (String) "yes"),
+  Xrm_ODR ("-visual",   ".EmacsVisual",	    XrmoptionSepArg, NULL),
 
   /* #### Beware!  If the type of the shell changes, update this. */
-  {"-T",        "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL},
-  {"-wn",       "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL},
-  {"-title",    "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL},
+  Xrm_ODR ("-T",        "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL),
+  Xrm_ODR ("-wn",       "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL),
+  Xrm_ODR ("-title",    "*TopLevelEmacsShell.title",    XrmoptionSepArg, NULL),
 
-  {"-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
-  {"-in",       "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL},
-  {"-mc",       "*pointerColor",                XrmoptionSepArg, NULL},
-  {"-cr",       "*cursorColor",                 XrmoptionSepArg, NULL},
-  {"-fontset",  "*FontSet",                     XrmoptionSepArg, NULL},
+  Xrm_ODR ("-iconname", "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL),
+  Xrm_ODR ("-in",       "*TopLevelEmacsShell.iconName", XrmoptionSepArg, NULL),
+  Xrm_ODR ("-mc",       "*pointerColor",                XrmoptionSepArg, NULL),
+  Xrm_ODR ("-cr",       "*cursorColor",                 XrmoptionSepArg, NULL),
+  Xrm_ODR ("-fontset",  "*FontSet",                     XrmoptionSepArg, NULL),
 };
 
 static const struct memory_description x_device_data_description_1 [] = {
@@ -329,7 +333,7 @@
   if (argc > 0 && argv[0] && *argv[0])
     return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0];
 
-  return "xemacs";
+  return (Extbyte *) "xemacs";	/* shut up g++ 4.3 */
 }
 
 /*
@@ -343,7 +347,7 @@
 static int
 have_xemacs_resources_in_xrdb (Display *dpy)
 {
-  char *xdefs, *key;
+  const char *xdefs, *key;
   int len;
 
 #ifdef INFODOCK
@@ -688,9 +692,9 @@
        does not override resources defined elsewhere */
     const Extbyte *data_dir;
     Extbyte *path;
-    Extbyte *format;
+    const Extbyte *format;
     XrmDatabase db = XtDatabase (dpy); /* #### XtScreenDatabase(dpy) ? */
-    Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db));
+    const Extbyte *locale = xstrdup (XrmLocaleOfDatabase (db));
     Extbyte *locale_end;
 
     if (STRINGP (Vx_app_defaults_directory) &&
@@ -739,7 +743,11 @@
     }
 
   no_data_directory:
-    xfree (locale, Extbyte*);
+    {
+      /* Cast off const for G++ 4.3. */
+      Extbyte *temp = (Extbyte *) locale;
+      xfree (temp, Extbyte*);
+    }
  }
 #endif /* MULE */
 
@@ -861,9 +869,9 @@
      be the place.  Make sure it doesn't conflict with GNOME. */
   {
     Arg al[3];
-    XtSetArg (al[0], XtNvisual,   visual);
-    XtSetArg (al[1], XtNdepth,    depth);
-    XtSetArg (al[2], XtNcolormap, cmap);
+    Xt_SET_ARG (al[0], XtNvisual,   visual);
+    Xt_SET_ARG (al[1], XtNdepth,    depth);
+    Xt_SET_ARG (al[2], XtNcolormap, cmap);
 
     app_shell = XtAppCreateShell (NULL, app_class,
 				  applicationShellWidgetClass,
@@ -880,11 +888,13 @@
      and set it to the size of the root window for child placement purposes */
   {
     Arg al[5];
-    XtSetArg (al[0], XtNmappedWhenManaged, False);
-    XtSetArg (al[1], XtNx, 0);
-    XtSetArg (al[2], XtNy, 0);
-    XtSetArg (al[3], XtNwidth,  WidthOfScreen  (ScreenOfDisplay (dpy, screen)));
-    XtSetArg (al[4], XtNheight, HeightOfScreen (ScreenOfDisplay (dpy, screen)));
+    Xt_SET_ARG (al[0], XtNmappedWhenManaged, False);
+    Xt_SET_ARG (al[1], XtNx, 0);
+    Xt_SET_ARG (al[2], XtNy, 0);
+    Xt_SET_ARG (al[3], XtNwidth,
+		WidthOfScreen  (ScreenOfDisplay (dpy, screen)));
+    Xt_SET_ARG (al[4], XtNheight,
+		HeightOfScreen (ScreenOfDisplay (dpy, screen)));
     XtSetValues (app_shell, al, countof (al));
     XtRealizeWidget (app_shell);
   }