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]

PATCH to gdb/ada-lang.c


This patch is prompted by a build failure

/home/gdr/redhat/src/gdb/ada-lang.c: In function 'ada_lookup_symbol_list':
/home/gdr/redhat/src/gdb/ada-lang.c:4659: warning: passing argument 3 of 'remove_out_of_scope_renamings' discards qualifiers from pointer target type

with SVN GCC and CVS GDB.  The real issue is a bug in GCC, reported here

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30743

However, looking at the code, it appears that the function
remove_out_of_scope_renamings does not modify the object pointed to by
its thirs parameter.  Consequently the third parameter type should be
a pointer to const struct block.  That removes the "need" for a cast
in ada_lookup_symbol_list.

OK?

-- Gaby
2007-02-09  Gabriel Dos Reis  <gdr@integrable-solutions.net>

	* ada-lang.c (remove_out_of_scope_renamings): Change third parameter's
	type to a pointer to const struct block.
	(ada_lookup_symbol_list): Don't cast away constness when calling
	remove_out_of_scope_renamings.

Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.92
diff -p -r1.92 ada-lang.c
*** ada-lang.c	26 Jan 2007 21:31:05 -0000	1.92
--- ada-lang.c	9 Feb 2007 12:00:33 -0000
*************** renaming_is_visible (const struct symbol
*** 4419,4425 ****
  
  static int
  remove_out_of_scope_renamings (struct ada_symbol_info *syms,
!                                int nsyms, struct block *current_block)
  {
    struct symbol *current_function;
    char *current_function_name;
--- 4419,4425 ----
  
  static int
  remove_out_of_scope_renamings (struct ada_symbol_info *syms,
!                                int nsyms, const struct block *current_block)
  {
    struct symbol *current_function;
    char *current_function_name;
*************** done:
*** 4656,4663 ****
      cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block,
                    (*results)[0].symtab);
  
!   ndefns = remove_out_of_scope_renamings (*results, ndefns,
!                                           (struct block *) block0);
  
    return ndefns;
  }
--- 4656,4662 ----
      cache_symbol (name0, namespace, (*results)[0].sym, (*results)[0].block,
                    (*results)[0].symtab);
  
!   ndefns = remove_out_of_scope_renamings (*results, ndefns, block0);
  
    return ndefns;
  }


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