This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gdb sources


On Friday 12 September 2008 17:35:34 Daniel Jacobowitz wrote:
> On Fri, Sep 12, 2008 at 05:12:50PM +0200, André Pönitz 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?
> 
> 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 const
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'
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  <apoenitz@trolltech.com>
> 
> 	* 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 *);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]