[cfe-dev] compile problem with clang/Sema/SemaDecl.cpp

Sam Bishop sam at bishop.dhs.org
Sun Jan 13 17:43:22 PST 2008


Hi, all.

This weekend I compiled LLVM and clang under Cygwin.  I had a problem
compiling both of them for the same reason: Cygwin maps the *int32_t
types to longs instead of ints.  I have submitted a fix for LLVM, but
for clang I punted with these heavy-handed casts:

--- SemaDecl.cpp        (revision 45943)
+++ SemaDecl.cpp        (working copy)
@@ -1502,9 +1502,9 @@

      // Keep track of the size of positive and negative values.
      if (InitVal.isUnsigned() || !InitVal.isNegative())
-      NumPositiveBits = std::max(NumPositiveBits, InitVal.getActiveBits());
+      NumPositiveBits = std::max(NumPositiveBits, (unsigned)InitVal.getActiveBits());
      else
-      NumNegativeBits = std::max(NumNegativeBits, InitVal.getMinSignedBits());
+      NumNegativeBits = std::max(NumNegativeBits, (unsigned)InitVal.getMinSignedBits());

      // Keep track of whether every enum element has type int (very commmon).
      if (AllElementsInt)

I suspect that someone who knows this code better could come up with a
better fix.

Thanks,
Sam



More information about the cfe-dev mailing list