From a9031b6bae742b333b1b390192fa590f2ecb07ea Mon Sep 17 00:00:00 2001 From: peterbell10 Date: Mon, 5 Oct 2020 11:27:14 +0100 Subject: Fix cmake not adding Werror on clang, and _lots_ of warnings (#4963) * Fix cmake not adding Werror on clang, and _lots_ of warnings * WIP: Build fixes * Cannot make intermediate blockhandler instance * Tiger's changes * Fix BitIndex check * Handle invalid NextState values in cMultiVersionProtocol Co-authored-by: Tiger Wang --- .../IncrementalRedstoneSimulator/RedstoneDataHelper.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h') diff --git a/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h b/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h index 16d6924b1..2f827206f 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h +++ b/src/Simulator/IncrementalRedstoneSimulator/RedstoneDataHelper.h @@ -12,7 +12,7 @@ inline void UpdateAdjustedRelative(const cChunk & From, const cChunk & To, const { DataForChunk(To).WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(From, To, Position + Offset)); - for (const auto LinkedOffset : cSimulator::GetLinkedOffsets(Offset)) + for (const auto & LinkedOffset : cSimulator::GetLinkedOffsets(Offset)) { DataForChunk(To).WakeUp(cIncrementalRedstoneSimulatorChunkData::RebaseRelativePosition(From, To, Position + LinkedOffset)); } @@ -21,7 +21,7 @@ inline void UpdateAdjustedRelative(const cChunk & From, const cChunk & To, const template inline void UpdateAdjustedRelatives(const cChunk & From, const cChunk & To, const Vector3i Position, const ArrayType & Relative) { - for (const auto Offset : Relative) + for (const auto & Offset : Relative) { UpdateAdjustedRelative(From, To, Position, Offset); } @@ -30,12 +30,18 @@ inline void UpdateAdjustedRelatives(const cChunk & From, const cChunk & To, cons template inline void InvokeForAdjustedRelatives(ForEachSourceCallback & Callback, const Vector3i Position, const ArrayType & Relative) { - for (const auto Offset : Relative) + for (const auto & Offset : Relative) { Callback(Position + Offset); } } +// Warning shouldn't trigger for inline variables, this is fixed in clang 7 +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wmissing-variable-declarations" +#endif + inline constexpr Vector3i OffsetYP{ 0, 1, 0 }; inline constexpr Vector3i OffsetYM{ 0, -1, 0 }; @@ -61,3 +67,7 @@ inline constexpr std::array RelativeLaterals { 0, 0, -1 }, } }; + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif -- cgit v1.2.3