Skip to content

gardening: make c++98-compat-extra-semi an error #40305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,12 @@ if(CMAKE_C_COMPILER_ID MATCHES Clang)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Werror=gnu>)
endif()

# Make some warnings errors as they are commonly occurring and flood the build
# with unnecessary noise.
if(CMAKE_C_COMPILER_ID MATCHES Clang)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-Werror=c++98-compat-extra-semi>)
endif()

# Use dispatch as the system scheduler by default.
# For convenience, we set this to false when concurrency is disabled.
set(SWIFT_CONCURRENCY_USES_DISPATCH FALSE)
Expand Down
4 changes: 2 additions & 2 deletions include/swift/AST/ExtInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ convertRepresentation(FunctionTypeRepresentation rep) {
return SILFunctionTypeRepresentation::CFunctionPointer;
}
llvm_unreachable("Unhandled FunctionTypeRepresentation!");
};
}

inline Optional<FunctionTypeRepresentation>
convertRepresentation(SILFunctionTypeRepresentation rep) {
Expand All @@ -241,7 +241,7 @@ convertRepresentation(SILFunctionTypeRepresentation rep) {
return None;
}
llvm_unreachable("Unhandled SILFunctionTypeRepresentation!");
};
}

/// Can this calling convention result in a function being called indirectly
/// through the runtime.
Expand Down
10 changes: 5 additions & 5 deletions include/swift/AST/IRGenRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class TBDGenDescriptor;

namespace irgen {
class IRGenModule;
};
}

namespace Lowering {
class TypeConverter;
};
}

}; // namespace swift
} // namespace swift

namespace llvm {
class GlobalVariable;
Expand All @@ -51,9 +51,9 @@ class TargetMachine;

namespace orc {
class ThreadSafeModule;
}; // namespace orc
} // namespace orc

}; // namespace llvm
} // namespace llvm

namespace swift {

Expand Down
2 changes: 1 addition & 1 deletion include/swift/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ inline void simple_display(llvm::raw_ostream &out, Stmt *S) {
out << Stmt::getKindName(S->getKind());
else
out << "(null)";
};
}

} // end namespace swift

Expand Down
4 changes: 2 additions & 2 deletions include/swift/AST/TypeAlignments.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::SILFunctionType,
LLVM_DECLARE_TYPE_ALIGNMENT(swift::Stmt, swift::StmtAlignInBits)
LLVM_DECLARE_TYPE_ALIGNMENT(swift::BraceStmt, swift::StmtAlignInBits)

LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits);
LLVM_DECLARE_TYPE_ALIGNMENT(swift::ASTContext, swift::ASTContextAlignInBits)
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DeclContext, swift::DeclContextAlignInBits)
LLVM_DECLARE_TYPE_ALIGNMENT(swift::FileUnit, swift::DeclContextAlignInBits)
LLVM_DECLARE_TYPE_ALIGNMENT(swift::DifferentiableAttr, swift::PointerAlignInBits)
Expand Down Expand Up @@ -152,7 +152,7 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::AttributeBase, swift::AttrAlignInBits)

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

LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits);
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits)

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

Expand Down
20 changes: 10 additions & 10 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1407,7 +1407,7 @@ class BuiltinRawPointerType : public BuiltinType {
return T->getKind() == TypeKind::BuiltinRawPointer;
}
};
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType);
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinRawPointerType, BuiltinType)

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

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

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

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

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

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

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

/// A builtin vector type.
class BuiltinVectorType : public BuiltinType, public llvm::FoldingSetNode {
Expand Down Expand Up @@ -1743,7 +1743,7 @@ class BuiltinIntegerLiteralType : public AnyBuiltinIntegerType {

BuiltinIntegerWidth getWidth() const = delete;
};
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType);
DEFINE_EMPTY_CAN_TYPE_WRAPPER(BuiltinIntegerLiteralType, AnyBuiltinIntegerType)

