OSDN Git Service

2003-05-23 Andrew Cagney <cagney@redhat.com>
authorAndrew Cagney <cagney@redhat.com>
Fri, 23 May 2003 16:02:30 +0000 (16:02 +0000)
committerAndrew Cagney <cagney@redhat.com>
Fri, 23 May 2003 16:02:30 +0000 (16:02 +0000)
* objc-lang.c: Include "gdb_assert.h".
(objc_op_print_tab): Use OP_NULL and PREC_NULL instead of 0.
(CHECK, CHECK_FATAL, __CHECK_FUNCTION): Delete macros.
(gdb_check, gdb_check_fatal): Delete functions.
(read_objc_methlist_method): Replace CHECK and CHECK_FATAL with
gdb_assert.
(parse_selector, parse_method, find_methods, find_imps): Ditto.
* Makefile.in (objc-lang.o): Update dependencies.

gdb/ChangeLog
gdb/Makefile.in
gdb/objc-lang.c

index d81f24f..9d3656b 100644 (file)
@@ -1,3 +1,14 @@
+2003-05-23  Andrew Cagney  <cagney@redhat.com>
+
+       * objc-lang.c: Include "gdb_assert.h".
+       (objc_op_print_tab): Use OP_NULL and PREC_NULL instead of 0.
+       (CHECK, CHECK_FATAL, __CHECK_FUNCTION): Delete macros.
+       (gdb_check, gdb_check_fatal): Delete functions.
+       (read_objc_methlist_method): Replace CHECK and CHECK_FATAL with
+       gdb_assert.
+       (parse_selector, parse_method, find_methods, find_imps): Ditto.
+       * Makefile.in (objc-lang.o): Update dependencies.
+
 2003-05-22  Ian Lance Taylor  <ian@airs.com>
 
        * disasm.c (gdb_disassemble_info): Initialize disassemble_info
index 38be4f6..c4f1d38 100644 (file)
@@ -2007,7 +2007,7 @@ objc-lang.o: objc-lang.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(expression_h) \
        $(parser_defs_h) $(language_h) $(c_lang_h) $(objc_lang_h) \
        $(complaints_h) $(value_h) $(symfile_h) $(objfiles_h) $(gdb_string_h) \
        $(target_h) $(gdbcore_h) $(gdbcmd_h) $(frame_h) $(gdb_regex_h) \
-       $(regcache_h) $(block_h) $(infcall_h) $(valprint_h)
+       $(regcache_h) $(block_h) $(infcall_h) $(valprint_h) $(gdb_assert_h)
 objfiles.o: objfiles.c $(defs_h) $(bfd_h) $(symtab_h) $(symfile_h) \
        $(objfiles_h) $(gdb_stabs_h) $(target_h) $(bcache_h) $(gdb_stat_h) \
        $(gdb_obstack_h) $(gdb_string_h) $(breakpoint_h) $(mmalloc_h) \
index 0b98a96..c357747 100644 (file)
@@ -44,6 +44,7 @@
 #include "block.h"
 #include "infcall.h"
 #include "valprint.h"
+#include "gdb_assert.h"
 
 #include <ctype.h>
 
@@ -75,38 +76,6 @@ struct objc_method {
   CORE_ADDR imp;
 };
 
-/* Complaints about ObjC classes, selectors, etc.  */
-
-#if (!defined __GNUC__ || __GNUC__ < 2 || __GNUC_MINOR__ < (defined __cplusplus ? 6 : 4))
-#define __CHECK_FUNCTION ((__const char *) 0)
-#else
-#define __CHECK_FUNCTION __PRETTY_FUNCTION__
-#endif
-
-#define CHECK(expression) \
-  ((void) ((expression) ? 0 : gdb_check (#expression, __FILE__, __LINE__, \
-                                         __CHECK_FUNCTION)))
-
-#define CHECK_FATAL(expression) \
-  ((void) ((expression) ? 0 : gdb_check_fatal (#expression, __FILE__, \
-                              __LINE__, __CHECK_FUNCTION)))
-
-static void 
-gdb_check (const char *str, const char *file, 
-          unsigned int line, const char *func)
-{
-  error ("assertion failure on line %u of \"%s\" in function \"%s\": %s\n",
-        line, file, func, str);
-}
-
-static void 
-gdb_check_fatal (const char *str, const char *file, 
-                unsigned int line, const char *func)
-{
-  internal_error (file, line, 
-                 "assertion failure in function \"%s\": %s\n", func, str);
-}
-
 /* Lookup a structure type named "struct NAME", visible in lexical
    block BLOCK.  If NOERR is nonzero, return zero if NAME is not
    suitably defined.  */
@@ -658,7 +627,7 @@ static const struct op_print objc_op_print_tab[] =
     {"sizeof ", UNOP_SIZEOF, PREC_PREFIX, 0},
     {"++", UNOP_PREINCREMENT, PREC_PREFIX, 0},
     {"--", UNOP_PREDECREMENT, PREC_PREFIX, 0},
-    {NULL, 0, 0, 0}
+    {NULL, OP_NULL, PREC_NULL, 0}
 };
 
 struct type ** const (objc_builtin_types[]) = 
@@ -1153,7 +1122,7 @@ parse_selector (char *method, char **selector)
 
   char *nselector = NULL;
 
-  CHECK (selector != NULL);
+  gdb_assert (selector != NULL);
 
   s1 = method;
 
@@ -1212,10 +1181,10 @@ parse_method (char *method, char *type, char **class,
   char *ncategory = NULL;
   char *nselector = NULL;
 
-  CHECK (type != NULL);
-  CHECK (class != NULL);
-  CHECK (category != NULL);
-  CHECK (selector != NULL);
+  gdb_assert (type != NULL);
+  gdb_assert (class != NULL);
+  gdb_assert (category != NULL);
+  gdb_assert (selector != NULL);
   
   s1 = method;
 
@@ -1325,8 +1294,8 @@ find_methods (struct symtab *symtab, char type,
   static char *tmp = NULL;
   static unsigned int tmplen = 0;
 
-  CHECK (nsym != NULL);
-  CHECK (ndebug != NULL);
+  gdb_assert (nsym != NULL);
+  gdb_assert (ndebug != NULL);
 
   if (symtab)
     block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
@@ -1438,8 +1407,8 @@ char *find_imps (struct symtab *symtab, struct block *block,
   char *buf = NULL;
   char *tmp = NULL;
 
-  CHECK (nsym != NULL);
-  CHECK (ndebug != NULL);
+  gdb_assert (nsym != NULL);
+  gdb_assert (ndebug != NULL);
 
   if (nsym != NULL)
     *nsym = 0;
@@ -1826,7 +1795,7 @@ static void
 read_objc_methlist_method (CORE_ADDR addr, unsigned long num, 
                           struct objc_method *method)
 {
-  CHECK_FATAL (num < read_objc_methlist_nmethods (addr));
+  gdb_assert (num < read_objc_methlist_nmethods (addr));
   read_objc_method (addr + 8 + (12 * num), method);
 }