For PR786:
authorReid Spencer <rspencer@reidspencer.com>
Wed, 24 May 2006 19:21:13 +0000 (19:21 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 24 May 2006 19:21:13 +0000 (19:21 +0000)
Minor tweaks in public headers and a few .cpp files so that LLVM can build
successfully with -pedantic and projects using LLVM with -pedantic don't
get warnings from LLVM. There's still more -pedantic warnings to fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28453 91177308-0d34-0410-b5e6-96231b3b80d8

12 files changed:
include/llvm/ADT/StringExtras.h
include/llvm/CodeGen/ValueTypes.h
include/llvm/Constants.h
include/llvm/Support/MathExtras.h
include/llvm/Support/SlowOperationInformer.h
include/llvm/Target/TargetLowering.h
include/llvm/Type.h
lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp
runtime/GCCLibraries/crtend/Exception.h
tools/llvm-prof/llvm-prof.cpp

index bd8333909c472aa137520873be48bf4e0f0305e1..375b655b4d6e8ed317ba197c693e0a1143ea13c1 100644 (file)
@@ -39,7 +39,7 @@ static inline std::string utohexstr(uint64_t X) {
   return std::string(BufPtr);
 }
 
-static inline std::string utostr(unsigned long long X, bool isNeg = false) {
+static inline std::string utostr(uint64_t X, bool isNeg = false) {
   char Buffer[40];
   char *BufPtr = Buffer+39;
 
@@ -56,7 +56,7 @@ static inline std::string utostr(unsigned long long X, bool isNeg = false) {
 }
 
 static inline std::string utostr(unsigned long X, bool isNeg = false) {
-  return utostr(static_cast<unsigned long long>(X), isNeg);
+  return utostr(static_cast<uint64_t>(X), isNeg);
 }
 
 static inline std::string utostr(unsigned X, bool isNeg = false) {
@@ -76,7 +76,7 @@ static inline std::string utostr(unsigned X, bool isNeg = false) {
   return std::string(BufPtr);
 }
 
-static inline std::string itostr(long long X) {
+static inline std::string itostr(int64_t X) {
   if (X < 0)
     return utostr(static_cast<uint64_t>(-X), true);
   else
index fe1b11a2686c8ff908b0bba984192ea4afae31c8..e754cd529db2384e603c121f23d64ff5ff9105ba 100644 (file)
@@ -203,13 +203,13 @@ namespace MVT {  // MVT = Machine Value Types
   /// bits in the specified integer value type.
   static inline uint64_t getIntVTBitMask(ValueType VT) {
     assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!");
-    return ~0ULL >> (64-getSizeInBits(VT));
+    return ~uint64_t(0UL) >> (64-getSizeInBits(VT));
   }
   /// MVT::getIntVTSignBit - Return an integer with a 1 in the position of the
   /// sign bit for the specified integer value type.
   static inline uint64_t getIntVTSignBit(ValueType VT) {
     assert(isInteger(VT) && !isVector(VT) && "Only applies to int scalars!");
-    return 1ULL << (getSizeInBits(VT)-1);
+    return uint64_t(1UL) << (getSizeInBits(VT)-1);
   }
 
   /// MVT::getValueTypeString - This function returns value type as a string,
index ef2c839adc22cd6eb264e8eb730e3f6c1b0e683d..d555d3ef1731853bb7906d1ec5e37a2f189fc155 100644 (file)
@@ -58,7 +58,7 @@ public:
   /// type.
   inline uint64_t getZExtValue() const {
     unsigned Size = getType()->getPrimitiveSizeInBits();
-    return Val.Unsigned & (~0ULL >> (64-Size));
+    return Val.Unsigned & (~uint64_t(0UL) >> (64-Size));
   }
 
   /// getSExtValue - Return the constant sign extended as appropriate for this
index 65f6ed3f753a4a578f1aa9c70de59397756b0d6d..ed21bb05260bd9d18606ef3bbab42f1f3a0bcb7d 100644 (file)
@@ -76,7 +76,7 @@ inline bool isPowerOf2_32(unsigned Value) {
 // isPowerOf2_64 - This function returns true if the argument is a power of two
 // > 0 (64 bit edition.)
 inline bool isPowerOf2_64(uint64_t Value) {
-  return Value && !(Value & (Value - 1LL));
+  return Value && !(Value & (Value - int64_t(1L)));
 }
 
 // ByteSwap_16 - This function returns a byte-swapped representation of the
index 0486406138ae7fdb59c1c7a4221da0ea9e58e328..80ece41834f843799e652f2c230d03c02e3d8069 100644 (file)
@@ -57,7 +57,7 @@ namespace llvm {
     void progress(unsigned Current, unsigned Maximum) {
       assert(Maximum != 0 &&
              "Shouldn't be doing work if there is nothing to do!");
-      progress(Current*1000ULL/Maximum);
+      progress(Current*uint64_t(1000UL)/Maximum);
     }
   };
 } // end namespace llvm
index f756a61ffbafc0d256b76981f26dac8182d31536..d17449bf504a50965025d0e466e2e3fb79ecf537 100644 (file)
@@ -512,7 +512,7 @@ protected:
                           LegalizeAction Action) {
     assert(VT < 32 && Op < sizeof(OpActions)/sizeof(OpActions[0]) &&
            "Table isn't big enough!");
-    OpActions[Op] &= ~(3ULL << VT*2);
+    OpActions[Op] &= ~(uint64_t(3UL) << VT*2);
     OpActions[Op] |= (uint64_t)Action << VT*2;
   }
   
index d507dd6a837292ef77209b583c77f4a9c1137011..34da2e7c8e13ae10684e7fd58ff4c2107fa9ad32 100644 (file)
@@ -239,7 +239,7 @@ public:
   /// sbyte/ubyte, 0xFFFF for shorts, etc.
   uint64_t getIntegralTypeMask() const {
     assert(isIntegral() && "This only works for integral types!");
-    return ~0ULL >> (64-getPrimitiveSizeInBits());
+    return ~uint64_t(0UL) >> (64-getPrimitiveSizeInBits());
   }
 
   /// getForwaredType - Return the type that this type has been resolved to if
index 20b7227809a294bfd51d70873ee1958f6d0b8427..fc58115bded3230f09d775e4ceed62bf77c8ae55 100644 (file)
@@ -313,7 +313,7 @@ GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {
         if (HowLong >= 1) {
           if (HowLong == 1 &&
               TheInterpreter->getModule().getPointerSize()==Module::Pointer64 &&
-              sizeof(long) < sizeof(long long)) {
+              sizeof(long) < sizeof(int64_t)) {
             // Make sure we use %lld with a 64 bit argument because we might be
             // compiling LLI on a 32 bit compiler.
             unsigned Size = strlen(FmtBuf);
index 4c74e54053447cd6d899245e8425674a1ab8c37f..120448a2f4837a953fb7fb114837035599b3c222 100644 (file)
@@ -685,7 +685,7 @@ void CWriter::printConstant(Constant *CPV) {
         char Buffer[100];
 
         uint64_t ll = DoubleToBits(FPC->getValue());
-        sprintf(Buffer, "0x%llx", (unsigned long long)ll);
+        sprintf(Buffer, "0x%llx", uint64_t(ll));
 
         std::string Num(&Buffer[0], &Buffer[6]);
         unsigned long Val = strtoul(Num.c_str(), 0, 16);
index 4c74e54053447cd6d899245e8425674a1ab8c37f..120448a2f4837a953fb7fb114837035599b3c222 100644 (file)
@@ -685,7 +685,7 @@ void CWriter::printConstant(Constant *CPV) {
         char Buffer[100];
 
         uint64_t ll = DoubleToBits(FPC->getValue());
-        sprintf(Buffer, "0x%llx", (unsigned long long)ll);
+        sprintf(Buffer, "0x%llx", uint64_t(ll));
 
         std::string Num(&Buffer[0], &Buffer[6]);
         unsigned long Val = strtoul(Num.c_str(), 0, 16);
index 9bda39da1d544785bed8a3972398c5ed1fbdb0b3..dc4d3a5f2cedafc4a72640a67bfa274a4db0f42b 100644 (file)
@@ -54,7 +54,7 @@ struct llvm_exception {
 enum {
   ErrorException = 0,
   SJLJException  = 1,
-  CXXException   = 2,
+  CXXException   = 2
 };
 
 // Language independent exception handling API...
index fb2e469976c07dc9042eed325cb8744555acca07..0b645f6b971f9858b7a038a6c5fc7f6be0597798 100644 (file)
@@ -139,7 +139,7 @@ int main(int argc, char **argv) {
     sort(FunctionCounts.begin(), FunctionCounts.end(),
               PairSecondSortReverse<Function*>());
 
-    unsigned long long TotalExecutions = 0;
+    uint64_t TotalExecutions = 0;
     for (unsigned i = 0, e = FunctionCounts.size(); i != e; ++i)
       TotalExecutions += FunctionCounts[i].second;