* [RFA] Add one "const" keyword
@ 2002-09-12 16:51 Joel Brobecker
2002-09-12 17:13 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2002-09-12 16:51 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 464 bytes --]
This is a preliminary cleanup before I (re)submit a new architecture
field (see http://sources.redhat.com/ml/gdb-patches/2002-09/msg00215.html)
2002-09-12 Joel Brobecker <brobecker@gnat.com>
* value.h (find_function_in_inferior): Add const keyword to
one of the parameters. Allows us to invoke this function with
a const char *.
* valops.c (find_function_in_inferior): Likewise.
Tested on Linux. Ok to apply?
Thanks,
--
Joel
[-- Attachment #2: const.diff --]
[-- Type: text/plain, Size: 1607 bytes --]
Index: value.h
===================================================================
RCS file: /cvs/src/src/gdb/value.h,v
retrieving revision 1.33
diff -c -3 -p -r1.33 value.h
*** value.h 1 Aug 2002 17:18:33 -0000 1.33
--- value.h 12 Sep 2002 23:46:46 -0000
*************** extern struct value *value_literal_compl
*** 558,564 ****
extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
int *, int *);
! extern struct value *find_function_in_inferior (char *);
extern struct value *value_allocate_space_in_inferior (int);
--- 558,564 ----
extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
int *, int *);
! extern struct value *find_function_in_inferior (const char *);
extern struct value *value_allocate_space_in_inferior (int);
Index: valops.c
===================================================================
RCS file: /cvs/src/src/gdb/valops.c,v
retrieving revision 1.69
diff -c -3 -p -r1.69 valops.c
*** valops.c 21 Aug 2002 17:24:31 -0000 1.69
--- valops.c 12 Sep 2002 23:46:48 -0000
*************** int unwind_on_signal_p = 0;
*** 95,101 ****
/* Find the address of function name NAME in the inferior. */
struct value *
! find_function_in_inferior (char *name)
{
register struct symbol *sym;
sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
--- 95,101 ----
/* Find the address of function name NAME in the inferior. */
struct value *
! find_function_in_inferior (const char *name)
{
register struct symbol *sym;
sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Add one "const" keyword
2002-09-12 16:51 [RFA] Add one "const" keyword Joel Brobecker
@ 2002-09-12 17:13 ` Andrew Cagney
2002-09-12 17:28 ` Joel Brobecker
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-09-12 17:13 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
> This is a preliminary cleanup before I (re)submit a new architecture
> field (see http://sources.redhat.com/ml/gdb-patches/2002-09/msg00215.html)
>
> 2002-09-12 Joel Brobecker <brobecker@gnat.com>
>
> * value.h (find_function_in_inferior): Add const keyword to
> one of the parameters. Allows us to invoke this function with
> a const char *.
> * valops.c (find_function_in_inferior): Likewise.
>
> Tested on Linux. Ok to apply?
Getting GDB to compile with:
-Wwrite-strings
Give string constants the type const char[length]
so that copying the address of one into a non-const
char * pointer will get a warning. These warnings
will help you find at compile time code that can
try to write into a string constant, but only if
you have been very careful about using const in
declarations and prototypes. Otherwise, it will
just be a nuisance; this is why we did not make
`-Wall' request these warnings.
is a [very] long term goal. So yes, obvious.
Andrew
> Index: value.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/value.h,v
> retrieving revision 1.33
> diff -c -3 -p -r1.33 value.h
> *** value.h 1 Aug 2002 17:18:33 -0000 1.33
> --- value.h 12 Sep 2002 23:46:46 -0000
> *************** extern struct value *value_literal_compl
> *** 558,564 ****
> extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
> int *, int *);
>
> ! extern struct value *find_function_in_inferior (char *);
>
> extern struct value *value_allocate_space_in_inferior (int);
>
> --- 558,564 ----
> extern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
> int *, int *);
>
> ! extern struct value *find_function_in_inferior (const char *);
>
> extern struct value *value_allocate_space_in_inferior (int);
>
> Index: valops.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valops.c,v
> retrieving revision 1.69
> diff -c -3 -p -r1.69 valops.c
> *** valops.c 21 Aug 2002 17:24:31 -0000 1.69
> --- valops.c 12 Sep 2002 23:46:48 -0000
> *************** int unwind_on_signal_p = 0;
> *** 95,101 ****
> /* Find the address of function name NAME in the inferior. */
>
> struct value *
> ! find_function_in_inferior (char *name)
> {
> register struct symbol *sym;
> sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
> --- 95,101 ----
> /* Find the address of function name NAME in the inferior. */
>
> struct value *
> ! find_function_in_inferior (const char *name)
> {
> register struct symbol *sym;
> sym = lookup_symbol (name, 0, VAR_NAMESPACE, 0, NULL);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Add one "const" keyword
2002-09-12 17:13 ` Andrew Cagney
@ 2002-09-12 17:28 ` Joel Brobecker
2002-09-12 17:43 ` Andrew Cagney
0 siblings, 1 reply; 4+ messages in thread
From: Joel Brobecker @ 2002-09-12 17:28 UTC (permalink / raw)
To: Andrew Cagney; +Cc: gdb-patches
> >2002-09-12 Joel Brobecker <brobecker@gnat.com>
> >
> > * value.h (find_function_in_inferior): Add const keyword to
> > one of the parameters. Allows us to invoke this function with
> > a const char *.
> > * valops.c (find_function_in_inferior): Likewise.
>
> So yes, obvious.
Thank you, it's in.
BTW: Would it be worth having a page with a list of easy changes that
could help the gdb project? This one would qualify, and being able to
compile with -WWwrite-strings would be quite useful. I remember when I
was doing my military service (this stopped being an obligation only a
few years after I did mine) that I found myself with a lot of free time.
I moved my computer on my desk, and I was wondering how I could
contribute back to the free software community, to say thank you. I
looked at helping on certain projects I was interested in, but ended up
creating GtkAda with another friend of mine, as most of the assignments
I would be able to get from the already existing projects seemed a bit
too hard as a first step in the project. Maybe a page with such a list
of easy changes for some people looking for some ways to contribute
would help? Just some out of the box thinking...
--
Joel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] Add one "const" keyword
2002-09-12 17:28 ` Joel Brobecker
@ 2002-09-12 17:43 ` Andrew Cagney
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-09-12 17:43 UTC (permalink / raw)
To: Joel Brobecker; +Cc: gdb-patches
> 2002-09-12 Joel Brobecker <brobecker@gnat.com>
>> >
>> > * value.h (find_function_in_inferior): Add const keyword to
>> > one of the parameters. Allows us to invoke this function with
>> > a const char *.
>> > * valops.c (find_function_in_inferior): Likewise.
>
>>
>> So yes, obvious.
>
>
> Thank you, it's in.
>
> BTW: Would it be worth having a page with a list of easy changes that
> could help the gdb project? This one would qualify, and being able to
> compile with -WWwrite-strings would be quite useful. I remember when I
> was doing my military service (this stopped being an obligation only a
> few years after I did mine) that I found myself with a lot of free time.
> I moved my computer on my desk, and I was wondering how I could
> contribute back to the free software community, to say thank you. I
> looked at helping on certain projects I was interested in, but ended up
> creating GtkAda with another friend of mine, as most of the assignments
> I would be able to get from the already existing projects seemed a bit
> too hard as a first step in the project. Maybe a page with such a list
> of easy changes for some people looking for some ways to contribute
> would help? Just some out of the box thinking...
I think the best starting point is the bug database (under change
request). Some of the GDB developers activly monitor it (Some don't
though :-( ). After that, the ARI, but I tend to save that one for
rainy days :-)
Neither of these are sorted in ``easyness'' order though :-(
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-09-13 0:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12 16:51 [RFA] Add one "const" keyword Joel Brobecker
2002-09-12 17:13 ` Andrew Cagney
2002-09-12 17:28 ` Joel Brobecker
2002-09-12 17:43 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox