From c68642eb5f379b5539c83b4e56ad204c22932d14 Mon Sep 17 00:00:00 2001 From: lfittl Date: Thu, 19 Jan 2006 23:11:57 +0000 Subject: [PATCH] - Disabled -Weffc++ flag, fixing these warnings produces too much useless code - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@499 7ec92016-0320-0410-acc4-a06ded1c099a --- CHANGES | 3 ++- include/loki/Factory.h | 5 +++++ include/loki/Singleton.h | 6 +++++ include/loki/flex/flex_string_shell.h | 32 +++++++++++++-------------- src/Makefile | 2 +- src/SmallObj.cpp | 6 ++++- test/Factory/Factory.cpp | 8 +++++-- test/Factory/Makefile | 2 +- test/Function/Makefile | 2 +- test/Longevity/Makefile | 2 +- test/OrderedStatic/Makefile | 2 +- test/Pimpl/Makefile | 3 +-- test/RegressionTest/AssocVectorTest.h | 2 +- test/RegressionTest/FactoryTest.h | 12 +++++----- test/RegressionTest/Makefile | 2 +- test/RegressionTest/SequenceTest.h | 4 ++-- test/RegressionTest/TypelistTest.h | 4 ++-- test/SafeFormat/Makefile | 4 ++-- test/ScopeGuard/Makefile | 2 +- test/Singleton/Dependencies.cpp | 16 +++++++------- test/Singleton/Makefile | 2 +- test/SmallObj/Makefile | 2 +- test/SmallObj/SmallObjBench.cpp | 8 +++++-- test/SmallObj/timer.h | 6 ++++- test/Visitor/Makefile | 2 +- 25 files changed, 83 insertions(+), 56 deletions(-) diff --git a/CHANGES b/CHANGES index ccfc247..99f38ec 100755 --- a/CHANGES +++ b/CHANGES @@ -9,6 +9,7 @@ General: - improved Makefiles (lf) - improved make.msvc.bat files (pk) - cvs LOG keywords added (rs) + - removed old c style casts (lf) Singleton: - support of allocators with a standard interface added (Thanks to Miguel A. Figueroa-Villanueva, pk) @@ -217,4 +218,4 @@ Threading: LOKI_CLASS_LEVEL_THREADING and LOKI_OBJECT_LEVEL_THREADING (pk) -CVS commits by Rich Sposato (rs) and Peter Kümmel (pk) \ No newline at end of file +CVS commits by Rich Sposato (rs) and Peter Kümmel (pk) diff --git a/include/loki/Factory.h b/include/loki/Factory.h index 1d3b3a5..1e39b91 100644 --- a/include/loki/Factory.h +++ b/include/loki/Factory.h @@ -726,6 +726,7 @@ template public: Factory() + : associations_() { } @@ -1035,6 +1036,10 @@ template #endif // FACTORY_INC_ // $Log$ +// Revision 1.15 2006/01/19 23:11:55 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.14 2006/01/16 19:05:09 rich_sposato // Added cvs keywords. // diff --git a/include/loki/Singleton.h b/include/loki/Singleton.h index 427f58b..fa47da9 100644 --- a/include/loki/Singleton.h +++ b/include/loki/Singleton.h @@ -537,6 +537,8 @@ namespace Loki class SingletonFixedLongevity { public: + virtual ~SingletonFixedLongevity() {} + static void ScheduleDestruction(T* pObj, atexit_pfn_t pFun) { Private::Adapter adapter = { pFun }; @@ -833,6 +835,10 @@ namespace Loki #endif // SINGLETON_INC_ // $Log$ +// Revision 1.22 2006/01/19 23:11:55 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.21 2006/01/16 20:10:51 syntheticpp // another fight against tabs // diff --git a/include/loki/flex/flex_string_shell.h b/include/loki/flex/flex_string_shell.h index 0ade2da..34f1f0f 100755 --- a/include/loki/flex/flex_string_shell.h +++ b/include/loki/flex/flex_string_shell.h @@ -324,7 +324,7 @@ public: void reserve(size_type res_arg = 0) { - Enforce(res_arg <= max_size(), (std::length_error*)0, ""); + Enforce(res_arg <= max_size(), static_cast(0), ""); Storage::reserve(res_arg); } @@ -343,13 +343,13 @@ public: const_reference at(size_type n) const { - Enforce(n <= size(), (std::out_of_range*)0, ""); + Enforce(n <= size(), static_cast(0), ""); return (*this)[n]; } reference at(size_type n) { - Enforce(n < size(), (std::out_of_range*)0, ""); + Enforce(n < size(), static_cast(0), ""); return (*this)[n]; } @@ -373,7 +373,7 @@ public: size_type n) { const size_type sz = str.size(); - Enforce(pos <= sz, (std::out_of_range*)0, ""); + Enforce(pos <= sz, static_cast(0), ""); Procust(n, sz - pos); return append(str.data() + pos, n); } @@ -429,7 +429,7 @@ public: size_type n) { const size_type sz = str.size(); - Enforce(pos <= sz, (std::out_of_range*)0, ""); + Enforce(pos <= sz, static_cast(0), ""); Procust(n, sz - pos); return assign(str.data() + pos, n); } @@ -465,14 +465,14 @@ public: flex_string& insert(size_type pos1, const flex_string& str, size_type pos2, size_type n) { - Enforce(pos2 <= str.length(), (std::out_of_range*)0, ""); + Enforce(pos2 <= str.length(), static_cast(0), ""); Procust(n, str.length() - pos2); return insert(pos1, str.data() + pos2, n); } flex_string& insert(size_type pos, const value_type* s, size_type n) { - Enforce(pos <= length(), (std::out_of_range*)0, ""); + Enforce(pos <= length(), static_cast(0), ""); insert(begin() + pos, s, s + n); return *this; } @@ -482,7 +482,7 @@ public: flex_string& insert(size_type pos, size_type n, value_type c) { - Enforce(pos <= length(), (std::out_of_range*)0, ""); + Enforce(pos <= length(), static_cast(0), ""); insert(begin() + pos, n, c); return *this; } @@ -612,7 +612,7 @@ public: { Invariant checker(*this); (void) checker; - Enforce(pos <= length(), (std::out_of_range*)0, ""); + Enforce(pos <= length(), static_cast(0), ""); Procust(n, length() - pos); std::copy(begin() + pos + n, end(), begin() + pos); resize(length() - n); @@ -642,7 +642,7 @@ public: flex_string& replace(size_type pos1, size_type n1, const flex_string& str, size_type pos2, size_type n2) { - Enforce(pos2 <= str.length(), (std::out_of_range*)0, ""); + Enforce(pos2 <= str.length(), static_cast(0), ""); return replace(pos1, n1, str.data() + pos2, Min(n2, str.size() - pos2)); } @@ -741,7 +741,7 @@ public: { Invariant checker(*this); (void) checker; - Enforce(pos <= size(), (std::out_of_range*)0, ""); + Enforce(pos <= size(), static_cast(0), ""); Procust(n1, length() - pos); const iterator b = begin() + pos; return replace(b, b + n1, s_or_n2, n_or_c); @@ -854,7 +854,7 @@ public: size_type copy(value_type* s, size_type n, size_type pos = 0) const { - Enforce(pos <= size(), (std::out_of_range*)0, ""); + Enforce(pos <= size(), static_cast(0), ""); Procust(n, size() - pos); flex_string_details::pod_copy( @@ -1046,7 +1046,7 @@ public: flex_string substr(size_type pos = 0, size_type n = npos) const { - Enforce(pos <= size(), (std::out_of_range*)0, ""); + Enforce(pos <= size(), static_cast(0), ""); return flex_string(data() + pos, Min(n, size() - pos)); } @@ -1073,7 +1073,7 @@ public: int compare(size_type pos1, size_type n1, const value_type* s, size_type n2) const { - Enforce(pos1 <= size(), (std::out_of_range*)0, ""); + Enforce(pos1 <= size(), static_cast(0), ""); Procust(n1, size() - pos1); const int r = traits_type::compare(data(), s, Min(n1, n2)); return @@ -1087,7 +1087,7 @@ public: const flex_string& str, size_type pos2, size_type n2) const { - Enforce(pos2 <= str.size(), (std::out_of_range*)0, ""); + Enforce(pos2 <= str.size(), static_cast(0), ""); return compare(pos1, n1, str.data() + pos2, Min(n2, str.size() - pos2)); } @@ -1286,6 +1286,6 @@ getline( template const typename flex_string::size_type -flex_string::npos = (typename flex_string::size_type)(-1); +flex_string::npos = static_cast::size_type>(-1); #endif // FLEX_STRING_SHELL_INC_ diff --git a/src/Makefile b/src/Makefile index 099bf7a..df8a618 100755 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ OBJ = Singleton.o SmallObj.o OrderedStatic.o SafeFormat.o BIN = ../lib/libloki.a -CXXFLAGS = -Wall -Weffc++ -pedantic -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../include -DNDEBUG $(BIN): $(OBJ) diff --git a/src/SmallObj.cpp b/src/SmallObj.cpp index 18759ec..4476883 100644 --- a/src/SmallObj.cpp +++ b/src/SmallObj.cpp @@ -1115,7 +1115,7 @@ void * SmallObjAllocator::Allocate( std::size_t numBytes, bool doThrow ) if ( ( NULL == place ) && doThrow ) { -#if _MSC_VER +#ifdef _MSC_VER throw std::bad_alloc( "could not allocate small object" ); #else // GCC did not like a literal string passed to std::bad_alloc. @@ -1222,6 +1222,10 @@ bool SmallObjAllocator::IsCorrupt( void ) const //////////////////////////////////////////////////////////////////////////////// // $Log$ +// Revision 1.27 2006/01/19 23:11:56 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.26 2006/01/18 17:21:31 lfittl // - Compile library with -Weffc++ and -pedantic (gcc) // - Fix most issues raised by using -Weffc++ (initialization lists) diff --git a/test/Factory/Factory.cpp b/test/Factory/Factory.cpp index 994f087..34ea980 100755 --- a/test/Factory/Factory.cpp +++ b/test/Factory/Factory.cpp @@ -194,12 +194,12 @@ CreatorT cT; bool reg() { bool const ok1 = PFactoryNull::Instance().Register( 1, createProductNull ); - bool const ok2 = PFactoryNull::Instance().Register( 2, (Product*(*)()) createProductOver ); + bool const ok2 = PFactoryNull::Instance().Register( 2, static_cast(createProductOver) ); bool const ok3 = PFactoryNull::Instance().Register( 3, c, &AbstractCreator::create ); bool const ok4 = PFactoryNull::Instance().Register( 4, &cT, &CreatorT::create ); bool const ok5 = PFactory::Instance().Register( "One", createProductParm ); - bool const ok6 = PFactory::Instance().Register( "Two", (Product*(*)(int,int))createProductOver ); + bool const ok6 = PFactory::Instance().Register( "Two", static_cast(createProductOver) ); bool const ok7 = PFactory::Instance().Register( "Three", c, &AbstractCreator::createParm ); bool const ok8 = PFactory::Instance().Register( "Four", &cT, &CreatorT::createParm ); @@ -303,6 +303,10 @@ int main() // $Log$ +// Revision 1.14 2006/01/19 23:11:56 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.13 2006/01/09 07:27:01 syntheticpp // replace tabs // diff --git a/test/Factory/Makefile b/test/Factory/Makefile index 9d28743..6faed5a 100755 --- a/test/Factory/Makefile +++ b/test/Factory/Makefile @@ -1,5 +1,5 @@ BIN = Factory -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/Function/Makefile b/test/Function/Makefile index 5563cce..bf080f9 100644 --- a/test/Function/Makefile +++ b/test/Function/Makefile @@ -1,5 +1,5 @@ BIN = FunctionTest -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki -lboost_test_exec_monitor diff --git a/test/Longevity/Makefile b/test/Longevity/Makefile index 59cb557..26b5858 100755 --- a/test/Longevity/Makefile +++ b/test/Longevity/Makefile @@ -1,6 +1,6 @@ BIN1 = main BIN2 = main2 -CXXFLAGS = -Wall -fexpensive-optimizations -O3 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -fexpensive-optimizations -O3 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/OrderedStatic/Makefile b/test/OrderedStatic/Makefile index e25a1ad..6edf530 100755 --- a/test/OrderedStatic/Makefile +++ b/test/OrderedStatic/Makefile @@ -1,5 +1,5 @@ BIN = main -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/Pimpl/Makefile b/test/Pimpl/Makefile index 092bada..6edf530 100755 --- a/test/Pimpl/Makefile +++ b/test/Pimpl/Makefile @@ -1,6 +1,5 @@ BIN = main -CC = gcc -CXXFLAGS = -Wall -O2 -pedantic +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/RegressionTest/AssocVectorTest.h b/test/RegressionTest/AssocVectorTest.h index 4d1c52f..e9e33df 100755 --- a/test/RegressionTest/AssocVectorTest.h +++ b/test/RegressionTest/AssocVectorTest.h @@ -358,7 +358,7 @@ void test_vect5() void test_vect6() { - srand( (unsigned int) time(NULL) ); + srand( static_cast(time(NULL)) ); typedef Loki::AssocVector IntMap; const unsigned int numTests = 20; diff --git a/test/RegressionTest/FactoryTest.h b/test/RegressionTest/FactoryTest.h index 5e3d804..218c8d3 100755 --- a/test/RegressionTest/FactoryTest.h +++ b/test/RegressionTest/FactoryTest.h @@ -57,9 +57,9 @@ namespace FactoryTestPrivate { FactoryType factory; - factory.Register(1, (Shape * (*)()) createPolygon); - factory.Register(2, (Shape * (*)()) createCircle); - factory.Register(3, (Shape * (*)()) createLine); + factory.Register(1, reinterpret_cast(createPolygon)); + factory.Register(2, reinterpret_cast(createCircle)); + factory.Register(3, reinterpret_cast(createLine)); Shape *s; @@ -96,9 +96,9 @@ namespace FactoryTestPrivate { CloneFactoryType factory; - factory.Register(Loki::TypeInfo(typeid(Polygon)), (Shape * (*)(const Shape *)) clonePolygon); - factory.Register(Loki::TypeInfo(typeid(Circle)), (Shape * (*)(const Shape *)) cloneCircle); - factory.Register(Loki::TypeInfo(typeid(Line)), (Shape * (*)(const Shape *)) cloneLine); + factory.Register(Loki::TypeInfo(typeid(Polygon)), reinterpret_cast(clonePolygon)); + factory.Register(Loki::TypeInfo(typeid(Circle)), reinterpret_cast(cloneCircle)); + factory.Register(Loki::TypeInfo(typeid(Line)), reinterpret_cast(cloneLine)); Polygon p; Circle c; diff --git a/test/RegressionTest/Makefile b/test/RegressionTest/Makefile index 5942f2a..7de6da5 100755 --- a/test/RegressionTest/Makefile +++ b/test/RegressionTest/Makefile @@ -1,5 +1,5 @@ BIN = Test -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/RegressionTest/SequenceTest.h b/test/RegressionTest/SequenceTest.h index 024f874..7b0f204 100755 --- a/test/RegressionTest/SequenceTest.h +++ b/test/RegressionTest/SequenceTest.h @@ -54,7 +54,7 @@ public: testAssert("TypeAt",r,result); - #if !(_MSC_VER && !__INTEL_COMPILER && !__MWERKS__ && _MSC_VER < 1300) + #if !(defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) && _MSC_VER < 1300) // TypeAtNonStrict works like TypeAt on MSVC 6.0 @@ -79,7 +79,7 @@ public: testAssert("IndexOf",r,result); - #if !(_MSC_VER && !__INTEL_COMPILER && !__MWERKS__ && _MSC_VER < 1300) + #if !(defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) && _MSC_VER < 1300) // Append, Erase, EraseAll, NoDuplicates, Replace, ReplaceAll, Reverse, // MostDerived and DerivedToFront doesn't work on MSVC 6.0 diff --git a/test/RegressionTest/TypelistTest.h b/test/RegressionTest/TypelistTest.h index 3ffc198..04ac5c2 100755 --- a/test/RegressionTest/TypelistTest.h +++ b/test/RegressionTest/TypelistTest.h @@ -65,7 +65,7 @@ public: testAssert("TypeAt",r,result); - #if !(_MSC_VER && !__INTEL_COMPILER && !__MWERKS__ && _MSC_VER < 1300) + #if !(defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) && _MSC_VER < 1300) // TypeAtNonStrict works like TypeAt on MSVC 6.0 @@ -90,7 +90,7 @@ public: testAssert("IndexOf",r,result); - #if !(_MSC_VER && !__INTEL_COMPILER && !__MWERKS__ && _MSC_VER < 1300) + #if !(defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__MWERKS__) && _MSC_VER < 1300) // Append, Erase, EraseAll, NoDuplicates, Replace, ReplaceAll, Reverse, // MostDerived and DerivedToFront doesn't work on MSVC 6.0 diff --git a/test/SafeFormat/Makefile b/test/SafeFormat/Makefile index 6d9eaf2..1ae0d41 100755 --- a/test/SafeFormat/Makefile +++ b/test/SafeFormat/Makefile @@ -1,5 +1,5 @@ BIN = main -CXXFLAGS = -Wall -fexpensive-optimizations -O3 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -fexpensive-optimizations -O3 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki @@ -7,4 +7,4 @@ LDLIBS = -lloki .PHONY: build clean build: $(BIN) clean: - rm -f $(BIN) $(BIN).exe $(BIN).o \ No newline at end of file + rm -f $(BIN) $(BIN).exe $(BIN).o diff --git a/test/ScopeGuard/Makefile b/test/ScopeGuard/Makefile index e25a1ad..6edf530 100755 --- a/test/ScopeGuard/Makefile +++ b/test/ScopeGuard/Makefile @@ -1,5 +1,5 @@ BIN = main -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/Singleton/Dependencies.cpp b/test/Singleton/Dependencies.cpp index 6ad2634..1d8681c 100755 --- a/test/Singleton/Dependencies.cpp +++ b/test/Singleton/Dependencies.cpp @@ -408,13 +408,13 @@ int main() void* p; - p = (void*) &Singleton_with_MySmallObject_DieAs::Instance(); - p = (void*) &Singleton_MyFunctionObject_DieAs::Instance(); + p = static_cast(&Singleton_with_MySmallObject_DieAs::Instance()); + p = static_cast(&Singleton_MyFunctionObject_DieAs::Instance()); std::cout<<"\n"; - p = (void*) &Follower1_Singleton_B1_die_first::Instance(); - p = (void*) &Follower1_Singleton_B1_die_last::Instance(); + p = static_cast(&Follower1_Singleton_B1_die_first::Instance()); + p = static_cast(&Follower1_Singleton_B1_die_last::Instance()); // test of FollowIntoDeath policy, not supported by msvc 7.1 compiler @@ -422,9 +422,9 @@ int main() std::cout << "\nMaster1:\n\n"; - p = (void*) &Follower1_Singleton_DefaultLifetime::Instance(); - p = (void*) &Follower1_Singleton_PhoenixSingleton::Instance(); - p = (void*) &Follower1_Singleton_DeletableSingleton::Instance(); + p = static_cast(&Follower1_Singleton_DefaultLifetime::Instance()); + p = static_cast(&Follower1_Singleton_PhoenixSingleton::Instance()); + p = static_cast(&Follower1_Singleton_DeletableSingleton::Instance()); std::cout << "\n\nMaster2:\n\n"; @@ -441,7 +441,7 @@ int main() // memory leak when code is enabled //#define ENABLE_MEMORY_LEAK #ifdef ENABLE_MEMORY_LEAK - p = (void*) &Follower1_Singleton_NoDestroy::Instance(); + p = static_cast(&Follower1_Singleton_NoDestroy::Instance()); B2_NoDestroy *no2 = &Follower2_Singleton_NoDestroy::Instance(); no2->data = &Master2_NoDestroy::Singleton::Instance(); #endif diff --git a/test/Singleton/Makefile b/test/Singleton/Makefile index 93a8cdc..ab4770e 100644 --- a/test/Singleton/Makefile +++ b/test/Singleton/Makefile @@ -1,7 +1,7 @@ BIN1 = DeletableSingleton BIN2 = Dependencies BIN3 = Phoenix -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/SmallObj/Makefile b/test/SmallObj/Makefile index b7a961b..c42a34c 100755 --- a/test/SmallObj/Makefile +++ b/test/SmallObj/Makefile @@ -1,6 +1,6 @@ BIN1 = SmallObjBench BIN2 = SmallObjSingleton -CXXFLAGS = -Wall -fexpensive-optimizations -O3 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -fexpensive-optimizations -O3 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki diff --git a/test/SmallObj/SmallObjBench.cpp b/test/SmallObj/SmallObjBench.cpp index f89657f..b000064 100755 --- a/test/SmallObj/SmallObjBench.cpp +++ b/test/SmallObj/SmallObjBench.cpp @@ -195,11 +195,11 @@ int FUNC(void** arrv, const int N, int loop, Timer& t, const char* s) \ LOKI_SMALLOBJ_BENCH(delete_new ,delete new T;) -LOKI_SMALLOBJ_BENCH(delete_new_mal ,std::free(std::malloc(sizeof(T)));); +LOKI_SMALLOBJ_BENCH(delete_new_mal ,std::free(std::malloc(sizeof(T)));) LOKI_SMALLOBJ_BENCH(delete_new_all ,std::allocator st;st.deallocate(st.allocate(1), 1);) LOKI_SMALLOBJ_BENCH(delete_new_array ,delete[] new T[N];) -LOKI_SMALLOBJ_BENCH(delete_new_array_mal,std::free(std::malloc(sizeof(T[TN])));); +LOKI_SMALLOBJ_BENCH(delete_new_array_mal,std::free(std::malloc(sizeof(T[TN])));) LOKI_SMALLOBJ_BENCH(delete_new_array_all,std::allocator st;st.deallocate(st.allocate(1), 1);) LOKI_SMALLOBJ_BENCH_ARRAY(new_del_on_arr , , arr[i] = new T; , @@ -324,6 +324,10 @@ int main() // ---------------------------------------------------------------------------- // $Log$ +// Revision 1.19 2006/01/19 23:11:57 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.18 2006/01/05 09:55:09 syntheticpp // assert, include path, and virtual ~ patches by Lukas Fittl // diff --git a/test/SmallObj/timer.h b/test/SmallObj/timer.h index 1f36bee..19ecc1e 100755 --- a/test/SmallObj/timer.h +++ b/test/SmallObj/timer.h @@ -52,7 +52,7 @@ public: int rel(int t) { - return ( t100==0 ? 100 : (int) floor(100.0*t/t100+0.5) ); + return ( t100==0 ? 100 : static_cast(floor(100.0*t/t100+0.5)) ); } double speedup(int t) @@ -75,6 +75,10 @@ private: #endif // $Log$ +// Revision 1.6 2006/01/19 23:11:57 lfittl +// - Disabled -Weffc++ flag, fixing these warnings produces too much useless code +// - Enabled -pedantic, -Wold-style-cast and -Wundef for src/ and test/ +// // Revision 1.5 2005/10/30 14:03:23 syntheticpp // replace tabs space // diff --git a/test/Visitor/Makefile b/test/Visitor/Makefile index e25a1ad..6edf530 100755 --- a/test/Visitor/Makefile +++ b/test/Visitor/Makefile @@ -1,5 +1,5 @@ BIN = main -CXXFLAGS = -Wall -O2 +CXXFLAGS = -Wall -Wold-style-cast -Wundef -pedantic -O2 CPPFLAGS = -I../../include -DNDEBUG LDFLAGS = -L../../lib LDLIBS = -lloki