Skip to content

Commit 32aa35b

Browse files
Drop empty string literals from static_assert (NFC)
Identified with modernize-unary-static-assert.
1 parent baee196 commit 32aa35b

File tree

20 files changed

+55
-57
lines changed

20 files changed

+55
-57
lines changed

Diff for: bolt/include/bolt/Core/BinaryBasicBlock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ class BinaryBasicBlock {
985985
#if defined(LLVM_ON_UNIX)
986986
/// Keep the size of the BinaryBasicBlock within a reasonable size class
987987
/// (jemalloc bucket) on Linux
988-
static_assert(sizeof(BinaryBasicBlock) <= 256, "");
988+
static_assert(sizeof(BinaryBasicBlock) <= 256);
989989
#endif
990990

991991
bool operator<(const BinaryBasicBlock &LHS, const BinaryBasicBlock &RHS);

Diff for: clang-tools-extra/clang-tidy/readability/SuspiciousCallArgumentCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ struct AllHeuristicsBoundsWellConfigured {
9090
1>::Value;
9191
};
9292

93-
static_assert(AllHeuristicsBoundsWellConfigured::Value, "");
93+
static_assert(AllHeuristicsBoundsWellConfigured::Value);
9494
} // namespace
9595

9696
static constexpr llvm::StringLiteral DefaultAbbreviations = "addr=address;"

Diff for: clang-tools-extra/clangd/Quality.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ evaluateDecisionForest(const SymbolQualitySignals &Quality,
591591
// Produces an integer that sorts in the same order as F.
592592
// That is: a < b <==> encodeFloat(a) < encodeFloat(b).
593593
static uint32_t encodeFloat(float F) {
594-
static_assert(std::numeric_limits<float>::is_iec559, "");
594+
static_assert(std::numeric_limits<float>::is_iec559);
595595
constexpr uint32_t TopBit = ~(~uint32_t{0} >> 1);
596596

597597
// Get the bits of the float. Endianness is the same as for integers.

Diff for: clang-tools-extra/pseudo/include/clang-pseudo/Forest.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class alignas(class ForestNode *) ForestNode {
157157
// An array of ForestNode* following the object.
158158
};
159159
// ForestNode may not be destroyed (for BumpPtrAllocator).
160-
static_assert(std::is_trivially_destructible<ForestNode>(), "");
160+
static_assert(std::is_trivially_destructible<ForestNode>());
161161

162162
// A memory arena for the parse forest.
163163
class ForestArena {

Diff for: lld/MachO/SyntheticSections.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void sha256(const uint8_t *data, size_t len, uint8_t *output) {
5858
#else
5959
ArrayRef<uint8_t> block(data, len);
6060
std::array<uint8_t, 32> hash = SHA256::hash(block);
61-
static_assert(hash.size() == CodeSignatureSection::hashSize, "");
61+
static_assert(hash.size() == CodeSignatureSection::hashSize);
6262
memcpy(output, hash.data(), hash.size());
6363
#endif
6464
}
@@ -1381,8 +1381,8 @@ void StringTableSection::writeTo(uint8_t *buf) const {
13811381
}
13821382
}
13831383

1384-
static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0, "");
1385-
static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0, "");
1384+
static_assert((CodeSignatureSection::blobHeadersSize % 8) == 0);
1385+
static_assert((CodeSignatureSection::fixedHeadersSize % 8) == 0);
13861386

