Skip to content

Commit

Permalink
Remove unused internal warn-on-hidden option
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed Jul 7, 2023
1 parent 7ef3ce0 commit dd9ce69
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 152 deletions.
11 changes: 0 additions & 11 deletions src/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,17 +779,6 @@ static symbol_t *make_visible(scope_t *s, ident_t name, tree_t decl,
}
else if (is_design_unit(decl))
; // Design unit is top level so cannot hide anything
else if (!overload && dd->visibility == DIRECT
&& opt_get_int(OPT_WARN_HIDDEN)) {
diag_t *d = diag_new(DIAG_WARN, tree_loc(decl));
diag_printf(d, "declaration of %s %s hides %s %s",
class_str(class_of(decl)), istr(name),
class_str(class_of(dd->tree)), istr(name));
diag_hint(d, tree_loc(dd->tree), "earlier declaration of %s is "
"hidden", istr(name));
diag_hint(d, tree_loc(decl), "hidden by this declaration");
diag_emit(d);
}
dd->visibility = HIDDEN;
}
else if (!overload && kind == POTENTIAL && dd->visibility == DIRECT)
Expand Down
1 change: 0 additions & 1 deletion src/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ void set_default_options(void)
opt_set_int(OPT_RELAXED, 0);
opt_set_str(OPT_JIT_VERBOSE, getenv("NVC_JIT_VERBOSE"));
opt_set_int(OPT_JIT_LOG, get_int_env("NVC_JIT_LOG", 0));
opt_set_int(OPT_WARN_HIDDEN, 0);
opt_set_int(OPT_NO_SAVE, 0);
opt_set_str(OPT_LLVM_VERBOSE, getenv("NVC_LLVM_VERBOSE"));
opt_set_int(OPT_JIT_THRESHOLD, get_int_env("NVC_JIT_THRESHOLD", 100));
Expand Down
1 change: 0 additions & 1 deletion src/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ typedef enum {
OPT_RELAXED,
OPT_JIT_VERBOSE,
OPT_JIT_LOG,
OPT_WARN_HIDDEN,
OPT_NO_SAVE,
OPT_LLVM_VERBOSE,
OPT_JIT_THRESHOLD,
Expand Down
58 changes: 4 additions & 54 deletions test/test_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,12 @@ START_TEST(test_seq)
tree_t a, p, s, e, b, c;

set_standard(STD_08);
opt_set_int(OPT_WARN_HIDDEN, 1);

input_from_file(TESTDIR "/parse/seq.vhd");

const error_t expect[] = {
{ 15, "type of slice prefix INTEGER is not an array" },
{ 45, "target of variable assignment must be a variable name or" },
{ 51, "declaration of variable X hides signal X" },
{ 51, "declaration of variable Y hides signal Y" },
{ 84, "return statement not allowed outside subprogram" },
{ 125, "cannot use exit statement outside loop" },
{ 126, "cannot use exit statement outside loop" },
Expand Down Expand Up @@ -1356,16 +1353,8 @@ START_TEST(test_qual)
{
tree_t a, p, s, q, e;

opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/qual.vhd");

const error_t expect[] = {
{ 4, "declaration of type FOO hides architecture FOO" },
{ 5, "declaration of type BAR hides entity BAR" },
{ -1, NULL }
};
expect_errors(expect);

e = parse();
fail_if(e == NULL);
fail_unless(tree_kind(e) == T_ENTITY);
Expand Down Expand Up @@ -1400,7 +1389,7 @@ START_TEST(test_qual)
a = parse();
fail_unless(a == NULL);

check_expected_errors();
fail_if_errors();
}
END_TEST

Expand Down Expand Up @@ -2491,16 +2480,8 @@ START_TEST(test_generate)
{
tree_t e, a, g, i, c;

opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/generate.vhd");

const error_t expect[] = {
{ 13, "declaration of signal X hides signal X" },
{ 25, "declaration of signal X hides signal X" },
{ -1, NULL }
};
expect_errors(expect);

e = parse();
fail_if(e == NULL);
fail_unless(tree_kind(e) == T_ENTITY);
Expand Down Expand Up @@ -2567,7 +2548,7 @@ START_TEST(test_generate)
a = parse();
fail_unless(a == NULL);

check_expected_errors();
fail_if_errors();
}
END_TEST

Expand Down Expand Up @@ -2884,7 +2865,6 @@ START_TEST(test_error)
{
tree_t e, a;

opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/error.vhd");

e = parse();
Expand All @@ -2911,7 +2891,6 @@ START_TEST(test_error)
{ 44, "A1 already declared in this region" },
{ 47, "S1 already declared in this region" },
{ 50, "B1 already declared in this region" },
{ 53, "declaration of constant X hides signal X" },
{ 56, "C1 already declared in this region" },
{ 64, "missing declaration for entity WORK.NOT_HERE" },
{ -1, NULL }
Expand Down Expand Up @@ -3185,13 +3164,11 @@ END_TEST

START_TEST(test_guarded)
{
opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/guarded.vhd");

const error_t expect[] = {
{ 7, "guarded assignment has no visible guard signal" },
{ 9, "guarded assignment has no visible guard signal" },
{ 24, "declaration of signal Q hides signal Q" },
{ 25, "Q in disconnection specification must denote a guarded" },
{ -1, NULL }
};
Expand Down Expand Up @@ -3297,15 +3274,8 @@ END_TEST

START_TEST(test_issue367)
{
opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/issue367.vhd");

const error_t expect[] = {
{ 13, "declaration of constant I hides variable I" },
{ -1, NULL }
};
expect_errors(expect);

tree_t p = parse();
fail_if(p == NULL);
fail_unless(tree_kind(p) == T_PACKAGE);
Expand Down Expand Up @@ -3335,7 +3305,7 @@ START_TEST(test_issue367)

fail_if(parse() != NULL);

check_expected_errors();
fail_if_errors();
}
END_TEST

Expand Down Expand Up @@ -3488,7 +3458,6 @@ END_TEST

START_TEST(test_names)
{
opt_set_int(OPT_WARN_HIDDEN, 1);
input_from_file(TESTDIR "/parse/names.vhd");

const error_t expect[] = {
Expand Down Expand Up @@ -3517,14 +3486,11 @@ START_TEST(test_names)
{ 222, "ambiguous use of name FOO" },
{ 233, "name X not found in \"+\"" },
{ 256, "no visible subprogram declaration for NOTHERE" },
{ 282, "declaration of subtype MY_INT hides type MY_INT" },
{ 288, "declaration of subtype MY_INT hides type MY_INT" },
{ 313, "no visible subprogram declaration for FNORK" },
{ 323, "no matching subprogram P26_1 [universal_integer" },
{ 332, "no matching operator \"and\" [BIT, BOOLEAN return BOOLEAN]" },
{ 360, "object X with type INTEGER cannot be selected" },
{ 362, "no visible declaration for FOO" },
{ 374, "declaration of type LIST hides type LIST" },
{ 386, "expecting type mark while parsing qualified expression" },
{ -1, NULL }
};
Expand Down Expand Up @@ -3599,7 +3565,6 @@ END_TEST

START_TEST(test_error2)
{
opt_set_int(OPT_WARN_HIDDEN, 1);
set_standard(STD_00);

input_from_file(TESTDIR "/parse/error2.vhd");
Expand All @@ -3611,7 +3576,6 @@ START_TEST(test_error2)
{ 10, "no visible declaration for SGHBBX" },
{ 17, "cannot find unit STD.NOTHERE" },
{ 22, "unexpected identifier while parsing range" },
{ 22, "declaration of constant FOO hides type FOO" },
{ 29, "expected physical type definition trailing" },
{ 33, "expected record type definition trailing identifier" },
{ 38, "unexpected procedure while parsing subprogram body" },
Expand Down Expand Up @@ -4823,8 +4787,6 @@ END_TEST

START_TEST(test_visibility3)
{
opt_set_int(OPT_WARN_HIDDEN, 1);

input_from_file(TESTDIR "/parse/visibility3.vhd");

for (int i = 0; i < 2; i++) {
Expand All @@ -4846,8 +4808,6 @@ END_TEST

START_TEST(test_visibility4)
{
opt_set_int(OPT_WARN_HIDDEN, 1);

lib_t foo_lib = lib_tmp("FOO");
lib_set_work(foo_lib);

Expand Down Expand Up @@ -4888,16 +4848,8 @@ END_TEST

START_TEST(test_visibility5)
{
opt_set_int(OPT_WARN_HIDDEN, 1);

input_from_file(TESTDIR "/parse/visibility5.vhd");

const error_t expect[] = {
{ 2, "declaration of type STRING_LIST hides package STRING_LIST" },
{ -1, NULL }
};
expect_errors(expect);

for (int i = 0; i < 2; i++) {
tree_t p = parse();
fail_if(p == NULL);
Expand All @@ -4907,14 +4859,12 @@ START_TEST(test_visibility5)

fail_unless(parse() == NULL);

check_expected_errors();
fail_if_errors();
}
END_TEST

START_TEST(test_visibility6)
{
opt_set_int(OPT_WARN_HIDDEN, 1);

input_from_file(TESTDIR "/parse/visibility6.vhd");

for (int i = 0; i < 2; i++) {
Expand Down
Loading

0 comments on commit dd9ce69

Please sign in to comment.