This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb sources
On Friday 19 September 2008 16:44:22 Daniel Jacobowitz wrote:
> It looks like you don't have a copyright assignment or employer
> disclaimer on file. Is that correct? If so, we should sort it out
> now before you contribute anything larger.
Working on that already. Might take a while, though.
The stuff in question is certainly well below any reasonable threshold
of "original art", though, but I see the problem.
> > 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?
>
> Probably acceptable, but if you know it is allocated by xfree, should
> it really be returned as const?
The problem will come up with "char *" struct members pointing to
"names" of all sorts. They could arguably be "const char *" as they
usually aren't touched between construction and destruction to
get a compiler warning if something tries to modify them nevertheless.
But then, those members could stay non-const...
> > the work. Are there any shortcuts available/acceptable?
>
> If you have to update the call sites, you can say "all callers
> updated" or something like that in the changelog entry, though if any
> of the changes are more than mechanical then it's better to list
> the complicated ones explicitly. But for just a change to a prototype
> and a definition, I think the changelog entry is still appropriate.
>
> BTW, your changelog is too verbose in another way; there is normally
> only one starred entry for a file and you can combine similar changes.
> Like this:
>
> * symfile.c (allocate_symtab, allocate_psymtab, free_named_symtabs)
> (deduce_language_from_filename): Accept a const argument.
Ok.
> Please use diff -up for patches; with the default diff arguments, it's
> impossible to see what you've changed.
I intented to do that but I somehow fumbled. Next try attached.
Andre'
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.9826
diff -u -p -r1.9826 ChangeLog
--- ChangeLog 17 Sep 2008 21:48:48 -0000 1.9826
+++ ChangeLog 19 Sep 2008 15:11:01 -0000
@@ -1,3 +1,18 @@
+
+2008-09-19 Andre Poenitz <apoenitz@trolltech.com>
+
+ * symfile.c (allocate_symtab,allocate_psymtab): Accept a const argument.
+ (allocate_psymtab): Likewise.
+ (free_named_symtabs): Likewise.
+ (deduce_language_from_filename): Likewise.
+
+ * symfile.h (allocate_symtab): Update prototype.
+ (allocate_psymtab): Likewise.
+ (free_named_symtabs): Likewise.
+ * symtab.h (deduce_language_from_filename): Likewise.
+
+ * i386-tdep.c (i386_analyze_stack_align): Fix typo in comment.
+
2008-09-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix a crash on uninitialized ECS->EVENT_THREAD for a newly found thread.
Index: i386-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-tdep.c,v
retrieving revision 1.266
diff -u -p -r1.266 i386-tdep.c
--- i386-tdep.c 11 Sep 2008 14:23:15 -0000 1.266
+++ i386-tdep.c 19 Sep 2008 15:11:15 -0000
@@ -784,7 +784,7 @@ i386_analyze_stack_align (CORE_ADDR pc,
offset = 5;
}
- /* Rigister can't be %esp nor %ebp. */
+ /* Register can't be %esp nor %ebp. */
if (reg == 4 || reg == 5)
return pc;
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.215
diff -u -p -r1.215 symfile.c
--- symfile.c 13 Sep 2008 17:28:56 -0000 1.215
+++ symfile.c 19 Sep 2008 15:11:30 -0000
@@ -1544,7 +1544,7 @@ set_initial_language (void)
if (lang == language_unknown)
{
- /* Make C the default language */
+ /* Make C the default language. */
lang = language_c;
}
@@ -2685,10 +2685,10 @@ init_filename_language_table (void)
}
enum language
-deduce_language_from_filename (char *filename)
+deduce_language_from_filename (const char *filename)
{
int i;
- char *cp;
+ const char *cp;
if (filename != NULL)
if ((cp = strrchr (filename, '.')) != NULL)
@@ -2714,7 +2714,7 @@ deduce_language_from_filename (char *fil
*/
struct symtab *
-allocate_symtab (char *filename, struct objfile *objfile)
+allocate_symtab (const char *filename, struct objfile *objfile)
{
struct symtab *symtab;
@@ -2738,7 +2738,7 @@ allocate_symtab (char *filename, struct
}
struct partial_symtab *
-allocate_psymtab (char *filename, struct objfile *objfile)
+allocate_psymtab (const char *filename, struct objfile *objfile)
{
struct partial_symtab *psymtab;
@@ -2946,7 +2946,7 @@ cashier_psymtab (struct partial_symtab *
all stray pointers into the freed symtab. */
int
-free_named_symtabs (char *name)
+free_named_symtabs (const char *name)
{
#if 0
/* FIXME: With the new method of each objfile having it's own
@@ -3052,7 +3052,7 @@ again2:
struct partial_symtab *
start_psymtab_common (struct objfile *objfile,
- struct section_offsets *section_offsets, char *filename,
+ struct section_offsets *section_offsets, const char *filename,
CORE_ADDR textlow, struct partial_symbol **global_syms,
struct partial_symbol **static_syms)
{
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.48
diff -u -p -r1.48 symfile.h
--- symfile.h 5 Sep 2008 11:37:17 -0000 1.48
+++ symfile.h 19 Sep 2008 15:11:30 -0000
@@ -203,9 +203,9 @@ extern void init_psymbol_list (struct ob
extern void sort_pst_symbols (struct partial_symtab *);
-extern struct symtab *allocate_symtab (char *, struct objfile *);
+extern struct symtab *allocate_symtab (const char *, struct objfile *);
-extern int free_named_symtabs (char *);
+extern int free_named_symtabs (const char *);
extern void add_symtab_fns (struct sym_fns *);
@@ -249,7 +249,7 @@ extern void free_section_addr_info (stru
extern struct partial_symtab *start_psymtab_common (struct objfile *,
struct section_offsets *,
- char *, CORE_ADDR,
+ const char *, CORE_ADDR,
struct partial_symbol **,
struct partial_symbol **);
@@ -299,7 +299,7 @@ extern int auto_solib_limit;
extern void set_initial_language (void);
-extern struct partial_symtab *allocate_psymtab (char *, struct objfile *);
+extern struct partial_symtab *allocate_psymtab (const char *, struct objfile *);
extern void discard_psymtab (struct partial_symtab *);
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.131
diff -u -p -r1.131 symtab.h
--- symtab.h 5 Sep 2008 11:37:17 -0000 1.131
+++ symtab.h 19 Sep 2008 15:11:30 -0000
@@ -1274,7 +1274,7 @@ extern struct symtab_and_line find_funct
extern void clear_symtab_users (void);
-extern enum language deduce_language_from_filename (char *);
+extern enum language deduce_language_from_filename (const char *);
/* symtab.c */