]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use bool constants for value_print_options
authorTom Tromey <tom@tromey.com>
Sun, 12 Jun 2022 20:13:22 +0000 (14:13 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 19 Dec 2022 15:18:59 +0000 (08:18 -0700)
This changes the uses of value_print_options to use 'true' and 'false'
rather than integers.

19 files changed:
gdb/ada-valprint.c
gdb/c-valprint.c
gdb/cp-valprint.c
gdb/dwarf2/read.c
gdb/guile/scm-pretty-print.c
gdb/guile/scm-value.c
gdb/infcmd.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-main.c
gdb/p-valprint.c
gdb/printcmd.c
gdb/python/py-framefilter.c
gdb/python/py-prettyprint.c
gdb/python/py-value.c
gdb/riscv-tdep.c
gdb/rust-lang.c
gdb/stack.c
gdb/valprint.c
gdb/varobj.c

index 40c26145224adefe55aed7bb7b591914e1dc2da4..92e96da4bec9fbfe19ca37fedc66e84f39e08de4 100644 (file)
@@ -209,7 +209,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
        {
          struct value_print_options opts = *options;
 
-         opts.deref_ref = 0;
+         opts.deref_ref = false;
          common_val_print (v0, stream, recurse + 1, &opts, current_language);
          annotate_elt_rep (i - i0);
          gdb_printf (stream, _(" %p[<repeats %u times>%p]"),
@@ -222,7 +222,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
          int j;
          struct value_print_options opts = *options;
 
-         opts.deref_ref = 0;
+         opts.deref_ref = false;
          for (j = i0; j < i; j += 1)
            {
              if (j > i0)
@@ -658,7 +658,7 @@ print_field_values (struct value *value, struct value *outer_value,
                     bit_pos % HOST_CHAR_BIT,
                     bit_size, type->field (i).type ());
              opts = *options;
-             opts.deref_ref = 0;
+             opts.deref_ref = false;
              common_val_print (v, stream, recurse + 1, &opts, language);
            }
        }
@@ -666,7 +666,7 @@ print_field_values (struct value *value, struct value *outer_value,
        {
          struct value_print_options opts = *options;
 
-         opts.deref_ref = 0;
+         opts.deref_ref = false;
 
          struct value *v = value_field (value, i);
          common_val_print (v, stream, recurse + 1, &opts, language);
@@ -1127,6 +1127,6 @@ ada_value_print (struct value *val0, struct ui_file *stream,
     }
 
   opts = *options;
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
   common_val_print (val, stream, 0, &opts, current_language);
 }
index 9b73d973cd5aa5ffd1c4e35a288de873ac99a90e..994168fc01d050a5e453c5ebc02b6acbd34c3024 100644 (file)
@@ -476,7 +476,7 @@ c_value_print (struct value *val, struct ui_file *stream,
   LONGEST top;
   struct value_print_options opts = *options;
 
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
 
   /* If it is a pointer, indicate what it points to.
 
index fac558deb05412118ee91b837a99759584960a5a..1c8c4995d968784a508fff270fd08b23f9a87c85 100644 (file)
@@ -279,7 +279,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
                }
              else
                {
-                 opts->deref_ref = 0;
+                 opts->deref_ref = false;
 
                  v = value_field_bitfield (type, i, valaddr,
                                            value_embedded_offset (val), val);
@@ -331,7 +331,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
              else
                {
                  struct value *v = value_primitive_field (val, 0, i, type);
-                 opts->deref_ref = 0;
+                 opts->deref_ref = false;
                  common_val_print (v, stream, recurse + 1, opts,
                                    current_language);
                }
@@ -613,7 +613,7 @@ cp_print_static_field (struct type *type,
     }
 
   opts = *options;
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
   common_val_print (val, stream, recurse, &opts, current_language);
 }
 
index 032e20af93ab67008f9a704b65161bcaf7bae136..ddea38cf596aa92cf48fd4894b707182c239f495 100644 (file)
@@ -9045,7 +9045,7 @@ dwarf2_compute_name (const char *name,
                      /* Specify decimal so that we do not depend on
                         the radix.  */
                      get_formatted_print_options (&opts, 'd');
-                     opts.raw = 1;
+                     opts.raw = true;
                      value_print (v, &buf, &opts);
                      release_value (v);
                    }
index 5e6bb12a3a50df4cd1f4fcc928ccc9a1b91d057b..9e42a4d6178f46d1242a337def43aacb30030434 100644 (file)
@@ -660,7 +660,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
       struct value_print_options opts = *options;
 
       gdb_assert (replacement != NULL);
-      opts.addressprint = 0;
+      opts.addressprint = false;
       common_val_print (replacement, stream, recurse, &opts, language);
       result = STRING_REPR_OK;
     }
@@ -698,7 +698,7 @@ ppscm_print_string_repr (SCM printer, enum display_hint hint,
     {
       struct value_print_options local_opts = *options;
 
-      local_opts.addressprint = 0;
+      local_opts.addressprint = false;
       lsscm_val_print_lazy_string (str_scm, stream, &local_opts);
       result = STRING_REPR_OK;
     }
@@ -883,7 +883,7 @@ ppscm_print_children (SCM printer, enum display_hint hint,
        {
          struct value_print_options local_opts = *options;
 
-         local_opts.addressprint = 0;
+         local_opts.addressprint = false;
          lsscm_val_print_lazy_string (v_scm, stream, &local_opts);
        }
       else if (scm_is_string (v_scm))
index 0107a4bd320fcdfd03e0ff522a6b5aeb9347b9e7..8ff2823ab19f4bd71e8d4d289685bd698f5f9b80 100644 (file)
@@ -148,7 +148,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
     gdbscm_printf (port, "#<%s ", value_smob_name);
 
   get_user_print_options (&opts);
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   /* pstate->writingp = zero if invoked by display/~A, and nonzero if
      invoked by write/~S.  What to do here may need to evolve.
@@ -1264,7 +1264,7 @@ gdbscm_value_print (SCM self)
   struct value_print_options opts;
 
   get_user_print_options (&opts);
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   string_file stb;
 
index a27d3577b3aa8e24b4498b783724050289516d8f..1a25e22de289a44cce7e17198fbdd7e220569214 100644 (file)
@@ -2190,7 +2190,7 @@ default_print_one_register_info (struct ui_file *file,
       enum bfd_endian byte_order = type_byte_order (regtype);
 
       get_user_print_options (&opts);
-      opts.deref_ref = 1;
+      opts.deref_ref = true;
 
       common_val_print (val, &format_stream, 0, &opts, current_language);
 
@@ -2209,7 +2209,7 @@ default_print_one_register_info (struct ui_file *file,
 
       /* Print the register in hex.  */
       get_formatted_print_options (&opts, 'x');
-      opts.deref_ref = 1;
+      opts.deref_ref = true;
       common_val_print (val, &format_stream, 0, &opts, current_language);
       /* If not a vector register, print it also according to its
         natural format.  */
@@ -2217,7 +2217,7 @@ default_print_one_register_info (struct ui_file *file,
        {
          pad_to_column (format_stream, value_column_2);
          get_user_print_options (&opts);
-         opts.deref_ref = 1;
+         opts.deref_ref = true;
          common_val_print (val, &format_stream, 0, &opts, current_language);
        }
     }
index f0af7c9a0143fbceba388423b7c3f97744effee6..b14f41d403c337bb7f0421ecd93f4d52c969e642 100644 (file)
@@ -545,7 +545,7 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what,
              struct value_print_options opts;
 
              get_no_prettyformat_print_options (&opts);
-             opts.deref_ref = 1;
+             opts.deref_ref = true;
              common_val_print (arg->val, &stb, 0, &opts,
                                language_def (arg->sym->language ()));
            }
index 1b9948c1f6db4efc1073bc55f5e3153356d8d538..e8bc904386de8c31b4abe680ff7aa51f40c6e5b7 100644 (file)
@@ -1111,7 +1111,7 @@ output_register (frame_info_ptr frame, int regnum, int format,
   string_file stb;
 
   get_formatted_print_options (&opts, format);
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
   common_val_print (val, &stb, 0, &opts, current_language);
   uiout->field_stream ("value", stb);
 }
@@ -1195,7 +1195,7 @@ mi_cmd_data_evaluate_expression (const char *command, char **argv, int argc)
 
   /* Print the result of the expression evaluation.  */
   get_user_print_options (&opts);
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
   common_val_print (val, &stb, 0, &opts, current_language);
 
   uiout->field_stream ("value", stb);
@@ -2484,7 +2484,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
          struct value_print_options opts;
 
          get_no_prettyformat_print_options (&opts);
-         opts.deref_ref = 1;
+         opts.deref_ref = true;
          common_val_print (val, &stb, 0, &opts, current_language);
          uiout->field_stream ("value", stb);
        }
@@ -2494,7 +2494,7 @@ print_variable_or_computed (const char *expression, enum print_values values)
        struct value_print_options opts;
 
        get_no_prettyformat_print_options (&opts);
-       opts.deref_ref = 1;
+       opts.deref_ref = true;
        common_val_print (val, &stb, 0, &opts, current_language);
        uiout->field_stream ("value", stb);
       }
index 2786a8e8c8629a8167a2f3adcff6921937d03f3f..b74c424350ff7ad072f4b2ec191b6047f2f68a4a 100644 (file)
@@ -408,7 +408,7 @@ pascal_language::value_print (struct value *val, struct ui_file *stream,
   struct type *type = value_type (val);
   struct value_print_options opts = *options;
 
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
 
   /* If it is a pointer, indicate what it points to.
 
@@ -619,7 +619,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
 
                  v = value_field_bitfield (type, i, valaddr, 0, val);
 
-                 opts.deref_ref = 0;
+                 opts.deref_ref = false;
                  common_val_print (v, stream, recurse + 1, &opts,
                                    current_language);
                }
@@ -649,7 +649,7 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
                {
                  struct value_print_options opts = *options;
 
-                 opts.deref_ref = 0;
+                 opts.deref_ref = false;
 
                  struct value *v = value_primitive_field (val, 0, i,
                                                           value_type (val));
@@ -853,7 +853,7 @@ pascal_object_print_static_field (struct value *val,
     }
 
   opts = *options;
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
   common_val_print (val, stream, recurse, &opts, current_language);
 }
 
index 273aa5931a9d0a80a3e867fd946342277fbc3589..60921415abd56ef4275bc813052f3a9347451795 100644 (file)
@@ -2400,7 +2400,7 @@ print_variable_and_value (const char *name, struct symbol *var,
         a block to it.  */
       val = read_var_value (var, NULL, frame);
       get_user_print_options (&opts);
-      opts.deref_ref = 1;
+      opts.deref_ref = true;
       common_val_print_checked (val, stream, indent, &opts, current_language);
 
       /* common_val_print invalidates FRAME when a pretty printer calls inferior
index 0d7dc48c5a0ed8f6dbe676e269858d0ca152babd..30968d1f550844cc33ca2097b9ad95a138edb67d 100644 (file)
@@ -428,10 +428,10 @@ enumerate_args (PyObject *iter,
   if (args_type == CLI_SCALAR_VALUES)
     {
       /* True in "summary" mode, false otherwise.  */
-      opts.summary = 1;
+      opts.summary = true;
     }
 
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
 
   annotate_frame_args ();
 
@@ -555,7 +555,7 @@ enumerate_locals (PyObject *iter,
   struct value_print_options opts;
 
   get_user_print_options (&opts);
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
 
   while (true)
     {
index 9276807341e301ad9d3fabccf41a98b7f97c3f47..eb3a3fdd4f654f48bb3db2724fba19b08b8a62ac 100644 (file)
@@ -303,7 +303,7 @@ print_string_repr (PyObject *printer, const char *hint,
          gdbpy_extract_lazy_string (py_str.get (), &addr, &type,
                                     &length, &encoding);
 
-         local_opts.addressprint = 0;
+         local_opts.addressprint = false;
          val_print_string (type, encoding.get (), addr, (int) length,
                            stream, &local_opts);
        }
@@ -338,7 +338,7 @@ print_string_repr (PyObject *printer, const char *hint,
     {
       struct value_print_options opts = *options;
 
-      opts.addressprint = 0;
+      opts.addressprint = false;
       common_val_print (replacement, stream, recurse, &opts, language);
     }
   else
@@ -506,7 +506,7 @@ print_children (PyObject *printer, const char *hint,
 
          gdbpy_extract_lazy_string (py_v, &addr, &type, &length, &encoding);
 
-         local_opts.addressprint = 0;
+         local_opts.addressprint = false;
          val_print_string (type, encoding.get (), addr, (int) length, stream,
                            &local_opts);
        }
index 92a15304c34dc53a4bff647910d9575d1b90392c..44b4ebcf4e4d38d6b89fa925b7f1c7ffadd3a5a8 100644 (file)
@@ -675,7 +675,7 @@ valpy_format_string (PyObject *self, PyObject *args, PyObject *kw)
 
   struct value_print_options opts;
   gdbpy_get_print_options (&opts);
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   /* We need objects for booleans as the "p" flag for bools is new in
      Python 3.3.  */
@@ -1169,7 +1169,7 @@ valpy_str (PyObject *self)
   struct value_print_options opts;
 
   gdbpy_get_print_options (&opts);
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   string_file stb;
 
index a298623b44921947135f0ff6882d0d01de3d4039..3ad791353fa47016a8bc730a352b90b1d3c4bf35 100644 (file)
@@ -1146,7 +1146,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
       enum bfd_endian byte_order = type_byte_order (regtype);
 
       get_user_print_options (&opts);
-      opts.deref_ref = 1;
+      opts.deref_ref = true;
 
       common_val_print (val, file, 0, &opts, current_language);
 
@@ -1165,7 +1165,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
 
       /* Print the register in hex.  */
       get_formatted_print_options (&opts, 'x');
-      opts.deref_ref = 1;
+      opts.deref_ref = true;
       common_val_print (val, file, 0, &opts, current_language);
 
       if (print_raw_format)
@@ -1298,7 +1298,7 @@ riscv_print_one_register_info (struct gdbarch *gdbarch,
              if (regtype->is_vector () == 0)
                {
                  get_user_print_options (&opts);
-                 opts.deref_ref = 1;
+                 opts.deref_ref = true;
                  gdb_printf (file, "\t");
                  common_val_print (val, file, 0, &opts, current_language);
                }
index 8673a9086985c0d7324374b85274fd4fcf64e989..f26d4c398b7d079ff5d4ec9f1368914fc06c73a6 100644 (file)
@@ -398,7 +398,7 @@ rust_language::val_print_struct
     gdb_puts ("{", stream);
 
   opts = *options;
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   first_field = 1;
   for (i = 0; i < type->num_fields (); ++i)
@@ -452,7 +452,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
   struct value_print_options opts = *options;
   struct type *type = check_typedef (value_type (val));
 
-  opts.deref_ref = 0;
+  opts.deref_ref = false;
 
   gdb_assert (rust_enum_p (type));
   gdb::array_view<const gdb_byte> view
@@ -524,7 +524,7 @@ rust_language::value_print_inner
         const struct value_print_options *options) const
 {
   struct value_print_options opts = *options;
-  opts.deref_ref = 1;
+  opts.deref_ref = true;
 
   if (opts.prettyformat == Val_prettyformat_default)
     opts.prettyformat = (opts.prettyformat_structs
index c7d392842ae18edf5f715d7d952f55159b17bebf..e4bbcf9c928b4cbb1f8897859104a254452346bc 100644 (file)
@@ -479,7 +479,7 @@ print_frame_arg (const frame_print_options &fp_opts,
                language = current_language;
 
              get_no_prettyformat_print_options (&vp_opts);
-             vp_opts.deref_ref = 1;
+             vp_opts.deref_ref = true;
              vp_opts.raw = fp_opts.print_raw_frame_arguments;
 
              /* True in "summary" mode, false otherwise.  */
index 48d611ecf8a1eecaae3a917a225ef5bb21f677e3..1a73d27d0c22b03622a8ca1d70d890b842cfc45f 100644 (file)
@@ -100,26 +100,26 @@ static void val_print_type_code_flags (struct type *type,
 struct value_print_options user_print_options =
 {
   Val_prettyformat_default,    /* prettyformat */
-  0,                           /* prettyformat_arrays */
-  0,                           /* prettyformat_structs */
-  0,                           /* vtblprint */
-  1,                           /* unionprint */
-  1,                           /* addressprint */
+  false,                       /* prettyformat_arrays */
+  false,                       /* prettyformat_structs */
+  false,                       /* vtblprint */
+  true,                                /* unionprint */
+  true,                                /* addressprint */
   false,                       /* nibblesprint */
-  0,                           /* objectprint */
+  false,                       /* objectprint */
   PRINT_MAX_DEFAULT,           /* print_max */
   10,                          /* repeat_count_threshold */
   0,                           /* output_format */
   0,                           /* format */
-  1,                           /* memory_tag_violations */
-  0,                           /* stop_print_at_null */
-  0,                           /* print_array_indexes */
-  0,                           /* deref_ref */
-  1,                           /* static_field_print */
-  1,                           /* pascal_static_field_print */
-  0,                           /* raw */
-  0,                           /* summary */
-  1,                           /* symbol_print */
+  true,                                /* memory_tag_violations */
+  false,                       /* stop_print_at_null */
+  false,                       /* print_array_indexes */
+  false,                       /* deref_ref */
+  true,                                /* static_field_print */
+  true,                                /* pascal_static_field_print */
+  false,                       /* raw */
+  false,                       /* summary */
+  true,                                /* symbol_print */
   PRINT_MAX_DEPTH_DEFAULT,     /* max_depth */
 };
 
@@ -1272,7 +1272,7 @@ value_print_scalar_formatted (struct value *val,
     {
       struct value_print_options opts = *options;
       opts.format = 0;
-      opts.deref_ref = 0;
+      opts.deref_ref = false;
       common_val_print (val, stream, 0, &opts, current_language);
       return;
     }
index 467f9ff3a26126c7b99d2eead1b36c51e2918bb8..6ed5b7049bc421454515539e3f48f99400135aed 100644 (file)
@@ -2144,7 +2144,7 @@ varobj_formatted_print_options (struct value_print_options *opts,
                                enum varobj_display_formats format)
 {
   get_formatted_print_options (opts, format_code[(int) format]);
-  opts->deref_ref = 0;
+  opts->deref_ref = false;
   opts->raw = !pretty_printing;
 }