From 5e69faff468a0e3e6082466188aeb867f57fb921 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Thu, 27 Mar 2025 19:01:25 -0400 Subject: [PATCH] Fix clang 20 warnings --- include/verilated_vpi.cpp | 2 +- src/V3Param.cpp | 6 ++---- test_regress/t/t_vpi_get_value_array.cpp | 8 ++++---- test_regress/t/t_vpi_put_value_array.cpp | 10 +++++----- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/include/verilated_vpi.cpp b/include/verilated_vpi.cpp index c05b0820d..c4e4bf293 100644 --- a/include/verilated_vpi.cpp +++ b/include/verilated_vpi.cpp @@ -85,7 +85,7 @@ public: // To simplify our free list, we use a size large enough for all derived types // We reserve word zero for the next pointer, as that's safer in case a // dangling reference to the original remains around. - static constexpr size_t CHUNK_SIZE = 128; + static constexpr size_t CHUNK_SIZE = 256; if (VL_UNCOVERABLE(size > CHUNK_SIZE)) VL_FATAL_MT(__FILE__, __LINE__, "", "increase CHUNK_SIZE"); if (VL_LIKELY(t_freeHeadp)) { diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 31f7aa684..e5cf86c39 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -1260,14 +1260,12 @@ class ParamVisitor final : public VNVisitor { if (const AstNodeDType* const typep = varp->childDTypep()) { ifacerefp = VN_CAST(typep, IfaceRefDType); if (!ifacerefp) { - if (const AstUnpackArrayDType* const unpackp - = VN_CAST(typep, UnpackArrayDType)) { + if (VN_IS(typep, UnpackArrayDType)) { ifacerefp = VN_CAST(typep->getChildDTypep(), IfaceRefDType); } } if (!ifacerefp) { - if (const AstBracketArrayDType* const unpackp - = VN_CAST(typep, BracketArrayDType)) { + if (VN_IS(typep, BracketArrayDType)) { ifacerefp = VN_CAST(typep->subDTypep(), IfaceRefDType); } } diff --git a/test_regress/t/t_vpi_get_value_array.cpp b/test_regress/t/t_vpi_get_value_array.cpp index 86796eb04..621d1ac62 100644 --- a/test_regress/t/t_vpi_get_value_array.cpp +++ b/test_regress/t/t_vpi_get_value_array.cpp @@ -117,7 +117,7 @@ int test_vpiVectorVal(char* name, PLI_BYTE8* test_data, int index, const unsigne const unsigned elem_size_words = (elem_size + 3) / sizeof(PLI_UINT32); const unsigned vec_size = elem_size_words * size; std::vector test_data_vectors; - test_data_vectors.reserve(vec_size); + test_data_vectors.resize(vec_size); unsigned test_data_index = 0; for (unsigned i = 0; i < size; i++) { unsigned count = 0; @@ -179,7 +179,7 @@ int test_vpiIntVal(char* name, PLI_BYTE8* test_data, int index, const unsigned l // prepare index int index_arr[1] = {index}; std::vector test_data_integers; - test_data_integers.reserve(size); + test_data_integers.resize(size); for (unsigned i = 0; i < size; i++) { PLI_INT32& integer = test_data_integers[i]; integer = 0; @@ -230,7 +230,7 @@ int test_vpiShortIntVal(char* name, PLI_BYTE8* test_data, int index, const unsig // prepare index int index_arr[1] = {index}; std::vector test_data_shortints; - test_data_shortints.reserve(size); + test_data_shortints.resize(size); for (unsigned i = 0; i < size; i++) { if (elem_size == 2) { test_data_shortints[i] = test_data[i * 2] & 0xFF; @@ -282,7 +282,7 @@ int test_vpiLongIntVal(char* name, PLI_BYTE8* test_data, int index, const unsign // prepare index int index_arr[1] = {index}; std::vector test_data_longints; - test_data_longints.reserve(size); + test_data_longints.resize(size); for (unsigned i = 0; i < size; i++) { PLI_INT64& longint = test_data_longints[i]; longint = 0; diff --git a/test_regress/t/t_vpi_put_value_array.cpp b/test_regress/t/t_vpi_put_value_array.cpp index 2e9008ba4..b8f8c65a7 100644 --- a/test_regress/t/t_vpi_put_value_array.cpp +++ b/test_regress/t/t_vpi_put_value_array.cpp @@ -36,7 +36,7 @@ int test_vpiRawFourStateVal(char* name, PLI_BYTE8* test_data, int index, const u // prepare index and test data arrays int index_arr[1] = {index}; std::vector test_data_four_state; - test_data_four_state.reserve(size * elem_size * 2); + test_data_four_state.resize(size * elem_size * 2); for (unsigned i = 0; i < size; i++) { for (unsigned j = 0; j < elem_size; j++) { test_data_four_state[(i * 2 * elem_size) + j] = test_data[(i * elem_size) + j]; @@ -147,7 +147,7 @@ int test_vpiVectorVal(char* name, PLI_BYTE8* test_data, int index, const unsigne const unsigned elem_size_words = (elem_size + 3) / sizeof(PLI_UINT32); const unsigned vec_size = elem_size_words * size; std::vector test_data_vectors; - test_data_vectors.reserve(vec_size); + test_data_vectors.resize(vec_size); unsigned test_data_index = 0; for (unsigned i = 0; i < size; i++) { unsigned count = 0; @@ -214,7 +214,7 @@ int test_vpiIntVal(char* name, PLI_BYTE8* test_data, int index, const unsigned n // prepare index int index_arr[1] = {index}; std::vector test_data_integers; - test_data_integers.reserve(size); + test_data_integers.resize(size); for (unsigned i = 0; i < size; i++) { PLI_INT32& integer = test_data_integers[i]; integer = 0; @@ -268,7 +268,7 @@ int test_vpiShortIntVal(char* name, PLI_BYTE8* test_data, int index, const unsig // prepare index int index_arr[1] = {index}; std::vector test_data_shortints; - test_data_shortints.reserve(size); + test_data_shortints.resize(size); for (unsigned i = 0; i < size; i++) { if (elem_size == 2) { test_data_shortints[i] = test_data[i * 2] & 0xFF; @@ -323,7 +323,7 @@ int test_vpiLongIntVal(char* name, PLI_BYTE8* test_data, int index, const unsign // prepare index int index_arr[1] = {index}; std::vector test_data_longints; - test_data_longints.reserve(size); + test_data_longints.resize(size); for (unsigned i = 0; i < size; i++) { PLI_INT64& longint = test_data_longints[i]; longint = 0;