From 99d68cc183c0869b2ed089a6c5588b0a21310a54 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Thu, 3 May 2007 13:51:47 +0000 Subject: [PATCH] enable -Wall -Woverloaded-virtual by default --- CMakeLists.txt | 4 +-- devel/devel.ma/Parse.cc | 90 +++---------------------------------------------- 2 files changed, 6 insertions(+), 88 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 75ba01c..6447ae2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT(libzypp) -SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g" ) -SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g" ) +SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -Woverloaded-virtual" ) +SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Wall " ) # Library IF ( DEFINED LIB ) diff --git a/devel/devel.ma/Parse.cc b/devel/devel.ma/Parse.cc index b949337..9c1932c 100644 --- a/devel/devel.ma/Parse.cc +++ b/devel/devel.ma/Parse.cc @@ -134,87 +134,10 @@ namespace zypp bool exampleReceiver( ProgressData::value_type v ) { - WAR << "got ->" << v << endl; - return( v <= 100 ); // Abort if ( v > 100 + WAR << "got ->" << v << "%" << endl; + return true; } - class Example - { - public: - - Example( const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() ) - : _fnc( fnc_r ) - {} - - void SendTo( const ProgressData::ReceiverFnc & fnc_r ) - { _fnc = fnc_r; } - - public: - - void action() - { - ProgressData tics( 10 ); // Expect range 0 -> 10 - tics.name( "test ticks" ); // Some arbitrary name - tics.sendTo( _fnc ); // Send reports to _fnc - tics.toMin(); // start sending min (0) - - for ( int i = 0; i < 10; ++i ) - { - if ( ! tics.set( i ) ) - return; // user requested abort - } - - tics.toMax(); // take care 100% are reported on success - } - - void action2() - { - ProgressData tics; // Just send 'still alive' messages - tics.name( "test ticks" ); // Some arbitrary name - tics.sendTo( _fnc ); // Send reports to _fnc - tics.toMin(); // start sending min (0) - - for ( int i = 0; i < 10; ++i ) - { - if ( ! tics.set( i ) ) - return; // user requested abort - } - - tics.toMax(); // - } - - private: - ProgressData::ReceiverFnc _fnc; - }; - - - //ProgressData makeProgressData( const InputStream & input_r ) - //{ - // ProgressData ret; - // ret.name( input_r.name() ); - // if ( input_r.size() > 0 ) - // ret.range( input_r.size() ); - // return ret; - //} - - void simpleParser( const InputStream & input_r, - const ProgressData::ReceiverFnc & fnc_r = ProgressData::ReceiverFnc() ) - { - ProgressData ticks( makeProgressData( input_r ) ); - ticks.sendTo( fnc_r ); - ticks.toMin(); // start sending min (0) - - iostr::EachLine line( input_r ); - for( ; line; line.next() ) - { - /* process the line */ - - if ( ! ticks.set( input_r.stream().tellg() ) ) - return; // user requested abort - } - - ticks.toMax(); // take care 100% are reported on success - } ///////////////////////////////////////////////////////////////// @@ -239,11 +162,6 @@ int main( int argc, char * argv[] ) //zypp::base::LogControl::instance().logfile( "log.restrict" ); INT << "===[START]==========================================" << endl; - TagParser c; - c.parse( "packages.gz", exampleReceiver ); - - return ( 0 ); - //Pathname p( "lmd/suse/setup/descr/packages" ); Pathname p( "packages" ); @@ -267,13 +185,13 @@ int main( int argc, char * argv[] ) PackagesFileReader tp; tp.parse( p ); } - if ( 1 ) { + if ( 0 ) { Pathname p( "packages" ); Measure x( p.basename() ); PackagesFileReader tp; tp.parse( p ); } - if ( 1 ) { + if ( 0 ) { Pathname p( "packages.gz" ); Measure x( p.basename() ); PackagesFileReader tp; -- 2.7.4