Skip to content

Commit 910fbee

Browse files
committed
gardening: make c++98-compat-extra-semi an error
This cleans up 90 instances of this warning and reduces the build spew when building on Linux. This helps identify actual issues when building which can get lost in the stream of warning messages. It also helps restore the ability to build the compiler with gcc.
1 parent 17f1cf9 commit 910fbee

Some content is hidden

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

58 files changed

+96
-90
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::SILFunctionType,
123123
LLVM_DECLARE_TYPE_ALIGNMENT(swift::Stmt, swift::StmtAlignInBits)
124124
LLVM_DECLARE_TYPE_ALIGNMENT(swift::BraceStmt, swift::StmtAlignInBits)
125125

126-
LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits);
126+
LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits)
127127
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DeclContext, swift::DeclContextAlignInBits)
128128
LLVM_DECLARE_TYPE_ALIGNMENT(swift::FileUnit, swift::DeclContextAlignInBits)
129129
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DifferentiableAttr, swift::PointerAlignInBits)
@@ -152,7 +152,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::AttributeBase, swift::AttrAlignInBits)
152152

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

155-
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits);
155+
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits)
156156

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

include/swift/AST/Types.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ class BuiltinRawPointerType : public BuiltinType {
14071407
return T->getKind() == TypeKind::BuiltinRawPointer;
14081408
}
14091409
};
1410-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType);
1410+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType)
14111411

14121412
/// BuiltinRawContinuationType - The builtin raw unsafe continuation type.
14131413
/// In C, this is a non-null AsyncTask*. This pointer is completely
@@ -1422,7 +1422,7 @@ class BuiltinRawUnsafeContinuationType : public BuiltinType {
14221422
return T->getKind() == TypeKind::BuiltinRawUnsafeContinuation;
14231423
}
14241424
};
1425-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawUnsafeContinuationType, BuiltinType);
1425+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawUnsafeContinuationType, BuiltinType)
14261426

14271427
/// BuiltinExecutorType - The builtin executor-ref type. In C, this
14281428
/// is the ExecutorRef struct type.
@@ -1435,7 +1435,7 @@ class BuiltinExecutorType : public BuiltinType {
14351435
return T->getKind() == TypeKind::BuiltinExecutor;
14361436
}
14371437
};
1438-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinExecutorType, BuiltinType);
1438+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinExecutorType, BuiltinType)
14391439

14401440
/// BuiltinJobType - The builtin job type. In C, this is a
14411441
/// non-null Job*. This pointer is completely unmanaged (the unscheduled
@@ -1449,7 +1449,7 @@ class BuiltinJobType : public BuiltinType {
14491449
return T->getKind() == TypeKind::BuiltinJob;
14501450
}
14511451
};
1452-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinJobType, BuiltinType);
1452+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinJobType, BuiltinType)
14531453

14541454
/// BuiltinDefaultActorStorageType - The type of the stored property
14551455
/// that's added implicitly to default actors. No C equivalent because
@@ -1465,7 +1465,7 @@ class BuiltinDefaultActorStorageType : public BuiltinType {
14651465
return T->getKind() == TypeKind::BuiltinDefaultActorStorage;
14661466
}
14671467
};
1468-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinDefaultActorStorageType, BuiltinType);
1468+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinDefaultActorStorageType, BuiltinType)
14691469

14701470
/// BuiltinNativeObjectType - The builtin opaque object-pointer type.
14711471
/// Useful for keeping an object alive when it is otherwise being
@@ -1479,7 +1479,7 @@ class BuiltinNativeObjectType : public BuiltinType {
14791479
return T->getKind() == TypeKind::BuiltinNativeObject;
14801480
}
14811481
};
1482-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinNativeObjectType, BuiltinType);
1482+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinNativeObjectType, BuiltinType)
14831483

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

14981498
/// BuiltinUnsafeValueBufferType - The builtin opaque fixed-size value
14991499
/// buffer type, into which storage for an arbitrary value can be
@@ -1512,7 +1512,7 @@ class BuiltinUnsafeValueBufferType : public BuiltinType {
15121512
return T->getKind() == TypeKind::BuiltinUnsafeValueBuffer;
15131513
}
15141514
};
1515-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinUnsafeValueBufferType, BuiltinType);
1515+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinUnsafeValueBufferType, BuiltinType)
15161516

15171517
/// A builtin vector type.
15181518
class BuiltinVectorType : public BuiltinType, public llvm::FoldingSetNode {
@@ -1743,7 +1743,7 @@ class BuiltinIntegerLiteralType : public AnyBuiltinIntegerType {
17431743

17441744
BuiltinIntegerWidth getWidth() const = delete;
17451745
};
1746-
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType);
1746+
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType)
17471747

17481748
inline BuiltinIntegerWidth AnyBuiltinIntegerType::getWidth() const {
17491749
if (auto intTy = dyn_cast<BuiltinIntegerType>(this)) {
@@ -4096,7 +4096,7 @@ substOpaqueTypesWithUnderlyingTypes(ProtocolConformanceRef ref, Type origType,
40964096
TypeExpansionContext context);
40974097
namespace Lowering {
40984098
class TypeConverter;
4099-
};
4099+
}
41004100

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

include/swift/Basic/Fingerprint.h

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ SDKNodeDeclImport::SDKNodeDeclImport(SDKNodeInitInfo Info):
178178
SDKNodeDecl(Info, SDKNodeKind::DeclImport) {}
179179

180180
SDKNodeDeclAssociatedType::SDKNodeDeclAssociatedType(SDKNodeInitInfo Info):
181-
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {};
181+
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {}
182182

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

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4182,7 +4182,7 @@ static AssociatedTypeDecl *getAssociatedTypeAnchor(
41824182

41834183
return bestAnchor;
41844184
}
4185-
};
4185+
}
41864186

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

lib/AST/ImportCache.cpp

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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)