From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18094 invoked by alias); 13 Sep 2002 00:13:57 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18083 invoked from network); 13 Sep 2002 00:13:57 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 13 Sep 2002 00:13:57 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 42E2D3C44; Thu, 12 Sep 2002 20:13:54 -0400 (EDT) Message-ID: <3D812DC2.6030001@ges.redhat.com> Date: Thu, 12 Sep 2002 17:13:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020824 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joel Brobecker Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Add one "const" keyword References: <20020912235127.GM1105@gnat.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-09/txt/msg00224.txt.bz2 > This is a preliminary cleanup before I (re)submit a new architecture > field (see http://sources.redhat.com/ml/gdb-patches/2002-09/msg00215.html) > > 2002-09-12 Joel Brobecker > > * value.h (find_function_in_inferior): Add const keyword to > one of the parameters. Allows us to invoke this function with > a const char *. > * valops.c (find_function_in_inferior): Likewise. > > Tested on Linux. Ok to apply? Getting GDB to compile with: -Wwrite-strings Give string constants the type const char[length] so that copying the address of one into a non-const char * pointer will get a warning. These warnings will help you find at compile time code that can try to write into a string constant, but only if you have been very careful about using const in declarations and prototypes. Otherwise, it will just be a nuisance; this is why we did not make `-Wall' request these warnings. is a [very] long term goal. So yes, obvious. Andrew > Index: value.h > =================================================================== > RCS file: /cvs/src/src/gdb/value.h,v > retrieving revision 1.33 > diff -c -3 -p -r1.33 value.h > *** value.h 1 Aug 2002 17:18:33 -0000 1.33 > --- value.h 12 Sep 2002 23:46:46 -0000 > *************** extern struct value *value_literal_compl > *** 558,564 **** > extern void find_rt_vbase_offset (struct type *, struct type *, char *, int, > int *, int *); > > ! extern struct value *find_function_in_inferior (char *); > > extern struct value *value_allocate_space_in_inferior (int); > > --- 558,564 ---- > extern void find_rt_vbase_offset (struct type *, struct type *, char *, int, > int *, int *); > > ! extern struct value *find_function_in_inferior (const char *); > > extern struct value *value_allocate_space_in_inferior (int); > > Index: valops.c > =================================================================== > RCS file: /cvs/src/src/gdb/valops.c,v > retrieving revision 1.69 > diff -c -3 -p -r1.69 valops.c > *** valops.c 21 Aug 2002 17:24:31 -0000 1.69 > --- valops.c 12 Sep 2002 23:46:48 -0000 > *************** int unwind_on_signal_p = 0; > *** 95,101 **** > /* Find the address of function name NAME in the inferior. */ > > struct value * > ! find_function_in_inferior (char *name) > { > register struct symbol *sym; > sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL); > --- 95,101 ---- > /* Find the address of function name NAME in the inferior. */ > > struct value * > ! find_function_in_inferior (const char *name) > { > register struct symbol *sym; > sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);