diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-16 16:11:35 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-16 16:11:35 -0700 |
commit | fd35b6f96777be3305879a9ca60ab5befb254042 (patch) | |
tree | db72c649acdc7f53d9672fba88b6a08b3601cdda /lwlib | |
parent | c4354cb4f4a3982331180439120ca72734d49cc5 (diff) | |
parent | 399c71d323b8beef139437311c78440d0033c652 (diff) | |
download | emacs-fd35b6f96777be3305879a9ca60ab5befb254042.tar.gz |
Static checks with GCC 4.6.0 and non-default toolkits.
Diffstat (limited to 'lwlib')
-rw-r--r-- | lwlib/ChangeLog | 16 | ||||
-rw-r--r-- | lwlib/lwlib-Xm.c | 12 | ||||
-rw-r--r-- | lwlib/lwlib-utils.c | 28 | ||||
-rw-r--r-- | lwlib/lwlib-utils.h | 3 | ||||
-rw-r--r-- | lwlib/lwlib.c | 9 | ||||
-rw-r--r-- | lwlib/xlwmenu.c | 38 |
6 files changed, 48 insertions, 58 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 64ae2fe085d..e98526f2546 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,19 @@ +2011-04-16 Paul Eggert <eggert@cs.ucla.edu> + + Static checks with GCC 4.6.0 and non-default toolkits. + + * lwlib-Xm.c (make_dialog): Rename local to avoid shadowing. + (make_menu_in_widget): Add cast to avoid warning. + * lwlib-utils.c (XtCompositeChildren): Likewise. + + * lwlib.c (EXPLAIN, destroy_one_instance): Avoid "else;". + (first_child) [USE_MOTIF]: Protoize. + + * lwlib-utils.h, lwlib-utils.c (XtSafelyDestroyWidget): Remove; unused. + + * xlwmenu.c (XlwMenuSetValues): Rename/ move locals to avoid shadowing. + (MINL): Define only if not emacs. + 2011-03-07 Chong Yidong <cyd@stupidchicken.com> * Version 23.3 released. diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c index 55b27b9dab0..2b7677a02f5 100644 --- a/lwlib/lwlib-Xm.c +++ b/lwlib/lwlib-Xm.c @@ -511,7 +511,7 @@ make_menu_in_widget (widget_instance* instance, /* Allocate the children array */ for (num_children = 0, cur = val; cur; num_children++, cur = cur->next) ; - children = (Widget*)XtMalloc (num_children * sizeof (Widget)); + children = (Widget*)(void*)XtMalloc (num_children * sizeof (Widget)); /* WIDGET should be a RowColumn. */ if (!XmIsRowColumn (widget)) @@ -1020,10 +1020,10 @@ dialog_key_cb (Widget widget, { KeySym sym = 0; Modifiers modif_ret; - + XtTranslateKeycode (event->xkey.display, event->xkey.keycode, 0, &modif_ret, &sym); - + if (sym == osfXK_Cancel) { Widget w = *((Widget *) closure); @@ -1055,7 +1055,7 @@ make_dialog (char* name, Widget row; Widget icon; Widget icon_separator; - Widget message; + Widget message_label; Widget value = 0; Widget separator; Widget button = 0; @@ -1269,7 +1269,7 @@ make_dialog (char* name, XtSetArg(al[ac], XmNleftWidget, icon); ac++; XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM); ac++; XtSetArg(al[ac], XmNrightOffset, 13); ac++; - message = XmCreateLabel (form, "message", al, ac); + message_label = XmCreateLabel (form, "message", al, ac); if (list) XtManageChild (value); @@ -1281,7 +1281,7 @@ make_dialog (char* name, { children [i] = value; i++; } - children [i] = message; i++; + children [i] = message_label; i++; children [i] = icon; i++; children [i] = icon_separator; i++; XtManageChildren (children, i); diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c index a3e1cb3b432..7a0dd1b264a 100644 --- a/lwlib/lwlib-utils.c +++ b/lwlib/lwlib-utils.c @@ -129,7 +129,7 @@ XtCompositeChildren (Widget widget, unsigned int *number) return NULL; } n = cw->composite.num_children; - result = (Widget*)XtMalloc (n * sizeof (Widget)); + result = (Widget*)(void*)XtMalloc (n * sizeof (Widget)); *number = n; for (i = 0; i < n; i++) result [i] = cw->composite.children [i]; @@ -141,29 +141,3 @@ XtWidgetBeingDestroyedP (Widget widget) { return widget->core.being_destroyed; } - -void -XtSafelyDestroyWidget (Widget widget) -{ -#if 0 - - /* this requires IntrinsicI.h (actually, InitialI.h) */ - - XtAppContext app = XtWidgetToApplicationContext(widget); - - if (app->dispatch_level == 0) - { - app->dispatch_level = 1; - XtDestroyWidget (widget); - /* generates an event so that the event loop will be called */ - XChangeProperty (XtDisplay (widget), XtWindow (widget), - XA_STRING, XA_STRING, 32, PropModeAppend, NULL, 0); - app->dispatch_level = 0; - } - else - XtDestroyWidget (widget); - -#else - abort (); -#endif -} diff --git a/lwlib/lwlib-utils.h b/lwlib/lwlib-utils.h index b988374288a..ec3daab94ef 100644 --- a/lwlib/lwlib-utils.h +++ b/lwlib/lwlib-utils.h @@ -15,7 +15,4 @@ Widget *XtCompositeChildren (Widget, unsigned int *); Boolean XtWidgetBeingDestroyedP (Widget widget); -void XtSafelyDestroyWidget (Widget); - #endif /* _LWLIB_UTILS_H_ */ - diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index 290ce091301..9d8ec3330d3 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c @@ -422,7 +422,7 @@ safe_strcmp (const char *s1, const char *s2) (nc == STRUCTURAL_CHANGE ? "structural" : "???")))), \ nc, desc, a1, a2) #else -# define EXPLAIN(name, oc, nc, desc, a1, a2) +# define EXPLAIN(name, oc, nc, desc, a1, a2) ((void) 0) #endif @@ -912,8 +912,9 @@ destroy_one_instance (widget_instance *instance) xaw_destroy_instance (instance); else #endif - /* do not remove the empty statement */ - ; + { + /* Empty compound statement to terminate if-then-else chain. */ + } } free_widget_instance (instance); @@ -978,7 +979,7 @@ lw_destroy_all_pop_ups (void) } #ifdef USE_MOTIF -extern Widget first_child (/* Widget */); /* garbage */ +extern Widget first_child (Widget); /* garbage */ #endif Widget diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c index 5b97f2bf999..e9ec604ae7f 100644 --- a/lwlib/xlwmenu.c +++ b/lwlib/xlwmenu.c @@ -1220,9 +1220,9 @@ display_menu (XlwMenuWidget mw, { if (val->enabled) *hit_return = val; - else + else no_return = 1; - if (mw->menu.inside_entry != val) + if (mw->menu.inside_entry != val) { if (mw->menu.inside_entry) XtCallCallbackList ((Widget)mw, mw->menu.leave, @@ -1426,7 +1426,7 @@ fit_to_screen (XlwMenuWidget mw, static void create_pixmap_for_menu (window_state* ws, XlwMenuWidget mw) { - if (ws->pixmap != None) + if (ws->pixmap != None) { XFreePixmap (XtDisplay (ws->w), ws->pixmap); ws->pixmap = None; @@ -1592,9 +1592,9 @@ map_event_to_widget_value (XlwMenuWidget mw, } } - if (!inside) + if (!inside) { - if (mw->menu.inside_entry != NULL) + if (mw->menu.inside_entry != NULL) XtCallCallbackList ((Widget)mw, mw->menu.leave, (XtPointer) mw->menu.inside_entry); mw->menu.inside_entry = NULL; @@ -1693,8 +1693,10 @@ release_drawing_gcs (XlwMenuWidget mw) mw->menu.background_gc = (GC) -1; } +#ifndef emacs #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ ? ((unsigned long) (x)) : ((unsigned long) (y))) +#endif static void make_shadow_gcs (XlwMenuWidget mw) @@ -1881,7 +1883,7 @@ openXftFont (XlwMenuWidget mw) if (!mw->menu.font) { mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname); - if (!mw->menu.xft_font) + if (!mw->menu.xft_font) { fprintf (stderr, "Can't find font '%s'\n", fname); mw->menu.xft_font = getDefaultXftFont (mw); @@ -1930,19 +1932,19 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args) if (!mw->menu.font) { mw->menu.font = XLoadQueryFont (display, "fixed"); - if (!mw->menu.font) + if (!mw->menu.font) { fprintf (stderr, "Menu font fixed not found, can't continue.\n"); abort (); } } } - + #ifdef HAVE_X_I18N if (mw->menu.fontSet) mw->menu.font_extents = XExtentsOfFontSet (mw->menu.fontSet); #endif - + make_drawing_gcs (mw); make_shadow_gcs (mw); @@ -2118,12 +2120,12 @@ XlwMenuDestroy (Widget w) XftFontClose (XtDisplay (mw), mw->menu.xft_font); #endif - if (mw->menu.windows [0].pixmap != None) + if (mw->menu.windows [0].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [0].pixmap); /* start from 1 because the one in slot 0 is w->core.window */ for (i = 1; i < mw->menu.windows_length; i++) { - if (mw->menu.windows [i].pixmap != None) + if (mw->menu.windows [i].pixmap != None) XFreePixmap (XtDisplay (mw), mw->menu.windows [i].pixmap); #ifdef HAVE_XFT if (mw->menu.windows [i].xft_draw) @@ -2153,18 +2155,17 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, { XlwMenuWidget oldmw = (XlwMenuWidget)current; XlwMenuWidget newmw = (XlwMenuWidget)new; - Boolean redisplay = False; - int i; + Boolean do_redisplay = False; if (newmw->menu.contents && newmw->menu.contents->contents && newmw->menu.contents->contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; /* Do redisplay if the contents are entirely eliminated. */ if (newmw->menu.contents && newmw->menu.contents->contents == 0 && newmw->menu.contents->change >= VISIBLE_CHANGE) - redisplay = True; + do_redisplay = True; if (newmw->core.background_pixel != oldmw->core.background_pixel || newmw->menu.foreground != oldmw->menu.foreground @@ -2179,6 +2180,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, #endif ) { + int i; release_drawing_gcs (newmw); make_drawing_gcs (newmw); @@ -2188,7 +2190,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, newmw->menu.bottom_shadow_color = -1; make_shadow_gcs (newmw); - redisplay = True; + do_redisplay = True; if (XtIsRealized (current)) /* If the menu is currently displayed, change the display. */ @@ -2229,12 +2231,12 @@ XlwMenuSetValues (Widget current, Widget request, Widget new, #ifdef HAVE_X_I18N if (newmw->menu.fontSet != oldmw->menu.fontSet && newmw->menu.fontSet != NULL) { - redisplay = True; + do_redisplay = True; newmw->menu.font_extents = XExtentsOfFontSet (newmw->menu.fontSet); } #endif - return redisplay; + return do_redisplay; } static void |