Commit 343b7260 by Joseph Myers Committed by Joseph Myers

c-common.c (time_char_table): Don't allow width and flags with "z" format.

	* c-common.c (time_char_table): Don't allow width and flags with
	"z" format.

testsuite:
	* gcc.dg/format-ext-3.c, gcc.dg/format-ext-4.c,
	gcc.dg/format-ext-5.c: New tests.

From-SVN: r35984
parent 22efd687
2000-08-25 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (time_char_table): Don't allow width and flags with
"z" format.
2000-08-25 Jakub Jelinek <jakub@redhat.com> 2000-08-25 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.c (ix86_expand_branch): Treat GE and GEU the same * config/i386/i386.c (ix86_expand_branch): Treat GE and GEU the same
......
...@@ -1294,7 +1294,8 @@ static format_char_info time_char_table[] = { ...@@ -1294,7 +1294,8 @@ static format_char_info time_char_table[] = {
{ "e", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" }, { "e", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" },
{ "j", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" }, { "j", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" },
{ "Vu", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" }, { "Vu", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" },
{ "Gz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow9" }, { "G", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow9" },
{ "z", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "Oo9" },
{ "kls", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" }, { "kls", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" },
{ "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" }, { "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" },
{ "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" }, { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" },
......
2000-08-25 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.dg/format-ext-3.c, gcc.dg/format-ext-4.c,
gcc.dg/format-ext-5.c: New tests.
2000-08-25 Jakub Jelinek <jakub@redhat.com> 2000-08-25 Jakub Jelinek <jakub@redhat.com>
* testsuite/g++.old-deja/g++.other/crash22.C: New test. * testsuite/g++.old-deja/g++.other/crash22.C: New test.
......
/* Test for scanf formats. %a extensions. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu89 -Wformat" } */
typedef __WCHAR_TYPE__ wchar_t;
extern int scanf (const char *, ...);
void
foo (char **sp, wchar_t **lsp)
{
/* %a formats for allocation, only recognised in C90 mode, are a
GNU extension. Followed by other characters, %a is not treated
specially.
*/
scanf ("%as", sp);
scanf ("%aS", lsp);
scanf ("%a[bcd]", sp);
}
/* Test for gettext default attributes. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
/* { dg-do compile } */
/* { dg-options "-std=gnu99 -Wformat" } */
extern int printf (const char *, ...);
extern char *gettext (const char *);
extern char *dgettext (const char *, const char *);
extern char *dcgettext (const char *, const char *, int);
void
foo (int i, long l)
{
printf (gettext ("%d"), i);
printf (gettext ("%ld"), i); /* { dg-warning "format" "gettext" } */
printf (dgettext ("", "%d"), i);
printf (dgettext ("", "%ld"), i); /* { dg-warning "format" "dgettext" } */
printf (dcgettext ("", "%d", 0), i);
printf (dcgettext ("", "%ld", 0), i); /* { dg-warning "format" "dcgettext" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment