Boost logo

Boost :

From: Guillaume Melquiond (gmelquio_at_[hidden])
Date: 2003-05-18 09:41:01


Here are the patches to reduce the number of warnings the regression suite
for the Regex library produces with gcc. They are trivial patches and are
not really needed. But it's always nice to only have warning when there is
a real problem.

The first patch adds a newline at the end of pathology/recursion_test.cpp.
According to the paragraph 2.1-2 of the Standard, it is necessary.

Index: libs/regex/test/pathology/recursion_test.cpp
===================================================================
RCS file:
/cvsroot/boost/boost/libs/regex/test/pathology/recursion_test.cpp,v
retrieving revision 1.2
diff -u -r1.2 recursion_test.cpp
--- libs/regex/test/pathology/recursion_test.cpp 17 May 2003 11:55:51 -0000 1.2
+++ libs/regex/test/pathology/recursion_test.cpp 18 May 2003 14:20:03 -0000
@@ -60,4 +60,4 @@
    BOOST_CHECK(boost::regex_match(good_text, what, e));

    return 0;
-}
\ No newline at end of file
+}

This patch sorts the initializers of the constructor (paragraph 12.6.2-5)
in order for them to match the order of the declarations. It also
removes a default initializer (it seemed silly to let the default
initializer at the end of the list after I had swapped them).

Index: libs/regex/example/snippets/regex_grep_example_3.cpp
===================================================================
RCS file:
/cvsroot/boost/boost/libs/regex/example/snippets/regex_grep_example_3.cpp,v
retrieving revision 1.6
diff -u -r1.6 regex_grep_example_3.cpp
--- libs/regex/example/snippets/regex_grep_example_3.cpp 17 May 2003 11:45:45 -0000 1.6
+++ libs/regex/example/snippets/regex_grep_example_3.cpp 18 May 2003 14:20:03 -0000
@@ -67,8 +67,7 @@
    map_type& get_map() { return index; }
    void IndexClasses(const std::string& file);
    class_index()
- : index(),
- expression(re)
+ : expression(re)
         {}
 };

This patch removes a "signed-unsigned comparison" warning. Since the patch
is only a one-liner and it allows the program to compile flawlessly, here
it comes:

Index: libs/regex/example/snippets/partial_regex_grep.cpp
===================================================================
RCS file:
/cvsroot/boost/boost/libs/regex/example/snippets/partial_regex_grep.cpp,v
retrieving revision 1.4
diff -u -r1.4 partial_regex_grep.cpp
--- libs/regex/example/snippets/partial_regex_grep.cpp 24 Apr 2002 10:50:23 -0000 1.4
+++ libs/regex/example/snippets/partial_regex_grep.cpp 18 May 2003 14:20:03 -0000
@@ -78,7 +78,7 @@
 {
    if(argc > 1)
    {
- for(unsigned int i = 1; i < argc; ++i)
+ for(int i = 1; i < argc; ++i)
       {
          std::ifstream fs(argv[i]);
          if(fs.bad()) continue;

About the imho spurious "signed-unsigned comparison" warnings,
example/timer/regex_timer.cpp contains a lot of them. It also contains a
lot of "double-to-integer assignment". Since it is no more a trivial patch
(although the job itself is trivial), I won't propose a patch unless the
maintener asks for one.

Regards,

Guillaume


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk