changeset 32677:03dcf031fbf3

Deprecate '--verbose' option in favor of '--init-trace'. * NEWS.10.md: Announce change. * basics.txi: Document new '--init-trace' option. * interpreter.h (interpreter::m_init_trace): New member variable. * interpreter.h (interpreter::init_trace): New function. * interpreter.h (interpreter::verbose): Add OCTAVE_DEPRECATED tag. * interpreter.cc (interpreter::interpreter): Use m_init_trace variable. * interpreter.cc (execute_startup_files): Rename local variable to "trace". Use m_init_trace variable. * octave.h (verbose_flag): Add OCTAVE_DEPRECATED tag. * octave.h (init_trace): New function. * octave.h (m_init_trace): New member variable. * octave.cc (cmdline_options): Use m_init_trace variable. * octave.cc (as_octave_value): Use init_trace() function. Provide alias verbose in struct. * options.h (long_opts): Add option "--init-trace". Add comment about --verbose being deprecated. * usage.h (usage_string, octave_print_verbose_usage_and_exit): Remove references to --verbose.
author Rik <rik@octave.org>
date Tue, 02 Jan 2024 13:42:37 -0800
parents 2438b3513ee3
children 49d6ecd07a76
files doc/interpreter/basics.txi etc/NEWS.10.md libinterp/corefcn/interpreter.cc libinterp/corefcn/interpreter.h libinterp/octave.cc libinterp/octave.h libinterp/options.h libinterp/usage.h
diffstat 8 files changed, 48 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/doc/interpreter/basics.txi	Sun Dec 31 20:28:43 2023 -0500
+++ b/doc/interpreter/basics.txi	Tue Jan 02 13:42:37 2024 -0800
@@ -145,6 +145,11 @@
 commands in the system or user startup files that use the
 @code{info_program} function.
 
+@item  --init-trace
+@cindex @sortas{options, Octave command --init-trace} @ @ @code{--init-trace}
+Print the name of each configuration as it is read and executed during
+initialization.
+
 @item  --interactive
 @itemx -i
 @cindex @sortas{options, Octave command --interactive} @ @ @code{--interactive}
@@ -277,12 +282,6 @@
 that works in Octave but not @sc{matlab} (@pxref{XREFwarning,,warning},
 @ref{XREFwarning_ids,,warning_ids}).
 
-@item  --verbose
-@itemx -V
-@cindex @sortas{options, Octave command --verbose} @ @ @code{--verbose}
-@cindex @sortas{options, Octave command -V} @ @ @code{-V}
-Turn on verbose output.
-
 @item  --version
 @itemx -v
 @cindex @sortas{options, Octave command --version} @ @ @code{--version}
--- a/etc/NEWS.10.md	Sun Dec 31 20:28:43 2023 -0500
+++ b/etc/NEWS.10.md	Tue Jan 02 13:42:37 2024 -0800
@@ -49,13 +49,18 @@
         symbol_record_rep::unmark_as_variable | symbol_record_rep::unmark_variable
         symbol_record::mark_as_variable       | symbol_record::mark_variable
         symbol_record::unmark_as_variable     | symbol_record::unmark_variable
+        interpreter::verbose                  | interpreter::init_trace
+        cmdline_options::verbose              | cmdline_options::init_trace
 
-- A new method `rwdata ()` provides direct read/write access (a pointer) to the
+  - A new method `rwdata ()` provides direct read/write access (a pointer) to the
 data in a liboctave `Array` object (or its derived classes such as `Matrix`).
 Historically, the method `fortran_vec ()` provided this access, but the name
 is unclear, and it is recommended to use `rwdata ()` in any new code.  There
 are no plans to deprecate `fortran_vec`.
 
+  - The `--verbose`,`-V` command-line option has been deprecated.  Use
+`--init-trace` to print the configuration files executed during initialization.
+
 The following features were deprecated in Octave 8 and have been removed
 from Octave 10.
 
--- a/libinterp/corefcn/interpreter.cc	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/corefcn/interpreter.cc	Tue Jan 02 13:42:37 2024 -0800
@@ -456,7 +456,7 @@
     m_interactive (false),
     m_read_site_files (true),
     m_read_init_files (m_app_context != nullptr),
