On Sat, Apr 6, 2013 at 11:50 PM, Andreas Schwab <sch...@linux-m68k.org> wrote: > Tobias Burnus <bur...@net-b.de> writes: > >> gcc.dg/Wunprototyped-calls.c:13:3: warning: call to function āgā without a >> real prototype [-Wunprototyped-calls] > > What is a real prototype?
One reason I didn't bother to upstream that patch is language lawyer legalise ... We want to catch int foo (); int bar (T x) { return foo (x); } int foo (U) { ... } that is, calling foo () from a context where the definition or declaration with argument specification is not visible. This causes the C frontend to apply var-args promotion rules to all arguments which may differ from promotion rules that would be applied when a "real prototype" was visible at the point of the function call. I'd just say "without a prototype". int foo(); or just foo(); is specified as part of 6.7.5.3/14 as "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." (this appears mostly in K&R style programs where the T D ( identifier-list(opt) ) form is valid). I am not sure that GCC doing varargs style promotions to calls with only this kind of declarator is valid or if the program would be rejected by K&R (and only the GCC extension of varargs functions without a first named arguments makes us do what we do ...). The patch was implemented while hunting down "miscompiles" in either X or ghostscript (I don't remember...). Richard. > Andreas. > > -- > Andreas Schwab, sch...@linux-m68k.org > GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 > "And now for something completely different."