Examples of errors detected by the V751 diagnostic
V751. Parameter is not used inside function's body.
Overgrowth
V751 [CERT-MSC13-C] Parameter 'rayTo' is not used inside function body. btSoftBody.cpp 2148
btScalar btSoftBody::RayFromToCaster::rayFromToTriangle(
const btVector3& rayFrom,
const btVector3& rayTo,
const btVector3& rayNormalizedDirection,
const btVector3& a,
const btVector3& b,
const btVector3& c,
btScalar maxt)
{
static const btScalar ceps = -SIMD_EPSILON * 10;
static const btScalar teps = SIMD_EPSILON * 10;
const btVector3 n = btCross(b - a, c - a);
const btScalar d = btDot(a, n);
const btScalar den = btDot(rayNormalizedDirection, n);
if (!btFuzzyZero(den))
{
const btScalar num = btDot(rayFrom, n) - d;
const btScalar t = -num / den;
if ((t > teps) && (t < maxt))
{
const btVector3 hit = rayFrom + rayNormalizedDirection * t;
if ((btDot(n, btCross(a - hit, b - hit)) > ceps) &&
(btDot(n, btCross(b - hit, c - hit)) > ceps) &&
(btDot(n, btCross(c - hit, a - hit)) > ceps))
{
return (t);
}
}
}
return (-1);
}
Bullet Physics SDK
V751 Parameter 'halfExtentsZ' is not used inside function body. TinyRenderer.cpp 375
void TinyRenderObjectData::createCube(float halfExtentsX,
float halfExtentsY,
float halfExtentsZ,
....)
{
....
m_model->addVertex(halfExtentsX * cube_vertices_textured[i * 9],
halfExtentsY * cube_vertices_textured[i * 9 + 1],
halfExtentsY * cube_vertices_textured[i * 9 + 2],
cube_vertices_textured[i * 9 + 4],
....);
....
}
Godot Engine
V751 Parameter 'p_y' is not used inside function body. texture.cpp 1085
bool AtlasTexture::is_pixel_opaque(int p_x, int p_y) const {
if (atlas.is_valid()) {
return atlas->is_pixel_opaque(p_x + region.position.x + margin.position.x,
p_x + region.position.y + margin.position.y);
}
return true;
}
System Shock
V751 Parameter 'Y' is not used inside function body. BTEST.C 67
fix Terrain( fix X, fix Y, int deriv ) {
if( deriv == 0 )
return fix_mul(...., (X - ....) );
if( deriv == 1 )
return fix_mul(...., (X - ....) );
if( deriv == 2 ) return 0;
return 0;
}
HarfBuzz
V751 Parameter 'right' is not used inside function body. hb-ot-kern-table.hh 115
inline int get_kerning (hb_codepoint_t left,
hb_codepoint_t right,
const char *end) const
{
unsigned int l = (this+leftClassTable).get_class (left);
unsigned int r = (this+leftClassTable).get_class (left); // <=
unsigned int offset = l * rowWidth + r * sizeof (FWORD);
....
}
Nice error due to Copy-Paste. One copied the line, but forgot to change the left with right twice.
Steinberg SDKs
V751 Parameter 'column' is not used inside function body. pitchnamesdatabrowsersource.cpp 227
void PitchNamesDataBrowserSource::dbCellTextChanged(
int32_t row, int32_t column, ....)
{
if (pitchnames)
{
UString128 str (newText);
if (str.getLength () == 0)
pitchnames->removePitchName (0, (int16)row);
else
pitchnames->setPitchName (0, (int16)row, str);
}
}
Valgrind
V751 Parameter 'i2' is not used inside function body. host_tilegx_defs.c 1223
void genReload_TILEGX ( /*OUT*/ HInstr ** i1,
/*OUT*/ HInstr ** i2,
HReg rreg,
Int offsetB )
{
TILEGXAMode *am;
vassert(!hregIsVirtual(rreg));
am = TILEGXAMode_IR(offsetB, TILEGXGuestStatePointer());
switch (hregClass(rreg)) {
case HRcInt64:
*i1 = TILEGXInstr_Load(8, rreg, am); // <=
break;
case HRcInt32:
*i1 = TILEGXInstr_Load(4, rreg, am); // <=
break;
default:
ppHRegClass(hregClass(rreg));
vpanic("genReload_TILEGX: unimplemented regclass");
break;
}
}
Similar errors can be found in some other places:
- V751 Parameter 'i2' is not used inside function body. host_mips_defs.c 2000
Linux Kernel
V751 Parameter 'LCDheight' is not used inside function body. init.c 339
static
unsigned short
SiS_GetModeID(int VGAEngine, unsigned int VBFlags,
int HDisplay, int VDisplay,
int Depth, bool FSTN,
int LCDwidth, int LCDheight)
{
unsigned short ModeIndex = 0;
switch(HDisplay)
{
case 320:
if(VDisplay == 200) ModeIndex = ModeIndex_320x200[Depth];
else if(VDisplay == 240) {
if((VBFlags & CRT2_LCD) && (FSTN))
ModeIndex = ModeIndex_320x240_FSTN[Depth];
else
ModeIndex = ModeIndex_320x240[Depth];
}
break;
case 400:
if((!(VBFlags & CRT1_LCDA)) ||
((LCDwidth >= 800) && (LCDwidth >= 600))) { // <=
if(VDisplay == 300) ModeIndex = ModeIndex_400x300[Depth];
}
break;
case 512:
if((!(VBFlags & CRT1_LCDA)) ||
((LCDwidth >= 1024) && (LCDwidth >= 768))) { // <=
if(VDisplay == 384) ModeIndex = ModeIndex_512x384[Depth];
}
break;
....
}
return ModeIndex;
}