Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compiler warnings #668

Closed
veripoolbot opened this issue Jul 29, 2013 · 4 comments
Closed

fix compiler warnings #668

veripoolbot opened this issue Jul 29, 2013 · 4 comments
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed

Comments

@veripoolbot
Copy link
Contributor


Author Name: Yutetsu TAKATSUKASA (@yTakatsukasa)
Original Redmine Issue: 668 from https://www.veripool.org
Original Date: 2013-07-29


Hi verilator developers,

I appreciate you developing and maintaining the tool.

I use verilator-3.850 with clang-3.3 and found 2 types of warning.

  • The first one is emitted because VL_MODULEs declared as a struct are defined as a class.
  • The second one is due to the lack of initialization. I guess this may cause an unexpected result.

I made a patch for the latest version(git repository).

Please find the attached tiny patch.

Regards,
Yutetsu.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-07-29T14:38:43Z


I pushed the initialization patch.

I don't understand the class patch - what is the exact warning? According to the C++ standard, 'struct' is just a public class.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Yutetsu TAKATSUKASA (@yTakatsukasa)
Original Date: 2013-07-30T12:58:12Z


Hi Wilson
Thanks for your quick response.

I agree that the class and struct are equivalent except their default accessibility.

The warning is emmitted from mismatch between actual 'definition' and 'forward declaration' generated by verilator.

Please see the attached logfile.
Note that I use my custom makefile, not generated one by verilator.
But I think you can get the same warnings if you add -CFLAGS -Wall for
verilator.

Regards,
Yutetsu.

Update:

As far as I have searched, declare as a class and define as a struct is a well-formed C++.
Only older VC++ failed to link such code.
So my class patch is not vital.

But I think enabling compiler checks (like -Wall) is useful, it actually helped me to find a potential problem (initialize patch). And fixing trivial warnings makes it easier to find non-trivial warnings.

Here is a minimal example to reproduce. (with clang-3.3)

% cat dut.v

module sub(clk, out);
     input clk;
     output out;
     reg out;
     always @(posedge clk) out <= !out;
endmodule

module top(clk, out);
     input clk;
     output out;
     sub i_sub(.clk(clk), .out(out));
endmodule


% verilator -cc -O0 -CFLAGS -Wall dut.v
% make -C obj_dir -f Vdut.mk

Thanks

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-08-08T23:40:06Z


Fixed other patch and some more towards 3.851.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2013-08-15T12:46:30Z


In 3.851.

@veripoolbot veripoolbot added area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed labels Dec 22, 2019
tgorochowik pushed a commit to antmicro/verilator that referenced this issue Feb 29, 2024
…uhdm-tests/serv/serv-09e49f7

Bump uhdm-tests/serv/serv from `e59fe53` to `09e49f7`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: configure/compiling Issue involves configuring or compilating Verilator itself resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

1 participant