From 6c69dc32a0f86078fe32878f5ba70fd9ed2bfd54 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Tue, 7 Mar 2023 17:24:41 +0000 Subject: [PATCH] WINGs: Make the test examples to compile Those examples are optional but currently cannot compile properly. The compiler is reporting some unused variables and missing header file. --- WINGs/Tests/Makefile.am | 3 ++- WINGs/Tests/mywidget.c | 1 + WINGs/Tests/testmywidget.c | 2 +- WINGs/Tests/wmfile.c | 11 ++++------- WINGs/Tests/wmquery.c | 8 +++----- WINGs/Tests/wtest.c | 15 +++++++++++++-- 6 files changed, 24 insertions(+), 16 deletions(-) diff --git a/WINGs/Tests/Makefile.am b/WINGs/Tests/Makefile.am index 48fa7b78..98f0e458 100644 --- a/WINGs/Tests/Makefile.am +++ b/WINGs/Tests/Makefile.am @@ -17,4 +17,5 @@ wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.la EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png AM_CPPFLAGS = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \ - -DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@ + -DRESOURCE_PATH=\"$(datadir)/WINGs\" @XFT_CFLAGS@ @HEADER_SEARCH_PATH@ \ + @PANGO_CFLAGS@ diff --git a/WINGs/Tests/mywidget.c b/WINGs/Tests/mywidget.c index 9212fdaa..76c963ca 100644 --- a/WINGs/Tests/mywidget.c +++ b/WINGs/Tests/mywidget.c @@ -64,6 +64,7 @@ static W_Class myWidgetClass = 0; */ W_Class InitMyWidget(WMScreen * scr) { + (void)scr; /* register our widget with WINGs and get our widget class ID */ if (!myWidgetClass) { myWidgetClass = W_RegisterUserWidget(); diff --git a/WINGs/Tests/testmywidget.c b/WINGs/Tests/testmywidget.c index 3a271fd9..08f3ad8e 100644 --- a/WINGs/Tests/testmywidget.c +++ b/WINGs/Tests/testmywidget.c @@ -4,7 +4,7 @@ #include "mywidget.h" -void wAbort() +_Noreturn void wAbort(void) { exit(1); } diff --git a/WINGs/Tests/wmfile.c b/WINGs/Tests/wmfile.c index f12362e9..276e8990 100644 --- a/WINGs/Tests/wmfile.c +++ b/WINGs/Tests/wmfile.c @@ -19,14 +19,14 @@ #include "logo.xpm" -void wAbort() +_Noreturn void wAbort(void) { exit(1); } char *ProgName; -void usage(void) +_Noreturn void usage(void) { fprintf(stderr, "usage:\n" @@ -53,13 +53,10 @@ int main(int argc, char **argv) WMPixmap *pixmap; WMOpenPanel *oPanel; WMSavePanel *sPanel; - /* RImage *image; */ char *title = NULL; char *initial = "/"; int ch; int panelType = OPEN_PANEL_TYPE; - extern char *optarg; - extern int optind; if (!dpy) { puts("could not open display"); @@ -96,14 +93,14 @@ int main(int argc, char **argv) if (panelType == SAVE_PANEL_TYPE) { sPanel = WMGetSavePanel(scr); if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial, - /*title */ NULL, NULL) == True) + title, NULL) == True) printf("%s\n", WMGetFilePanelFileName(sPanel)); else printf("\n"); } else { oPanel = WMGetOpenPanel(scr); if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial, - /*title */ NULL, NULL) == True) + title, NULL) == True) printf("%s\n", WMGetFilePanelFileName(oPanel)); else printf("\n"); diff --git a/WINGs/Tests/wmquery.c b/WINGs/Tests/wmquery.c index dac70317..b2347e22 100644 --- a/WINGs/Tests/wmquery.c +++ b/WINGs/Tests/wmquery.c @@ -11,14 +11,14 @@ #include "logo.xpm" -void wAbort() +_Noreturn void wAbort(void) { - exit(1); + exit(1); } char *ProgName; -void usage(void) +_Noreturn void usage(void) { fprintf(stderr, "usage:\n" @@ -45,8 +45,6 @@ int main(int argc, char **argv) char *initial = NULL; char *result = NULL; int ch; - extern char *optarg; - extern int optind; WMInitializeApplication("WMQuery", &argc, argv); diff --git a/WINGs/Tests/wtest.c b/WINGs/Tests/wtest.c index 1d147448..ea622822 100644 --- a/WINGs/Tests/wtest.c +++ b/WINGs/Tests/wtest.c @@ -14,7 +14,7 @@ * This will be called when the application will be terminated because * of a fatal error (only for memory allocation failures ATM). */ -void wAbort() +_Noreturn void wAbort(void) { exit(1); } @@ -25,6 +25,7 @@ int windowCount = 0; void closeAction(WMWidget * self, void *data) { + (void)data; WMDestroyWidget(self); windowCount--; printf("window closed, window count = %d\n", windowCount); @@ -165,10 +166,13 @@ void testBox(WMScreen * scr) static void singleClick(WMWidget * self, void *data) { + (void)self; + (void)data; } static void doubleClick(WMWidget * self, void *data) { + (void)data; WMSelectAllListItems((WMList *) self); } @@ -480,6 +484,7 @@ void testColorPanel(WMScreen * scr) void sliderCallback(WMWidget * w, void *data) { + (void)data; printf("SLIDER == %i\n", WMGetSliderValue(w)); } @@ -749,6 +754,8 @@ void testTabView(WMScreen * scr) void splitViewConstrainProc(WMSplitView * sPtr, int indView, int *minSize, int *maxSize) { + (void)sPtr; + switch (indView) { case 0: *minSize = 20; @@ -782,6 +789,7 @@ static void resizeSplitView(XEvent * event, void *data) void appendSubviewButtonAction(WMWidget * self, void *data) { + (void)self; WMSplitView *sPtr = (WMSplitView *) data; char buf[64]; WMLabel *label = WMCreateLabel(sPtr); @@ -796,6 +804,7 @@ void appendSubviewButtonAction(WMWidget * self, void *data) void removeSubviewButtonAction(WMWidget * self, void *data) { + (void)self; WMSplitView *sPtr = (WMSplitView *) data; int count = WMGetSplitViewSubviewsCount(sPtr); @@ -808,12 +817,14 @@ void removeSubviewButtonAction(WMWidget * self, void *data) void orientationButtonAction(WMWidget * self, void *data) { + (void)self; WMSplitView *sPtr = (WMSplitView *) data; WMSetSplitViewVertical(sPtr, !WMGetSplitViewVertical(sPtr)); } void adjustSubviewsButtonAction(WMWidget * self, void *data) { + (void)self; WMAdjustSplitViewSubviews((WMSplitView *) data); } @@ -902,7 +913,7 @@ void testSplitView(WMScreen * scr) WMMapWidget(win); } -void testUD() +void testUD(void) { WMUserDefaults *defs; char str[32];