This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/6326: non prototype-format parameter type declarators



>Number:         6326
>Category:       c
>Synopsis:       gcc compile illegal code
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          accepts-illegal
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 16 08:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.4
>Organization:
>Environment:
System: Linux dreamland 2.4.18-xfs #2 Mon Mar 4 17:42:57 CET 2002 i586 unknown
Architecture: i586

	
host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr --with-slibdir=/lib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-cpu=k6 --enable-threads : (reconfigured) 
>Description:

Quoting from ISO C99:

6.7.5.3 Function declarators (including prototypes)
[...]
14 An identifier list declares only the identifiers of the parameters of
the function. An  empty list in  a function  declarator that is  part of
a  definition  of that  function  specifies  that  the function  has  no
parameters. The empty list in a function  declarator that is not part of
a definition  of that function  specifies that no information  about the
number or types of the parameters is supplied.

I think that

int foo() {
	return 0;
}

should be equal to

int foo(void) {
	return 0;
}

gcc  do  not  complain  when  I  pass one  or  more  paramters  to  this
function. The code (see below) was compiled with:

gcc -Wall -std=c99 -op p.c

>How-To-Repeat:

int foo() {
	return 0;
}

int main(void) {
	foo("bar");
	foo(1, 2, 3);
	foo(3.14);
}

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]