[c++,04/12] Add scm_t_dynwind_flags casts

Message ID 1445831204-16588-4-git-send-email-simon.marchi@polymtl.ca
State New, archived
Headers

Commit Message

Simon Marchi Oct. 26, 2015, 3:46 a.m. UTC
  There is a handful of calls to

  scm_dynwind_begin (0);

where the parameter is an enum, scm_t_dynwind_flags.  In C++, we have no
choice but to add an explicit cast, since there is no enum value that
represents 0 (no flags set).

gdb/ChangeLog:

	* guile/scm-breakpoint.c (gdbscm_set_breakpoint_stop_x): Add
	scm_t_dynwind_flags casts.
	* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
	* guile/scm-ports.c (gdbscm_open_memory): Likewise.
	* guile/scm-value.c (gdbscm_value_to_string): Likewise.
---
 gdb/guile/scm-breakpoint.c | 2 +-
 gdb/guile/scm-cmd.c        | 4 ++--
 gdb/guile/scm-ports.c      | 2 +-
 gdb/guile/scm-value.c      | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
  

Comments

Pedro Alves Oct. 27, 2015, 12:15 p.m. UTC | #1
On 10/26/2015 03:46 AM, Simon Marchi wrote:
> There is a handful of calls to
> 
>   scm_dynwind_begin (0);
> 
> where the parameter is an enum, scm_t_dynwind_flags.  In C++, we have no
> choice but to add an explicit cast, since there is no enum value that
> represents 0 (no flags set).

I agree; I don't think there's anything else that we could do here.

So, OK.

Thanks,
Pedro Alves
  
Simon Marchi Oct. 27, 2015, 1:36 p.m. UTC | #2
On 27/10/15 08:15 AM, Pedro Alves wrote:
> I agree; I don't think there's anything else that we could do here.
> 
> So, OK.
> 
> Thanks,
> Pedro Alves

Pushed, thanks.
  

Patch

diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 83574a3..b599e23 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -956,7 +956,7 @@  gdbscm_set_breakpoint_stop_x (SCM self, SCM newvalue)
 			" this breakpoint."),
 		      ext_lang_capitalized_name (extlang));
 
-      scm_dynwind_begin (0);
+      scm_dynwind_begin ((scm_t_dynwind_flags) 0);
       gdbscm_dynwind_xfree (error_text);
       gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, self, error_text);
       /* The following line, while unnecessary, is present for completeness
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 900d7b0..051f0d2 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -530,7 +530,7 @@  gdbscm_parse_command_name (const char *name,
       msg = xstrprintf (_("could not find command prefix '%s'"), prefix_text);
       xfree (prefix_text);
       xfree (result);
-      scm_dynwind_begin (0);
+      scm_dynwind_begin ((scm_t_dynwind_flags) 0);
       gdbscm_dynwind_xfree (msg);
       gdbscm_out_of_range_error (func_name, arg_pos,
 				 gdbscm_scm_from_c_string (name), msg);
@@ -546,7 +546,7 @@  gdbscm_parse_command_name (const char *name,
   msg = xstrprintf (_("'%s' is not a prefix command"), prefix_text);
   xfree (prefix_text);
   xfree (result);
-  scm_dynwind_begin (0);
+  scm_dynwind_begin ((scm_t_dynwind_flags) 0);
   gdbscm_dynwind_xfree (msg);
   gdbscm_out_of_range_error (func_name, arg_pos,
 			     gdbscm_scm_from_c_string (name), msg);
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index 90bdb39..925f3b2 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -1136,7 +1136,7 @@  gdbscm_open_memory (SCM rest)
 			      &start_arg_pos, &start,
 			      &size_arg_pos, &size);
 
-  scm_dynwind_begin (0);
+  scm_dynwind_begin ((scm_t_dynwind_flags) 0);
 
   if (mode == NULL)
     mode = xstrdup ("r");
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index f25f7d5..851d8a7 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -1158,7 +1158,7 @@  gdbscm_value_to_string (SCM self, SCM rest)
      Make sure we don't leak.  This is done via scm_dynwind_begin, et.al.  */
   discard_cleanups (cleanups);
 
-  scm_dynwind_begin (0);
+  scm_dynwind_begin ((scm_t_dynwind_flags) 0);
 
   gdbscm_dynwind_xfree (encoding);
   gdbscm_dynwind_xfree (buffer);