Skip to content

Commit cb410cf

Browse files
committed
Merge branch 'main' into improve-enable-all-docs
Updating
2 parents 91519a3 + 35dc425 commit cb410cf

13 files changed

Lines changed: 71 additions & 43 deletions

.github/workflows/CI-unixish.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
os: [ubuntu-22.04, macos-13, macos-15]
23+
os: [ubuntu-22.04, macos-15]
2424
fail-fast: false # Prefer quick result
2525

2626
runs-on: ${{ matrix.os }}
@@ -75,7 +75,7 @@ jobs:
7575

7676
strategy:
7777
matrix:
78-
os: [ubuntu-22.04, macos-13, macos-15]
78+
os: [ubuntu-22.04, macos-15]
7979
fail-fast: false # Prefer quick result
8080

8181
runs-on: ${{ matrix.os }}
@@ -195,7 +195,7 @@ jobs:
195195

196196
strategy:
197197
matrix:
198-
os: [ubuntu-22.04, macos-13, macos-15]
198+
os: [ubuntu-22.04, macos-15]
199199
fail-fast: false # Prefer quick result
200200

201201
runs-on: ${{ matrix.os }}
@@ -229,7 +229,7 @@ jobs:
229229

230230
strategy:
231231
matrix:
232-
os: [ubuntu-22.04, macos-13, macos-15]
232+
os: [ubuntu-22.04, macos-15]
233233
fail-fast: false # Prefer quick result
234234

235235
runs-on: ${{ matrix.os }}
@@ -263,7 +263,7 @@ jobs:
263263

264264
strategy:
265265
matrix:
266-
os: [ubuntu-22.04, macos-13, macos-15]
266+
os: [ubuntu-22.04, macos-15]
267267
fail-fast: false # Prefer quick result
268268

269269
runs-on: ${{ matrix.os }}
@@ -287,7 +287,7 @@ jobs:
287287

288288
strategy:
289289
matrix:
290-
os: [macos-13, macos-15] # non-macos platforms are already built with Boost in other contexts
290+
os: [macos-15] # non-macos platforms are already built with Boost in other contexts
291291
fail-fast: false # Prefer quick result
292292

293293
runs-on: ${{ matrix.os }}
@@ -348,12 +348,10 @@ jobs:
348348

349349
strategy:
350350
matrix:
351-
os: [ubuntu-22.04, macos-13, macos-15]
351+
os: [ubuntu-22.04, macos-15]
352352
include:
353353
- xdist_n: auto
354354
# FIXME: test_color_tty fails with xdist - see #13278
355-
- os: macos-13
356-
xdist_n: '1'
357355
- os: macos-15
358356
xdist_n: '1'
359357
fail-fast: false # Prefer quick result

.github/workflows/scriptcheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ jobs:
203203
dmake:
204204
strategy:
205205
matrix:
206-
os: [ubuntu-22.04, macos-13, macos-15, windows-2025]
206+
os: [ubuntu-22.04, macos-15, windows-2025]
207207
fail-fast: false
208208

209209
runs-on: ${{ matrix.os }}

lib/checkbufferoverrun.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,7 @@ ValueFlow::Value CheckBufferOverrun::getBufferSize(const Token *bufTok) const
564564
if (!var || var->isPointer())
565565
return ValueFlow::Value(-1);
566566

567-
const MathLib::bigint dim = std::accumulate(var->dimensions().cbegin(), var->dimensions().cend(), 1LL, [](MathLib::bigint i1, const Dimension &dim) {
567+
const MathLib::bigint dim = std::accumulate(var->dimensions().cbegin(), var->dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint i1, const Dimension &dim) {
568568
return i1 * dim.num;
569569
});
570570

lib/checktype.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ void CheckType::checkFloatToIntegerOverflow(const Token *tok, const ValueType *v
511511
bits = mSettings->platform.long_long_bit;
512512
else
513513
continue;
514-
if (bits < MathLib::bigint_bits && f.floatValue >= (static_cast<MathLib::biguint>(1) << bits))
514+
if (bits < MathLib::bigint_bits && f.floatValue >= (1ULL << bits))
515515
floatToIntegerOverflowError(tok, f);
516516
}
517517
}

lib/clangimport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ Token *clangimport::AstNode::createTokens(TokenList &tokenList)
785785
if (nodeType == BreakStmt)
786786
return addtoken(tokenList, "break");
787787
if (nodeType == CharacterLiteral) {
788-
const int c = MathLib::toBigNumber(mExtTokens.back());
788+
const int c = static_cast<int>(MathLib::toBigNumber(mExtTokens.back()));
789789
if (c == 0)
790790
return addtoken(tokenList, "\'\\0\'");
791791
if (c == '\r')
@@ -1582,7 +1582,7 @@ static void setValues(const Tokenizer &tokenizer, const SymbolDatabase *symbolDa
15821582

15831583
MathLib::bigint typeSize = 0;
15841584
for (const Variable &var: scope.varlist) {
1585-
const int mul = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), 1, [](int v, const Dimension& dim) {
1585+
const MathLib::bigint mul = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint v, const Dimension& dim) {
15861586
return v * dim.num;
15871587
});
15881588
if (var.valueType())

lib/programmemory.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,19 @@ bool ProgramMemory::empty() const
227227
}
228228

