Skip to content

Commit

Permalink
Merge branch 'master' into rm-pointer-decr
Browse files Browse the repository at this point in the history
  • Loading branch information
dbaileychess authored Sep 29, 2023
2 parents 0dfda12 + eb40a54 commit 9710d33
Show file tree
Hide file tree
Showing 33 changed files with 687 additions and 467 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cxx: [g++-10, clang++-12]
cxx: [g++-10, clang++-14]
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -58,25 +58,25 @@ jobs:
with:
files: Linux.flatc.binary.${{ matrix.cxx }}.zip
- name: Generate SLSA subjects - clang
if: matrix.cxx == 'clang++-12' && startsWith(github.ref, 'refs/tags/')
if: matrix.cxx == 'clang++-14' && startsWith(github.ref, 'refs/tags/')
id: hash-clang
run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT
- name: Generate SLSA subjects - gcc
if: matrix.cxx == 'g++-10' && startsWith(github.ref, 'refs/tags/')
id: hash-gcc
run: echo "hashes=$(sha256sum Linux.flatc.binary.${{ matrix.cxx }}.zip | base64 -w0)" >> $GITHUB_OUTPUT
build-linux-no-file-tests:

build-linux-no-file-tests:
name: Build Linux with -DFLATBUFFERS_NO_FILE_TESTS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cmake
run: CXX=clang++-12 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON -DFLATBUFFERS_CXX_FLAGS="-DFLATBUFFERS_NO_FILE_TESTS" .
run: CXX=clang++-14 cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON -DFLATBUFFERS_CXX_FLAGS="-DFLATBUFFERS_NO_FILE_TESTS" .
- name: build
run: make -j

build-linux-out-of-source:
build-linux-out-of-source:
name: Build Linux with out-of-source build location
runs-on: ubuntu-latest
steps:
Expand All @@ -86,7 +86,7 @@ jobs:
- name: cmake
working-directory: build
run: >
CXX=clang++-12 cmake .. -G "Unix Makefiles" -DFLATBUFFERS_STRICT_MODE=ON
CXX=clang++-14 cmake .. -G "Unix Makefiles" -DFLATBUFFERS_STRICT_MODE=ON
-DFLATBUFFERS_BUILD_CPP17=ON -DFLATBUFFERS_CPP_STD=17
- name: build
working-directory: build
Expand All @@ -105,7 +105,7 @@ jobs:
fail-fast: false
matrix:
std: [11, 14, 17, 20, 23]
cxx: [g++-10, clang++-12]
cxx: [g++-10, clang++-14]
exclude:
# GCC 10.3.0 doesn't support std 23
- cxx: g++-10
Expand All @@ -114,8 +114,8 @@ jobs:
- uses: actions/checkout@v3
- name: cmake
run: >
CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles"
-DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON
CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles"
-DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
-DFLATBUFFERS_BUILD_CPP17=${{ matrix.std >= 17 && 'On' || 'Off'}}
- name: build
Expand All @@ -139,8 +139,8 @@ jobs:
uses: microsoft/setup-msbuild@v1.1
- name: cmake
run: >
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release
-DFLATBUFFERS_STRICT_MODE=ON
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release
-DFLATBUFFERS_STRICT_MODE=ON
-DFLATBUFFERS_CPP_STD=${{ matrix.std }}
-DFLATBUFFERS_BUILD_CPP17=${{ matrix.std >= 17 && 'On' || 'Off'}}
- name: build
Expand All @@ -156,7 +156,7 @@ jobs:
contents: write
outputs:
digests: ${{ steps.hash.outputs.hashes }}
name: Build Windows 2019
name: Build Windows 2019
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -225,15 +225,15 @@ jobs:
matrix:
configuration: [
'',
'-p:UnsafeByteBuffer=true',
'-p:UnsafeByteBuffer=true',
# Fails two tests currently.
#'-p:EnableSpanT=true,UnsafeByteBuffer=true'
]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
with:
dotnet-version: '3.1.x'
- name: Build
run: |
Expand Down Expand Up @@ -358,7 +358,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
cxx: [g++-10, clang++-12]
cxx: [g++-10, clang++-14]
steps:
- uses: actions/checkout@v3
- name: cmake
Expand Down Expand Up @@ -462,7 +462,7 @@ jobs:
- name: test
working-directory: tests
run: bash RustTest.sh

