Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74145 - sandbox/tools/profile_templates2/src
From: dsaritz_at_[hidden]
Date: 2011-08-30 05:10:37


Author: psiha
Date: 2011-08-30 05:10:35 EDT (Tue, 30 Aug 2011)
New Revision: 74145
URL: http://svn.boost.org/trac/boost/changeset/74145

Log:
Fixed intermediate file opening code to truncate existing files.
Minor other refactoring and cleanup.
Text files modified:
   sandbox/tools/profile_templates2/src/postprocess.cpp | 2 +-
   sandbox/tools/profile_templates2/src/profiler.cpp | 14 ++++++++------
   2 files changed, 9 insertions(+), 7 deletions(-)

Modified: sandbox/tools/profile_templates2/src/postprocess.cpp
==============================================================================
--- sandbox/tools/profile_templates2/src/postprocess.cpp (original)
+++ sandbox/tools/profile_templates2/src/postprocess.cpp 2011-08-30 05:10:35 EDT (Tue, 30 Aug 2011)
@@ -181,7 +181,7 @@
 {
     bool const use_call_graph( true );
 
- output.open( output_file_name );
+ output.open( output_file_name, std::ios_base::trunc );
 
     std::map<std::string, int> messages;
     std::string line;

Modified: sandbox/tools/profile_templates2/src/profiler.cpp
==============================================================================
--- sandbox/tools/profile_templates2/src/profiler.cpp (original)
+++ sandbox/tools/profile_templates2/src/profiler.cpp 2011-08-30 05:10:35 EDT (Tue, 30 Aug 2011)
@@ -24,11 +24,13 @@
 #include "boost/config.hpp"
 
 // POSIX implementation
-#ifdef BOOST_HAS_UNISTD_H
- #include "sys/stat.h"
+#if defined( BOOST_HAS_UNISTD_H )
     #include "unistd.h"
-#else
+#elif defined( BOOST_MSVC )
+ #pragma warning ( disable : 4996 ) // "The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name."
     #include "io.h"
+#else
+ #error unknown or no POSIX implementation
 #endif // BOOST_HAS_UNISTD_H
 #include "fcntl.h"
 #include "sys/stat.h"
@@ -86,11 +88,11 @@
         static char const prepared_file_to_compile[] = "template_profiler.preprocessed.cpp";
         {
             std::string preprocessed_input;
+ std::string filtered_input ;
             preprocess ( compiler_preprocessed_file, preprocessed_input );
- std::string filtered_input;
- copy_call_graph( preprocessed_input, filtered_input );
+ copy_call_graph( preprocessed_input , filtered_input );
 
- int const file_id( /*std*/::open( prepared_file_to_compile, O_CREAT | O_WRONLY, S_IREAD | S_IWRITE ) );
+ int const file_id( /*std*/::open( prepared_file_to_compile, O_CREAT | O_TRUNC | O_WRONLY, S_IREAD | S_IWRITE ) );
             if ( file_id < 0 )
             {
                 std::puts( "Failed creating an intermediate file." );


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