bugGNU Octave - Bugs: bug #59784, additional text at end of block...


bug #59784: additional text at end of block comment produces doubled warning

Submitter:  Rik <rik5>
Submitted:  Wed 30 Dec 2020 05:13:45 PM UTC
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  10.1.0 (current default) Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Wed 28 Feb 2024 04:45:44 AM UTC, comment #3: 

I changed the warning to an error in this changeset: https://hg.savannah.gnu.org/hgweb/octave/rev/12ba0316d483.

This behavior is arguably better because an unterminated block comment is a large problem.  This is also compatible with Matlab.  As a side effect, there is only one error message generated which was the focus of this bug report.

Marking as Fixed and closing report.

Rik <rik5>
Group administrator
Sat 13 Feb 2021 10:00:20 PM UTC, comment #2: 

I pushed a change to the warning message here (http://hg.savannah.gnu.org/hgweb/octave/rev/30afb3804d6e).  Incidentally, Matlab doesn't let the programmer get away with unterminated block comments.  It throws an error, rather than a warning, at the end of input.

Rik <rik5>
Group administrator
Sat 13 Feb 2021 09:43:12 PM UTC, comment #1: 

I think the fact that we are getting two messages printed is due to an actual misunderstanding in using bison parser.  The code in lex.ll is

<<EOF>> {
   return curr_lexer->handle_end_of_input ();

I used a debugger with a breakpoint in handle_end_of_input and the function is called twice from this location.

I suspect the problem is that when EOF is encountered the token is somehow not being popped off the stack (possibly because of the return statement).  Or in some other way we are not marking that we should abandon processing.  Adding jwe to the CC list since he might understand what is going on.

Rik <rik5>
Group administrator
Wed 30 Dec 2020 05:13:45 PM UTC, original submission:  

This isn't a big deal, but consider the script below.

comment line
#} disp ('out of block comment');

When the script is run the output from the interpreter is:

warning: block comment open at end of input
warning: near line 4 of file 'dbl_msg_print.m'
warning: block comment open at end of input
warning: near line 4 of file 'dbl_msg_print.m'

I get that the interpreter is unhappy, but it really only needs to print the message once.

On a second note, I think the warning message could be clearer.  Maybe something like

warning: trailing text after block comment close

Rik <rik5>
Group administrator


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5 (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 group members can vote.


    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-02-28 rik5 StatusConfirmed Fixed
        Fixed ReleaseNone 10.1.0 (current default)
    2021-02-13 rik5 Carbon-Copy- Added jwe
    2021-01-04 rik5 Priority5 - Normal 3 - Low

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code