mirror of
https://github.com/openembedded/meta-openembedded.git
synced 2026-09-29 01:10:21 +00:00
pegtl: Fix build with clang-23
clang 23 enables -Wunused-template under plain -Wall, and every test in
src/test is compiled with -pedantic -Wall -Wextra -Wshadow -Werror, so the
whole test build fails:
include/tao/pegtl/internal/match_impl.hpp:24:30: error: unused function
template 'match_no_control' [-Werror,-Wunused-template]
match_no_control() is a namespace-scope static function template in a
header, so it has internal linkage in every translation unit. It is only
ever referenced from other templates, so in a TU where none of those get
instantiated it really is unused and clang says so.
Add a patch declaring the two overloads inline instead, which is the
correct linkage for a function template defined in a header.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
+48
@@ -0,0 +1,48 @@
|
||||
From e5997938100dd459ad9473bf574ab9a75e5a0a53 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 8 Sep 2026 05:31:46 +0000
|
||||
Subject: [PATCH] internal: declare match_no_control() inline instead of static
|
||||
|
||||
Newer clang (23+) enables -Wunused-template for namespace-scope static
|
||||
function templates defined in headers. match_no_control() is only ever
|
||||
referenced from other templates, so in any translation unit where none of
|
||||
those get instantiated the internal-linkage template is genuinely unused
|
||||
and the -Werror test build fails:
|
||||
|
||||
include/tao/pegtl/internal/match_impl.hpp:24:30: error: unused function
|
||||
template 'match_no_control' [-Werror,-Wunused-template]
|
||||
|
||||
This breaks every test in src/test, since they are all compiled with
|
||||
-Wall -Werror.
|
||||
|
||||
Declare the two overloads inline instead; that is the correct linkage for
|
||||
a function template defined in a header and does not trigger the warning.
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
|
||||
---
|
||||
include/tao/pegtl/internal/match_impl.hpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/include/tao/pegtl/internal/match_impl.hpp b/include/tao/pegtl/internal/match_impl.hpp
|
||||
index 8723dae2..c13dd4f7 100644
|
||||
--- a/include/tao/pegtl/internal/match_impl.hpp
|
||||
+++ b/include/tao/pegtl/internal/match_impl.hpp
|
||||
@@ -21,7 +21,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
|
||||
template< typename... > class Control,
|
||||
typename ParseInput,
|
||||
typename... States >
|
||||
- [[nodiscard]] static auto match_no_control( ParseInput& in, States&&... st )
|
||||
+ [[nodiscard]] inline auto match_no_control( ParseInput& in, States&&... st )
|
||||
-> decltype( Rule::template match< A, M, Action, Control >( in, st... ) )
|
||||
{
|
||||
return Rule::template match< A, M, Action, Control >( in, st... );
|
||||
@@ -34,7 +34,7 @@ namespace TAO_PEGTL_NAMESPACE::internal
|
||||
template< typename... > class Control,
|
||||
typename ParseInput,
|
||||
typename... States >
|
||||
- [[nodiscard]] static auto match_no_control( ParseInput& in, States&&... /*unused*/ )
|
||||
+ [[nodiscard]] inline auto match_no_control( ParseInput& in, States&&... /*unused*/ )
|
||||
-> decltype( Rule::match( in ) )
|
||||
{
|
||||
return Rule::match( in );
|
||||
@@ -4,6 +4,7 @@ LICENSE = "BSL-1.0"
|
||||
LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c"
|
||||
|
||||
SRC_URI = "git://github.com/taocpp/PEGTL.git;protocol=https;branch=4.x \
|
||||
file://0001-internal-declare-match_no_control-inline-instead-of-.patch \
|
||||
file://run-ptest \
|
||||
"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user