From 9330ddf946ed18d955593e866382a74d0b1f42a8 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sun, 13 Oct 2013 22:44:04 +0200 Subject: [PATCH] wmaker: Marked args as unused for compiler in menu callback code When an entry of a menu is selected, the appropriate action is triggered using a callback, which means having a fixed argument list for that function. It is then correct to not use all the arguments, so this patch adds the appropriate stuff to avoid a false report from compiler. Signed-off-by: Christophe CURIS --- src/appicon.c | 9 +++++++++ src/appmenu.c | 3 +++ src/dock.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/rootmenu.c | 28 ++++++++++++++++++++++++++++ src/switchmenu.c | 3 +++ src/winmenu.c | 9 +++++++++ src/workspace.c | 9 +++++++++ 7 files changed, 114 insertions(+) diff --git a/src/appicon.c b/src/appicon.c index 6a6e4fd0..576ba3b7 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -483,6 +483,9 @@ static void relaunchCallback(WMenu * menu, WMenuEntry * entry) { WApplication *wapp = (WApplication *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + relaunchApplication(wapp); } @@ -502,6 +505,9 @@ static void unhideHereCallback(WMenu * menu, WMenuEntry * entry) { WApplication *wapp = (WApplication *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + wUnhideApplication(wapp, False, True); } @@ -512,6 +518,9 @@ static void setIconCallback(WMenu *menu, WMenuEntry *entry) WScreen *scr; int result; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(icon != NULL); if (icon->editing) diff --git a/src/appmenu.c b/src/appmenu.c index 276194ae..126d228c 100644 --- a/src/appmenu.c +++ b/src/appmenu.c @@ -76,6 +76,9 @@ static void notifyClient(WMenu * menu, WMenuEntry * entry) { WAppMenuData *data = entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + sendMessage(data->window, wmSelectItem, data->tag); } diff --git a/src/dock.c b/src/dock.c index c652e14f..30197f5d 100644 --- a/src/dock.c +++ b/src/dock.c @@ -169,6 +169,9 @@ static void renameCallback(WMenu *menu, WMenuEntry *entry) int wspace; char *name; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(entry->clientdata != NULL); wspace = w_global.workspace.current; @@ -419,6 +422,9 @@ static void omnipresentCallback(WMenu *menu, WMenuEntry *entry) WMArrayIterator iter; int failed; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(entry->clientdata != NULL); dock = clickedIcon->dock; @@ -484,6 +490,9 @@ static void removeIconsCallback(WMenu *menu, WMenuEntry *entry) WDock *dock; WMArray *selectedIcons; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(clickedIcon != NULL); dock = clickedIcon->dock; @@ -521,6 +530,9 @@ static void keepIconsCallback(WMenu *menu, WMenuEntry *entry) WMArray *selectedIcons; WMArrayIterator it; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(clickedIcon != NULL); dock = clickedIcon->dock; @@ -635,6 +647,9 @@ static void colectIconsCallback(WMenu *menu, WMenuEntry *entry) int x, y, x_pos, y_pos; Bool update_icon = False; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(entry->clientdata != NULL); clip = clickedIcon->dock; @@ -731,6 +746,10 @@ static void toggleAutoRaiseLower(WDock *dock) static void toggleAutoRaiseLowerCallback(WMenu *menu, WMenuEntry *entry) { WDock *dock; + + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(entry->clientdata != NULL); dock = (WDock *) entry->clientdata; @@ -746,6 +765,9 @@ static void launchCallback(WMenu *menu, WMenuEntry *entry) { WAppIcon *btn = (WAppIcon *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + launchDockedApplication(btn, False); } @@ -753,6 +775,9 @@ static void settingsCallback(WMenu *menu, WMenuEntry *entry) { WAppIcon *btn = (WAppIcon *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (btn->editing) return; ShowDockAppSettingsPanel(btn); @@ -763,6 +788,9 @@ static void hideCallback(WMenu *menu, WMenuEntry *entry) WApplication *wapp; WAppIcon *btn = (WAppIcon *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + wapp = wApplicationOf(btn->icon->owner->main_window); if (wapp->flags.hidden) { @@ -778,6 +806,9 @@ static void unhideHereCallback(WMenu *menu, WMenuEntry *entry) WApplication *wapp; WAppIcon *btn = (WAppIcon *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + wapp = wApplicationOf(btn->icon->owner->main_window); wUnhideApplication(wapp, False, True); @@ -841,6 +872,9 @@ static void switchWSCommand(WMenu *menu, WMenuEntry *entry) WMArray *selectedIcons; int x, y; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (entry->order == w_global.workspace.current) return; src = icon->dock; @@ -1047,6 +1081,10 @@ static void setDockPositionNormalCallback(WMenu *menu, WMenuEntry *entry) { WDock *dock = (WDock *) entry->clientdata; WDrawerChain *dc; + + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (entry->flags.indicator_on) // already set, nothing to do return; // Do we come from auto raise lower or keep on top? @@ -1070,6 +1108,10 @@ static void setDockPositionAutoRaiseLowerCallback(WMenu *menu, WMenuEntry *entry { WDock *dock = (WDock *) entry->clientdata; WDrawerChain *dc; + + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (entry->flags.indicator_on) // already set, nothing to do return; // Do we come from normal or keep on top? @@ -1089,6 +1131,10 @@ static void setDockPositionKeepOnTopCallback(WMenu *menu, WMenuEntry *entry) { WDock *dock = (WDock *) entry->clientdata; WDrawerChain *dc; + + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (entry->flags.indicator_on) // already set, nothing to do return; dock->auto_raise_lower = 0; @@ -4333,6 +4379,9 @@ static int addADrawer(WScreen *scr) static void addADrawerCallback(WMenu *menu, WMenuEntry *entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(entry->clientdata!=NULL); addADrawer(((WAppIcon *) entry->clientdata)->dock->screen_ptr); } @@ -4401,6 +4450,10 @@ static void drawerDestroy(WDock *drawer) static void removeDrawerCallback(WMenu *menu, WMenuEntry *entry) { WDock *dock = ((WAppIcon*)entry->clientdata)->dock; + + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + assert(dock != NULL); if (dock->icon_count > 2) { diff --git a/src/rootmenu.c b/src/rootmenu.c index d508c062..ca7750c9 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -250,6 +250,10 @@ static void shutdownCommand(WMenu * menu, WMenuEntry * entry) static void restartCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + (void) entry; + Shutdown(WSRestartPreparationMode); Restart((char *)entry->clientdata, False); Restart(NULL, True); @@ -257,26 +261,41 @@ static void restartCommand(WMenu * menu, WMenuEntry * entry) static void refreshCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wRefreshDesktop(menu->frame->screen_ptr); } static void arrangeIconsCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wArrangeIcons(menu->frame->screen_ptr, True); } static void showAllCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wShowAllWindows(menu->frame->screen_ptr); } static void hideOthersCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wHideOtherApplications(menu->frame->screen_ptr->focused_window); } static void saveSessionCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + if (!wPreferences.save_session_on_exit) wSessionSaveState(menu->frame->screen_ptr); @@ -285,17 +304,26 @@ static void saveSessionCommand(WMenu * menu, WMenuEntry * entry) static void clearSessionCommand(WMenu *menu, WMenuEntry *entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wSessionClearState(); wScreenSaveState(menu->frame->screen_ptr); } static void infoPanelCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wShowInfoPanel(menu->frame->screen_ptr); } static void legalPanelCommand(WMenu * menu, WMenuEntry * entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wShowLegalPanel(menu->frame->screen_ptr); } diff --git a/src/switchmenu.c b/src/switchmenu.c index 9b9fc98b..3141f062 100644 --- a/src/switchmenu.c +++ b/src/switchmenu.c @@ -65,6 +65,9 @@ static void focusWindow(WMenu * menu, WMenuEntry * entry) WScreen *scr; int x, y, move = 0; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + wwin = (WWindow *) entry->clientdata; scr = wwin->screen_ptr; diff --git a/src/winmenu.c b/src/winmenu.c index f2a10ee8..04db90dd 100644 --- a/src/winmenu.c +++ b/src/winmenu.c @@ -75,6 +75,9 @@ static void execWindowOptionCommand(WMenu * menu, WMenuEntry * entry) { WWindow *wwin = (WWindow *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + switch (entry->order) { case WO_KEEP_ON_TOP: if (wwin->frame->core->stacking->window_level != WMFloatingLevel) @@ -180,6 +183,9 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry) { WWindow *wwin = (WWindow *) entry->clientdata; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + wSelectWindow(wwin, False); wWindowChangeWorkspace(wwin, entry->order); } @@ -190,6 +196,9 @@ static void makeShortcutCommand(WMenu *menu, WMenuEntry *entry) WScreen *scr = wwin->screen_ptr; int index = entry->order - WO_ENTRIES; + /* Parameter not used, but tell the compiler that it is ok */ + (void) menu; + if (w_global.shortcut.windows[index]) { WMFreeArray(w_global.shortcut.windows[index]); w_global.shortcut.windows[index] = NULL; diff --git a/src/workspace.c b/src/workspace.c index 10c348d8..4e619efd 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -640,11 +640,17 @@ static void switchWSCommand(WMenu * menu, WMenuEntry * entry) static void lastWSCommand(WMenu *menu, WMenuEntry *entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wWorkspaceChange(menu->frame->screen_ptr, w_global.workspace.last_used); } static void deleteWSCommand(WMenu *menu, WMenuEntry *entry) { + /* Parameter not used, but tell the compiler that it is ok */ + (void) entry; + wWorkspaceDelete(menu->frame->screen_ptr, w_global.workspace.count - 1); } @@ -652,6 +658,9 @@ static void newWSCommand(WMenu *menu, WMenuEntry *foo) { int ws; + /* Parameter not used, but tell the compiler that it is ok */ + (void) foo; + ws = wWorkspaceNew(menu->frame->screen_ptr); /* autochange workspace */ -- 2.11.4.GIT