[PATCH] [-cxx-abi microsoft] Correctly identify Win32 entry points

Reid Kleckner rnk at google.com
Sun Sep 15 10:46:36 PDT 2013

Comment at: lib/Sema/SemaDecl.cpp:7694
@@ +7693,3 @@
+      FT->getResultType()->isNullPtrType())
+    FD->setHasImplicitReturnZero(true);
David Majnemer wrote:
> Reid Kleckner wrote:
> > MSVC doesn't do this for DllMain, which returns BOOL (typedefed to int =/).
> It does this on my machine.
> Like so:
> int DllMain() {}
> I get:
> DllMain PROC
>     xor eax, eax
>     ret 0
> DllMain ENDP
That behavior isn't very useful, though, because DllMain is supposed to return TRUE on success and FALSE on failure.  If a user tries to compile an empty DllMain with clang, we won't warn them, and they'll get weird runtime failures where LoadLibrary returns NULL.  I'd rather have the warning than be compatible on this fine codegen detail.


More information about the cfe-commits mailing list