Bug Summary

File:src/forg.c
Warning:line 160, column 3
Value stored to 'text' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name forg.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=/home/kfp/aldor/aldor/aldor/src -fcoverage-compilation-dir=/home/kfp/aldor/aldor/aldor/src -resource-dir /usr/local/lib/clang/18 -D PACKAGE_NAME="aldor" -D PACKAGE_TARNAME="aldor" -D PACKAGE_VERSION="1.4.0" -D PACKAGE_STRING="aldor 1.4.0" -D PACKAGE_BUGREPORT="aldor@xinutec.org" -D PACKAGE_URL="" -D PACKAGE="aldor" -D VERSION="1.4.0" -D YYTEXT_POINTER=1 -D HAVE_STDIO_H=1 -D HAVE_STDLIB_H=1 -D HAVE_STRING_H=1 -D HAVE_INTTYPES_H=1 -D HAVE_STDINT_H=1 -D HAVE_STRINGS_H=1 -D HAVE_SYS_STAT_H=1 -D HAVE_SYS_TYPES_H=1 -D HAVE_UNISTD_H=1 -D STDC_HEADERS=1 -D HAVE_LIBREADLINE=1 -D HAVE_READLINE_READLINE_H=1 -D HAVE_READLINE_HISTORY=1 -D HAVE_READLINE_HISTORY_H=1 -D USE_GLOOP_SHELL=1 -D GENERATOR_COROUTINES=0 -D HAVE_DLFCN_H=1 -D LT_OBJDIR=".libs/" -I . -D VCSVERSION="2c53e759f1e00e345f8b172e7139debda72fda13" -internal-isystem /usr/local/lib/clang/18/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 -Wno-empty-body -Wno-enum-compare -Wno-missing-field-initializers -Wno-unused -Wno-unused-parameter -Wno-error=format -Wno-error=type-limits -Wno-error=strict-aliasing -Wno-sign-compare -Wno-error=shift-negative-value -Wno-error=clobbered -std=c99 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2026-01-15-223856-845667-1 -x c forg.c
1#include "axlobs.h"
2#include "forg.h"
3#include "spesym.h"
4#include "store.h"
5#include "comsg.h"
6#include "strops.h"
7#include "util.h"
8
9/*****************************************************************************
10 *
11 * :: Foreign origins
12 *
13 ****************************************************************************/
14
15localstatic ForeignOrigin forgAlloc (FoamProtoTag, String);
16
17static ForeignOrigin stdOrig[FOAM_PROTO_LIMIT - FOAM_PROTO_START];
18
19localstatic ForeignOrigin
20forgAlloc(FoamProtoTag ptag, String file)
21{
22 ForeignOrigin forg = (ForeignOrigin) stoAlloc(OB_Other0, sizeof(*forg));
23
24 forg->protocol = ptag;
25 forg->file = file ? strCopy(file) : NULL((void*)0);
26
27 return forg;
28}
29
30ForeignOrigin
31forgNew(FoamProtoTag ptag, String file)
32{
33 static Bool stdOrigAreInit = false((int) 0);
34 static ForeignOrigin oldOrig = NULL((void*)0);
35
36 if (!stdOrigAreInit) {
37 Length i;
38 for (i = 0; i < FOAM_PROTO_LIMIT - FOAM_PROTO_START; i += 1)
39 stdOrig[i] = forgAlloc((FoamProtoTag)(i) + FOAM_PROTO_START, NULL((void*)0));
40 stdOrigAreInit = true1;
41 }
42
43 if (file == NULL((void*)0))
44 return stdOrig[ptag - FOAM_PROTO_START];
45
46 if (oldOrig && ptag==oldOrig->protocol && strEqual(file,oldOrig->file))
47 return oldOrig;
48
49 return oldOrig = forgAlloc(ptag, file);
50}
51
52ForeignOrigin
53forgFrAbSyn(AbSyn origin)
54{
55 Symbol psym;
56 FoamProtoTag ptag;
57 String file = NULL((void*)0);
58
59 if (!origin)
60 return forgNew(FOAM_Proto_Other, file);
61
62 if (abHasTag(origin, AB_Apply)((origin)->abHdr.tag == (AB_Apply))) {
63 AbSyn *argv = abApplyArgv(origin)((origin)->abApply.argv);
64 if (abApplyArgc(origin)(((origin)->abHdr.argc)-1)==1 && abHasTag(argv[0],AB_LitString)((argv[0])->abHdr.tag == (AB_LitString)))
65 file = argv[0]->abLitString.str;
66
67 origin = origin->abApply.op;
68 }
69
70 psym = abHasTag(origin, AB_Id)((origin)->abHdr.tag == (AB_Id)) ? origin->abId.sym : NULL((void*)0);
71
72 if (!psym || psym == ssymForeign)
73 ptag = FOAM_Proto_Other;
74
75 else if (psym == ssymFortran)
76 ptag = FOAM_Proto_Fortran;
77
78 else if (psym == ssymC)
79 ptag = FOAM_Proto_C;
80
81 else if (psym == ssymLisp)
82 ptag = FOAM_Proto_Lisp;
83
84 else if (psym == ssymJava)
85 ptag = FOAM_Proto_Java;
86
87 else if (psym == ssymBuiltin)
88 ptag = FOAM_Proto_Other;
89
90 else {
91 comsgWarning(origin, ALDOR_W_ScoNotProtocol131);
92 ptag = FOAM_Proto_Other;
93 }
94
95 return forgNew(ptag, file);
96}
97
98Bool
99forgEqual(ForeignOrigin f1, ForeignOrigin f2)
100{
101 if (f1->protocol != f2->protocol)
102 return false((int) 0);
103
104 if (f1->file == NULL((void*)0) && f2->file == NULL((void*)0))
105 return true1;
106 if (f1->file != NULL((void*)0) && f2->file != NULL((void*)0))
107 return strEqual(f1->file, f2->file);
108 return false((int) 0);
109}
110
111void
112forgFree(ForeignOrigin forg)
113{
114 /* Not possible to free these as there is a
115 * pre-initialised cache, and some last-value caching
116 */
117}
118
119AInt
120forgHash(ForeignOrigin forg)
121{
122 if (forg->file == NULL((void*)0)) {
123 return forg->protocol;
124 }
125 return hashCombine(forg->protocol, strHash(forg->file))((((forg->protocol) ^ ((forg->protocol) << 8)) + (
(strHash(forg->file)) + 200041)) & 0x3FFFFFFF)
;
126}
127
128ForeignOrigin
129forgFrBuffer(Buffer buf)
130{
131 FoamProtoTag tag = (FoamProtoTag) bufGetHInt(buf);
132 String file = NULL((void*)0);
133 Bool flg;
134 flg = bufGetByte(buf);
135 if (flg) {
136 file = bufRdString(buf);
137 }
138
139 return forgNew(tag, file);
140}
141
142void
143forgToBuffer(Buffer buf, ForeignOrigin forg)
144{
145 bufPutHInt(buf, forg->protocol);
146 bufPutByte(buf, forg->file != NULL((void*)0));
147 if (forg->file != NULL((void*)0)) {
148 bufWrString(buf, forg->file);
149 }
150}
151
152void
153forgBufferSkip(Buffer buf)
154{
155 String text;
156 Bool flg;
157 bufGetHInt(buf);
158 flg = bufGetByte(buf);
159 if (flg) {
160 text = bufRdString(buf);
Value stored to 'text' is never read
161 }
162}