Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81820 - in branches/release/tools/inspect: . build
From: marshall_at_[hidden]
Date: 2012-12-10 10:12:52


Author: marshall
Date: 2012-12-10 10:12:51 EST (Mon, 10 Dec 2012)
New Revision: 81820
URL: http://svn.boost.org/trac/boost/changeset/81820

Log:
Merged Deprecated macro tests for inspect tool to release branch
Added:
   branches/release/tools/inspect/deprecated_macro_check.cpp
      - copied unchanged from r81819, /trunk/tools/inspect/deprecated_macro_check.cpp
   branches/release/tools/inspect/deprecated_macro_check.hpp
      - copied unchanged from r81819, /trunk/tools/inspect/deprecated_macro_check.hpp
Properties modified:
   branches/release/tools/inspect/build/Jamfile.v2 (contents, props changed)
   branches/release/tools/inspect/inspect.cpp (contents, props changed)
Text files modified:
   branches/release/tools/inspect/build/Jamfile.v2 | 1
   branches/release/tools/inspect/inspect.cpp | 95 ++++++++++++++++++++++++---------------
   2 files changed, 59 insertions(+), 37 deletions(-)

Modified: branches/release/tools/inspect/build/Jamfile.v2
==============================================================================
--- branches/release/tools/inspect/build/Jamfile.v2 (original)
+++ branches/release/tools/inspect/build/Jamfile.v2 2012-12-10 10:12:51 EST (Mon, 10 Dec 2012)
@@ -19,6 +19,7 @@
     assert_macro_check.cpp
     copyright_check.cpp
     crlf_check.cpp
+ deprecated_macro_check.cpp
     end_check.cpp
     inspect.cpp
     license_check.cpp

Modified: branches/release/tools/inspect/inspect.cpp
==============================================================================
--- branches/release/tools/inspect/inspect.cpp (original)
+++ branches/release/tools/inspect/inspect.cpp 2012-12-10 10:12:51 EST (Mon, 10 Dec 2012)
@@ -1,4 +1,4 @@
-// inspect program ---------------------------------------------------------//
+// inspect program -------------------------------------------------------------------//
 
 // Copyright Beman Dawes 2002.
 // Copyright Rene Rivera 2004-2006.
@@ -15,6 +15,11 @@
 
 // See http://www.boost.org/tools/inspect/ for more information.
 
+const char* boost_no_inspect = "boost-" "no-inspect";
+
+// Directories with a file name of the boost_no_inspect value are not inspected.
+// Files that contain the boost_no_inspect value are not inspected.
+
 
 #include <vector>
 #include <list>
@@ -26,6 +31,15 @@
 #include "boost/filesystem/operations.hpp"
 #include "boost/filesystem/fstream.hpp"
 
+#include <stdio.h> // for popen, pclose
+#if defined(_MSC_VER)
+# define POPEN _popen
+# define PCLOSE _pclose
+#else
+# define POPEN popen
+# define PCLOSE pclose
+#endif
+
 #include "time_string.hpp"
 
 #include "inspector.hpp"
@@ -41,6 +55,7 @@
 #include "ascii_check.hpp"
 #include "apple_macro_check.hpp"
 #include "assert_macro_check.hpp"
+#include "deprecated_macro_check.hpp"
 #include "minmax_check.hpp"
 #include "unnamed_namespace_check.hpp"
 
@@ -111,29 +126,26 @@
 
 // get info (as a string) if inspect_root is svn working copy --------------//
 
- void extract_info( fs::ifstream & entries_file, string & rev, string & repos )
- {
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev );
- std::getline( entries_file, rev ); // revision number as a string
- std::getline( entries_file, repos ); // repository as a string
- }
-
   string info( const fs::path & inspect_root )
   {
- string rev( "?" );
- string repos( "unknown" );
- fs::path entries( inspect_root / ".svn" / "entries" );
- fs::ifstream entries_file( entries );
- if ( entries_file )
- extract_info( entries_file, rev, repos );
- else
- {
- entries = inspect_root / ".." / "svn_info" / ".svn" / "entries";
- fs::ifstream entries_file( entries );
- if ( entries_file )
- extract_info( entries_file, rev, repos );
+ string rev("unknown");
+ string repos("unknown");
+ string command("cd ");
+ command += inspect_root.string() + " & svn info";
+ FILE* fp = POPEN(command.c_str(), "r");
+ if (fp)
+ {
+ static const int line_max = 128;
+ char line[line_max];
+ while (fgets(line, line_max, fp) != NULL)
+ {
+ string ln(line);
+ string::size_type pos;
+ if ((pos = ln.find("Revision: ")) != string::npos)
+ rev = ln.substr(pos + 10);
+ else if ((pos = ln.find("URL: ")) != string::npos)
+ repos = ln.substr(pos + 5);
+ }
     }
     return repos + " at revision " + rev;
   }
@@ -165,7 +177,7 @@
       // ignore OS X directory info files:
       && leaf != ".DS_Store"
       // ignore if tag file present
- && !boost::filesystem::exists(pth / "boost-no-inspect")
+ && !boost::filesystem::exists(pth / boost_no_inspect)
       ;
   }
 
