# HG changeset patch # User John W. Eaton # Date 1386813510 18000 # Node ID d96747f74b1e9e3c17dc37ee142b9f702972c9de # Parent d76f790b4eece0ab6bddeb788cfd686f0d327264 enable "backtrace" warning by default and document option * error.cc (Vbacktrace_on_warning): Initialize to true. (Fwarning): Describe "backtrace" option. diff -r d76f790b4eec -r d96747f74b1e NEWS --- a/NEWS Wed Dec 11 20:51:22 2013 -0500 +++ b/NEWS Wed Dec 11 20:58:30 2013 -0500 @@ -1,6 +1,9 @@ Summary of important user-visible changes for version 4.0: --------------------------------------------------------- + ** For compatibility with Matlab, the "backtrace" warning option is now + enabled by default. + ** The preference do_braindead_shortcircuit_evaluation diff -r d76f790b4eec -r d96747f74b1e libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc Wed Dec 11 20:51:22 2013 -0500 +++ b/libinterp/corefcn/error.cc Wed Dec 11 20:58:30 2013 -0500 @@ -61,7 +61,7 @@ // TRUE means that Octave will try to display a stack trace when a // warning is encountered. -static bool Vbacktrace_on_warning = false; +static bool Vbacktrace_on_warning = true; // TRUE means that Octave will print a verbose warning. Currently unused. static bool Vverbose_warning; @@ -1225,6 +1225,7 @@ @deftypefnx {Built-in Function} {} warning (\"off\", @var{id})\n\ @deftypefnx {Built-in Function} {} warning (\"query\", @var{id})\n\ @deftypefnx {Built-in Function} {} warning (\"error\", @var{id})\n\ +@deftypefnx {Built-in Function} {} warning (@var{state}, \"backtrace\")\n\ @deftypefnx {Built-in Function} {} warning (@var{state}, @var{id}, \"local\")\n\ Format the optional arguments under the control of the template string\n\ @var{template} using the same rules as the @code{printf} family of\n\ @@ -1255,6 +1256,11 @@ @end group\n\ @end example\n\ \n\ +If the state is @qcode{\"on\"} or @qcode{\"off\"} and the third argument\n\ +is @qcode{\"backtrace\"}, then a stack trace is printed along with the\n\ +warning message when warnings occur inside function calls. This option\n\ +is enabled by default.\n\ +\n\ If the state is @qcode{\"on\"}, @qcode{\"off\"}, or @qcode{\"error\"}\n\ and the third argument is @qcode{\"local\"}, then the warning state\n\ will be set temporarily, until the end of the current function.\n\