[RFA 04/13] Call some functions in guile/ for effect

Tom Tromey
2018-07-12T20:52:32Z

This changes a few spots in guile/ to remove a variable declaration
but to still call a function for effect.

gdb/ChangeLog
2018-07-12 Tom Tromey <tom@tromey.com>

* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer): Call
value_contents_for_printing for effect.
* guile/scm-cmd.c (gdbscm_dont_repeat): Call
cmdscm_get_valid_command_smob_arg_unsafe for effect.
* guile/scm-block.c (gdbscm_make_block_syms_iter): Call
bkscm_get_valid_block_smob_arg_unsafe for effect.
---
gdb/ChangeLog | 9 +++++++++
gdb/guile/scm-block.c | 5 ++---
gdb/guile/scm-cmd.c | 6 +++---
gdb/guile/scm-pretty-print.c | 4 +++-
4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index d4566fc1ffe..9caff799dc1 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -613,9 +613,8 @@ bkscm_block_syms_progress_p (SCM scm)
static SCM
gdbscm_make_block_syms_iter (SCM self)
{
- block_smob *b_smob
- = bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- const struct block *block = b_smob->block;
+ /* Call for side effects. */
+ bkscm_get_valid_block_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
SCM progress, iter;

progress = bkscm_make_block_syms_progress_smob ();
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 64243d1ba2e..9e5ff8f2636 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -267,9 +267,9 @@ gdbscm_command_valid_p (SCM self)
static SCM
gdbscm_dont_repeat (SCM self)
{
- /* We currently don't need anything from SELF, but still verify it. */
- command_smob *c_smob
- = cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
+ /* We currently don't need anything from SELF, but still verify it.
+ Call for side effects. */
+ cmdscm_get_valid_command_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);

dont_repeat ();

diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index da1b7d2be15..8c96e7e3f8b 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -970,7 +970,9 @@ gdbscm_apply_val_pretty_printer (const struct extension_language_defn *extlang,
struct cleanup *cleanups;
enum ext_lang_rc result = EXT_LANG_RC_NOP;
enum string_repr_result print_result;
- const gdb_byte *valaddr = value_contents_for_printing (val);
+
+ /* Call for side effects. */
+ value_contents_for_printing (val);

/* No pretty-printer support for unavailable values. */
if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
--
2.13.6