浏览代码

Even more warnings

Thomas Buck 10 年前
父节点
当前提交
4e66f79da7
共有 16 个文件被更改,包括 63 次插入57 次删除
  1. 0
    2
      ChangeLog
  2. 18
    11
      Makefile
  3. 3
    0
      include/Emitter.h
  4. 6
    1
      include/List.h
  5. 6
    1
      include/Map.h
  6. 12
    3
      include/MatMath.h
  7. 1
    0
      src/Camera.cpp
  8. 1
    1
      src/Emitter.cpp
  9. 1
    30
      src/MatMath.cpp
  10. 1
    1
      src/Texture.cpp
  11. 1
    1
      src/TombRaider.cpp
  12. 1
    1
      src/ViewVolume.cpp
  13. 6
    1
      src/World.cpp
  14. 3
    1
      src/tga.cpp
  15. 1
    1
      test/TombRaider.cpp
  16. 2
    2
      test/tga.cpp

+ 0
- 2
ChangeLog 查看文件

8
 	[ 20140117 ]
8
 	[ 20140117 ]
9
 	* Now using C++11 standard.
9
 	* Now using C++11 standard.
10
 	* Turned on many more warnings and silenced some of them.
10
 	* Turned on many more warnings and silenced some of them.
11
-	  There are a lot of unused parameters, so this warning is still turned
12
-	  off.
13
 	* Removed empty Quaternion Unit Test
11
 	* Removed empty Quaternion Unit Test
14
 
12
 
15
 	[ 20140111 ]
13
 	[ 20140111 ]

+ 18
- 11
Makefile 查看文件

91
 
91
 
92
 ###############################################################
92
 ###############################################################
93
 CC=gcc
93
 CC=gcc
94
-WARNINGS=-std=c++11 -Wall -Wextra -pedantic -Wno-unused-parameter
94
+WARNINGS=-Wno-padded -Wno-packed -Wno-documentation
95
+WARNINGS+=-Wno-documentation-unknown-command -Wno-format-nonliteral
96
+WARNINGS+=-Wno-covered-switch-default -Wno-global-constructors
97
+WARNINGS+=-Wno-exit-time-destructors
95
 
98
 
96
-BASE_CFLAGS=$(WARNINGS) $(BASE_DEFS) \
99
+WARNINGS+=-Wno-conversion -Wno-sign-conversion -Wno-shorten-64-to-32
100
+
101
+FLAGS_ALL=-std=c++11 -Weverything $(WARNINGS)
102
+
103
+BASE_CFLAGS=$(FLAGS_ALL) $(BASE_DEFS) \
97
 	-DVERSION=\"\\\"$(NAME)-$(VERSION)-$(BUILD_ID)\\\"\" \
104
 	-DVERSION=\"\\\"$(NAME)-$(VERSION)-$(BUILD_ID)\\\"\" \
98
 	-DBUILD_HOST=\"\\\"$(BUILD_HOST)\\\"\"
105
 	-DBUILD_HOST=\"\\\"$(BUILD_HOST)\\\"\"
99
 
106
 
183
 	$(BUILDDIR)/GLString.o \
190
 	$(BUILDDIR)/GLString.o \
184
 	$(BUILDDIR)/MatMath.o \
191
 	$(BUILDDIR)/MatMath.o \
185
 	$(BUILDDIR)/Matrix.o \
192
 	$(BUILDDIR)/Matrix.o \
186
-	$(BUILDDIR)/tga.o \
187
 	$(BUILDDIR)/Network.o \
193
 	$(BUILDDIR)/Network.o \
188
 	$(BUILDDIR)/OpenGLMesh.o \
194
 	$(BUILDDIR)/OpenGLMesh.o \
189
 	$(BUILDDIR)/OpenRaider.o \
195
 	$(BUILDDIR)/OpenRaider.o \
195
 	$(BUILDDIR)/Sound.o \
201
 	$(BUILDDIR)/Sound.o \
196
 	$(BUILDDIR)/System.o \
202
 	$(BUILDDIR)/System.o \
197
 	$(BUILDDIR)/Texture.o \
203
 	$(BUILDDIR)/Texture.o \
204
+	$(BUILDDIR)/TGA.o \
198
 	$(BUILDDIR)/TombRaider.o \
205
 	$(BUILDDIR)/TombRaider.o \
199
 	$(BUILDDIR)/Vector3d.o \
206
 	$(BUILDDIR)/Vector3d.o \
200
 	$(BUILDDIR)/ViewVolume.o \
