Bug Summary

File:out/../deps/icu-small/source/i18n/rbt_data.cpp
Warning:line 64, column 13
Value stored to 'status' 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 rbt_data.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -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=/home/maurizio/node-v18.6.0/out -resource-dir /usr/local/lib/clang/16.0.0 -D V8_DEPRECATION_WARNINGS -D V8_IMMINENT_DEPRECATION_WARNINGS -D _GLIBCXX_USE_CXX11_ABI=1 -D NODE_OPENSSL_CONF_NAME=nodejs_conf -D NODE_OPENSSL_HAS_QUIC -D __STDC_FORMAT_MACROS -D OPENSSL_NO_PINSHARED -D OPENSSL_THREADS -D U_COMMON_IMPLEMENTATION=1 -D U_I18N_IMPLEMENTATION=1 -D U_IO_IMPLEMENTATION=1 -D U_TOOLUTIL_IMPLEMENTATION=1 -D U_ATTRIBUTE_DEPRECATED= -D _CRT_SECURE_NO_DEPRECATE= -D U_STATIC_IMPLEMENTATION=1 -D UCONFIG_NO_SERVICE=1 -D U_ENABLE_DYLOAD=0 -D U_HAVE_STD_STRING=1 -D UCONFIG_NO_BREAK_ITERATION=0 -I ../deps/icu-small/source/common -I ../deps/icu-small/source/i18n -I ../deps/icu-small/source/tools/toolutil -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8 -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/x86_64-redhat-linux -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/backward -internal-isystem /usr/local/lib/clang/16.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-redhat-linux/8/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-deprecated-declarations -Wno-strict-aliasing -std=gnu++17 -fdeprecated-macro -fdebug-compilation-dir=/home/maurizio/node-v18.6.0/out -ferror-limit 19 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/scan-build-2022-08-22-142216-507842-1 -x c++ ../deps/icu-small/source/i18n/rbt_data.cpp
1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html
3/*
4**********************************************************************
5* Copyright (C) 1999-2014, International Business Machines
6* Corporation and others. All Rights Reserved.
7**********************************************************************
8* Date Name Description
9* 11/17/99 aliu Creation.
10**********************************************************************
11*/
12
13#include "unicode/utypes.h"
14#include "umutex.h"
15
16#if !UCONFIG_NO_TRANSLITERATION0
17
18#include "unicode/unistr.h"
19#include "unicode/uniset.h"
20#include "rbt_data.h"
21#include "hash.h"
22#include "cmemory.h"
23
24U_NAMESPACE_BEGINnamespace icu_71 {
25
26TransliterationRuleData::TransliterationRuleData(UErrorCode& status)
27 : UMemory(), ruleSet(status), variableNames(status),
28 variables(0), variablesAreOwned(TRUE1)
29{
30 if (U_FAILURE(status)) {
31 return;
32 }
33 variableNames.setValueDeleter(uprv_deleteUObjectuprv_deleteUObject_71);
34 variables = 0;
35 variablesLength = 0;
36}
37
38TransliterationRuleData::TransliterationRuleData(const TransliterationRuleData& other) :
39 UMemory(other), ruleSet(other.ruleSet),
40 variablesAreOwned(TRUE1),
41 variablesBase(other.variablesBase),
42 variablesLength(other.variablesLength)
43{
44 UErrorCode status = U_ZERO_ERROR;
45 int32_t i = 0;
46 variableNames.setValueDeleter(uprv_deleteUObjectuprv_deleteUObject_71);
47 int32_t pos = UHASH_FIRST(-1);
48 const UHashElement *e;
49 while ((e = other.variableNames.nextElement(pos)) != 0) {
50 UnicodeString* value =
51 new UnicodeString(*(const UnicodeString*)e->value.pointer);
52 // Exit out if value could not be created.
53 if (value == NULL__null) {
54 return;
55 }
56 variableNames.put(*(UnicodeString*)e->key.pointer, value, status);
57 }
58
59 variables = 0;
60 if (other.variables != 0) {
61 variables = (UnicodeFunctor **)uprv_mallocuprv_malloc_71(variablesLength * sizeof(UnicodeFunctor *));
62 /* test for NULL */
63 if (variables == 0) {
64 status = U_MEMORY_ALLOCATION_ERROR;
Value stored to 'status' is never read
65 return;
66 }
67 for (i=0; i<variablesLength; ++i) {
68 variables[i] = other.variables[i]->clone();
69 if (variables[i] == NULL__null) {
70 status = U_MEMORY_ALLOCATION_ERROR;
71 break;
72 }
73 }
74 }
75 // Remove the array and exit if memory allocation error occurred.
76 if (U_FAILURE(status)) {
77 for (int32_t n = i-1; n >= 0; n--) {
78 delete variables[n];
79 }
80 uprv_freeuprv_free_71(variables);
81 variables = NULL__null;
82 return;
83 }
84
85 // Do this last, _after_ setting up variables[].
86 ruleSet.setData(this); // ruleSet must already be frozen
87}
88
89TransliterationRuleData::~TransliterationRuleData() {
90 if (variablesAreOwned && variables != 0) {
91 for (int32_t i=0; i<variablesLength; ++i) {
92 delete variables[i];
93 }
94 }
95 uprv_freeuprv_free_71(variables);
96}
97
98UnicodeFunctor*
99TransliterationRuleData::lookup(UChar32 standIn) const {
100 int32_t i = standIn - variablesBase;
101 return (i >= 0 && i < variablesLength) ? variables[i] : 0;
102}
103
104UnicodeMatcher*
105TransliterationRuleData::lookupMatcher(UChar32 standIn) const {
106 UnicodeFunctor *f = lookup(standIn);
107 return (f != 0) ? f->toMatcher() : 0;
108}
109
110UnicodeReplacer*
111TransliterationRuleData::lookupReplacer(UChar32 standIn) const {
112 UnicodeFunctor *f = lookup(standIn);
113 return (f != 0) ? f->toReplacer() : 0;
114}
115
116
117U_NAMESPACE_END}
118
119#endif /* #if !UCONFIG_NO_TRANSLITERATION */