• R/O
  • SSH
  • HTTPS

iris-fmw: Commit


Commit MetaInfo

Revision277 (tree)
Time2012-02-23 23:20:52
Authorshirayanagi

Log Message

cppcheck 対応

Change Summary

Incremental Difference

--- trunk/framework/src/platform/windows/win/net/WXSocketCore.h (revision 276)
+++ trunk/framework/src/platform/windows/win/net/WXSocketCore.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -20,6 +20,7 @@
2020 //======================================================================
2121 // include
2222 #if !defined(_WINSOCK2API_) && defined(_WINSOCKAPI_)
23+// cppcheck-suppress syntaxError
2324 #error winsock.h がインクルード先にinclude されています。 include 順序を変更してください
2425 #endif
2526
--- trunk/framework/src/platform/windows/win/net/WXSocket.h (revision 276)
+++ trunk/framework/src/platform/windows/win/net/WXSocket.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -20,6 +20,7 @@
2020 //======================================================================
2121 // include
2222 #if !defined(_WINSOCK2API_) && defined(_WINSOCKAPI_)
23+// cppcheck-suppress syntaxError
2324 #error winsock.h がインクルード先にinclude されています。 include 順序を変更してください
2425 #endif
2526
--- trunk/framework/src/platform/windows/win/debug/dbghelp/WXObjLeakCheck.cpp (revision 276)
+++ trunk/framework/src/platform/windows/win/debug/dbghelp/WXObjLeakCheck.cpp (revision 277)
@@ -146,6 +146,7 @@
146146 : m_pTop(nullptr)
147147 , m_Heap(nullptr)
148148 , m_pLast(nullptr)
149+ , m_AllocCount(0)
149150 {
150151 }
151152
--- trunk/framework/src/misc/iris_pushpack8.h (revision 276)
+++ trunk/framework/src/misc/iris_pushpack8.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -19,10 +19,12 @@
1919
2020 //======================================================================
2121 // define
22-#ifdef _IRIS_iris_poppack_H_
23-# undef _IRIS_iris_poppack_H_
22+#ifdef INCG_IRIS_iris_poppack_H_
23+# undef INCG_IRIS_iris_poppack_H_
2424 #endif
2525
26+#define INCG_IRIS_iris_pushpack8_H_
27+
2628 //======================================================================
2729 // include
2830 #if defined(_WIN32)
@@ -32,5 +34,9 @@
3234 # pragma pack(8)
3335 #endif
3436
37+#elif !defined(INCG_IRIS_iris_pushpack8_H_)
3538
39+// cppcheck-suppress syntaxError
40+#error pack 設定を変える場合は、一度 pop してください。
41+
3642 #endif
--- trunk/framework/src/misc/iris_pushpack1.h (revision 276)
+++ trunk/framework/src/misc/iris_pushpack1.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -37,6 +37,7 @@
3737
3838 #elif !defined(INCG_IRIS_iris_pushpack1_H_)
3939
40+// cppcheck-suppress syntaxError
4041 #error pack 設定を変える場合は、一度 pop してください。
4142
4243 #endif
--- trunk/framework/src/misc/iris_pushpack2.h (revision 276)
+++ trunk/framework/src/misc/iris_pushpack2.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -37,6 +37,7 @@
3737
3838 #elif !defined(INCG_IRIS_iris_pushpack2_H_)
3939
40+// cppcheck-suppress syntaxError
4041 #error pack 設定を変える場合は、一度 pop してください。
4142
4243 #endif
--- trunk/framework/src/misc/iris_pushpack4.h (revision 276)
+++ trunk/framework/src/misc/iris_pushpack4.h (revision 277)
@@ -8,7 +8,7 @@
88 * @version 1.0
99 *
1010 * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
11+ * Copyright (C) 2009-2012 Takazumi Shirayanagi\n
1212 * The new BSD License is applied to this software.
1313 * see iris_LICENSE.txt
1414 */
@@ -19,10 +19,12 @@
1919
2020 //======================================================================
2121 // define
22-#ifdef _IRIS_iris_poppack_H_
23-# undef _IRIS_iris_poppack_H_
22+#ifdef INCG_IRIS_iris_poppack_H_
23+# undef INCG_IRIS_iris_poppack_H_
2424 #endif
2525
26+#define INCG_IRIS_iris_pushpack4_H_
27+
2628 //======================================================================
2729 // include
2830 #if defined(_WIN32)
@@ -32,5 +34,9 @@
3234 # pragma pack(4)
3335 #endif
3436
37+#elif !defined(INCG_IRIS_iris_pushpack4_H_)
3538
39+// cppcheck-suppress syntaxError
40+#error pack 設定を変える場合は、一度 pop してください。
41+
3642 #endif
--- trunk/framework/src/fnd/container/test/test_templates.cpp (revision 276)
+++ trunk/framework/src/fnd/container/test/test_templates.cpp (nonexistent)
@@ -1,339 +0,0 @@
1-//======================================================================
2-//-----------------------------------------------------------------------
3-/**
4- * @file FndUnitTest.cpp
5- * @brief 単体テストファイルファイル
6- *
7- * @author t.sirayanagi
8- * @version 1.0
9- *
10- * @par copyright
11- * Copyright (C) 2009-2011 Takazumi Shirayanagi\n
12- * The new BSD License is applied to this software.
13- * see iris_LICENSE.txt
14-*/
15-//-----------------------------------------------------------------------
16-//======================================================================
17-#define INCG_IRIS_FndUnitTest_CPP_
18-
19-#if (defined(_IRIS_UNITTEST) || defined(_IRIS_MULTI_UNITTEST) )
20-
21-//======================================================================
22-// include
23-#include "../../unit/UnitCore.h"
24-// ヘッダのみのファイルをここでincludeしてチェックさせる
25-#include "../../cipher/FndAES.h"
26-#include "../FndAllocator.h"
27-#include "../FndArray.h"
28-#include "../FndAspect.h"
29-#include "../FndAspectMT.h"
30-#include "../FndAutoPtr.h"
31-#include "../FndAutoSingleton.h"
32-#include "../FndAVLTree.h"
33-#include "../FndLiberator.h"
34-#include "../FndList.h"
35-#include "../FndLonePtr.h"
36-#include "../FndOrderedTree.h"
37-#include "../FndQueue.h"
38-#include "../FndRange.h"
39-#include "../FndRedBlackTree.h"
40-#include "../FndRefPtr.h"
41-#include "../FndRegexOp.h"
42-#include "../FndScopedLock.h"
43-#include "../FndScopedPtr.h"
44-#include "../FndSealed.h"
45-#include "../FndSingleton.h"
46-#include "../FndSort.h"
47-#include "../FndVector.h"
48-#include "../../types/FndCollector.h"
49-#include "../../types/FndDelayVariable.h"
50-#include "../../types/FndExecutor.h"
51-#include "../../types/FndFuzzyVariable.h"
52-#include "../../types/FndLargeVariable.h"
53-#include "../../types/FndSyncObject.h"
54-#include "../../types/FndTypes.h"
55-#include "../../types/FndVLVariable.h"
56-#include "../../utility/FndDPI.h"
57-#include "../../utility/FndFlag.h"
58-#include "../../utility/FndRefCounter.h"
59-#include "../../utility/FndUID.h"
60-#include "../../utility/FndByteArrayIOStream.h"
61-#include "../../random/FndRandom.h"
62-#include <time.h>
63-#include "../../../iris_using.h"
64-#include "../../../iris_iostream.h"
65-
66-#if defined(_IRIS_SUPPORT_GOOGLETEST)
67-
68-//======================================================================
69-// include
70-#include "../../../unit/gt/gt_inchead.h"
71-#include <map>
72-
73-TEST(ContainerTest, Range)
74-{
75- typedef CRange<int> Range;
76- Range range0( 0, 100);
77- Range range1(100, 200);
78- Range range2(195, 300);
79-
80- {
81- typedef std::multimap<Range, int> MAP;
82- typedef std::pair<Range, int> PAIR;
83-
84- MAP map;
85- map.insert(PAIR(range0, 0));
86- map.insert(PAIR(range1, 1));
87- map.insert(PAIR(range2, 2));
88-
89- size_t cnt = map.count(Range(50, 150)); // マッチするキーの数取得
90- MAP::iterator it = map.find(Range(50, 150)); // 検索
91- ASSERT_TRUE( it != map.end() );
92- ASSERT_EQ( 2, cnt ); // マッチしたキーの個数をテスト
93- // 想定される value が取れているかのテスト
94- for( size_t i=0; i < cnt; ++i, ++it )
95- {
96- ASSERT_EQ( it->second, 0+i );
97- }
98- }
99-
100-#if defined(IRIS_MFC_VER)
101- {
102- typedef CMap<Range, Range&, int, int&> MAP;
103-
104- MAP map;
105- }
106-#endif
107-}
108-
109-TEST(ContainerTest, List)
110-{
111- typedef CListNode<int> myNode;
112- typedef CList<myNode> myList;
113- myList list;
114- int find = 0;
115- ASSERT_EQ( 0, list.size() );
116- ASSERT_EQ( TRUE, list.find(find) == nullptr );
117- myNode node[10];
118- for( int i=0; i < 10; ++i )
119- {
120- node[i].set(i);
121- list.push_back(node+i);
122- }
123- ASSERT_EQ( 10, list.size() );
124- ASSERT_EQ( 0, *(*list.find(find)) );
125-}
126-
127-TEST(ContainerTest, Queue)
128-{
129- typedef CDelayVariable<xf32> CF32Delay;
130- typedef CQueue<CF32Delay*, 32> myQueue;
131- myQueue queue;
132- CF32Delay d;
133- queue.push(&d);
134- ASSERT_FALSE( queue.empty() );
135- ASSERT_EQ( 32, queue.capacity() );
136- ASSERT_EQ( 1, queue.size() );
137- CF32Delay* g = queue.get(0);
138- queue.pop();
139- ASSERT_EQ( &d, g );
140-}
141-
142-#endif
143-
144-//======================================================================
145-// declare
146-static void __AspectTest(void);
147-static void __ArrayTest(void);
148-static void __AVLTreeTest(void);
149-static void __RedBlackTreeTest(void);
150-
151-//======================================================================
152-// typedef
153-typedef CDelayVariable<xf32> CF32Delay;
154-
155-//======================================================================
156-// test
157-IRIS_UNITTEST(Ctest_templateUnitTest, FndUnitTest)
158-{
159- typedef CListNode<int> Node;
160- typedef CList<Node> List;
161- typedef CFixedAllocator<List, 1> FixAlloc;
162- typedef CLonePtr<List, FixAlloc> Lone;
163- typedef CRefPtr<List> Ref;
164- CAutoPtr<int> aptr(new int);
165- CScopedPtr<int*> sptr(new int);
166-
167- __AspectTest();
168-
169- Lone lone = new List;
170- Ref ref = new List;
171-
172- {
173- typedef COrderedTreeNode<CF32Delay> OTreeNode;
174- typedef COrderedTree<OTreeNode> OTree;
175- CF32Delay d;
176- OTreeNode node(&d);
177- OTree tree;
178- tree.push_child(&node);
179- IRIS_ASSERT( !tree.empty() );
180- for( OTree::iterator it = tree.begin(); it != tree.end(); ++it )
181- {
182- }
183- tree.clear();
184- }
185-
186- __AVLTreeTest();
187- __RedBlackTreeTest();
188-
189- __ArrayTest();
190-}
191-
192-static void __AspectTest(void)
193-{
194- typedef CAspectual< CF32Delay*, CLogAspect<CF32Delay*> > CF32DelayAspect;
195- typedef CAspectual< CF32Delay*, CLogAspect<CF32Delay*, CLogAspect<CF32Delay*> > > CF32DelayAspect2;
196- CF32Delay d;
197- CF32DelayAspect da(&d);
198- CF32DelayAspect2 da2 = &d;
199- da->Update();
200- da2->Update();
201-}
202-
203-static void __ArrayTest(void)
204-{
205- typedef CArray<CF32Delay> Array;
206- typedef CRingArray<CF32Delay> RingArray;
207-
208- {
209- typedef CFixedArray<CF32Delay, 5> a1;
210- typedef CFixedArray<int, 5> b1;
211- int i=0;
212- a1 a;
213- i=0;
214- for( a1::iterator it = a.begin(), end = a.end(); it != end; ++it, ++i )
215- {
216- *it = XF32_ONE;
217- IRIS_ASSERT(*it == a[i]);
218- }
219- b1 b;
220- i=0;
221- for( b1::iterator it = b.begin(), end = b.end(); it != end; ++it, ++i )
222- {
223- *it = 0;
224- IRIS_ASSERT(*it == b[i]);
225- }
226- }
227- {
228- Array a(10);
229- Array b;
230- a[0] = XF32_ONE;
231- b = a;
232- b.resize(2);
233- Array::value_type x = b[1];
234- }
235- {
236- RingArray a(10);
237- RingArray b;
238- a[0] = XF32_ONE;
239- b = a;
240- b.resize(9);
241- IRIS_ASSERT( b[0] == b[9] );
242- }
243-}
244-
245-static void __AVLTreeTest(void)
246-{
247- printf("test AVL Tree.\n");
248- typedef CF32Delay AVLNodeType;
249- typedef CAVLTreeNode<AVLNodeType> AVLTreeNode;
250- typedef CAVLTree<AVLTreeNode> AVLTree;
251- AVLNodeType d1(XF32_ONE), d2(XF32_ZERO), d3(XF32_HALF);
252- AVLTreeNode node1(d1);
253- AVLTreeNode node2(d2);
254- AVLTreeNode node3(d3);
255- AVLTree tree;
256- tree.insert(&node1);
257- tree.insert(&node2);
258- tree.insert(&node3);
259- tree.print();
260- tree.erase(&node3);
261- tree.print();
262- tree.erase(&node2);
263- tree.print();
264-}
265-
266-static void __RedBlackTreeTest(void)
267-{
268-#ifdef WIN32
269- CRandom::GetInstance().Initialize((u32)time(nullptr));
270-#else
271- CRandom::GetInstance().Initialize(0);
272-#endif
273-
274- printf("test Red-Black Tree.\n");
275- typedef CRBTreeNode<CF32Delay> RBTreeNode;
276- typedef CRBTree<RBTreeNode> RBTree;
277-
278- const static int node_num = 7;
279- xf32 tbl[] = {
280- XF32_CONST(0.0f),
281- XF32_CONST(1.0f),
282- XF32_CONST(0.5f),
283- XF32_CONST(0.3f),
284- XF32_CONST(0.1f),
285- XF32_CONST(1.1f),
286- XF32_CONST(1.5f),
287- };
288- int tbl_num = sizeof(tbl)/sizeof(tbl[0]);
289- CF32Delay d[node_num];
290- RBTreeNode node[node_num];
291- RBTree tree;
292- for( int i=0; i < node_num; ++i )
293- {
294- d[i] = tbl[i%tbl_num];
295- node[i].set(d[i]);
296- tree.insert(&node[i]);
297-#ifdef _IRIS_DEBUG
298- tree.print();
299-#endif
300- }
301- for( int i=1; i < node_num; ++i )
302- {
303-#if 1
304- RBTree::value_ptr root = tree.root();
305- for(RBTree::iterator it = tree.begin(), end = tree.end(); it != end; ++it)
306- {
307- RBTree::iterator tmp = it;
308- ++tmp;
309- if( tmp != end )
310- {
311- --tmp;
312- IRIS_ASSERT( tmp == it );
313- }
314- if( it != root && it->m_Color == RBTreeNode::BLACK )
315- {
316- tree.erase(it);
317- tree.print();
318- break;
319- }
320- }
321-#else
322- int idx = RandS32() % node_num;
323- while( 1 )
324- {
325- if( tree.search(node[idx]) != nullptr )
326- {
327- printf( " -->>!! delete %0.8x.\n", (u32)(u32w64)&node[idx] );
328- tree.erase(&node[idx]);
329- tree.print();
330- break;
331- }
332- ++idx;
333- idx %= node_num;
334- }
335-#endif
336- }
337-}
338-
339-#endif // #if (defined(_IRIS_UNITTEST) || defined(_IRIS_MULTI_UNITTEST) )
--- trunk/framework/testsuite/cppcheck/check.bat (revision 276)
+++ trunk/framework/testsuite/cppcheck/check.bat (revision 277)
@@ -1,11 +1,24 @@
11 @echo off
22
3+pushd "%~dp0"
34 SET TARGETPATH=%~dp0/../../src
45
5-SET INC=-I %~dp0/../../src
6-rem SET EXCLUDE=-i/src/fnd/container/FndAllocator.h
7-SET DEFS=-D__cplusplus
8-SET OPTIONS=%DEFS% --template vs --enable=style,information --check-config %INC% %EXCLUDE%
6+SET VCINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC
7+rem SET INC=-I "%VCINSTALLDIR%\include" -I "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v5.0\include"
8+
9+SET INC=-I %~dp0/../../src %INC%
10+rem SET EXCLUDE=-i"%VCINSTALLDIR%\include" -i"%ProgramFiles(x86)%\Microsoft SDKs\Windows\v5.0\include"
11+rem SET DEFS=-D__cplusplus
12+rem SET UNDEFS=-U_IRIS_DEBUGTEST_ENABLE -U_IRIS_MULTI_UNITTEST -U_IRIS_SUPPORT_MULTI_UNITTEST_GUI -U_IRIS_FPU_INLINE
13+rem SET UNDEFS=%UNDEFS% -U_IRIS_XFPU_INLINE -U_IRIS_DX_RIGHTHAND -U_IRIS_SUPPORT_SAFE_ISTREAM -U_IRIS_SUPPORT_DCAST_DYNAMIC
14+rem SET UNDEFS=%UNDEFS% -U_IRIS_SUPPORT_OPENAL -U_IRIS_SUPPORT_OGGVORBIS -U_IRIS_SUPPORT_GLUT -U_IRIS_SUPPORT_GLEW
15+rem SET UNDEFS=%UNDEFS% -U_IRIS_SUPPORT_GLEXT -U_IRIS_SUPPORT_CG -U_IRIS_SUPPORT_FBX -U_IRIS_SUPPORT_PNG -U_IRIS_SUPPORT_SQUIRREL
16+rem SET UNDEFS=%UNDEFS% -U_IRIS_SUPPORT_GOOGLETEST -U_IRIS_SUPPORT_MSXML -U_IRIS_SUPPORT_OPENCV=IRIS_DYNAMIC_LIB -U_IRIS_SUPPORT_WDK
17+rem SET UNDEFS=%UNDEFS% -U_IRIS_SUPPORT_LUA -U_IRIS_SUPPORT_ANGELSCRIPT
18+SET SUPPRESS=--inline-suppr
19+rem SET CHECKCONFING=--check-config
20+SET BUILDOPTIONS=%DEFS% %UNDEFS% %CHECKCONFING% --platform=win32A %INC% %EXCLUDE%
21+SET OPTIONS=--template vs -f --enable=all %SUPPRESS% %BUILDOPTIONS%
922 rem SET OPTIONS=--template vs --enable=all
1023 rem SET OPTIONS=
1124
@@ -15,8 +28,10 @@
1528
1629 rem 全部やる場合はこっち
1730 @echo %OPTIONS%
18-call cppcheck %OPTIONS% --xml "%TARGETPATH%" 2> result.xml
31+cd "%TARGETPATH%"
32+call cppcheck %OPTIONS% -v --xml --report-progress ./ 2> "%~dp0\result.xml"
1933 if errorlevel 1 goto error
34+popd
2035
2136 call add_xsl.bat result.xml
2237 if errorlevel 1 goto error
@@ -28,8 +43,10 @@
2843
2944 :error
3045 pause
46+popd
3147 exit /b 1
3248
3349 :end
50+popd
3451 exit /b 0
3552
Show on old repository browser