207
 	$(BUILDDIR)/ViewVolume.o \
277
 #################################################################
284
 #################################################################
278
 # Unit Test builds
285
 # Unit Test builds
279
 #################################################################
286
 #################################################################
280
-TEST_FLAGS=$(WARNINGS) -g -O0 -DDEBUG -lstdc++ -Iinclude
287
+TEST_FLAGS=$(FLAGS_ALL) -g -O0 -DDEBUG -lstdc++ -Iinclude
281
 
288
 
282
 TEST_MAP_TR5=~/.OpenRaider/paks/tr5/demo.trc
289
 TEST_MAP_TR5=~/.OpenRaider/paks/tr5/demo.trc
283
 TEST_MAP_TR4=~/.OpenRaider/paks/tr4/angkor1.tr4
290
 TEST_MAP_TR4=~/.OpenRaider/paks/tr4/angkor1.tr4
322
 
329
 
323
 TombRaider.test:
330
 TombRaider.test:
324
 	@-mkdir -p $(BUILD_TEST_DIR)
331
 	@-mkdir -p $(BUILD_TEST_DIR)
325
-	$(CC) $(WARNINGS) -Iinclude $(TR_FLAGS) -o $(BUILD_TEST_DIR)/TombRaiderTest.o -c test/TombRaider.cpp
332
+	$(CC) $(FLAGS_ALL) -Iinclude $(TR_FLAGS) -o $(BUILD_TEST_DIR)/TombRaiderTest.o -c test/TombRaider.cpp
326
 	$(MAKE) targets NAME=TombRaider.test BUILDDIR=$(BUILD_TEST_DIR) \
333
 	$(MAKE) targets NAME=TombRaider.test BUILDDIR=$(BUILD_TEST_DIR) \
327
-	OBJS="$(BUILD_TEST_DIR)/TombRaiderTest.o $(BUILD_TEST_DIR)/TombRaider.o $(BUILD_TEST_DIR)/tga.o $(BUILD_TEST_DIR)/memory_test.o" \
334
+	OBJS="$(BUILD_TEST_DIR)/TombRaiderTest.o $(BUILD_TEST_DIR)/TombRaider.o $(BUILD_TEST_DIR)/TGA.o $(BUILD_TEST_DIR)/memory_test.o" \
328
 	CFLAGS="$(BASE_CFLAGS) -g $(TR_FLAGS)" \
335
 	CFLAGS="$(BASE_CFLAGS) -g $(TR_FLAGS)" \
329
 	LD_FLAGS="-lz -lstdc++"
336
 	LD_FLAGS="-lz -lstdc++"
330
 
337
 
332
 
339
 
333
 GLString.test:
340
 GLString.test:
334
 	mkdir -p $(BUILD_TEST_DIR)
341
 	mkdir -p $(BUILD_TEST_DIR)
335
-	$(CC) $(WARNINGS) -Iinclude -DHAVE_SDL_TTF -DHAVE_SDL \
342
+	$(CC) $(FLAGS_ALL) -Iinclude -DHAVE_SDL_TTF -DHAVE_SDL \
336
 	$(shell sdl-config --cflags) $(shell sdl-config --libs) \
343
 	$(shell sdl-config --cflags) $(shell sdl-config --libs) \
337
 	$(GL_LIBS) $(GL_DEFS) -lSDL_ttf -lm -lstdc++ \
344
 	$(GL_LIBS) $(GL_DEFS) -lSDL_ttf -lm -lstdc++ \
338
 	src/Texture.cpp src/GLString.cpp \
345
 	src/Texture.cpp src/GLString.cpp \
343
 Matrix.test:
350
 Matrix.test:
344
 	@-echo "Building Matrix unit test"
351
 	@-echo "Building Matrix unit test"
345
 	mkdir -p $(BUILD_TEST_DIR)
352
 	mkdir -p $(BUILD_TEST_DIR)
346
-	$(CC) $(WARNINGS) -g -lm -lstdc++ -Iinclude \
353
+	$(CC) $(FLAGS_ALL) -g -lm -lstdc++ -Iinclude \
347
 	src/Matrix.cpp src/Quaternion.cpp src/Vector3d.cpp \
354
 	src/Matrix.cpp src/Quaternion.cpp src/Vector3d.cpp \
348
 	test/Matrix.cpp -o $(BUILD_TEST_DIR)/Matrix.test
355
 	test/Matrix.cpp -o $(BUILD_TEST_DIR)/Matrix.test
349
 
356
 
350
 Math.test:
357
 Math.test:
351
 	@-echo "Building Math unit test"
358
 	@-echo "Building Math unit test"
352
 	mkdir -p $(BUILD_TEST_DIR)
359
 	mkdir -p $(BUILD_TEST_DIR)
353
-	$(CC) $(WARNINGS) -g -lm -lstdc++ -Iinclude \
360
+	$(CC) $(FLAGS_ALL) -g -lm -lstdc++ -Iinclude \
354
 	src/MatMath.cpp src/Vector3d.cpp test/MatMath.cpp -o $(BUILD_TEST_DIR)/Math.test
361
 	src/MatMath.cpp src/Vector3d.cpp test/MatMath.cpp -o $(BUILD_TEST_DIR)/Math.test
355
 
362
 
356
 #################################################################
363
 #################################################################
357
 
364
 
358
 Memory.test:
365
 Memory.test:
359
 	mkdir -p $(BUILD_TEST_DIR)
366
 	mkdir -p $(BUILD_TEST_DIR)
360
-	$(CC) $(WARNINGS) -g -lstdc++ -Iinclude \
367
+	$(CC) $(FLAGS_ALL) -g -lstdc++ -Iinclude \
361
 	-DDEBUG_MEMORY -DDEBUG_MEMORY_ERROR \
368
 	-DDEBUG_MEMORY -DDEBUG_MEMORY_ERROR \
362
 	src/memory_test.cpp test/memory_test.cpp -o $(BUILD_TEST_DIR)/memory_test.test
369
 	src/memory_test.cpp test/memory_test.cpp -o $(BUILD_TEST_DIR)/memory_test.test
363
 
370
 
381
 TGA.test:
388
 TGA.test:
382
 	mkdir -p $(BUILD_TEST_DIR)
389
 	mkdir -p $(BUILD_TEST_DIR)
383
 	$(CC) $(TEST_FLAGS) \
390
 	$(CC) $(TEST_FLAGS) \
384
-		src/tga.cpp test/tga.cpp -o $(BUILD_TEST_DIR)/TGA.test
391
+		src/TGA.cpp test/TGA.cpp -o $(BUILD_TEST_DIR)/TGA.test
385
 
392
 
386
 #################################################################
393
 #################################################################
387
 
394
 

+ 3
- 0
include/Emitter.h 查看文件

273
 
273
 
274
  private:
274
  private:
275
 
275
 
276
+    static int compareParticleDist(const void *voidA, const void *voidB);
277
+
278
+
276
 	char *_name;              /* Emitter name */
279
 	char *_name;              /* Emitter name */
277
 
280
 
278
 	unsigned int _flags;      /* Emitter flags */
281
 	unsigned int _flags;      /* Emitter flags */

+ 6
- 1
include/List.h 查看文件

337
     _cache = _head;
337
     _cache = _head;
338
   }
338
   }
339
 
339
 
340
-  bool operator ++ (int dummy)
340
+  bool operator ++ (int)
341
+  {
342
+    return Next();
343
+  }
344
+
345
+  bool operator ++ ()
341
   {
346
   {
342
     return Next();
347
     return Next();
343
   }
348
   }

+ 6
- 1
include/Map.h 查看文件

498
 	}
498
 	}
499
 
499
 
500
 
500
 
501
-	bool operator ++ (int dummy)
501
+	bool operator ++ (int)
502
+	{
503
+		return Next();
504
+	}
505
+
506
+    bool operator ++ ()
502
 	{
507
 	{
503
 		return Next();
508
 		return Next();
504
 	}
509
 	}

+ 12
- 3
include/MatMath.h 查看文件

27
 typedef vec_t matrix_t[16]; //!< Used as _Column_major_ in every class now!
27
 typedef vec_t matrix_t[16]; //!< Used as _Column_major_ in every class now!
28
 
28
 
