Bug Summary

File:src/games/monop/print.c
Warning:line 142, column 3
Value stored to 'rnt' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple amd64-unknown-openbsd7.0 -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name print.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -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 1 -pic-is-pie -mframe-pointer=all -relaxed-aliasing -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +retpoline-indirect-calls -target-feature +retpoline-indirect-branches -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/usr/src/games/monop/obj -resource-dir /usr/local/lib/clang/13.0.0 -internal-isystem /usr/local/lib/clang/13.0.0/include -internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir=/usr/src/games/monop/obj -ferror-limit 19 -fwrapv -D_RET_PROTECTOR -ret-protector -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-valloc -fno-builtin-free -fno-builtin-strdup -fno-builtin-strndup -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/ben/Projects/vmm/scan-build/2022-01-12-194120-40624-1 -x c /usr/src/games/monop/print.c
1/* $OpenBSD: print.c,v 1.8 2016/01/08 18:20:33 mestre Exp $ */
2/* $NetBSD: print.c,v 1.3 1995/03/23 08:35:05 cgd Exp $ */
3
4/*
5 * Copyright (c) 1980, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#include <stdio.h>
34
35#include "monop.ext"
36
37static const char *header = "Name Own Price Mg # Rent";
38
39static void printmorg(SQUARE *);
40
41/*
42 * This routine prints out the current board
43 */
44void
45printboard(void)
46{
47 int i;
48
49 printf("%s\t%s\n", header, header);
50 for (i = 0; i < N_SQRS40/2; i++) {
51 printsq(i, FALSE(0));
52 putchar('\t')(!__isthreaded ? __sputc('\t', (&__sF[1])) : (putc)('\t',
(&__sF[1])))
;
53 printsq(i+N_SQRS40/2, TRUE(1));
54 }
55}
56/*
57 * This routine lists where each player is.
58 */
59void
60where(void)
61{
62 int i;
63
64 printf("%s Player\n", header);
65 for (i = 0; i < num_play; i++) {
66 printsq(play[i].loc, FALSE(0));
67 printf(" %s (%d)", play[i].name, i+1);
68 if (cur_p == &play[i])
69 printf(" *");
70 putchar('\n')(!__isthreaded ? __sputc('\n', (&__sF[1])) : (putc)('\n',
(&__sF[1])))
;
71 }
72}
73/*
74 * This routine prints out an individual square
75 */
76void
77printsq(int sqn, boolint8_t eoln)
78{
79 int rnt;
80 PROP *pp;
81 SQUARE *sqp;
82
83 sqp = &board[sqn];
84 printf("%-10.10s", sqp->name);
85 switch (sqp->type) {
86 case SAFE3:
87 case CC4:
88 case CHANCE5:
89 case INC_TAX6:
90 case GOTO_J7:
91 case LUX_TAX8:
92 case IN_JAIL9:
93 if (!eoln)
94 printf(" ");
95 break;
96 case PRPTY0:
97 pp = sqp->desc;
98 if (sqp->owner < 0) {
99 printf(" - %-8.8s %3d", pp->mon_desc->name, sqp->cost);
100 if (!eoln)
101 printf(" ");
102 break;
103 }
104 printf(" %d %-8.8s %3d", sqp->owner+1, pp->mon_desc->name,
105 sqp->cost);
106 printmorg(sqp);
107 if (pp->monop) {
108 if (pp->houses < 5) {
109 if (pp->houses > 0)
110 printf("%d %4d", pp->houses,
111 pp->rent[(int)pp->houses]);
112 else
113 printf("0 %4d", pp->rent[0] * 2);
114 } else
115 printf("H %4d", pp->rent[5]);
116 } else
117 printf(" %4d", pp->rent[0]);
118 break;
119 case UTIL2:
120 if (sqp->owner < 0) {
121 printf(" - 150");
122 if (!eoln)
123 printf(" ");
124 break;
125 }
126 printf(" %d 150", sqp->owner+1);
127 printmorg(sqp);
128 printf("%d", play[(int)sqp->owner].num_util);
129 if (!eoln)
130 printf(" ");
131 break;
132 case RR1:
133 if (sqp->owner < 0) {
134 printf(" - Railroad 200");
135 if (!eoln)
136 printf(" ");
137 break;
138 }
139 printf(" %d Railroad 200", sqp->owner+1);
140 printmorg(sqp);
141 rnt = 25;
142 rnt <<= play[(int)sqp->owner].num_rr - 1;
Value stored to 'rnt' is never read
143 printf("%d %4d", play[(int)sqp->owner].num_rr,
144 25 << (play[(int)sqp->owner].num_rr - 1));
145 break;
146 default:
147 printf("Warning: printsq() switch %d\n", sqp->type);
148 break;
149 }
150 if (eoln)
151 putchar('\n')(!__isthreaded ? __sputc('\n', (&__sF[1])) : (putc)('\n',
(&__sF[1])))
;
152}
153/*
154 * This routine prints out the mortgage flag.
155 */
156static void
157printmorg(SQUARE *sqp)
158{
159 if (sqp->desc->morg)
160 printf(" * ");
161 else
162 printf(" ");
163}
164/*
165 * This routine lists the holdings of the player given
166 */
167void
168printhold(int pl)
169{
170 OWN *op;
171 PLAY *pp;
172
173 pp = &play[pl];
174 printf("%s's (%d) holdings (Total worth: $%d):\n", name_list[pl], pl+1,
175 pp->money + prop_worth(pp));
176 printf("\t$%d", pp->money);
177 if (pp->num_gojf) {
178 printf(", %d get-out-of-jail-free card", pp->num_gojf);
179 if (pp->num_gojf > 1)
180 putchar('s')(!__isthreaded ? __sputc('s', (&__sF[1])) : (putc)('s', (
&__sF[1])))
;
181 }
182 putchar('\n')(!__isthreaded ? __sputc('\n', (&__sF[1])) : (putc)('\n',
(&__sF[1])))
;
183 if (pp->own_list) {
184 printf("\t%s\n", header);
185 for (op = pp->own_list; op; op = op->next) {
186 putchar('\t')(!__isthreaded ? __sputc('\t', (&__sF[1])) : (putc)('\t',
(&__sF[1])))
;
187 printsq(sqnum(op->sqr)(op->sqr - board), TRUE(1));
188 }
189 }
190}