public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* -Wformat
@ 2003-08-01 15:49 David Carlton
  2003-08-01 16:08 ` -Wformat Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-08-01 15:49 UTC (permalink / raw)
  To: gdb; +Cc: Andrew Cagney

I just downloaded mainline GDB for the first time in far too long, and
the recent -Wformat-nonliteral change breaks -Werror for me (compiling
with GCC 3.2.3).  I'll include the stderr output of 'make -k' from
within gdb/ after my signature; I haven't investigated them
thoroughly, but what I've look at makes me think that
-Wformat-nonliteral isn't a good idea.

David Carlton
carlton@kealia.com

cc1: warnings being treated as errors
breakpoint.c: In function `insert_breakpoints':
breakpoint.c:916: warning: format not a string literal, argument types not checked
breakpoint.c: In function `bpstat_stop_status':
breakpoint.c:2612: warning: format not a string literal, argument types not checked
breakpoint.c: In function `delete_breakpoint':
breakpoint.c:6545: warning: format not a string literal, argument types not checked
breakpoint.c: In function `breakpoint_re_set':
breakpoint.c:6948: warning: format not a string literal, argument types not checked
make: *** [breakpoint.o] Error 1
cc1: warnings being treated as errors
charset.c: In function `cached_iconv_convert':
charset.c:449: warning: format not a string literal, argument types not checked
make: *** [charset.o] Error 1
cc1: warnings being treated as errors
source.c: In function `forward_search_command':
source.c:1364: warning: format not a string literal and no format arguments
source.c: In function `reverse_search_command':
source.c:1460: warning: format not a string literal and no format arguments
make: *** [source.o] Error 1
cc1: warnings being treated as errors
valprint.c: In function `print_longest':
valprint.c:331: warning: format not a string literal, argument types not checked
valprint.c:340: warning: format not a string literal, argument types not checked
valprint.c:346: warning: format not a string literal, argument types not checked
valprint.c:349: warning: format not a string literal, argument types not checked
valprint.c:352: warning: format not a string literal, argument types not checked
valprint.c:355: warning: format not a string literal, argument types not checked
valprint.c:358: warning: format not a string literal, argument types not checked
valprint.c: In function `print_floating':
valprint.c:455: warning: format not a string literal and no format arguments
valprint.c:456: warning: format not a string literal and no format arguments
valprint.c:457: warning: format not a string literal and no format arguments
valprint.c: In function `print_binary_chars':
valprint.c:518: warning: format not a string literal and no format arguments
valprint.c:556: warning: format not a string literal and no format arguments
valprint.c: In function `print_octal_chars':
valprint.c:605: warning: format not a string literal and no format arguments
valprint.c:704: warning: format not a string literal and no format arguments
valprint.c: In function `print_decimal_chars':
valprint.c:747: warning: format not a string literal and no format arguments
valprint.c:844: warning: format not a string literal and no format arguments
valprint.c: In function `print_hex_chars':
valprint.c:856: warning: format not a string literal and no format arguments
valprint.c:875: warning: format not a string literal and no format arguments
make: *** [valprint.o] Error 1
cc1: warnings being treated as errors
printcmd.c: In function `print_scalar_formatted':
printcmd.c:510: warning: format not a string literal and no format arguments
printcmd.c: In function `printf_command':
printcmd.c:1973: warning: format not a string literal, argument types not checked
printcmd.c:1979: warning: format not a string literal, argument types not checked
printcmd.c:1986: warning: format not a string literal, argument types not checked
printcmd.c:1996: warning: format not a string literal, argument types not checked
printcmd.c:2006: warning: format not a string literal and no format arguments
make: *** [printcmd.o] Error 1
cc1: warnings being treated as errors
infcall.c: In function `call_function_by_hand':
infcall.c:944: warning: format not a string literal, argument types not checked
make: *** [infcall.o] Error 1
cc1: warnings being treated as errors
event-top.c: In function `command_line_handler':
event-top.c:615: warning: format not a string literal and no format arguments
make: *** [event-top.o] Error 1
cc1: warnings being treated as errors
linux-proc.c: In function `linux_info_proc_cmd':
linux-proc.c:424: warning: format not a string literal, argument types not checked
linux-proc.c:434: warning: format not a string literal, argument types not checked
linux-proc.c:449: warning: format not a string literal and no format arguments
make: *** [linux-proc.o] Error 1
cc1: warnings being treated as errors
remote.c: In function `remote_cisco_section_offsets':
remote.c:2074: warning: format not a string literal and no format arguments
make: *** [remote.o] Error 1
cc1: warnings being treated as errors
language.c: In function `op_error':
language.c:1186: warning: format not a string literal, argument types not checked
language.c:1189: warning: format not a string literal, argument types not checked
make: *** [language.o] Error 1
cc1: warnings being treated as errors
p-typeprint.c: In function `pascal_type_print_base':
p-typeprint.c:464: warning: format not a string literal and no format arguments
make: *** [p-typeprint.o] Error 1
cc1: warnings being treated as errors
p-valprint.c: In function `pascal_object_print_class_method':
p-valprint.c:664: warning: format not a string literal and no format arguments
p-valprint.c: In function `pascal_object_print_class_member':
p-valprint.c:1083: warning: format not a string literal and no format arguments
make: *** [p-valprint.o] Error 1
cc1: warnings being treated as errors
cp-valprint.c: In function `cp_print_class_method':
cp-valprint.c:146: warning: format not a string literal and no format arguments
cp-valprint.c: In function `cp_print_class_member':
cp-valprint.c:723: warning: format not a string literal and no format arguments
make: *** [cp-valprint.o] Error 1
cc1: warnings being treated as errors
top.c: In function `command_line_input':
top.c:1205: warning: format not a string literal and no format arguments
top.c:1226: warning: format not a string literal and no format arguments
top.c: In function `get_prompt_1':
top.c:1509: warning: format not a string literal, argument types not checked
top.c:1541: warning: format not a string literal, argument types not checked
top.c:1553: warning: format not a string literal, argument types not checked
top.c:1565: warning: format not a string literal, argument types not checked
top.c:1577: warning: format not a string literal, argument types not checked
top.c: In function `quit_confirm':
top.c:1689: warning: format not a string literal and no format arguments
make: *** [top.o] Error 1
cc1: warnings being treated as errors
utils.c: In function `vwarning':
utils.c:581: warning: format not a string literal and no format arguments
utils.c: In function `error_stream':
utils.c:647: warning: format not a string literal and no format arguments
utils.c: In function `quit':
utils.c:925: warning: format not a string literal and no format arguments
make: *** [utils.o] Error 1
cc1: warnings being treated as errors
cli/cli-script.c: In function `define_command':
cli/cli-script.c:1099: warning: format not a string literal, argument types not checked
make: *** [cli-script.o] Error 1
cc1: warnings being treated as errors
cli/cli-setshow.c: In function `do_setshow_command':
cli/cli-setshow.c:216: warning: format not a string literal and no format arguments
make: *** [cli-setshow.o] Error 1
cc1: warnings being treated as errors
mi/mi-cmd-env.c: In function `env_execute_cli_command':
mi/mi-cmd-env.c:56: warning: format not a string literal, argument types not checked
make: *** [mi-cmd-env.o] Error 1
cc1: warnings being treated as errors
mi/mi-main.c: In function `mi_error_last_message':
mi/mi-main.c:104: warning: format not a string literal and no format arguments
mi/mi-main.c: In function `mi_execute_cli_command':
mi/mi-main.c:1310: warning: format not a string literal, argument types not checked
make: *** [mi-main.o] Error 1
cc1: warnings being treated as errors
gdbtk/generic/gdbtk.c: In function `gdbtk_source_start_file':
gdbtk/generic/gdbtk.c:639: warning: format not a string literal and no format arguments
gdbtk/generic/gdbtk.c: In function `tk_command':
gdbtk/generic/gdbtk.c:734: warning: format not a string literal and no format arguments
gdbtk/generic/gdbtk.c: In function `view_command':
gdbtk/generic/gdbtk.c:756: warning: format not a string literal and no format arguments
make: *** [gdbtk.o] Error 1
make: Target `all' not remade because of errors.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 15:49 -Wformat David Carlton
@ 2003-08-01 16:08 ` Andrew Cagney
  2003-08-01 16:18   ` -Wformat David Carlton
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Cagney @ 2003-08-01 16:08 UTC (permalink / raw)
  To: David Carlton; +Cc: gdb

> I just downloaded mainline GDB for the first time in far too long, and
> the recent -Wformat-nonliteral change breaks -Werror for me (compiling
> with GCC 3.2.3).  I'll include the stderr output of 'make -k' from
> within gdb/ after my signature; I haven't investigated them
> thoroughly, but what I've look at makes me think that
> -Wformat-nonliteral isn't a good idea.

`works for me'.  I tested it with:
gcc version 2.95.3 20010315 (release) (NetBSD nb3)
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)

