From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 500 invoked by alias); 11 Apr 2013 23:01:04 -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 478 invoked by uid 89); 11 Apr 2013 23:01:04 -0000 X-Spam-SWARE-Status: No, score=-8.9 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,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 23:01:04 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3BN125u016006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 11 Apr 2013 19:01:02 -0400 Received: from brno.lan (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3BN11Rv017030 for ; Thu, 11 Apr 2013 19:01:02 -0400 Subject: [PATCH 17/26] -Wpointer-sign: python/. To: gdb-patches@sourceware.org From: Pedro Alves Date: Fri, 12 Apr 2013 02:32:00 -0000 Message-ID: <20130411230100.16791.37111.stgit@brno.lan> In-Reply-To: <20130411225847.16791.29283.stgit@brno.lan> References: <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/msg00356.txt.bz2 This fixes -Wpointer-sign warnings in the python/ code in the manner that seems most appropriate to me. gdb/ 2013-04-11 Pedro Alves * python/py-inferior.c (infpy_write_memory): Add cast to gdb_byte * python/py-prettyprint.c (print_string_repr): Change type of 'output' local to char *. Add cast to gdb_byte * in LA_PRINT_STRING call. (print_children): Change type of 'output' local to char *. * python/py-value.c (valpy_string): Add cast to const char * in PyUnicode_Decode call. --- gdb/python/py-inferior.c | 2 +- gdb/python/py-prettyprint.c | 10 +++++----- gdb/python/py-value.c | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c index 9c84904..4af7131 100644 --- a/gdb/python/py-inferior.c +++ b/gdb/python/py-inferior.c @@ -513,7 +513,7 @@ infpy_write_memory (PyObject *self, PyObject *args, PyObject *kw) error = 1; break; } - write_memory_with_notification (addr, buffer, length); + write_memory_with_notification (addr, (gdb_byte *) buffer, length); } #ifdef IS_PY3K PyBuffer_Release (&pybuf); diff --git a/gdb/python/py-prettyprint.c b/gdb/python/py-prettyprint.c index dbf6c22..b50e757 100644 --- a/gdb/python/py-prettyprint.c +++ b/gdb/python/py-prettyprint.c @@ -343,13 +343,13 @@ print_string_repr (PyObject *printer, const char *hint, string = python_string_to_target_python_string (py_str); if (string) { - gdb_byte *output; + char *output; long length; struct type *type; make_cleanup_py_decref (string); #ifdef IS_PY3K - output = (gdb_byte *) PyBytes_AS_STRING (string); + output = PyBytes_AS_STRING (string); length = PyBytes_GET_SIZE (string); #else output = PyString_AsString (string); @@ -358,8 +358,8 @@ print_string_repr (PyObject *printer, const char *hint, type = builtin_type (gdbarch)->builtin_char; if (hint && !strcmp (hint, "string")) - LA_PRINT_STRING (stream, type, output, length, NULL, - 0, options); + LA_PRINT_STRING (stream, type, (gdb_byte *) output, + length, NULL, 0, options); else fputs_filtered (output, stream); } @@ -634,7 +634,7 @@ print_children (PyObject *printer, const char *hint, } else if (gdbpy_is_string (py_v)) { - gdb_byte *output; + char *output; output = python_string_to_host_string (py_v); if (!output) diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c index 11cc038..2cbb0cb 100644 --- a/gdb/python/py-value.c +++ b/gdb/python/py-value.c @@ -421,7 +421,8 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw) GDB_PY_HANDLE_EXCEPTION (except); encoding = (user_encoding && *user_encoding) ? user_encoding : la_encoding; - unicode = PyUnicode_Decode (buffer, length * TYPE_LENGTH (char_type), + unicode = PyUnicode_Decode ((const char *) buffer, + length * TYPE_LENGTH (char_type), encoding, errors); xfree (buffer);