rubyx icon indicating copy to clipboard operation
rubyx copied to clipboard

Several warnings about not initialized instance variables

Open abinoam opened this issue 4 years ago • 9 comments

I'm using ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin17]

(eval):1: warning: instance variable @single_class not initialized
/Users/abinoam/src/ruby/rubyx/lib/rubyx/rubyx_compiler.rb:113: warning: instance variable @sol not initialized
/Users/abinoam/src/ruby/rubyx/lib/util/compiler_list.rb:10: warning: instance variable @next_compiler not initialized
/Users/abinoam/src/ruby/rubyx/lib/util/list.rb:16: warning: instance variable @next not initialized

I'll open a branch and see if I can handle this.

abinoam avatar Jun 29 '20 14:06 abinoam

I couldn't make it run on my machine. Sorry. Giving up by now. If I find some time later I'll try again.

abinoam avatar Jun 29 '20 14:06 abinoam

Hi @abinoam thanks for trying to fix it. You didn't include the command that was run, so i can't reproduce. I have used 2.6.x , i think even 3, though not sure. 2.5 is so much faster, i switched back.

If you tell me the command, i can check myself

rubydesign avatar Jun 29 '20 15:06 rubydesign

Hi @rubydesign,

Congratulations for the project. I haven't had heard about it before. I was trying to learn Rust to make some extensions for Ruby code than I've reached rubyx (which I've found it to be a really interesting project).

I was trying to run bundle exec rake test when a lot of warnings came out. And I was trying to bin/rubyx my_simple_script.rb and it didn't work also. It may be something related to my ruby enviroment/versions. I promise you to have a second look (more carefully) at the weekend.

By the way, I think if I set ruby to lower warning level the warnings would vanish. But I think it would be more interesting to fix them instead.

Most of them are the form:

  return @ins_var if @ins_var

The fix would be something like

  return @ins_var if defined? @ins_var

Some of them seems to come from code in some dependencies (not your project itself).

abinoam avatar Jun 29 '20 16:06 abinoam

well thanks, and sorry, i haven't set up a rakefile

try

ruby test/test_all.rb

that should work

compiling your own code will be tricky, as only parts of the language are implemented, and error handling is non existing

rubydesign avatar Jun 29 '20 17:06 rubydesign

With ruby test/test_all.rb I can run the tests without the warnings. It happens that rake test runs it differently.

If you run ruby -W2 test/test_all.rb you will probably see the same warnings as I see.

abinoam avatar Jun 29 '20 23:06 abinoam

I'm trying to update .rubocop.yml configs also. Because I couldn't make it run.

abinoam avatar Jun 29 '20 23:06 abinoam

Just clarifying... I'm aiming at configuring rubocop in the hope that its auto-correct feature can gives us hand to quickly get rid of most of these warnings.

abinoam avatar Jun 30 '20 00:06 abinoam

While running the tests I've got this messages on my ubuntu machine. No such file or directory - arm-linux-gnueabi-ld

I've solved it with sudo apt-get install gcc-arm-linux-gnueabi

Taking note here for the case it is not documented elsewhere.

abinoam avatar Jun 30 '20 00:06 abinoam

Ok, many things. I'll start here with the linker. Bug #13 is old and requires a link step before running an executable. Some test, like class TestArm test an actual arm executable through qemu. They test for the linker availability and the warning you saw is when the linker is not available.

That warning should be supressed and yes, more docs would be good (and a small start is in the test/README if you want to have a go)

rubydesign avatar Jun 30 '20 09:06 rubydesign