vtr-verilog-to-routing icon indicating copy to clipboard operation
vtr-verilog-to-routing copied to clipboard

Fix warning in FASM

Open vaughnbetz opened this issue 1 year ago • 2 comments

Recent CI shows this warning in fasm:

/home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing/utils/fasm/src/fasm.cpp:572:24: warning: loop variable ‘param’ creates a copy from type ‘const std::__cxx11::basic_string’ [-Wrange-loop-construct] 572 | for(const auto param : vtr::split(fasm_params_str, "\n")) { | ^~~~~ /home/runner/work/vtr-verilog-to-routing/vtr-verilog-to-routing/utils/fasm/src/fasm.cpp:572:24: note: use reference type to prevent copying 572 | for(const auto param : vtr::split(fasm_params_str, "\n")) { | ^~~~~ | &

@duck2 : can you fix this? I think it just needs a ref (&).

vaughnbetz avatar Oct 06 '23 19:10 vaughnbetz

In general, not only using string references, but also using more std::string_view would help avoid a lot of allocating new strings. I see that there are a lot of functions that take a std::string as value parameter and return std::vector<std::string> (e.g. split_fasm_entry()).

(And for fast fasm parsing, I'd like to plug this thing I did a while back https://github.com/hzeller/simple-fasm - feel free to just copy into the project).

hzeller avatar Oct 06 '23 22:10 hzeller

@hzeller: if that new fasm works better I'm happy to see it integrated, but I think you'd have to drive it since I don't have any fasm experts on my team.

vaughnbetz avatar Oct 06 '23 23:10 vaughnbetz

This warning has been resolved in PR #2535

@vaughnbetz should we close this issue?

AlexandreSinger avatar Apr 16 '24 20:04 AlexandreSinger

Thanks!

vaughnbetz avatar Apr 16 '24 20:04 vaughnbetz