Looking at the first problem:

breakpoint.c: In function `insert_breakpoints':
breakpoint.c:916: warning: format not a string literal, argument types 
not checked

it revealed this little `gem':

   static char message1[] = "Error inserting catchpoint %d:\n";
   static char message[sizeof (message1) + 30];
	...
         sprintf (message, message1, b->number);

While getting the option working with a current GCC could mean more 
work, I'm not convinced that it's a bad idea.

Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:08 ` -Wformat Andrew Cagney
@ 2003-08-01 16:18   ` David Carlton
  2003-08-01 16:30     ` -Wformat Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-08-01 16:18 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Fri, 01 Aug 2003 12:07:26 -0400, Andrew Cagney <ac131313@redhat.com> said:

>> I just downloaded mainline GDB for the first time in far too long, and
>> the recent -Wformat-nonliteral change breaks -Werror for me (compiling
>> with GCC 3.2.3).  I'll include the stderr output of 'make -k' from
>> within gdb/ after my signature; I haven't investigated them
>> thoroughly, but what I've look at makes me think that
>> -Wformat-nonliteral isn't a good idea.

> `works for me'.  I tested it with:
> gcc version 2.95.3 20010315 (release) (NetBSD nb3)
> gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.2)

Actually, I lied slightly: I used GCC 3.2 Red Hat.  But I would assume
that any recent GCC would show this; the warnings are legitimate.