-    m_verbose (false),
+    m_init_trace (false),
     m_traditional (false),
     m_inhibit_startup_message (false),
     m_load_path_initialized (false),
@@ -1101,7 +1101,7 @@
 {
   bool read_site_files = m_read_site_files;
   bool read_init_files = m_read_init_files;
-  bool verbose = m_verbose;
+  bool trace = m_init_trace;
   bool inhibit_startup_message = m_inhibit_startup_message;
 
   if (m_app_context)
@@ -1110,11 +1110,11 @@
 
       read_site_files = options.read_site_files ();
       read_init_files = options.read_init_files ();
-      verbose = options.verbose_flag ();
+      trace = options.init_trace ();
       inhibit_startup_message = options.inhibit_startup_message ();
     }
 
-  verbose = (verbose && ! inhibit_startup_message);
+  trace = (trace && ! inhibit_startup_message);
 
   bool require_file = false;
 
@@ -1130,13 +1130,13 @@
       // $(prefix)/share/octave/$(version)/m/octaverc (if it exists).
 
       int status = safe_source_file (config::local_site_defaults_file (),
-                                     context, verbose, require_file);
+                                     context, trace, require_file);
 
       if (status)
         exit_status = status;
 
       status = safe_source_file (config::site_defaults_file (),
-                                 context, verbose, require_file);
+                                 context, trace, require_file);
 
       if (status)
         exit_status = status;
