Bug 11369

Summary: too relaxed checking with -Wstrict-prototypes
Product: gcc Reporter: Debian GCC Maintainers <debian-gcc>
Component: cAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs
Priority: P2 Keywords: diagnostic
Version: 3.3   
Target Milestone: 3.4.0   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2003-07-18 22:55:01

Description Debian GCC Maintainers 2003-06-29 10:39:37 UTC
[forwarded from http://bugs.debian.org/197504]

int foo(void);

int foo()
{
	return 42;
}
$ gcc -c -Wstrict-prototypes gcc-bug.c
$

Bug submitter expected gcc to raise a warning in line 3, because a function is
declared with an unknown parameter list instead of an empty list.
Instead, line 3 should look like "int foo(void)".
Comment 1 Dara Hazeghi 2003-07-06 01:31:34 UTC
Confirmed with mainline (20030705) and current branch.
Comment 2 Dara Hazeghi 2003-07-18 22:55:01 UTC
The EDG front-end doesn't get this right either.
Comment 3 GCC Commits 2003-08-23 21:19:05 UTC
Subject: Bug 11369

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	hubicka@gcc.gnu.org	2003-08-23 21:18:58

Modified files:
	gcc            : expr.c ChangeLog 
	gcc/config/i386: i386.c i386.h i386.md 

Log message:
	PR target/11369
	* i386.c (ix86_expand_carry_flag_compare): Validate operand.
	
	PR target/11031
	* i386.c (const_0_to_3_operand, const_0_to_7_operand,
	const_0_to_15_operand, const_0_to_255_operand): New predicates.
	* i386.h (PREDICATE_CODES): Add these.
	* i386.c (pinsrw and pextrw patterns): Use them.
	
	PR target/10984
	* i386.c (ix86_expand_binop_builtin): Behave sanely for VOIDmodes.
	
	PR target/8869
	* expr.c (convert_modes): Deal properly with integer to vector
	constant conversion.
	
	PR target/8871
	* i386.md (zero_extendsidi2*): Add MMX and SSE alternatives.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&r1=1.577&r2=1.578
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.864&r2=2.865
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.595&r2=1.596
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.h.diff?cvsroot=gcc&r1=1.350&r2=1.351
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.480&r2=1.481

Comment 4 Andrew Pinski 2003-11-20 07:16:01 UTC
This is invalid as the documentation talks about "prototypes" non existant:
Warn about unprototyped function declarations

In this case foo is prototyped.
The flag you want is -Wold-style-definition instead but this only added for 3.4, closing as 
fixed.