diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-16 19:00:04 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2012-12-16 19:00:04 +0000 |
commit | 3d745be3fca9cfd3cbfb09c224a6c7312bec4de3 (patch) | |
tree | f8dfe8091bc9c5da1476d6368bf476b16a76cabd /gdb/doc | |
parent | b57a636e4b4d23ba89c9d18118ed231500b0de06 (diff) | |
download | fsf-binutils-gdb-3d745be3fca9cfd3cbfb09c224a6c7312bec4de3.zip fsf-binutils-gdb-3d745be3fca9cfd3cbfb09c224a6c7312bec4de3.tar.gz fsf-binutils-gdb-3d745be3fca9cfd3cbfb09c224a6c7312bec4de3.tar.bz2 |
gdb/
Code cleanup.
* skip.c (skip_function_command, skip_file_command, skip_info): Remove
unused forward declarations.
(skip_file_command): Make variables symtab and filename targets const.
Use proper 0 vs. NULL constant everywhere.
(skip_function_command): Use proper 0 vs. NULL constant everywhere.
Include empty line after declarations. Use GNU spacing in a comment.
Do not use strlen for end of string check.
(skip_info): Use proper 0 vs. NULL constant everywhere. Add column 5
comments.
(skip_enable_command, skip_disable_command, skip_delete_command)
(add_skiplist_entry): Use proper 0 vs. NULL constant everywhere.
(function_pc_is_marked_for_skip): Make variable filename target const.
Use proper 0 vs. NULL constant everywhere. Fix GNU non-compliant
comment formatting.
(skip_re_set): Add empty line after function comment. Use proper 0 vs.
NULL constant everywhere. Include empty line after declarations. Make
variable symtab target const. Do not use strlen for end of string
check.
gdb/doc/
* gdbint.texinfo (Coding Standards) (C Usage): New rule for 0 vs. NULL.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 08ff980..893ca70 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2012-12-16 Jan Kratochvil <jan.kratochvil@redhat.com> + + * gdbint.texinfo (Coding Standards) (C Usage): New rule for 0 vs. NULL. + 2012-12-15 Yao Qi <yao@codesourcery.com> * gdb.texinfo (Debugging Output): Document 'set debug diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 5dbf7bf..bb7e5e5 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -5907,6 +5907,25 @@ protected with parentheses.) Declarations like @samp{struct foo *} should be used in preference to declarations like @samp{typedef struct foo @{ @dots{} @} *foo_ptr}. +Zero constant (@code{0}) is not interchangeable with a null pointer +constant (@code{NULL}) anywhere. @sc{gcc} does not give a warning for +such interchange. Specifically: + +@multitable @columnfractions .2 .5 +@item incorrect +@tab @code{if (pointervar) @{@}} +@item incorrect +@tab @code{if (!pointervar) @{@}} +@item incorrect +@tab @code{if (pointervar != 0) @{@}} +@item incorrect +@tab @code{if (pointervar == 0) @{@}} +@item correct +@tab @code{if (pointervar != NULL) @{@}} +@item correct +@tab @code{if (pointervar == NULL) @{@}} +@end multitable + @subsection Function Prototypes @cindex function prototypes |