From 4b01f8d817fd5d3bd2176637b1f02b14741a2684 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Tue, 17 Jul 2001 12:58:54 +0100 Subject: 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 --- gcc/testsuite/gcc.dg/format/attr-4.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/format/attr-4.c (limited to 'gcc/testsuite/gcc.dg/format') 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 */ +/* { 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" } */ +} -- cgit v1.1