diff options
author | Joseph Myers <jsm28@cam.ac.uk> | 2001-07-17 12:58:54 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2001-07-17 12:58:54 +0100 |
commit | 4b01f8d817fd5d3bd2176637b1f02b14741a2684 (patch) | |
tree | c445adeac5f944ebf602b7f57989eb9c6f6c4a83 /gcc/testsuite/gcc.dg/format | |
parent | eae4bce3a43dad89963794efbc5c4b3b6271bcd8 (diff) | |
download | gcc-4b01f8d817fd5d3bd2176637b1f02b14741a2684.zip gcc-4b01f8d817fd5d3bd2176637b1f02b14741a2684.tar.gz gcc-4b01f8d817fd5d3bd2176637b1f02b14741a2684.tar.bz2 |
c-parse.in (all_prefix_attributes): New variable.
* c-parse.in (all_prefix_attributes): New variable.
(PUSH_DECLSPEC_STACK, POP_DECLSPEC_STACK): New macros.
(maybe_resetattrs): New production.
(c_parse_init, datadef, fndef, datadecl, setspecs, setattrs, decl,
maybe_type_quals_setattrs, initdecls, notype_initdecls, initdcl,
notype_initdcl, nested_function, notype_nested_function,
component_decl, components, components_notype,
component_declarator, component_notype_declarator,
absdcl_maybe_attribute, parm, firstparm, setspecs_fp, ivar_decl,
ivars, mydecl, myparm): Update. Avoid prefix attributes just
after a comma being applied to more than one declarator.
* doc/extend.texi (Attribute Syntax): Update. Remove
documentation of bugs that are no longer present.
testsuite:
* gcc.c-torture/compile/20010714-1.c, gcc.dg/format/attr-4.c: New
tests.
From-SVN: r44070
Diffstat (limited to 'gcc/testsuite/gcc.dg/format')
-rw-r--r-- | gcc/testsuite/gcc.dg/format/attr-4.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/format/attr-4.c b/gcc/testsuite/gcc.dg/format/attr-4.c new file mode 100644 index 0000000..ef50c49 --- /dev/null +++ b/gcc/testsuite/gcc.dg/format/attr-4.c @@ -0,0 +1,25 @@ +/* Test for format attributes: test use of __attribute__ + in prefix attributes. */ +/* Origin: Joseph Myers <jsm28@cam.ac.uk> */ +/* { dg-do compile } */ +/* { dg-options "-std=gnu99 -Wformat" } */ + +#include "format.h" + +extern __attribute__((format(printf, 1, 2))) void tformatprintf0 (const char *, ...); +extern void __attribute__((format(printf, 1, 2))) tformatprintf1 (const char *, ...); +extern void foo (void), __attribute__((format(printf, 1, 2))) tformatprintf2 (const char *, ...); +extern __attribute__((noreturn)) void bar (void), __attribute__((format(printf, 1, 2))) tformatprintf3 (const char *, ...); + +void +baz (int i, int *ip, double d) +{ + tformatprintf0 ("%d", i); + tformatprintf0 ("%"); /* { dg-warning "format" "attribute format printf case 0" } */ + tformatprintf1 ("%d", i); + tformatprintf1 ("%"); /* { dg-warning "format" "attribute format printf case 1" } */ + tformatprintf2 ("%d", i); + tformatprintf2 ("%"); /* { dg-warning "format" "attribute format printf case 2" } */ + tformatprintf3 ("%d", i); + tformatprintf3 ("%"); /* { dg-warning "format" "attribute format printf case 3" } */ +} |