13871387
CodeSignatureSection::CodeSignatureSection()
13881388
: LinkEditSection(segment_names::linkEdit, section_names::codeSignature) {

Diff for: lld/MachO/SyntheticSections.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ class WordLiteralSection final : public SyntheticSection {
581581
using UInt128 = std::pair<uint64_t, uint64_t>;
582582
// I don't think the standard guarantees the size of a pair, so let's make
583583
// sure it's exact -- that way we can construct it via `mmap`.
584-
static_assert(sizeof(UInt128) == 16, "");
584+
static_assert(sizeof(UInt128) == 16);
585585

586586
WordLiteralSection();
587587
void addInput(WordLiteralInputSection *);

Diff for: lld/MachO/UnwindInfoSection.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,9 @@ static bool canFoldEncoding(compact_unwind_encoding_t encoding) {
394394
// unwind info can't be folded if it's using this encoding since both
395395
// entries need unique addresses.
396396
static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_MASK) ==
397-
static_cast<uint32_t>(UNWIND_X86_MODE_MASK),
398-
"");
397+
static_cast<uint32_t>(UNWIND_X86_MODE_MASK));
399398
static_assert(static_cast<uint32_t>(UNWIND_X86_64_MODE_STACK_IND) ==
400-
static_cast<uint32_t>(UNWIND_X86_MODE_STACK_IND),
401-
"");
399+
static_cast<uint32_t>(UNWIND_X86_MODE_STACK_IND));
402400
if ((target->cpuType == CPU_TYPE_X86_64 || target->cpuType == CPU_TYPE_X86) &&
403401
(encoding & UNWIND_X86_64_MODE_MASK) == UNWIND_X86_64_MODE_STACK_IND) {
404402
// FIXME: Consider passing in the two function addresses and getting

Diff for: llvm/include/llvm/ADT/APFloat.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ class APFloat : public APFloatBase {
702702
typedef detail::IEEEFloat IEEEFloat;
703703
typedef detail::DoubleAPFloat DoubleAPFloat;
704704

705-
static_assert(std::is_standard_layout<IEEEFloat>::value, "");
705+
static_assert(std::is_standard_layout<IEEEFloat>::value);
706706

707707
union Storage {
708708
const fltSemantics *semantics;
@@ -795,7 +795,7 @@ class APFloat : public APFloatBase {
795795

796796
template <typename T> static bool usesLayout(const fltSemantics &Semantics) {
797797
static_assert(std::is_same<T, IEEEFloat>::value ||
798-
std::is_same<T, DoubleAPFloat>::value, "");
798+
std::is_same<T, DoubleAPFloat>::value);
799799
if (std::is_same<T, DoubleAPFloat>::value) {
800800
return &Semantics == &PPCDoubleDouble();
801801
}

Diff for: llvm/include/llvm/Analysis/CmpInstAnalysis.h

+17-17
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,23 @@ namespace llvm {
6464
assert(CmpInst::FCMP_FALSE <= CC && CC <= CmpInst::FCMP_TRUE &&
6565
"Unexpected FCmp predicate!");
6666
// Take advantage of the bit pattern of CmpInst::Predicate here.
67-
// U L G E
68-
static_assert(CmpInst::FCMP_FALSE == 0, ""); // 0 0 0 0
69-
static_assert(CmpInst::FCMP_OEQ == 1, ""); // 0 0 0 1
70-
static_assert(CmpInst::FCMP_OGT == 2, ""); // 0 0 1 0
71-
static_assert(CmpInst::FCMP_OGE == 3, ""); // 0 0 1 1
72-
static_assert(CmpInst::FCMP_OLT == 4, ""); // 0 1 0 0
73-
static_assert(CmpInst::FCMP_OLE == 5, ""); // 0 1 0 1
74-
static_assert(CmpInst::FCMP_ONE == 6, ""); // 0 1 1 0
75-
static_assert(CmpInst::FCMP_ORD == 7, ""); // 0 1 1 1
76-
static_assert(CmpInst::FCMP_UNO == 8, ""); // 1 0 0 0
77-
static_assert(CmpInst::FCMP_UEQ == 9, ""); // 1 0 0 1
78-
static_assert(CmpInst::FCMP_UGT == 10, ""); // 1 0 1 0
79-
static_assert(CmpInst::FCMP_UGE == 11, ""); // 1 0 1 1
80-
static_assert(CmpInst::FCMP_ULT == 12, ""); // 1 1 0 0
81-
static_assert(CmpInst::FCMP_ULE == 13, ""); // 1 1 0 1
82-
static_assert(CmpInst::FCMP_UNE == 14, ""); // 1 1 1 0
83-
static_assert(CmpInst::FCMP_TRUE == 15, ""); // 1 1 1 1
67+
// U L G E
68+
static_assert(CmpInst::FCMP_FALSE == 0); // 0 0 0 0
69+
static_assert(CmpInst::FCMP_OEQ == 1); // 0 0 0 1
70+
static_assert(CmpInst::FCMP_OGT == 2); // 0 0 1 0
71+
static_assert(CmpInst::FCMP_OGE == 3); // 0 0 1 1
72+
static_assert(CmpInst::FCMP_OLT == 4); // 0 1 0 0
73+
static_assert(CmpInst::FCMP_OLE == 5); // 0 1 0 1
74+
static_assert(CmpInst::FCMP_ONE == 6); // 0 1 1 0
75+
static_assert(CmpInst::FCMP_ORD == 7); // 0 1 1 1
76+
static_assert(CmpInst::FCMP_UNO == 8); // 1 0 0 0
77+
static_assert(CmpInst::FCMP_UEQ == 9); // 1 0 0 1
78+
static_assert(CmpInst::FCMP_UGT == 10); // 1 0 1 0
79+
static_assert(CmpInst::FCMP_UGE == 11); // 1 0 1 1
80+
static_assert(CmpInst::FCMP_ULT == 12); // 1 1 0 0
81+
static_assert(CmpInst::FCMP_ULE == 13); // 1 1 0 1
82+
static_assert(CmpInst::FCMP_UNE == 14); // 1 1 1 0
83+
static_assert(CmpInst::FCMP_TRUE == 15); // 1 1 1 1
8484
return CC;
8585
}
8686

Diff for: llvm/include/llvm/BinaryFormat/MachO.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,7 @@ struct CS_CodeDirectory {
23422342
uint64_t execSegFlags; /* executable segment flags */
23432343
};
23442344

2345-
static_assert(sizeof(CS_CodeDirectory) == 88, "");
2345+
static_assert(sizeof(CS_CodeDirectory) == 88);
23462346

23472347
struct CS_BlobIndex {
23482348
uint32_t type; /* type of entry */

Diff for: llvm/include/llvm/BinaryFormat/Minidump.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct Header {
4343
support::ulittle32_t TimeDateStamp;
4444
support::ulittle64_t Flags;
4545
};
46-
static_assert(sizeof(Header) == 32, "");
46+
static_assert(sizeof(Header) == 32);
4747

4848
/// The type of a minidump stream identifies its contents. Streams numbers after
4949
/// LastReserved are for application-defined data streams.
@@ -60,15 +60,15 @@ struct LocationDescriptor {
6060
support::ulittle32_t DataSize;
6161
support::ulittle32_t RVA;
6262
};
63-
static_assert(sizeof(LocationDescriptor) == 8, "");
63+
static_assert(sizeof(LocationDescriptor) == 8);
6464

6565
/// Describes a single memory range (both its VM address and where to find it in
6666
/// the file) of the process from which this minidump file was generated.
6767
struct MemoryDescriptor {
6868
support::ulittle64_t StartOfMemoryRange;
6969
LocationDescriptor Memory;
7070
};
71-
static_assert(sizeof(MemoryDescriptor) == 16, "");
71+
static_assert(sizeof(MemoryDescriptor) == 16);
7272

7373
struct MemoryInfoListHeader {
7474
support::ulittle32_t SizeOfHeader;
@@ -81,7 +81,7 @@ struct MemoryInfoListHeader {
8181
: SizeOfHeader(SizeOfHeader), SizeOfEntry(SizeOfEntry),
8282
NumberOfEntries(NumberOfEntries) {}
8383
};
84-
static_assert(sizeof(MemoryInfoListHeader) == 16, "");
84+
static_assert(sizeof(MemoryInfoListHeader) == 16);
8585

8686
enum class MemoryProtection : uint32_t {
8787
#define HANDLE_MDMP_PROTECT(CODE, NAME, NATIVENAME) NAME = CODE,
@@ -112,7 +112,7 @@ struct MemoryInfo {
112112
support::little_t<MemoryType> Type;
113113
support::ulittle32_t Reserved1;
114114
};
115-
static_assert(sizeof(MemoryInfo) == 48, "");
115+
static_assert(sizeof(MemoryInfo) == 48);
116116

117117
/// Specifies the location and type of a single stream in the minidump file. The
118118
/// minidump stream directory is an array of entries of this type, with its size
@@ -121,7 +121,7 @@ struct Directory {
121121
support::little_t<StreamType> Type;
122122
LocationDescriptor Location;
123123
};
124-
static_assert(sizeof(Directory) == 12, "");
124+
static_assert(sizeof(Directory) == 12);
125125

126126
/// The processor architecture of the system that generated this minidump. Used
127127
/// in the ProcessorArch field of the SystemInfo stream.
@@ -154,7 +154,7 @@ union CPUInfo {
154154
uint8_t ProcessorFeatures[16];
155155
} Other;
156156
};
157-
static_assert(sizeof(CPUInfo) == 24, "");
157+
static_assert(sizeof(CPUInfo) == 24);
158158

159159
/// The SystemInfo stream, containing various information about the system where
160160
/// this minidump was generated.
@@ -177,7 +177,7 @@ struct SystemInfo {
177177

178178
CPUInfo CPU;
179179
};
180-
static_assert(sizeof(SystemInfo) == 56, "");
180+
static_assert(sizeof(SystemInfo) == 56);
181181

182182
struct VSFixedFileInfo {
183183
support::ulittle32_t Signature;
@@ -194,7 +194,7 @@ struct VSFixedFileInfo {
194194
support::ulittle32_t FileDateHigh;
195195
support::ulittle32_t FileDateLow;
196196
};
197-
static_assert(sizeof(VSFixedFileInfo) == 52, "");
197+
static_assert(sizeof(VSFixedFileInfo) == 52);
198198

199199
inline bool operator==(const VSFixedFileInfo &LHS, const VSFixedFileInfo &RHS) {
200200
return memcmp(&LHS, &RHS, sizeof(VSFixedFileInfo)) == 0;
@@ -212,7 +212,7 @@ struct Module {
212212
support::ulittle64_t Reserved0;
213213
support::ulittle64_t Reserved1;
214214
};
215-
static_assert(sizeof(Module) == 108, "");
215+
static_assert(sizeof(Module) == 108);
216216

217217
/// Describes a single thread in the minidump file. Part of the ThreadList
218218
/// stream.
@@ -225,7 +225,7 @@ struct Thread {
225225
MemoryDescriptor Stack;
226226
LocationDescriptor Context;
227227
};
228-
static_assert(sizeof(Thread) == 48, "");
228+
static_assert(sizeof(Thread) == 48);
229229

230230
struct Exception {
231231
static constexpr size_t MaxParameters = 15;
@@ -238,15 +238,15 @@ struct Exception {
238238
support::ulittle32_t UnusedAlignment;
239239
support::ulittle64_t ExceptionInformation[MaxParameters];
240240
};
241-
static_assert(sizeof(Exception) == 152, "");
241+
static_assert(sizeof(Exception) == 152);
242242

243243
struct ExceptionStream {
244244
support::ulittle32_t ThreadId;
245245
support::ulittle32_t UnusedAlignment;
246246
Exception ExceptionRecord;
247247
LocationDescriptor ThreadContext;
248248
};
249-
static_assert(sizeof(ExceptionStream) == 168, "");
249+
static_assert(sizeof(ExceptionStream) == 168);
250250

251251
} // namespace minidump
252252

Diff for: llvm/include/llvm/CodeGen/AccelTable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ void emitAppleAccelTableImpl(AsmPrinter *Asm, AccelTableBase &Contents,
300300
template <typename DataT>
301301
void emitAppleAccelTable(AsmPrinter *Asm, AccelTable<DataT> &Contents,
302302
StringRef Prefix, const MCSymbol *SecBegin) {
303-
static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value, "");
303+
static_assert(std::is_convertible<DataT *, AppleAccelTableData *>::value);
304304
emitAppleAccelTableImpl(Asm, Contents, Prefix, SecBegin, DataT::Atoms);
305305
}
306306

Diff for: llvm/include/llvm/Demangle/MicrosoftDemangle.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class ArenaAllocator {
100100
if (Head->Used <= Head->Capacity)
101101
return new (PP) T(std::forward<Args>(ConstructorArgs)...);
102102

103-
static_assert(Size < AllocUnit, "");
103+
static_assert(Size < AllocUnit);
104104
addNode(AllocUnit);
105105
Head->Used = Size;
106106
return new (Head->Buf) T(std::forward<Args>(ConstructorArgs)...);

Diff for: llvm/include/llvm/Frontend/OpenMP/OMPGridValues.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static constexpr GV AMDGPUGridValues32 = {
100100
};
101101

102102
template <unsigned wavesize> constexpr const GV &getAMDGPUGridValues() {
103-
static_assert(wavesize == 32 || wavesize == 64, "");
103+
static_assert(wavesize == 32 || wavesize == 64);
104104
return wavesize == 32 ? AMDGPUGridValues32 : AMDGPUGridValues64;
105105
}
106106

Diff for: llvm/include/llvm/Testing/Support/Error.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ testing::Matcher<const detail::ErrorHolder &> Failed(M Matcher) {
207207

208208
template <typename... M>
209209
testing::Matcher<const detail::ErrorHolder &> FailedWithMessage(M... Matcher) {
210-
static_assert(sizeof...(M) > 0, "");
210+
static_assert(sizeof...(M) > 0);
211211
return MakeMatcher(
212212
new detail::ErrorMessageMatches(testing::ElementsAre(Matcher...)));
213213
}

Diff for: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
8282
}
8383
};
8484

85-
static_assert(sizeof(uint64_t) == sizeof(LocalVarDef), "");
85+
static_assert(sizeof(uint64_t) == sizeof(LocalVarDef));
8686

8787
private:
8888
MCStreamer &OS;

Diff for: llvm/lib/Support/SHA1.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ void SHA1::update(ArrayRef<uint8_t> Data) {
225225
// Fast buffer filling for large inputs.
226226
while (Data.size() >= BLOCK_LENGTH) {
227227
assert(InternalState.BufferOffset == 0);
228-
static_assert(BLOCK_LENGTH % 4 == 0, "");
228+
static_assert(BLOCK_LENGTH % 4 == 0);
229229
constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4;
230230
for (size_t I = 0; I < BLOCK_LENGTH_32; ++I)
231231
InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]);
@@ -288,7 +288,7 @@ std::array<uint8_t, 20> SHA1::final() {
288288
std::array<uint32_t, HASH_LENGTH / 4> HashResult;
289289
std::array<uint8_t, HASH_LENGTH> ReturnResult;
290290
};
291-
static_assert(sizeof(HashResult) == sizeof(ReturnResult), "");
291+
static_assert(sizeof(HashResult) == sizeof(ReturnResult));
292292
final(HashResult);
293293
return ReturnResult;
294294
}

Diff for: llvm/lib/Support/SHA256.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void SHA256::update(ArrayRef<uint8_t> Data) {
204204
// Fast buffer filling for large inputs.
205205
while (Data.size() >= BLOCK_LENGTH) {
206206
assert(InternalState.BufferOffset == 0);
207-
static_assert(BLOCK_LENGTH % 4 == 0, "");
207+
static_assert(BLOCK_LENGTH % 4 == 0);
208208
constexpr size_t BLOCK_LENGTH_32 = BLOCK_LENGTH / 4;
209209
for (size_t I = 0; I < BLOCK_LENGTH_32; ++I)
210210
InternalState.Buffer.L[I] = support::endian::read32be(&Data[I * 4]);
@@ -268,7 +268,7 @@ std::array<uint8_t, 32> SHA256::final() {
268268
std::array<uint32_t, HASH_LENGTH / 4> HashResult;
269269
std::array<uint8_t, HASH_LENGTH> ReturnResult;
270270
};
271-
static_assert(sizeof(HashResult) == sizeof(ReturnResult), "");
271+
static_assert(sizeof(HashResult) == sizeof(ReturnResult));
272272
final(HashResult);
273273
return ReturnResult;
274274
}

Diff for: llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1513,7 +1513,7 @@ MCOperand AMDGPUDisassembler::decodeSrcOp(const OpWidthTy Width, unsigned Val,
15131513
}
15141514
if (Val <= SGPR_MAX) {
15151515
// "SGPR_MIN <= Val" is always true and causes compilation warning.
1516-
static_assert(SGPR_MIN == 0, "");
1516+
static_assert(SGPR_MIN == 0);
15171517
return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN);
15181518
}
15191519

@@ -1557,7 +1557,7 @@ MCOperand AMDGPUDisassembler::decodeDstOp(const OpWidthTy Width, unsigned Val) c
15571557

15581558
if (Val <= SGPR_MAX) {
15591559
// "SGPR_MIN <= Val" is always true and causes compilation warning.
1560-
static_assert(SGPR_MIN == 0, "");
1560+
static_assert(SGPR_MIN == 0);
15611561
return createSRegOperand(getSgprClassId(Width), Val - SGPR_MIN);
15621562
}
15631563

Diff for: llvm/utils/TableGen/X86DisassemblerTables.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ void DisassemblerTables::emitOpcodeDecision(raw_ostream &o1, raw_ostream &o2,
763763
}
764764
if (index == 256) {
765765
// If all 256 entries are MODRM_ONEENTRY, omit output.
766-
static_assert(MODRM_ONEENTRY == 0, "");
766+
static_assert(MODRM_ONEENTRY == 0);
767767
--i2;
768768
o2 << "},\n";
769769
} else {

0 commit comments

Comments
 (0)