Bug Summary

File:wm-tester/test-size-hints.c
Warning:line 92, column 11
Value stored to 'y' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name test-size-hints.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/rootdir/src/wm-tester -resource-dir /usr/lib/llvm-16/lib/clang/16 -D HAVE_CONFIG_H -I . -I ../.. -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/harfbuzz -I /usr/include/freetype2 -I /usr/include/libpng16 -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -I /usr/include/cairo -I /usr/include/pixman-1 -I /usr/include/gdk-pixbuf-2.0 -I /usr/include/x86_64-linux-gnu -I /usr/include/webp -I /usr/include/gio-unix-2.0 -I /usr/include/atk-1.0 -I /usr/include/at-spi2-atk/2.0 -I /usr/include/at-spi-2.0 -I /usr/include/dbus-1.0 -I /usr/lib/x86_64-linux-gnu/dbus-1.0/include -D _REENTRANT -D _REENTRANT -I /usr/include/startup-notification-1.0 -I /usr/include/libgtop-2.0 -internal-isystem /usr/lib/llvm-16/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir=/rootdir/src/wm-tester -ferror-limit 19 -fgnuc-version=4.2.1 -analyzer-checker deadcode.DeadStores -analyzer-checker alpha.deadcode.UnreachableCode -analyzer-checker alpha.core.CastSize -analyzer-checker alpha.core.CastToStruct -analyzer-checker alpha.core.IdenticalExpr -analyzer-checker alpha.core.SizeofPtr -analyzer-checker alpha.security.ArrayBoundV2 -analyzer-checker alpha.security.MallocOverflow -analyzer-checker alpha.security.ReturnPtrRange -analyzer-checker alpha.unix.SimpleStream -analyzer-checker alpha.unix.cstring.BufferOverlap -analyzer-checker alpha.unix.cstring.NotNullTerminated -analyzer-checker alpha.unix.cstring.OutOfBounds -analyzer-checker alpha.core.FixedAddr -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /rootdir/html-report/2024-02-14-225616-31151-1 -x c test-size-hints.c
1#include <X11/Xlib.h>
2#include <X11/Xutil.h>
3#include <stdlib.h>
4#include <glib.h>
5
6static Boolint
7all_events (Display *display,
8 XEvent *event,
9 XPointer arg)
10{
11 return True1;
12}
13
14#if 0
15static void
16get_size (Display *d, Drawable draw,
17 int *xp, int *yp, int *widthp, int *heightp)
18{
19 int x, y;
20 unsigned int width, height, border, depth;
21 Window root;
22
23 XGetGeometry (d, draw, &root, &x, &y, &width, &height, &border, &depth);
24
25 if (xp)
26 *xp = x;
27 if (yp)
28 *yp = y;
29 if (widthp)
30 *widthp = width;
31 if (*heightp)
32 *heightp = height;
33}
34#endif
35
36int
37main (int argc, char **argv)
38{
39 Display *d;
40 Window zero_min_size;
41 XSizeHints hints;
42 int screen;
43 XEvent ev;
44 int x, y, width, height;
45 Pixmap pix;
46 GC gc;
47 XGCValues gc_vals;
48 gboolean redraw_pending;
49
50 d = XOpenDisplay (NULL((void*)0));
51
52 screen = DefaultScreen (d)(((_XPrivDisplay)(d))->default_screen);
53
54 x = 0;
55 y = 0;
56 width = 100;
57 height = 100;
58
59 zero_min_size = XCreateSimpleWindow (d, RootWindow (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->root),
60 x, y, width, height, 0,
61 WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel
)
,
62 WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel
)
);
63
64 XSelectInput (d, zero_min_size,
65 ButtonPressMask(1L<<2) | ExposureMask(1L<<15) | StructureNotifyMask(1L<<17));
66
67 hints.flags = PMinSize(1L << 4);
68
69 hints.min_width = 0;
70 hints.min_height = 0;
71
72 XSetWMNormalHints (d, zero_min_size, &hints);
73 XMapWindow (d, zero_min_size);
74
75 redraw_pending = FALSE(0);
76 while (1)
77 {
78 XNextEvent (d, &ev);
79
80 switch (ev.xany.type)
81 {
82 case ButtonPress4:
83 if (ev.xbutton.button == 1)
84 {
85 g_print ("Exiting on button 1 press\n");
86 exit (0);
87 }
88 break;
89
90 case ConfigureNotify22:
91 x = ev.xconfigure.x;
92 y = ev.xconfigure.y;
Value stored to 'y' is never read
93 width = ev.xconfigure.width;
94 height = ev.xconfigure.height;
95
96 redraw_pending = TRUE(!(0));
97 break;
98
99 case Expose12:
100 redraw_pending = TRUE(!(0));
101 break;
102
103 default:
104 break;
105 }
106
107 /* Primitive event compression */
108 if (XCheckIfEvent (d, &ev, all_events, NULL((void*)0)))
109 {
110 XPutBackEvent (d, &ev);
111 }
112 else if (redraw_pending)
113 {
114 pix = XCreatePixmap (d, zero_min_size, width, height,
115 DefaultDepth (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->root_depth
)
);
116
117 gc_vals.foreground = WhitePixel (d, screen)((&((_XPrivDisplay)(d))->screens[screen])->white_pixel
)
;
118
119 gc = XCreateGC (d, pix, GCForeground(1L<<2), &gc_vals);
120
121 XFillRectangle (d, pix, gc, 0, 0, width, height);
122
123 XCopyArea (d, pix, zero_min_size, gc, 0, 0, width, height, 0, 0);
124
125 XFreePixmap (d, pix);
126 XFreeGC (d, gc);
127
128 redraw_pending = FALSE(0);
129 }
130 }
131
132 /* This program has an infinite loop above so a return statement would
133 * just cause compiler warnings.
134 */
135}
136