You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can the -Wlogical-not-parentheses warning be enhanced to also cover 'inside' statements? Since SV does not have a 'not_inside' type operator, it is really common to have to add a !() around the inside call and there isn't a warning here when developers forget the parentheses.
inside_paren.sv:4:13: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
if (!a == 3) begin
^ ~~
inside_paren.sv:4:14: note: add parentheses after the '!' to evaluate the comparison first
if (!a == 3) begin
^~~~~~
inside_paren.sv:4:13: note: add parentheses around left hand side expression to silence this warning
if (!a == 3) begin
^~
classC;
functionf();
bit [7:0] a;
if (!a ==3) beginendif (!a inside{0, 3, 9}) beginendendfunctionendclass
The text was updated successfully, but these errors were encountered:
Looks like there is some partial overlap with Wcase-outside-range which catches the issue due to the size-mismatch. But that warning would not flag if the inside-vector only had the values 0 and 1.
Also, I'm not 100% certain if it was intended for case-outside-range to apply to inside-statements as well, although it is useful and is finding real bugs.
inside_paren.sv:6:27: warning: 'inside' item with 2 bits can never match the 1 bit case expression [-Wcase-outside-range]
if (!a inside {0, 3, 9}) begin
^
inside_paren.sv:6:30: warning: 'inside' item with 4 bits can never match the 1 bit case expression [-Wcase-outside-range]
if (!a inside {0, 3, 9}) begin
^
Can the -Wlogical-not-parentheses warning be enhanced to also cover 'inside' statements? Since SV does not have a 'not_inside' type operator, it is really common to have to add a !() around the inside call and there isn't a warning here when developers forget the parentheses.
The text was updated successfully, but these errors were encountered: