Add regression tests for enum and struct line info

Check that when an error message for a enum or struct data type is
generated it points to the location of the declaration of the type.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2022-01-22 11:52:10 +01:00
parent 057cd700fe
commit fa643cbfe1
5 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,5 @@
./ivltests/enum_line_info.v:7: error: Enumeration name B and A have the same value: 1'd0
./ivltests/enum_line_info.v:12: error: Enumeration name D and C have the same value: 1'd0
./ivltests/enum_line_info.v:17: error: Enumeration name F and E have the same value: 1'd0
./ivltests/enum_line_info.v:22: error: Enumeration name H and G have the same value: 1'd0
5 error(s) during elaboration.

View File

@ -0,0 +1,4 @@
./ivltests/struct_line_info.v:7: error: Member r of packed struct/union must be packed.
./ivltests/struct_line_info.v:12: error: Member r of packed struct/union must be packed.
./ivltests/struct_line_info.v:17: error: Member r of packed struct/union must be packed.
3 error(s) during elaboration.

View File

@ -0,0 +1,32 @@
// Checks that the line and file information is correctly attached to a enum
// data type and will be used when printing an error message about the enum.
module test;
// Direct
enum logic {
A, B = A
} e1;
// Used in a struct
typedef enum logic {
C, D = C
} enum1_type;
// Used as a signal type
typedef enum logic {
E, F = E
} enum2_type;
// Unreferenced
typedef enum logic {
G, H = G
} enum3_type;
struct packed {
enum1_type e;
} s;
enum2_type e2;
endmodule

View File

@ -0,0 +1,24 @@
// Checks that the line and file information is correctly attached to a struct
// data type and will be used when printing an error message about the struct.
module test;
// Direct
struct packed {
real r;
} s1;
// Used in a struct
typedef struct packed {
real r;
} struct1_type;
// Used as a signal type
typedef struct packed {
struct1_type s;
real r;
} struct2_type;
struct2_type s2;
endmodule

View File

@ -236,6 +236,7 @@ enum_dims_invalid CE,-g2005-sv ivltests
enum_in_struct normal,-g2005-sv ivltests
enum_in_class normal,-g2005-sv ivltests
enum_in_class_name_coll CE,-g2005-sv ivltests
enum_line_info CE,-g2005-sv ivltests gold=enum_line_info.gold
enum_next normal,-g2005-sv ivltests
enum_order normal,-g2005-sv ivltests
enum_ports normal,-g2005-sv ivltests
@ -381,6 +382,7 @@ struct6 normal,-g2009 ivltests
struct7 normal,-g2009 ivltests
struct8 normal,-g2009 ivltests
struct9 normal,-g2009 ivltests
struct_line_info CE,-g2009 ivltests gold=struct_line_info.gold
struct_packed_array normal,-g2009 ivltests
struct_packed_array2 normal,-g2009 ivltests
struct_packed_sysfunct normal,-g2009 ivltests