* [rfa/cli] s/NO_FUNCTION/NULL/
@ 2002-01-02 8:15 Andrew Cagney
2002-01-20 15:17 ` Andrew Cagney
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-01-02 8:15 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 284 bytes --]
Hello,
The attached replaces the NO_FUNCTION macro with NULL. If you examine
the code, function.cfunc() is only sometimes assigned the value
NO_FUNCTION and no code actually tests for a value of NO_FUNCTION.
Consequently, I can't see any point in having this macro.
ok?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 8015 bytes --]
2001-12-28 Andrew Cagney <ac131313@redhat.com>
* command.h (NO_FUNCTION): Delete macro.
* cli/cli-decode.h (NO_FUNCTION): Ditto.
* top.c (execute_command): Replace NO_FUNCTION with NULL.
* tracepoint.c (_initialize_tracepoint): Ditto.
* cli/cli-decode.c (add_set_cmd): Ditto.
* cli/cli-cmds.c (init_cli_cmds): Ditto.
Index: tui/ChangeLog
2001-12-28 Andrew Cagney <ac131313@redhat.com>
* tuiWin.c (_initialize_tuiWin): Replace NO_FUNCTION with NULL.
Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.20
diff -u -r1.20 command.h
--- command.h 2001/11/22 00:23:11 1.20
+++ command.h 2002/01/02 15:49:57
@@ -126,9 +126,8 @@
/* Command class; class values are chosen by application program. */
enum command_class class;
- /* Function definition of this command.
- NO_FUNCTION for command class names and for help topics that
- are not really commands. */
+ /* Function definition of this command. NULL for command class
+ names and for help topics that are not really commands. */
union
{
/* If type is not_set_cmd, call it like this: */
@@ -139,7 +138,6 @@
void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
}
function;
-#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
/* Documentation of this command (or help topic).
First line is brief documentation; remaining lines form, with it,
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.50
diff -u -r1.50 top.c
--- top.c 2001/11/27 04:15:09 1.50
+++ top.c 2002/01/02 15:49:58
@@ -698,7 +698,7 @@
execute_user_command (c, arg);
else if (c->type == set_cmd || c->type == show_cmd)
do_setshow_command (arg, from_tty & caution, c);
- else if (c->function.cfunc == NO_FUNCTION)
+ else if (c->function.cfunc == NULL)
error ("That is not a command, just a help topic.");
else if (call_command_hook)
call_command_hook (c, arg, from_tty & caution);
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.29
diff -u -r1.29 tracepoint.c
--- tracepoint.c 2001/12/25 22:24:38 1.29
+++ tracepoint.c 2002/01/02 15:50:00
@@ -2658,7 +2658,7 @@
add_info ("scope", scope_info,
"List the variables local to a scope");
- add_cmd ("tracepoints", class_trace, NO_FUNCTION,
+ add_cmd ("tracepoints", class_trace, NULL,
"Tracing of program execution without stopping the program.",
&cmdlist);
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.10
diff -u -r1.10 cli-cmds.c
--- cli-cmds.c 2001/09/01 21:38:05 1.10
+++ cli-cmds.c 2002/01/02 15:50:00
@@ -605,24 +605,24 @@
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
- add_cmd ("internals", class_maintenance, NO_FUNCTION,
+ add_cmd ("internals", class_maintenance, NULL,
"Maintenance commands.\n\
Some gdb commands are provided just for use by gdb maintainers.\n\
These commands are subject to frequent change, and may not be as\n\
well documented as user commands.",
&cmdlist);
- add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist);
- add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist);
- add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\
+ add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist);
+ add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist);
+ add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\
The commands in this class are those defined by the user.\n\
Use the \"define\" command to define a command.", &cmdlist);
- add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist);
+ add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist);
if (!dbx_commands)
- add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist);
- add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist);
- add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist);
- add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist);
- add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\
+ add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist);
+ add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist);
+ add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist);
+ add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist);
+ add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\
The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
counting from zero for the innermost (currently executing) frame.\n\n\
At any time gdb identifies one frame as the \"selected\" frame.\n\
@@ -630,7 +630,7 @@
When the program being debugged stops, gdb selects the innermost frame.\n\
The commands below can be used to select other frames by number or address.",
&cmdlist);
- add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist);
+ add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist);
/* Define general commands. */
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.10
diff -u -r1.10 cli-decode.c
--- cli-decode.c 2001/12/20 18:35:30 1.10
+++ cli-decode.c 2002/01/02 15:50:01
@@ -238,13 +238,12 @@
char *doc,
struct cmd_list_element **list)
{
- struct cmd_list_element *c
- = add_cmd (name, class, NO_FUNCTION, doc, list);
+ struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
c->type = set_cmd;
c->var_type = var_type;
c->var = var;
- /* This needs to be something besides NO_FUNCTION so that this isn't
+ /* This needs to be something besides NULL so that this isn't
treated as a help class. */
c->function.sfunc = empty_sfunc;
return c;
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.5
diff -u -r1.5 cli-decode.h
--- cli-decode.h 2001/11/22 00:23:13 1.5
+++ cli-decode.h 2002/01/02 15:50:01
@@ -120,9 +120,8 @@
/* Command class; class values are chosen by application program. */
enum command_class class;
- /* Function definition of this command.
- NO_FUNCTION for command class names and for help topics that
- are not really commands. */
+ /* Function definition of this command. NULL for command class
+ names and for help topics that are not really commands. */
union
{
/* If type is not_set_cmd, call it like this: */
@@ -133,7 +132,6 @@
void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
}
function;
-#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
/* Documentation of this command (or help topic).
First line is brief documentation; remaining lines form, with it,
Index: tui/tuiWin.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
retrieving revision 1.16
diff -u -r1.16 tuiWin.c
--- tuiWin.c 2001/07/28 19:30:54 1.16
+++ tuiWin.c 2002/01/02 15:50:22
@@ -280,7 +280,7 @@
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
- add_cmd ("tui", class_tui, NO_FUNCTION,
+ add_cmd ("tui", class_tui, NULL,
"Text User Interface commands.",
&cmdlist);
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-02 8:15 [rfa/cli] s/NO_FUNCTION/NULL/ Andrew Cagney
@ 2002-01-20 15:17 ` Andrew Cagney
2002-01-21 1:51 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-01-20 15:17 UTC (permalink / raw)
To: Fernando Nasser; +Cc: gdb-patches
Fernando,
Do you have any problems with the below?
Andrew
> Hello,
>
> The attached replaces the NO_FUNCTION macro with NULL. If you examine the code, function.cfunc() is only sometimes assigned the value NO_FUNCTION and no code actually tests for a value of NO_FUNCTION. Consequently, I can't see any point in having this macro.
>
> ok?
>
> Andrew
>
>
> 2001-12-28 Andrew Cagney <ac131313@redhat.com>
>
> * command.h (NO_FUNCTION): Delete macro.
> * cli/cli-decode.h (NO_FUNCTION): Ditto.
> * top.c (execute_command): Replace NO_FUNCTION with NULL.
> * tracepoint.c (_initialize_tracepoint): Ditto.
> * cli/cli-decode.c (add_set_cmd): Ditto.
> * cli/cli-cmds.c (init_cli_cmds): Ditto.
>
> Index: tui/ChangeLog
> 2001-12-28 Andrew Cagney <ac131313@redhat.com>
>
> * tuiWin.c (_initialize_tuiWin): Replace NO_FUNCTION with NULL.
>
> Index: command.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/command.h,v
> retrieving revision 1.20
> diff -u -r1.20 command.h
> --- command.h 2001/11/22 00:23:11 1.20
> +++ command.h 2002/01/02 15:49:57
> @@ -126,9 +126,8 @@
> /* Command class; class values are chosen by application program. */
> enum command_class class;
>
> - /* Function definition of this command.
> - NO_FUNCTION for command class names and for help topics that
> - are not really commands. */
> + /* Function definition of this command. NULL for command class
> + names and for help topics that are not really commands. */
> union
> {
> /* If type is not_set_cmd, call it like this: */
> @@ -139,7 +138,6 @@
> void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
> }
> function;
> -#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
>
> /* Documentation of this command (or help topic).
> First line is brief documentation; remaining lines form, with it,
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.50
> diff -u -r1.50 top.c
> --- top.c 2001/11/27 04:15:09 1.50
> +++ top.c 2002/01/02 15:49:58
> @@ -698,7 +698,7 @@
> execute_user_command (c, arg);
> else if (c->type == set_cmd || c->type == show_cmd)
> do_setshow_command (arg, from_tty & caution, c);
> - else if (c->function.cfunc == NO_FUNCTION)
> + else if (c->function.cfunc == NULL)
> error ("That is not a command, just a help topic.");
> else if (call_command_hook)
> call_command_hook (c, arg, from_tty & caution);
> Index: tracepoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/tracepoint.c,v
> retrieving revision 1.29
> diff -u -r1.29 tracepoint.c
> --- tracepoint.c 2001/12/25 22:24:38 1.29
> +++ tracepoint.c 2002/01/02 15:50:00
> @@ -2658,7 +2658,7 @@
> add_info ("scope", scope_info,
> "List the variables local to a scope");
>
> - add_cmd ("tracepoints", class_trace, NO_FUNCTION,
> + add_cmd ("tracepoints", class_trace, NULL,
> "Tracing of program execution without stopping the program.",
> &cmdlist);
>
> Index: cli/cli-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
> retrieving revision 1.10
> diff -u -r1.10 cli-cmds.c
> --- cli-cmds.c 2001/09/01 21:38:05 1.10
> +++ cli-cmds.c 2002/01/02 15:50:00
> @@ -605,24 +605,24 @@
> /* Define the classes of commands.
> They will appear in the help list in the reverse of this order. */
>
> - add_cmd ("internals", class_maintenance, NO_FUNCTION,
> + add_cmd ("internals", class_maintenance, NULL,
> "Maintenance commands.\n\
> Some gdb commands are provided just for use by gdb maintainers.\n\
> These commands are subject to frequent change, and may not be as\n\
> well documented as user commands.",
> &cmdlist);
> - add_cmd ("obscure", class_obscure, NO_FUNCTION, "Obscure features.", &cmdlist);
> - add_cmd ("aliases", class_alias, NO_FUNCTION, "Aliases of other commands.", &cmdlist);
> - add_cmd ("user-defined", class_user, NO_FUNCTION, "User-defined commands.\n\
> + add_cmd ("obscure", class_obscure, NULL, "Obscure features.", &cmdlist);
> + add_cmd ("aliases", class_alias, NULL, "Aliases of other commands.", &cmdlist);
> + add_cmd ("user-defined", class_user, NULL, "User-defined commands.\n\
> The commands in this class are those defined by the user.\n\
> Use the \"define\" command to define a command.", &cmdlist);
> - add_cmd ("support", class_support, NO_FUNCTION, "Support facilities.", &cmdlist);
> + add_cmd ("support", class_support, NULL, "Support facilities.", &cmdlist);
> if (!dbx_commands)
> - add_cmd ("status", class_info, NO_FUNCTION, "Status inquiries.", &cmdlist);
> - add_cmd ("files", class_files, NO_FUNCTION, "Specifying and examining files.", &cmdlist);
> - add_cmd ("breakpoints", class_breakpoint, NO_FUNCTION, "Making program stop at certain points.", &cmdlist);
> - add_cmd ("data", class_vars, NO_FUNCTION, "Examining data.", &cmdlist);
> - add_cmd ("stack", class_stack, NO_FUNCTION, "Examining the stack.\n\
> + add_cmd ("status", class_info, NULL, "Status inquiries.", &cmdlist);
> + add_cmd ("files", class_files, NULL, "Specifying and examining files.", &cmdlist);
> + add_cmd ("breakpoints", class_breakpoint, NULL, "Making program stop at certain points.", &cmdlist);
> + add_cmd ("data", class_vars, NULL, "Examining data.", &cmdlist);
> + add_cmd ("stack", class_stack, NULL, "Examining the stack.\n\
> The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
> counting from zero for the innermost (currently executing) frame.\n\n\
> At any time gdb identifies one frame as the \"selected\" frame.\n\
> @@ -630,7 +630,7 @@
> When the program being debugged stops, gdb selects the innermost frame.\n\
> The commands below can be used to select other frames by number or address.",
> &cmdlist);
> - add_cmd ("running", class_run, NO_FUNCTION, "Running the program.", &cmdlist);
> + add_cmd ("running", class_run, NULL, "Running the program.", &cmdlist);
>
> /* Define general commands. */
>
> Index: cli/cli-decode.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
> retrieving revision 1.10
> diff -u -r1.10 cli-decode.c
> --- cli-decode.c 2001/12/20 18:35:30 1.10
> +++ cli-decode.c 2002/01/02 15:50:01
> @@ -238,13 +238,12 @@
> char *doc,
> struct cmd_list_element **list)
> {
> - struct cmd_list_element *c
> - = add_cmd (name, class, NO_FUNCTION, doc, list);
> + struct cmd_list_element *c = add_cmd (name, class, NULL, doc, list);
>
> c->type = set_cmd;
> c->var_type = var_type;
> c->var = var;
> - /* This needs to be something besides NO_FUNCTION so that this isn't
> + /* This needs to be something besides NULL so that this isn't
> treated as a help class. */
> c->function.sfunc = empty_sfunc;
> return c;
> Index: cli/cli-decode.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
> retrieving revision 1.5
> diff -u -r1.5 cli-decode.h
> --- cli-decode.h 2001/11/22 00:23:13 1.5
> +++ cli-decode.h 2002/01/02 15:50:01
> @@ -120,9 +120,8 @@
> /* Command class; class values are chosen by application program. */
> enum command_class class;
>
> - /* Function definition of this command.
> - NO_FUNCTION for command class names and for help topics that
> - are not really commands. */
> + /* Function definition of this command. NULL for command class
> + names and for help topics that are not really commands. */
> union
> {
> /* If type is not_set_cmd, call it like this: */
> @@ -133,7 +132,6 @@
> void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
> }
> function;
> -#define NO_FUNCTION ((void (*) (char *args, int from_tty)) 0)
>
> /* Documentation of this command (or help topic).
> First line is brief documentation; remaining lines form, with it,
> Index: tui/tuiWin.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/tui/tuiWin.c,v
> retrieving revision 1.16
> diff -u -r1.16 tuiWin.c
> --- tuiWin.c 2001/07/28 19:30:54 1.16
> +++ tuiWin.c 2002/01/02 15:50:22
> @@ -280,7 +280,7 @@
>
> /* Define the classes of commands.
> They will appear in the help list in the reverse of this order. */
> - add_cmd ("tui", class_tui, NO_FUNCTION,
> + add_cmd ("tui", class_tui, NULL,
> "Text User Interface commands.",
> &cmdlist);
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-20 15:17 ` Andrew Cagney
@ 2002-01-21 1:51 ` Eli Zaretskii
2002-01-21 8:51 ` Fernando Nasser
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2002-01-21 1:51 UTC (permalink / raw)
To: Andrew Cagney; +Cc: Fernando Nasser, gdb-patches
On Sun, 20 Jan 2002, Andrew Cagney wrote:
> Do you have any problems with the below?
>
> Andrew
>
> > Hello,
> >
> > The attached replaces the NO_FUNCTION macro with NULL. If you
> > examine the code, function.cfunc() is only sometimes assigned the
> > value NO_FUNCTION and no code actually tests for a value of
> > NO_FUNCTION. Consequently, I can't see any point in having this
> > macro.
IMHO, someone should test this change with the latest versions of GCC,
including their development line: they could have their own ideas when
you are allowed to pass NULL, especially with all the warning options
we use.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-21 1:51 ` Eli Zaretskii
@ 2002-01-21 8:51 ` Fernando Nasser
2002-01-21 9:19 ` Eli Zaretskii
2002-01-21 10:37 ` Andrew Cagney
0 siblings, 2 replies; 10+ messages in thread
From: Fernando Nasser @ 2002-01-21 8:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Andrew Cagney, gdb-patches
Eli Zaretskii wrote:
>
> On Sun, 20 Jan 2002, Andrew Cagney wrote:
>
> > Do you have any problems with the below?
> >
> > Andrew
> >
> > > Hello,
> > >
> > > The attached replaces the NO_FUNCTION macro with NULL. If you
> > > examine the code, function.cfunc() is only sometimes assigned the
> > > value NO_FUNCTION and no code actually tests for a value of
> > > NO_FUNCTION. Consequently, I can't see any point in having this
> > > macro.
>
> IMHO, someone should test this change with the latest versions of GCC,
> including their development line: they could have their own ideas when
> you are allowed to pass NULL, especially with all the warning options
> we use.
Besides, the NO_FUNCTION documents the meaning better than NULL
(although most people should guess). Maybe you can add a comment
somewhere nearby.
Any chance Eli's concerns become true and we get a warning because
NULL is not typed properly? Maybe you would need a cast (in which
case I would prefer the NO_FUNCTION def.
Regards,
Fernando
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-21 8:51 ` Fernando Nasser
@ 2002-01-21 9:19 ` Eli Zaretskii
2002-01-21 10:37 ` Andrew Cagney
1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2002-01-21 9:19 UTC (permalink / raw)
To: Fernando Nasser; +Cc: Andrew Cagney, gdb-patches
On Mon, 21 Jan 2002, Fernando Nasser wrote:
> Maybe you would need a cast (in which
> case I would prefer the NO_FUNCTION def.
Exactly (since they are technically identical, AFAICS).
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-21 8:51 ` Fernando Nasser
2002-01-21 9:19 ` Eli Zaretskii
@ 2002-01-21 10:37 ` Andrew Cagney
2002-01-22 0:57 ` Eli Zaretskii
1 sibling, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-01-21 10:37 UTC (permalink / raw)
To: Fernando Nasser; +Cc: Eli Zaretskii, gdb-patches
>> IMHO, someone should test this change with the latest versions of GCC,
>> including their development line: they could have their own ideas when
>> you are allowed to pass NULL, especially with all the warning options
>> we use.
My ISO C is pretty rusty, however my memory is that NULL is very very
special. GCC might do be doing some strange things but they won't
extend to things like:
cmd->function.cfunc = NULL;
if (cmd->function.cfunc)
or
if (cmd->function.cfunc == NULL)
With regard to parameters, GDB is fully parameterized so that isn't a
problem.
GDB built with GCC 3.0.3. Using current GCC things died mysteriously
part way through the build.
> Besides, the NO_FUNCTION documents the meaning better than NULL
> (although most people should guess). Maybe you can add a comment
> somewhere nearby.
>
> Any chance Eli's concerns become true and we get a warning because
> NULL is not typed properly? Maybe you would need a cast (in which
> case I would prefer the NO_FUNCTION def.
If we're going to have a cast NULL pointer for cfunc (NO_FUNCTION) then
we're going to need to do similar for every single function pointer in
GDB. I really can't see anyone doing that.
Anyway, per my original e-mail , a quick look through the CLI code
reveals that even the CLI doesn't follow its own convention. The CLI uses:
if (cmd->function.cfunc == NULL)
and
if (cmd->function.cfunc)
intead of:
if (cmd->function.cfunc == NO_FUNCTION)
(the latter occures just once). This leads me to conclude that
NO_FUNCTION ``was simply a good idea at the time''. One of those
conventions that looks good but doesn't actually improve things.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-21 10:37 ` Andrew Cagney
@ 2002-01-22 0:57 ` Eli Zaretskii
2002-01-28 20:51 ` Andrew Cagney
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2002-01-22 0:57 UTC (permalink / raw)
To: ac131313; +Cc: fnasser, gdb-patches
> Date: Mon, 21 Jan 2002 13:36:52 -0500
> From: Andrew Cagney <ac131313@cygnus.com>
>
> My ISO C is pretty rusty, however my memory is that NULL is very very
> special.
In C++, but not in C, IIRC.
> GDB built with GCC 3.0.3. Using current GCC things died mysteriously
> part way through the build.
Well, until GCC 3.1 can compile the whole thing, I guess we don't
have to worry.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-22 0:57 ` Eli Zaretskii
@ 2002-01-28 20:51 ` Andrew Cagney
2002-01-29 2:10 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: Andrew Cagney @ 2002-01-28 20:51 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: fnasser, gdb-patches
> Date: Mon, 21 Jan 2002 13:36:52 -0500
>> From: Andrew Cagney <ac131313@cygnus.com>
>>
>> My ISO C is pretty rusty, however my memory is that NULL is very very
>> special.
>
>
> In C++, but not in C, IIRC.
>
>
>> GDB built with GCC 3.0.3. Using current GCC things died mysteriously
>> part way through the build.
>
>
> Well, until GCC 3.1 can compile the whole thing, I guess we don't
> have to worry.
I went and asked. The following is of course third hand:
In C++, NULL can't be ``(void*)0''. It should be ``0'' but GCC likes to
define it to ``__null''. The latter is a special constant with magic
properties that lets GCC verify that NULL is being used correctly.
In C, NULL is typically ``(void*)0''. What ever it is, it must be
compatible with both data and code pointers.
I think this makes using NULL more robust than NO_FUNCTION?
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-28 20:51 ` Andrew Cagney
@ 2002-01-29 2:10 ` Eli Zaretskii
2002-01-31 21:49 ` Andrew Cagney
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2002-01-29 2:10 UTC (permalink / raw)
To: Andrew Cagney; +Cc: fnasser, gdb-patches
On Mon, 28 Jan 2002, Andrew Cagney wrote:
> In C, NULL is typically ``(void*)0''. What ever it is, it must be
> compatible with both data and code pointers.
>
> I think this makes using NULL more robust than NO_FUNCTION?
NULL _should_ be more robust than NO_FUNCTION, but you can never know
what GCC will invent next ;-)
I guess we can postpone this, and use NULL, until we see some
warnings. With any luck, that will never happen.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [rfa/cli] s/NO_FUNCTION/NULL/
2002-01-29 2:10 ` Eli Zaretskii
@ 2002-01-31 21:49 ` Andrew Cagney
0 siblings, 0 replies; 10+ messages in thread
From: Andrew Cagney @ 2002-01-31 21:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: fnasser, gdb-patches
> On Mon, 28 Jan 2002, Andrew Cagney wrote:
>
>
>> In C, NULL is typically ``(void*)0''. What ever it is, it must be
>> compatible with both data and code pointers.
>>
>> I think this makes using NULL more robust than NO_FUNCTION?
>
>
> NULL _should_ be more robust than NO_FUNCTION, but you can never know
> what GCC will invent next ;-)
>
> I guess we can postpone this, and use NULL, until we see some
> warnings. With any luck, that will never happen.
Ok, it is in.
Andrew
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2002-02-01 5:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-02 8:15 [rfa/cli] s/NO_FUNCTION/NULL/ Andrew Cagney
2002-01-20 15:17 ` Andrew Cagney
2002-01-21 1:51 ` Eli Zaretskii
2002-01-21 8:51 ` Fernando Nasser
2002-01-21 9:19 ` Eli Zaretskii
2002-01-21 10:37 ` Andrew Cagney
2002-01-22 0:57 ` Eli Zaretskii
2002-01-28 20:51 ` Andrew Cagney
2002-01-29 2:10 ` Eli Zaretskii
2002-01-31 21:49 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox