Skip to content

Commit

Permalink
Merge pull request TrenchBroom#3922 from TrenchBroom/3921-glAssert-se…
Browse files Browse the repository at this point in the history
…micolon

3921: Fix missing semicolons after glAssert
  • Loading branch information
kduske authored Nov 15, 2021
2 parents 0e85287 + b6b4ff4 commit 7c8885b
Show file tree
Hide file tree
Showing 108 changed files with 326 additions and 283 deletions.
2 changes: 1 addition & 1 deletion common/src/Assets/PropertyDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ std::string PropertyDefinition::defaultValue(const PropertyDefinition& definitio
case PropertyDefinitionType::TargetSourceProperty:
case PropertyDefinitionType::TargetDestinationProperty:
return "";
switchDefault()
switchDefault();
}
}

Expand Down
4 changes: 2 additions & 2 deletions common/src/EL/EvaluationContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class EvaluationContext {
virtual Value variableValue(const std::string& name) const;
virtual void declareVariable(const std::string& name, const Value& value);

deleteCopyAndMove(EvaluationContext)
deleteCopyAndMove(EvaluationContext);
};

class EvaluationStack : public EvaluationContext {
Expand All @@ -51,7 +51,7 @@ class EvaluationStack : public EvaluationContext {

Value variableValue(const std::string& name) const override;

deleteCopyAndMove(EvaluationStack)
deleteCopyAndMove(EvaluationStack);
};
} // namespace EL
} // namespace TrenchBroom
2 changes: 1 addition & 1 deletion common/src/EL/Types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std::string typeName(const ValueType type) {
return "Null";
case ValueType::Undefined:
return "Undefined";
switchDefault()
switchDefault();
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/FileLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ class FileLogger : public Logger {
void doLog(LogLevel level, const std::string& message) override;
void doLog(LogLevel level, const QString& message) override;

deleteCopyAndMove(FileLogger)
deleteCopyAndMove(FileLogger);
};
} // namespace TrenchBroom
2 changes: 1 addition & 1 deletion common/src/IO/CompilationConfigParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CompilationConfigParser : public ConfigParserBase {
std::unique_ptr<Model::CompilationTask> parseCopyTask(const EL::Value& value) const;
std::unique_ptr<Model::CompilationTask> parseToolTask(const EL::Value& value) const;

deleteCopyAndMove(CompilationConfigParser)
deleteCopyAndMove(CompilationConfigParser);
};
} // namespace IO
} // namespace TrenchBroom
2 changes: 1 addition & 1 deletion common/src/IO/CompilationConfigWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CompilationConfigWriter {

std::string escape(const std::string& str) const;

deleteCopyAndMove(CompilationConfigWriter)
deleteCopyAndMove(CompilationConfigWriter);
};
} // namespace IO
} // namespace TrenchBroom
2 changes: 1 addition & 1 deletion common/src/IO/EntityDefinitionParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ std::unique_ptr<Assets::EntityDefinition> EntityDefinitionParser::createDefiniti
name, color, std::move(description), std::move(attributes));
case EntityDefinitionClassType::BaseClass:
return nullptr;
switchDefault()
switchDefault();
};
}

Expand Down
29 changes: 17 additions & 12 deletions common/src/IO/FileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ class File;
class Path;

class FileSystem {
deleteCopyAndMove(FileSystem) protected :
/**
* Next filesystem in the search path.
*
* NOTE: the use of std::shared_ptr is because there is shared ownership during construction of
* the filesystems (std::unique_ptr would require std::move'ing the existing chain of
* filesystems when passing it to the FileSystem constructor, which means if the constructor
* throws, the existing filesystem chain gets destroyed. FileSystem constructors throw if there
* is an error creating the filesystem, so std::unique_ptr isn't usable with this design.)
*/
std::shared_ptr<FileSystem> m_next;
deleteCopyAndMove(FileSystem);

protected:
/**
* Next filesystem in the search path.
*
* NOTE: the use of std::shared_ptr is because there is shared ownership during construction of
* the filesystems (std::unique_ptr would require std::move'ing the existing chain of
* filesystems when passing it to the FileSystem constructor, which means if the constructor
* throws, the existing filesystem chain gets destroyed. FileSystem constructors throw if there
* is an error creating the filesystem, so std::unique_ptr isn't usable with this design.)
*/
std::shared_ptr<FileSystem> m_next;

public: // public API
explicit FileSystem(std::shared_ptr<FileSystem> next = std::shared_ptr<FileSystem>());
Expand Down Expand Up @@ -215,7 +217,10 @@ class FileSystem {
};

class WritableFileSystem {
deleteCopyAndMove(WritableFileSystem) public : WritableFileSystem();
deleteCopyAndMove(WritableFileSystem);

public:
WritableFileSystem();
virtual ~WritableFileSystem();

/**
Expand Down
2 changes: 1 addition & 1 deletion common/src/IO/GameConfigParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GameConfigParser : public ConfigParserBase {
int parseFlagValue(const EL::Value& value, const Model::FlagsConfig& flags) const;
std::vector<Model::TagAttribute> parseTagAttributes(const EL::Value& values) const;

deleteCopyAndMove(GameConfigParser)
deleteCopyAndMove(GameConfigParser);
};

std::optional<vm::bbox3> parseSoftMapBoundsString(const std::string& string);
Expand Down
2 changes: 1 addition & 1 deletion common/src/IO/GameEngineConfigParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GameEngineConfigParser : public ConfigParserBase {
const EL::Value& value) const;
std::unique_ptr<Model::GameEngineProfile> parseProfile(const EL::Value& value) const;

deleteCopyAndMove(GameEngineConfigParser)
deleteCopyAndMove(GameEngineConfigParser);
};
} // namespace IO
} // namespace TrenchBroom
2 changes: 1 addition & 1 deletion common/src/IO/GameEngineConfigWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GameEngineConfigWriter {
EL::Value writeProfiles(const Model::GameEngineConfig& config) const;
EL::Value writeProfile(const Model::GameEngineProfile* profile) const;

deleteCopyAndMove(GameEngineConfigWriter)
deleteCopyAndMove(GameEngineConfigWriter);
};
} // namespace IO
} // namespace TrenchBroom
4 changes: 2 additions & 2 deletions common/src/IO/ImageLoaderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ FREE_IMAGE_FORMAT ImageLoaderImpl::translateFormat(const ImageLoader::Format for
return FIF_PCX;
case ImageLoader::BMP:
return FIF_BMP;
switchDefault()
switchDefault();
}
}

Expand All @@ -215,7 +215,7 @@ size_t ImageLoaderImpl::pixelSize(const ImageLoader::PixelFormat format) {
return 3;
case ImageLoader::RGBA:
return 4;
switchDefault()
switchDefault();
}
}
} // namespace IO
Expand Down
2 changes: 1 addition & 1 deletion common/src/IO/MapFileSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ std::unique_ptr<NodeSerializer> MapFileSerializer::create(
return std::make_unique<Hexen2FileSerializer>(stream);
case Model::MapFormat::Unknown:
throw FileFormatException("Unknown map file format");
switchDefault()
switchDefault();
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/IO/StandardMapParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ void StandardMapParser::parseFace(ParserStatus& status, const bool primitive) {
case Model::MapFormat::Unknown:
// cannot happen
break;
switchDefault()
switchDefault();
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/src/IO/TextureLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class TextureLoader {
Assets::TextureCollection loadTextureCollection(const Path& path);
void loadTextures(const std::vector<Path>& paths, Assets::TextureManager& textureManager);

deleteCopyAndMove(TextureLoader)
deleteCopyAndMove(TextureLoader);
};
} // namespace IO
} // namespace TrenchBroom
10 changes: 5 additions & 5 deletions common/src/IO/TextureReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TextureReader {
virtual std::string doGetTextureName(
const std::string& textureName, const Path& path) const = 0;

deleteCopyAndMove(NameStrategy)
deleteCopyAndMove(NameStrategy);
};

class TextureNameStrategy : public NameStrategy {
Expand All @@ -65,7 +65,7 @@ class TextureReader {
NameStrategy* doClone() const override;
std::string doGetTextureName(const std::string& textureName, const Path& path) const override;

deleteCopyAndMove(TextureNameStrategy)
deleteCopyAndMove(TextureNameStrategy);
};

/**
Expand All @@ -92,7 +92,7 @@ class TextureReader {
NameStrategy* doClone() const override;
std::string doGetTextureName(const std::string& textureName, const Path& path) const override;

deleteCopyAndMove(PathSuffixNameStrategy)
deleteCopyAndMove(PathSuffixNameStrategy);
};

class StaticNameStrategy : public NameStrategy {
Expand All @@ -106,7 +106,7 @@ class TextureReader {
NameStrategy* doClone() const override;
std::string doGetTextureName(const std::string& textureName, const Path& path) const override;

deleteCopyAndMove(StaticNameStrategy)
deleteCopyAndMove(StaticNameStrategy);
};

private:
Expand Down Expand Up @@ -152,7 +152,7 @@ class TextureReader {
public:
static size_t mipSize(size_t width, size_t height, size_t mipLevel);

deleteCopyAndMove(TextureReader)
deleteCopyAndMove(TextureReader);
};
} // namespace IO
} // namespace TrenchBroom
22 changes: 12 additions & 10 deletions common/src/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,50 +28,52 @@
// The following macro is used to silence a compiler warning in MSVC and GCC when a switch is used
// in a function to compute a return value, and there is no default path.
#ifdef __clang__
#define switchDefault()
#define switchDefault() \
do { \
} while (0)
#else
#define switchDefault() \
default: \
assert(false); \
throw "Unhandled switch case";
throw "Unhandled switch case"
#endif

// Annotate an intended switch fallthrough
#define switchFallthrough() [[fallthrough]]

#define assertResult(funexp) \
{ \
do { \
const bool result_ = (funexp); \
unused(result_); \
assert(result_); \
}
} while (0)

#define defineCopy(classname) \
public: \
classname(const classname& other) = default; \
classname& operator=(const classname& other) = default;
classname& operator=(const classname& other) = default
#define defineMove(classname) \
public: \
classname(classname&& other) noexcept = default; \
classname& operator=(classname&& other) = default;
classname& operator=(classname&& other) = default
#define defineCopyAndMove(classname) \
public: \
classname(const classname& other) = default; \
classname(classname&& other) noexcept = default; \
classname& operator=(const classname& other) = default; \
classname& operator=(classname&& other) = default;
classname& operator=(classname&& other) = default

#define deleteCopy(classname) \
public: \
classname(const classname& other) = delete; \
classname& operator=(const classname& other) = delete;
classname& operator=(const classname& other) = delete
#define deleteMove(classname) \
public: \
classname(classname&& other) = delete; \
classname& operator=(classname&& other) = delete;
classname& operator=(classname&& other) = delete
#define deleteCopyAndMove(classname) \
public: \
classname(const classname& other) = delete; \
classname(classname&& other) noexcept = delete; \
classname& operator=(const classname& other) = delete; \
classname& operator=(classname&& other) = delete;
classname& operator=(classname&& other) = delete
2 changes: 1 addition & 1 deletion common/src/Model/BrushNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class BrushNode : public Node, public Object {
void doAcceptTagVisitor(ConstTagVisitor& visitor) const override;

private:
deleteCopyAndMove(BrushNode)
deleteCopyAndMove(BrushNode);
};

bool operator==(const BrushNode& lhs, const BrushNode& rhs);
Expand Down
10 changes: 5 additions & 5 deletions common/src/Model/ChangeBrushFaceAttributesRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static T evaluateValueOp(
return oldValue * newValue;
case ChangeBrushFaceAttributesRequest::ValueOp_None:
return oldValue;
switchDefault()
switchDefault();
}
}

Expand All @@ -60,7 +60,7 @@ static std::optional<T> evaluateValueOp(
return oldValue.value_or(oldValueFallback) * newValue.value_or(T{});
case ChangeBrushFaceAttributesRequest::ValueOp_None:
return oldValue;
switchDefault()
switchDefault();
}
}

Expand All @@ -76,7 +76,7 @@ static T evaluateFlagOp(
return oldValue & ~newValue;
case ChangeBrushFaceAttributesRequest::FlagOp_None:
return oldValue;
switchDefault()
switchDefault();
}
}

Expand All @@ -93,7 +93,7 @@ static std::optional<T> evaluateFlagOp(
return oldValue.value_or(oldValueFallback) & ~newValue.value_or(T{});
case ChangeBrushFaceAttributesRequest::FlagOp_None:
return oldValue;
switchDefault()
switchDefault();
}
}

Expand Down Expand Up @@ -184,7 +184,7 @@ bool ChangeBrushFaceAttributesRequest::evaluate(BrushFace& brushFace) const {
break;
case AxisOp_ToParallel:
break;
switchDefault()
switchDefault();
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion common/src/Model/CompilationProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CompilationProfile {
void accept(const CompilationTaskConstVisitor& visitor);
void accept(const ConstCompilationTaskConstVisitor& visitor) const;

deleteCopyAndMove(CompilationProfile)
deleteCopyAndMove(CompilationProfile);
};
} // namespace Model
} // namespace TrenchBroom
8 changes: 4 additions & 4 deletions common/src/Model/CompilationTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CompilationTask {
bool operator!=(const CompilationTask& other) const;
virtual void appendToStream(std::ostream& str) const = 0;

deleteCopyAndMove(CompilationTask)
deleteCopyAndMove(CompilationTask);
};

std::ostream& operator<<(std::ostream& str, const CompilationTask& task);
Expand All @@ -79,7 +79,7 @@ class CompilationExportMap : public CompilationTask {
bool operator==(const CompilationTask& other) const override;
void appendToStream(std::ostream& str) const override;

deleteCopyAndMove(CompilationExportMap)
deleteCopyAndMove(CompilationExportMap);
};

class CompilationCopyFiles : public CompilationTask {
Expand All @@ -105,7 +105,7 @@ class CompilationCopyFiles : public CompilationTask {
bool operator==(const CompilationTask& other) const override;
void appendToStream(std::ostream& str) const override;

deleteCopyAndMove(CompilationCopyFiles)
deleteCopyAndMove(CompilationCopyFiles);
};

class CompilationRunTool : public CompilationTask {
Expand All @@ -131,7 +131,7 @@ class CompilationRunTool : public CompilationTask {
bool operator==(const CompilationTask& other) const override;
void appendToStream(std::ostream& str) const override;

deleteCopyAndMove(CompilationRunTool)
deleteCopyAndMove(CompilationRunTool);
};

class CompilationTaskVisitor {
Expand Down
Loading

0 comments on commit 7c8885b

Please sign in to comment.