* utils.c (error_begin): Make static.
authorAndrew Cagney <cagney@redhat.com>
Sat, 2 Feb 2002 03:42:59 +0000 (03:42 +0000)
committerAndrew Cagney <cagney@redhat.com>
Sat, 2 Feb 2002 03:42:59 +0000 (03:42 +0000)
* defs.h (error_begin): Delete declaration.

* linespec.c (cplusplus_error): Replace cplusplus_hint.
(decode_line_1): Use cplusplus_error instead of error_begin,
cplusplus_hint and return_to_top_level.
* coffread.c (coff_symfile_read): Use error instead of error_begin
and return_to_top_level.
* infrun.c (default_skip_permanent_breakpoint): Ditto.

gdb/ChangeLog
gdb/coffread.c
gdb/defs.h
gdb/infrun.c
gdb/linespec.c
gdb/utils.c

index 233e3b06c42092c0d9d45e59b9ec917c04c3c810..27aff5fe217856f37f2c00de55e480f2b08229cf 100644 (file)
@@ -1,3 +1,15 @@
+2002-02-01  Andrew Cagney  <ac131313@redhat.com>
+
+       * utils.c (error_begin): Make static.
+       * defs.h (error_begin): Delete declaration.
+
+       * linespec.c (cplusplus_error): Replace cplusplus_hint.
+       (decode_line_1): Use cplusplus_error instead of error_begin,
+       cplusplus_hint and return_to_top_level.
+       * coffread.c (coff_symfile_read): Use error instead of error_begin
+       and return_to_top_level.
+       * infrun.c (default_skip_permanent_breakpoint): Ditto.
+
 2002-02-01  Andrew Cagney  <ac131313@redhat.com>
 
        * language.h (type_error, range_error): Make string parameter
