Skip to content

Commit 9864fcf

Browse files
authored
sim_if/ghdl: remove 'ghdl.flags' (#932)
1 parent e59fdb0 commit 9864fcf

File tree

7 files changed

+31
-39
lines changed

7 files changed

+31
-39
lines changed

docs/news.d/932.breaking.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[GHDL] Remove ``ghdl.flags``; use ``ghdl.a_flags`` instead.
2+

docs/py/opts.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ The following compilation options are known.
1111
Extra arguments passed to ``ghdl -a`` command during compilation.
1212
Must be a list of strings.
1313

14-
``ghdl.flags``
15-
Deprecated alias of ``ghdl.a_flags``. It will be removed in future releases.
16-
1714
``incisive.irun_vhdl_flags``
1815
Extra arguments passed to the Incisive ``irun`` command when compiling VHDL files.
1916
Must be a list of strings.

examples/vhdl/array/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
VU.add_library("lib").add_source_files([SRC_PATH / "*.vhd", SRC_PATH / "test" / "*.vhd"])
2828

29-
VU.set_compile_option("ghdl.flags", ["-frelaxed"])
29+
VU.set_compile_option("ghdl.a_flags", ["-frelaxed"])
3030
VU.set_sim_option("ghdl.elab_flags", ["-frelaxed"])
3131

3232
VU.set_compile_option("nvc.a_flags", ["--relaxed"])

tests/unit/test_ghdl_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def test_compile_project_extra_flags(self, check_output):
204204
project = Project()
205205
project.add_library("lib", "lib_path")
206206
source_file = project.add_source_file("file.vhd", "lib", file_type="vhdl")
207-
source_file.set_compile_option("ghdl.flags", ["custom", "flags"])
207+
source_file.set_compile_option("ghdl.a_flags", ["custom", "flags"])
208208
simif.compile_project(project)
209209
check_output.assert_called_once_with(
210210
[

tests/unit/test_project.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ def test_should_recompile_files_after_changing_compile_options(self):
970970
self.update(file3)
971971
self.assert_should_recompile([])
972972

973-
file2.set_compile_option("ghdl.flags", ["--no-vital-checks"])
973+
file2.set_compile_option("ghdl.a_flags", ["--no-vital-checks"])
974974
self.assert_should_recompile([file2, file3])
975975

976976
def test_should_recompile_files_after_changing_vhdl_standard(self):
@@ -991,37 +991,37 @@ def test_should_recompile_files_after_changing_vhdl_standard(self):
991991
def test_add_compile_option(self):
992992
self.project.add_library("lib", "lib_path")
993993
file1 = self.add_source_file("lib", "file.vhd", "")
994-
file1.add_compile_option("ghdl.flags", ["--foo"])
995-
self.assertEqual(file1.get_compile_option("ghdl.flags"), ["--foo"])
996-
file1.add_compile_option("ghdl.flags", ["--bar"])
997-
self.assertEqual(file1.get_compile_option("ghdl.flags"), ["--foo", "--bar"])
998-
file1.set_compile_option("ghdl.flags", ["--xyz"])
999-
self.assertEqual(file1.get_compile_option("ghdl.flags"), ["--xyz"])
994+
file1.add_compile_option("ghdl.a_flags", ["--foo"])
995+
self.assertEqual(file1.get_compile_option("ghdl.a_flags"), ["--foo"])
996+
file1.add_compile_option("ghdl.a_flags", ["--bar"])
997+
self.assertEqual(file1.get_compile_option("ghdl.a_flags"), ["--foo", "--bar"])
998+
file1.set_compile_option("ghdl.a_flags", ["--xyz"])
999+
self.assertEqual(file1.get_compile_option("ghdl.a_flags"), ["--xyz"])
10001000

10011001
def test_add_compile_option_does_not_mutate_argument(self):
10021002
self.project.add_library("lib", "lib_path")
10031003
file1 = self.add_source_file("lib", "file.vhd", "")
10041004
options = ["--foo"]
1005-
file1.add_compile_option("ghdl.flags", options)
1005+
file1.add_compile_option("ghdl.a_flags", options)
10061006
options[0] = "--xyz"
1007-
self.assertEqual(file1.get_compile_option("ghdl.flags"), ["--foo"])
1008-
file1.add_compile_option("ghdl.flags", ["--bar"])
1007+
self.assertEqual(file1.get_compile_option("ghdl.a_flags"), ["--foo"])
1008+
file1.add_compile_option("ghdl.a_flags", ["--bar"])
10091009
self.assertEqual(options, ["--xyz"])
10101010

10111011
def test_set_compile_option_does_not_mutate_argument(self):
10121012
self.project.add_library("lib", "lib_path")
10131013
file1 = self.add_source_file("lib", "file.vhd", "")
10141014
options = ["--foo"]
1015-
file1.set_compile_option("ghdl.flags", options)
1015+
file1.set_compile_option("ghdl.a_flags", options)
10161016
options[0] = "--xyz"
1017-
self.assertEqual(file1.get_compile_option("ghdl.flags"), ["--foo"])
1017+
self.assertEqual(file1.get_compile_option("ghdl.a_flags"), ["--foo"])
10181018

10191019
def test_compile_option_validation(self):
10201020
self.project.add_library("lib", "lib_path")
10211021
source_file = self.add_source_file("lib", "file.vhd", "")
10221022
self.assertRaises(ValueError, source_file.set_compile_option, "foo", None)
1023-
self.assertRaises(ValueError, source_file.set_compile_option, "ghdl.flags", None)
1024-
self.assertRaises(ValueError, source_file.add_compile_option, "ghdl.flags", None)
1023+
self.assertRaises(ValueError, source_file.set_compile_option, "ghdl.a_flags", None)
1024+
self.assertRaises(ValueError, source_file.add_compile_option, "ghdl.a_flags", None)
10251025
self.assertRaises(ValueError, source_file.get_compile_option, "foo")
10261026

10271027
def test_should_recompile_files_affected_by_change_with_later_timestamp(self):

tests/unit/test_ui.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -925,17 +925,17 @@ def test_compile_options(self):
925925

926926
# Use methods on all types of interface objects
927927
for obj in [source_file, ui, lib, lib.get_source_files(file_name), ui.get_libraries("lib")]:
928-
obj.set_compile_option("ghdl.flags", [])
929-
self.assertEqual(source_file.get_compile_option("ghdl.flags"), [])
928+
obj.set_compile_option("ghdl.a_flags", [])
929+
self.assertEqual(source_file.get_compile_option("ghdl.a_flags"), [])
930930

931-
obj.add_compile_option("ghdl.flags", ["1"])
932-
self.assertEqual(source_file.get_compile_option("ghdl.flags"), ["1"])
931+
obj.add_compile_option("ghdl.a_flags", ["1"])
932+
self.assertEqual(source_file.get_compile_option("ghdl.a_flags"), ["1"])
933933

934-
obj.add_compile_option("ghdl.flags", ["2"])
935-
self.assertEqual(source_file.get_compile_option("ghdl.flags"), ["1", "2"])
934+
obj.add_compile_option("ghdl.a_flags", ["2"])
935+
self.assertEqual(source_file.get_compile_option("ghdl.a_flags"), ["1", "2"])
936936

937-
obj.set_compile_option("ghdl.flags", ["3"])
938-
self.assertEqual(source_file.get_compile_option("ghdl.flags"), ["3"])
937+
obj.set_compile_option("ghdl.a_flags", ["3"])
938+
self.assertEqual(source_file.get_compile_option("ghdl.a_flags"), ["3"])
939939

940940
def test_default_vhdl_standard_is_used(self):
941941
file_name = "foo.vhd"

vunit/sim_if/ghdl.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import shutil
1818
from json import dump
1919
from sys import stdout # To avoid output catched in non-verbose mode
20-
from warnings import warn
2120
from ..exceptions import CompileError
2221
from ..ostools import Process
2322
from . import SimulatorInterface, ListOfStringOption, StringOption, BooleanOption
@@ -38,7 +37,7 @@ class GHDLInterface(SimulatorInterface): # pylint: disable=too-many-instance-at
3837

3938
compile_options = [
4039
ListOfStringOption("ghdl.a_flags"),
41-
ListOfStringOption("ghdl.flags"),
40+
ListOfStringOption("ghdl.flags"), # Removed in v5.0.0
4241
]
4342

4443
sim_options = [
@@ -237,6 +236,9 @@ def compile_vhdl_file_command(self, source_file):
237236
"""
238237
Returns the command to compile a vhdl file
239238
"""
239+
if source_file.compile_options.get("ghdl.flags", []) != []:
240+
raise RuntimeError("'ghdl.flags was removed in v5.0.0; use 'ghdl.a_flags' instead")
241+
240242
cmd = [
241243
str(Path(self._prefix) / self.executable),
242244
"-a",
@@ -247,16 +249,7 @@ def compile_vhdl_file_command(self, source_file):
247249
for library in self._project.get_libraries():
248250
cmd += [f"-P{library.directory!s}"]
249251

250-
a_flags = source_file.compile_options.get("ghdl.a_flags", [])
251-
flags = source_file.compile_options.get("ghdl.flags", [])
252-
if flags != []:
253-
warn(
254-
("'ghdl.flags' is deprecated and it will be removed in future releases; use 'ghdl.a_flags' instead"),
255-
Warning,
256-
)
257-
a_flags += flags
258-
259-
cmd += a_flags
252+
cmd += source_file.compile_options.get("ghdl.a_flags", [])
260253

261254
if source_file.compile_options.get("enable_coverage", False):
262255
# Add gcc compilation flags for coverage

0 commit comments

Comments
 (0)