29
 /*!
29
 /*!
30
+ * \fixme Add Documentation or remove, as it is unused?
31
+ */
32
+vec_t helIntersectionOfAbstractSpheres(vec3_t centerA, vec_t radiusA, vec3_t centerB, vec_t radiusB);
33
+
34
+/*!
35
+ * \fixme Add Documentation or remove, as it is unused?
36
+ */
37
+int helIntersectionOfAbstractSphereAndLine(vec3_t center, vec_t radius, vec3_t posA, vec3_t posB, vec3_t intersectionA, vec3_t intersectionB);
38
+
39
+/*!
30
  * \brief Calculate Intersection of a line and a polygon
40
  * \brief Calculate Intersection of a line and a polygon
31
  * \param intersect Where the intersection is stored, if it exists
41
  * \param intersect Where the intersection is stored, if it exists
32
  * \param p1 First point of line segment
42
  * \param p1 First point of line segment
33
  * \param p2 Second point of line segment
43
  * \param p2 Second point of line segment
34
- * \param vertexCount number of vertices in polygon
35
- * \param polygon polygon vertex array
44
+ * \param polygon polygon vertex array (0 to 2 are used)
36
  * \returns 0 if there is no intersection
45
  * \returns 0 if there is no intersection
37
  */
46
  */
38
-int helIntersectionLineAndPolygon(vec3_t intersect, vec3_t p1, vec3_t p2, unsigned int vertexCount, vec3_t *polygon);
47
+int helIntersectionLineAndPolygon(vec3_t intersect, vec3_t p1, vec3_t p2, vec3_t *polygon);
39
 
48
 
