From c67df0c462db55a7fcac0361ed084a907d6df59c Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 12 Oct 2014 17:56:40 +0000 Subject: [PATCH] Modernize old-style static asserts. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219588 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 +- lib/Support/APFloat.cpp | 3 +-- lib/Support/APInt.cpp | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index df9121ac2ca..7fb7aba00c4 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2737,7 +2737,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, case ISD::FP_TO_UINT: { integerPart x[2]; bool ignored; - assert(integerPartWidth >= 64); + static_assert(integerPartWidth >= 64, "APFloat parts too small!"); // FIXME need to be more flexible about rounding mode. APFloat::opStatus s = V.convertToInteger(x, VT.getSizeInBits(), Opcode==ISD::FP_TO_SINT, diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 3063a07f9ff..57fbe897fc8 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -35,8 +35,7 @@ using namespace llvm; /* Assumed in hexadecimal significand parsing, and conversion to hexadecimal strings. */ -#define COMPILE_TIME_ASSERT(cond) extern int CTAssert[(cond) ? 1 : -1] -COMPILE_TIME_ASSERT(integerPartWidth % 4 == 0); +static_assert(integerPartWidth % 4 == 0, "Part width must be divisible by 4!"); namespace llvm { diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 8973f02d80b..02778b2fc7c 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -2288,8 +2288,7 @@ void APInt::print(raw_ostream &OS, bool isSigned) const { // Assumed by lowHalf, highHalf, partMSB and partLSB. A fairly safe // and unrestricting assumption. -#define COMPILE_TIME_ASSERT(cond) extern int CTAssert[(cond) ? 1 : -1] -COMPILE_TIME_ASSERT(integerPartWidth % 2 == 0); +static_assert(integerPartWidth % 2 == 0, "Part width must be divisible by 2!"); /* Some handy functions local to this file. */ namespace { -- 2.34.1