From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21277 invoked by alias); 11 Apr 2013 22:58:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 21267 invoked by uid 89); 11 Apr 2013 22:58:53 -0000 X-Spam-SWARE-Status: No, score=-8.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 11 Apr 2013 22:58:52 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3BMwpqi000821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Apr 2013 18:58:51 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3BMwnJe010890 for ; Thu, 11 Apr 2013 18:58:50 -0400 Subject: [PATCH 00/26] Make GDB -Wpointer-sign clean. To: gdb-patches@sourceware.org From: Pedro Alves Date: Thu, 11 Apr 2013 23:00:00 -0000 Message-ID: <20130411225847.16791.29283.stgit@brno.lan> User-Agent: StGit/0.16 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2013-04/txt/msg00340.txt.bz2 (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