From: Andrew Cagney Date: Tue, 19 Mar 2002 02:51:09 +0000 (+0000) Subject: * defs.h (XMALLOC): Define. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=349c5d5f6c08699c3e433b28e2beaa24b65a63b0;p=binutils-gdb.git * defs.h (XMALLOC): Define. * gdb-events.sh (XMALLOC): Delete macro. * gdb-events.c, gdb-events.h: Regenerate. * gdbarch.sh (XMALLOC): Delete macro. * gdbarch.c: Regenerate. * serial.c (XMALLOC): Delete macro. * ui-file.c (XMALLOC): Ditto. * ser-unix.h (XMALLOC): Ditto. * sh-tdep.c (XMALLOC): Ditto. * ui-out.c (XMALLOC): Ditto. * utils.c (XMALLOC): Ditto. * i386-tdep.c (XMALLOC): Ditto. * gdb-events.c (XMALLOC): Ditto. * d10v-tdep.c (XMALLOC): Ditto. * cli-out.c (XMALLOC): Ditto. * cli-out.c, d10v-tdep.c, gdb-events.c: Update copyright. * gdb-events.sh, i386-tdep.c, ser-unix.h, serial.c: Ditto. * ui-file.c, ui-out.c: Ditto. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 90118cb4bd6..0db58f33866 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +2002-03-18 Andrew Cagney + + * defs.h (XMALLOC): Define. + * gdb-events.sh (XMALLOC): Delete macro. + * gdb-events.c, gdb-events.h: Regenerate. + * gdbarch.sh (XMALLOC): Delete macro. + * gdbarch.c: Regenerate. + * serial.c (XMALLOC): Delete macro. + * ui-file.c (XMALLOC): Ditto. + * ser-unix.h (XMALLOC): Ditto. + * sh-tdep.c (XMALLOC): Ditto. + * ui-out.c (XMALLOC): Ditto. + * utils.c (XMALLOC): Ditto. + * i386-tdep.c (XMALLOC): Ditto. + * gdb-events.c (XMALLOC): Ditto. + * d10v-tdep.c (XMALLOC): Ditto. + * cli-out.c (XMALLOC): Ditto. + + * cli-out.c, d10v-tdep.c, gdb-events.c: Update copyright. + * gdb-events.sh, i386-tdep.c, ser-unix.h, serial.c: Ditto. + * ui-file.c, ui-out.c: Ditto. + 2002-03-18 Andrew Cagney * command.h (struct cmd_list_element): Add field context. diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 9bcfa4684a1..bd079f250bb 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -1,5 +1,7 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -26,12 +28,6 @@ #include "gdb_string.h" #include "gdb_assert.h" -/* Convenience macro for allocting typesafe memory. */ - -#ifndef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) -#endif - struct ui_out_data { struct ui_file *stream; diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c index d06a0b9b107..bd35fc065af 100644 --- a/gdb/d10v-tdep.c +++ b/gdb/d10v-tdep.c @@ -1,6 +1,7 @@ /* Target-dependent code for Mitsubishi D10V, for GDB. - Copyright 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software + Foundation, Inc. This file is part of GDB. @@ -41,9 +42,6 @@ #include "floatformat.h" #include "sim-d10v.h" -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - struct frame_extra_info { CORE_ADDR return_pc; diff --git a/gdb/defs.h b/gdb/defs.h index 23036451790..455eb661e15 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -840,6 +840,11 @@ extern void xmfree (void *md, void *ptr); "libiberty.h". */ extern void xfree (void *); +/* Utility macro to allocate typed memory. Avoids errors like + ``struct foo *foo = xmalloc (sizeof bar)'' and ``struct foo *foo = + (struct foo *) xmalloc (sizeof bar)''. */ +#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) + /* Like asprintf/vasprintf but get an internal_error if the call fails. */ extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3); diff --git a/gdb/gdb-events.c b/gdb/gdb-events.c index 0fbb3bab798..ada30a3ef5a 100644 --- a/gdb/gdb-events.c +++ b/gdb/gdb-events.c @@ -1,5 +1,6 @@ /* User Interface Events. - Copyright 1999, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2001, 2002 Free Software Foundation, Inc. Contributed by Cygnus Solutions. @@ -38,9 +39,6 @@ #include "gdb-events.h" #include "gdbcmd.h" -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - #if WITH_GDB_EVENTS static struct gdb_events null_event_hooks; static struct gdb_events queue_event_hooks; diff --git a/gdb/gdb-events.h b/gdb/gdb-events.h index 18a4a2018c2..5f7fc6b5a55 100644 --- a/gdb/gdb-events.h +++ b/gdb/gdb-events.h @@ -1,5 +1,6 @@ /* User Interface Events. - Copyright 1999, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2001, 2002 Free Software Foundation, Inc. Contributed by Cygnus Solutions. diff --git a/gdb/gdb-events.sh b/gdb/gdb-events.sh index eb7346551a0..9965f05577f 100755 --- a/gdb/gdb-events.sh +++ b/gdb/gdb-events.sh @@ -1,7 +1,7 @@ #!/bin/sh # User Interface Events. -# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # # Contributed by Cygnus Solutions. # @@ -113,7 +113,8 @@ copyright () { cat < + + * mi-main.c (XMALLOC): Delete macro. + * mi-out.c (XMALLOC): Ditto. + * mi-parse.c (XMALLOC): Ditto. + * mi-console.c (XMALLOC): Ditto. + * mi-cmd-var.c (XMALLOC): Ditto. + * mi-cmd-break.c (XMALLOC): Ditto. + + * mi/mi-cmd-var.c, mi/mi-console.c, mi/mi-out.c: Update copyright + * mi/mi-parse.c: Ditto. + 2002-02-24 Andrew Cagney From wiz at danbala: diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c index 5061392fa67..5d15aa98b8a 100644 --- a/gdb/mi/mi-cmd-break.c +++ b/gdb/mi/mi-cmd-break.c @@ -29,11 +29,6 @@ #include "gdb-events.h" #include "gdb.h" -/* Convenience macro for allocting typesafe memory. */ - -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - enum { FROM_TTY = 0 diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c index 0c840648bf7..4848a4e29c1 100644 --- a/gdb/mi/mi-cmd-var.c +++ b/gdb/mi/mi-cmd-var.c @@ -1,5 +1,7 @@ /* MI Command Set - varobj commands. - Copyright 2000 Free Software Foundation, Inc. + + Copyright 2000, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -27,11 +29,6 @@ #include "value.h" #include -/* Convenience macro for allocting typesafe memory. */ - -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - extern int varobjdebug; /* defined in varobj.c */ static int varobj_update_one (struct varobj *var); diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c index 5824f833ceb..c1b6e9f7b33 100644 --- a/gdb/mi/mi-console.c +++ b/gdb/mi/mi-console.c @@ -1,5 +1,7 @@ /* MI Console code. - Copyright 2000, 2001 Free Software Foundation, Inc. + + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -23,11 +25,6 @@ #include "mi-console.h" #include "gdb_string.h" -/* Convenience macro for allocting typesafe memory. */ - -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - /* MI-console: send output to std-out but correcty encapsulated */ static ui_file_fputs_ftype mi_console_file_fputs; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 3a59fc88dec..238d0e73608 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -42,11 +42,6 @@ #include #include -/* Convenience macro for allocting typesafe memory. */ - -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - enum { FROM_TTY = 0 diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index a92ccbeab8e..947720bc10c 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -1,5 +1,7 @@ /* MI Command Set - output generating routines. - Copyright 2000 Free Software Foundation, Inc. + + Copyright 2000, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -23,12 +25,6 @@ #include "ui-out.h" #include "mi-out.h" -/* Convenience macro for allocting typesafe memory. */ - -#ifndef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) -#endif - struct ui_out_data { int suppress_field_separator; diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c index 2ed49b8b773..caefd5936a5 100644 --- a/gdb/mi/mi-parse.c +++ b/gdb/mi/mi-parse.c @@ -1,5 +1,7 @@ /* MI Command Set - MI parser. - Copyright 2000, 2001 Free Software Foundation, Inc. + + Copyright 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions (a Red Hat company). This file is part of GDB. @@ -26,9 +28,6 @@ #include #include "gdb_string.h" -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - static void mi_parse_argv (char *args, struct mi_parse *parse) { diff --git a/gdb/ser-unix.h b/gdb/ser-unix.h index 861694fb806..f7be059b28a 100644 --- a/gdb/ser-unix.h +++ b/gdb/ser-unix.h @@ -1,5 +1,6 @@ /* Serial interface for UN*X file-descriptor based connection. - Copyright 1999, 2000 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -21,9 +22,6 @@ #ifndef SER_UNIX_H #define SER_UNIX_H -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - /* Generic UNIX/FD functions */ extern int ser_unix_nop_flush_output (struct serial *scb); diff --git a/gdb/serial.c b/gdb/serial.c index 22964eb3f98..ada5631dce9 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -1,7 +1,7 @@ /* Generic serial interface routines - Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -58,9 +58,6 @@ static const char logbase_ascii[] = "ascii"; static const char *logbase_enums[] = {logbase_hex, logbase_octal, logbase_ascii, NULL}; static const char *serial_logbase = logbase_ascii; - -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) static int serial_current_type = 0; diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 3f7bc6a1732..f5d123bf4fb 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -43,9 +43,6 @@ #include "solib-svr4.h" -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - void (*sh_show_regs) (void); CORE_ADDR (*skip_prologue_hard_way) (CORE_ADDR); void (*do_pseudo_register) (int); diff --git a/gdb/tui/ChangeLog b/gdb/tui/ChangeLog index 2f676a88d1b..d278c6a73a7 100644 --- a/gdb/tui/ChangeLog +++ b/gdb/tui/ChangeLog @@ -1,3 +1,7 @@ +2002-03-15 Andrew Cagney + + * tui-out.c (XMALLOC): Delete macro. Update copyright. + 2002-03-01 Andrew Cagney * tui-hooks.c: Add FIXME to explain true/false problem. Update diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 9789c65a608..a8cc58ba5ca 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -1,5 +1,7 @@ /* Output generating routines for GDB CLI. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -26,12 +28,6 @@ #include "gdb_string.h" #include "gdb_assert.h" -/* Convenience macro for allocting typesafe memory. */ - -#ifndef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) -#endif - struct ui_out_data { struct ui_file *stream; diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 86655e9c2f7..3dbcaab1326 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -1,5 +1,6 @@ /* UI_FILE - a generic STDIO like output stream. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GDB. @@ -24,9 +25,6 @@ #include "ui-file.h" #include "gdb_string.h" -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - static ui_file_isatty_ftype null_file_isatty; static ui_file_write_ftype null_file_write; static ui_file_fputs_ftype null_file_fputs; diff --git a/gdb/ui-out.c b/gdb/ui-out.c index 06db646de3d..7e27d592ed6 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -1,5 +1,7 @@ /* Output generating routines for GDB. - Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + + Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Contributed by Cygnus Solutions. Written by Fernando Nasser for Cygnus. @@ -27,11 +29,6 @@ #include "ui-out.h" #include "gdb_assert.h" -/* Convenience macro for allocting typesafe memory. */ - -#undef XMALLOC -#define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - /* table header structures */ struct ui_out_hdr diff --git a/gdb/utils.c b/gdb/utils.c index edc340e326e..4a1b5775143 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -87,9 +87,6 @@ extern void free (); extern char *canonicalize_file_name (const char *); #endif -#undef XMALLOC -#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) - /* readline defines this. */ #undef savestring