From 106d842653aab453cd3bbfa0b38bd78d852ceade Mon Sep 17 00:00:00 2001 From: tushenmei Date: Mon, 2 Aug 2021 11:37:28 +0800 Subject: [PATCH] bugfix of gcc10 --- PEGTL.spec | 10 ++++++++-- bugfix-gcc-10.patch | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 bugfix-gcc-10.patch diff --git a/PEGTL.spec b/PEGTL.spec index 1bb2067..bfccfdb 100644 --- a/PEGTL.spec +++ b/PEGTL.spec @@ -2,7 +2,7 @@ Name: PEGTL Version: 2.8.0 -Release: 2 +Release: 3 Summary: Parsing Expression Grammar Template Library License: MIT URL: https://github.com/taocpp/PEGTL/ @@ -11,6 +11,8 @@ Source0: https://github.com/taocpp/%{name}/archive/%{version}.tar.gz BuildRequires: gcc-c++ BuildRequires: make +Patch0001: bugfix-gcc-10.patch + %description The Parsing Expression Grammar Template Library (PEGTL) is a zero-dependency 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}. %prep -%setup -q -n %{name}-%{version} +%setup -q -n %{name}-%{version} +%patch0001 -p1 %check make @@ -45,5 +48,8 @@ popd %{_includedir}/tao/pegtl %changelog +* Mon Aug 2 2021 Shenmei Tu - 2.8.0-3 +- bugfix-gcc-10.patch + * Sat Jul 18 2020 Guoshuai Sun - 2.8.0-2 - Package init diff --git a/bugfix-gcc-10.patch b/bugfix-gcc-10.patch new file mode 100644 index 0000000..bcc030d --- /dev/null +++ b/bugfix-gcc-10.patch @@ -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; + } + };