diff --git a/v5/include/libhal-util/macros.hpp b/v5/include/libhal-util/macros.hpp new file mode 100644 index 0000000..7bcfd4d --- /dev/null +++ b/v5/include/libhal-util/macros.hpp @@ -0,0 +1,30 @@ +// Copyright 2026 Khalil Estell and the libhal contributors +// +// 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 + +#if defined(__clang__) +#define SUPPRESS_DEPRECATED_START \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#define SUPPRESS_DEPRECATED_END _Pragma("clang diagnostic pop") +#elif defined(__GNUC__) +#define SUPPRESS_DEPRECATED_START \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#define SUPPRESS_DEPRECATED_END _Pragma("GCC diagnostic pop") +#else +#define SUPPRESS_DEPRECATED_START +#define SUPPRESS_DEPRECATED_END +#endif diff --git a/v5/include/libhal-util/usb/enumerator.hpp b/v5/include/libhal-util/usb/enumerator.hpp index 967a757..8a43a08 100644 --- a/v5/include/libhal-util/usb/enumerator.hpp +++ b/v5/include/libhal-util/usb/enumerator.hpp @@ -23,8 +23,6 @@ #include #include #include -#include -#include #include #include @@ -32,10 +30,11 @@ #include #include +#include "../as_bytes.hpp" +#include "../macros.hpp" +#include "../scatter_span.hpp" #include "descriptors.hpp" -#include "libhal-util/as_bytes.hpp" -#include "libhal-util/scatter_span.hpp" -#include "libhal-util/usb/endpoints.hpp" +#include "endpoints.hpp" #include "utils.hpp" namespace hal::v5::usb { @@ -67,6 +66,10 @@ class enumerator , m_retry_max(p_args.retry_max) { m_ctrl_ep->on_receive([this](control_endpoint::on_receive_tag) { + // NOTE: These APIs will be replaced in a future update (see PR + // https://github.com/libhal/libhal-util/pull/100/changes), so suppressing + // them for now. + SUPPRESS_DEPRECATED_START; if (!this->m_ctrl_ep->has_setup().has_value()) { m_has_setup_packet = true; // We will just assume the packet is a setup packet, enumerator @@ -75,6 +78,7 @@ class enumerator } m_has_setup_packet = this->m_ctrl_ep->has_setup().value(); + SUPPRESS_DEPRECATED_END; }); } diff --git a/v5/test_package/conanfile.py b/v5/test_package/conanfile.py index d827098..e364644 100644 --- a/v5/test_package/conanfile.py +++ b/v5/test_package/conanfile.py @@ -23,7 +23,7 @@ class TestPackageConan(ConanFile): generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" def build_requirements(self): - self.tool_requires("cmake/3.27.1") + self.tool_requires("cmake/[^4.0.0]") def requirements(self): self.requires(self.tested_reference_str)