> Looking at the first problem:

> breakpoint.c: In function `insert_breakpoints':
> breakpoint.c:916: warning: format not a string literal, argument types
> not checked

> it revealed this little `gem':

>    static char message1[] = "Error inserting catchpoint %d:\n";
>    static char message[sizeof (message1) + 30];
> 	...
>          sprintf (message, message1, b->number);

Yup.  And further down in the log, you'll run into stuff like

  fprintf_filtered (stream, local_octal_format_prefix ());

which could easily be fixed by using fputs_filtered.

> While getting the option working with a current GCC could mean more
> work, I'm not convinced that it's a bad idea.

You're right: I was too pessimistic.  I just want the
-Wformat-nonliteral patch reverted in the meantime. :-) (Actually, if
you want to fix the warnings in question quickly, that's fine with me
too: I can easily revert it on my local tree.)

David Carlton
carlton@kealia.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:18   ` -Wformat David Carlton
@ 2003-08-01 16:30     ` Andrew Cagney
  2003-08-01 16:33       ` -Wformat Daniel Jacobowitz
  2003-08-01 16:46       ` -Wformat David Carlton
  0 siblings, 2 replies; 9+ messages in thread
From: Andrew Cagney @ 2003-08-01 16:30 UTC (permalink / raw)
  To: David Carlton; +Cc: gdb

> 
> Yup.  And further down in the log, you'll run into stuff like
> 
>   fprintf_filtered (stream, local_octal_format_prefix ());
> 
> which could easily be fixed by using fputs_filtered.

Outch, that's just bad.

>> While getting the option working with a current GCC could mean more
>> work, I'm not convinced that it's a bad idea.
> 
> 
> You're right: I was too pessimistic.  I just want the
> -Wformat-nonliteral patch reverted in the meantime. :-) (Actually, if
> you want to fix the warnings in question quickly, that's fine with me
> too: I can easily revert it on my local tree.)

But it `works for me'.  Can you fix the obvious ones and leave me with 
the messier problems, say?

Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:30     ` -Wformat Andrew Cagney
@ 2003-08-01 16:33       ` Daniel Jacobowitz
  2003-08-01 16:46       ` -Wformat David Carlton
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-08-01 16:33 UTC (permalink / raw)
  To: gdb

