Quellcode durchsuchen

Using C++11, more warnings

Thomas Buck vor 10 Jahren
Ursprung
Commit
f09dfbe486
8 geänderte Dateien mit 23 neuen und 16 gelöschten Zeilen
  1. 6
    0
      ChangeLog
  2. 9
    8
      Makefile
  3. 1
    1
      include/BoundingVolume.h
  4. 1
    1
      include/OpenRaider.h
  5. 1
    1
      include/System.h
  6. 3
    3
      src/memory_test.cpp
  7. 1
    1
      test/TombRaider.cpp
  8. 1
    1
      test/greatest.h

+ 6
- 0
ChangeLog Datei anzeigen

@@ -5,6 +5,12 @@
5 5
 
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8
+	[ 20140117 ]
9
+	* Now using C++11 standard.
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
+
8 14
 	[ 20140111 ]
9 15
 	* Rewrote GLString Unit Test, now using TTF Font
10 16
 	* Removed included TGA font and loading code

+ 9
- 8
Makefile Datei anzeigen

@@ -91,8 +91,9 @@ INSTALL_INCLUDE=$(DESTDIR)/usr/include
91 91
 
92 92
 ###############################################################
93 93
 CC=gcc
94
+WARNINGS=-std=c++11 -Wall -Wextra -pedantic -Wno-unused-parameter
94 95
 
95
-BASE_CFLAGS=-Wall $(BASE_DEFS) \
96
+BASE_CFLAGS=$(WARNINGS) $(BASE_DEFS) \
96 97
 	-DVERSION=\"\\\"$(NAME)-$(VERSION)-$(BUILD_ID)\\\"\" \
97 98
 	-DBUILD_HOST=\"\\\"$(BUILD_HOST)\\\"\"
98 99
 
@@ -275,7 +276,7 @@ endif
275 276
 #################################################################
276 277
 # Unit Test builds
277 278
 #################################################################
278
-TEST_FLAGS=-Wall -g -O0 -DDEBUG -lstdc++ -Iinclude
279
+TEST_FLAGS=$(WARNINGS) -g -O0 -DDEBUG -lstdc++ -Iinclude
279 280
 
280 281
 TEST_MAP_TR5=~/projects/Data/models/tombraider/tr5/demo.trc
281 282
 TEST_MAP_TR4=~/projects/Data/models/tombraider/tr4/angkor1.tr4
@@ -295,7 +296,7 @@ TR_FLAGS = -D__TEST_TR5_DUMP_TGA -D__TEST_32BIT_TEXTILES -DDEBUG_MEMORY
295 296
 
296 297
 TombRaider.test:
297 298
 	@-mkdir -p $(BUILD_TEST_DIR)
298
-	$(CC) -Wall -Iinclude $(TR_FLAGS) -o $(BUILD_TEST_DIR)/TombRaiderTest.o -c test/TombRaider.cpp
299
+	$(CC) $(WARNINGS) -Iinclude $(TR_FLAGS) -o $(BUILD_TEST_DIR)/TombRaiderTest.o -c test/TombRaider.cpp
299 300
 	$(MAKE) targets NAME=TombRaider.test BUILDDIR=$(BUILD_TEST_DIR) \
300 301
 	OBJS="$(BUILD_TEST_DIR)/TombRaiderTest.o $(BUILD_TEST_DIR)/TombRaider.o $(BUILD_TEST_DIR)/tga.o $(BUILD_TEST_DIR)/memory_test.o" \
301 302
 	CFLAGS="$(BASE_CFLAGS) -g $(TR_FLAGS)" \
@@ -305,7 +306,7 @@ TombRaider.test:
305 306
 
306 307
 GLString.test:
307 308
 	mkdir -p $(BUILD_TEST_DIR)
308
-	$(CC) -Wall -Iinclude -DHAVE_SDL_TTF -DHAVE_SDL \
309
+	$(CC) $(WARNINGS) -Iinclude -DHAVE_SDL_TTF -DHAVE_SDL \
309 310
 	$(shell sdl-config --cflags) $(shell sdl-config --libs) \
310 311
 	$(GL_LIBS) $(GL_DEFS) -lSDL_ttf -lm -lstdc++ \
311 312
 	src/Texture.cpp src/GLString.cpp \
@@ -327,27 +328,27 @@ Hel.test: Quaternion.test Matrix.test Math.test
327 328
 Matrix.test:
328 329
 	@-echo "Building Matrix unit test"
329 330
 	mkdir -p $(BUILD_TEST_DIR)
330
-	$(CC) -Wall -g -lm -lstdc++ -Iinclude \
331
+	$(CC) $(WARNINGS) -g -lm -lstdc++ -Iinclude \
331 332
 	src/Matrix.cpp src/Quaternion.cpp src/Vector3d.cpp \
