From ec7a130d03a7dc04419a4e7bcd1224800f6f7882 Mon Sep 17 00:00:00 2001 From: Manuel Bertsch Date: Tue, 19 Dec 2023 18:29:17 +0100 Subject: [PATCH] tests+verilog preproc: Fix ANTLR <=4.9, CMake and Icarus tests - ANTLR 4.9 antlrcpp::Any was used incorrectly, preventing it from compiling on e.g. 4.9.3 - Depending on the compiler and CMake version used, C++ 17 wouldn't be automatically selected for the project. - Icarus moved the test file "sv_macro3" to two separate versions (a and b), but this is not yet correctly reflected in their file lists. With this change, all ~7000 tests collect correctly again under pytest and concurrencytest. --- src/CMakeLists.txt | 2 ++ src/verilogPreproc/verilogPreproc.cpp | 4 +++- tests/test_icarus_verilog_testsuite.py | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1a0db05b..c650a362 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,8 @@ # build of the main library ############################################################################################## +set(CMAKE_CXX_STANDARD 17) + include(${CMAKE_CURRENT_SOURCE_DIR}/CMake_antlr4.txt) include_directories( diff --git a/src/verilogPreproc/verilogPreproc.cpp b/src/verilogPreproc/verilogPreproc.cpp index 0584e8b7..413f7ce2 100644 --- a/src/verilogPreproc/verilogPreproc.cpp +++ b/src/verilogPreproc/verilogPreproc.cpp @@ -1,3 +1,5 @@ +#include + #include // antlr4-runtime/ @@ -194,7 +196,7 @@ antlrcpp::Any VerilogPreproc::visitDefine( vector params_dummy; if (da) { #if !defined(ANTLRCPP_VERSION_MAJOR) || (ANTLRCPP_VERSION_MAJOR == 4 && ANTLRCPP_VERSION_MINOR <= 9) - params = visitDefine_args(da); + params = visitDefine_args(da).as *>(); #else params = std::any_cast *>(visitDefine_args(da)); #endif diff --git a/tests/test_icarus_verilog_testsuite.py b/tests/test_icarus_verilog_testsuite.py index 8f22eef9..13be11cf 100644 --- a/tests/test_icarus_verilog_testsuite.py +++ b/tests/test_icarus_verilog_testsuite.py @@ -48,6 +48,7 @@ def parse_verilator_record(line, dir_name): "sv_string_index": "string_index", "sv_timeunit_prec": "sv_timeunit_prec1", "sv_timeunit_prec_fail": "sv_timeunit_prec_fail1", + "sv_macro3": "sv_macro3a" } name = name_fix.get(name, name) args = columns[1]