index b765af9c7816285573f22034466d76f54069dbc9..69d06bae5909050a23f10bf08298e4c532e6f550 100644 (file)
@@ -668,13 +668,10 @@ coff_symfile_read (struct objfile *objfile, int mainline)
     {
       if (!info->stabstrsect)
        {
-         error_begin ();
-         fprintf_filtered
-           (gdb_stderr,
-            ("The debugging information in `%s' is corrupted.\n"
-          "The file has a `.stabs' section, but no `.stabstr' section.\n"),
-            name);
-         return_to_top_level (RETURN_ERROR);
+         error (("The debugging information in `%s' is corrupted.\n"
+                 "The file has a `.stabs' section, but no `.stabstr' "
+                 "section."),
+                name);
        }
 
       /* FIXME: dubious.  Why can't we use something normal like
index 274cacc495af3cd0641511924c552ab4942a9d73..66e5ff0b082a853b0ff68a36625db1cc118497e7 100644 (file)
@@ -1068,9 +1068,6 @@ extern NORETURN void verror (const char *fmt, va_list ap) ATTR_NORETURN;
 
 extern NORETURN void error (const char *fmt, ...) ATTR_NORETURN;
 
-/* DEPRECATED: Use error(), verror() or error_stream(). */
-extern NORETURN void error_begin (void);
-
 extern NORETURN void error_stream (struct ui_file *) ATTR_NORETURN;
 
 /* Returns a freshly allocate buffer containing the last error
index 8a5b3022280da9c2afe345908d650f44b4a1c1e2..1b0eb7e3e066cbbd006a544d708cccd3c135882f 100644 (file)
@@ -232,12 +232,10 @@ static int may_follow_exec = MAY_FOLLOW_EXEC;
 static void
 default_skip_permanent_breakpoint (void)
 {
-  error_begin ();
-  fprintf_filtered (gdb_stderr, "\
+  error ("\
 The program is stopped at a permanent breakpoint, but GDB does not know\n\
 how to step past a permanent breakpoint on this architecture.  Try using\n\
-a command like `return' or `jump' to continue execution.\n");
-  return_to_top_level (RETURN_ERROR);
+a command like `return' or `jump' to continue execution.");
 }
 #endif
    
index 98b13a4ba2aa380d0d98e563a50aadfbf754d785..ef3a28c39623b4e62ca9511773990ed354d8c5be 100644 (file)
@@ -42,7 +42,7 @@ extern char *operator_chars (char *, char **);
 
 /* Prototypes for local functions */
 
-static void cplusplus_hint (char *name);
+static void cplusplus_error (const char *name, const char *fmt, ...) ATTR_FORMAT (printf, 2, 3);
 
 static int total_number_of_methods (struct type *type);
 
@@ -58,17 +58,31 @@ static struct symtabs_and_lines decode_line_2 (struct symbol *[],
 
 /* Helper functions. */
 
-/* While the C++ support is still in flux, issue a possibly helpful hint on
-   using the new command completion feature on single quoted demangled C++
-   symbols.  Remove when loose ends are cleaned up.   FIXME -fnf */
+/* Issue a helpful hint on using the command completion feature on
+   single quoted demangled C++ symbols as part of the completion
+   error.  */
 
 static void
-cplusplus_hint (char *name)
+cplusplus_error (const char *name, const char *fmt, ...)
 {
+  struct ui_file *tmp_stream;
+  tmp_stream = mem_fileopen ();
+  make_cleanup_ui_file_delete (tmp_stream);
+
+  {
+    va_list args;
+    va_start (args, fmt);
+    vfprintf_unfiltered (tmp_stream, fmt, args);
+    va_end (args);
+  }
+
   while (*name == '\'')
     name++;
-  printf_filtered ("Hint: try '%s<TAB> or '%s<ESC-?>\n", name, name);
-  printf_filtered ("(Note leading single quote.)\n");
+  fprintf_unfiltered (tmp_stream,
+                     ("Hint: try '%s<TAB> or '%s<ESC-?>\n"
+                      "(Note leading single quote.)"),
+                     name, name);
+  error_stream (tmp_stream);
 }
 
 /* Return the number of methods described for TYPE, including the
@@ -722,10 +736,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
    opname = cplus_mangle_opname (tmp, DMGL_ANSI);
    if (opname == NULL)
    {
-   error_begin ();
-   printf_filtered ("no mangling for \"%s\"\n", tmp);
-   cplusplus_hint (saved_arg);
-   return_to_top_level (RETURN_ERROR);
+   cplusplus_error (saved_arg, "no mangling for \"%s\"\n", tmp);
    }
    copy = (char*) alloca (3 + strlen(opname));
    sprintf (copy, "__%s", opname);
@@ -810,17 +821,14 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
                        }
                      else
                        tmp = copy;
-                     error_begin ();
                      if (tmp[0] == '~')
-                       printf_filtered
-                         ("the class `%s' does not have destructor defined\n",
-                          SYMBOL_SOURCE_NAME (sym_class));
+                       cplusplus_error (saved_arg,
+                                        "the class `%s' does not have destructor defined\n",
+                                        SYMBOL_SOURCE_NAME (sym_class));
                      else
-                       printf_filtered
-                         ("the class %s does not have any method named %s\n",
-                          SYMBOL_SOURCE_NAME (sym_class), tmp);
-                     cplusplus_hint (saved_arg);
-                     return_to_top_level (RETURN_ERROR);
+                       cplusplus_error (saved_arg,
+                                        "the class %s does not have any method named %s\n",
+                                        SYMBOL_SOURCE_NAME (sym_class), tmp);
                    }
                }
 
@@ -873,12 +881,10 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
            goto symbol_found;
 
          /* Couldn't find any interpretation as classes/namespaces, so give up */
-         error_begin ();
          /* The quotes are important if copy is empty.  */
-         printf_filtered
-           ("Can't find member of namespace, class, struct, or union named \"%s\"\n", copy);
-         cplusplus_hint (saved_arg);
-         return_to_top_level (RETURN_ERROR);
+         cplusplus_error (saved_arg,
+                          "Can't find member of namespace, class, struct, or union named \"%s\"\n",
+                          copy);
        }
       /*  end of C++  */
 
index 2459dead92607e8b265ce09979eac2828104c046..c3e5a5058899ebebbc16428036974d434866a32d 100644 (file)
@@ -600,7 +600,7 @@ warning (const char *string,...)
    error() provides a convenient way to do this for the special case
    that the error message can be formatted with a single printf call,
    but this is more general.  */
-void
+static void
 error_begin (void)
 {
   if (error_begin_hook)
This page took 0.032679 seconds and 4 git commands to generate.