diff libinterp/parse-tree/profiler.cc @ 23752:6be1bf9455e3

fix argument checks for internal profiler functions * profiler.cc (F__profiler_enable__, F__profiler_reset__, F__profiler_data__): Error with usage message for incorrect number of arguments.
author John W. Eaton <jwe@octave.org>
date Sat, 08 Jul 2017 10:14:32 -0400
parents 0ebc4f1a5714
children c3828bd031cd
line wrap: on
line diff
--- a/libinterp/parse-tree/profiler.cc	Sat Jul 08 10:10:37 2017 -0400
+++ b/libinterp/parse-tree/profiler.cc	Sat Jul 08 10:14:32 2017 -0400
@@ -392,7 +392,7 @@
   if (nargin > 1)
     print_usage ();
 
-  if (nargin > 0)
+  if (nargin == 1)
     profiler.set_active (args(0).bool_value ());
 
   return ovl (profiler.is_active ());
@@ -405,8 +405,8 @@
 Undocumented internal function.
 @end deftypefn */)
 {
-  if (args.length () > 0)
-    warning ("profiler_reset: ignoring extra arguments");
+  if (args.length () != 0)
+    print_usage ();
 
   profiler.reset ();
 
@@ -420,8 +420,8 @@
 Undocumented internal function.
 @end deftypefn */)
 {
-  if (args.length () > 0)
-    warning ("profiler_data: ignoring extra arguments");
+  if (args.length () != 0)
+    print_usage ();
 
   if (nargout > 1)
     return ovl (profiler.get_flat (), profiler.get_hierarchical ());