build-rust-windows:
name: Build Rust Windows
runs-on: windows-2019
Expand Down Expand Up @@ -578,7 +578,7 @@ jobs:
- uses: jiro4989/setup-nim-action@v1
- name: install library
working-directory: nim
run: nimble -y develop
run: nimble -y develop && nimble install
- name: test
working-directory: tests/nim
run: python3 testnim.py
Expand Down
5 changes: 2 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.2
// swift-tools-version:5.6
/*
* Copyright 2020 Google Inc. All rights reserved.
*
Expand Down Expand Up @@ -32,6 +32,5 @@ let package = Package(
.target(
name: "FlatBuffers",
dependencies: [],
path: "swift/Sources",
exclude: ["Documentation.docc/Resources/code/swift"]),
path: "swift/Sources"),
])
38 changes: 19 additions & 19 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file"

http_archive(
name = "platforms",
sha256 = "379113459b0feaf6bfbb584a91874c065078aa673222846ac765f86661c27407",
sha256 = "3a561c99e7bdbe9173aa653fd579fe849f1d8d67395780ab4770b1f381431d51",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.5/platforms-0.0.5.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
"https://github.com/bazelbuild/platforms/releases/download/0.0.7/platforms-0.0.7.tar.gz",
],
)

Expand All @@ -33,10 +33,10 @@ swift_rules_extra_dependencies()

http_archive(
name = "io_bazel_rules_go",
sha256 = "ae013bf35bd23234d1dea46b079f1e05ba74ac0321423830119d3e787ec73483",
sha256 = "278b7ff5a826f3dc10f04feaf0b70d48b68748ccd512d7f98bf442077f043fe3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.36.0/rules_go-v0.36.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.41.0/rules_go-v0.41.0.zip",
],
)

Expand Down Expand Up @@ -79,9 +79,9 @@ grpc_extra_deps()

http_archive(
name = "aspect_rules_js",
sha256 = "124ed29fb0b3d0cba5b44f8f8e07897cf61b34e35e33b1f83d1a943dfd91b193",
strip_prefix = "rules_js-1.24.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.24.0/rules_js-v1.24.0.tar.gz",
sha256 = "bdbd6df52fc7963f55281fe0a140e21de8ec587ab711a8a2fff0715b6710a4f8",
strip_prefix = "rules_js-1.32.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.32.0/rules_js-v1.32.0.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand All @@ -94,9 +94,9 @@ pnpm_repository(name = "pnpm")

http_archive(
name = "aspect_rules_ts",
sha256 = "8eb25d1fdafc0836f5778d33fb8eaac37c64176481d67872b54b0a05de5be5c0",
strip_prefix = "rules_ts-1.3.3",
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.3.3/rules_ts-v1.3.3.tar.gz",
sha256 = "4c3f34fff9f96ffc9c26635d8235a32a23a6797324486c7d23c1dfa477e8b451",
strip_prefix = "rules_ts-1.4.5",
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.4.5/rules_ts-v1.4.5.tar.gz",
)

load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
Expand Down Expand Up @@ -132,25 +132,25 @@ npm_repositories()

http_archive(
name = "aspect_rules_esbuild",
sha256 = "2ea31bd97181a315e048be693ddc2815fddda0f3a12ca7b7cc6e91e80f31bac7",
strip_prefix = "rules_esbuild-0.14.4",
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.14.4/rules_esbuild-v0.14.4.tar.gz",
sha256 = "098e38e5ee868c14a6484ba263b79e57d48afacfc361ba30137c757a9c4716d6",
strip_prefix = "rules_esbuild-0.15.0",
url = "https://github.com/aspect-build/rules_esbuild/releases/download/v0.15.0/rules_esbuild-v0.15.0.tar.gz",
)

# Register a toolchain containing esbuild npm package and native bindings
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_VERSION", "esbuild_register_toolchains")
load("@aspect_rules_esbuild//esbuild:repositories.bzl", "LATEST_ESBUILD_VERSION", "esbuild_register_toolchains")

esbuild_register_toolchains(
name = "esbuild",
esbuild_version = LATEST_VERSION,
esbuild_version = LATEST_ESBUILD_VERSION,
)

http_file(
name = "bazel_linux_x86_64",
downloaded_file_path = "bazel",
executable = True,
sha256 = "e89747d63443e225b140d7d37ded952dacea73aaed896bca01ccd745827c6289",
sha256 = "e78fc3394deae5408d6f49a15c7b1e615901969ecf6e50d55ef899996b0b8458",
urls = [
"https://github.com/bazelbuild/bazel/releases/download/6.1.2/bazel-6.1.2-linux-x86_64",
"https://github.com/bazelbuild/bazel/releases/download/6.3.2/bazel-6.3.2-linux-x86_64",
],
)
2 changes: 1 addition & 1 deletion grpc/examples/go/greeter/client/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ replace github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0 =>
require (
github.com/google/flatbuffers v1.12.0
github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0
google.golang.org/grpc v1.35.0
google.golang.org/grpc v1.53.0
)
2 changes: 1 addition & 1 deletion grpc/examples/go/greeter/models/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.15

require (
github.com/google/flatbuffers v1.12.0
google.golang.org/grpc v1.35.0
google.golang.org/grpc v1.53.0
)
2 changes: 1 addition & 1 deletion grpc/examples/go/greeter/server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ replace github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0 =>
require (
github.com/google/flatbuffers v1.12.0
github.com/google/flatbuffers/grpc/examples/go/greeter/models v0.0.0
google.golang.org/grpc v1.39.0-dev
google.golang.org/grpc v1.53.0
)
2 changes: 1 addition & 1 deletion include/flatbuffers/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ namespace flatbuffers {
#define FLATBUFFERS_FINAL_CLASS final
#define FLATBUFFERS_OVERRIDE override
#define FLATBUFFERS_EXPLICIT_CPP11 explicit
#define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : flatbuffers::voffset_t
#define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : ::flatbuffers::voffset_t
#else
#define FLATBUFFERS_FINAL_CLASS
#define FLATBUFFERS_OVERRIDE
Expand Down
6 changes: 2 additions & 4 deletions include/flatbuffers/flatbuffer_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ template<bool Is64Aware = false> class FlatBufferBuilderImpl {
typedef typename VectorT<T>::size_type LenT;
typedef typename OffsetT<VectorT<const T *>>::offset_type offset_type;

StartVector<OffsetT, LenT>(len * sizeof(T) / AlignOf<T>(), sizeof(T),
AlignOf<T>());
StartVector<OffsetT, LenT>(len, sizeof(T), AlignOf<T>());
if (len > 0) {
PushBytes(reinterpret_cast<const uint8_t *>(v), sizeof(T) * len);
}
Expand Down Expand Up @@ -1384,8 +1383,7 @@ template<bool Is64Aware = false> class FlatBufferBuilderImpl {
// Must be completed with EndVectorOfStructs().
template<typename T, template<typename> class OffsetT = Offset>
T *StartVectorOfStructs(size_t vector_size) {
StartVector<OffsetT>(vector_size * sizeof(T) / AlignOf<T>(), sizeof(T),
AlignOf<T>());
StartVector<OffsetT>(vector_size, sizeof(T), AlignOf<T>());
return reinterpret_cast<T *>(buf_.make_space(vector_size * sizeof(T)));
}

Expand Down
16 changes: 8 additions & 8 deletions include/flatbuffers/flatbuffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,31 +248,31 @@ inline const char *flatbuffers_version_string() {

// clang-format off
#define FLATBUFFERS_DEFINE_BITMASK_OPERATORS(E, T)\
inline E operator | (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator | (E lhs, E rhs){\
return E(T(lhs) | T(rhs));\
}\
inline E operator & (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator & (E lhs, E rhs){\
return E(T(lhs) & T(rhs));\
}\
inline E operator ^ (E lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^ (E lhs, E rhs){\
return E(T(lhs) ^ T(rhs));\
}\
inline E operator ~ (E lhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ~ (E lhs){\
return E(~T(lhs));\
}\
inline E operator |= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator |= (E &lhs, E rhs){\
lhs = lhs | rhs;\
return lhs;\
}\
inline E operator &= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator &= (E &lhs, E rhs){\
lhs = lhs & rhs;\
return lhs;\
}\
inline E operator ^= (E &lhs, E rhs){\
inline FLATBUFFERS_CONSTEXPR_CPP11 E operator ^= (E &lhs, E rhs){\
lhs = lhs ^ rhs;\
return lhs;\
}\
inline bool operator !(E rhs) \
inline FLATBUFFERS_CONSTEXPR_CPP11 bool operator !(E rhs) \
{\
return !bool(T(rhs)); \
}
Expand Down
2 changes: 2 additions & 0 deletions include/flatbuffers/idl.h
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ struct IDLOptions {
bool keep_proto_id;
bool python_no_type_prefix_suffix;
bool python_typing;
bool ts_omit_entrypoint;
ProtoIdGapAction proto_id_gap_action;

// Possible options for the more general generator below.
Expand Down Expand Up @@ -818,6 +819,7 @@ struct IDLOptions {
keep_proto_id(false),
python_no_type_prefix_suffix(false),
python_typing(false),
ts_omit_entrypoint(false),
proto_id_gap_action(ProtoIdGapAction::WARNING),
mini_reflect(IDLOptions::kNone),
require_explicit_ids(false),
Expand Down
Loading

0 comments on commit 9710d33

Please sign in to comment.