public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc vs g++ format string warning question
@ 2004-04-27 17:14 Scott Lipcon
  2004-04-28  0:25 ` llewelly
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Lipcon @ 2004-04-27 17:14 UTC (permalink / raw)
  To: gcc-help

Hi,

I've got a very simple test program:

#include <stdio.h>
int main(int argc, char** argv)
{
  printf("%s $s\n", "foo", "bar");
  return 0;
}

which resulted from a typo in a format string ($s instead of %s).
Logic would say that this would result in a warning about the format
string having too many arguments, and using gcc (3.3.2) it does:

> gcc -Wall -Werror -o try-too-many try-too-many.c
try-too-many.c: In function `main':
try-too-many.c:5: warning: too many arguments for format
>

however, using g++ (also 3.3.2), there is no warning:

> g++ -Wall -Werror -o try-too-many try-too-many.c
>

I just tried this again with gcc/g++ 3.4.0 and both produce the
expected warning.  Is this a bug in 3.3.2, or is there another warning
I need to enable for g++?

please cc any replies to me as I'm not subscribed.

Thanks,

Scott Lipcon

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

* Re: gcc vs g++ format string warning question
  2004-04-27 17:14 gcc vs g++ format string warning question Scott Lipcon
@ 2004-04-28  0:25 ` llewelly
  0 siblings, 0 replies; 2+ messages in thread
From: llewelly @ 2004-04-28  0:25 UTC (permalink / raw)
  To: Scott Lipcon; +Cc: gcc-help

Scott Lipcon <slipcon@mercea.net> writes:

> Hi,
> 
> I've got a very simple test program:
> 
> #include <stdio.h>
> int main(int argc, char** argv)
> {
>   printf("%s $s\n", "foo", "bar");
>   return 0;
> }
> 
> which resulted from a typo in a format string ($s instead of %s).
> Logic would say that this would result in a warning about the format
> string having too many arguments, and using gcc (3.3.2) it does:
> 
> > gcc -Wall -Werror -o try-too-many try-too-many.c
> try-too-many.c: In function `main':
> try-too-many.c:5: warning: too many arguments for format
> >
> 
> however, using g++ (also 3.3.2), there is no warning:
> 
> > g++ -Wall -Werror -o try-too-many try-too-many.c
> >
> 
> I just tried this again with gcc/g++ 3.4.0 and both produce the
> expected warning.  Is this a bug in 3.3.2, or is there another warning
> I need to enable for g++?

It's a bug, fixed in 3.3.3 and 3.4 . See
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13507

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

end of thread, other threads:[~2004-04-28  0:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-27 17:14 gcc vs g++ format string warning question Scott Lipcon
2004-04-28  0:25 ` llewelly

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).