Skip to content
Snippets Groups Projects
Commit a3e200ef authored by Andrew Burgess's avatar Andrew Burgess
Browse files

gdbarch: remove some unneeded predefault="0" from gdbarch_components.py


I noticed that there are a bunch of 'predefault="0"' lines in
gdbarch_components.py, and that some (just some, not all) of these are
not needed.

The gdbarch is already zero initialized, but these lines seem to
exists so that we can know when to compare against "0" and when to
compare against "NULL".  At least, this seems to be useful in some
places in the generated code.

Specifically, if we remove the predefault="0" line from the
max_insn_length component then we end up generating a line like:

  gdb_assert (gdbarch->max_insn_length != NULL);

which doesn't compile as we compare a ULONGEST to NULL.

In this commit I remove all the predefault="0" lines that I claim are
obviously not needed.  These are lines for components that are not
Values (i.e. the component holds a function pointer anyway), or for
Value components that hold a pointer type, in which case using NULL is
fine.

The only changes after this commit are some fields that have nullptr
as their initial value, and gcore_bfd_target now compares to NULL not
0 in gdbarch_gcore_bfd_target_p, which, given the field is of type
'const char *', seems like an improvement.

Approved-By: default avatarSimon Marchi <simon.marchi@efficios.com>
parent c317ea57
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment