This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 00/26] Make GDB -Wpointer-sign clean.


(I started out writting this a few weeks ago, and pushed out some
bits, but I hadn't managed to get to travel the last mile and properly
split it and write descriptions/logs.  I did it now in order to avoid
having it fall into further bitrot decay.)

This makes GDB -Wpointer-sign clean on x86_64 GNU/Linux,
--enable-targets=all.  Once this is in, and perhaps a couple hosts
more are clean too (mingw and i386 GNU/Linux at least; haven't tried
those), I'll propose enabling the switch by default.

The main idea came out as reviewing a new port a few months ago, and
pointing out for the Nth time to use gdb_byte[] instead of char[].
The bad uses were of course coming in through copy/paste, so at the
time I grepped and fixed all I found.  Later, I noticed that
-Wpointer-sign catches these issues, as gdb_byte is unsigned char
while char is signed on x86_64, so it'd be good to enable that switch.
Of course, before that, we need to fix all current issues in the tree,
hence the previous patches from a few weeks back and now this series.

This is mostly split by category, with the first patches touching the
whole codebase, fixing each a class of issues.  Latter patches in the
series fix the remaining issues in individual files, when their fixes
are either non-obvious, or don't fit in the class of a previous patch.

I'm hoping this sort of split makes review easy and allows quick
turnaround as consequence.

Tested on x86_64 Fedora 17.

For convenience, you can also find this series at:

 git@github.com:palves/gdb.git Wpointer-sign
 https://github.com/palves/gdb/commits/Wpointer-sign

---

Pedro Alves (26):
      -Wpointer-sign: char -> gdb_byte.
      -Wpointer-sign: gdb_byte -> char.
      cris-tdep.c: Use unsigned variable for unsigned command.
      alpha-tdep.c/mips-tdep.c: "set heuristic-fence-post" is signed/zinteger.
      mep-tdep.c: Wrong signness for instruction buffer.
      mips-tdep.c: Wrong signness for local holding PC register.
      ppc-linux-tdep.c: Wrong signness for buffer holding instructions.
      -Wpointer-sign: s390-tdep.c.
      -Wpointer-sign: aarch64-tdep.c.
      -Wpointer-sign: xtensa-tdep.c.
      -Wpointer-sign: alpha-tdep.c.
      Cast result of obstack_base to gdb_byte * in a couple spots.
      serial_write: change prototype to take a void-pointer buffer.
      gdb_byte for binary buffer, char for string: remote.c, tracepoint.c.
      gdb_byte for binary buffer, char for string: common/agent.c.
      -Wpointer-sign: remote-mips.c.
      -Wpointer-sign: python/.
      -Wpointer-sign: bookmarks.
      -Wpointer-sign: coff-pe-read.c: treat strings in PE/COFF data as char *.
      -Wpointer-sign: xcoffread.c.
      -Wpointer-sign: dwarf2read.c.
      -Wpointer-sign: dwarf2-frame.c: Pass unsigned variable to safe_read_uleb128.
      -Wpointer-sign: ada-lang.c, ada-tasks.c.
      -Wpointer-sign: cp-valprint.c.
      -Wpointer-sign: ctf.c.
      -Wpointer-sign: record.c.


 gdb/aarch64-tdep.c           |    6 +++---
 gdb/ada-lang.c               |    5 +++--
 gdb/ada-tasks.c              |    2 +-
 gdb/alpha-tdep.c             |    6 +++---
 gdb/alphanbsd-tdep.c         |    8 ++++----
 gdb/arm-linux-tdep.c         |   16 ++++++++-------
 gdb/arm-tdep.c               |   12 ++++++-----
 gdb/arm-tdep.h               |    6 +++---
 gdb/arm-wince-tdep.c         |    4 ++--
 gdb/armnbsd-tdep.c           |    8 ++++----
 gdb/armobsd-tdep.c           |    4 ++--
 gdb/avr-tdep.c               |    8 +++++---
 gdb/c-lang.c                 |    2 +-
 gdb/coff-pe-read.c           |    7 ++++---
 gdb/common/agent.c           |    3 ++-
 gdb/cp-valprint.c            |    2 +-
 gdb/cris-tdep.c              |   26 ++++++++++++-------------
 gdb/ctf.c                    |   15 ++++++++------
 gdb/dwarf2-frame.c           |    6 +++---
 gdb/dwarf2loc.c              |    4 ++--
 gdb/dwarf2read.c             |   10 +++++-----
 gdb/frv-tdep.c               |   10 +++++-----
 gdb/hppa-hpux-tdep.c         |   16 ++++++++-------
 gdb/hppa-tdep.c              |    4 ++--
 gdb/i386-cygwin-tdep.c       |    6 +++---
 gdb/i387-tdep.c              |    2 +-
 gdb/ia64-tdep.c              |   24 +++++++++++------------
 gdb/linux-tdep.c             |    8 ++++----
 gdb/m32c-tdep.c              |    3 +--
 gdb/m68hc11-tdep.c           |   14 +++++++------
 gdb/mep-tdep.c               |    2 +-
 gdb/mips-tdep.c              |    6 +++---
 gdb/mipsnbsd-tdep.c          |    2 +-
 gdb/mn10300-tdep.c           |   11 ++++++-----
 gdb/moxie-tdep.c             |   14 +++++--------
 gdb/ppc-linux-tdep.c         |    2 +-
 gdb/ppc-ravenscar-thread.c   |    6 +++---
 gdb/python/py-inferior.c     |    2 +-
 gdb/python/py-prettyprint.c  |   10 +++++-----
 gdb/python/py-value.c        |    3 ++-
 gdb/ravenscar-thread.c       |    2 +-
 gdb/record-full.c            |   10 ++++++----
 gdb/record.c                 |    2 +-
 gdb/remote-m32r-sdi.c        |    2 +-
 gdb/remote-mips.c            |   34 +++++++++++++++++---------------
 gdb/remote.c                 |   31 +++++++++++++++---------------
 gdb/reverse.c                |    4 ++--
 gdb/s390-tdep.c              |    8 ++++----
 gdb/score-tdep.c             |    2 +-
 gdb/ser-base.c               |   11 ++++++-----
 gdb/ser-base.h               |    2 +-
 gdb/ser-go32.c               |   13 +++++++-----
 gdb/serial.c                 |   16 +++++++++------
 gdb/serial.h                 |    6 +++---
 gdb/sh-tdep.c                |   44 +++++++++++++++++++++---------------------
 gdb/sh64-tdep.c              |   41 ++++++++++++++++++---------------------
 gdb/solib-darwin.c           |   10 +++++-----
 gdb/solib-dsbt.c             |    4 ++--
 gdb/solib-frv.c              |    4 ++--
 gdb/solib-irix.c             |   12 ++++++-----
 gdb/solib-som.c              |    2 +-
 gdb/solib-spu.c              |    2 +-
 gdb/solib-svr4.c             |    6 +++---
 gdb/sparc-ravenscar-thread.c |    6 +++---
 gdb/spu-multiarch.c          |    2 +-
 gdb/spu-tdep.c               |   18 ++++++++++-------
 gdb/tic6x-tdep.c             |    2 +-
 gdb/tic6x-tdep.h             |    2 +-
 gdb/tracepoint.c             |   19 ++++++++++--------
 gdb/xcoffread.c              |    2 +-
 gdb/xstormy16-tdep.c         |   10 +++++-----
 gdb/xtensa-tdep.c            |   10 +++++-----
 72 files changed, 328 insertions(+), 316 deletions(-)

-- 
Signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]