Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r67436 - in branches/release: . boost boost/algorithm/string boost/archive boost/bimap boost/config boost/detail boost/filesystem boost/functional/hash boost/fusion boost/gil boost/graph boost/icl boost/integer boost/interprocess boost/intrusive boost/io boost/iostreams boost/math boost/msm boost/numeric/ublas boost/program_options boost/property_tree boost/python boost/range boost/regex boost/serialization boost/signals boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/support boost/statechart boost/system boost/thread boost/tr1 boost/type_traits boost/typeof boost/unordered boost/utility boost/uuid boost/variant boost/wave doc libs libs/algorithm/string libs/array/doc libs/array/test libs/bimap libs/config libs/date_time libs/filesystem libs/functional/hash libs/fusion libs/graph_parallel libs/icl libs/integer libs/interprocess libs/intrusive libs/iostreams libs/math libs/math/doc libs/math/doc/sf_and_dist libs/mpi/build libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/msm libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/python libs/range libs/regex libs/serialization libs/serialization/doc libs/serialization/example libs/serialization/src libs/serialization/test libs/serialization/vc7ide libs/signals libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/statechart libs/static_assert libs/system libs/thread libs/timer libs/tr1 libs/type_traits libs/type_traits/doc libs/typeof/doc libs/unordered libs/utility libs/utility/swap/test libs/uuid libs/wave more more/getting_started status tools tools/bcp tools/boostbook tools/build/v2 tools/inspect tools/inspect/build tools/inspect/build/msvc tools/inspect/doc tools/quickbook tools/regression tools/regression/src tools/release tools/wave
From: eric_at_[hidden]
Date: 2010-12-23 13:56:34


Author: eric_niebler
Date: 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
New Revision: 67436
URL: http://svn.boost.org/trac/boost/changeset/67436

Log:
inspect checks for use of C assert macro
Added:
   branches/release/tools/inspect/assert_macro_check.cpp
      - copied, changed from r66502, /trunk/tools/inspect/assert_macro_check.cpp
   branches/release/tools/inspect/assert_macro_check.hpp
      - copied, changed from r66502, /trunk/tools/inspect/assert_macro_check.hpp
