Commit 4b01f8d8 by Joseph Myers Committed by Joseph Myers

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
parent eae4bce3
2001-07-17 Joseph S. Myers <jsm28@cam.ac.uk>
* 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.
2001-07-13 Eric Christopher <echristo@redhat.com>
* config/mips/mips.h: Change TUNE_MIPS* options to use
......
......@@ -2188,15 +2188,12 @@ other specifiers or qualifiers.
An attribute specifier list may appear immediately before a declarator
(other than the first) in a comma-separated list of declarators in a
declaration of more than one identifier using a single list of
specifiers and qualifiers. At present, such attribute specifiers apply
not only to the identifier before whose declarator they appear, but to
all subsequent identifiers declared in that declaration, but in future
they may apply only to that single identifier. For example, in
specifiers and qualifiers. Such attribute specifiers apply
only to the identifier before whose declarator they appear. For example, in
@code{__attribute__((noreturn)) void d0 (void),
__attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2
(void)}, the @code{noreturn} attribute applies to all the functions
declared; the @code{format} attribute should only apply to @code{d1},
but at present applies to @code{d2} as well (and so causes an error).
declared; the @code{format} attribute only applies to @code{d1}.
An attribute specifier list may appear immediately before the comma,
@code{=} or semicolon terminating the declaration of an identifier other
......@@ -2227,12 +2224,10 @@ ignored.
An attribute specifier list may appear at the start of a nested
declarator. At present, there are some limitations in this usage: the
attributes apply to the identifier declared, and to all subsequent
identifiers declared in that declaration (if it includes a
comma-separated list of declarators), rather than to a specific
attributes apply to the identifier declared, rather than to a specific
declarator. When attribute specifiers follow the @code{*} of a pointer
declarator, they must presently follow any type qualifiers present, and
cannot be mixed with them. The following describes intended future
declarator, they may be mixed with any type qualifiers present.
The following describes intended future
semantics which make this syntax more useful only. It will make the
most sense if you are familiar with the formal specification of
declarators in the ISO C standard.
......
2001-07-17 Joseph S. Myers <jsm28@cam.ac.uk>
* gcc.c-torture/compile/20010714-1.c, gcc.dg/format/attr-4.c: New
tests.
2001-07-17 Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de>
* g++.old-deja/g++.robertl/eb130.C: Include the correct header file.
......
/* Test that prefix attributes after a comma only apply to a single
declared object or function. */
/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */
__attribute__((noreturn)) void d0 (void), __attribute__((format(printf, 1, 2))) d1 (const char *, ...), d2 (void);
/* 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" } */
}
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