!5 解决gcc10导致的PEGTL编译失败问题

From: @tushenmei
Reviewed-by: @chenyanpanHW,@licihua
Signed-off-by: @licihua
This commit is contained in:
openeuler-ci-bot 2021-08-04 08:44:00 +00:00 committed by Gitee
commit b19930cd9c
2 changed files with 45 additions and 2 deletions

View File

@ -2,7 +2,7 @@
Name: PEGTL Name: PEGTL
Version: 2.8.0 Version: 2.8.0
Release: 2 Release: 3
Summary: Parsing Expression Grammar Template Library Summary: Parsing Expression Grammar Template Library
License: MIT License: MIT
URL: https://github.com/taocpp/PEGTL/ URL: https://github.com/taocpp/PEGTL/
@ -11,6 +11,8 @@ Source0: https://github.com/taocpp/%{name}/archive/%{version}.tar.gz
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: make BuildRequires: make
Patch0001: bugfix-gcc-10.patch
%description %description
The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency
C++11 header-only library for creating parsers according to a Parsing C++11 header-only library for creating parsers according to a Parsing
@ -27,7 +29,8 @@ The %{name}-devel package contains C++ header files for developing
applications that use %{name}. applications that use %{name}.
%prep %prep
%setup -q -n %{name}-%{version} %setup -q -n %{name}-%{version}
%patch0001 -p1
%check %check
make make
@ -45,5 +48,8 @@ popd
%{_includedir}/tao/pegtl %{_includedir}/tao/pegtl
%changelog %changelog
* Mon Aug 2 2021 Shenmei Tu <tushenmei@huawei.com> - 2.8.0-3
- bugfix-gcc-10.patch
* Sat Jul 18 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 2.8.0-2 * Sat Jul 18 2020 Guoshuai Sun <sunguoshuai@huawei.com> - 2.8.0-2
- Package init - Package init

37
bugfix-gcc-10.patch Normal file
View File

@ -0,0 +1,37 @@
diff -Nur PEGTL-2.8.0/include/tao/pegtl/contrib/rep_one_min_max.hpp PEGTL-2.8.0-new/include/tao/pegtl/contrib/rep_one_min_max.hpp
--- PEGTL-2.8.0/include/tao/pegtl/contrib/rep_one_min_max.hpp 2019-04-10 02:27:36.000000000 +0800
+++ PEGTL-2.8.0-new/include/tao/pegtl/contrib/rep_one_min_max.hpp 2021-08-02 10:13:41.000000000 +0800
@@ -1,4 +1,4 @@
-// Copyright (c) 2017-2019 Dr. Colin Hirsch and Daniel Frey
+// Copyright (c) 2017-2020 Dr. Colin Hirsch and Daniel Frey
// Please see LICENSE for license or visit https://github.com/taocpp/PEGTL/
#ifndef TAO_PEGTL_CONTRIB_REP_ONE_MIN_MAX_HPP
@@ -41,6 +41,27 @@
bump_help< result_on_found::success, Input, char, C >( in, i );
return true;
}
+ return false;
+ }
+ };
+
+ template< unsigned Max, char C >
+ struct rep_one_min_max< 0, Max, C >
+ {
+ using analyze_t = analysis::counted< analysis::rule_type::any, 0 >;
+
+ template< typename Input >
+ static bool match( Input& in )
+ {
+ const auto size = in.size( Max + 1 );
+ std::size_t i = 0;
+ while( ( i < size ) && ( in.peek_char( i ) == C ) ) {
+ ++i;
+ }
+ if( i <= Max ) {
+ bump_help< result_on_found::success, Input, char, C >( in, i );
+ return true;
+ }
return false;
}
};