Properties modified:
   branches/release/ (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/archive/ (props changed)
   branches/release/boost/array.hpp (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/config.hpp (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/detail/endian.hpp (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/filesystem.hpp (props changed)
   branches/release/boost/functional/hash/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/gil/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/icl/ (props changed)
   branches/release/boost/integer/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/io/ (props changed)
   branches/release/boost/iostreams/ (props changed)
   branches/release/boost/math/ (props changed)
   branches/release/boost/math_fwd.hpp (props changed)
   branches/release/boost/msm/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/numeric/ublas/functional.hpp (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/python/ (props changed)
   branches/release/boost/range/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2.hpp (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/statechart/ (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/thread/ (props changed)
   branches/release/boost/thread.hpp (props changed)
   branches/release/boost/token_functions.hpp (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/typeof/message.hpp (props changed)
   branches/release/boost/typeof/register_functions.hpp (props changed)
   branches/release/boost/typeof/register_functions_iterate.hpp (props changed)
   branches/release/boost/typeof/typeof.hpp (props changed)
   branches/release/boost/typeof/unsupported.hpp (props changed)
   branches/release/boost/unordered/ (props changed)
   branches/release/boost/utility/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/algorithm/string/ (props changed)
   branches/release/libs/array/doc/array.xml (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/array/test/array2.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/date_time/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/functional/hash/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/icl/ (props changed)
   branches/release/libs/integer/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/iostreams/ (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/math/doc/ (props changed)
   branches/release/libs/math/doc/sf_and_dist/ (props changed)
   branches/release/libs/mpi/build/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/msm/ (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/python/ (props changed)
   branches/release/libs/range/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/serialization/doc/ (props changed)
   branches/release/libs/serialization/example/ (props changed)
   branches/release/libs/serialization/src/ (props changed)
   branches/release/libs/serialization/test/test_diamond_complex.cpp (props changed)
   branches/release/libs/serialization/vc7ide/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/statechart/ (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/thread/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/type_traits/doc/ (props changed)
   branches/release/libs/typeof/doc/typeof.qbk (props changed)
   branches/release/libs/unordered/ (props changed)
   branches/release/libs/utility/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/swap/test/std_bitset.cpp (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/more/getting_started/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/explicit-failures-markup.xml (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/boostbook/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/quickbook/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/regression/src/library_status.cpp (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
Text files modified:
   branches/release/tools/inspect/assert_macro_check.cpp | 30 +++++++++++++++++++++---------
   branches/release/tools/inspect/assert_macro_check.hpp | 1 +
   branches/release/tools/inspect/build/Jamfile.v2 | 2 +-
   branches/release/tools/inspect/build/msvc/boost_inspect.vcproj | 4 ++++
   branches/release/tools/inspect/doc/inspect.qbk | 20 ++++++++++++++++++--
   branches/release/tools/inspect/inspect.cpp | 8 ++++++++
   6 files changed, 53 insertions(+), 12 deletions(-)

Copied: branches/release/tools/inspect/assert_macro_check.cpp (from r66502, /trunk/tools/inspect/assert_macro_check.cpp)
==============================================================================
--- /trunk/tools/inspect/assert_macro_check.cpp (original)
+++ branches/release/tools/inspect/assert_macro_check.cpp 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -44,7 +44,11 @@
 {
   namespace inspect
   {
- assert_macro_check::assert_macro_check() : m_files_with_errors(0)
+ assert_macro_check::assert_macro_check()
+ : m_files_with_errors(0)
+ , m_from_boost_root(
+ fs::exists(fs::initial_path() / "boost") &&
+ fs::exists(fs::initial_path() / "libs"))
    {
      register_signature( ".c" );
      register_signature( ".cpp" );
@@ -60,15 +64,23 @@
       const path & full_path, // example: c:/foo/boost/filesystem/path.hpp
       const string & contents ) // contents of file to be inspected
     {
- if (contents.find( "boostinspect:" "naassert_macro" ) != string::npos) return;
+ if (contents.find( "boostinspect:" "naassert_macro" ) != string::npos)
+ return;
 
- boost::sregex_iterator cur(contents.begin(), contents.end(), assert_macro_regex), end;
+ // Check files iff (a) they are in the boost directory, or (b) they
+ // are in the src directory under libs.
+ if (m_from_boost_root) {
+ path relative( relative_to( full_path, fs::initial_path() ), fs::no_check );
+ path::const_iterator pbeg = relative.begin(), pend = relative.end();
+ if (pbeg != std::find(pbeg, pend, "boost") &&
+ !(pbeg == std::find(pbeg, pend, "libs") && pend != std::find(pbeg, pend, "src")))
+ return;
+ }
 
       long errors = 0;
-
- for( ; cur != end; ++cur /*, ++m_files_with_errors*/ )
+ boost::sregex_iterator cur(contents.begin(), contents.end(), assert_macro_regex), end;
+ for( ; cur != end; ++cur )
       {
-
         if(!(*cur)[3].matched)
         {
           string::const_iterator it = contents.begin();
@@ -85,12 +97,12 @@
           }
 
           ++errors;
- error( library_name, full_path, "C-style assert macro", line_number );
+ error( library_name, full_path, "C-style assert macro on line "
+ + boost::lexical_cast<string>( line_number ) );
         }
       }
- if(errors > 0) {
+ if(errors > 0)
         ++m_files_with_errors;
- }
     }
   } // namespace inspect
 } // namespace boost

Copied: branches/release/tools/inspect/assert_macro_check.hpp (from r66502, /trunk/tools/inspect/assert_macro_check.hpp)
==============================================================================
--- /trunk/tools/inspect/assert_macro_check.hpp (original)
+++ branches/release/tools/inspect/assert_macro_check.hpp 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -19,6 +19,7 @@
     class assert_macro_check : public inspector
     {
       long m_files_with_errors;
+ bool m_from_boost_root;
     public:
 
       assert_macro_check();

Modified: branches/release/tools/inspect/build/Jamfile.v2
==============================================================================
--- branches/release/tools/inspect/build/Jamfile.v2 (original)
+++ branches/release/tools/inspect/build/Jamfile.v2 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -15,7 +15,7 @@
 exe inspect
     :
     inspect.cpp license_check.cpp link_check.cpp path_name_check.cpp tab_check.cpp crlf_check.cpp end_check.cpp unnamed_namespace_check.cpp ascii_check.cpp
- copyright_check.cpp minmax_check.cpp apple_macro_check.cpp
+ copyright_check.cpp minmax_check.cpp apple_macro_check.cpp assert_macro_check.cpp
     /boost//filesystem/<link>static
     /boost//regex/<link>static
     :

Modified: branches/release/tools/inspect/build/msvc/boost_inspect.vcproj
==============================================================================
--- branches/release/tools/inspect/build/msvc/boost_inspect.vcproj (original)
+++ branches/release/tools/inspect/build/msvc/boost_inspect.vcproj 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -185,6 +185,10 @@
>
                         </File>
                         <File
+ RelativePath="..\..\assert_macro_check.cpp"
+ >
+ </File>
+ <File
                                 RelativePath="..\..\copyright_check.cpp"
>
                         </File>

Modified: branches/release/tools/inspect/doc/inspect.qbk
==============================================================================
--- branches/release/tools/inspect/doc/inspect.qbk (original)
+++ branches/release/tools/inspect/doc/inspect.qbk 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -54,9 +54,13 @@
   -license
   -copyright
   -crlf
+ -end
   -link
- -long_name
+ -path_name
   -tab
+ -ascii
+ -apple_macro
+ -assert_macro
   -minmax
   -unnamed
  default is all checks on; otherwise options specify desired checks
@@ -86,15 +90,27 @@
   [ [[^-crlf]]
     [Checks that files use consistent EOL chanracters.] ]
 
+ [ [[^-end]]
+ [Checks that files end with a newline character.] ]
+
   [ [[^-link]]
     [Checks the validity of URIs in HTML files.] ]
 
- [ [[^-long_name]]
+ [ [[^-path_name]]
     [Checks for long names, and a variety of other file name problems that inhibit portability of files.] ]
 
   [ [[^-tab]]
     [Checks for files with tab characters.] ]
 
+ [ [[^-ascii]]
+ [Checks for files with non-ASCII characters.] ]
+
+ [ [[^-apple_macro]]
+ [Checks for conflicts with to Apple's unfortunately named debugging macros.] ]
+
+ [ [[^-assert_macro]]
+ [Checks for presence of C-style assert macros (instead of BOOST_ASSERT).] ]
+
   [ [[^-minmax]]
     [Checks for violations of the Boost min/max quidelines.] ]
 

Modified: branches/release/tools/inspect/inspect.cpp
==============================================================================
--- branches/release/tools/inspect/inspect.cpp (original)
+++ branches/release/tools/inspect/inspect.cpp 2010-12-23 13:56:29 EST (Thu, 23 Dec 2010)
@@ -40,6 +40,7 @@
 #include "tab_check.hpp"
 #include "ascii_check.hpp"
 #include "apple_macro_check.hpp"
+#include "assert_macro_check.hpp"
 #include "minmax_check.hpp"
 #include "unnamed_namespace_check.hpp"
 
@@ -548,6 +549,7 @@
          " -tab\n"
          " -ascii\n"
          " -apple_macro\n"
+ " -assert_macro\n"
          " -minmax\n"
          " -unnamed\n"
          " default is all checks on; otherwise options specify desired checks"
@@ -720,6 +722,7 @@
   bool tab_ck = true;
   bool ascii_ck = true;
   bool apple_ok = true;
+ bool assert_ok = true;
   bool minmax_ck = true;
   bool unnamed_ck = true;
   bool cvs = false;
@@ -753,6 +756,7 @@
     tab_ck = false;
     ascii_ck = false;
     apple_ok = false;
+ assert_ok = false;
     minmax_ck = false;
     unnamed_ck = false;
   }
@@ -778,6 +782,8 @@
       ascii_ck = true;
     else if ( std::strcmp( argv[1], "-apple_macro" ) == 0 )
       apple_ok = true;
+ else if ( std::strcmp( argv[1], "-assert_macro" ) == 0 )
+ assert_ok = true;
     else if ( std::strcmp( argv[1], "-minmax" ) == 0 )
         minmax_ck = true;
     else if ( std::strcmp( argv[1], "-unnamed" ) == 0 )
@@ -823,6 +829,8 @@
       inspectors.push_back( inspector_element( new boost::inspect::ascii_check ) );
   if ( apple_ok )
       inspectors.push_back( inspector_element( new boost::inspect::apple_macro_check ) );
+ if ( assert_ok )
+ inspectors.push_back( inspector_element( new boost::inspect::assert_macro_check ) );
   if ( minmax_ck )
       inspectors.push_back( inspector_element( new boost::inspect::minmax_check ) );
   if ( unnamed_ck )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk