From 0419ab13395ca4c84c292827f4bd14a97de4625a Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Wed, 25 Feb 2026 15:01:30 +0900 Subject: [PATCH 1/5] Redirect tl_expected to system libexpected-dev when available Signed-off-by: Tamaki Nishino --- tl_expected/CMakeLists.txt | 6 ++++++ tl_expected/include/tl_expected/expected.hpp | 11 ++++++++++- tl_expected/package.xml | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/tl_expected/CMakeLists.txt b/tl_expected/CMakeLists.txt index 3039e6c..df93f6a 100644 --- a/tl_expected/CMakeLists.txt +++ b/tl_expected/CMakeLists.txt @@ -7,7 +7,13 @@ project(tl_expected find_package(ament_cmake REQUIRED) +option(USE_VENDORED_TL_EXPECTED "Use vendored tl_expected instead of system libexpected-dev" OFF) + add_library(tl_expected INTERFACE) + +if(USE_VENDORED_TL_EXPECTED) + target_compile_definitions(tl_expected INTERFACE USE_VENDORED_TL_EXPECTED) +endif() target_include_directories(tl_expected INTERFACE $ $) diff --git a/tl_expected/include/tl_expected/expected.hpp b/tl_expected/include/tl_expected/expected.hpp index ae90975..e58f9ae 100644 --- a/tl_expected/include/tl_expected/expected.hpp +++ b/tl_expected/include/tl_expected/expected.hpp @@ -13,6 +13,13 @@ // . /// +// If the system header is available and vendored version is not explicitly +// requested, redirect to the system header with a deprecation warning. +#if !defined(USE_VENDORED_TL_EXPECTED) && __has_include() +#pragma message("tl_expected/expected.hpp is deprecated, use tl/expected.hpp instead") +#include +#else + #ifndef TL_EXPECTED_HPP #define TL_EXPECTED_HPP @@ -2480,4 +2487,6 @@ void swap(expected &lhs, } } // namespace tl -#endif +#endif // TL_EXPECTED_HPP + +#endif // !defined(USE_VENDORED_TL_EXPECTED) && __has_include() diff --git a/tl_expected/package.xml b/tl_expected/package.xml index 07dac78..ef78d93 100644 --- a/tl_expected/package.xml +++ b/tl_expected/package.xml @@ -14,6 +14,8 @@ ament_cmake + libexpected-dev + ament_cmake From 1f91ae73d137a08dce3f5bbf51589bf626602c71 Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Sun, 1 Mar 2026 20:44:58 +0900 Subject: [PATCH 2/5] Update tl_expected/include/tl_expected/expected.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Fröhlich --- tl_expected/include/tl_expected/expected.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tl_expected/include/tl_expected/expected.hpp b/tl_expected/include/tl_expected/expected.hpp index e58f9ae..b2dea5a 100644 --- a/tl_expected/include/tl_expected/expected.hpp +++ b/tl_expected/include/tl_expected/expected.hpp @@ -16,7 +16,7 @@ // If the system header is available and vendored version is not explicitly // requested, redirect to the system header with a deprecation warning. #if !defined(USE_VENDORED_TL_EXPECTED) && __has_include() -#pragma message("tl_expected/expected.hpp is deprecated, use tl/expected.hpp instead") +#warning("tl_expected/expected.hpp is deprecated, use tl/expected.hpp instead") #include #else From 9ca7705117548166eef51b89f4d7ec4b2f976fee Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Sat, 7 Mar 2026 16:35:36 +0900 Subject: [PATCH 3/5] Update deprecation warning message Signed-off-by: Tamaki Nishino --- tl_expected/include/tl_expected/expected.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tl_expected/include/tl_expected/expected.hpp b/tl_expected/include/tl_expected/expected.hpp index b2dea5a..151c03d 100644 --- a/tl_expected/include/tl_expected/expected.hpp +++ b/tl_expected/include/tl_expected/expected.hpp @@ -16,7 +16,7 @@ // If the system header is available and vendored version is not explicitly // requested, redirect to the system header with a deprecation warning. #if !defined(USE_VENDORED_TL_EXPECTED) && __has_include() -#warning("tl_expected/expected.hpp is deprecated, use tl/expected.hpp instead") +#warning "tl_expected/expected.hpp is deprecated. Use from libexpected-dev, or if the system header is not available." #include #else From 953183f0e52c18436f0bd7bfec4a7a717c4d6ea6 Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Thu, 12 Mar 2026 15:01:54 +0900 Subject: [PATCH 4/5] Remove USE_VENDORED_TL_EXPECTED option --- tl_expected/CMakeLists.txt | 6 ------ tl_expected/include/tl_expected/expected.hpp | 8 ++++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/tl_expected/CMakeLists.txt b/tl_expected/CMakeLists.txt index df93f6a..3039e6c 100644 --- a/tl_expected/CMakeLists.txt +++ b/tl_expected/CMakeLists.txt @@ -7,13 +7,7 @@ project(tl_expected find_package(ament_cmake REQUIRED) -option(USE_VENDORED_TL_EXPECTED "Use vendored tl_expected instead of system libexpected-dev" OFF) - add_library(tl_expected INTERFACE) - -if(USE_VENDORED_TL_EXPECTED) - target_compile_definitions(tl_expected INTERFACE USE_VENDORED_TL_EXPECTED) -endif() target_include_directories(tl_expected INTERFACE $ $) diff --git a/tl_expected/include/tl_expected/expected.hpp b/tl_expected/include/tl_expected/expected.hpp index 151c03d..7766ee1 100644 --- a/tl_expected/include/tl_expected/expected.hpp +++ b/tl_expected/include/tl_expected/expected.hpp @@ -13,12 +13,12 @@ // . /// -// If the system header is available and vendored version is not explicitly -// requested, redirect to the system header with a deprecation warning. -#if !defined(USE_VENDORED_TL_EXPECTED) && __has_include() -#warning "tl_expected/expected.hpp is deprecated. Use from libexpected-dev, or if the system header is not available." +// If the system header is available, redirect to it. +// Otherwise, fall back to the vendored version with a deprecation warning. +#if __has_include() #include #else +#warning "tl_expected/expected.hpp is deprecated. Please install libexpected-dev and use instead." #ifndef TL_EXPECTED_HPP #define TL_EXPECTED_HPP From e04551c04bcb0ffb85bdbf9b6107cedd67f7244f Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Thu, 12 Mar 2026 19:20:22 +0900 Subject: [PATCH 5/5] Update tl_expected/include/tl_expected/expected.hpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Christoph Fröhlich --- tl_expected/include/tl_expected/expected.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tl_expected/include/tl_expected/expected.hpp b/tl_expected/include/tl_expected/expected.hpp index 7766ee1..b04d6c7 100644 --- a/tl_expected/include/tl_expected/expected.hpp +++ b/tl_expected/include/tl_expected/expected.hpp @@ -19,7 +19,12 @@ #include #else #warning "tl_expected/expected.hpp is deprecated. Please install libexpected-dev and use instead." - +#warning "tl_expected/expected.hpp is deprecated. Use from libexpected-dev, or if the system header is not available." +// If the system header is available, redirect to it. +// Otherwise, fall back to the vendored version +#if __has_include() +#include +#else #ifndef TL_EXPECTED_HPP #define TL_EXPECTED_HPP