mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-06 01:24:10 +00:00
kernel/drivertools.h: avoid maybe-uninitialized compile warnings
Initialize "unsigned int inner" in hash() functions Includes a log_assert() that might help catch corrupted data structures or future incomplete modification of DriveType definition
This commit is contained in:
parent
cef87cc179
commit
d36a387aca
|
@ -364,7 +364,7 @@ public:
|
||||||
|
|
||||||
unsigned int hash() const
|
unsigned int hash() const
|
||||||
{
|
{
|
||||||
unsigned int inner;
|
unsigned int inner = 0;
|
||||||
switch (type_)
|
switch (type_)
|
||||||
{
|
{
|
||||||
case DriveType::NONE:
|
case DriveType::NONE:
|
||||||
|
@ -385,6 +385,9 @@ public:
|
||||||
case DriveType::MULTIPLE:
|
case DriveType::MULTIPLE:
|
||||||
inner = multiple_.hash();
|
inner = multiple_.hash();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
log_assert(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return mkhash((unsigned int)type_, inner);
|
return mkhash((unsigned int)type_, inner);
|
||||||
}
|
}
|
||||||
|
@ -912,7 +915,7 @@ public:
|
||||||
|
|
||||||
unsigned int hash() const
|
unsigned int hash() const
|
||||||
{
|
{
|
||||||
unsigned int inner;
|
unsigned int inner = 0;
|
||||||
switch (type_)
|
switch (type_)
|
||||||
{
|
{
|
||||||
case DriveType::NONE:
|
case DriveType::NONE:
|
||||||
|
@ -933,6 +936,9 @@ public:
|
||||||
case DriveType::MULTIPLE:
|
case DriveType::MULTIPLE:
|
||||||
inner = multiple_.hash();
|
inner = multiple_.hash();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
log_assert(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return mkhash((unsigned int)type_, inner);
|
return mkhash((unsigned int)type_, inner);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue