From 511a1d8247cf0403005b46d2576286896cd42a3b Mon Sep 17 00:00:00 2001 From: NikLeberg Date: Thu, 12 Dec 2024 01:23:40 +0000 Subject: [PATCH] Raise error when entity aspect is missing in configuration specification. Issue #1091 --- src/parse.c | 4 ++++ test/parse/config.vhd | 12 ++++++++++++ test/test_parse.c | 12 ++++++++++++ 3 files changed, 28 insertions(+) diff --git a/src/parse.c b/src/parse.c index 7edec24ba..8a0ed2112 100644 --- a/src/parse.c +++ b/src/parse.c @@ -9076,7 +9076,11 @@ static void p_configuration_specification(tree_t parent) push_scope(nametab); + bool is_open = (peek() == tUSE && peek_nth(2) == tOPEN); tree_t bind = p_binding_indication(comp); + if (!is_open && bind == NULL) + parse_error(CURRENT_LOC, "a binding indication in an explicit " + "configuration specification must contain an entity aspect"); consume(tSEMI); if (ids != NULL) { diff --git a/test/parse/config.vhd b/test/parse/config.vhd index bab1e159f..281dbfe20 100644 --- a/test/parse/config.vhd +++ b/test/parse/config.vhd @@ -74,3 +74,15 @@ configuration use_pack_ent of ent is end for; end for; end configuration; + +entity b is +end entity b; + +architecture rtl of b is + component ent + end component; + + for ent0 : ent; -- Error +begin + ent0: ent; +end architecture rtl; diff --git a/test/test_parse.c b/test/test_parse.c index 7d47f265f..a6ccde4c4 100644 --- a/test/test_parse.c +++ b/test/test_parse.c @@ -2900,6 +2900,8 @@ START_TEST(test_config) { 45, "cannot find architecture BAD of entity WORK.ENT" }, { 52, "P is not a block that can be configured" }, { 55, "instance P not found" }, + { 85, "a binding indication in an explicit configuration " + "specification must contain an entity aspect" }, { -1, NULL } }; expect_errors(expect); @@ -2979,6 +2981,16 @@ START_TEST(test_config) fail_unless(tree_kind(c) == T_CONFIGURATION); lib_put(lib_work(), c); + e = parse(); + fail_if(e == NULL); + fail_unless(tree_kind(e) == T_ENTITY); + lib_put(lib_work(), e); + + e = parse(); + fail_if(e == NULL); + fail_unless(tree_kind(e) == T_ARCH); + lib_put(lib_work(), e); + c = parse(); fail_unless(c == NULL);