Project

General

Profile

Actions

Bug #3514

closed

Unused Variable Warnings in StdLib [PATCHES]

Added by runpaint (Run Paint Run Run) over 14 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3dev (2010-07-01 trunk 28516) [i686-linux]
Backport:

Description

=begin
Quite a few files in lib/ trigger "assigned but unused variable" warnings. Attached are fixes for the first seven files. For all of them I've examined the local variable scope, and confirmed that neither the unit tests nor RubySpec breaks. If these are OK, I'll continue.
=end


Files

date.patch (1.57 KB) date.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
debug.patch (939 Bytes) debug.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
pathname.patch (1.07 KB) pathname.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
irb.patch (1 KB) irb.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
logger.patch (790 Bytes) logger.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
drb.patch (1.41 KB) drb.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
csv.patch (942 Bytes) csv.patch runpaint (Run Paint Run Run), 07/02/2010 04:38 AM
unused.patch (36.5 KB) unused.patch runpaint (Run Paint Run Run), 07/14/2010 04:57 AM
Actions #1

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

=begin
attachments didn't make it...
=end

Updated by runpaint (Run Paint Run Run) over 14 years ago

=begin
Sorry. I'm in an area with "excellent" 3G coverage which drops out every ten minutes...
=end

Actions #3

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • Target version set to 2.0.0

=begin
Thanks for the patches. They have been applied in r28619 .

Note that as all these changes are independent, breaking them in different patches is not needed; a single one is easier to apply.

To generate the warnings in an automatic fashion, one can issue the following command:

make test-all TESTS="test_library_loading.rb"

Where the file test/test_library_loading.rb is:

require 'test/unit'
require_relative 'ruby/envutil'

class TestRequire < Test::Unit::TestCase
exceptions = %w[rubygems/specification]
exclude = Regexp.union(exceptions.map{|p| Regexp.new "^#{p}"})
root = "lib"
path = File.expand_path("../../#{root}/", FILE)
seen = []
Dir.chdir path
puts ENV['LOAD_ONLY'].inspect
load = if ENV['LOAD_ONLY']
ENV['LOAD_ONLY'].split(/,/)
else
Dir.glob("**/
.rb")
end
load.each do |lib|
lib.chomp!(".rb")
next if exclude =~ lib
define_method :"test_load_library (#{root}/#{lib})" do
assert_in_out_err([], "$VERBOSE= true\nrequire '#{lib}'") do |stdout, stderr|
all = stdout+stderr
all -= seen
seen += all
fail "No output was expected but got:\n" + all.join("\n") unless all.empty?
pass
end
end
end
end

=end

Actions #4

Updated by runpaint (Run Paint Run Run) over 14 years ago

=begin
The attached fixes the majority of the remainder. The residuum are used in a binding, so can't simply be removed. I suspect they can be replaced with ivars, but that'll be a separate ticket. RubySpec library/ still passes. I don't believe any of the test-all failures are my fault, but I'm currently re-building without my patch to check.
=end

Actions #5

Updated by marcandre (Marc-Andre Lafortune) over 14 years ago

  • Status changed from Open to Assigned
  • Assignee set to marcandre (Marc-Andre Lafortune)

=begin

=end

Actions #6

Updated by marcandre (Marc-Andre Lafortune) about 14 years ago

  • Status changed from Assigned to Closed

=begin
Thanks for the patch and sorry for the delay.

Applied in r29726, as well as r29725 downto r29722 for RubyGems, RDoc, Rake & minitest.
=end

Actions #7

Updated by zenspider (Ryan Davis) about 14 years ago

=begin

On Nov 8, 2010, at 18:55 , Marc-Andre Lafortune wrote:

Issue #3514 has been updated by Marc-Andre Lafortune.

Status changed from Assigned to Closed

Thanks for the patch and sorry for the delay.

Applied in r29726, as well as r29725 downto r29722 for RubyGems, RDoc, Rake & minitest.

Please respect the warning at the top of the file:

############################################################

This file is imported from a different project.

DO NOT make modifications in this repo.

File a patch instead and assign it to Ryan Davis

############################################################

In this case, the patch will be rolled out because the file is getting an total revamp in the next merge.

The same should be true for rubygems, rdoc, and rake. It is much better to file a ticket against the maintainer and let them handle it rather than force them to deal with bi-directional merge conflicts across multiple repos.

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0