diff --git a/conanfile.py b/conanfile.py index 177778a7f..c53aec98d 100644 --- a/conanfile.py +++ b/conanfile.py @@ -18,7 +18,6 @@ from conan.tools.cmake import CMake, cmake_layout from conan.tools.files import copy from conan.tools.build import check_min_cppstd -from conan.errors import ConanInvalidConfiguration import os @@ -27,7 +26,7 @@ class libhal_conan(ConanFile): name = "libhal" - version = "2.0.0" + version = "2.0.1" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libhal.github.io/libhal" @@ -59,19 +58,8 @@ def validate(self): if self.settings.get_safe("compiler.cppstd"): check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - min_length = min(len(lv1), len(lv2)) - return lv1[:min_length] < lv2[:min_length] - - compiler = str(self.settings.compiler) - version = str(self.settings.compiler.version) - minimum_version = self._compilers_minimum_version.get(compiler, False) - - if minimum_version and lazy_lt_semver(version, minimum_version): - raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") + def build_requirements(self): + self.tool_requires("cmake/3.27.1") def requirements(self): self.requires("tl-function-ref/1.0.0") @@ -109,6 +97,8 @@ def package_info(self): if self._bare_metal: self.cpp_info.defines = [ "BOOST_LEAF_EMBEDDED", + # TODO(#694): Remove this or have it be configurable. Users + # should not be forced to operate without thread support "BOOST_LEAF_NO_THREADS" ] diff --git a/demos/libhal.tweaks.hpp b/demos/libhal.tweaks.hpp deleted file mode 100644 index 4b39c9973..000000000 --- a/demos/libhal.tweaks.hpp +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#define BOOST_LEAF_EMBEDDED -#define BOOST_LEAF_NO_THREADS - -#include - -namespace hal::config { -constexpr std::string_view platform = "lpc4078"; -} // namespace hal::config diff --git a/include/libhal/third_party/inplace_function.hpp b/include/libhal/third_party/inplace_function.hpp index ef048a31e..13b62cf97 100644 --- a/include/libhal/third_party/inplace_function.hpp +++ b/include/libhal/third_party/inplace_function.hpp @@ -35,6 +35,10 @@ * of the called function will NOT be valid. * 4. Move SG14_INPLACE_FUNCTION_THROW is no longer needed and thus * this library no longer needs exceptions. + * 5. After removing the `nullptr_t` constructors, there is a new edge case + * where the vtable_ptr_ is now nullptr and not an empty_vtable, which + * means that access to that vtable_ptr_ results in a null pointer + * dereference. A check must be put in the copy ctor and dtor. */ #pragma once @@ -320,7 +324,9 @@ class inplace_function inplace_function& operator=(inplace_function other) noexcept { - vtable_ptr_->destructor_ptr(std::addressof(storage_)); + if (vtable_ptr_) { + vtable_ptr_->destructor_ptr(std::addressof(storage_)); + } vtable_ptr_ = std::exchange( other.vtable_ptr_, @@ -332,7 +338,9 @@ class inplace_function ~inplace_function() { - vtable_ptr_->destructor_ptr(std::addressof(storage_)); + if (vtable_ptr_) { + vtable_ptr_->destructor_ptr(std::addressof(storage_)); + } } R operator()(Args... args) const diff --git a/test_package/conanfile.py b/test_package/conanfile.py index de34321a2..e3d0bcef4 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -24,6 +24,9 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + def build_requirements(self): + self.tool_requires("cmake/3.27.1") + def requirements(self): self.requires(self.tested_reference_str) diff --git a/test_package/libhal.tweaks.hpp b/test_package/libhal.tweaks.hpp deleted file mode 100644 index 639610ac1..000000000 --- a/test_package/libhal.tweaks.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include - -namespace hal::config { -constexpr std::string_view platform = "test_package"; -} // namespace hal::config