Use snprintf for random unique indexes
Replace sprintf with VL_SNPRINTF when formatting unique-array SMT select indexes. Apple clang marks sprintf deprecated under the current SDK, and --enable-ccwarn promotes that warning to an error when tests compile verilated_random.cpp. Evidence: t_process.py failed before the change at include/verilated_random.cpp:499 with -Wdeprecated-declarations; after the change, t_process.py and t_randomize_unique_elem.py pass.
This commit is contained in:
parent
dde8de0a0d
commit
ed369c0650
|
|
@ -496,7 +496,7 @@ bool VlRandomizer::next(VlRNG& rngr) {
|
|||
std::string distinctExpr = "(__Vbv (distinct";
|
||||
for (uint32_t i = 0; i < size; ++i) {
|
||||
char hexIdx[12];
|
||||
sprintf(hexIdx, "#x%08x", i);
|
||||
(void)VL_SNPRINTF(hexIdx, sizeof(hexIdx), "#x%08x", i);
|
||||
distinctExpr += " (select " + it->first + " " + hexIdx + ")";
|
||||
}
|
||||
distinctExpr += "))";
|
||||
|
|
|
|||
Loading…
Reference in New Issue