Compare commits

...

4 Commits
master ... f7

Author SHA1 Message Date
Fedora Release Engineering 9b591d5edc dist-git conversion 2010-07-28 11:11:55 +00:00
Petr Machata 878cbb870d - Fixes for boost.regex. 2008-01-16 20:42:10 +00:00
Petr Machata 1acce65b09 - Apply/testsuite ambiguous option patch from James Philbin
- Resolves: #369581
2007-11-19 18:25:53 +00:00
Bill Nottingham 3ff5b45e1e Initialize branch F-7 for boost 2007-05-18 03:06:47 +00:00
5 changed files with 197 additions and 7 deletions

View File

View File

@ -1,6 +0,0 @@
# Makefile for source rpm: boost
# $Id: Makefile,v 1.1 2004/09/09 03:35:58 cvsdist Exp $
NAME := boost
SPECFILE = $(firstword $(wildcard *.spec))
include ../common/Makefile.common

141
boost-opt.patch Normal file
View File

@ -0,0 +1,141 @@
--- libs/program_options/src/options_description.cpp
+++ libs/program_options/src/options_description.cpp
@@ -53,10 +53,10 @@
{
}
- bool
+ option_description::match_result
option_description::match(const std::string& option, bool approx) const
{
- bool result = false;
+ match_result result = no_match;
if (!m_long_name.empty()) {
if (*m_long_name.rbegin() == '*')
@@ -65,23 +65,26 @@
// prefix is OK.
if (option.find(m_long_name.substr(0, m_long_name.length()-1))
== 0)
- result = true;
+ result = approximate_match;
}
if (approx)
{
if (m_long_name.find(option) == 0)
- result = true;
+ if (m_long_name == option)
+ result = full_match;
+ else
+ result = approximate_match;
}
else
{
if (m_long_name == option)
- result = true;
+ result = full_match;
}
}
if (m_short_name == option)
- result = true;
+ result = full_match;
return result;
}
@@ -258,21 +261,38 @@
// case sensitivity and trailing '*' and so we can't use simple map.
for(unsigned i = 0; i < m_options.size(); ++i)
{
- if (m_options[i]->match(name, approx))
+ option_description::match_result r =
+ m_options[i]->match(name, approx);
+
+ if (r == option_description::no_match)
+ continue;
+
+ // If we have a full patch, and an approximate match,
+ // ignore approximate match instead of reporting error.
+ // Say, if we have options "all" and "all-chroots", then
+ // "--all" on the command line should select the first one,
+ // without ambiguity.
+ //
+ // For now, we don't check the situation when there are
+ // two full matches.
+
+ if (r == option_description::full_match)
{
- if (found != -1)
- {
- vector<string> alts;
- // FIXME: the use of 'key' here might not
- // be the best approach.
- alts.push_back(m_options[found]->key(name));
- alts.push_back(m_options[i]->key(name));
- boost::throw_exception(ambiguous_option(name, alts));
- }
- else
- {
- found = i;
- }
+ return m_options[i].get();
+ }
+
+ if (found != -1)
+ {
+ vector<string> alts;
+ // FIXME: the use of 'key' here might not
+ // be the best approach.
+ alts.push_back(m_options[found]->key(name));
+ alts.push_back(m_options[i]->key(name));
+ boost::throw_exception(ambiguous_option(name, alts));
+ }
+ else
+ {
+ found = i;
}
}
if (found != -1) {
--- libs/program_options/test/options_description_test.cpp
+++ libs/program_options/test/options_description_test.cpp
@@ -20,11 +20,20 @@
{
options_description desc;
desc.add_options()
- ("foo", new untyped_value())
- ("fee", new untyped_value())
- ("baz", new untyped_value());
+ ("foo", new untyped_value())
+ ("fee", new untyped_value())
+ ("baz", new untyped_value())
+ ("all", new untyped_value())
+ ("all-chroots", new untyped_value())
+ ("all-sessions", new untyped_value())
+ ;
BOOST_CHECK_EQUAL(desc.find("fo", true).long_name(), "foo");
+
+ BOOST_CHECK_EQUAL(desc.find("all", true).long_name(), "all");
+ BOOST_CHECK_EQUAL(desc.find("all-ch", true).long_name(), "all-chroots");
+
+
// BOOST_CHECK(desc.count_approx("foo") == 1);
// set<string> a = desc.approximations("f");
// BOOST_CHECK(a.size() == 2);
--- boost/program_options/options_description.hpp
+++ boost/program_options/options_description.hpp
@@ -78,10 +78,12 @@
virtual ~option_description();
+ enum match_result { no_match, full_match, approximate_match };
+
/** Given 'option', specified in the input source,
return 'true' is 'option' specifies *this.
*/
- bool match(const std::string& option, bool approx) const;
+ match_result match(const std::string& option, bool approx) const;
/** Return the key that should identify the option, in
particular in the variables_map class.

44
boost-regex.patch Normal file
View File

@ -0,0 +1,44 @@
--- ./boost/regex/v4/basic_regex_parser.hpp.orig 2008-01-16 21:09:57.000000000 +0100
+++ ./boost/regex/v4/basic_regex_parser.hpp 2008-01-16 21:08:30.000000000 +0100
@@ -727,7 +727,8 @@
++m_position;
}
}
- if(0 == this->m_last_state)
+ if(0 == this->m_last_state
+ || this->m_last_state->type == syntax_element_assert_backref)
{
fail(regex_constants::error_badrepeat, ::boost::re_detail::distance(m_base, m_position));
return false;
@@ -767,6 +768,7 @@
case syntax_element_restart_continue:
case syntax_element_jump:
case syntax_element_startmark:
+ case syntax_element_backstep:
// can't legally repeat any of the above:
fail(regex_constants::error_badrepeat, m_position - m_base);
return false;
@@ -1853,6 +1855,7 @@
if(markid == -4)
{
re_syntax_base* b = this->getaddress(expected_alt_point);
+ // Make sure we have exactly one alternative following this state:
if(b->type != syntax_element_alt)
{
re_alt* alt = static_cast<re_alt*>(this->insert_state(expected_alt_point, syntax_element_alt, sizeof(re_alt)));
@@ -1863,6 +1866,15 @@
fail(regex_constants::error_bad_pattern, m_position - m_base);
return false;
}
+ // check for invalid repetition of next state:
+ b = this->getaddress(expected_alt_point);
+ b = this->getaddress(static_cast<re_alt*>(b)->next.i, b);
+ if((b->type != syntax_element_assert_backref)
+ && (b->type != syntax_element_startmark))
+ {
+ fail(regex_constants::error_badrepeat, m_position - m_base);
+ return false;
+ }
}
//
// append closing parenthesis state:

View File

@ -1,7 +1,7 @@
Name: boost
Summary: The Boost C++ Libraries
Version: 1.33.1
Release: 13%{?dist}
Release: 15%{?dist}
License: Boost Software License (GPL-Compatible, Free Software License)
URL: http://www.boost.org/
Group: System Environment/Libraries
@ -28,6 +28,8 @@ Patch6: boost-spirit-warnings.patch
Patch7: boost-bind-gcc41.patch
Patch8: boost-cxxflags-debug.patch
Patch9: boost-python-vs-x86-64.patch
Patch10: boost-opt.patch
Patch11: boost-regex.patch
%description
Boost provides free peer-reviewed portable C++ source libraries. The
@ -78,6 +80,8 @@ rm -rf %{buildroot}
%patch7 -p0
%patch8 -p0
%patch9 -p0
%patch10 -p0
%patch11 -p0
%build
#build bjam
@ -183,6 +187,13 @@ rm -rf %{buildroot}
%doc %{_docdir}/boost-%{version}
%changelog
* Wed Jan 16 2008 Petr Machata <pmachata@redhat.com> - 1.33.1-15
- Fixes for boost.regex.
* Mon Nov 19 2007 Petr Machata <pmachata@redhat.com> - 1.33.1-14
- Apply/testsuite ambiguous option patch from James Philbin
- Resolves: #369581
* Mon Apr 02 2007 Benjamin Kosnik <bkoz@redhat.com> 1.33.1-13
- (#225622: Merge Review: boost)
Change static to devel-static.