Commit e9122ef6 by Marek Polacek Committed by Marek Polacek

re PR c/68024 (Diagnose variadic functions defined without prototypes)

	PR c/68024
	* c-decl.c (start_function): Warn about vararg functions without
	a prototype.

	* gcc.dg/pr68024.c: New test.

From-SVN: r229131
parent 68d58afb
2015-10-21 Marek Polacek <polacek@redhat.com>
PR c/68024
* c-decl.c (start_function): Warn about vararg functions without
a prototype.
2015-10-21 Ilya Enkovich <enkovich.gnu@gmail.com>
* c-typeck.c (build_conditional_expr): Use boolean vector
......
......@@ -8328,6 +8328,12 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator,
&& comptypes (TREE_TYPE (TREE_TYPE (decl1)),
TREE_TYPE (TREE_TYPE (old_decl))))
{
if (stdarg_p (TREE_TYPE (old_decl)))
{
warning_at (loc, 0, "%q+D defined as variadic function "
"without prototype", decl1);
locate_old_decl (old_decl);
}
TREE_TYPE (decl1) = composite_type (TREE_TYPE (old_decl),
TREE_TYPE (decl1));
current_function_prototype_locus = DECL_SOURCE_LOCATION (old_decl);
......
2015-10-21 Marek Polacek <polacek@redhat.com>
PR c/68024
* gcc.dg/pr68024.c: New test.
2015-10-21 Nathan Sidwell <nathan@codesourcery.com>
* c-c++-common/goacc/clauses-fail.c: Adjust errors.
......
/* PR c/68024 */
/* { dg-do compile } */
void f (int, ...);
void f (a) int a; {} /* { dg-warning "defined as variadic function without prototype" } */
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