elsid
|
ec0c76d2f3
|
Ignore false positive warning
cellSize > 1 so the result of the division cannot be undefined.
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:18:35: error: The result of the '/' expression is undefined [clang-analyzer-core.UndefinedBinaryOperatorResult,-warnings-as-errors]
18 | std::size_t cell = global / (cellSize - 1);
| ^
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:244:13: note: Assuming 'lodLevel' is >= 0
244 | if (lodLevel < 0 || 63 < lodLevel)
| ^~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:244:13: note: Left side of '||' is false
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:244:29: note: Assuming 'lodLevel' is <= 63
244 | if (lodLevel < 0 || 63 < lodLevel)
| ^~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:244:9: note: Taking false branch
244 | if (lodLevel < 0 || 63 < lodLevel)
| ^
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:247:13: note: Assuming 'size' is > 0
247 | if (size <= 0)
| ^~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:247:9: note: Taking false branch
247 | if (size <= 0)
| ^
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:272:13: note: Assuming the condition is false
272 | if (land != nullptr)
| ^~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:272:9: note: Taking false branch
272 | if (land != nullptr)
| ^
/home/elsid/dev/openmw/components/esmterrain/storage.cpp:363:9: note: Calling 'sampleCellGrid<const (lambda at /home/elsid/dev/openmw/components/esmterrain/storage.cpp:280:35) &>'
363 | sampleCellGrid(cellSize, sampleSize, beginX, beginY, distance, handleSample);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:72:13: note: Assuming 'cellSize' is >= 2
72 | if (cellSize < 2 || !Misc::isPowerOfTwo(cellSize - 1))
| ^~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:72:13: note: Left side of '||' is false
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:72:9: note: Taking false branch
72 | if (cellSize < 2 || !Misc::isPowerOfTwo(cellSize - 1))
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:75:13: note: Assuming 'sampleSize' is not equal to 0
75 | if (sampleSize == 0 || !Misc::isPowerOfTwo(sampleSize))
| ^~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:75:13: note: Left side of '||' is false
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:75:9: note: Taking false branch
75 | if (sampleSize == 0 || !Misc::isPowerOfTwo(sampleSize))
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:78:13: note: Assuming 'distance' is >= 2
78 | if (distance < 2 || !Misc::isPowerOfTwo(distance - 1))
| ^~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:78:13: note: Left side of '||' is false
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:78:9: note: Taking false branch
78 | if (distance < 2 || !Misc::isPowerOfTwo(distance - 1))
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:84:13: note: Assuming 'distance' is >= 'cellSize'
84 | if (distance < cellSize || sampleSize > cellSize - 1)
| ^~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:84:13: note: Left side of '||' is false
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:84:36: note: Assuming the condition is true
84 | if (distance < cellSize || sampleSize > cellSize - 1)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:84:9: note: Taking true branch
84 | if (distance < cellSize || sampleSize > cellSize - 1)
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:85:20: note: Calling 'sampleCellGridSimple<const (lambda at /home/elsid/dev/openmw/components/esmterrain/storage.cpp:280:35) &>'
85 | return sampleCellGridSimple(cellSize, sampleSize, beginX, beginY, endX, endY, f);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:56:16: note: 'cellSize' is > 1
56 | assert(cellSize > 1);
| ^
/usr/include/assert.h💯27: note: expanded from macro 'assert'
100 | (static_cast <bool> (expr) \
| ^~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:56:9: note: '?' condition is true
56 | assert(cellSize > 1);
| ^
/usr/include/assert.h💯7: note: expanded from macro 'assert'
100 | (static_cast <bool> (expr) \
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:57:9: note: '?' condition is true
57 | assert(Misc::isPowerOfTwo(cellSize - 1));
| ^
/usr/include/assert.h💯7: note: expanded from macro 'assert'
100 | (static_cast <bool> (expr) \
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:58:16: note: 'sampleSize' is not equal to 0
58 | assert(sampleSize != 0);
| ^
/usr/include/assert.h💯27: note: expanded from macro 'assert'
100 | (static_cast <bool> (expr) \
| ^~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:58:9: note: '?' condition is true
58 | assert(sampleSize != 0);
| ^
/usr/include/assert.h💯7: note: expanded from macro 'assert'
100 | (static_cast <bool> (expr) \
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:60:9: note: Calling 'sampleGrid<(lambda at /home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:61:13)>'
60 | sampleGrid(sampleSize, beginX, beginY, endX, endY,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61 | [&](std::size_t globalX, std::size_t globalY, std::size_t vertX, std::size_t vertY) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 | const auto [cellX, x] = toCellAndLocal(beginX, globalX, cellSize);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63 | const auto [cellY, y] = toCellAndLocal(beginY, globalY, cellSize);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 | f(cellX, cellY, x, y, vertX, vertY);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65 | });
| ~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:33:38: note: Assuming 'y' is < 'endY'
33 | for (std::size_t y = beginY; y < endY; y += sampleSize)
| ^~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:33:9: note: Loop condition is true. Entering loop body
33 | for (std::size_t y = beginY; y < endY; y += sampleSize)
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:36:42: note: Assuming 'x' is < 'endX'
36 | for (std::size_t x = beginX; x < endX; x += sampleSize)
| ^~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:36:13: note: Loop condition is true. Entering loop body
36 | for (std::size_t x = beginX; x < endX; x += sampleSize)
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:36:42: note: Assuming 'x' is < 'endX'
36 | for (std::size_t x = beginX; x < endX; x += sampleSize)
| ^~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:36:13: note: Loop condition is true. Entering loop body
36 | for (std::size_t x = beginX; x < endX; x += sampleSize)
| ^
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:37:17: note: Calling 'operator()'
37 | f(x, y, vertX++, vertY);
| ^~~~~~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:62:41: note: Calling 'toCellAndLocal'
62 | const auto [cellX, x] = toCellAndLocal(beginX, globalX, cellSize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/elsid/dev/openmw/components/esmterrain/gridsampling.hpp:18:35: note: The result of the '/' expression is undefined
18 | std::size_t cell = global / (cellSize - 1);
| ~~~~~~~^~~~~~~~~~~~~~~~
|
2025-07-27 12:11:24 +02:00 |
|