[PATCH] Fix standard integer definitions for MSVC in DataTypes.h

Zachary Turner zturner at google.com
Wed May 28 08:06:07 PDT 2014


Thanks!  Could I request someone to submit the patch for me?

On Wed, May 28, 2014 at 7:29 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Tue, May 27, 2014 at 4:00 PM, Zachary Turner <zturner at google.com> wrote:
>> I've attached the updated patch.  This is my first patch, so I'm not
>> sure what the procedure is for making changes, but this updated diff
>> is based on HEAD rather than on my previous diff.  I think this is the
>> right thing to do, but let me know if I'm wrong.
>>
>> I put the #error outside of the #if _MSVC check.  The reason for this
>> is that, even though the non-MSVC branch was using #if HAVE_STDINT_H
>> previously, it was not doing anything in case the header didn't exist.
>>  In other words, for any other platform where stdint was not present,
>> it was already broken.
>
> LGTM, at least for the CMake side of things.
>
> Thanks!
>
> ~Aaron
>
>>
>> On Tue, May 27, 2014 at 12:20 PM, Zachary Turner <zturner at google.com> wrote:
>>> This was actually my original approach until I searched around online.  One
>>> example of a report of a user not being able to find stdint.h on VS2012 is
>>> here: https://code.google.com/p/msinttypes/issues/detail?id=12
>>>
>>> That being said, i did in fact do a vanilla install of VS2012 and confirmed
>>> that the file was there.  So I really don't know how to explain that
>>> person's experience.  Maybe a pre-release version of VS2012?  You can find
>>> more reports of people not having stdint.h by doing a quick google search
>>> for "visual studio 2012 stdint.h".
>>>
>>> I would also prefer to remove all of this, so if everyone is still ok with
>>> this, I will change the patch accordingly.
>>>
>>>
>>> On Tue, May 27, 2014 at 11:33 AM, Aaron Ballman <aaron at aaronballman.com>
>>> wrote:
>>>>
>>>> On Tue, May 27, 2014 at 2:30 PM, Reid Kleckner <rnk at google.com> wrote:
>>>> > +Nakamura, he knows more about the various supported Windows configs.
>>>> >
>>>> > Thanks!  At one point I thought I could delete DataTypes.h completely in
>>>> > favor of stdint.h, but I gave up because inttypes.h makes things
>>>> > complicated.
>>>> >
>>>> > +#if defined(_WIN64)
>>>> > +typedef signed __int64 ssize_t;
>>>> > +#else
>>>> > +typedef signed int ssize_t;
>>>> > +#endif /* _WIN64 */
>>>> > +
>>>> > +/* Ideally, we would like to assume that stdint.h always exists on
>>>> > +   every supported Visual Studio version.  Indeed, the header does get
>>>> > +   installed on a vanilla VS 2012 installation.  But a search online
>>>> > +   shows that some people seem to have a version of VS2012 that does
>>>> > +   not have this header, so without a better understanding of why this
>>>> > +   is it's better to leave this check in. */
>>>> > +#ifndef HAVE_STDINT_H
>>>> >
>>>> > Really?  I thought it was available since VS 2010.  Do you have a link
>>>> > to
>>>> > these results?  I'd like to nuke this, replace it with '#error "MSVC
>>>> > must
>>>> > provide stdint.h"', commit it, and see if it sticks.
>>>>
>>>> stdint.h is included with MSVC 2010 and later. I concur with the
>>>> #error approach.
>>>>
>>>> ~Aaron
>>>
>>>



More information about the llvm-commits mailing list