Skip to content

Commit 349af37

Browse files
authored
Merge pull request #40305 from compnerd/semitruck
gardening: make c++98-compat-extra-semi an error
2 parents 34267d7 + cbd0441 commit 349af37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+99
-93
lines changed

CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
494494
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
495495
endif()
496496

497+
# Make some warnings errors as they are commonly occurring and flood the build
498+
# with unnecessary noise.
499+
if(CMAKE_C_COMPILER_ID MATCHES Clang)
500+
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=c++98-compat-extra-semi>)
501+
endif()
502+
497503
# Use dispatch as the system scheduler by default.
498504
# For convenience, we set this to false when concurrency is disabled.
499505
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)

include/swift/AST/ExtInfo.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ convertRepresentation(FunctionTypeRepresentation rep) {
221221
return SILFunctionTypeRepresentation::CFunctionPointer;
222222
}
223223
llvm_unreachable("Unhandled FunctionTypeRepresentation!");
224-
};
224+
}
225225

226226
inline Optional<FunctionTypeRepresentation>
227227
convertRepresentation(SILFunctionTypeRepresentation rep) {
@@ -241,7 +241,7 @@ convertRepresentation(SILFunctionTypeRepresentation rep) {
241241
return None;
242242
}
243243
llvm_unreachable("Unhandled SILFunctionTypeRepresentation!");
244-
};
244+
}
245245

246246
/// Can this calling convention result in a function being called indirectly
247247
/// through the runtime.

include/swift/AST/IRGenRequests.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class TBDGenDescriptor;
3535

3636
namespace irgen {
3737
class IRGenModule;
38-
};
38+
}
3939

4040
namespace Lowering {
4141
class TypeConverter;
42-
};
42+
}
4343

44-
}; // namespace swift
44+
} // namespace swift
4545

4646
namespace llvm {
4747
class GlobalVariable;
@@ -51,9 +51,9 @@ class TargetMachine;
5151

5252
namespace orc {
5353
class ThreadSafeModule;
54-
}; // namespace orc
54+
} // namespace orc
5555

56-
}; // namespace llvm
56+
} // namespace llvm
5757

5858
namespace swift {
5959

include/swift/AST/Stmt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ inline void simple_display(llvm::raw_ostream &out, Stmt *S) {
13961396
out << Stmt::getKindName(S->getKind());
13971397
else
13981398
out << "(null)";
1399-
};
1399+
}
14001400

14011401
} // end namespace swift
14021402

include/swift/AST/TypeAlignments.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::SILFunctionType,
124124
LLVM_DECLARE_TYPE_ALIGNMENT(swift::Stmt, swift::StmtAlignInBits)
125125
LLVM_DECLARE_TYPE_ALIGNMENT(swift::BraceStmt, swift::StmtAlignInBits)
126126

127-
LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits);
127+
LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits)
128128
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DeclContext, swift::DeclContextAlignInBits)
129129
LLVM_DECLARE_TYPE_ALIGNMENT(swift::FileUnit, swift::DeclContextAlignInBits)
130130
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DifferentiableAttr, swift::PointerAlignInBits)
@@ -153,7 +153,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::AttributeBase, swift::AttrAlignInBits)
153153

154154
LLVM_DECLARE_TYPE_ALIGNMENT(swift::TypeRepr, swift::TypeReprAlignInBits)
155155

156-
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits);
156+
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits)
157157

158158
static_assert(alignof(void*) >= 2, "pointer alignment is too small");
159159

include/swift/AST/Types.h

+10-10
Original file line numberDiff line numberDiff line change
@@ -1416,7 +1416,7 @@ class BuiltinRawPointerType : public BuiltinType {
14161416
return T->getKind() == TypeKind::BuiltinRawPointer;
14171417
}
14181418
};
1419-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType);
1419+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType)
14201420

14211421
/// BuiltinRawContinuationType - The builtin raw unsafe continuation type.
14221422
/// In C, this is a non-null AsyncTask*. This pointer is completely
@@ -1431,7 +1431,7 @@ class BuiltinRawUnsafeContinuationType : public BuiltinType {
14311431
return T->getKind() == TypeKind::BuiltinRawUnsafeContinuation;
14321432
}
14331433
};
1434-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawUnsafeContinuationType, BuiltinType);
1434+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawUnsafeContinuationType, BuiltinType)
14351435

