From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24740 invoked by alias); 19 Sep 2008 14:13:20 -0000 Received: (qmail 24726 invoked by uid 22791); 19 Sep 2008 14:13:19 -0000 X-Spam-Check-By: sourceware.org Received: from smtp.nokia.com (HELO mgw-mx06.nokia.com) (192.100.122.233) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 19 Sep 2008 14:12:45 +0000 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id m8JECEFo020885 for ; Fri, 19 Sep 2008 17:12:40 +0300 Received: from vaebh102.NOE.Nokia.com ([10.160.244.23]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 19 Sep 2008 17:12:23 +0300 Received: from gar.local ([172.25.167.168]) by vaebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 19 Sep 2008 17:12:09 +0300 From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: gdb-patches@sources.redhat.com Subject: Re: gdb sources Date: Fri, 19 Sep 2008 14:13:00 -0000 User-Agent: KMail/1.9.9 References: <200809121713.09226.apoenitz@trolltech.com> <20080912153534.GA13672@caradoc.them.org> In-Reply-To: <20080912153534.GA13672@caradoc.them.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_HN70IrDn77/N6/a" Message-Id: <200809191612.23617.apoenitz@trolltech.com> X-Nokia-AV: Clean X-IsSubscribed: yes 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 X-SW-Source: 2008-09/txt/msg00409.txt.bz2 --Boundary-00=_HN70IrDn77/N6/a Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 1173 On Friday 12 September 2008 17:35:34 Daniel Jacobowitz wrote: > On Fri, Sep 12, 2008 at 05:12:50PM +0200, Andr=E9 P=F6nitz wrote: > > [...] > > (2) Most of the "strings" in gdb are "char *", even if they are > > conceptionally "const char *" (i.e. coming from literal, or not > > intended to be changed). Why? In some places "const" is also > > used, so the reason can't be "gdb supports compilers that > > don't know about 'const'". Is it "just legacy"? If so, would patches > > replacing "char *" by "const char *" if appropriate be welcome? >=20 > Yes, constifying patches are welcome. It's just that gdb _used_ to > support compilers that didn't know const, and may even predate > const in places. Ok. Something tiny attached for starters. It is as harmless as it can be. I hope this is uncontroversial, but before going further into this direction I have two related questions: 1. How would the prefered way to call, say, xfree on a 'conceptionally con= st char *' item look like? Are casts to non-const (void *) acceptable here? 2. Recording every such change in the ChangeLog basically duplicates the work. Are there any shortcuts available/acceptable? Andre' --Boundary-00=_HN70IrDn77/N6/a Content-Type: text/x-diff; charset="iso-8859-1"; name="1" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="1" Content-length: 2958 Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.9826 diff -r1.9826 ChangeLog 0a1,15 > > 2008-09-19 Andre Poenitz > > * symfile.c (allocate_symtab): Accept a const argument. > * symfile.c (allocate_psymtab): Likewise. > * symfile.c (free_named_symtabs): Likewise. > * symfile.c (deduce_language_from_filename): Likewise. > > * symfile.h (allocate_symtab): Update prototype. > * symfile.h (allocate_psymtab): Likewise. > * symfile.h (free_named_symtabs): Likewise. > * symtab.h (deduce_language_from_filename): Likewise. > > * i386-tdep.c (i386_analyze_stack_align): Fix typo in comment. > Index: i386-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/i386-tdep.c,v retrieving revision 1.266 diff -r1.266 i386-tdep.c 787c787 < /* Rigister can't be %esp nor %ebp. */ --- > /* Register can't be %esp nor %ebp. */ Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.215 diff -r1.215 symfile.c 1547c1547 < /* Make C the default language */ --- > /* Make C the default language. */ 2688c2688 < deduce_language_from_filename (char *filename) --- > deduce_language_from_filename (const char *filename) 2691c2691 < char *cp; --- > const char *cp; 2717c2717 < allocate_symtab (char *filename, struct objfile *objfile) --- > allocate_symtab (const char *filename, struct objfile *objfile) 2741c2741 < allocate_psymtab (char *filename, struct objfile *objfile) --- > allocate_psymtab (const char *filename, struct objfile *objfile) 2949c2949 < free_named_symtabs (char *name) --- > free_named_symtabs (const char *name) 3055c3055 < struct section_offsets *section_offsets, char *filename, --- > struct section_offsets *section_offsets, const char *filename, Index: symfile.h =================================================================== RCS file: /cvs/src/src/gdb/symfile.h,v retrieving revision 1.48 diff -r1.48 symfile.h 206c206 < extern struct symtab *allocate_symtab (char *, struct objfile *); --- > extern struct symtab *allocate_symtab (const char *, struct objfile *); 208c208 < extern int free_named_symtabs (char *); --- > extern int free_named_symtabs (const char *); 252c252 < char *, CORE_ADDR, --- > const char *, CORE_ADDR, 302c302 < extern struct partial_symtab *allocate_psymtab (char *, struct objfile *); --- > extern struct partial_symtab *allocate_psymtab (const char *, struct objfile *); Index: symtab.h =================================================================== RCS file: /cvs/src/src/gdb/symtab.h,v retrieving revision 1.131 diff -r1.131 symtab.h 1277c1277 < extern enum language deduce_language_from_filename (char *); --- > extern enum language deduce_language_from_filename (const char *); --Boundary-00=_HN70IrDn77/N6/a--