From 07d4d02628e664b1e9e46cf9afd3e8af7b2c2c3b Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Tue, 15 Dec 2020 07:08:52 -0800 Subject: [PATCH] Build fixes for older GCC and Ubuntu - Ubuntu 18.04 ships with GCC 7, which needs `std::move()` when returning an `absl::StatusOr<>` - Ignore C++ AST nodes of type `cindex.TypeKind.UNEXPOSED` in Python generator - Remove default values in `ubuntu-cmake.yml` PiperOrigin-RevId: 347605109 Change-Id: Ibe167249ecf4ef1af1654d63c2e067fc02e5782d --- .github/workflows/ubuntu-cmake.yml | 5 +---- sandboxed_api/sandbox2/buffer.cc | 2 +- sandboxed_api/tools/generator2/code.py | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ubuntu-cmake.yml b/.github/workflows/ubuntu-cmake.yml index 802a89c..009cbae 100644 --- a/.github/workflows/ubuntu-cmake.yml +++ b/.github/workflows/ubuntu-cmake.yml @@ -20,21 +20,18 @@ jobs: - name: Create Build Environment run: | - pip3 install absl-py clang + pip3 install absl-py cmake -E make_directory ${{runner.workspace}}/build - name: Configure CMake - shell: bash working-directory: ${{runner.workspace}}/build run: cmake $GITHUB_WORKSPACE -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE - name: Build working-directory: ${{runner.workspace}}/build - shell: bash run: cmake --build . --config $BUILD_TYPE # TODO(cblichmann): Before enabling this, make sure all OSS tests pass #- name: Test # working-directory: ${{runner.workspace}}/build - # shell: bash # run: ctest -C $BUILD_TYPE diff --git a/sandboxed_api/sandbox2/buffer.cc b/sandboxed_api/sandbox2/buffer.cc index 81dabcf..81a7314 100644 --- a/sandboxed_api/sandbox2/buffer.cc +++ b/sandboxed_api/sandbox2/buffer.cc @@ -49,7 +49,7 @@ absl::StatusOr> Buffer::CreateFromFd(int fd) { } buffer->fd_ = fd; buffer->size_ = size; - return buffer; + return std::move(buffer); // GCC 7 needs the move (C++ DR #1579) } // Creates a new Buffer of the specified size, backed by a temporary file that diff --git a/sandboxed_api/tools/generator2/code.py b/sandboxed_api/tools/generator2/code.py index 14d57cd..ec1e4fc 100644 --- a/sandboxed_api/tools/generator2/code.py +++ b/sandboxed_api/tools/generator2/code.py @@ -266,10 +266,10 @@ class Type(object): if not skip_self: result.add(self) self._tu.search_for_macro_name(self._get_declaration()) - return result - raise ValueError('Unhandled kind: {}'.format(self._clang_type.kind)) + # Ignore all cindex.TypeKind.UNEXPOSED AST nodes + return result def _get_related_types_of_typedef(self, result): # type: (Set[Type]) -> Set[Type]