# HG changeset patch # User Stefan Miereis # Date 1441407747 -7200 # Node ID 9502e0142c198534d78f250e61731b30d63f7e8c # Parent 315b7d51d6c86e14e407913aaacb73bea1d81324 Simplify error output if max_recursion_depth is exceeded (Bug #45843). * error.cc (pr_where): Call unique on std::list frames. * toplev.h (operator==): Declare equality operator for octave_call_stack::stack_frame. * toplev.cc (operator==): Implement equality operator for octave_call_stack::stack_frame. diff -r 315b7d51d6c8 -r 9502e0142c19 libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Wed Sep 23 15:31:34 2015 +0200 +++ b/libinterp/corefcn/error.cc Sat Sep 05 01:02:27 2015 +0200 @@ -314,6 +314,10 @@ if (nframes > 0) pr_where_1 ("%s: called from\n", who); + // Print the error message only if it is different from the previous one; + // Makes the output more concise and readable. + frames.unique (); + for (std::list::const_iterator p = frames.begin (); p != frames.end (); p++) { diff -r 315b7d51d6c8 -r 9502e0142c19 libinterp/corefcn/toplev.cc --- a/libinterp/corefcn/toplev.cc Wed Sep 23 15:31:34 2015 +0200 +++ b/libinterp/corefcn/toplev.cc Sat Sep 05 01:02:27 2015 +0200 @@ -130,6 +130,21 @@ return retval; } +bool +octave_call_stack::stack_frame::operator== (const octave_call_stack::stack_frame &rhs) const +{ + if (this->line () != rhs.line ()) + return false; + else if (this->column () != rhs.column ()) + return false; + else if (this->fcn_file_name () != rhs.fcn_file_name ()) + return false; + else if (this->fcn_name () != rhs.fcn_name ()) + return false; + else + return true; +} + void octave_call_stack::create_instance (void) { diff -r 315b7d51d6c8 -r 9502e0142c19 libinterp/corefcn/toplev.h --- a/libinterp/corefcn/toplev.h Wed Sep 23 15:31:34 2015 +0200 +++ b/libinterp/corefcn/toplev.h Sat Sep 05 01:02:27 2015 +0200 @@ -107,6 +107,8 @@ std::string fcn_name (bool print_subfn = true) const; + bool operator== (const stack_frame &rhs) const; + private: octave_function *m_fcn;