This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
-Wall option doesn't include -Wformat completely in gcc version 2.95.3 20010315 (release) [FreeBSD] on FreeBSD 4.4-RC
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: -Wall option doesn't include -Wformat completely in gcc version 2.95.3 20010315 (release) [FreeBSD] on FreeBSD 4.4-RC
- From: "Andrey Simonenko" <simon at comsys dot ntu-kpi dot kiev dot ua>
- Date: Wed, 12 Sep 2001 10:53:53 +0400
I found problem with -Wall and think that this is a bug of GCC.
This is simple C source check.c:
#include <stdio.h>
#include <stdarg.h>
#ifdef __GNUC__
static void my_printf(const char *, ...) __attribute__ ((format (printf, 1,
2)));
#endif
void
my_printf(const char *format, ...)
{
va_list ap;
vprintf(format, ap);
va_end(ap);
}
int
main()
{
char name[] = "Nick";
my_printf("hello %s %s\n", name);
my_printf("hello\n", name);
return 0;
}
I call function my_printf two times and each time pass incorrect
printf-like string to my_printf().
Command:
gcc -Wall -O0 -o check1 check.c
doesn't report any worning messages about first line
but command
gcc -Wall -Wformat -O0 -o check2 check.c
reports two warning messages.
I think it is a bug, because -Wall should include -Wformat. I found
this bug on:
FreeBSD/i386 4.4-RC
Using builtin specs.
gcc version 2.95.3 20010315 (release) [FreeBSD]
But on following systems I don't see this bug (both "make" commands
report two warnings messages):
FreeBSD/i386 4.3-STABLE
Using builtin specs.
gcc version 2.95.3 [FreeBSD] 20010315 (release)
FreeBSD/i386 3.4-STABLE
gcc version 2.7.2.3