From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5133 invoked by alias); 16 Jan 2014 19:31:06 -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 5124 invoked by uid 89); 16 Jan 2014 19:31:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 16 Jan 2014 19:31:04 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 6B.B8.23183.47338D25; Thu, 16 Jan 2014 20:31:00 +0100 (CET) Received: from [142.133.110.254] (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 16 Jan 2014 14:31:02 -0500 Message-ID: <52D8338F.2060800@ericsson.com> Date: Thu, 16 Jan 2014 19:31:00 -0000 From: Simon Marchi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Pedro Alves CC: GDB Patches Subject: Re: [PATCH] Add comments to gdbarch_address_class_name_to_type_flags References: <52D8293B.6060701@ericsson.com> <52D82EDF.5010402@redhat.com> In-Reply-To: <52D82EDF.5010402@redhat.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00648.txt.bz2 On 14-01-16 02:11 PM, Pedro Alves wrote: > On 01/16/2014 06:47 PM, Simon Marchi wrote: >> +/* Return the appropriate type_flags for the supplied address class. >> + This function should return 1 if the address class was recognized and >> + type_flags was set, zero otherwise. > > Say true/false instead of 1/zero. > >> + No assumption should be made about the initial value of *type_flags_ptr, >> + which means that if it returns 1, the function should write it, even if >> + no flags are set. */ > > This makes me a little confused. This is a mapping/conversion function: > > class name -> type flags > > I'd expect the function to recognize the name, and return a valid flag > (thus return true), or not recognize the name, and return false. > > What would "even if no flags are set" mean? What's the use case for that? > Recognizing a class name, but having that map to no flags? As in, > ignoring the class name? Is that useful? In our case, address classes are used for multiple memory spaces support. For completeness sake, I wanted to allow the user to specify that a variable is in the default address space, for those who like to be explicit. An address in the default space would cause no flag to be set. So yeah, this is a little far fetched and arguable, so probably doesn't need to be mentioned here. The part "No assumption should be made about the initial value of *type_flags_ptr" is still important I think, so that people know that you should not just OR your flags, but overwrite the whole content. Simon