Skip to content

Commit

Permalink
Merge pull request #1497 from Return-To-The-Roots/clang-13-compat
Browse files Browse the repository at this point in the history
Add support for Clang 13 and fix ordering of tools by AI
  • Loading branch information
Flow86 authored Feb 9, 2022
2 parents 3420c8e + 5bc1f78 commit 3d90130
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
- { compiler: gcc-11, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: gcc-11, os: ubuntu-20.04, buildType: Release }
# Latest Clang with externals
- { compiler: clang-12, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, externalSanitizer: true }
- { compiler: clang-12, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: clang-12, os: ubuntu-20.04, buildType: Release }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, cxxStandard: 14, externalSanitizer: true }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, cxxStandard: 17 }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Release }
# Latest Clang with latest boost
- { compiler: clang-12, os: ubuntu-20.04, buildType: Debug, boostVersion: 1.77.0, externalSanitizer: true }
- { compiler: clang-13, os: ubuntu-20.04, buildType: Debug, boostVersion: 1.78.0, externalSanitizer: true }

runs-on: ${{matrix.os}}

Expand Down Expand Up @@ -65,6 +65,12 @@ jobs:
path: ${{env.DEPS_DIR}}
key: ${{matrix.os}}-${{env.BOOST_VERSION}}

- name: Add LLVM repo
if: matrix.compiler == 'clang-13' && matrix.os == 'ubuntu-20.04'
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main'
sudo apt update
- name: Install Compiler
if: "!startsWith(runner.os, 'macos')"
run: |
Expand Down
3 changes: 2 additions & 1 deletion libs/common/include/Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ struct Point //-V690
T x, y;
constexpr Point() noexcept : x(getInvalidValue()), y(getInvalidValue()) {}
constexpr Point(const T x, const T y) noexcept : x(x), y(y) {}
constexpr Point(const Point&) = default;
template<typename U>
constexpr explicit Point(const Point<U>& pt) noexcept : x(static_cast<T>(pt.x)), y(static_cast<T>(pt.y))
{}
constexpr Point(const Point&) = default;
constexpr Point& operator=(const Point&) = default;

static constexpr Point Invalid() noexcept { return Point(); }
/// Create a new point with all coordinates set to value
Expand Down
2 changes: 1 addition & 1 deletion libs/s25main/ai/aijh/AIPlayerJH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2371,7 +2371,7 @@ void AIPlayerJH::AdjustSettings()
const unsigned requiredTools = numBuildingsRequiringWorker - inventory[job];
// When we are missing tools produce some.
// Slightly higher priority if we don't have any tool at all.
if(requiredTools > inventory[good])
if(requiredTools > numToolsAvailable)
return (inventory[good] == 0) ? 4 : 2;
numToolsAvailable -= requiredTools;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/s25Main/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else()
FetchContent_Declare(
GoogleBenchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.5.3
GIT_TAG v1.6.1
)
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "")
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "")
Expand Down

0 comments on commit 3d90130

Please sign in to comment.