From 48effad448d5f17faad38a4c9b90a3f0b7813c6a Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 21 Mar 2025 21:32:05 -0400 Subject: [PATCH] Add DEPRECATED warning on `--xml-only` and `--xml-output`. --- Changes | 1 + src/V3Options.cpp | 10 ++++++++-- test_regress/t/t_constraint_xml.py | 2 +- test_regress/t/t_flag_only_bad.py | 4 +++- test_regress/t/t_flag_only_bad2.py | 9 +++++---- test_regress/t/t_flag_only_bad3.py | 4 +++- test_regress/t/t_var_port_xml.py | 2 +- test_regress/t/t_xml_begin_hier.py | 2 +- test_regress/t/t_xml_deprecated_bad.out | 4 ++++ test_regress/t/t_xml_deprecated_bad.py | 19 +++++++++++++++++++ test_regress/t/t_xml_first.py | 2 +- test_regress/t/t_xml_flat.py | 2 +- test_regress/t/t_xml_flat_no_inline_mod.py | 2 +- test_regress/t/t_xml_flat_pub_mod.py | 2 +- test_regress/t/t_xml_flat_vlvbound.py | 2 +- test_regress/t/t_xml_output.py | 9 +++++---- test_regress/t/t_xml_tag.py | 2 +- 17 files changed, 57 insertions(+), 21 deletions(-) create mode 100644 test_regress/t/t_xml_deprecated_bad.out create mode 100755 test_regress/t/t_xml_deprecated_bad.py diff --git a/Changes b/Changes index 461438ff3..e0387e47d 100644 --- a/Changes +++ b/Changes @@ -24,6 +24,7 @@ Verilator 5.035 devel * Add used language to `--preproc-resolve` output (#5795). [Kamil Rakoczy, Antmicro Ltd.] * Add `--make json` to enable integration with non-make/cmake build systems (#5799). [Andrew Voznytsa] * Add empty veriuser.h for legacy compatibility. +* Add DEPRECATED warning on `--xml-only` and `--xml-output`. * Remove unused gtkwave/wavealloca.h. [Geza Lore] * Optimize automatic splitting of some packed variables (#5843). [Geza Lore] * Optimize trigger vector in whole words (#5857). [Geza Lore] diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 6089d7135..3260f5fb4 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1815,8 +1815,14 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, } }); DECL_OPTION("-x-initial-edge", OnOff, &m_xInitialEdge); - DECL_OPTION("-xml-only", OnOff, &m_xmlOnly); - DECL_OPTION("-xml-output", CbVal, [this](const char* valp) { + DECL_OPTION("-xml-only", CbOnOff, [this, fl](bool flag) { + if (!m_xmlOnly && flag) + fl->v3warn(DEPRECATED, "Option --xml-only is deprecated, move to --json-only"); + m_xmlOnly = flag; + }); + DECL_OPTION("-xml-output", CbVal, [this, fl](const char* valp) { + if (!m_xmlOnly) + fl->v3warn(DEPRECATED, "Option --xml-only is deprecated, move to --json-only"); m_xmlOutput = valp; m_xmlOnly = true; }); diff --git a/test_regress/t/t_constraint_xml.py b/test_regress/t/t_constraint_xml.py index 118386ead..f2bffa381 100755 --- a/test_regress/t/t_constraint_xml.py +++ b/test_regress/t/t_constraint_xml.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only', '-Wno-CONSTRAINTIGN'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only', '-Wno-CONSTRAINTIGN'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_flag_only_bad.py b/test_regress/t/t_flag_only_bad.py index be2835493..f440bf973 100755 --- a/test_regress/t/t_flag_only_bad.py +++ b/test_regress/t/t_flag_only_bad.py @@ -12,7 +12,9 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_flag_main.v" -test.lint(verilator_flags2=["--binary -E --dpi-hdr-only --lint-only --xml-only --json-only -Wall"], +test.lint(verilator_flags2=[ + "-Wno-DEPRECATED --binary -E --dpi-hdr-only --lint-only --xml-only --json-only -Wall" +], fails=True, expect_filename=test.golden_filename) diff --git a/test_regress/t/t_flag_only_bad2.py b/test_regress/t/t_flag_only_bad2.py index 10fa26356..255bd8622 100755 --- a/test_regress/t/t_flag_only_bad2.py +++ b/test_regress/t/t_flag_only_bad2.py @@ -12,9 +12,10 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_flag_main.v" -test.lint( - verilator_flags2=["--build -E -Wno-fatal --dpi-hdr-only --lint-only --xml-only --json-only"], - fails=True, - expect_filename=test.golden_filename) +test.lint(verilator_flags2=[ + "-Wno-DEPRECATED --build -E -Wno-fatal --dpi-hdr-only --lint-only --xml-only --json-only" +], + fails=True, + expect_filename=test.golden_filename) test.passes() diff --git a/test_regress/t/t_flag_only_bad3.py b/test_regress/t/t_flag_only_bad3.py index 7bd76ebe4..397085a9a 100755 --- a/test_regress/t/t_flag_only_bad3.py +++ b/test_regress/t/t_flag_only_bad3.py @@ -12,7 +12,9 @@ import vltest_bootstrap test.scenarios('vlt') test.top_filename = "t/t_flag_main.v" -test.lint(verilator_flags2=["-Wall --lint-only -Wno-fatal --dpi-hdr-only --xml-only --json-only"], +test.lint(verilator_flags2=[ + "-Wall -Wno-DEPRECATED --lint-only -Wno-fatal --dpi-hdr-only --xml-only --json-only" +], fails=True, expect_filename=test.golden_filename) diff --git a/test_regress/t/t_var_port_xml.py b/test_regress/t/t_var_port_xml.py index e24dca19d..06a5adc58 100755 --- a/test_regress/t/t_var_port_xml.py +++ b/test_regress/t/t_var_port_xml.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_begin_hier.py b/test_regress/t/t_xml_begin_hier.py index e24dca19d..06a5adc58 100755 --- a/test_regress/t/t_xml_begin_hier.py +++ b/test_regress/t/t_xml_begin_hier.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_deprecated_bad.out b/test_regress/t/t_xml_deprecated_bad.out new file mode 100644 index 000000000..838a455b0 --- /dev/null +++ b/test_regress/t/t_xml_deprecated_bad.out @@ -0,0 +1,4 @@ +%Warning-DEPRECATED: Option --xml-only is deprecated, move to --json-only + ... 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. +%Error: Exiting due to diff --git a/test_regress/t/t_xml_deprecated_bad.py b/test_regress/t/t_xml_deprecated_bad.py new file mode 100755 index 000000000..7fcdf4d0a --- /dev/null +++ b/test_regress/t/t_xml_deprecated_bad.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 +# DESCRIPTION: Verilator: Verilog Test driver/expect definition +# +# Copyright 2024 by Wilson Snyder. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +import vltest_bootstrap + +test.scenarios('vlt') +test.top_filename = 't/t_EXAMPLE.v' + +test.lint(verilator_flags2=["--xml-only --xml-output /dev/null"], + fails=True, + expect_filename=test.golden_filename) + +test.passes() diff --git a/test_regress/t/t_xml_first.py b/test_regress/t/t_xml_first.py index e24dca19d..06a5adc58 100755 --- a/test_regress/t/t_xml_first.py +++ b/test_regress/t/t_xml_first.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_flat.py b/test_regress/t/t_xml_flat.py index 39b3babd7..5c6842ae3 100755 --- a/test_regress/t/t_xml_flat.py +++ b/test_regress/t/t_xml_flat.py @@ -14,7 +14,7 @@ test.top_filename = "t/t_xml_first.v" out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only', '--flatten'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only', '--flatten'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_flat_no_inline_mod.py b/test_regress/t/t_xml_flat_no_inline_mod.py index d011198ac..046b5ff50 100755 --- a/test_regress/t/t_xml_flat_no_inline_mod.py +++ b/test_regress/t/t_xml_flat_no_inline_mod.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only', '--flatten'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only', '--flatten'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_flat_pub_mod.py b/test_regress/t/t_xml_flat_pub_mod.py index d011198ac..046b5ff50 100755 --- a/test_regress/t/t_xml_flat_pub_mod.py +++ b/test_regress/t/t_xml_flat_pub_mod.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only', '--flatten'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only', '--flatten'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_flat_vlvbound.py b/test_regress/t/t_xml_flat_vlvbound.py index d011198ac..046b5ff50 100755 --- a/test_regress/t/t_xml_flat_vlvbound.py +++ b/test_regress/t/t_xml_flat_vlvbound.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only', '--flatten'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only', '--flatten'], verilator_make_gmake=False, make_top_shell=False, make_main=False) diff --git a/test_regress/t/t_xml_output.py b/test_regress/t/t_xml_output.py index 640e36eca..09f0d91b5 100755 --- a/test_regress/t/t_xml_output.py +++ b/test_regress/t/t_xml_output.py @@ -13,10 +13,11 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/renamed-" + test.name + ".xml" -test.compile(verilator_flags2=["--no-std", "--xml-only --xml-output", out_filename], - verilator_make_gmake=False, - make_top_shell=False, - make_main=False) +test.compile( + verilator_flags2=["--no-std", "-Wno-DEPRECATED --xml-only --xml-output", out_filename], + verilator_make_gmake=False, + make_top_shell=False, + make_main=False) test.files_identical(out_filename, test.golden_filename) diff --git a/test_regress/t/t_xml_tag.py b/test_regress/t/t_xml_tag.py index e24dca19d..06a5adc58 100755 --- a/test_regress/t/t_xml_tag.py +++ b/test_regress/t/t_xml_tag.py @@ -13,7 +13,7 @@ test.scenarios('vlt') out_filename = test.obj_dir + "/V" + test.name + ".xml" -test.compile(verilator_flags2=['--no-std', '--xml-only'], +test.compile(verilator_flags2=['--no-std', '-Wno-DEPRECATED --xml-only'], verilator_make_gmake=False, make_top_shell=False, make_main=False)