[PATCH] constify to_attach

Joel Brobecker brobecker@adacore.com
Wed May 21 21:22:00 GMT 2014


> I also wanted to note that I checked all the functions for forward
> declarations as well.
> 
> Tom
> 
> 2014-05-21  Tom Tromey  <tromey@redhat.com>
> 
> 	* procfs.c (procfs_attach): Make "args" const.
> 	* windows-nat.c (windows_attach): Make "args" const.
> 	* nto-procfs.c (procfs_attach): Make "args" const.
> 	* inf-ttrace.c (inf_ttrace_attach): Make "args" const.
> 	* go32-nat.c (go32_attach): Make "args" const.
> 	* gnu-nat.c (gnu_attach): Make "args" const.
> 	* darwin-nat.c (darwin_attach): Make "args" const.
> 	* inf-ptrace.c (inf_ptrace_attach): Make "args" const.
> 	* linux-nat.c (linux_nat_attach): Make "args" const.
> 	* remote.c (extended_remote_attach_1, extended_remote_attach):
> 	Make "args" const.
> 	* target.h (struct target_ops) <to_attach>: Make "args" const.
> 	(find_default_attach): Likewise.
> 	* utils.c (parse_pid_to_attach): Make "args" const.
> 	* utils.h (parse_pid_to_attach): Update.

I tried a few different ways to see if we may have missed any other
files, and came up empty, so hopefully you nailed them all.

For this sort of search, it would be helpful to have a convention
that we either use var->method to set the field, or else put the name
of the field in comment next to the assignment like we do with
the language vector. That really makes it easier to find them;
otherwise, one has to use code analyzers, which sometimes don't
work when you can't compile the file first.

Patch looks good to me!
-- 
Joel



More information about the Gdb-patches mailing list