40
 /*!
49
 /*!
41
  * \brief Calculate the distance from a sphere to a plane
50
  * \brief Calculate the distance from a sphere to a plane

+ 1
- 0
src/Camera.cpp 查看文件

306
   case CAMERA_SPEED_DOWN:
306
   case CAMERA_SPEED_DOWN:
307
     if (--mTranslateDelta < 0.0)
307
     if (--mTranslateDelta < 0.0)
308
       mTranslateDelta = 1.0;
308
       mTranslateDelta = 1.0;
309
+    break;
309
   default:
310
   default:
310
     ;
311
     ;
311
   }
312
   }

+ 1
- 1
src/Emitter.cpp 查看文件

39
 vec_t Emitter::mFrustum[6][4];
39
 vec_t Emitter::mFrustum[6][4];
40
 
40
 
41
 
41
 
42
-int compareParticleDist(const void *voidA, const void *voidB)
42
+int Emitter::compareParticleDist(const void *voidA, const void *voidB)
43
 {
43
 {
44
 	Particle *a = (Particle *)voidA, *b = (Particle *)voidB;
44
 	Particle *a = (Particle *)voidA, *b = (Particle *)voidB;
45
 	float x, y, z, distA, distB;
45
 	float x, y, z, distA, distB;

+ 1
- 30
src/MatMath.cpp 查看文件

13
 #include <Vector3d.h>
13
 #include <Vector3d.h>
14
 #include <Matrix.h>
14
 #include <Matrix.h>
15
 
15
 
16
-bool tmpHelSphereIntersectLine(Vector3d pos, Vector3d lastPos,
17
-										 Vector3d center, vec_t radius)
18
-{
19
-	Vector3d seg, segToCenter, delta;
20
-	vec_t s, dSquare;
21
-
22
-
23
-	seg = pos - lastPos;
24
-	segToCenter = center - lastPos;
25
-
26
-	s = seg * segToCenter;
27
-
28
-	if (s >= 1.0f || s <= 0.0f)
29
-		return false;
30
-
31
-	seg.normalize();
32
-	seg = seg * s;
33
-	seg = seg + lastPos;
34
-
35
-	delta = seg - center;
36
-
37
-	dSquare = delta * delta;
38
-
39
-	if (radius >= dSquare)
40
-		return true;
41
-	else
42
-		return false;
43
-}
44
-
45
 
16
 
46
 vec_t helIntersectionOfAbstractSpheres(vec3_t centerA, vec_t radiusA,
17
 vec_t helIntersectionOfAbstractSpheres(vec3_t centerA, vec_t radiusA,
47
 													vec3_t centerB, vec_t radiusB)
18
 													vec3_t centerB, vec_t radiusB)
128
 
99
 
129
 int helIntersectionLineAndPolygon(vec3_t intersect,
100
 int helIntersectionLineAndPolygon(vec3_t intersect,
130
 											 vec3_t p1, vec3_t p2,
101
 											 vec3_t p1, vec3_t p2,
131
-											 unsigned int vertexCount, vec3_t *polygon)
102
+											 vec3_t *polygon)
132
 {
103
 {
133
 	//	vec3_t normal, a, b;
104
 	//	vec3_t normal, a, b;
134
 	Vector3d a, b, normal, pA, pB;
105
 	Vector3d a, b, normal, pA, pB;

+ 1
- 1
src/Texture.cpp 查看文件

38
 #endif
38
 #endif
39
 
39
 
40
 #ifdef USING_TGA
40
 #ifdef USING_TGA
41
-#include <tga.h>
41
+#include <TGA.h>
42
 #endif
42
 #endif
43
 
43
 
44
 #ifdef USING_PNG
44
 #ifdef USING_PNG

+ 1
- 1
src/TombRaider.cpp 查看文件

59
 #endif
59
 #endif
60
 
60
 
61
 #ifdef __TEST_TR5_DUMP_TGA
61
 #ifdef __TEST_TR5_DUMP_TGA
62
-#include <tga.h>
62
+#include <TGA.h>
63
 #endif
63
 #endif
64
 
64
 
65
 #ifdef DEBUG_MEMORY
65
 #ifdef DEBUG_MEMORY

+ 1
- 1
src/ViewVolume.cpp 查看文件

159
 														vec_t radius)
159
 														vec_t radius)
160
 {
160
 {
161
    unsigned int p;
161
    unsigned int p;
162
-   vec_t d;
162
+   vec_t d = 0.0;
163
 
163
 
164
    for (p = 0; p < 6; ++p)
164
    for (p = 0; p < 6; ++p)
165
    {
165
    {

+ 6
- 1
src/World.cpp 查看文件

127
 			if (!portal)
127
 			if (!portal)
128
 				continue;
128
 				continue;
129
 
129
 
130
-			if (helIntersectionLineAndPolygon(intersect, p1, p2, 4,
130
+			if (helIntersectionLineAndPolygon(intersect, p1, p2, // 4,
131
 														 portal->vertices))
131
 														 portal->vertices))
132
 			{
132
 			{
133
 				return portal->adjoining_room;
133
 				return portal->adjoining_room;
431
 	case worldMoveType_walk:
431
 	case worldMoveType_walk:
432
 		pitch = 0.0f;  // in the future pitch could control jump up blocks here
432
 		pitch = 0.0f;  // in the future pitch could control jump up blocks here
433
 		break;
433
 		break;
434
+
435
+    case worldMoveType_noClipping:
436
+    case worldMoveType_fly:
437
+    case worldMoveType_swim:
434
 	default:
438
 	default:
435
 		pitch = e->angles[2];
439
 		pitch = e->angles[2];
440
+        break;
436
 	}
441
 	}
437
 
442
 
438
 	switch (movement)
443
 	switch (movement)

+ 3
- 1
src/tga.cpp 查看文件

27
 #include <string.h>
27
 #include <string.h>
28
 #include <stdarg.h>
28
 #include <stdarg.h>
29
 
29
 
30
-#include <tga.h>
30
+#include <TGA.h>
31
 
31
 
32
 #ifdef DEBUG_MEMORY
32
 #ifdef DEBUG_MEMORY
33
 #include <memory_test.h>
33
 #include <memory_test.h>
391
   case 4:
391
   case 4:
392
     header.image_type = TGA_TYPE__COLOR;
392
     header.image_type = TGA_TYPE__COLOR;
393
     header.desc_flags = 32;
393
     header.desc_flags = 32;
394
+    header.bpp = 32;
395
+    break;
394
   case 2:
396
   case 2:
395
     header.bpp = 32;
397
     header.bpp = 32;
396
     break;
398
     break;

+ 1
- 1
test/TombRaider.cpp 查看文件

53
 #include <TombRaider.h>
53
 #include <TombRaider.h>
54
 
54
 
55
 #ifdef __TEST_TR5_DUMP_TGA
55
 #ifdef __TEST_TR5_DUMP_TGA
56
-#include <tga.h>
56
+#include <TGA.h>
57
 #endif
57
 #endif
58
 
58
 
59
 #ifdef DEBUG_MEMORY
59
 #ifdef DEBUG_MEMORY

+ 2
- 2
test/tga.cpp 查看文件

1
 /*!
1
 /*!
2
- * \file test/tga.cpp
2
+ * \file test/TGA.cpp
3
  * \brief The TGA reader Unit Test
3
  * \brief The TGA reader Unit Test
4
  *
4
  *
5
  * \author xythobuz
5
  * \author xythobuz
6
  */
6
  */
7
 #include <stdio.h>
7
 #include <stdio.h>
8
 #include <stdlib.h>
8
 #include <stdlib.h>
9
-#include <tga.h>
9
+#include <TGA.h>
10
 #include "greatest.h"
10
 #include "greatest.h"
11
 
11
 
12
 //! \todo generate list?
12
 //! \todo generate list?

正在加载...
取消
保存