On Fri, Aug 01, 2003 at 12:29:58PM -0400, Andrew Cagney wrote:
> >
> >Yup.  And further down in the log, you'll run into stuff like
> >
> >  fprintf_filtered (stream, local_octal_format_prefix ());
> >
> >which could easily be fixed by using fputs_filtered.
> 
> Outch, that's just bad.
> 
> >>While getting the option working with a current GCC could mean more
> >>work, I'm not convinced that it's a bad idea.
> >
> >
> >You're right: I was too pessimistic.  I just want the
> >-Wformat-nonliteral patch reverted in the meantime. :-) (Actually, if
> >you want to fix the warnings in question quickly, that's fine with me
> >too: I can easily revert it on my local tree.)
> 
> But it `works for me'.  Can you fix the obvious ones and leave me with 
> the messier problems, say?

It's hardly David's fault you're still using a stone-age compiler :)

*ducks*

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:30     ` -Wformat Andrew Cagney
  2003-08-01 16:33       ` -Wformat Daniel Jacobowitz
@ 2003-08-01 16:46       ` David Carlton
  2003-08-01 16:48         ` -Wformat Daniel Jacobowitz
  1 sibling, 1 reply; 9+ messages in thread
From: David Carlton @ 2003-08-01 16:46 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb

On Fri, 01 Aug 2003 12:29:58 -0400, Andrew Cagney <ac131313@redhat.com> said:

> But it `works for me'.

I was wondering about that.  Am I the only person who compiles with
-Werror and who uses GCC 3.x?  I would have expected somebody else to
have noticed.  Still, it's only been in the tree for a week.

> Can you fix the obvious ones and leave me with the messier problems,
> say?

Sure, that should be easy enough.

David Carlton
carlton@kealia.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:46       ` -Wformat David Carlton
@ 2003-08-01 16:48         ` Daniel Jacobowitz
  2003-08-01 17:53           ` -Wformat Andrew Cagney
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2003-08-01 16:48 UTC (permalink / raw)
  To: gdb

On Fri, Aug 01, 2003 at 09:46:04AM -0700, David Carlton wrote:
> On Fri, 01 Aug 2003 12:29:58 -0400, Andrew Cagney <ac131313@redhat.com> said:
> 
> > But it `works for me'.
> 
> I was wondering about that.  Am I the only person who compiles with
> -Werror and who uses GCC 3.x?  I would have expected somebody else to
> have noticed.  Still, it's only been in the tree for a week.

I haven't updated in two weeks, since I've been busy on another
project.  Before that I had to disable -Werror due to some
-Wmissing-prototypes problems, I think.  I've found that it's not worth
worrying about; I just use make -s, and skim the output.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
  2003-08-01 16:48         ` -Wformat Daniel Jacobowitz
@ 2003-08-01 17:53           ` Andrew Cagney
  0 siblings, 0 replies; 9+ messages in thread
From: Andrew Cagney @ 2003-08-01 17:53 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

> On Fri, Aug 01, 2003 at 09:46:04AM -0700, David Carlton wrote:
> 
>> On Fri, 01 Aug 2003 12:29:58 -0400, Andrew Cagney <ac131313@redhat.com> said:
>> 
> 
>> > But it `works for me'.
> 
>> 
>> I was wondering about that.  Am I the only person who compiles with
>> -Werror and who uses GCC 3.x?  I would have expected somebody else to
>> have noticed.  Still, it's only been in the tree for a week.
> 
> 
> I haven't updated in two weeks, since I've been busy on another
> project.  Before that I had to disable -Werror due to some
> -Wmissing-prototypes problems, I think.  I've found that it's not worth
> worrying about; I just use make -s, and skim the output.

Er, the assumption here is that everyone chips in and fixes problems as 
this as soon as they are encountered.

Andrew


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: -Wformat
@ 2003-08-01 18:25 Michael Elizabeth Chastain
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-01 18:25 UTC (permalink / raw)
  To: ac131313, carlton; +Cc: gdb

David Carlton asks:
> I was wondering about that.  Am I the only person who compiles with
> -Werror and who uses GCC 3.x?  I would have expected somebody else to
> have noticed.  Still, it's only been in the tree for a week.

I build gdb with gcc 3.3 (that's the "host tools" section in my report).
But I don't turn on -Werror.

Michael C

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2003-08-01 18:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-01 15:49 -Wformat David Carlton
2003-08-01 16:08 ` -Wformat Andrew Cagney
2003-08-01 16:18   ` -Wformat David Carlton
2003-08-01 16:30     ` -Wformat Andrew Cagney
2003-08-01 16:33       ` -Wformat Daniel Jacobowitz
2003-08-01 16:46       ` -Wformat David Carlton
2003-08-01 16:48         ` -Wformat Daniel Jacobowitz
2003-08-01 17:53           ` -Wformat Andrew Cagney
2003-08-01 18:25 -Wformat Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).