Do not let GCC emit a warning for INT64_MIN

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18398 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-11-30 21:33:58 +00:00
parent 33ce43e8a8
commit 40e7c35a2f
2 changed files with 10 additions and 4 deletions

View File

@ -536,13 +536,16 @@ void CWriter::printConstant(Constant *CPV) {
Out << cast<ConstantSInt>(CPV)->getValue(); break;
case Type::IntTyID:
if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
Out << "((int)0x80000000)"; // Handle MININT specially to avoid warning
Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning
else
Out << cast<ConstantSInt>(CPV)->getValue();
break;
case Type::LongTyID:
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
if (cast<ConstantSInt>(CPV)->isMinValue())
Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)";
else
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
case Type::UByteTyID:
case Type::UShortTyID:

View File

@ -536,13 +536,16 @@ void CWriter::printConstant(Constant *CPV) {
Out << cast<ConstantSInt>(CPV)->getValue(); break;
case Type::IntTyID:
if ((int)cast<ConstantSInt>(CPV)->getValue() == (int)0x80000000)
Out << "((int)0x80000000)"; // Handle MININT specially to avoid warning
Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning
else
Out << cast<ConstantSInt>(CPV)->getValue();
break;
case Type::LongTyID:
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
if (cast<ConstantSInt>(CPV)->isMinValue())
Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)";
else
Out << cast<ConstantSInt>(CPV)->getValue() << "ll"; break;
case Type::UByteTyID:
case Type::UShortTyID: