[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ec16837: Tweak X toolkit code to pacify modern GCC
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master ec16837: Tweak X toolkit code to pacify modern GCC |
Date: |
Fri, 10 Mar 2017 12:32:05 -0500 (EST) |
branch: master
commit ec168376d1d961be9adceaafcbff04d5b2b0a492
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Tweak X toolkit code to pacify modern GCC
* lwlib/lwlib-Xaw.c, lwlib/lwlib-Xm.c, lwlib/lwlib.c:
Don’t include <stdlib.h>, since this code now calls emacs_abort
rather than abort.
* lwlib/lwlib-Xaw.c (make_dialog, xaw_generic_callback)
(wm_delete_window):
* lwlib/lwlib-Xm.c (make_menu_in_widget, do_call):
* lwlib/lwlib.c (instantiate_widget_instance, lw_make_widget):
* lwlib/xlwmenu.c (abort_gracefully, draw_separator)
(separator_height, XlwMenuInitialize):
Use emacs_abort, not abort. Without this change, some calls
to ‘abort’ were invalid, as stdlib.h was not always included.
* src/widget.c (resources, emacsFrameClassRec):
* src/xfns.c (x_window) [USE_X_TOOLKIT]:
* src/xmenu.c (create_and_show_popup_menu) [USE_X_TOOLKIT]:
* src/xterm.c (emacs_options) [USE_X_TOOLKIT}:
(x_term_init) [USE_X_TOOLKIT]:
Cast string constants to char * to pacify --enable-gcc-warnings.
---
lwlib/lwlib-Xaw.c | 19 +++++++++----------
lwlib/lwlib-Xm.c | 11 +++++------
lwlib/lwlib.c | 7 +++----
lwlib/xlwmenu.c | 8 ++++----
src/widget.c | 31 +++++++++++++++++--------------
src/xfns.c | 8 ++++----
src/xmenu.c | 2 +-
src/xterm.c | 35 ++++++++++++++++++-----------------
8 files changed, 61 insertions(+), 60 deletions(-)
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index af57a7f..ec33e78 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -21,7 +21,6 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
-#include <stdlib.h>
#include <setjmp.h>
#include <lisp.h>
@@ -516,10 +515,10 @@ make_dialog (char* name,
XtTranslations button_override;
#endif
- if (! pop_up_p) abort (); /* not implemented */
- if (text_input_slot) abort (); /* not implemented */
- if (radio_box) abort (); /* not implemented */
- if (list) abort (); /* not implemented */
+ if (! pop_up_p) emacs_abort (); /* not implemented */
+ if (text_input_slot) emacs_abort (); /* not implemented */
+ if (radio_box) emacs_abort (); /* not implemented */
+ if (list) emacs_abort (); /* not implemented */
if (! actions_initted)
{
@@ -764,7 +763,7 @@ xaw_generic_callback (Widget widget, XtPointer closure,
XtPointer call_data)
break;
val = val->next;
}
- if (! val) abort ();
+ if (! val) emacs_abort ();
user_data = val->call_data;
}
@@ -790,11 +789,11 @@ wm_delete_window (Widget w,
shell = w;
if (! XtIsSubclass (shell, shellWidgetClass))
- abort ();
+ emacs_abort ();
XtVaGetValues (shell, XtNnumChildren, &nkids, NULL);
XtVaGetValues (shell, XtNchildren, &kids, NULL);
if (!kids || !*kids)
- abort ();
+ emacs_abort ();
for (i = 0; i < nkids; i++)
{
widget = kids[i];
@@ -804,11 +803,11 @@ wm_delete_window (Widget w,
if (! widget) return;
id = lw_get_widget_id (widget);
- if (! id) abort ();
+ if (! id) emacs_abort ();
{
widget_info *info = lw_get_widget_info (id);
- if (! info) abort ();
+ if (! info) emacs_abort ();
if (info->selection_cb)
info->selection_cb (widget, id, (XtPointer) -1);
}
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 6e1e0d6..b184290 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -22,7 +22,6 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <stdio.h>
-#include <stdlib.h>
#include <setjmp.h>
#include <X11/StringDefs.h>
@@ -504,14 +503,14 @@ make_menu_in_widget (widget_instance* instance,
/* WIDGET should be a RowColumn. */
if (!XmIsRowColumn (widget))
- abort ();
+ emacs_abort ();
/* Determine whether WIDGET is a menu bar. */
type = -1;
XtSetArg (al[0], XmNrowColumnType, &type);
XtGetValues (widget, al, 1);
if (type != XmMENU_BAR && type != XmMENU_PULLDOWN && type != XmMENU_POPUP)
- abort ();
+ emacs_abort ();
menubar_p = type == XmMENU_BAR;
/* Add a callback to popups and pulldowns that is called when
@@ -528,7 +527,7 @@ make_menu_in_widget (widget_instance* instance,
/* Check that those are all we have
(the caller should have deleted the rest). */
if (old_num_children != keep_first_children)
- abort ();
+ emacs_abort ();
/* Create the rest. */
for (child_index = keep_first_children; cur; child_index++, cur = cur->next)
@@ -677,7 +676,7 @@ update_one_menu_entry (widget_instance* instance,
if (strcmp (XtName (widget_list[i]), XtName (widget)) == 0)
break;
if (i == old_num_children)
- abort ();
+ emacs_abort ();
if (XmIsCascadeButton (widget_list[i]))
{
menu = XmCreatePulldownMenu (parent, XtName(widget), NULL, 0);
@@ -1829,7 +1828,7 @@ do_call (Widget widget,
break;
default:
- abort ();
+ emacs_abort ();
}
}
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 18a4610..fffb17f 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see
<http://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <stdio.h>
-#include <stdlib.h>
#include "lwlib-int.h"
#include "lwlib-utils.h"
#include <X11/StringDefs.h>
@@ -721,13 +720,13 @@ instantiate_widget_instance (widget_instance *instance)
{
printf ("No creation function for widget type %s\n",
instance->info->type);
- abort ();
+ emacs_abort ();
}
instance->widget = (*function) (instance);
if (!instance->widget)
- abort ();
+ emacs_abort ();
/* XtRealizeWidget (instance->widget);*/
}
@@ -772,7 +771,7 @@ lw_make_widget (LWLIB_ID id, Widget parent, Boolean
pop_up_p)
initialize_widget_instance (instance);
}
if (!instance->widget)
- abort ();
+ emacs_abort ();
return instance->widget;
}
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 11be340..1ce4aea 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -267,7 +267,7 @@ abort_gracefully (Widget w)
if (XtIsShell (XtParent (w)))
XtRemoveGrab (w);
ungrab_all (w, CurrentTime);
- abort ();
+ emacs_abort ();
}
static void
@@ -897,7 +897,7 @@ draw_separator (XlwMenuWidget mw,
break;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -933,7 +933,7 @@ separator_height (enum menu_separator separator)
return 5;
default:
- abort ();
+ emacs_abort ();
}
}
@@ -1900,7 +1900,7 @@ XlwMenuInitialize (Widget request, Widget w, ArgList
args, Cardinal *num_args)
if (!mw->menu.font)
{
fprintf (stderr, "Menu font fixed not found, can't continue.\n");
- abort ();
+ emacs_abort ();
}
}
}
diff --git a/src/widget.c b/src/widget.c
index 96555ed..d7ec702 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -57,31 +57,34 @@ static XtGeometryResult EmacsFrameQueryGeometry (Widget
widget, XtWidgetGeometry
#define offset(field) offsetof (EmacsFrameRec, emacs_frame.field)
static XtResource resources[] = {
- {XtNgeometry, XtCGeometry, XtRString, sizeof (String),
+ {(char *) XtNgeometry, (char *) XtCGeometry, XtRString, sizeof (String),
offset (geometry), XtRString, (XtPointer) 0},
{XtNiconic, XtCIconic, XtRBoolean, sizeof (Boolean),
offset (iconic), XtRImmediate, (XtPointer) False},
- {XtNemacsFrame, XtCEmacsFrame, XtRPointer, sizeof (XtPointer),
+ {(char *) XtNemacsFrame, (char *) XtCEmacsFrame,
+ XtRPointer, sizeof (XtPointer),
offset (frame), XtRImmediate, 0},
- {XtNminibuffer, XtCMinibuffer, XtRInt, sizeof (int),
+ {(char *) XtNminibuffer, (char *) XtCMinibuffer, XtRInt, sizeof (int),
offset (minibuffer), XtRImmediate, (XtPointer)0},
- {XtNunsplittable, XtCUnsplittable, XtRBoolean, sizeof (Boolean),
+ {(char *) XtNunsplittable, (char *) XtCUnsplittable,
+ XtRBoolean, sizeof (Boolean),
offset (unsplittable), XtRImmediate, (XtPointer)0},
- {XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, sizeof (int),
+ {(char *) XtNinternalBorderWidth, (char *) XtCInternalBorderWidth,
+ XtRInt, sizeof (int),
offset (internal_border_width), XtRImmediate, (XtPointer)4},
- {XtNinterline, XtCInterline, XtRInt, sizeof (int),
+ {(char *) XtNinterline, (char *) XtCInterline, XtRInt, sizeof (int),
offset (interline), XtRImmediate, (XtPointer)0},
- {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel),
- offset (foreground_pixel), XtRString, "XtDefaultForeground"},
- {XtNcursorColor, XtCForeground, XtRPixel, sizeof (Pixel),
- offset (cursor_color), XtRString, "XtDefaultForeground"},
- {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean),
+ {(char *) XtNforeground, (char *) XtCForeground, XtRPixel, sizeof (Pixel),
+ offset (foreground_pixel), XtRString, (char *) "XtDefaultForeground"},
+ {(char *) XtNcursorColor, (char *) XtCForeground, XtRPixel, sizeof (Pixel),
+ offset (cursor_color), XtRString, (char *) "XtDefaultForeground"},
+ {(char *) XtNbarCursor, (char *) XtCBarCursor, XtRBoolean, sizeof (Boolean),
offset (bar_cursor), XtRImmediate, (XtPointer)0},
- {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean),
+ {(char *) XtNvisualBell, (char *) XtCVisualBell, XtRBoolean, sizeof
(Boolean),
offset (visual_bell), XtRImmediate, (XtPointer)0},
- {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int),
+ {(char *) XtNbellVolume, (char *) XtCBellVolume, XtRInt, sizeof (int),
offset (bell_volume), XtRImmediate, (XtPointer)0},
};
@@ -106,7 +109,7 @@ emacsFrameTranslations [] = "\
static EmacsFrameClassRec emacsFrameClassRec = {
{ /* core fields */
/* superclass */ &widgetClassRec,
- /* class_name */ "EmacsFrame",
+ /* class_name */ (char *) "EmacsFrame",
/* widget_size */ sizeof (EmacsFrameRec),
/* class_initialize */ 0,
/* class_part_initialize */ 0,
diff --git a/src/xfns.c b/src/xfns.c
index 97aa923..d3e0839 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2640,10 +2640,10 @@ x_window (struct frame *f, long window_prompting)
ac = 0;
XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++;
- XtSetArg (al[ac], XtNshowGrip, 0); ac++;
- XtSetArg (al[ac], XtNallowResize, 1); ac++;
- XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++;
- XtSetArg (al[ac], XtNemacsFrame, f); ac++;
+ XtSetArg (al[ac], (char *) XtNshowGrip, 0); ac++;
+ XtSetArg (al[ac], (char *) XtNallowResize, 1); ac++;
+ XtSetArg (al[ac], (char *) XtNresizeToPreferred, 1); ac++;
+ XtSetArg (al[ac], (char *) XtNemacsFrame, f); ac++;
XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
XtSetArg (al[ac], XtNdepth, FRAME_DISPLAY_INFO (f)->n_planes); ac++;
XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
diff --git a/src/xmenu.c b/src/xmenu.c
index e1f71a2..249cd69 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1366,7 +1366,7 @@ create_and_show_popup_menu (struct frame *f, widget_value
*first_wv,
event->button = i;
/* Don't allow any geometry request from the user. */
- XtSetArg (av[ac], XtNgeometry, 0); ac++;
+ XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++;
XtSetValues (menu, av, ac);
/* Display the menu. */
diff --git a/src/xterm.c b/src/xterm.c
index 28faea1..7856793 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11671,20 +11671,21 @@ x_check_font (struct frame *f, struct font *font)
#ifdef USE_X_TOOLKIT
static XrmOptionDescRec emacs_options[] = {
- {"-geometry", ".geometry", XrmoptionSepArg, NULL},
- {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"},
-
- {"-internal-border-width", "*EmacsScreen.internalBorderWidth",
- XrmoptionSepArg, NULL},
- {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL},
-
- {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
- {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
- {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
- {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer)
NULL},
- {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL},
- {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL},
- {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL}
+ {(char *) "-geometry", (char *) ".geometry", XrmoptionSepArg, NULL},
+ {(char *) "-iconic", (char *) ".iconic", XrmoptionNoArg, (XtPointer) "yes"},
+
+ {(char *) "-internal-border-width",
+ (char *) "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL},
+ {(char *) "-ib", (char *) "*EmacsScreen.internalBorderWidth",
+ XrmoptionSepArg, NULL},
+ {(char *) "-T", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
+ {(char *) "-wn", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
+ {(char *) "-title", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
+ {(char *) "-iconname", (char *) "*EmacsShell.iconName",
+ XrmoptionSepArg, NULL},
+ {(char *) "-in", (char *) "*EmacsShell.iconName", XrmoptionSepArg, NULL},
+ {(char *) "-mc", (char *) "*pointerColor", XrmoptionSepArg, NULL},
+ {(char *) "-cr", (char *) "*cursorColor", XrmoptionSepArg, NULL}
};
/* Whether atimer for Xt timeouts is activated or not. */
@@ -12002,11 +12003,11 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
int argc = 0;
char *argv[3];
- argv[0] = "";
+ argv[0] = (char *) "";
argc = 1;
if (xrm_option)
{
- argv[argc++] = "-xrm";
+ argv[argc++] = (char *) "-xrm";
argv[argc++] = xrm_option;
}
turn_on_atimers (false);
@@ -12384,7 +12385,7 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
dpy = dpyinfo->display;
d.addr = (XPointer)&dpy;
d.size = sizeof (Display *);
- fr.addr = XtDefaultFont;
+ fr.addr = (char *) XtDefaultFont;
fr.size = sizeof (XtDefaultFont);
to.size = sizeof (Font *);
to.addr = (XPointer)&font;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ec16837: Tweak X toolkit code to pacify modern GCC,
Paul Eggert <=