[cfe-commits] r86001 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclAttr.cpp test/Sema/callingconv.c test/Sema/stdcall-fastcall.c

John McCall rjmccall at apple.com
Wed Nov 4 14:08:57 PST 2009


Daniel Dunbar wrote:
> On Tue, Nov 3, 2009 at 7:36 PM, John McCall <rjmccall at apple.com> wrote:
>   
>> +def err_cconv_knr : Error<
>> +  "function with no prototype cannot use '%0' calling convention">;
>>     
>
> I'm not sure if we already have a canonical way of referring to this,
> but IIRC we already use "K&R" in other places, which may be more
> meaningful than "function with no prototype".
>   

I disagree.  I think very few people know what K&R syntax is, outside of 
a vague memory that they should (but usually don't) remember to write 
"(void)" instead of "()" when declaring a nullary function.  ANSI C 
programmers should at least be more familiar with the concept of a 
prototype.  The vast majority of people encountering this error are 
going to be people who've accidentally written their nullary function 
without void.

...not that there's really any point to declaring a nullary function 
fastcall, at least not in any of the conventions calling themselves 
'fastcall' that I know about.

That said, maybe we should say "K&R" and just provide a fixit to put 
'void' in the argument list.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20091104/78c80484/attachment.html>


More information about the cfe-commits mailing list