# HG changeset patch # User John W. Eaton # Date 1388439570 18000 # Mon Dec 30 16:39:30 2013 -0500 # Branch gui-release # Node ID 497564af7b8187c13ff35963c832da630459f3ea # Parent c26f44818eed605e2352cdb3d3c9a8eac201772b set last warning id and message even if warning state is off (bug #41028) * error.cc (vwarning): New arg, warn_opt. Only flush octave_stdout and print warning message if warn_opt is 1. (warning_1): Pass warn_opt to vwarning. diff --git a/libinterp/corefcn/error.cc b/libinterp/corefcn/error.cc --- a/libinterp/corefcn/error.cc +++ b/libinterp/corefcn/error.cc @@ -148,13 +148,12 @@ // Warning messages are never buffered. static void -vwarning (const char *name, const char *id, const char *fmt, va_list args) +vwarning (const char *name, const char *id, int warn_opt, + const char *fmt, va_list args) { if (discard_warning_messages) return; - flush_octave_stdout (); - std::ostringstream output_buf; if (name) @@ -178,11 +177,16 @@ Vlast_warning_message = msg_string; } - if (! Vquiet_warning) + if (warn_opt == 1) { - octave_diary << msg_string; + flush_octave_stdout (); - std::cerr << msg_string; + if (! Vquiet_warning) + { + octave_diary << msg_string; + + std::cerr << msg_string; + } } } @@ -637,27 +641,30 @@ error_2 (id, fmt, args); } - else if (warn_opt == 1) + else { - vwarning ("warning", id, fmt, args); + vwarning ("warning", id, warn_opt, fmt, args); - if (! symbol_table::at_top_level () - && Vbacktrace_on_warning - && ! warning_state - && ! discard_warning_messages) - pr_where ("warning"); + if (warn_opt == 1) + { + if (! symbol_table::at_top_level () + && Vbacktrace_on_warning + && ! warning_state + && ! discard_warning_messages) + pr_where ("warning"); - warning_state = 1; + warning_state = 1; - if ((interactive || forced_interactive) - && Vdebug_on_warning - && octave_call_stack::caller_user_code ()) - { - unwind_protect frame; - frame.protect_var (Vdebug_on_warning); - Vdebug_on_warning = false; + if ((interactive || forced_interactive) + && Vdebug_on_warning + && octave_call_stack::caller_user_code ()) + { + unwind_protect frame; + frame.protect_var (Vdebug_on_warning); + Vdebug_on_warning = false; - do_keyboard (octave_value_list ()); + do_keyboard (octave_value_list ()); + } } } }