changeset 20130:0aed244dbdb3

don't print stack trace if warning format ends with newline character * error.cc (warning_1): Skip printing stack trace if format string ends with newline character.
author John W. Eaton <jwe@octave.org>
date Sat, 25 Apr 2015 12:17:51 -0400
parents 1784bf79ed43
children 0d56160e346d
files libinterp/corefcn/error.cc
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/error.cc	Fri Apr 24 18:43:36 2015 +0200
+++ b/libinterp/corefcn/error.cc	Sat Apr 25 12:17:51 2015 -0400
@@ -638,7 +638,12 @@
 
       bool in_user_code = octave_call_stack::caller_user_code () != 0;
 
-      if (in_user_code && Vbacktrace_on_warning && ! warning_state
+      bool fmt_suppresses_backtrace = false;
+      size_t fmt_len = fmt ? strlen (fmt) : 0;
+      fmt_suppresses_backtrace = (fmt_len > 0 && fmt[fmt_len-1] == '\n');
+
+      if (! fmt_suppresses_backtrace && in_user_code
+          && Vbacktrace_on_warning && ! warning_state
           && ! discard_warning_messages)
         pr_where ("warning");