<div dir="ltr">We inject a typedef for size_t here:<div><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?revision=218230&view=markup#l206">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?revision=218230&view=markup#l206</a><br></div><div><br></div><div>The typedef type is determined by calling getSizeType().</div><div><br></div><div>SizeType is (relevantly) calculated in two places:</div><div>X86_64 <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?revision=218666&view=markup#l3512">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?revision=218666&view=markup#l3512</a><br></div><div>X86_32 <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?revision=218666&view=markup#l3157">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?revision=218666&view=markup#l3157</a></div><div><br></div><div>I don't see any obvious bugs here.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 30, 2014 at 6:50 PM, Eric Mader <span dir="ltr"><<a href="mailto:emader@gmx.us" target="_blank">emader@gmx.us</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    But crtdefs.h says:<br>
    <br>
    <font face="Courier New, Courier, monospace">#ifdef _WIN64<br>
      typedef unsigned __int64 size_t;<br>
      #else<br>
      typedef _W64 unsigned int size_t;<br>
      #endif<br>
    </font><br>
    Which conflicts with the built-in definition, that seems to be
    equivalent to:<br>
    <br>
    <font face="Courier New, Courier, monospace">typedef unsigned int
      size_t;</font><br>
    <br>
    What determines the built-in type of size_t? Is there some setting
    or variable I can define to change it?<br>
    <br>
    Regards,<br>
    Eric<div><div class="h5"><br>
    <br>
    <br>
    <br>
    <div>On 9/30/14, 3:21 PM, David Majnemer
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">I believe that we provide a definition of size_t
        inside the compiler itself when clang is in MSVC compatibility
        mode.</div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Sep 30, 2014 at 5:51 PM, Eric
          Mader <span dir="ltr"><<a href="mailto:emader@gmx.us" target="_blank">emader@gmx.us</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000"> I did some more
              investigation of the size_t size error. I misunderstood
              what was happening. It turns out that size_t is already
              defined before my prefix header is included. I added the
              following static_asserts to the font of the header:<br>
              <br>
              <font face="Courier New, Courier, monospace">static_assert(sizeof(size_t)

                != 4, "sizeof(size_t) == 4");<br>
                static_assert(sizeof(size_t) != 8, "sizeof(size_t) ==
                8");<br>
              </font><br>
              The first static_assert fires:<br>
              <br>
              <font face="Courier New, Courier, monospace">1>Build
                started 9/30/2014 2:29:54 PM.<br>
                1>clang-cl.exe : warning : argument unused during
                compilation: '/Gm-'<br>
                1>clang-cl.exe : warning : argument unused during
                compilation: '/GS'<br>
                1>clang-cl.exe : warning : argument unused during
                compilation: '/fp:precise'<br>
                1>clang-cl.exe : warning : argument unused during
                compilation: '/FdDebug\x64\vc120.pdb'<br>
                1>clang-cl.exe : warning : argument unused during
                compilation: '/Gd'<br>
                1>  In file included from <built-in>:187:<br>
                1>  In file included from <command line>:19:<br>
                1>[elided header file name](9,1): error :
                static_assert failed "sizeof(size_t) == 4"<br>
                1>  static_assert(sizeof(size_t) != 4,
                "sizeof(size_t) == 4");<br>
                1>  ^             ~~~~~~~~~~~~~~~~~~~<br>
              </font><br>
              Later on, I get an error saying that crtdefs.h is trying
              to redefine size_t from an unsigned int to an unsigned
              long long...<br>
              <br>
              Perhaps one of my preprocessor defines is causing these
              errors:<br>
              <br>
              <font face="Courier New, Courier, monospace">WIN32<br>
                _DEBUG<br>
                _WINDOWS<br>
                _USRDLL<br>
                _SCL_SECURE_NO_WARNINGS<br>
                _CRT_SECURE_NO_WARNINGS<br>
                _WIN64<br>
                _x86_64_ = 1<br>
              </font><br>
              (I added the "SECURE_NO_WARNINGS" defines when I ported an
              earlier version of this code to VS 2005; don't remember
              why any more...)<br>
              (There are a couple of other defines that are specific to
              the DLL I'm trying to build)<br>
              <br>
              Regards,<br>
              Eric Mader
              <div>
                <div><br>
                  <br>
                  <div>On 9/30/14, 1:01 PM, Eric Mader wrote:<br>
                  </div>
                  <blockquote type="cite"> Hi Reid,<br>
                    <br>
                    I copied the x64 toolsets by hand; they got
                    installed to C:\Program Files
                    (x86)\LLVM\tools\msbuild\x64; they just didn't get
                    moved correctly by install.bat.<br>
                    <br>
                    I just verified that the LLVM-vs2013 toolset.props
                    is correct.<br>
                    <br>
                    If it is a bitness problem, perhaps I'm failing to
                    define something correctly?<br>
                    <br>
                    Regards,<br>
                    Eric<br>
                    <br>
                    <div>On 9/30/14, 11:29 AM, Reid Kleckner wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">This looks like some kind of
                        bitness conflict. If you are building for win64,
                        are you sure clang is getting the -m64 argument?
                        <div><br>
                        </div>
                        <div>I recall that you copied the win32 platform
                          toolset xml files over by hand, and I don't
                          think they will have the correct flags. If you
                          see this line in the x64 toolset.props file,
                          replace -m32 with -m64 and try again:</div>
                        <div><AdditionalOptions>-m32
                          -fmsc-version=1700
                          %(AdditionalOptions)</AdditionalOptions><br>
                        </div>
                        <div><br>
                        </div>
                        <div>In the meantime, I think Hans is trying to
                          fix the installation of those xml files and
                          hopefully that will fix issues for other users
                          going forwards.</div>
                      </div>
                      <div class="gmail_extra"><br>
                        <div class="gmail_quote">On Tue, Sep 30, 2014 at
                          1:55 PM, Eric Mader <span dir="ltr"><<a href="mailto:emader@gmx.us" target="_blank">emader@gmx.us</a>></span>
                          wrote:<br>
                          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                            <div bgcolor="#FFFFFF" text="#000000"> I'm
                              getting compile errors because size_t is
                              getting redefined. My "forced include
                              file" starts with:<br>
                              <br>
                              <font face="Courier New, Courier,
                                monospace">#if BUILDING_FOR_WINDOWS<br>
                                #define NOMINMAX<br>
                                <br>
                                /* deal with the fact that windef.h also
                                defines BOOL */<br>
                                #define BOOL WINBOOL<br>
                                <br>
                                #include <windows.h><br>
                                #include <intrin.h><br>
                                <br>
                                #undef BOOL<br>
                                #endif<br>
                              </font><br>
                              Looking at the preprocessor expansion of a
                              typical .cpp file, I see that crtdefs.h
                              defines size_t like this:<br>
                              <br>
                              <font face="Courier New, Courier,
                                monospace">typedef unisgned __int64
                                size_t;<br>
                              </font><br>
                              Later on,
                              <LLVM>\lib\clang\3.6.0\includes\stddef.h
                              defines it as:<br>
                              <br>
                              <font face="Courier New, Courier,
                                monospace">typedef unsigned int size_t;<br>
                              </font><br>
                              Is there some other magic I need to do to
                              get these to work?<br>
                              <br>
                              I'm also seeing a bunch of errors like
                              this having to do with intrinsics:<br>
                              <br>
                              <font face="Courier New, Courier,
                                monospace">1>  In file included from
                                C:\Program Files (x86)\Microsoft Visual
                                Studio 12.0\VC\include\algorithm:6:<br>
                                1>  In file included from C:\Program
                                Files (x86)\Microsoft Visual Studio
                                12.0\VC\include\xmemory:6:<br>
                                1>  In file included from C:\Program
                                Files (x86)\Microsoft Visual Studio
                                12.0\VC\include\xmemory0:909:<br>
                                1>  In file included from C:\Program
                                Files
                                (x86)\LLVM\msbuild-bin\..\lib\clang\3.6.0\include\intrin.h:34:<br>
                                1>  In file included from C:\Program
                                Files
                                (x86)\LLVM\msbuild-bin\..\lib\clang\3.6.0\include\x86intrin.h:29:<br>
                                1>  In file included from C:\Program
                                Files
                                (x86)\LLVM\msbuild-bin\..\lib\clang\3.6.0\include\immintrin.h:28:<br>
                                1>C:\Program Files
                                (x86)\LLVM\msbuild-bin\..\lib\clang\3.6.0\include\mmintrin.h(52,40):
                                error : cannot initialize a parameter of
                                type '__attribute__((__vector_size__(2 *
                                sizeof(int)))) int' (vector of 2 'int'
                                values) with an rvalue of type '__v2si'
                                (aka 'int')<br>
                                1>      return
                                __builtin_ia32_vec_ext_v2si((__v2si)__m,
                                0);<br>
                                1>                                        

                                ^~~~~~~~~~~<br>
                              </font><br>
                              I suspect that these might be caused by
                              the same thing as the size_t problem...<br>
                              <br>
                              Regards,<br>
                              Eric Mader<br>
                              <br>
                              <br>
                              <br>
                            </div>
                            <br>
_______________________________________________<br>
                            LLVM Developers mailing list<br>
                            <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>   
                                 <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
                            <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
                            <br>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                    </blockquote>
                    <br>
                    <br>
                    <fieldset></fieldset>
                    <br>
                    <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            LLVM Developers mailing list<br>
            <a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> 
                   <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
            <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>