aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2017-03-10 09:30:30 -0800
committerPaul Eggert2017-03-10 09:31:59 -0800
commitec168376d1d961be9adceaafcbff04d5b2b0a492 (patch)
treee714c3bc5e3c5323ddbf936c382a0ba079307618
parent817c4d1a3055a12ab2f1a6a06479b5eb4d66286b (diff)
downloademacs-ec168376d1d961be9adceaafcbff04d5b2b0a492.tar.gz
emacs-ec168376d1d961be9adceaafcbff04d5b2b0a492.zip
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.
-rw-r--r--lwlib/lwlib-Xaw.c19
-rw-r--r--lwlib/lwlib-Xm.c11
-rw-r--r--lwlib/lwlib.c7
-rw-r--r--lwlib/xlwmenu.c8
-rw-r--r--src/widget.c31
-rw-r--r--src/xfns.c8
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.c35
8 files changed, 61 insertions, 60 deletions
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index af57a7fe910..ec33e788296 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/>. */
21#include <config.h> 21#include <config.h>
22 22
23#include <stdio.h> 23#include <stdio.h>
24#include <stdlib.h>
25#include <setjmp.h> 24#include <setjmp.h>
26 25
27#include <lisp.h> 26#include <lisp.h>
@@ -516,10 +515,10 @@ make_dialog (char* name,
516 XtTranslations button_override; 515 XtTranslations button_override;
517#endif 516#endif
518 517
519 if (! pop_up_p) abort (); /* not implemented */ 518 if (! pop_up_p) emacs_abort (); /* not implemented */
520 if (text_input_slot) abort (); /* not implemented */ 519 if (text_input_slot) emacs_abort (); /* not implemented */
521 if (radio_box) abort (); /* not implemented */ 520 if (radio_box) emacs_abort (); /* not implemented */
522 if (list) abort (); /* not implemented */ 521 if (list) emacs_abort (); /* not implemented */
523 522
524 if (! actions_initted) 523 if (! actions_initted)
525 { 524 {
@@ -764,7 +763,7 @@ xaw_generic_callback (Widget widget, XtPointer closure, XtPointer call_data)
764 break; 763 break;
765 val = val->next; 764 val = val->next;
766 } 765 }
767 if (! val) abort (); 766 if (! val) emacs_abort ();
768 user_data = val->call_data; 767 user_data = val->call_data;
769 } 768 }
770 769
@@ -790,11 +789,11 @@ wm_delete_window (Widget w,
790 shell = w; 789 shell = w;
791 790
792 if (! XtIsSubclass (shell, shellWidgetClass)) 791 if (! XtIsSubclass (shell, shellWidgetClass))
793 abort (); 792 emacs_abort ();
794 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL); 793 XtVaGetValues (shell, XtNnumChildren, &nkids, NULL);
795 XtVaGetValues (shell, XtNchildren, &kids, NULL); 794 XtVaGetValues (shell, XtNchildren, &kids, NULL);
796 if (!kids || !*kids) 795 if (!kids || !*kids)
797 abort (); 796 emacs_abort ();
798 for (i = 0; i < nkids; i++) 797 for (i = 0; i < nkids; i++)
799 { 798 {
800 widget = kids[i]; 799 widget = kids[i];
@@ -804,11 +803,11 @@ wm_delete_window (Widget w,
804 if (! widget) return; 803 if (! widget) return;
805 804
806 id = lw_get_widget_id (widget); 805 id = lw_get_widget_id (widget);
807 if (! id) abort (); 806 if (! id) emacs_abort ();
808 807
809 { 808 {
810 widget_info *info = lw_get_widget_info (id); 809 widget_info *info = lw_get_widget_info (id);
811 if (! info) abort (); 810 if (! info) emacs_abort ();
812 if (info->selection_cb) 811 if (info->selection_cb)
813 info->selection_cb (widget, id, (XtPointer) -1); 812 info->selection_cb (widget, id, (XtPointer) -1);
814 } 813 }
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 6e1e0d69216..b18429067d8 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/>. */
22 22
23#include <unistd.h> 23#include <unistd.h>
24#include <stdio.h> 24#include <stdio.h>
25#include <stdlib.h>
26#include <setjmp.h> 25#include <setjmp.h>
27 26
28#include <X11/StringDefs.h> 27#include <X11/StringDefs.h>
@@ -504,14 +503,14 @@ make_menu_in_widget (widget_instance* instance,
504 503
505 /* WIDGET should be a RowColumn. */ 504 /* WIDGET should be a RowColumn. */
506 if (!XmIsRowColumn (widget)) 505 if (!XmIsRowColumn (widget))
507 abort (); 506 emacs_abort ();
508 507
509 /* Determine whether WIDGET is a menu bar. */ 508 /* Determine whether WIDGET is a menu bar. */
510 type = -1; 509 type = -1;
511 XtSetArg (al[0], XmNrowColumnType, &type); 510 XtSetArg (al[0], XmNrowColumnType, &type);
512 XtGetValues (widget, al, 1); 511 XtGetValues (widget, al, 1);
513 if (type != XmMENU_BAR && type != XmMENU_PULLDOWN && type != XmMENU_POPUP) 512 if (type != XmMENU_BAR && type != XmMENU_PULLDOWN && type != XmMENU_POPUP)
514 abort (); 513 emacs_abort ();
515 menubar_p = type == XmMENU_BAR; 514 menubar_p = type == XmMENU_BAR;
516 515
517 /* Add a callback to popups and pulldowns that is called when 516 /* Add a callback to popups and pulldowns that is called when
@@ -528,7 +527,7 @@ make_menu_in_widget (widget_instance* instance,
528 /* Check that those are all we have 527 /* Check that those are all we have
529 (the caller should have deleted the rest). */ 528 (the caller should have deleted the rest). */
530 if (old_num_children != keep_first_children) 529 if (old_num_children != keep_first_children)
531 abort (); 530 emacs_abort ();
532 531
533 /* Create the rest. */ 532 /* Create the rest. */
534 for (child_index = keep_first_children; cur; child_index++, cur = cur->next) 533 for (child_index = keep_first_children; cur; child_index++, cur = cur->next)
@@ -677,7 +676,7 @@ update_one_menu_entry (widget_instance* instance,
677 if (strcmp (XtName (widget_list[i]), XtName (widget)) == 0) 676 if (strcmp (XtName (widget_list[i]), XtName (widget)) == 0)
678 break; 677 break;
679 if (i == old_num_children) 678 if (i == old_num_children)
680 abort (); 679 emacs_abort ();
681 if (XmIsCascadeButton (widget_list[i])) 680 if (XmIsCascadeButton (widget_list[i]))
682 { 681 {
683 menu = XmCreatePulldownMenu (parent, XtName(widget), NULL, 0); 682 menu = XmCreatePulldownMenu (parent, XtName(widget), NULL, 0);
@@ -1829,7 +1828,7 @@ do_call (Widget widget,
1829 break; 1828 break;
1830 1829
1831 default: 1830 default:
1832 abort (); 1831 emacs_abort ();
1833 } 1832 }
1834} 1833}
1835 1834
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 18a46109eb4..fffb17f7c33 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/>. */
26 26
27#include <sys/types.h> 27#include <sys/types.h>
28#include <stdio.h> 28#include <stdio.h>
29#include <stdlib.h>
30#include "lwlib-int.h" 29#include "lwlib-int.h"
31#include "lwlib-utils.h" 30#include "lwlib-utils.h"
32#include <X11/StringDefs.h> 31#include <X11/StringDefs.h>
@@ -721,13 +720,13 @@ instantiate_widget_instance (widget_instance *instance)
721 { 720 {
722 printf ("No creation function for widget type %s\n", 721 printf ("No creation function for widget type %s\n",
723 instance->info->type); 722 instance->info->type);
724 abort (); 723 emacs_abort ();
725 } 724 }
726 725
727 instance->widget = (*function) (instance); 726 instance->widget = (*function) (instance);
728 727
729 if (!instance->widget) 728 if (!instance->widget)
730 abort (); 729 emacs_abort ();
731 730
732 /* XtRealizeWidget (instance->widget);*/ 731 /* XtRealizeWidget (instance->widget);*/
733} 732}
@@ -772,7 +771,7 @@ lw_make_widget (LWLIB_ID id, Widget parent, Boolean pop_up_p)
772 initialize_widget_instance (instance); 771 initialize_widget_instance (instance);
773 } 772 }
774 if (!instance->widget) 773 if (!instance->widget)
775 abort (); 774 emacs_abort ();
776 return instance->widget; 775 return instance->widget;
777} 776}
778 777
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 11be3407254..1ce4aead93f 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -267,7 +267,7 @@ abort_gracefully (Widget w)
267 if (XtIsShell (XtParent (w))) 267 if (XtIsShell (XtParent (w)))
268 XtRemoveGrab (w); 268 XtRemoveGrab (w);
269 ungrab_all (w, CurrentTime); 269 ungrab_all (w, CurrentTime);
270 abort (); 270 emacs_abort ();
271} 271}
272 272
273static void 273static void
@@ -897,7 +897,7 @@ draw_separator (XlwMenuWidget mw,
897 break; 897 break;
898 898
899 default: 899 default:
900 abort (); 900 emacs_abort ();
901 } 901 }
902} 902}
903 903
@@ -933,7 +933,7 @@ separator_height (enum menu_separator separator)
933 return 5; 933 return 5;
934 934
935 default: 935 default:
936 abort (); 936 emacs_abort ();
937 } 937 }
938} 938}
939 939
@@ -1900,7 +1900,7 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
1900 if (!mw->menu.font) 1900 if (!mw->menu.font)
1901 { 1901 {
1902 fprintf (stderr, "Menu font fixed not found, can't continue.\n"); 1902 fprintf (stderr, "Menu font fixed not found, can't continue.\n");
1903 abort (); 1903 emacs_abort ();
1904 } 1904 }
1905 } 1905 }
1906 } 1906 }
diff --git a/src/widget.c b/src/widget.c
index 96555ed2ac7..d7ec7028517 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -57,31 +57,34 @@ static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry
57#define offset(field) offsetof (EmacsFrameRec, emacs_frame.field) 57#define offset(field) offsetof (EmacsFrameRec, emacs_frame.field)
58 58
59static XtResource resources[] = { 59static XtResource resources[] = {
60 {XtNgeometry, XtCGeometry, XtRString, sizeof (String), 60 {(char *) XtNgeometry, (char *) XtCGeometry, XtRString, sizeof (String),
61 offset (geometry), XtRString, (XtPointer) 0}, 61 offset (geometry), XtRString, (XtPointer) 0},
62 {XtNiconic, XtCIconic, XtRBoolean, sizeof (Boolean), 62 {XtNiconic, XtCIconic, XtRBoolean, sizeof (Boolean),
63 offset (iconic), XtRImmediate, (XtPointer) False}, 63 offset (iconic), XtRImmediate, (XtPointer) False},
64 64
65 {XtNemacsFrame, XtCEmacsFrame, XtRPointer, sizeof (XtPointer), 65 {(char *) XtNemacsFrame, (char *) XtCEmacsFrame,
66 XtRPointer, sizeof (XtPointer),
66 offset (frame), XtRImmediate, 0}, 67 offset (frame), XtRImmediate, 0},
67 68
68 {XtNminibuffer, XtCMinibuffer, XtRInt, sizeof (int), 69 {(char *) XtNminibuffer, (char *) XtCMinibuffer, XtRInt, sizeof (int),
69 offset (minibuffer), XtRImmediate, (XtPointer)0}, 70 offset (minibuffer), XtRImmediate, (XtPointer)0},
70 {XtNunsplittable, XtCUnsplittable, XtRBoolean, sizeof (Boolean), 71 {(char *) XtNunsplittable, (char *) XtCUnsplittable,
72 XtRBoolean, sizeof (Boolean),
71 offset (unsplittable), XtRImmediate, (XtPointer)0}, 73 offset (unsplittable), XtRImmediate, (XtPointer)0},
72 {XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, sizeof (int), 74 {(char *) XtNinternalBorderWidth, (char *) XtCInternalBorderWidth,
75 XtRInt, sizeof (int),
73 offset (internal_border_width), XtRImmediate, (XtPointer)4}, 76 offset (internal_border_width), XtRImmediate, (XtPointer)4},
74 {XtNinterline, XtCInterline, XtRInt, sizeof (int), 77 {(char *) XtNinterline, (char *) XtCInterline, XtRInt, sizeof (int),
75 offset (interline), XtRImmediate, (XtPointer)0}, 78 offset (interline), XtRImmediate, (XtPointer)0},
76 {XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), 79 {(char *) XtNforeground, (char *) XtCForeground, XtRPixel, sizeof (Pixel),
77 offset (foreground_pixel), XtRString, "XtDefaultForeground"}, 80 offset (foreground_pixel), XtRString, (char *) "XtDefaultForeground"},
78 {XtNcursorColor, XtCForeground, XtRPixel, sizeof (Pixel), 81 {(char *) XtNcursorColor, (char *) XtCForeground, XtRPixel, sizeof (Pixel),
79 offset (cursor_color), XtRString, "XtDefaultForeground"}, 82 offset (cursor_color), XtRString, (char *) "XtDefaultForeground"},
80 {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean), 83 {(char *) XtNbarCursor, (char *) XtCBarCursor, XtRBoolean, sizeof (Boolean),
81 offset (bar_cursor), XtRImmediate, (XtPointer)0}, 84 offset (bar_cursor), XtRImmediate, (XtPointer)0},
82 {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean), 85 {(char *) XtNvisualBell, (char *) XtCVisualBell, XtRBoolean, sizeof (Boolean),
83 offset (visual_bell), XtRImmediate, (XtPointer)0}, 86 offset (visual_bell), XtRImmediate, (XtPointer)0},
84 {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int), 87 {(char *) XtNbellVolume, (char *) XtCBellVolume, XtRInt, sizeof (int),
85 offset (bell_volume), XtRImmediate, (XtPointer)0}, 88 offset (bell_volume), XtRImmediate, (XtPointer)0},
86}; 89};
87 90
@@ -106,7 +109,7 @@ emacsFrameTranslations [] = "\
106static EmacsFrameClassRec emacsFrameClassRec = { 109static EmacsFrameClassRec emacsFrameClassRec = {
107 { /* core fields */ 110 { /* core fields */
108 /* superclass */ &widgetClassRec, 111 /* superclass */ &widgetClassRec,
109 /* class_name */ "EmacsFrame", 112 /* class_name */ (char *) "EmacsFrame",
110 /* widget_size */ sizeof (EmacsFrameRec), 113 /* widget_size */ sizeof (EmacsFrameRec),
111 /* class_initialize */ 0, 114 /* class_initialize */ 0,
112 /* class_part_initialize */ 0, 115 /* class_part_initialize */ 0,
diff --git a/src/xfns.c b/src/xfns.c
index 97aa923da05..d3e0839d8ac 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2640,10 +2640,10 @@ x_window (struct frame *f, long window_prompting)
2640 2640
2641 ac = 0; 2641 ac = 0;
2642 XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++; 2642 XtSetArg (al[ac], XtNmappedWhenManaged, 0); ac++;
2643 XtSetArg (al[ac], XtNshowGrip, 0); ac++; 2643 XtSetArg (al[ac], (char *) XtNshowGrip, 0); ac++;
2644 XtSetArg (al[ac], XtNallowResize, 1); ac++; 2644 XtSetArg (al[ac], (char *) XtNallowResize, 1); ac++;
2645 XtSetArg (al[ac], XtNresizeToPreferred, 1); ac++; 2645 XtSetArg (al[ac], (char *) XtNresizeToPreferred, 1); ac++;
2646 XtSetArg (al[ac], XtNemacsFrame, f); ac++; 2646 XtSetArg (al[ac], (char *) XtNemacsFrame, f); ac++;
2647 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++; 2647 XtSetArg (al[ac], XtNvisual, FRAME_X_VISUAL (f)); ac++;
2648 XtSetArg (al[ac], XtNdepth, FRAME_DISPLAY_INFO (f)->n_planes); ac++; 2648 XtSetArg (al[ac], XtNdepth, FRAME_DISPLAY_INFO (f)->n_planes); ac++;
2649 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++; 2649 XtSetArg (al[ac], XtNcolormap, FRAME_X_COLORMAP (f)); ac++;
diff --git a/src/xmenu.c b/src/xmenu.c
index e1f71a24904..249cd6903fa 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,
1366 event->button = i; 1366 event->button = i;
1367 1367
1368 /* Don't allow any geometry request from the user. */ 1368 /* Don't allow any geometry request from the user. */
1369 XtSetArg (av[ac], XtNgeometry, 0); ac++; 1369 XtSetArg (av[ac], (char *) XtNgeometry, 0); ac++;
1370 XtSetValues (menu, av, ac); 1370 XtSetValues (menu, av, ac);
1371 1371
1372 /* Display the menu. */ 1372 /* Display the menu. */
diff --git a/src/xterm.c b/src/xterm.c
index 28faea14a3a..7856793f8dc 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11671,20 +11671,21 @@ x_check_font (struct frame *f, struct font *font)
11671 11671
11672#ifdef USE_X_TOOLKIT 11672#ifdef USE_X_TOOLKIT
11673static XrmOptionDescRec emacs_options[] = { 11673static XrmOptionDescRec emacs_options[] = {
11674 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, 11674 {(char *) "-geometry", (char *) ".geometry", XrmoptionSepArg, NULL},
11675 {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"}, 11675 {(char *) "-iconic", (char *) ".iconic", XrmoptionNoArg, (XtPointer) "yes"},
11676 11676
11677 {"-internal-border-width", "*EmacsScreen.internalBorderWidth", 11677 {(char *) "-internal-border-width",
11678 XrmoptionSepArg, NULL}, 11678 (char *) "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL},
11679 {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL}, 11679 {(char *) "-ib", (char *) "*EmacsScreen.internalBorderWidth",
11680 11680 XrmoptionSepArg, NULL},
11681 {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, 11681 {(char *) "-T", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
11682 {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, 11682 {(char *) "-wn", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
11683 {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, 11683 {(char *) "-title", (char *) "*EmacsShell.title", XrmoptionSepArg, NULL},
11684 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, 11684 {(char *) "-iconname", (char *) "*EmacsShell.iconName",
11685 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, 11685 XrmoptionSepArg, NULL},
11686 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, 11686 {(char *) "-in", (char *) "*EmacsShell.iconName", XrmoptionSepArg, NULL},
11687 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} 11687 {(char *) "-mc", (char *) "*pointerColor", XrmoptionSepArg, NULL},
11688 {(char *) "-cr", (char *) "*cursorColor", XrmoptionSepArg, NULL}
11688}; 11689};
11689 11690
11690/* Whether atimer for Xt timeouts is activated or not. */ 11691/* 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)
12002 int argc = 0; 12003 int argc = 0;
12003 char *argv[3]; 12004 char *argv[3];
12004 12005
12005 argv[0] = ""; 12006 argv[0] = (char *) "";
12006 argc = 1; 12007 argc = 1;
12007 if (xrm_option) 12008 if (xrm_option)
12008 { 12009 {
12009 argv[argc++] = "-xrm"; 12010 argv[argc++] = (char *) "-xrm";
12010 argv[argc++] = xrm_option; 12011 argv[argc++] = xrm_option;
12011 } 12012 }
12012 turn_on_atimers (false); 12013 turn_on_atimers (false);
@@ -12384,7 +12385,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
12384 dpy = dpyinfo->display; 12385 dpy = dpyinfo->display;
12385 d.addr = (XPointer)&dpy; 12386 d.addr = (XPointer)&dpy;
12386 d.size = sizeof (Display *); 12387 d.size = sizeof (Display *);
12387 fr.addr = XtDefaultFont; 12388 fr.addr = (char *) XtDefaultFont;
12388 fr.size = sizeof (XtDefaultFont); 12389 fr.size = sizeof (XtDefaultFont);
12389 to.size = sizeof (Font *); 12390 to.size = sizeof (Font *);
12390 to.addr = (XPointer)&font; 12391 to.addr = (XPointer)&font;