[cfe-commits] r65360 - in /cfe/trunk: include/clang/AST/Decl.h include/clang/Basic/DiagnosticSemaKinds.def lib/AST/Decl.cpp lib/CodeGen/Mangle.cpp lib/Sema/Sema.h lib/Sema/SemaDecl.cpp test/CodeGen/linkage-redecl.c test/Sema/function-redecl.c test/Sema/function.c test/Sema/nested-redef.c test/SemaCXX/function-redecl.cpp

Douglas Gregor dgregor at apple.com
Tue Feb 24 08:21:56 PST 2009


On Feb 23, 2009, at 11:34 PM, Chris Lattner wrote:

> On Feb 23, 2009, at 5:23 PM, Douglas Gregor wrote:
>> - Don't name-mangle "main"
>
>>
>> +++ cfe/trunk/lib/AST/Decl.cpp Mon Feb 23 19:23:02 2009
>> @@ -255,6 +255,11 @@
>>  return 0;
>> }
>>
>> +bool FunctionDecl::isMain() const {
>> +  return getDeclContext()->getLookupContext()->isTranslationUnit()  
>> &&
>> +    getIdentifier() && getIdentifier()->isStr("main");
>> +}
>
> Should this also verify that the linkage isn't static?  Does  
> visibility hidden affect determination of main-ness?
>
> /me checks....
>
> Ok, it looks like GCC rejects this:
>
> t.cc:2: error: cannot declare ‘::main’ to be static
>
> But clang is missing that diagnostic.

We don't check any of the restrictions on main. Just filed:

   http://llvm.org/bugs/show_bug.cgi?id=3660

	- Doug



More information about the cfe-commits mailing list