229229
// NOLINTNEXTLINE(performance-unnecessary-value-param) - technically correct but we are moving the given values
230-
void ProgramMemory::replace(ProgramMemory pm)
230+
void ProgramMemory::replace(ProgramMemory pm, bool skipUnknown)
231231
{
232232
if (pm.empty())
233233
return;
234234

235235
copyOnWrite();
236236

237237
for (auto&& p : (*pm.mValues)) {
238+
if (skipUnknown) {
239+
auto it = mValues->find(p.first);
240+
if (it != mValues->end() && it->second.isUninitValue())
241+
continue;
242+
}
238243
(*mValues)[p.first] = std::move(p.second);
239244
}
240245
}
@@ -438,7 +443,8 @@ static void fillProgramMemoryFromAssignments(ProgramMemory& pm, const Token* tok
438443
if (!setvar) {
439444
if (!pm.hasValue(vartok->exprId())) {
440445
const Token* valuetok = tok2->astOperand2();
441-
pm.setValue(vartok, execute(valuetok, pm, settings));
446+
ProgramMemory local = state;
447+
pm.setValue(vartok, execute(valuetok, local, settings));
442448
}
443449
}
444450
} else if (Token::simpleMatch(tok2, ")") && tok2->link() &&
@@ -519,7 +525,7 @@ void ProgramMemoryState::replace(ProgramMemory pm, const Token* origin)
519525
if (origin)
520526
for (const auto& p : pm)
521527
origins[p.first.getExpressionId()] = origin;
522-
state.replace(std::move(pm));
528+
state.replace(std::move(pm), /*skipUnknown*/ true);
523529
}
524530

525531
static void addVars(ProgramMemory& pm, const ProgramMemory::Map& vars)
@@ -532,13 +538,14 @@ static void addVars(ProgramMemory& pm, const ProgramMemory::Map& vars)
532538

533539
void ProgramMemoryState::addState(const Token* tok, const ProgramMemory::Map& vars)
534540
{
535-
ProgramMemory pm = state;
536-
addVars(pm, vars);
537-
fillProgramMemoryFromConditions(pm, tok, settings);
538-
ProgramMemory local = pm;
541+
ProgramMemory local = state;
542+
addVars(local, vars);
543+
fillProgramMemoryFromConditions(local, tok, settings);
544+
ProgramMemory pm;
539545
fillProgramMemoryFromAssignments(pm, tok, settings, local, vars);
540-
addVars(pm, vars);
541-
replace(std::move(pm), tok);
546+
local.replace(std::move(pm));
547+
addVars(local, vars);
548+
replace(std::move(local), tok);
542549
}
543550

544551
void ProgramMemoryState::assume(const Token* tok, bool b, bool isEmpty)

lib/programmemory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ struct CPPCHECKLIB ProgramMemory {
134134

135135
bool empty() const;
136136

137-
void replace(ProgramMemory pm);
137+
void replace(ProgramMemory pm, bool skipUnknown = false);
138138

139139
Map::const_iterator begin() const {
140140
return mValues->cbegin();

lib/token.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -778,10 +778,10 @@ class CPPCHECKLIB Token {
778778
bool setBits(const MathLib::bigint b) {
779779
const MathLib::bigint max = std::numeric_limits<short>::max();
780780
if (b > max) {
781-
mImpl->mBits = max;
781+
mImpl->mBits = static_cast<short>(max);
782782
return false;
783783
}
784-
mImpl->mBits = b < 0 ? -1 : b;
784+
mImpl->mBits = b < 0 ? -1 : static_cast<short>(b);
785785
return true;
786786
}
787787

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10025,7 +10025,7 @@ void Tokenizer::simplifyBitfields()
1002510025
}
1002610026

1002710027
const auto tooLargeError = [this](const Token *tok) {
10028-
const MathLib::bigint max = std::numeric_limits<short>::max();
10028+
const auto max = std::numeric_limits<short>::max();
1002910029
reportError(tok,
1003010030
Severity::warning,
1003110031
"tooLargeBitField",

lib/valueflow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ static Result accumulateStructMembers(const Scope* scope, F f, ValueFlow::Accura
445445
if (const ValueType* vt = var.valueType()) {
446446
if (vt->type == ValueType::Type::RECORD && vt->typeScope == scope)
447447
return {0, false};
448-
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), 1LL, [](MathLib::bigint i1, const Dimension& dim) {
448+
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint i1, const Dimension& dim) {
449449
return i1 * dim.num;
450450
});
451451
if (var.nameToken()->scope() != scope && var.nameToken()->scope()->definedType) { // anonymous union

0 commit comments

Comments
 (0)