[C++] Drop -fpermissive hack
[deliverable/binutils-gdb.git] / gdb / serial.c
index b7e620d0f411c2bdff2c43e9dd25c2aaae225867..abc050ec49d0bc525ba98619372c43dda86cab6b 100644 (file)
@@ -404,7 +404,7 @@ serial_write (struct serial *scb, const void *buf, size_t count)
 {
   if (serial_logfp != NULL)
     {
-      const char *str = buf;
+      const char *str = (const char *) buf;
       size_t c;
 
       for (c = 0; c < count; c++)
@@ -416,7 +416,7 @@ serial_write (struct serial *scb, const void *buf, size_t count)
     }
   if (serial_debug_p (scb))
     {
-      const char *str = buf;
+      const char *str = (const char *) buf;
       size_t c;
 
       for (c = 0; c < count; c++)
@@ -524,6 +524,14 @@ serial_setstopbits (struct serial *scb, int num)
   return scb->ops->setstopbits (scb, num);
 }
 
+/* See serial.h.  */
+
+int
+serial_setparity (struct serial *scb, int parity)
+{
+  return scb->ops->setparity (scb, parity);
+}
+
 int
 serial_can_async_p (struct serial *scb)
 {
@@ -638,6 +646,30 @@ serial_baud_show_cmd (struct ui_file *file, int from_tty,
                    value);
 }
 
+/* Parity for serial port.  */
+
+int serial_parity = GDBPARITY_NONE;
+
+static const char parity_none[] = "none";
+static const char parity_odd[] = "odd";
+static const char parity_even[] = "even";
+static const char *const parity_enums[] =
+  {parity_none, parity_odd, parity_even,  NULL};
+static const char *parity = parity_none;
+
+/* Set serial_parity value.  */
+
+static void
+set_parity (char *ignore_args, int from_tty, struct cmd_list_element *c)
+{
+  if (parity == parity_odd)
+    serial_parity = GDBPARITY_ODD;
+  else if (parity == parity_even)
+    serial_parity = GDBPARITY_EVEN;
+  else
+    serial_parity = GDBPARITY_NONE;
+}
+
 void
 _initialize_serial (void)
 {
@@ -670,6 +702,14 @@ using remote targets."),
                            serial_baud_show_cmd,
                            &serial_set_cmdlist, &serial_show_cmdlist);
 
+  add_setshow_enum_cmd ("parity", no_class, parity_enums,
+                        &parity, _("\
+Set parity for remote serial I/O"), _("\
+Show parity for remote serial I/O"), NULL,
+                        set_parity,
+                        NULL, /* FIXME: i18n: */
+                        &serial_set_cmdlist, &serial_show_cmdlist);
+
   add_setshow_filename_cmd ("remotelogfile", no_class, &serial_logfile, _("\
 Set filename for remote session recording."), _("\
 Show filename for remote session recording."), _("\
This page took 0.024286 seconds and 4 git commands to generate.