14361436
/// BuiltinExecutorType - The builtin executor-ref type. In C, this
14371437
/// is the ExecutorRef struct type.
@@ -1444,7 +1444,7 @@ class BuiltinExecutorType : public BuiltinType {
14441444
return T->getKind() == TypeKind::BuiltinExecutor;
14451445
}
14461446
};
1447-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinExecutorType, BuiltinType);
1447+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinExecutorType, BuiltinType)
14481448

14491449
/// BuiltinJobType - The builtin job type. In C, this is a
14501450
/// non-null Job*. This pointer is completely unmanaged (the unscheduled
@@ -1458,7 +1458,7 @@ class BuiltinJobType : public BuiltinType {
14581458
return T->getKind() == TypeKind::BuiltinJob;
14591459
}
14601460
};
1461-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinJobType, BuiltinType);
1461+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinJobType, BuiltinType)
14621462

14631463
/// BuiltinDefaultActorStorageType - The type of the stored property
14641464
/// that's added implicitly to default actors. No C equivalent because
@@ -1474,7 +1474,7 @@ class BuiltinDefaultActorStorageType : public BuiltinType {
14741474
return T->getKind() == TypeKind::BuiltinDefaultActorStorage;
14751475
}
14761476
};
1477-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinDefaultActorStorageType, BuiltinType);
1477+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinDefaultActorStorageType, BuiltinType)
14781478

14791479
/// BuiltinNativeObjectType - The builtin opaque object-pointer type.
14801480
/// Useful for keeping an object alive when it is otherwise being
@@ -1488,7 +1488,7 @@ class BuiltinNativeObjectType : public BuiltinType {
14881488
return T->getKind() == TypeKind::BuiltinNativeObject;
14891489
}
14901490
};
1491-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinNativeObjectType, BuiltinType);
1491+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinNativeObjectType, BuiltinType)
14921492

14931493
/// A type that contains an owning reference to a heap object packed with
14941494
/// additional bits. The type uses a bit to discriminate native Swift objects
@@ -1502,7 +1502,7 @@ class BuiltinBridgeObjectType : public BuiltinType {
15021502
return T->getKind() == TypeKind::BuiltinBridgeObject;
15031503
}
15041504
};
1505-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinBridgeObjectType, BuiltinType);
1505+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinBridgeObjectType, BuiltinType)
15061506

15071507
/// BuiltinUnsafeValueBufferType - The builtin opaque fixed-size value
15081508
/// buffer type, into which storage for an arbitrary value can be
@@ -1521,7 +1521,7 @@ class BuiltinUnsafeValueBufferType : public BuiltinType {
15211521
return T->getKind() == TypeKind::BuiltinUnsafeValueBuffer;
15221522
}
15231523
};
1524-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinUnsafeValueBufferType, BuiltinType);
1524+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinUnsafeValueBufferType, BuiltinType)
15251525

15261526
/// A builtin vector type.
15271527
class BuiltinVectorType : public BuiltinType, public llvm::FoldingSetNode {
@@ -1752,7 +1752,7 @@ class BuiltinIntegerLiteralType : public AnyBuiltinIntegerType {
17521752

17531753
BuiltinIntegerWidth getWidth() const = delete;
17541754
};
1755-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType);
1755+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType)
17561756

17571757
inline BuiltinIntegerWidth AnyBuiltinIntegerType::getWidth() const {
17581758
if (auto intTy = dyn_cast<BuiltinIntegerType>(this)) {
@@ -4119,7 +4119,7 @@ substOpaqueTypesWithUnderlyingTypes(ProtocolConformanceRef ref, Type origType,
41194119
TypeExpansionContext context);
41204120
namespace Lowering {
41214121
class TypeConverter;
4122-
};
4122+
}
41234123

41244124
/// SILFunctionType - The lowered type of a function value, suitable
41254125
/// for use by SIL.

include/swift/Basic/Fingerprint.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace llvm {
2424
namespace yaml {
2525
class IO;
2626
}
27-
}; // namespace llvm
27+
} // namespace llvm
2828

2929
namespace swift {
3030

@@ -118,7 +118,7 @@ class Fingerprint final {
118118
};
119119

120120
void simple_display(llvm::raw_ostream &out, const Fingerprint &fp);
121-
}; // namespace swift
121+
} // namespace swift
122122

123123
namespace swift {
124124

@@ -134,11 +134,11 @@ template <> struct StableHasher::Combiner<Fingerprint> {
134134
}
135135
};
136136

