Fix CI builds (#8161)

* Update build.yml

Upgrade to gcc 13 and clang 15

* switch to __is_trivially_copyable

* fix cmake issue and warning about sign comparison

* Use libc++ for C++23 on clang for now

* Use libc++ for C++23 on clang for now

* exclude clang+15 for C++13 builds
This commit is contained in:
Derek Bailey
2023-11-18 00:19:03 -08:00
committed by GitHub
parent 755573bcda
commit 4354945727
4 changed files with 19 additions and 14 deletions

View File

@@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
cxx: [g++-10, clang++-14] cxx: [g++-13, clang++-15]
fail-fast: false fail-fast: false
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -58,11 +58,11 @@ jobs:
with: with:
files: Linux.flatc.binary.${{ matrix.cxx }}.zip files: Linux.flatc.binary.${{ matrix.cxx }}.zip
- name: Generate SLSA subjects - clang - name: Generate SLSA subjects - clang
if: matrix.cxx == 'clang++-14' && startsWith(github.ref, 'refs/tags/') if: matrix.cxx == 'clang++-15' && startsWith(github.ref, 'refs/tags/')
id: hash-clang id: hash-clang
run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT
- name: Generate SLSA subjects - gcc - name: Generate SLSA subjects - gcc
if: matrix.cxx == 'g++-10' && startsWith(github.ref, 'refs/tags/') if: matrix.cxx == 'g++-13' && startsWith(github.ref, 'refs/tags/')
id: hash-gcc id: hash-gcc
run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT
@@ -72,7 +72,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake
run: CXX=clang++-14 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON -DFLATBUFFERS_CXX_FLAGS="-DFLATBUFFERS_NO_FILE_TESTS" . run: CXX=clang++-15 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON -DFLATBUFFERS_CXX_FLAGS="-DFLATBUFFERS_NO_FILE_TESTS" .
- name: build - name: build
run: make -j run: make -j
@@ -86,7 +86,7 @@ jobs:
- name: cmake - name: cmake
working-directory: build working-directory: build
run: > run: >
CXX=clang++-14 cmake .. -G "Unix Makefiles" -DFLATBUFFERS_STRICT_MODE=ON CXX=clang++-15 cmake .. -G "Unix Makefiles" -DFLATBUFFERS_STRICT_MODE=ON
-DFLATBUFFERS_BUILD_CPP17=ON -DFLATBUFFERS_CPP_STD=17 -DFLATBUFFERS_BUILD_CPP17=ON -DFLATBUFFERS_CPP_STD=17
- name: build - name: build
working-directory: build working-directory: build
@@ -105,11 +105,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
std: [11, 14, 17, 20, 23] std: [11, 14, 17, 20, 23]
cxx: [g++-10, clang++-14] cxx: [g++-13, clang++-15]
exclude: exclude:
# GCC 10.3.0 doesn't support std 23 # Clang++15 10.3.0 stdlibc++ doesn't fully support std 23
- cxx: g++-10 - cxx: clang++-15
std: 23 std: 23
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake
@@ -358,7 +359,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
cxx: [g++-10, clang++-14] cxx: [g++-13, clang++-15]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake
@@ -389,7 +390,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
cxx: [g++-10] cxx: [g++-13]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: cmake - name: cmake

View File

@@ -556,7 +556,11 @@ if(FLATBUFFERS_BUILD_TESTS)
# Add a library so there is a single target that the generated samples can # Add a library so there is a single target that the generated samples can
# link too. # link too.
add_library(flatsample INTERFACE) if(MSVC)
add_library(flatsample INTERFACE)
else()
add_library(flatsample STATIC)
endif()
# Since flatsample has no sources, we have to explicitly set the linker lang. # Since flatsample has no sources, we have to explicitly set the linker lang.
set_target_properties(flatsample PROPERTIES LINKER_LANGUAGE CXX) set_target_properties(flatsample PROPERTIES LINKER_LANGUAGE CXX)

View File

@@ -1720,7 +1720,7 @@ class Verifier FLATBUFFERS_FINAL_CLASS {
max_vectors_(buf_len), max_vectors_(buf_len),
check_alignment_(_check_alignment), check_alignment_(_check_alignment),
reuse_tracker_(reuse_tracker) { reuse_tracker_(reuse_tracker) {
FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE); FLATBUFFERS_ASSERT(static_cast<int32_t>(size_) < FLATBUFFERS_MAX_BUFFER_SIZE);
if (reuse_tracker_) { if (reuse_tracker_) {
reuse_tracker_->clear(); reuse_tracker_->clear();
reuse_tracker_->resize(size_, PackedType(BIT_WIDTH_8, FBT_NULL)); reuse_tracker_->resize(size_, PackedType(BIT_WIDTH_8, FBT_NULL));

View File

@@ -86,7 +86,7 @@ void TriviallyCopyableTest() {
// clang-format off // clang-format off
#if __GNUG__ && __GNUC__ < 5 && \ #if __GNUG__ && __GNUC__ < 5 && \
!(defined(__clang__) && __clang_major__ >= 16) !(defined(__clang__) && __clang_major__ >= 16)
TEST_EQ(__has_trivial_copy(Vec3), true); TEST_EQ(__is_trivially_copyable(Vec3), true);
#else #else
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
TEST_EQ(std::is_trivially_copyable<Vec3>::value, true); TEST_EQ(std::is_trivially_copyable<Vec3>::value, true);