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

Reid Kleckner rnk at google.com
Tue May 27 11:30:19 PDT 2014


+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.

...

diff --git a/include/llvm/Support/DataTypes.h.in b/include/llvm/Support/
DataTypes.h.in
index 7fc9b72..40c4097 100644
--- a/include/llvm/Support/DataTypes.h.in
+++ b/include/llvm/Support/DataTypes.h.in
@@ -37,6 +37,14 @@

I don't think we support MSVC in the autoconf build, but it's good to keep
these in sync anyway.

On Sun, May 25, 2014 at 10:30 PM, Zachary Turner <zturner at google.com> wrote:

> Previously, DataTypes.h would #define a variety of symbols any time
> they weren't already defined.  However, some versions of Visual
> Studio do provide the appropriate headers, so if those headers
> are included after DataTypes.h, it can lead to macro redefinition
> warnings.
>
> The fix is to include the appropriate headers if they exist, and
> only #define the symbols if the required header does not exist.
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140527/69aa8239/attachment.html>


More information about the llvm-commits mailing list