<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, May 14, 2014 at 3:14 PM, Alp Toker <span dir="ltr"><<a href="mailto:alp@nuanti.com" target="_blank">alp@nuanti.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class=""><br>
On 15/05/2014 00:08, Reid Kleckner wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Hi hans,<br>
<br>
MSVC silently ignores it rather than warning on it, so they have some<br>
support for it.<br>
</blockquote>
<br></div>
Just to clarify, does MSVC handle -o differently to flags that definitely don't exist?</blockquote><div><br></div><div>It handles it slightly differently:</div><div><div>$ cl -c t.cpp -ofoo.obj -asdf -nologo</div><div>
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release</div><div>cl : Command line warning D9002 : ignoring unknown option '-asdf'</div></div><div><br></div>
<div>So, it used to know about it, but either way it ignores it.  I doubt they will add it back with a new meaning in a future release.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
   This greatly simplifies wiring clang-cl through CMake<br>
and other build systems that use traditional -o compiler flag.<br>
</blockquote>
<br></div>
CMake and other build systems already have measures in place to support MSVC's cl.exe -- wouldn't that existing support already work satisfactorily if you drop clang-cl.exe in its place?<br></blockquote><div><br>
</div><div>I wish I could drop clang-cl into the CMake build.  CMake actually starts off by doing something like:</div><div>${CMAKE_C_COMPILER} -c check_compiler_id.c -ocheck_compiler_id.o</div><div><br></div><div>Our handling of -o isn't the real problem, though, because we currently ignore it just like MSVC does:<div>
$ clang-cl -c t.cpp -ot.obj</div><div>clang-cl.exe: warning: argument unused during compilation: '-o t.obj'</div></div><div><br></div><div>So the summary isn't really accurate, this change doesn't improve the situation with CMake.</div>
<div><br></div><div>---</div><div><br></div><div>What actually happens is that CMake sees that __clang__ is defined, and proceeds to use gcc-style arguments to invoke the compiler.  It also sends us down the wrong codepaths in CMakeLists.txt where we check for if (MSVC) when we really mean "are we using MSVCRT".  I haven't had the time to sort it out.</div>
<div><br></div><div>To self-host, I currently generate a build.ninja file with CMake and replace the path to cl.exe with a script.  =(  I've been holding off on documenting self-hosting with clang-cl until that gets fixed.</div>
</div></div></div>