inline BuiltinIntegerWidth AnyBuiltinIntegerType::getWidth() const {
if (auto intTy = dyn_cast<BuiltinIntegerType>(this)) {
Expand Down Expand Up @@ -4096,7 +4096,7 @@ substOpaqueTypesWithUnderlyingTypes(ProtocolConformanceRef ref, Type origType,
TypeExpansionContext context);
namespace Lowering {
class TypeConverter;
};
}

/// SILFunctionType - The lowered type of a function value, suitable
/// for use by SIL.
Expand Down
8 changes: 4 additions & 4 deletions include/swift/Basic/Fingerprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace llvm {
namespace yaml {
class IO;
}
}; // namespace llvm
} // namespace llvm

namespace swift {

Expand Down Expand Up @@ -118,7 +118,7 @@ class Fingerprint final {
};

void simple_display(llvm::raw_ostream &out, const Fingerprint &fp);
}; // namespace swift
} // namespace swift

namespace swift {

Expand All @@ -134,11 +134,11 @@ template <> struct StableHasher::Combiner<Fingerprint> {
}
};

}; // namespace swift
} // namespace swift

namespace llvm {
class raw_ostream;
raw_ostream &operator<<(raw_ostream &OS, const swift::Fingerprint &fp);
}; // namespace llvm
} // namespace llvm

#endif // SWIFT_BASIC_FINGERPRINT_H
2 changes: 1 addition & 1 deletion include/swift/Runtime/InstrumentsSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,6 @@ size_t _swift_indexToSize(size_t idx);
SWIFT_RUNTIME_EXPORT
void _swift_zone_init(void);

};
}

#endif
2 changes: 1 addition & 1 deletion lib/APIDigester/ModuleAnalyzerNodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ SDKNodeDeclImport::SDKNodeDeclImport(SDKNodeInitInfo Info):
SDKNodeDecl(Info, SDKNodeKind::DeclImport) {}

SDKNodeDeclAssociatedType::SDKNodeDeclAssociatedType(SDKNodeInitInfo Info):
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {};
SDKNodeDecl(Info, SDKNodeKind::DeclAssociatedType) {}

SDKNodeDeclSubscript::SDKNodeDeclSubscript(SDKNodeInitInfo Info):
SDKNodeDeclAbstractFunc(Info, SDKNodeKind::DeclSubscript),
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1742,7 +1742,7 @@ namespace {
static StringRef
pathStringFromFrameworkSearchPath(const SearchPathOptions::FrameworkSearchPath &next) {
return next.Path;
};
}
}

std::vector<std::string> ASTContext::getDarwinImplicitFrameworkSearchPaths()
Expand Down
8 changes: 4 additions & 4 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1727,7 +1727,7 @@ static char getParamConvention(ParameterConvention conv) {
case ParameterConvention::Direct_Guaranteed: return 'g';
}
llvm_unreachable("bad parameter convention");
};
}

static Optional<char>
getParamDifferentiability(SILParameterDifferentiability diffKind) {
Expand All @@ -1738,7 +1738,7 @@ getParamDifferentiability(SILParameterDifferentiability diffKind) {
return 'w';
}
llvm_unreachable("bad parameter differentiability");
};
}

static char getResultConvention(ResultConvention conv) {
switch (conv) {
Expand All @@ -1749,7 +1749,7 @@ static char getResultConvention(ResultConvention conv) {
case ResultConvention::Autoreleased: return 'a';
}
llvm_unreachable("bad result convention");
};
}

static Optional<char>
getResultDifferentiability(SILResultDifferentiability diffKind) {
Expand All @@ -1760,7 +1760,7 @@ getResultDifferentiability(SILResultDifferentiability diffKind) {
return 'w';
}
llvm_unreachable("bad result differentiability");
};
}

void ASTMangler::appendImplFunctionType(SILFunctionType *fn,
GenericSignature outerGenericSig) {
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/AccessNotes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ void AccessNote::dump(llvm::raw_ostream &os, int indent) const {

}

LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::AccessNoteDeclName, QuotingType::Single);
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::ObjCSelector, QuotingType::Single);
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::AccessNoteDeclName, QuotingType::Single)
LLVM_YAML_DECLARE_SCALAR_TRAITS(swift::ObjCSelector, QuotingType::Single)
LLVM_YAML_IS_SEQUENCE_VECTOR(swift::AccessNote)
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::AccessNotesFile)

Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4182,7 +4182,7 @@ static AssociatedTypeDecl *getAssociatedTypeAnchor(

return bestAnchor;
}
};
}

