From 947cbaf330b2e5e4b78922cdcd1dfe0c5a172959 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 21 Mar 2026 10:59:27 -0400 Subject: [PATCH] Deprecate `--structs-packed` (#7222). --- Changes | 1 + bin/verilator | 1 - docs/guide/deprecations.rst | 10 +++++++++- docs/guide/exe_verilator.rst | 2 ++ src/V3Options.cpp | 5 ++++- test_regress/t/t_dist_docs_options.py | 1 + test_regress/t/t_flag_structs_packed.out | 3 +++ test_regress/t/t_flag_structs_packed.py | 2 +- test_regress/t/t_structu_dataType_assignment.py | 4 ++-- test_regress/t/t_structu_dataType_assignment_bad.py | 2 +- 10 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 test_regress/t/t_flag_structs_packed.out diff --git a/Changes b/Changes index 406d8cd3d..409b55f38 100644 --- a/Changes +++ b/Changes @@ -40,6 +40,7 @@ Verilator 5.047 devel * Add VPI callback support to --main (#7145). * Add V3LiftExpr pass to lower impure expressions and calls (#7141) (#7164). [Geza Lore, Testorrent USA, Inc.] * Add --func-recursion-depth CLI option (#7175) (#7179). +* Deprecate `--structs-packed` (#7222). * Improve assignment-compatibility type check (#2843) (#5666) (#7052). [Pawel Kojma, Antmicro Ltd.] * Change array tracing to dump left index to right index (#7205). [Geza Lore, Testorrent USA, Inc.] * Change `--converge-limit` default to 10000 (#7209). diff --git a/bin/verilator b/bin/verilator index 475ffcfde..18c24ff99 100755 --- a/bin/verilator +++ b/bin/verilator @@ -498,7 +498,6 @@ detailed descriptions of these arguments. --no-std-package Prevent parsing standard package --no-std-waiver Prevent parsing standard lint waivers --no-stop-fail Do not call $stop when assertion fails - --structs-packed Convert all unpacked structures to packed structures -sv Enable SystemVerilog parsing +systemverilogext+ Synonym for +1800-2023ext+ --threads Enable multithreading diff --git a/docs/guide/deprecations.rst b/docs/guide/deprecations.rst index b46a524f2..75cad0492 100644 --- a/docs/guide/deprecations.rst +++ b/docs/guide/deprecations.rst @@ -17,7 +17,15 @@ C++14 compiler support the Ubuntu LTS versions of GCC and clang use C++20 by default, estimated May 2028.) +`--structs-packed` option + The :vlopt:`--structs-packed` option was introduced when Verilator was + first implementing unpacked structs. That feature has been stable now + for multiple years, so :vlopt:`--structs-packed` should no longer be + used. Thus :vlopt:`--structs-packed` will change to a no-operation flag + and the related :option:`UNPACKED` warning will never be issued no + sooner than September 2026. + tcmalloc support Verilator currently supports the default malloc, tcmalloc, or jemalloc. As jemalloc has better performance, support for tcmalloc may be removed - no sooner than January 2026. + no sooner than January 2027. diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst index ac7c6026f..50b727e34 100644 --- a/docs/guide/exe_verilator.rst +++ b/docs/guide/exe_verilator.rst @@ -1682,6 +1682,8 @@ Summary: .. option:: --structs-packed + Deprecated; discontinue use of this option. + Converts all unpacked structures to packed structures, and issues an :option:`UNPACKED` warning. Specifying this option allows for backward compatibility with versions before Verilator 5.006, when Verilator would diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 9fab2e650..73d3b8f0e 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1742,7 +1742,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, DECL_OPTION("-std-package", OnOff, &m_stdPackage); DECL_OPTION("-std-waiver", OnOff, &m_stdWaiver); DECL_OPTION("-stop-fail", OnOff, &m_stopFail); - DECL_OPTION("-structs-packed", OnOff, &m_structsPacked); + DECL_OPTION("-structs-packed", CbOnOff, [this, fl](bool flag) { + m_structsPacked = flag; + fl->v3warn(DEPRECATED, "Option --structs-packed is deprecated, avoid use"); + }).undocumented(); DECL_OPTION("-sv", CbCall, [this]() { m_defaultLanguage = V3LangCode::L1800_2023; }); DECL_OPTION("-no-threads", CbCall, [this, fl]() { diff --git a/test_regress/t/t_dist_docs_options.py b/test_regress/t/t_dist_docs_options.py index 63db6b4f8..e4e768bcc 100755 --- a/test_regress/t/t_dist_docs_options.py +++ b/test_regress/t/t_dist_docs_options.py @@ -20,6 +20,7 @@ Doc_Waivers = [ '-order-clock-delay', # Deprecated '-pp-comments', # Deprecated '-prof-threads', # Deprecated + '-structs-packed', # Deprecated '-xml-only', # Removed '-xml-output', # Removed ] diff --git a/test_regress/t/t_flag_structs_packed.out b/test_regress/t/t_flag_structs_packed.out new file mode 100644 index 000000000..dd4a09029 --- /dev/null +++ b/test_regress/t/t_flag_structs_packed.out @@ -0,0 +1,3 @@ +%Warning-DEPRECATED: Option --structs-packed is deprecated, avoid use + ... For warning description see https://verilator.org/warn/DEPRECATED?v=latest + ... Use "/* verilator lint_off DEPRECATED */" and lint_on around source to disable this message. diff --git a/test_regress/t/t_flag_structs_packed.py b/test_regress/t/t_flag_structs_packed.py index acc4cf764..0c7729bf4 100755 --- a/test_regress/t/t_flag_structs_packed.py +++ b/test_regress/t/t_flag_structs_packed.py @@ -11,7 +11,7 @@ import vltest_bootstrap test.scenarios('linter') -test.compile(verilator_flags2=['--structs-packed']) +test.compile(verilator_flags2=['-Wno-fatal', '--structs-packed'], expect_filename=test.golden_filename) test.execute() diff --git a/test_regress/t/t_structu_dataType_assignment.py b/test_regress/t/t_structu_dataType_assignment.py index 1f96bf061..4a044903a 100755 --- a/test_regress/t/t_structu_dataType_assignment.py +++ b/test_regress/t/t_structu_dataType_assignment.py @@ -9,9 +9,9 @@ import vltest_bootstrap -test.scenarios('simulator') +test.scenarios('simulator_st') -test.compile(verilator_flags2=['--structs-packed']) +test.compile(verilator_flags2=['-Wno-DEPRECATED', '--structs-packed']) test.execute() diff --git a/test_regress/t/t_structu_dataType_assignment_bad.py b/test_regress/t/t_structu_dataType_assignment_bad.py index 9e2d9b6bf..c7d9b21a5 100755 --- a/test_regress/t/t_structu_dataType_assignment_bad.py +++ b/test_regress/t/t_structu_dataType_assignment_bad.py @@ -11,6 +11,6 @@ import vltest_bootstrap test.scenarios('linter') -test.lint(verilator_flags2=['--structs-packed'], fails=True, expect_filename=test.golden_filename) +test.lint(fails=True, expect_filename=test.golden_filename) test.passes()