Forums

Spurious warning on compiler compile

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

Spurious warning on compiler compile

Postby hopscc » Tue Jul 08, 2008 4:00 am

While I'm nitpicking there a couple of warnings coming from the cobra compiler source when it compiles.
These are really annoying when scanning for errors from additions
It'd be nice if they werent there :o

CobraParser.cobra(1090): warning: The value of variable "attribs" is never used.

this is true ( presumably for the moment).
if these are placeholders for something in the future could we comment them out until the future something comes along and put a trailing note on them
if not can we remove (both) lines entirely?

The second is spurious
Boxes.cobra(853): warning: The expression "_needs_typeArgs" (of type "List<of IType>") will always evaluate to true because it is not nilable. You can remove the expression or check for non-empty collections with ".count".


The surrounding lines look like this
Code: Select all
   var _needs_typeArgs as List<of IType>?
      """
      When non-nil, this box is constructed from a generic *and* requires completion of its construction of members.
      """

   def completeMemberConstructionIfNeeded
      if _needs_typeArgs
         assert not .isGenericDef
         if not .didBindInt and not .isBindingInt
            .bindInt  # this is required when inheriting from a constructed type such as "class Foo inherits List<of int>". Since "bind inheritance" happens prior to "bind interface", the base type will have been partially constructed without ever binding int.
         if _needs_typeArgs
            _completeConstruction(_needs_typeArgs)
         _needs_typeArgs = nil

Line 853 is the second 'if _needs_typeArgs' statement. (whoa!)
This warning is spurious since _needs_typeArgs is clearly marked as nilable (List<of IType>?) AND its not complaining about the first
if _needs_typeArgs line (exactly the same).
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Spurious warning on compiler compile

Postby Charles » Wed Sep 03, 2008 12:15 pm

I fixed the warning about "attribs" by making use of the attribs. changeset:1608

Re: the warning about "will always evaluate to true", see ticket:41.

I then added a # .no-warnings. directive on that line but it's not working. If I misspell it, I get an error so the compiler is definitely checking for directives. If I spell it correctly, no error, but no suppression either. I get the same result with "make-trial; comp-trial" so I think there is a bug in the warning suppression code.
Charles
 
Posts: 2512
Location: Los Angeles, CA

Re: Spurious warning on compiler compile

Postby hopscc » Wed Sep 03, 2008 11:11 pm

Its cos the noWarnings list is being replaced for each file (overwritten). If the warning is being generated from a stage after the
file is parsed the warning suppression record is no longer in existance....

fix is to augment the compiler._noWarningsList rather than overwriting it...
patch coming up - I'll attach it to ticket:41
hopscc
 
Posts: 632
Location: New Plymouth, Taranaki, New Zealand

Re: Spurious warning on compiler compile

Postby Charles » Sat Sep 13, 2008 11:38 pm

Fixed in development. I didn't use the patch which contained no test cases. Also, I thought it was more clear to call .addRange() directly than have a property setter do it. changeset:1620
Charles
 
Posts: 2512
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 7 guests

cron