AssociatedTypeDecl *AssociatedTypeDecl::getAssociatedTypeAnchor() const {
llvm::SmallSet<const AssociatedTypeDecl *, 8> searched;
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/ImportCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ ImportCache::getAllAccessPathsNotShadowedBy(const ModuleDecl *mod,
auto result = allocateArray(ctx, accessPaths);
ShadowCache[key] = result;
return result;
};
}

ArrayRef<ImportedModule>
swift::namelookup::getAllImports(const DeclContext *dc) {
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/RequirementMachine/HomotopyReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ bool RewriteStep::isInverseOf(const RewriteStep &other) const {

assert(EndOffset == other.EndOffset && "Bad whiskering?");
return true;
};
}

bool RewriteStep::maybeSwapRewriteSteps(RewriteStep &other,
const RewriteSystem &system) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Basic/PrefixMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void swift::printOpaquePrefixMap(raw_ostream &out, void *_root,

void PrefixMapKeyPrinter<char>::print(raw_ostream &out, ArrayRef<char> key) {
out << QuotedString(StringRef(key.data(), key.size()));
};
}

void PrefixMapKeyPrinter<unsigned char>::print(raw_ostream &out,
ArrayRef<unsigned char> key) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Basic/StableHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static inline void sip_round(uint64_t &v0, uint64_t &v1, uint64_t &v2,
v1 ^= v2;
v2 = ROTATE_LEFT(v2, 32);
}
}; // end anonymous namespace
} // end anonymous namespace

void StableHasher::compress(uint64_t value) {
state.v3 ^= value;
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/SwiftLookupTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2117,7 +2117,7 @@ void SwiftLookupTableWriter::populateTable(SwiftLookupTable &table,

// Finalize the lookup table, which may fail.
finalizeLookupTable(table, nameImporter, buffersForDiagnostics);
};
}

std::unique_ptr<clang::ModuleFileExtensionWriter>
SwiftNameLookupExtension::createExtensionWriter(clang::ASTWriter &writer) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Demangling/NodePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3047,7 +3047,7 @@ NodePointer NodePrinter::printEntity(NodePointer Entity, unsigned depth,
PostfixContext = nullptr;
}
return PostfixContext;
};
}

void NodePrinter::printEntityType(NodePointer Entity, NodePointer type,
NodePointer genericFunctionTypeList,
Expand Down
2 changes: 1 addition & 1 deletion lib/Demangling/OldRemangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static bool isInSwiftModule(Node *node) {
context->getText() == STDLIB_NAME &&
// Check for private declarations in Swift
node->getChild(1)->getKind() == Node::Kind::Identifier);
};
}

bool Remangler::mangleStandardSubstitution(Node *node) {
// Look for known substitutions.
Expand Down
2 changes: 1 addition & 1 deletion lib/Driver/Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Compilation::Compilation(DiagnosticEngine &Diags,
EmitFineGrainedDependencyDotFileAfterEveryImport(
EmitFineGrainedDependencyDotFileAfterEveryImport),
EnableCrossModuleIncrementalBuild(EnableCrossModuleIncrementalBuild)
{ };
{ }
// clang-format on

static bool writeFilelistIfNecessary(const Job *job, const ArgList &args,
Expand Down
2 changes: 1 addition & 1 deletion lib/Frontend/ArgsToFrontendOutputsConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ SupplementaryOutputPathsComputer::determineSupplementaryOutputFilename(
llvm::SmallString<128> path(defaultSupplementaryOutputPathExcludingExtension);
llvm::sys::path::replace_extension(path, file_types::getExtension(type));
return path.str().str();
};
}

void SupplementaryOutputPathsComputer::deriveModulePathParameters(
StringRef mainOutputFile, options::ID &emitOption, std::string &extension,
Expand Down
4 changes: 2 additions & 2 deletions lib/IDE/APIDigesterData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,11 @@ static APIDiffItemKind parseDiffItemKind(StringRef Content) {
static StringRef getScalarString(llvm::yaml::Node *N) {
auto WithQuote = cast<llvm::yaml::ScalarNode>(N)->getRawValue();
return WithQuote.substr(1, WithQuote.size() - 2);
};
}

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

static APIDiffItem*
serializeDiffItem(llvm::BumpPtrAllocator &Alloc,
Expand Down
Loading