@@ -268,9 +280,9 @@
         ++file_count;
         string content;
         load_content( *itr, content );
- check( lib.empty()
- ? library_from_content( content ) : lib
- , *itr, content, insps );
+ if (content.find(boost_no_inspect) == string::npos)
+ check( lib.empty() ? library_from_content( content ) : lib,
+ *itr, content, insps );
       }
     }
   }
@@ -376,8 +388,6 @@
 
   void display_details()
   {
- // gps - review this
-
     if (display_text == display_format)
     {
       // display error messages with group indication
@@ -573,6 +583,7 @@
          " -ascii\n"
          " -apple_macro\n"
          " -assert_macro\n"
+ " -deprecated_macro\n"
          " -minmax\n"
          " -unnamed\n"
          " default is all checks on; otherwise options specify desired checks"
@@ -743,8 +754,9 @@
   bool path_name_ck = true;
   bool tab_ck = true;
   bool ascii_ck = true;
- bool apple_ok = true;
- bool assert_ok = true;
+ bool apple_ck = true;
+ bool assert_ck = true;
+ bool deprecated_ck = true;
   bool minmax_ck = true;
   bool unnamed_ck = true;
   bool cvs = false;
@@ -777,8 +789,9 @@
     path_name_ck = false;
     tab_ck = false;
     ascii_ck = false;
- apple_ok = false;
- assert_ok = false;
+ apple_ck = false;
+ assert_ck = false;
+ deprecated_ck = false;
     minmax_ck = false;
     unnamed_ck = false;
   }
@@ -803,9 +816,11 @@
     else if ( std::strcmp( argv[1], "-ascii" ) == 0 )
       ascii_ck = true;
     else if ( std::strcmp( argv[1], "-apple_macro" ) == 0 )
- apple_ok = true;
+ apple_ck = true;
     else if ( std::strcmp( argv[1], "-assert_macro" ) == 0 )
- assert_ok = true;
+ assert_ck = true;
+ else if ( std::strcmp( argv[1], "-deprecated_macro" ) == 0 )
+ deprecated_ck = true;
     else if ( std::strcmp( argv[1], "-minmax" ) == 0 )
         minmax_ck = true;
     else if ( std::strcmp( argv[1], "-unnamed" ) == 0 )
@@ -849,10 +864,12 @@
       inspectors.push_back( inspector_element( new boost::inspect::tab_check ) );
   if ( ascii_ck )
       inspectors.push_back( inspector_element( new boost::inspect::ascii_check ) );
- if ( apple_ok )
+ if ( apple_ck )
       inspectors.push_back( inspector_element( new boost::inspect::apple_macro_check ) );
- if ( assert_ok )
+ if ( assert_ck )
       inspectors.push_back( inspector_element( new boost::inspect::assert_macro_check ) );
+ if ( deprecated_ck )
+ inspectors.push_back( inspector_element( new boost::inspect::deprecated_macro_check ) );
   if ( minmax_ck )
       inspectors.push_back( inspector_element( new boost::inspect::minmax_check ) );
   if ( unnamed_ck )
@@ -977,10 +994,14 @@
     if (display_text == display_format)
     {
       std::cout << "Details:\n" << inspector_keys;
- }
+ std::cout << "\nDirectories with a file named \"" << boost_no_inspect << "\" will not be inspected.\n"
+ "Files containing \"" << boost_no_inspect << "\" will not be inspected.\n";
+ }
     else
     {
       std::cout << "<h2>Details</h2>\n" << inspector_keys;
+ std::cout << "\n<p>Directories with a file named \"" << boost_no_inspect << "\" will not be inspected.<br>\n"
+ "Files containing \"" << boost_no_inspect << "\" will not be inspected.</p>\n";
     }
     display_details();
   }


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