137-
}; // namespace swift
137+
} // namespace swift
138138

139139
namespace llvm {
140140
class raw_ostream;
141141
raw_ostream &operator<<(raw_ostream &OS, const swift::Fingerprint &fp);
142-
}; // namespace llvm
142+
} // namespace llvm
143143

144144
#endif // SWIFT_BASIC_FINGERPRINT_H

include/swift/Runtime/InstrumentsSupport.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,6 @@ size_t _swift_indexToSize(size_t idx);
6060
SWIFT_RUNTIME_EXPORT
6161
void _swift_zone_init(void);
6262

63-
};
63+
}
6464

6565
#endif

lib/APIDigester/ModuleAnalyzerNodes.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ SDKNodeDeclImport::SDKNodeDeclImport(SDKNodeInitInfo Info):
179179
SDKNodeDecl(Info, SDKNodeKind::DeclImport) {}
180180

181181
SDKNodeDeclAssociatedType::SDKNodeDeclAssociatedType(SDKNodeInitInfo Info):
182-
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {};
182+
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {}
183183

184184
SDKNodeDeclSubscript::SDKNodeDeclSubscript(SDKNodeInitInfo Info):
185185
SDKNodeDeclAbstractFunc(Info, SDKNodeKind::DeclSubscript),

lib/AST/ASTContext.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,7 @@ namespace {
17421742
static StringRef
17431743
pathStringFromFrameworkSearchPath(const SearchPathOptions::FrameworkSearchPath &next) {
17441744
return next.Path;
1745-
};
1745+
}
17461746
}
17471747

17481748
std::vector<std::string> ASTContext::getDarwinImplicitFrameworkSearchPaths()

lib/AST/ASTMangler.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1727,7 +1727,7 @@ static char getParamConvention(ParameterConvention conv) {
17271727
case ParameterConvention::Direct_Guaranteed: return 'g';
17281728
}
17291729
llvm_unreachable("bad parameter convention");
1730-
};
1730+
}
17311731

17321732
static Optional<char>
17331733
getParamDifferentiability(SILParameterDifferentiability diffKind) {
@@ -1738,7 +1738,7 @@ getParamDifferentiability(SILParameterDifferentiability diffKind) {
17381738
return 'w';
17391739
}
17401740
llvm_unreachable("bad parameter differentiability");
1741-
};
1741+
}
17421742

17431743
static char getResultConvention(ResultConvention conv) {
17441744
switch (conv) {
@@ -1749,7 +1749,7 @@ static char getResultConvention(ResultConvention conv) {
17491749
case ResultConvention::Autoreleased: return 'a';
17501750
}
17511751
llvm_unreachable("bad result convention");
1752-
};
1752+
}
17531753

17541754
static Optional<char>
17551755
getResultDifferentiability(SILResultDifferentiability diffKind) {
@@ -1760,7 +1760,7 @@ getResultDifferentiability(SILResultDifferentiability diffKind) {
17601760
return 'w';
17611761
}
17621762
llvm_unreachable("bad result differentiability");
1763-
};
1763+
}
17641764

17651765
void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
17661766
GenericSignature outerGenericSig) {

lib/AST/AccessNotes.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ void AccessNote::dump(llvm::raw_ostream &os, int indent) const {
163163

164164
}
165165

166-
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::AccessNoteDeclName, QuotingType::Single);
167-
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::ObjCSelector, QuotingType::Single);
166+
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::AccessNoteDeclName, QuotingType::Single)
167+
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::ObjCSelector, QuotingType::Single)
168168
LLVM_YAML_IS_SEQUENCE_VECTOR(swift::AccessNote)
169169
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::AccessNotesFile)
170170

lib/AST/Decl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4199,7 +4199,7 @@ static AssociatedTypeDecl *getAssociatedTypeAnchor(
41994199

42004200
return bestAnchor;
42014201
}
4202-
};
4202+
}
42034203

42044204
AssociatedTypeDecl *AssociatedTypeDecl::getAssociatedTypeAnchor() const {
42054205
llvm::SmallSet<const AssociatedTypeDecl *, 8> searched;

lib/AST/ImportCache.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ ImportCache::getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
309309
auto result = allocateArray(ctx, accessPaths);
310310
ShadowCache[key] = result;
311311
return result;
312-
};
312+
}
313313

