This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Fix objc-lang.c on IRIX CC problems
- From: Andrew Cagney <ac131313 at redhat dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 23 May 2003 12:08:43 -0400
- Subject: [commit] Fix objc-lang.c on IRIX CC problems
Hello,
This gets rid of some of the most pressing problems (warnings and
errors) when trying to compile objc-lang.c using IRIX's CC. The big one
was the __CHECK_FUNCTION macro which I deleted.
Just note that I changed both CHECK and CHECK_FATAL to internal_error as
encountering something like a NULL pointer is always an internal error.
Adam,
You might want to audit the gdb_assert()s to see if any can be changed
to errors that report problems with the target data structures and not
gdb internal NULLs.
committed.
Andrew
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.
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.381
diff -u -r1.381 Makefile.in
--- Makefile.in 20 May 2003 23:44:22 -0000 1.381
+++ Makefile.in 23 May 2003 16:00:31 -0000
@@ -2007,7 +2007,7 @@
$(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: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.23
diff -u -r1.23 objc-lang.c
--- objc-lang.c 20 May 2003 01:55:17 -0000 1.23
+++ objc-lang.c 23 May 2003 16:00:32 -0000
@@ -44,6 +44,7 @@
#include "block.h"
#include "infcall.h"
#include "valprint.h"
+#include "gdb_assert.h"
#include <ctype.h>
@@ -75,38 +76,6 @@
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 @@
{"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 @@
char *nselector = NULL;
- CHECK (selector != NULL);
+ gdb_assert (selector != NULL);
s1 = method;
@@ -1212,10 +1181,10 @@
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 @@
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 *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 @@
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);
}