diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2000-10-12 10:28:52 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2000-10-12 10:28:52 +0100 |
commit | 9fa8f75dc90217d4682fc22454b064424b8c9497 (patch) | |
tree | 10bcbca131e9d45e6679cdb46afd7506c3c47005 /gcc/testsuite | |
parent | 1eb1669cd401fa1365febf71fb05bc4c750e19bc (diff) | |
download | gcc-9fa8f75dc90217d4682fc22454b064424b8c9497.zip gcc-9fa8f75dc90217d4682fc22454b064424b8c9497.tar.gz gcc-9fa8f75dc90217d4682fc22454b064424b8c9497.tar.bz2 |
c-common.c (decl_attributes): Don't allow strftime formats with first_arg_num nonzero.
* c-common.c (decl_attributes): Don't allow strftime formats with
first_arg_num nonzero.
(check_format_info): Set wanted_type and wanted_type_name to zero
before they are possibly assigned and used.
testsuite:
* gcc.dg/format-attr-1.c: New test.
From-SVN: r36845
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/format-attr-1.c | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7dbf2a..369e85c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2000-10-12 Joseph S. Myers <jsm28@cam.ac.uk> + * gcc.dg/format-attr-1.c: New test. + +2000-10-12 Joseph S. Myers <jsm28@cam.ac.uk> + * gcc.dg/c90-printf-2.c, gcc.dg/c90-scanf-2.c: Use __LONG_LONG_MAX__ instead of LLONG_MAX. diff --git a/gcc/testsuite/gcc.dg/format-attr-1.c b/gcc/testsuite/gcc.dg/format-attr-1.c new file mode 100644 index 0000000..e6ebaf2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format-attr-1.c @@ -0,0 +1,7 @@ +/* Test for strftime format attributes: can't have first_arg_num != 0. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +extern void foo0 (const char *) __attribute__((__format__(__strftime__, 1, 0))); +extern void foo1 (const char *, ...) __attribute__((__format__(__strftime__, 1, 2))); /* { dg-error "cannot format" "strftime first_arg_num != 0" } */ |