@@ -1179,7 +1179,7 @@
 
       if (! cfg_rc.empty ())
         {
-          int status = safe_source_file (cfg_rc, context, verbose,
+          int status = safe_source_file (cfg_rc, context, trace,
                                          require_file);
 
           if (status)
@@ -1205,7 +1205,7 @@
 
       if (! home_rc.empty ())
         {
-          int status = safe_source_file (home_rc, context, verbose,
+          int status = safe_source_file (home_rc, context, trace,
                                          require_file);
 
           if (status)
@@ -1229,7 +1229,7 @@
           if (local_rc.empty ())
             local_rc = sys::env::make_absolute (initfile);
 
-          int status = safe_source_file (local_rc, context, verbose,
+          int status = safe_source_file (local_rc, context, trace,
                                          require_file);
 
           if (status)
@@ -1237,7 +1237,7 @@
         }
     }
 
-  if (m_interactive && verbose)
+  if (m_interactive && trace)
     std::cout << std::endl;
 
   return exit_status;
--- a/libinterp/corefcn/interpreter.h	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/corefcn/interpreter.h	Tue Jan 02 13:42:37 2024 -0800
@@ -182,9 +182,15 @@
     m_read_init_files = flag;
   }
 
+  void init_trace (bool flag)
+  {
+    m_init_trace = flag;
+  }
+
+  OCTAVE_DEPRECATED (10, "interpreter::verbose is deprecated, use init_trace")
   void verbose (bool flag)
   {
-    m_verbose = flag;
+    init_trace (flag);
   }
 
   void traditional (bool flag)
@@ -640,7 +646,7 @@
 
   bool m_read_init_files;
 
-  bool m_verbose;
+  bool m_init_trace;
 
   bool m_traditional;
 
--- a/libinterp/octave.cc	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/octave.cc	Tue Jan 02 13:42:37 2024 -0800
@@ -98,7 +98,7 @@
           break;
 
         case 'V':
-          m_verbose_flag = true;
+          m_init_trace = true;
           break;
 
         // FIXME: Disabled debug option for parser 2023-12-29.
@@ -261,7 +261,9 @@
   m.assign ("server", server ());
   m.assign ("set_initial_path", set_initial_path ());
   m.assign ("traditional", traditional ());
-  m.assign ("verbose_flag", verbose_flag ());
+  m.assign ("init_trace", init_trace ());
+  // FIXME: --verbose deprecated in Octave 10.  Remove in Octave 12.
+  m.assign ("verbose", init_trace ());
   m.assign ("code_to_eval", code_to_eval ());
   m.assign ("command_line_path", string_vector (command_line_path ()));
   m.assign ("docstrings_file", docstrings_file ());
--- a/libinterp/octave.h	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/octave.h	Tue Jan 02 13:42:37 2024 -0800
@@ -72,7 +72,10 @@
   bool server () const { return m_server; }
   bool set_initial_path () const { return m_set_initial_path; }
   bool traditional () const { return m_traditional; }
-  bool verbose_flag () const { return m_verbose_flag; }
+
+  OCTAVE_DEPRECATED (10, "cmdline_options::verbose is deprecated, use init_trace")
+  bool verbose () const { return m_init_trace; }
+  bool init_trace () const { return m_init_trace; }
   std::string code_to_eval () const { return m_code_to_eval; }
   std::list<std::string> command_line_path () const
   { return m_command_line_path; }
@@ -104,7 +107,9 @@
   void server (bool arg) { m_server = arg; }
   void set_initial_path (bool arg) { m_set_initial_path = arg; }
   void traditional (bool arg) { m_traditional = arg; }
-  void verbose_flag (bool arg) { m_verbose_flag = arg; }
+  OCTAVE_DEPRECATED (10, "cmdline_options::verbose is deprecated, use init_trace")
+  void verbose (bool arg) { m_init_trace = arg; }
+  void init_trace (bool arg) { m_init_trace = arg; }
   void code_to_eval (const std::string& arg) { m_code_to_eval = arg; }
   void command_line_path (const std::list<std::string>& arg)
   { m_command_line_path = arg; }
@@ -182,9 +187,10 @@
   // (--traditional)
   bool m_traditional = false;
 
-  // If TRUE, print verbose info in some cases.
-  // (--verbose; -V)
-  bool m_verbose_flag = false;
+  // If TRUE, print trace of files read during initialization
+  // (--init-trace, --verbose; -V)
+  // FIXME: --verbose and -V will eventually be deprecated and removed.
+  bool m_init_trace = false;
 
   // The code to evaluate at startup
   // (--eval CODE)
--- a/libinterp/options.h	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/options.h	Tue Jan 02 13:42:37 2024 -0800
@@ -81,6 +81,8 @@
   { "info-file",                octave_required_arg, nullptr, INFO_FILE_OPTION },
   // Option for developers, not displayed in help
   { "info-program",             octave_required_arg, nullptr, INFO_PROG_OPTION },
+  // Option for developers, not displayed in help
+  { "init-trace",               octave_no_arg,       nullptr, 'V' },
   { "interactive",              octave_no_arg,       nullptr, 'i' },
   { "line-editing",             octave_no_arg,       nullptr, LINE_EDITING_OPTION },
   { "no-gui",                   octave_no_arg,       nullptr, 'G' },
@@ -101,6 +103,7 @@
   // Option for developers, not displayed in help
   { "texi-macros-file",         octave_required_arg, nullptr, TEXI_MACROS_FILE_OPTION },
   { "traditional",              octave_no_arg,       nullptr, TRADITIONAL_OPTION },
+  // Alias for --init-trace, not displayed in help, eventually will be deprecated
   { "verbose",                  octave_no_arg,       nullptr, 'V' },
   { "version",                  octave_no_arg,       nullptr, 'v' },
   { nullptr,                    0,                   nullptr, 0 }
--- a/libinterp/usage.h	Sun Dec 31 20:28:43 2023 -0500
+++ b/libinterp/usage.h	Tue Jan 02 13:42:37 2024 -0800
@@ -39,8 +39,7 @@
        [--line-editing] [--no-gui] [--no-history] [--no-init-file]\n\
        [--no-init-path] [--no-line-editing] [--no-site-file]\n\
        [--no-window-system] [--norc] [--path path] [--persist] [--server]\n\
-       [--silent] [--traditional] [--verbose]\n\
-       [--version] [file]";
+       [--silent] [--traditional] [--version] [file]";
 
 // Usage message with extra help.
 
@@ -80,7 +79,6 @@
   --server                Enter server mode at startup.\n\
   --silent, --quiet, -q   Don't print message at startup.\n\
   --traditional           Set variables for closer MATLAB compatibility.\n\
-  --verbose, -V           Enable verbose output in some cases.\n\
   --version, -v           Print version number and exit.\n\
 \n\
   FILE                    Execute commands from FILE.  Exit when done\n\