[PATCH] [-cxx-abi microsoft] Correctly identify Win32 entry points
David Majnemer
david.majnemer at gmail.com
Fri Sep 13 16:52:26 PDT 2013
================
Comment at: lib/AST/Decl.cpp:2216-2218
@@ +2215,5 @@
+
+ // Win32 entry points only exist on win32 targets.
+ if (TUnit->getASTContext().getTargetInfo().getTriple().getOS() !=
+ llvm::Triple::Win32)
+ return false;
----------------
Richard Smith wrote:
> Should this be isOSWindows()? How should we behave for MinGW32 and Cygwin?
It's really asking "is this something the CRT would call", this should be isOSMSVCRT().
================
Comment at: test/SemaCXX/ms-overload-entry-point.cpp:15
@@ +14,3 @@
+void wWinMain(int) {} // expected-error{{conflicting types for 'wWinMain'}}
+
+int foo() {
----------------
Reid Kleckner wrote:
> Test that DllMain must return a value and doesn't implicitly return 0. I get this from cl.exe:
> error C4716: 'DllMain' : must return a value
>
cl.exe complains but still sets the return value to zero, at least with my compiler.
================
Comment at: lib/Sema/SemaDecl.cpp:7694
@@ +7693,3 @@
+ FT->getResultType()->isNullPtrType())
+ FD->setHasImplicitReturnZero(true);
+
----------------
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
http://llvm-reviews.chandlerc.com/D1683
More information about the cfe-commits
mailing list