332 333
 	test/Matrix.cpp -o $(BUILD_TEST_DIR)/Matrix.test
333 334
 
334 335
 Quaternion.test:
335 336
 	@-echo "Building Quaternion unit test"
336 337
 	mkdir -p $(BUILD_TEST_DIR)
337
-	$(CC) -Wall -g -lm -lstdc++ -Iinclude \
338
+	$(CC) $(WARNINGS) -g -lm -lstdc++ -Iinclude \
338 339
 	src/Quaternion.cpp test/Quaternion.cpp -o $(BUILD_TEST_DIR)/Quaternion.test
339 340
 
340 341
 Math.test:
341 342
 	@-echo "Building Math unit test"
342 343
 	mkdir -p $(BUILD_TEST_DIR)
343
-	$(CC) -Wall -g -lm -lstdc++ -Iinclude \
344
+	$(CC) $(WARNINGS) -g -lm -lstdc++ -Iinclude \
344 345
 	src/MatMath.cpp src/Vector3d.cpp test/MatMath.cpp -o $(BUILD_TEST_DIR)/Math.test
345 346
 
346 347
 #################################################################
347 348
 
348 349
 Memory.test:
349 350
 	mkdir -p $(BUILD_TEST_DIR)
350
-	$(CC) -Wall -g -lstdc++ -Iinclude \
351
+	$(CC) $(WARNINGS) -g -lstdc++ -Iinclude \
351 352
 	-DDEBUG_MEMORY -DDEBUG_MEMORY_ERROR \
352 353
 	src/memory_test.cpp test/memory_test.cpp -o $(BUILD_TEST_DIR)/memory_test.test
353 354
 

+ 1
- 1
include/BoundingVolume.h Datei anzeigen

@@ -70,7 +70,7 @@ class BoundingVolume
70 70
 
71 71
 	BoundingSphere mSphere;    /* Bounding sphere of this volume */
72 72
 
73
-	BoundingBox mBox;;         /* Bounding box of this volume */
73
+	BoundingBox mBox;          /* Bounding box of this volume */
74 74
 
75 75
  private:
76 76
 

+ 1
- 1
include/OpenRaider.h Datei anzeigen

@@ -66,7 +66,7 @@ typedef enum
66 66
 	OpenRaider_DumpTexture  =  16,
67 67
 	OpenRaider_FullScreen   =  32,
68 68
 	OpenRaider_Loading      =  64,
69
-	OpenRaider_GameRunning  = 128,
69
+	OpenRaider_GameRunning  = 128
70 70
 
71 71
 } OpenRaiderFlags;
72 72
 

+ 1
- 1
include/System.h Datei anzeigen

@@ -47,7 +47,7 @@ typedef enum {
47 47
     SYS_MOD_KEY_LALT   = 16,
48 48
     SYS_MOD_KEY_RALT   = 32,
49 49
     SYS_MOD_KEY_LMETA  = 64,
50
-    SYS_MOD_KEY_RMETA  = 128,
50
+    SYS_MOD_KEY_RMETA  = 128
51 51
 } sdl_sys_mod_key_t;
52 52
 
53 53
 /*!

+ 3
- 3
src/memory_test.cpp Datei anzeigen

@@ -1122,7 +1122,7 @@ void *operator new(size_t size, const char *file, int line)
1122 1122
 
1123 1123
 	add_track((DWORD)ptr, size, file, line);
1124 1124
 	return ptr;
1125
-};
1125
+}
1126 1126
 
1127 1127
 
1128 1128
 void *operator new [](size_t size, const char *file, int line)
@@ -1171,13 +1171,13 @@ void operator delete(void *p)
1171 1171
 {
1172 1172
 	remove_track((DWORD)p);
1173 1173
 	free(p);
1174
-};
1174
+}
1175 1175
 
1176 1176
 
1177 1177
 void operator delete [](void *p)
1178 1178
 {
1179 1179
 	remove_track((DWORD)p);
1180 1180
 	free(p);
1181
-};
1181
+}
1182 1182
 #endif
1183 1183
 

+ 1
- 1
test/TombRaider.cpp Datei anzeigen

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

+ 1
- 1
test/greatest.h Datei anzeigen

@@ -21,7 +21,7 @@
21 21
 #define GREATEST_H
22 22
 
23 23
 #ifdef __cplusplus
24
-#define __STDC_VERSION__ 19901L // C++ compilers support var args
24
+#define __STDC_VERSION__ 19901L // C++11 compilers support var args
25 25
 extern "C"
26 26
 {
27 27
 #endif

Laden…
Abbrechen
Speichern