From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26902 invoked by alias); 4 Jun 2014 18:13:46 -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 26890 invoked by uid 89); 4 Jun 2014 18:13:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 04 Jun 2014 18:13:43 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 18645116194; Wed, 4 Jun 2014 14:13:42 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id q8GIydQ+bVzP; Wed, 4 Jun 2014 14:13:42 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 63FE611618E; Wed, 4 Jun 2014 14:13:40 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 7829940EB2; Wed, 4 Jun 2014 11:13:42 -0700 (PDT) Date: Wed, 04 Jun 2014 18:13:00 -0000 From: Joel Brobecker To: Siva Chandra Cc: gdb-patches , Doug Evans , uweigand@de.ibm.com Subject: Re: [PATCH] Fix py-xmethods.c when compiled with -Werror against Python 2.4 Message-ID: <20140604181342.GW4289@adacore.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-06/txt/msg00200.txt.bz2 > Does the attached patch fix the issue pointed out by Ulrich Weigand > here: https://sourceware.org/ml/gdb-patches/2014-06/msg00169.html > > ChangeLog > 2014-06-04 Siva Chandra Reddy > > * python/py-xmethods.c (invoke_match_method) > (gdbpy_get_matching_xmethod_workers, gdbpy_get_xmethod_arg_types): > Cast the second arg to PyObject_GetAttrString and > PyObject_GetAttrString to char *. I can't tell whether it fixes the problem - it should! - but looking at the patch, I think some lines might have become longer than 80 characters... Also, it'd be nice to answer Ulrich's question regarding the use of the constants - whether it might make sense to use the string directly? Looking at the code, I think that it would be to avoid duplicating that string? enabled_field_name is only used once, but then you'd probably use the constant for ... consistency (;-)). > diff --git a/gdb/python/py-xmethods.c b/gdb/python/py-xmethods.c > index 0062b2d..5ba146f 100644 > --- a/gdb/python/py-xmethods.c > +++ b/gdb/python/py-xmethods.c > @@ -106,7 +106,7 @@ invoke_match_method (PyObject *matcher, PyObject *py_obj_type, > > cleanups = make_cleanup (null_cleanup, NULL); > > - enabled_field = PyObject_GetAttrString (matcher, enabled_field_name); > + enabled_field = PyObject_GetAttrString (matcher, (char *) enabled_field_name); > if (enabled_field == NULL) > { > do_cleanups (cleanups); > @@ -127,7 +127,7 @@ invoke_match_method (PyObject *matcher, PyObject *py_obj_type, > Py_RETURN_NONE; > } > > - match_method = PyObject_GetAttrString (matcher, match_method_name); > + match_method = PyObject_GetAttrString (matcher, (char *) match_method_name); > if (match_method == NULL) > { > do_cleanups (cleanups); > @@ -252,13 +252,13 @@ gdbpy_get_matching_xmethod_workers > > /* Gather debug method matchers registered globally. */ > if (gdb_python_module != NULL > - && PyObject_HasAttrString (gdb_python_module, matchers_attr_str)) > + && PyObject_HasAttrString (gdb_python_module, (char *) matchers_attr_str)) > { > PyObject *gdb_matchers; > PyObject *temp = py_xmethod_matcher_list; > > gdb_matchers = PyObject_GetAttrString (gdb_python_module, > - matchers_attr_str); > + (char *) matchers_attr_str); > if (gdb_matchers != NULL) > { > py_xmethod_matcher_list = PySequence_Concat (temp, gdb_matchers); > @@ -391,8 +391,8 @@ gdbpy_get_xmethod_arg_types (const struct extension_language_defn *extlang, > > cleanups = ensure_python_env (get_current_arch (), current_language); > > - get_arg_types_method = PyObject_GetAttrString (py_worker, > - get_arg_types_method_name); > + get_arg_types_method = PyObject_GetAttrString > + (py_worker, (char *) get_arg_types_method_name); > if (get_arg_types_method == NULL) > { > gdbpy_print_stack (); -- Joel