314314
ArrayRef<ImportedModule>
315315
swift::namelookup::getAllImports(const DeclContext *dc) {

lib/AST/RequirementMachine/HomotopyReduction.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ bool RewriteStep::isInverseOf(const RewriteStep &other) const {
343343

344344
assert(EndOffset == other.EndOffset && "Bad whiskering?");
345345
return true;
346-
};
346+
}
347347

348348
bool RewriteStep::maybeSwapRewriteSteps(RewriteStep &other,
349349
const RewriteSystem &system) {

lib/Basic/PrefixMap.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void swift::printOpaquePrefixMap(raw_ostream &out, void *_root,
118118

119119
void PrefixMapKeyPrinter<char>::print(raw_ostream &out, ArrayRef<char> key) {
120120
out << QuotedString(StringRef(key.data(), key.size()));
121-
};
121+
}
122122

123123
void PrefixMapKeyPrinter<unsigned char>::print(raw_ostream &out,
124124
ArrayRef<unsigned char> key) {

lib/Basic/StableHasher.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static inline void sip_round(uint64_t &v0, uint64_t &v1, uint64_t &v2,
3535
v1 ^= v2;
3636
v2 = ROTATE_LEFT(v2, 32);
3737
}
38-
}; // end anonymous namespace
38+
} // end anonymous namespace
3939

4040
void StableHasher::compress(uint64_t value) {
4141
state.v3 ^= value;

lib/ClangImporter/SwiftLookupTable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ void SwiftLookupTableWriter::populateTable(SwiftLookupTable &table,
21172117

21182118
// Finalize the lookup table, which may fail.
21192119
finalizeLookupTable(table, nameImporter, buffersForDiagnostics);
2120-
};
2120+
}
21212121

21222122
std::unique_ptr<clang::ModuleFileExtensionWriter>
21232123
SwiftNameLookupExtension::createExtensionWriter(clang::ASTWriter &writer) {

lib/Demangling/NodePrinter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3047,7 +3047,7 @@ NodePointer NodePrinter::printEntity(NodePointer Entity, unsigned depth,
30473047
PostfixContext = nullptr;
30483048
}
30493049
return PostfixContext;
3050-
};
3050+
}
30513051

30523052
void NodePrinter::printEntityType(NodePointer Entity, NodePointer type,
30533053
NodePointer genericFunctionTypeList,

lib/Demangling/OldRemangler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static bool isInSwiftModule(Node *node) {
259259
context->getText() == STDLIB_NAME &&
260260
// Check for private declarations in Swift
261261
node->getChild(1)->getKind() == Node::Kind::Identifier);
262-
};
262+
}
263263

264264
bool Remangler::mangleStandardSubstitution(Node *node) {
265265
// Look for known substitutions.

lib/Driver/Compilation.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Compilation::Compilation(DiagnosticEngine &Diags,
150150
EmitFineGrainedDependencyDotFileAfterEveryImport(
151151
EmitFineGrainedDependencyDotFileAfterEveryImport),
152152
EnableCrossModuleIncrementalBuild(EnableCrossModuleIncrementalBuild)
153-
{ };
153+
{ }
154154
// clang-format on
155155

156156
static bool writeFilelistIfNecessary(const Job *job, const ArgList &args,

lib/Frontend/ArgsToFrontendOutputsConverter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ SupplementaryOutputPathsComputer::determineSupplementaryOutputFilename(
550550
llvm::SmallString<128> path(defaultSupplementaryOutputPathExcludingExtension);
551551
llvm::sys::path::replace_extension(path, file_types::getExtension(type));
552552
return path.str().str();
553-
};
553+
}
554554

555555
void SupplementaryOutputPathsComputer::deriveModulePathParameters(
556556
StringRef mainOutputFile, options::ID &emitOption, std::string &extension,

lib/IDE/APIDigesterData.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,11 @@ static APIDiffItemKind parseDiffItemKind(StringRef Content) {
329329
static StringRef getScalarString(llvm::yaml::Node *N) {
330330
auto WithQuote = cast<llvm::yaml::ScalarNode>(N)->getRawValue();
331331
return WithQuote.substr(1, WithQuote.size() - 2);
332-
};
332+
}
333333

334334
static int getScalarInt(llvm::yaml::Node *N) {
335335
return std::stoi(cast<llvm::yaml::ScalarNode>(N)->getRawValue().str());
336-
};
336+
}
337337

338338
static APIDiffItem*
339339
serializeDiffItem(llvm::BumpPtrAllocator &Alloc,

0 commit comments

Comments
 (0)