Bug Summary

File:_build/../libvnck/test-pager.c
Warning:line 95, column 18
This statement is never executed

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-pager.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 -fdebug-compilation-dir=/rootdir/_build -fcoverage-compilation-dir=/rootdir/_build -resource-dir /usr/lib/llvm-19/lib/clang/19 -I libvnck/test-pager.p -I libvnck -I ../libvnck -I . -I .. -I /usr/include/cairo -I /usr/include/libpng16 -I /usr/include/freetype2 -I /usr/include/pixman-1 -I /usr/include/glib-2.0 -I /usr/lib/x86_64-linux-gnu/glib-2.0/include -I /usr/include/sysprof-6 -I /usr/include/ctk-3.0 -I /usr/include/pango-1.0 -I /usr/include/harfbuzz -I /usr/include/libmount -I /usr/include/blkid -I /usr/include/fribidi -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 -I /usr/include/startup-notification-1.0 -D _FILE_OFFSET_BITS=64 -D G_LOG_DOMAIN="Vnck" -D VNCK_I_KNOW_THIS_IS_UNSTABLE -D VNCK_LOCALEDIR="/usr/local/share/locale" -D VNCK_COMPILATION -D SN_API_NOT_YET_FROZEN=1 -internal-isystem /usr/lib/llvm-19/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/14/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -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.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/2025-02-26-082442-9764-1 -x c ../libvnck/test-pager.c
1/* vim: set sw=2 et: */
2
3#include <libvnck/libvnck.h>
4#include <ctk/ctk.h>
5
6static int n_rows = 1;
7static gboolean only_current = FALSE(0);
8static gboolean rtl = FALSE(0);
9static gboolean show_name = FALSE(0);
10static gboolean simple_scrolling = FALSE(0);
11static gboolean vertical = FALSE(0);
12static gboolean wrap_on_scroll = FALSE(0);
13
14static GOptionEntry entries[] = {
15 {"n-rows", 'n', 0, G_OPTION_ARG_INT, &n_rows, "Use N_ROWS rows", "N_ROWS"},
16 {"only-current", 'c', 0, G_OPTION_ARG_NONE, &only_current, "Only show current workspace", NULL((void*)0)},
17 {"rtl", 'r', 0, G_OPTION_ARG_NONE, &rtl, "Use RTL as default direction", NULL((void*)0)},
18 {"show-name", 's', 0, G_OPTION_ARG_NONE, &show_name, "Show workspace names instead of workspace contents", NULL((void*)0)},
19 {"simple-scrolling", 'd', 0, G_OPTION_ARG_NONE, &simple_scrolling, "Use the simple 1d scroll mode", NULL((void*)0)},
20 {"vertical-orientation", 'v', 0, G_OPTION_ARG_NONE, &vertical, "Use a vertical orientation", NULL((void*)0)},
21 {"wrap-on-scroll", 'w', 0, G_OPTION_ARG_NONE, &wrap_on_scroll, "Wrap on scrolling over borders", NULL((void*)0)},
22 {NULL((void*)0) }
23};
24
25static void
26create_pager_window (CtkOrientation orientation,
27 gboolean show_all,
28 VnckPagerDisplayMode mode,
29 VnckPagerScrollMode scroll_mode,
30 int rows,
31 gboolean wrap)
32{
33 CtkWidget *win;
34 CtkWidget *pager;
35
36 win = ctk_window_new (CTK_WINDOW_TOPLEVEL);
37
38 ctk_window_stick (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((win)), ((ctk_window_get_type ()))))))
);
39#if 0
40 vnck_ctk_window_set_dock_type (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((win)), ((ctk_window_get_type ()))))))
);
41#endif
42
43 ctk_window_set_title (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((win)), ((ctk_window_get_type ()))))))
, "Pager");
44
45 /* very very random */
46 ctk_window_move (CTK_WINDOW (win)((((CtkWindow*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((win)), ((ctk_window_get_type ()))))))
, 0, 0);
47
48 /* quit on window close */
49 g_signal_connect (G_OBJECT (win), "destroy",g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((win)), (((GType) ((20) << (2))))))
))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0
)), ((void*)0), (GConnectFlags) 0)
50 G_CALLBACK (ctk_main_quit),g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((win)), (((GType) ((20) << (2))))))
))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0
)), ((void*)0), (GConnectFlags) 0)
51 NULL)g_signal_connect_data ((((((GObject*) (void *) g_type_check_instance_cast
((GTypeInstance*) ((win)), (((GType) ((20) << (2))))))
))), ("destroy"), (((GCallback) (ctk_main_quit))), (((void*)0
)), ((void*)0), (GConnectFlags) 0)
;
52
53 pager = vnck_pager_new ();
54
55 vnck_pager_set_show_all (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, show_all);
56 vnck_pager_set_display_mode (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, mode);
57 vnck_pager_set_scroll_mode (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, scroll_mode);
58 vnck_pager_set_orientation (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, orientation);
59 vnck_pager_set_n_rows (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, rows);
60 vnck_pager_set_shadow_type (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, CTK_SHADOW_IN);
61 vnck_pager_set_wrap_on_scroll (VNCK_PAGER (pager)((((VnckPager*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((pager)), ((vnck_pager_get_type ()))))))
, wrap);
62
63 ctk_container_add (CTK_CONTAINER (win)((((CtkContainer*) (void *) g_type_check_instance_cast ((GTypeInstance
*) ((win)), ((ctk_container_get_type ()))))))
, pager);
64
65 ctk_widget_show_all (win);
66}
67
68int
69main (int argc, char **argv)
70{
71 GOptionContext *ctxt;
72 CtkOrientation orientation;
73 VnckPagerDisplayMode mode;
74 VnckPagerScrollMode scroll_mode;
75 VnckScreen *screen;
76
77 ctxt = g_option_context_new ("");
78 g_option_context_add_main_entries (ctxt, entries, NULL((void*)0));
79 g_option_context_add_group (ctxt, ctk_get_option_group (TRUE(!(0))));
80 g_option_context_parse (ctxt, &argc, &argv, NULL((void*)0));
81 g_option_context_free (ctxt);
82 ctxt = NULL((void*)0);
83
84 ctk_init (&argc, &argv);
85
86 if (rtl)
87 ctk_widget_set_default_direction (CTK_TEXT_DIR_RTL);
88
89 screen = vnck_screen_get_default ();
90
91 /* because the pager doesn't respond to signals at the moment */
92 vnck_screen_force_update (screen);
93
94 if (vertical)
95 orientation = CTK_ORIENTATION_VERTICAL;
This statement is never executed
96 else
97 orientation = CTK_ORIENTATION_HORIZONTAL;
98
99 if (show_name)
100 mode = VNCK_PAGER_DISPLAY_NAME;
101 else
102 mode = VNCK_PAGER_DISPLAY_CONTENT;
103
104 if (simple_scrolling)
105 scroll_mode = VNCK_PAGER_SCROLL_1D;
106 else
107 scroll_mode = VNCK_PAGER_SCROLL_2D;
108
109 create_pager_window (orientation, !only_current, mode, scroll_mode, n_rows, wrap_on_scroll);
110
111 ctk_main ();
112
113 return 0;
114}