Remove superfluous semicolons from testsuite throughout.
[deliverable/binutils-gdb.git] / gdb / utils.c
index a28c782ef9415069d8c025b71920f836dae89784..18ee9bbf98b4a88308394424cf3dbe94c01531c6 100644 (file)
@@ -713,6 +713,7 @@ internal_vproblem (struct internal_problem *problem,
   int quit_p;
   int dump_core_p;
   char *reason;
+  struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
 
   /* Don't allow infinite error/warning recursion.  */
   {
@@ -821,6 +822,7 @@ internal_vproblem (struct internal_problem *problem,
     }
 
   dejavu = 0;
+  do_cleanups (cleanup);
 }
 
 static struct internal_problem internal_error_problem = {
@@ -966,11 +968,11 @@ add_internal_problem_command (struct internal_problem *problem)
 }
 
 /* Print the system error message for errno, and also mention STRING
-   as the file name for which the error was encountered.
-   Then return to command level.  */
+   as the file name for which the error was encountered.  Use ERRCODE
+   for the thrown exception.  Then return to command level.  */
 
 void
-perror_with_name (const char *string)
+throw_perror_with_name (enum errors errcode, const char *string)
 {
   char *err;
   char *combined;
@@ -987,7 +989,15 @@ perror_with_name (const char *string)
   bfd_set_error (bfd_error_no_error);
   errno = 0;
 
-  error (_("%s."), combined);
+  throw_error (errcode, _("%s."), combined);
+}
+
+/* See throw_perror_with_name, ERRCODE defaults here to GENERIC_ERROR.  */
+
+void
+perror_with_name (const char *string)
+{
+  throw_perror_with_name (GENERIC_ERROR, string);
 }
 
 /* Print the system error message for ERRCODE, and also mention STRING
@@ -1116,6 +1126,29 @@ get_regcomp_error (int code, regex_t *rx)
   return result;
 }
 
+/* Compile a regexp and throw an exception on error.  This returns a
+   cleanup to free the resulting pattern on success.  RX must not be
+   NULL.  */
+
+struct cleanup *
+compile_rx_or_error (regex_t *pattern, const char *rx, const char *message)
+{
+  int code;
+
+  gdb_assert (rx != NULL);
+
+  code = regcomp (pattern, rx, REG_NOSUB);
+  if (code != 0)
+    {
+      char *err = get_regcomp_error (code, pattern);
+
+      make_cleanup (xfree, err);
+      error (("%s: %s"), message, err);
+    }
+
+  return make_regfree_cleanup (pattern);
+}
+
 \f
 
 /* This function supports the query, nquery, and yquery functions.
@@ -2643,7 +2676,7 @@ initialize_utils (void)
 Set number of characters where GDB should wrap lines of its output."), _("\
 Show number of characters where GDB should wrap lines of its output."), _("\
 This affects where GDB wraps its output to fit the screen width.\n\
-Setting this to zero prevents GDB from wrapping its output."),
+Setting this to \"unlimited\" or zero prevents GDB from wrapping its output."),
                            set_width_command,
                            show_chars_per_line,
                            &setlist, &showlist);
@@ -2653,7 +2686,7 @@ Set number of lines in a page for GDB output pagination."), _("\
 Show number of lines in a page for GDB output pagination."), _("\
 This affects the number of lines after which GDB will pause\n\
 its output and ask you whether to continue.\n\
-Setting this to zero causes GDB never pause during output."),
+Setting this to \"unlimited\" or zero causes GDB never pause during output."),
                            set_height_command,
                            show_lines_per_page,
                            &setlist, &showlist);
@@ -2666,7 +2699,7 @@ Set state of GDB output pagination."), _("\
 Show state of GDB output pagination."), _("\
 When pagination is ON, GDB pauses at end of each screenful of\n\
 its output and asks you whether to continue.\n\
-Turning pagination off is an alternative to \"set height 0\"."),
+Turning pagination off is an alternative to \"set height unlimited\"."),
                           NULL,
                           show_pagination_enabled,
                           &setlist, &showlist);
This page took 0.027882 seconds and 4 git commands to generate.