Re: imnoise patch

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: imnoise patch

Paul Kienzle

On Feb 25, 2004, at 3:49 AM, Stefan van der Walt wrote:

> How do we test for warnings?

The current octave-forge tests ignore them.  Neither
assert() nor fail() will work since the function merrily
prints the warning and returns a value.  If we could
convert warnings to errors, then we could test for them.

Perhaps we could rename the debug_on_warning
flag to action_on_warning, with the following actions:

        show: show warnings
        trace: show warnings with line numbers
        hide: hide warnings
        debug: stop at the line in the debugger
        error: treat warnings as errors

This should be easy enough to implement with
a few changes in error.cc.

If you are feeling ambitious, an additional action
would be nice:

        once: only show a given warning once

For now I emulate this with static variables.

Supporting 'once' would require a cache of all warnings
we have seen.  Given this cache, it is easier to implement
different actions for different warnings.  Octave already
does this in an ad hoc fashion for a few warnings with the
built in warn_* variables.  Type "who -a warn_*" for a list.

Paul Kienzle
[hidden email]