Commit 7072018e by Roger Sayle Committed by Roger Sayle

re PR c++/13070 (-Wformat option ignored in g++)


	PR c++/13070
	* decl.c (duplicate_decls): When setting the type of an anticipated
	declaration, merge the existing type attributes.

	* g++.dg/warn/format3.C: New test case.

From-SVN: r75185
parent 9f88b919
2003-12-28 Roger Sayle <roger@eyesopen.com>
PR c++/13070
* decl.c (duplicate_decls): When setting the type of an anticipated
declaration, merge the existing type attributes.
2003-12-25 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/13268, c++/13339
......
......@@ -1261,7 +1261,12 @@ duplicate_decls (tree newdecl, tree olddecl)
/* Even if the types match, prefer the new declarations type
for anticipated built-ins, for exception lists, etc... */
else if (DECL_ANTICIPATED (olddecl))
TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
{
TYPE_ATTRIBUTES (TREE_TYPE (newdecl))
= (*targetm.merge_type_attributes) (TREE_TYPE (olddecl),
TREE_TYPE (newdecl));
TREE_TYPE (olddecl) = TREE_TYPE (newdecl);
}
/* Whether or not the builtin can throw exceptions has no
bearing on this declarator. */
......
2003-12-28 Roger Sayle <roger@eyesopen.com>
PR c++/13070
* g++.dg/warn/format3.C: New test case.
2003-12-27 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* gcc.c-torture/compile/20031227-1.c: New test.
......
// PR c++/13070
// { dg-do compile }
// { dg-options "-Wformat" }
extern "C" int printf (const char*, ...);
int main()
{
printf("%d\n", 1, 1); // { dg-warning "too many" "printf warning" }
return 0;
}
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