bugGNU Octave - Bugs: bug #44336, warning ("error",...

 
 

bug #44336: warning ("error", "all") changes "matlab-compatible" warnings if there's an "all" status before

Submitted by:  Carnë Draug <carandraug>
Submitted on:  Sat 21 Feb 2015 05:00:24 PM UTC
 
Category:  Interpreter Severity:  2 - Minor
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  lachlan
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Mon 08 Aug 2016 09:46:24 PM UTC, comment #6: 

@Lachlan: I pushed your patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/cf18d6e791a1).  Closing report and marking as fixed on http://wiki.octave.org/Bug_Fix_List_-_4.2.0_Release.

Rik <rik5>
Project Administrator
Fri 26 Feb 2016 09:43:46 AM UTC, comment #5: 

I forgot to mention in the previous post that a fix is attached, and also to give the example showing that "warning on all" is not required.

Without the patch:

>> warning on Octave:language-extension
>> a=1;
>> a++
warning: Octave language extension used: ++ used as operator
ans =  1
>> warning error all
>> a++
error: Octave language extension used: ++ used as operator
error: parse error

Lachlan Andrew <lachlan>
Thu 11 Feb 2016 10:15:44 AM UTC, comment #4: 

It turns out that there doesn't need to be a previous "all".  Just having Octave:language-extension enabled is the problem:

octave:1> warning("on", "Octave:language-extension");
octave:2> warning("error", "all");
octave:3> a=1; a++
error: Octave language extension used: ++ used as operator
error: parse error
-verbatim

It is a property of the state, not of how warning("error","all") works.

+verbatim+
octave:3> b = warning ("query");
octave:4> [{b.identifier}', {b.state}']'
ans =
{
  [1,1] = all
  [2,1] = error
  [1,2] = Octave:language-extension
  [2,2] = on
  [1,3] = Octave:single-quote-string
  [2,3] = on
}
octave:5> a=1; a++
error: Octave language extension used: ++ used as operator
error: parse error
-verbatim-

The reason is that warning_enabled decides that if "all"=="error", then anything other than "off" gives error, even if one ID is explicitly set to be "on":

+verbatim+
  else if (all_state == 2)
    {
      if (id_state == 0)
        retval= id_state;
      else
        retval = all_state;
    }
-verbatim-

That neither option 1 nor option 2 will work.  The only solutions are:

3. Set Octave:language-extension="off" for warning("error","all")
4. Change warning_enabled.

Option 4 may risk Matlab compatibility.  The attached patch implements option 3.

(file #36311)

Lachlan Andrew <lachlan>
Wed 10 Feb 2016 01:11:33 PM UTC, comment #3: 

Carnë, you're absolutely right.  I don't remember what I did to check it, but it was obviously not enough.

Looking at the code, I think it would be best to replace the current special treatment of Octave:matlab-incompatible (a.k.a. Octave:language-extension) with something like your option 2

For warning ("error", "all"):
Step 1. Set the Octave:language-extension to the previous value of "all"
Step 2. Search to see if it previously had an explicit value, in which case that value is retained.

Lachlan Andrew <lachlan>
Mon 08 Feb 2016 01:08:18 AM UTC, comment #2: 

I still get the error at the end of the sequence building the current default branch (cset d78e45987d6a).

octave-gui:1> a = 1;
octave-gui:2> warning ("on", "all");
octave-gui:3> warning ("error", "all");
octave-gui:4> a++
error: Octave language extension used: ++ used as operator
error: parse error

Carnë Draug <carandraug>
Project Member
Fri 15 Jan 2016 12:16:25 PM UTC, comment #1: 

The current development code gives no errors or warnings from this sequence of commands.  That sounds like your option 1, Carnë.

Can this bug report be closed?

Lachlan Andrew <lachlan>
Sat 21 Feb 2015 05:00:24 PM UTC, original submission:  

Changing the state of all warnings to error, is supposed to leave "Octave:matlab-incompatible" alone http://hg.savannah.gnu.org/hgweb/octave/file/343ca73b1507/libinterp/corefcn/error.cc#l1515

This works fine unless there has been some change of error state that groups them under "all". The following code is on 3.8.2 but I get the same behavior on dev.

octave-cli-3.8.2:1> a = 1;
octave-cli-3.8.2:2> a++;
octave-cli-3.8.2:3> warning ("error", "all");
octave-cli-3.8.2:4> a++;
octave-cli-3.8.2:5> warning ("on", "all");
octave-cli-3.8.2:6> a++;
warning: potential Matlab compatibility problem: ++ used as operator
octave-cli-3.8.2:7> warning ("error", "all");
octave-cli-3.8.2:8> a++;
error: potential Matlab compatibility problem: ++ used as operator

I see two possible fixes: 1) have all the changes to 'all' warning ids skip matlab-compatible instead of only error, 2) have error all, set matlab-compatible to the previous state of "all".

Carnë Draug <carandraug>
Project Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #36311:  bug_44336.cset added by lachlan (3KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by carandraug (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-08 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2016-02-26 lachlan Severity3 - Normal => 2 - Minor
        StatusNone => Patch Submitted
        Assigned toNone => lachlan
    2016-02-11 lachlan Attached File- => Added bug_44336.cset, #36311

    Back to the top


    Powered by Savane 3.9