mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-01 09:41:08 +00:00
Drop empty string literals from static_assert (NFC)
Identified with modernize-unary-static-assert.
This commit is contained in:
parent
baee196abb
commit
32aa35b504
@ -985,7 +985,7 @@ private:
|
||||
#if defined(LLVM_ON_UNIX)
|
||||
/// Keep the size of the BinaryBasicBlock within a reasonable size class
|
||||
/// (jemalloc bucket) on Linux
|
||||
static_assert(sizeof(BinaryBasicBlock) <= 256, "");
|
||||
static_assert(sizeof(BinaryBasicBlock) <= 256);
|
||||
#endif
|
||||
|
||||
bool operator<(const BinaryBasicBlock &LHS, const BinaryBasicBlock &RHS);
|
||||
|
@ -90,7 +90,7 @@ struct AllHeuristicsBoundsWellConfigured {
|
||||
1>::Value;
|
||||
};
|
||||
|
||||
static_assert(AllHeuristicsBoundsWellConfigured::Value, "");
|
||||
static_assert(AllHeuristicsBoundsWellConfigured::Value);
|
||||
} // namespace
|
||||
|
||||
static constexpr llvm::StringLiteral DefaultAbbreviations = "addr=address;"
|
||||
|
@ -591,7 +591,7 @@ evaluateDecisionForest(const SymbolQualitySignals &Quality,
|
||||
// Produces an integer that sorts in the same order as F.
|
||||
// That is: a < b <==> encodeFloat(a) < encodeFloat(b).
|
||||
static uint32_t encodeFloat(float F) {
|
||||
static_assert(std::numeric_limits<float>::is_iec559, "");
|
||||
static_assert(std::numeric_limits<float>::is_iec559);
|
||||
constexpr uint32_t TopBit = ~(~uint32_t{0} >> 1);
|
||||
|
||||
// Get the bits of the float. Endianness is the same as for integers.
|
||||
|
@ -157,7 +157,7 @@ private:
|
||||
// An array of ForestNode* following the object.
|
||||
};
|
||||
// ForestNode may not be destroyed (for BumpPtrAllocator).
|
||||
static_assert(std::is_trivially_destructible<ForestNode>(), "");
|
||||
static_assert(std::is_trivially_destructible<ForestNode>());
|
||||
|
||||
// A memory arena for the parse forest.
|
||||
class ForestArena {
|
||||
|
@ -58,7 +58,7 @@ static void sha256(const uint8_t *data, size_t len, uint8_t *output) {
|
||||
#else
|
||||
ArrayRef<uint8_t> block(data, len);
|
||||
std::array<uint8_t, 32> hash = SHA256::hash(block);
|
||||
static_assert(hash.size() == CodeSignatureSection::hashSize, "");
|
||||
static_assert(hash.size() == CodeSignatureSection::hashSize);
|
||||
memcpy(output, hash.data(), hash.size());
|
||||
#endif
|
||||
}
|
||||
@ -1381,8 +1381,8 @@ void StringTableSection::writeTo(uint8_t *buf) const {
|
||||
}
|
||||
}
|
||||
|
||||
static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0, "");
|
||||
static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0, "");
|
||||
static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0);
|
||||
static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0);
|
||||
|
||||
CodeSignatureSection::CodeSignatureSection()
|
||||
: LinkEditSection(segment_names::linkEdit, section_names::codeSignature) {
|
||||
|
@ -581,7 +581,7 @@ public:
|
||||
using UInt128 = std::pair<uint64_t, uint64_t>;
|
||||
// I don't think the standard guarantees the size of a pair, so let's make
|
||||
// sure it's exact -- that way we can construct it via `mmap`.
|
||||
static_assert(sizeof(UInt128) == 16, "");
|
||||
static_assert(sizeof(UInt128) == 16);
|
||||
|
||||
WordLiteralSection();
|
||||
void addInput(WordLiteralInputSection *);
|
||||
|
@ -394,11 +394,9 @@ static bool canFoldEncoding(compact_unwind_encoding_t encoding) {
|
||||
// unwind info can't be folded if it's using this encoding since both
|
||||
// entries need unique addresses.
|
||||
static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_MASK) ==
|
||||
static_cast<uint32_t>(UNWIND_X86_MODE_MASK),
|
||||
"");
|
||||
static_cast<uint32_t>(UNWIND_X86_MODE_MASK));
|
||||
static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_STACK_IND) ==
|
||||
static_cast<uint32_t>(UNWIND_X86_MODE_STACK_IND),
|
||||
"");
|
||||
static_cast<uint32_t>(UNWIND_X86_MODE_STACK_IND));
|
||||
if ((target->cpuType == CPU_TYPE_X86_64 || target->cpuType == CPU_TYPE_X86) &&
|
||||
(encoding & UNWIND_X86_64_MODE_MASK) == UNWIND_X86_64_MODE_STACK_IND) {
|
||||
// FIXME: Consider passing in the two function addresses and getting
|
||||
|
@ -702,7 +702,7 @@ class APFloat : public APFloatBase {
|
||||
typedef detail::IEEEFloat IEEEFloat;
|
||||
typedef detail::DoubleAPFloat DoubleAPFloat;
|
||||
|
||||
static_assert(std::is_standard_layout<IEEEFloat>::value, "");
|
||||
static_assert(std::is_standard_layout<IEEEFloat>::value);
|
||||
|
||||
union Storage {
|
||||
const fltSemantics *semantics;
|
||||
@ -795,7 +795,7 @@ class APFloat : public APFloatBase {
|
||||
|
||||
template <typename T> static bool usesLayout(const fltSemantics &Semantics) {
|
||||
static_assert(std::is_same<T, IEEEFloat>::value ||
|
||||
std::is_same<T, DoubleAPFloat>::value, "");
|
||||
std::is_same<T, DoubleAPFloat>::value);
|
||||
if (std::is_same<T, DoubleAPFloat>::value) {
|
||||
return &Semantics == &PPCDoubleDouble();
|
||||
}
|
||||
|
@ -64,23 +64,23 @@ namespace llvm {
|
||||
assert(CmpInst::FCMP_FALSE <= CC && CC <= CmpInst::FCMP_TRUE &&
|
||||
"Unexpected FCmp predicate!");
|
||||
// Take advantage of the bit pattern of CmpInst::Predicate here.
|
||||
// U L G E
|
||||
static_assert(CmpInst::FCMP_FALSE == 0, ""); // 0 0 0 0
|
||||
static_assert(CmpInst::FCMP_OEQ == 1, ""); // 0 0 0 1
|
||||
static_assert(CmpInst::FCMP_OGT == 2, ""); // 0 0 1 0
|
||||
static_assert(CmpInst::FCMP_OGE == 3, ""); // 0 0 1 1
|
||||
static_assert(CmpInst::FCMP_OLT == 4, ""); // 0 1 0 0
|
||||
static_assert(CmpInst::FCMP_OLE == 5, ""); // 0 1 0 1
|
||||
static_assert(CmpInst::FCMP_ONE == 6, ""); // 0 1 1 0
|
||||
static_assert(CmpInst::FCMP_ORD == 7, ""); // 0 1 1 1
|
||||
static_assert(CmpInst::FCMP_UNO == 8, ""); // 1 0 0 0
|
||||
static_assert(CmpInst::FCMP_UEQ == 9, ""); // 1 0 0 1
|
||||
static_assert(CmpInst::FCMP_UGT == 10, ""); // 1 0 1 0
|
||||
static_assert(CmpInst::FCMP_UGE == 11, ""); // 1 0 1 1
|
||||
static_assert(CmpInst::FCMP_ULT == 12, ""); // 1 1 0 0
|
||||
static_assert(CmpInst::FCMP_ULE == 13, ""); // 1 1 0 1
|
||||
static_assert(CmpInst::FCMP_UNE == 14, ""); // 1 1 1 0
|
||||
static_assert(CmpInst::FCMP_TRUE == 15, ""); // 1 1 1 1
|
||||
// U L G E
|
||||
static_assert(CmpInst::FCMP_FALSE == 0); // 0 0 0 0
|
||||
static_assert(CmpInst::FCMP_OEQ == 1); // 0 0 0 1
|
||||
static_assert(CmpInst::FCMP_OGT == 2); // 0 0 1 0
|
||||
static_assert(CmpInst::FCMP_OGE == 3); // 0 0 1 1
|
||||
static_assert(CmpInst::FCMP_OLT == 4); // 0 1 0 0
|
||||
static_assert(CmpInst::FCMP_OLE == 5); // 0 1 0 1
|
||||
static_assert(CmpInst::FCMP_ONE == 6); // 0 1 1 0
|
||||
static_assert(CmpInst::FCMP_ORD == 7); // 0 1 1 1
|
||||
static_assert(CmpInst::FCMP_UNO == 8); // 1 0 0 0
|
||||
static_assert(CmpInst::FCMP_UEQ == 9); // 1 0 0 1
|
||||
static_assert(CmpInst::FCMP_UGT == 10); // 1 0 1 0
|
||||
static_assert(CmpInst::FCMP_UGE == 11); // 1 0 1 1
|
||||
static_assert(CmpInst::FCMP_ULT == 12); // 1 1 0 0
|
||||
static_assert(CmpInst::FCMP_ULE == 13); // 1 1 0 1
|
||||
static_assert(CmpInst::FCMP_UNE == 14); // 1 1 1 0
|
||||
static_assert(CmpInst::FCMP_TRUE == 15); // 1 1 1 1
|
||||
return CC;
|
||||
}
|
||||
|
||||
|
@ -2342,7 +2342,7 @@ struct CS_CodeDirectory {
|
||||
uint64_t execSegFlags; /* executable segment flags */
|
||||
};
|
||||
|
||||
static_assert(sizeof(CS_CodeDirectory) == 88, "");
|
||||
static_assert(sizeof(CS_CodeDirectory) == 88);
|
||||
|
||||
struct CS_BlobIndex {
|
||||
uint32_t type; /* type of entry */
|
||||
|
@ -43,7 +43,7 @@ struct Header {
|
||||
support::ulittle32_t TimeDateStamp;
|
||||
support::ulittle64_t Flags;
|
||||
};
|
||||
static_assert(sizeof(Header) == 32, "");
|
||||
static_assert(sizeof(Header) == 32);
|
||||
|
||||
/// The type of a minidump stream identifies its contents. Streams numbers after
|
||||
/// LastReserved are for application-defined data streams.
|
||||
@ -60,7 +60,7 @@ struct LocationDescriptor {
|
||||
support::ulittle32_t DataSize;
|
||||
support::ulittle32_t RVA;
|
||||
};
|
||||
static_assert(sizeof(LocationDescriptor) == 8, "");
|
||||
static_assert(sizeof(LocationDescriptor) == 8);
|
||||
|
||||
/// Describes a single memory range (both its VM address and where to find it in
|
||||
/// the file) of the process from which this minidump file was generated.
|
||||
@ -68,7 +68,7 @@ struct MemoryDescriptor {
|
||||
support::ulittle64_t StartOfMemoryRange;
|
||||
LocationDescriptor Memory;
|
||||
};
|
||||
static_assert(sizeof(MemoryDescriptor) == 16, "");
|
||||
static_assert(sizeof(MemoryDescriptor) == 16);
|
||||
|
||||
struct MemoryInfoListHeader {
|
||||
support::ulittle32_t SizeOfHeader;
|
||||
@ -81,7 +81,7 @@ struct MemoryInfoListHeader {
|
||||
: SizeOfHeader(SizeOfHeader), SizeOfEntry(SizeOfEntry),
|
||||
NumberOfEntries(NumberOfEntries) {}
|
||||
};
|
||||
static_assert(sizeof(MemoryInfoListHeader) == 16, "");
|
||||
static_assert(sizeof(MemoryInfoListHeader) == 16);
|
||||
|
||||
enum class MemoryProtection : uint32_t {
|
||||
#define HANDLE_MDMP_PROTECT(CODE, NAME, NATIVENAME) NAME = CODE,
|
||||
@ -112,7 +112,7 @@ struct MemoryInfo {
|
||||
support::little_t<MemoryType> Type;
|
||||
support::ulittle32_t Reserved1;
|
||||
};
|
||||
static_assert(sizeof(MemoryInfo) == 48, "");
|
||||
static_assert(sizeof(MemoryInfo) == 48);
|
||||
|
||||
/// Specifies the location and type of a single stream in the minidump file. The
|
||||
/// minidump stream directory is an array of entries of this type, with its size
|
||||
@ -121,7 +121,7 @@ struct Directory {
|
||||
support::little_t<StreamType> Type;
|
||||
LocationDescriptor Location;
|
||||
};
|
||||
static_assert(sizeof(Directory) == 12, "");
|
||||
static_assert(sizeof(Directory) == 12);
|
||||
|
||||
/// The processor architecture of the system that generated this minidump. Used
|
||||
/// in the ProcessorArch field of the SystemInfo stream.
|
||||
@ -154,7 +154,7 @@ union CPUInfo {
|
||||
uint8_t ProcessorFeatures[16];
|
||||
} Other;
|
||||
};
|
||||
static_assert(sizeof(CPUInfo) == 24, "");
|
||||
static_assert(sizeof(CPUInfo) == 24);
|
||||
|
||||
/// The SystemInfo stream, containing various information about the system where
|
||||
/// this minidump was generated.
|
||||
@ -177,7 +177,7 @@ struct SystemInfo {
|
||||
|
||||
CPUInfo CPU;
|
||||
};
|
||||
static_assert(sizeof(SystemInfo) == 56, "");
|
||||
static_assert(sizeof(SystemInfo) == 56);
|
||||
|
||||
struct VSFixedFileInfo {
|
||||
support::ulittle32_t Signature;
|
||||
@ -194,7 +194,7 @@ struct VSFixedFileInfo {
|
||||
support::ulittle32_t FileDateHigh;
|
||||
support::ulittle32_t FileDateLow;
|
||||
};
|
||||
static_assert(sizeof(VSFixedFileInfo) == 52, "");
|
||||
static_assert(sizeof(VSFixedFileInfo) == 52);
|
||||
|
||||
inline bool operator==(const VSFixedFileInfo &LHS, const VSFixedFileInfo &RHS) {
|
||||
return memcmp(&LHS, &RHS, sizeof(VSFixedFileInfo)) == 0;
|
||||
@ -212,7 +212,7 @@ struct Module {
|
||||
support::ulittle64_t Reserved0;
|
||||
support::ulittle64_t Reserved1;
|
||||
};
|
||||
static_assert(sizeof(Module) == 108, "");
|
||||
static_assert(sizeof(Module) == 108);
|
||||
|
||||
/// Describes a single thread in the minidump file. Part of the ThreadList
|
||||
/// stream.
|
||||
@ -225,7 +225,7 @@ struct Thread {
|
||||
MemoryDescriptor Stack;
|
||||
LocationDescriptor Context;
|
||||
};
|
||||
static_assert(sizeof(Thread) == 48, "");
|
||||
static_assert(sizeof(Thread) == 48);
|
||||
|
||||
struct Exception {
|
||||
static constexpr size_t MaxParameters = 15;
|
||||
@ -238,7 +238,7 @@ struct Exception {
|
||||
support::ulittle32_t UnusedAlignment;
|
||||
support::ulittle64_t ExceptionInformation[MaxParameters];
|
||||
};
|
||||
static_assert(sizeof(Exception) == 152, "");
|
||||
static_assert(sizeof(Exception) == 152);
|
||||
|
||||
struct ExceptionStream {
|
||||
support::ulittle32_t ThreadId;
|
||||
@ -246,7 +246,7 @@ struct ExceptionStream {
|
||||
Exception ExceptionRecord;
|
||||
LocationDescriptor ThreadContext;
|
||||
};
|
||||
static_assert(sizeof(ExceptionStream) == 168, "");
|
||||
static_assert(sizeof(ExceptionStream) == 168);
|
||||
|
||||
} // namespace minidump
|
||||
|
||||
|
@ -300,7 +300,7 @@ void emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents,
|
||||
template <typename DataT>
|
||||
void emitAppleAccelTable(AsmPrinter *Asm, AccelTable<DataT> &Contents,
|
||||
StringRef Prefix, const MCSymbol *SecBegin) {
|
||||
static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value, "");
|
||||
static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value);
|
||||
emitAppleAccelTableImpl(Asm, Contents, Prefix, SecBegin, DataT::Atoms);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
if (Head->Used <= Head->Capacity)
|
||||
return new (PP) T(std::forward<Args>(ConstructorArgs)...);
|
||||
|
||||
static_assert(Size < AllocUnit, "");
|
||||
static_assert(Size < AllocUnit);
|
||||
addNode(AllocUnit);
|
||||
Head->Used = Size;
|
||||
return new (Head->Buf) T(std::forward<Args>(ConstructorArgs)...);
|
||||
|
@ -100,7 +100,7 @@ static constexpr GV AMDGPUGridValues32 = {
|
||||
};
|
||||
|
||||
template <unsigned wavesize> constexpr const GV &getAMDGPUGridValues() {
|
||||
static_assert(wavesize == 32 || wavesize == 64, "");
|
||||
static_assert(wavesize == 32 || wavesize == 64);
|
||||
return wavesize == 32 ? AMDGPUGridValues32 : AMDGPUGridValues64;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,7 @@ testing::Matcher<const detail::ErrorHolder &> Failed(M Matcher) {
|
||||
|
||||
template <typename... M>
|
||||
testing::Matcher<const detail::ErrorHolder &> FailedWithMessage(M... Matcher) {
|
||||
static_assert(sizeof...(M) > 0, "");
|
||||
static_assert(sizeof...(M) > 0);
|
||||
return MakeMatcher(
|
||||
new detail::ErrorMessageMatches(testing::ElementsAre(Matcher...)));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
static_assert(sizeof(uint64_t) == sizeof(LocalVarDef), "");
|
||||
static_assert(sizeof(uint64_t) == sizeof(LocalVarDef));
|
||||
|
||||
private:
|
||||
MCStreamer &OS;
|
||||
|
@ -225,7 +225,7 @@ void SHA1::update(ArrayRef<uint8_t> Data) {
|
||||
// Fast buffer filling for large inputs.
|
||||
while (Data.size() >= BLOCK_LENGTH) {
|
||||
assert(InternalState.BufferOffset == 0);
|
||||
static_assert(BLOCK_LENGTH % 4 == 0, "");
|
||||
static_assert(BLOCK_LENGTH % 4 == 0);
|
||||
constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4;
|
||||
for (size_t I = 0; I < BLOCK_LENGTH_32; ++I)
|
||||
InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]);
|
||||
@ -288,7 +288,7 @@ std::array<uint8_t, 20> SHA1::final() {
|
||||
std::array<uint32_t, HASH_LENGTH / 4> HashResult;
|
||||
std::array<uint8_t, HASH_LENGTH> ReturnResult;
|
||||
};
|
||||
static_assert(sizeof(HashResult) == sizeof(ReturnResult), "");
|
||||
static_assert(sizeof(HashResult) == sizeof(ReturnResult));
|
||||
final(HashResult);
|
||||
return ReturnResult;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ void SHA256::update(ArrayRef<uint8_t> Data) {
|
||||
// Fast buffer filling for large inputs.
|
||||
while (Data.size() >= BLOCK_LENGTH) {
|
||||
assert(InternalState.BufferOffset == 0);
|
||||
static_assert(BLOCK_LENGTH % 4 == 0, "");
|
||||
static_assert(BLOCK_LENGTH % 4 == 0);
|
||||
constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4;
|
||||
for (size_t I = 0; I < BLOCK_LENGTH_32; ++I)
|
||||
InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]);
|
||||
@ -268,7 +268,7 @@ std::array<uint8_t, 32> SHA256::final() {
|
||||
std::array<uint32_t, HASH_LENGTH / 4> HashResult;
|
||||
std::array<uint8_t, HASH_LENGTH> ReturnResult;
|
||||
};
|
||||
static_assert(sizeof(HashResult) == sizeof(ReturnResult), "");
|
||||
static_assert(sizeof(HashResult) == sizeof(ReturnResult));
|
||||
final(HashResult);
|
||||
return ReturnResult;
|
||||
}
|
||||
|
@ -1513,7 +1513,7 @@ MCOperand AMDGPUDisassembler::decodeSrcOp(const OpWidthTy Width, unsigned Val,
|
||||
}
|
||||
if (Val <= SGPR_MAX) {
|
||||
// "SGPR_MIN <= Val" is always true and causes compilation warning.
|
||||
static_assert(SGPR_MIN == 0, "");
|
||||
static_assert(SGPR_MIN == 0);
|
||||
return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN);
|
||||
}
|
||||
|
||||
@ -1557,7 +1557,7 @@ MCOperand AMDGPUDisassembler::decodeDstOp(const OpWidthTy Width, unsigned Val) c
|
||||
|
||||
if (Val <= SGPR_MAX) {
|
||||
// "SGPR_MIN <= Val" is always true and causes compilation warning.
|
||||
static_assert(SGPR_MIN == 0, "");
|
||||
static_assert(SGPR_MIN == 0);
|
||||
return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN);
|
||||
}
|
||||
|
||||
|
@ -763,7 +763,7 @@ void DisassemblerTables::emitOpcodeDecision(raw_ostream &o1, raw_ostream &o2,
|
||||
}
|
||||
if (index == 256) {
|
||||
// If all 256 entries are MODRM_ONEENTRY, omit output.
|
||||
static_assert(MODRM_ONEENTRY == 0, "");
|
||||
static_assert(MODRM_ONEENTRY == 0);
|
||||
--i2;
|
||||
o2 << "},\n";
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user