View Issue Details

IDProjectCategoryView StatusLast Update
0002894FSSCPBuild systempublic2020-04-13 19:19
ReporterFirewave Assigned Tochief1983  
PrioritynormalSeverityminorReproducibilityN/A
Status resolvedResolutionfixed 
Product Version3.7.0 RC2 
Summary0002894: Compiler warning fixes for clang
DescriptionI got the 3.7.0 RC2 source code and compiled it with clang 3.3 on ubuntu 13.04. Most of the warnings are fixed by the attached patch.

Some notes:
- the void casting is done to get rid of "set, but not read" warning about variables, that are only being used in conditional code like Assert() or mprintf(), that is not being called in an NDEBUG build
- code/graphics/2d.cpp <-- there's a bug, that it didn't use the actual mode, that could be changed by the parameters
- code/hud/hud.{cpp|h} <--- that was missing the virtual destructor in the base object, which can cause problems with polymorphic objects
- code/ai/aibig.cpp <-- it might be possible, that code where I disabled the priority1 and priority2 variables can be removed alltogether

I will add an additional report for the remaining warnings.
TagsNo tags attached.

Relationships

related to 0002895 resolvedchief1983 clang compiler warnings 

Activities

Firewave

2013-06-29 12:36

reporter  

scp_clang_fixes.diff (55,416 bytes)   
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aibig.cpp C:\temp\fs2_open_3_7_0_RC2/code/ai/aibig.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aibig.cpp	2013-01-27 11:28:35.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/ai/aibig.cpp	2013-06-28 22:39:05.000000000 +0200
@@ -712,21 +712,22 @@
 
 			if (tswp->num_secondary_banks > 0) {
 
-				int	priority1, priority2;
+				//int	priority1, priority2;
 
-				priority1 = -1;
-				priority2 = -1;
+				//priority1 = -1;
+				//priority2 = -1;
 
 				//	Maybe favor selecting a bomb.
 				//	Note, if you're firing a bomb, if it's aspect seeking, the firing conditions can be looser.
 				if (Ship_info[Ships[En_objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP))
-					if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f)		//	Don't select a bomb if enemy moving fast relative to distance
-						priority1 = WIF_BOMB;
+					if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f) {		//	Don't select a bomb if enemy moving fast relative to distance
+						//priority1 = WIF_BOMB;
+					}
 
 				if (!(En_objp->flags & OF_PROTECTED) || (aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP))) {
 					//ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2);	//	Note, need to select to get weapon speed and lifetime
 					if(aip->goals[0].ai_mode & (AI_GOAL_DISABLE_SHIP | AI_GOAL_DISARM_SHIP)) {
-						priority1 = WIF_PUNCTURE;
+						//priority1 = WIF_PUNCTURE;
 					}
 					ai_choose_secondary_weapon(Pl_objp, aip, En_objp);
 					int current_bank = tswp->current_secondary_bank;
@@ -1224,10 +1225,9 @@
 			aip->submode = AIS_STRAFE_RETREAT1;
 			aip->submode_start_time = Missiontime;
 
-			float box_dist;
 			int is_inside;
 			vec3d goal_point;
-			box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
+			get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST);
 
 			// set goal point
 			aip->goal_point = goal_point;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aicode.cpp C:\temp\fs2_open_3_7_0_RC2/code/ai/aicode.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aicode.cpp	2013-02-22 07:13:37.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/ai/aicode.cpp	2013-06-28 23:02:17.000000000 +0200
@@ -973,6 +973,7 @@
 	Assert(stealth_objp->type == OBJ_SHIP);
 	shipp = &Ships[stealth_objp->instance];
 	Assert(viewer_objp->type == OBJ_SHIP);
+	(void)shipp;
 
 	// check if stealth ship
 	Assert(shipp->flags2 & SF2_STEALTH);
@@ -2672,6 +2673,7 @@
 	num_points = mp->nverts;
 
 	Assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS);
+	(void)num_points;
 
 	vm_vec_unrotate(&gp0, &mp->verts[0].pos, &mobjp->orient);
 	vm_vec_add2(&gp0, &mobjp->pos);
@@ -2764,6 +2766,7 @@
 	num_points = mp->nverts;
 
 	Assert(Ppfp-Path_points + num_points + 4 < MAX_PATH_POINTS);
+	(void)num_points;
 
 	copy_xlate_model_path_points(mobjp, mp, -1, count, path_num, NULL);
 
@@ -3695,6 +3698,7 @@
 	pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
 	num_paths = pm->n_paths;
 	Assert(num_paths > 0);
+	(void)num_paths;
 
 	if (aip->path_start == -1) {
 		Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
@@ -3846,6 +3850,7 @@
 	pm = model_get(Ship_info[gshipp->ship_info_index].model_num);
 	num_paths = pm->n_paths;
 	Assert(num_paths > 0);
+	(void)num_paths;
 
 	if (aip->path_start == -1) {
 		Assert(aip->goal_objnum >= 0 && aip->goal_objnum < MAX_OBJECTS);
@@ -6555,9 +6560,8 @@
 	vec3d	new_pos;
 	float		dot;
 	vec3d	vec_from_enemy;
-	float		dist;
 
-	dist = vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
+	vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos);
 
 	vm_vec_scale_add(&new_pos, &En_objp->pos, &En_objp->orient.vec.fvec, -100.0f);		//	Pick point 100 units behind.
 	ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0);
@@ -7798,10 +7802,6 @@
 		return;
 	}
 
-	ship			*eshipp;
-
-	eshipp = &Ships[En_objp->instance];
-
 	vec3d	goal_pos;
 	float turn_time = Ship_info[Ships[Pl_objp->instance].ship_info_index].srotation_time;
 
@@ -7950,7 +7950,7 @@
  */
 void ai_chase()
 {
-	float		dist_to_enemy, time_to_enemy;
+	float		dist_to_enemy;
 	float		dot_to_enemy, dot_from_enemy, real_dot_to_enemy;
 	vec3d		player_pos, enemy_pos, predicted_enemy_pos, real_vec_to_enemy, predicted_vec_to_enemy;
 	ship		*shipp = &Ships[Pl_objp->instance];
@@ -8031,7 +8031,6 @@
 
 	ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos);
 	dist_to_enemy = vm_vec_dist_quick(&player_pos, &enemy_pos);
-	time_to_enemy = compute_time_to_enemy(dist_to_enemy, Pl_objp, En_objp);
 	vm_vec_sub(&real_vec_to_enemy, &enemy_pos, &player_pos);
 
 	//Enemy position for the purpose of aiming is already calculated differently, do it explicitly here
@@ -10446,7 +10445,6 @@
 	//	This mode means to follow the path until just before the end.
 	case AIS_DOCK_1:
 	{
-		float	dist;
 		int	r;
 
 		if ((r = maybe_dock_obstructed(Pl_objp, goal_objp, 1)) != -1) {
@@ -10457,7 +10455,7 @@
 			}
 		} //else {
 		{
-			dist = ai_path();
+			ai_path();
 
 			if (aip->path_cur-aip->path_start >= aip->path_length-1) {		//	If got this far, advance no matter what.
 				aip->submode = AIS_DOCK_2;
@@ -11540,9 +11538,8 @@
 	} else {
 		vec3d	v2f2;
 		float	dot_to_f2;
-		float	dist_to_f2;
 
-		dist_to_f2 = vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
+		vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos);
 		dot_to_f2 = vm_vec_dot(&v2f2, &Pl_objp->orient.vec.fvec);
 
 		//	Leader flying like a maniac.  Don't try hard to form on wing.
@@ -11760,10 +11757,8 @@
 
 	if ((aip->nearest_locked_object != -1) && (Objects[aip->nearest_locked_object].type == OBJ_WEAPON)) {
 		object	*weapon_objp;
-		weapon	*weaponp;
 
 		weapon_objp = &Objects[aip->nearest_locked_object];
-		weaponp = &Weapons[weapon_objp->instance];
 
 		if ((dist = vm_vec_dist_quick(&objp->pos, &weapon_objp->pos)) < weapon_objp->phys_info.speed*2.0f) {
 	
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aiturret.cpp C:\temp\fs2_open_3_7_0_RC2/code/ai/aiturret.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ai/aiturret.cpp	2013-04-19 00:06:54.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/ai/aiturret.cpp	2013-06-28 21:58:19.000000000 +0200
@@ -1409,6 +1409,7 @@
 	// but we need to keep retail behavior by default, which means always returning 0 unless a special
 	// flag is used.  the "ret_val" stuff is here is needed/wanted at a later date however.
 	//return ret_val;
+	(void)ret_val;
 
 	// return 0 by default (to preserve retail behavior) but allow for a per-subsystem option
 	// for using the turret normals for firing
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/anim/animplay.cpp C:\temp\fs2_open_3_7_0_RC2/code/anim/animplay.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/anim/animplay.cpp	2012-11-03 10:23:23.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/anim/animplay.cpp	2013-06-28 22:41:22.000000000 +0200
@@ -254,7 +254,7 @@
 int anim_show_next_frame(anim_instance *instance, float frametime)
 {
 	int	bitmap_id, bitmap_flags=0, new_frame_num, frame_diff=0, i, n_frames=0,frame_save;
-	float percent_through, decompress_time, render_time, time;
+	float percent_through, time;
 	vertex	image_vertex;
 	int aabitmap = 0;
 	int bpp = 16;
@@ -462,8 +462,6 @@
 		instance->loop_count++;
 	}
 		
-	decompress_time = f2fl(t2-t1);
-
 	t1 = timer_get_fixed_seconds();
 	if ( frame_diff == 0 && instance->last_bitmap != -1 ) {
 		bitmap_id = instance->last_bitmap;
@@ -510,7 +508,6 @@
 	}
 
 	t2 = timer_get_fixed_seconds();
-	render_time = f2fl(t2-t1);
 
 	return 0;
 }
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/anim/packunpack.cpp C:\temp\fs2_open_3_7_0_RC2/code/anim/packunpack.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/anim/packunpack.cpp	2011-10-20 22:25:39.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/anim/packunpack.cpp	2013-06-28 22:03:54.000000000 +0200
@@ -300,6 +300,7 @@
 			}
 
 			Assert(packed_size == (save-dest_start) );
+			(void)dest_start;
 			return packed_size;
 			break;
 			}
@@ -466,6 +467,7 @@
 			}
 
 			Assert(packed_size == (save-dest_start) );
+			(void)dest_start;
 			return packed_size;
 			break;
 			}
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/asteroid/asteroid.cpp C:\temp\fs2_open_3_7_0_RC2/code/asteroid/asteroid.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/asteroid/asteroid.cpp	2013-01-13 01:05:21.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/asteroid/asteroid.cpp	2013-06-28 21:29:07.000000000 +0200
@@ -1935,7 +1935,9 @@
 
 		asteroid_parse_section( &new_asteroid );
 
+#ifndef NDEBUG
 		int species = tally / NUM_DEBRIS_SIZES;
+#endif
 		if (tally >= max_asteroids)
 		{
 #ifdef NDEBUG
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/bmpman/bmpman.cpp C:\temp\fs2_open_3_7_0_RC2/code/bmpman/bmpman.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/bmpman/bmpman.cpp	2013-05-07 21:25:28.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/bmpman/bmpman.cpp	2013-06-28 21:30:13.000000000 +0200
@@ -1771,7 +1771,6 @@
 void bm_unlock( int handle )
 {
 	bitmap_entry	*be;
-	bitmap			*bmp;
 
 	if ( !bm_inited ) bm_init();
 
@@ -1788,7 +1787,6 @@
 	Assert( (bitmapnum >= 0) && (bitmapnum < MAX_BITMAPS) );
 
 	be = &bm_bitmaps[bitmapnum];
-	bmp = &be->bm;
 
 	be->ref_count--;
 	Assert(be->ref_count >= 0);		// Trying to unlock data more times than lock was called!!!
@@ -1941,13 +1939,11 @@
 int bm_unload( int handle, int clear_render_targets, bool nodebug )
 {
 	bitmap_entry *be;
-	bitmap *bmp;
 
 	int n = handle % MAX_BITMAPS;
 
 	Assert( (n >= 0) && (n < MAX_BITMAPS) );
 	be = &bm_bitmaps[n];
-	bmp = &be->bm;
 
 	if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
 		return -1;
@@ -2010,13 +2006,11 @@
 int bm_unload_fast( int handle, int clear_render_targets )
 {
 	bitmap_entry *be;
-	bitmap *bmp;
 
 	int n = handle % MAX_BITMAPS;
 
 	Assert( (n >= 0) && (n < MAX_BITMAPS) );
 	be = &bm_bitmaps[n];
-	bmp = &be->bm;
 
 	if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
 		return -1;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/controlconfig/controlsconfig.cpp C:\temp\fs2_open_3_7_0_RC2/code/controlconfig/controlsconfig.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/controlconfig/controlsconfig.cpp	2013-03-08 06:22:57.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/controlconfig/controlsconfig.cpp	2013-06-28 22:47:23.000000000 +0200
@@ -387,21 +387,10 @@
 
 void control_config_conflict_check()
 {
-	int i, j, shift = -1, alt = -1;
+	int i, j;
 
 	for (i=0; i<CCFG_MAX; i++) {
 		Conflicts[i].key = Conflicts[i].joy = -1;
-		switch (Control_config[i].key_id) {
-			case KEY_LSHIFT:
-			case KEY_RSHIFT:
-				shift = i;
-				break;
-
-			case KEY_LALT:
-			case KEY_RALT:
-				alt = i;
-				break;
-		}
 	}
 
 	for (i=0; i<NUM_TABS; i++) {
@@ -462,13 +451,12 @@
 // do list setup required prior to rendering and checking for the controls listing.  Called when list changes
 void control_config_list_prepare()
 {
-	int j, k, y, z;
+	int j, y, z;
 	int font_height = gr_get_font_height();
 
 	Num_cc_lines = y = z = 0;
 	while (z < CCFG_MAX) {
 		if (Control_config[z].tab == Tab && !Control_config[z].disabled) {
-			k = Control_config[z].key_id;
 			j = Control_config[z].joy_id;
 
 			if (Control_config[z].hasXSTR) {
@@ -654,7 +642,7 @@
 
 int control_config_remove_binding()
 {
-	int z, j, k;
+	int z;
 	config_item_undo *ptr;
 
 	if (Selected_line < 0) {
@@ -684,7 +672,6 @@
 		return -1;
 	}
 
-	j = k = -1;
 	ptr = get_undo_block(1);
 	ptr->index[0] = z;
 	ptr->list[0] = Control_config[z];
@@ -1392,8 +1379,8 @@
 
 void control_config_do_frame(float frametime)
 {
-	char buf[256], *str, *jptr;
-	int i, j, k, w, x, y, z, len, line, conflict;
+	char buf[256], *str;
+	int i, j, k, w, x, y, z, line, conflict;
 	int font_height = gr_get_font_height();
 	int select_tease_line = -1;  // line mouse is down on, but won't be selected until button released
 	static float timer = 0.0f;
@@ -1952,7 +1939,6 @@
 			k = Control_config[z].key_id;
 			j = Control_config[z].joy_id;
 			x = Control_list_key_x[gr_screen.res];
-			jptr = NULL;
 			*buf = 0;
 
 			if ((k < 0) && (j < 0)) {
@@ -1979,7 +1965,6 @@
 
 					gr_printf(x, y, buf);
 
-					len = strlen(buf);
 					Cc_lines[line].kx = x - Control_list_coords[gr_screen.res][CONTROL_X_COORD];
 					gr_get_string_size(&w, NULL, buf);
 					Cc_lines[line].kw = w;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/cutscene/decoder16.cpp C:\temp\fs2_open_3_7_0_RC2/code/cutscene/decoder16.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/cutscene/decoder16.cpp	2010-10-25 05:26:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/cutscene/decoder16.cpp	2013-06-28 21:32:30.000000000 +0200
@@ -15,7 +15,7 @@
 
 void decodeFrame16(ubyte *pFrame, ubyte *pMap, int mapRemain, unsigned char *pData, int dataRemain)
 {
-	ubyte *pOrig, *pOffData, *pEnd, op;
+	ubyte *pOrig, *pOffData, op;
 	ushort offset;
 	int length = 0, i, j, xb, yb;
 
@@ -32,7 +32,6 @@
 	offset = pData[0]|(pData[1]<<8);
 
 	pOffData = pData + offset;
-	pEnd = pData + offset;
 
 	pData += 2;
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/cutscene/mveplayer.cpp C:\temp\fs2_open_3_7_0_RC2/code/cutscene/mveplayer.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/cutscene/mveplayer.cpp	2012-11-18 11:05:44.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/cutscene/mveplayer.cpp	2013-06-28 21:34:24.000000000 +0200
@@ -228,7 +228,7 @@
 		return;
 	}
 
-	int flags, desired_buffer, sample_rate;
+	int flags, sample_rate;
 
 	mas = (mve_audio_t *) vm_malloc ( sizeof(mve_audio_t) );
 	memset(mas, 0, sizeof(mve_audio_t));
@@ -237,7 +237,6 @@
 
 	flags = mve_get_ushort(data + 2);
 	sample_rate = mve_get_ushort(data + 4);
-	desired_buffer = mve_get_int(data + 6);
 
 	mas->channels = (flags & 0x0001) ? 2 : 1;
 	mas->bitsize = (flags & 0x0002) ? 16 : 8;
@@ -419,16 +418,10 @@
 	}
 
 	short w, h;
-	short count, truecolor;
+	short  truecolor;
 	w = mve_get_short(data);
 	h = mve_get_short(data+2);
 
-	if (minor > 0) {
-		count = mve_get_short(data+4);
-	} else {
-		count = 1;
-	}
-
 	if (minor > 1) {
 		truecolor = mve_get_short(data+6);
 	} else {
@@ -725,18 +718,9 @@
 
 void mve_video_data(ubyte *data, int len)
 {
-	short nFrameHot, nFrameCold;
-	short nXoffset, nYoffset;
-	short nXsize, nYsize;
 	ushort nFlags;
 	ubyte *temp;
 
-	nFrameHot = mve_get_short(data);
-	nFrameCold = mve_get_short(data+2);
-	nXoffset = mve_get_short(data+4);
-	nYoffset = mve_get_short(data+6);
-	nXsize = mve_get_short(data+8);
-	nYsize = mve_get_short(data+10);
 	nFlags = mve_get_ushort(data+12);
 
 	if (nFlags & 1) {
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ddsutils/ddsutils.cpp C:\temp\fs2_open_3_7_0_RC2/code/ddsutils/ddsutils.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ddsutils/ddsutils.cpp	2010-10-25 05:48:01.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/ddsutils/ddsutils.cpp	2013-06-28 21:35:08.000000000 +0200
@@ -36,7 +36,7 @@
 	int retval = DDS_ERROR_NONE;
 	int ct = DDS_UNCOMPRESSED;
 	int bits = 0;
-	int i, trash, is_cubemap = 0;
+	int i, is_cubemap = 0;
 	int d_width = 0, d_height = 0, d_depth = 0, d_size = 0;
 
 
@@ -80,7 +80,7 @@
 
 	// skip over the crap we don't care about
 	for (i = 0; i < 11; i++)
-		trash = cfread_uint(ddsfile);
+		cfread_uint(ddsfile);
 
 	dds_header.ddpfPixelFormat.dwSize				= cfread_uint(ddsfile);
 	dds_header.ddpfPixelFormat.dwFlags				= cfread_uint(ddsfile);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/fireball/fireballs.cpp C:\temp\fs2_open_3_7_0_RC2/code/fireball/fireballs.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/fireball/fireballs.cpp	2012-06-13 15:20:04.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/fireball/fireballs.cpp	2013-06-28 22:42:42.000000000 +0200
@@ -461,6 +461,7 @@
 	fb = &Fireballs[num];
 
 	Assert( fb->objnum == OBJ_INDEX(obj));
+	(void)fb;
 
 	Fireballs[num].objnum = -1;
 	Num_fireballs--;
@@ -543,6 +544,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assert( Fireballs[num].objnum == objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
@@ -603,6 +605,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assert( Fireballs[num].objnum == objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
@@ -647,6 +650,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assert( Fireballs[num].objnum == objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
@@ -671,6 +675,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assert( Fireballs[num].objnum == objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
@@ -688,6 +693,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assert( Fireballs[num].objnum == objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
@@ -1033,6 +1039,7 @@
 	num = obj->instance;
 	objnum = OBJ_INDEX(obj);
 	Assertion( Fireballs[num].objnum == objnum, "Basic sanity check. Fireballs[num].objnum (%d) should == objnum (%d)", Fireballs[num].objnum, objnum );
+	(void)objnum;
 
 	fb = &Fireballs[num];
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/freespace2/freespace.cpp C:\temp\fs2_open_3_7_0_RC2/code/freespace2/freespace.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/freespace2/freespace.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/freespace2/freespace.cpp	2013-06-28 22:37:08.000000000 +0200
@@ -1265,7 +1265,7 @@
 	mprintf(( "================================================\n" ));
 #else
 	// to remove warnings in release build
-	real_count = 0;
+	(void)real_count;
 #endif
 
 	generic_anim_unload(&Game_loading_ani);
@@ -2012,7 +2012,9 @@
 	nprintf(("General", "Ships.tbl is : %s\n", Game_ships_tbl_valid ? "VALID" : "INVALID!!!!"));
 	nprintf(("General", "Weapons.tbl is : %s\n", Game_weapons_tbl_valid ? "VALID" : "INVALID!!!!"));
 
-	mprintf(("cfile_init() took %d\n", e1 - s1));	
+	mprintf(("cfile_init() took %d\n", e1 - s1));
+	(void)e1;
+	(void)s1;
 	Script_system.RunBytecode(Script_gameinithook);
 }
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/fs2netd/fs2netd_client.cpp C:\temp\fs2_open_3_7_0_RC2/code/fs2netd/fs2netd_client.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/fs2netd/fs2netd_client.cpp	2013-03-26 10:12:48.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/fs2netd/fs2netd_client.cpp	2013-06-28 22:21:34.000000000 +0200
@@ -738,6 +738,7 @@
 
 				for (int i = 0; i < numServers; i++) {
 					PXO_GET_INT( svr_flags );
+					(void)svr_flags;
 					PXO_GET_USHORT( svr_port );
 					PXO_GET_STRING( svr_ip );
 
@@ -1653,7 +1654,6 @@
 void fs2netd_spew_table_checksums(char *outfile)
 {
 	char full_name[MAX_PATH_LEN];
-	int count;
 	FILE *out = NULL;
 	char description[512] = { 0 };
 	char filename[65] = { 0 };
@@ -1689,8 +1689,6 @@
 	// header
 	fprintf(out, "filename,CRC32,description\r\n");
 
-	count = (int)Table_valid_status.size();
-
 	// do all the checksums
 	for (SCP_vector<crc_valid_status>::iterator tvs = Table_valid_status.begin(); tvs != Table_valid_status.end(); ++tvs) {
 		offset = 0;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/fs2netd/tcp_client.cpp C:\temp\fs2_open_3_7_0_RC2/code/fs2netd/tcp_client.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/fs2netd/tcp_client.cpp	2011-10-03 11:06:56.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/fs2netd/tcp_client.cpp	2013-06-28 22:08:38.000000000 +0200
@@ -296,6 +296,7 @@
 
 			if (si_index == -1) {
 				PXO_GET_USHORT( bogus );
+				(void)bogus;
 			} else {
 				PXO_GET_USHORT( pl->stats.kills[si_index] );
 			}
@@ -522,6 +523,7 @@
 		PXO_GET_INT( sid );
 
 		PXO_GET_SHORT( pilots );
+		(void)pilots;
 
 		return sid;
 	}
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/globalincs/safe_strings.cpp C:\temp\fs2_open_3_7_0_RC2/code/globalincs/safe_strings.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/globalincs/safe_strings.cpp	2012-01-13 19:37:09.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/globalincs/safe_strings.cpp	2013-06-28 22:22:53.000000000 +0200
@@ -39,14 +39,14 @@
 	if ( !strDest || !strSource )
 	{
 		if ( strDest )
-			*strDest = NULL;
+			*strDest = '\0';
 		__safe_strings_error_handler( EINVAL );
 		return EINVAL;
 	}
 
 	if ( sizeInBytes == 0 )
 	{
-		*strDest = NULL;
+		*strDest = '\0';
 		__safe_strings_error_handler( ERANGE );
 		return ERANGE;
 	}
@@ -58,7 +58,7 @@
 
 	if ( bufferLeft == 0 )
 	{
-		*strDest = NULL;
+		*strDest = '\0';
 		__safe_strings_error_handler( ERANGE );
 		return ERANGE;
 	}
@@ -75,14 +75,14 @@
 	if ( !strDest || !strSource )
 	{
 		if ( strDest )
-			*strDest = NULL;
+			*strDest = '\0';
 		__safe_strings_error_handler( EINVAL );
 		return EINVAL;
 	}
 
 	if ( bufferLeft == 0 )
 	{
-		*strDest = NULL;
+		*strDest = '\0';
 		__safe_strings_error_handler( ERANGE );
 		return ERANGE;
 	}
@@ -98,7 +98,7 @@
 
 	if ( bufferLeft == 0 )
 	{
-		*strDest = NULL;
+		*strDest = '\0';
 		__safe_strings_error_handler( ERANGE );
 		return ERANGE;
 	}
@@ -108,7 +108,7 @@
 
 	if ( bufferLeft == 0 )
 	{
-		*strDest = NULL;
+		*strDest = '\0';
 		__safe_strings_error_handler( ERANGE );
 		return ERANGE;
 	}
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/2d.cpp C:\temp\fs2_open_3_7_0_RC2/code/graphics/2d.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/2d.cpp	2013-03-16 01:48:23.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/graphics/2d.cpp	2013-06-28 22:23:56.000000000 +0200
@@ -283,7 +283,7 @@
 	}
 
 	if ( Dc_status ) {
-		switch( gr_screen.mode ) {
+		switch( mode ) {
 		case GR_OPENGL:
 			dc_printf( "OpenGl\n" );
 			break;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/gropenglbmpman.cpp C:\temp\fs2_open_3_7_0_RC2/code/graphics/gropenglbmpman.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/gropenglbmpman.cpp	2012-08-15 01:48:23.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/graphics/gropenglbmpman.cpp	2013-06-28 22:48:23.000000000 +0200
@@ -244,6 +244,7 @@
 	Assert( num_mipmaps > 0 );
 
 	nprintf(("BMPMAN", "Attempting to compress '%s' with %d frames, original size %.3fM ... ", bm_bitmaps[first_frame].filename, nframes, ((float)(size*nframes)/1024.0f)/1024.0f));
+	(void)size;
 
 	for ( i=0; i<nframes; i++ )	{
 		be = &bm_bitmaps[first_frame+i];
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/gropengldraw.cpp C:\temp\fs2_open_3_7_0_RC2/code/graphics/gropengldraw.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/graphics/gropengldraw.cpp	2013-03-14 18:06:26.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/graphics/gropengldraw.cpp	2013-06-28 22:44:00.000000000 +0200
@@ -540,6 +540,8 @@
 
 
 	INT_CLIPLINE(x1, y1, x2, y2, clip_left, clip_top, clip_right, clip_bottom, return, clipped = 1, swapped = 1);
+	(void)clipped;
+	(void)swapped;
 
 	sx1 = i2fl(x1 + offset_x);
 	sy1 = i2fl(y1 + offset_y);
@@ -666,6 +668,8 @@
 
 
 	FL_CLIPLINE(x1, y1, x2, y2, (float)gr_screen.clip_left, (float)gr_screen.clip_top, (float)gr_screen.clip_right, (float)gr_screen.clip_bottom, return, clipped = 1, swapped = 1);
+	(void)clipped;
+	(void)swapped;
 
 	sx1 = x1 + (float)gr_screen.offset_x;
 	sy1 = y1 + (float)gr_screen.offset_y;
@@ -748,6 +752,7 @@
 	}
 
 	INT_CLIPLINE(x1, y1, x2, y2, gr_screen.clip_left, gr_screen.clip_top, gr_screen.clip_right, gr_screen.clip_bottom, return, clipped = 1, swapped = 1);
+	(void)clipped;
 
 	GL_state.SetTextureSource(TEXTURE_SOURCE_NONE);
 	GL_state.SetAlphaBlendMode(ALPHA_BLEND_ALPHA_BLEND_ALPHA);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hud.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hud.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hud.cpp	2013-04-13 09:57:17.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hud.cpp	2013-06-28 22:29:02.000000000 +0200
@@ -398,6 +398,10 @@
 	}
 }
 
+HudGauge::~HudGauge()
+{
+}
+
 void HudGauge::initPosition(int x, int y)
 {
 	Assert(x >= 0 && y >= 0);
@@ -3582,14 +3586,13 @@
 	if ( (viewer_obj == Player_obj) && wiggedy_wack ){		
 		vec3d tmp;
 		vertex pt;
-		ubyte flags;		
 
 		HUD_offset_x = 0.0f;
 		HUD_offset_y = 0.0f;
 
 		vm_vec_scale_add( &tmp, &Eye_position, &eye_orient->vec.fvec, 100.0f );
 		
-		flags = g3_rotate_vertex(&pt,&tmp);
+		g3_rotate_vertex(&pt,&tmp);
 
 		g3_project_vertex(&pt);
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hud.h C:\temp\fs2_open_3_7_0_RC2/code/hud/hud.h
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hud.h	2012-10-15 06:45:02.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hud.h	2013-06-28 22:29:13.000000000 +0200
@@ -254,6 +254,8 @@
 	// constructor for custom gauges
 	HudGauge(int _gauge_config, bool _slew, int r, int g, int b, char* _custom_name, char* _custom_text, char* frame_fname, int txtoffset_x, int txtoffset_y);
 
+	virtual ~HudGauge();
+
 	void initPosition(int x, int y);
 	void initBaseResolution(int w, int h);
 	void initSlew(bool slew);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudlock.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hudlock.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudlock.cpp	2012-09-24 18:17:26.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hudlock.cpp	2013-06-28 22:26:59.000000000 +0200
@@ -458,10 +458,10 @@
 // Determine if locking point is in the locking cone
 void hud_lock_check_if_target_in_lock_cone()
 {
-	float		dist, dot;
+	float		dot;
 	vec3d	vec_to_target;
 
-	dist = vm_vec_normalized_dir(&vec_to_target, &lock_world_pos, &Player_obj->pos);
+	vm_vec_normalized_dir(&vec_to_target, &lock_world_pos, &Player_obj->pos);
 	dot = vm_vec_dot(&Player_obj->orient.vec.fvec, &vec_to_target);
 
 	if ( dot > 0.85) {
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudmessage.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hudmessage.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudmessage.cpp	2012-11-21 00:42:12.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hudmessage.cpp	2013-06-28 22:27:17.000000000 +0200
@@ -535,6 +535,7 @@
 
 	len = strlen(tmp);
 	Assert(len < HUD_MSG_LENGTH_MAX);	//	If greater than this, probably crashed anyway.
+	(void)len;
 	hud_sourced_print(HUD_SOURCE_COMPUTER, tmp);
 }
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudsquadmsg.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hudsquadmsg.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudsquadmsg.cpp	2013-01-13 04:03:25.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hudsquadmsg.cpp	2013-06-28 22:17:37.000000000 +0200
@@ -1386,6 +1386,8 @@
 			if ( Objects[ainfo->target_objnum].type == OBJ_SHIP ) {
 				Assert( target_shipname );
 				Assert( wing_team != target_team );
+				(void)wing_team;
+				(void)target_team;
 				if ( (Ships[Objects[ainfo->target_objnum].instance].wingnum != -1) && (Ships[Objects[ainfo->target_objnum].instance].wingnum == wingnum) ) {
 					message = MESSAGE_NOSIR;
 					ai_mode = AI_GOAL_NONE;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudtarget.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hudtarget.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudtarget.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hudtarget.cpp	2013-06-28 22:33:04.000000000 +0200
@@ -4196,8 +4196,7 @@
 	polymodel	*pm;
 	ship_weapon	*swp;
 	weapon_info	*wip;
-	weapon_info	*tmp=NULL;
-	float		dist_to_target, prange, srange;
+	float		dist_to_target, prange;
 	int			bank_to_fire;
 
 	if (Player_ai->target_objnum == -1)
@@ -4261,17 +4260,6 @@
 	// to the closest point on the bounding box of the target
 	dist_to_target = hud_find_target_distance(targetp, Player_obj);
 
-	srange = ship_get_secondary_weapon_range(Player_ship);
-
-	if ( swp->current_secondary_bank >= 0 ) {
-		int bank = swp->current_secondary_bank;
-		tmp = &Weapon_info[swp->secondary_bank_weapons[bank]];
-		if ( !(tmp->wi_flags & WIF_HOMING) && !(tmp->wi_flags & WIF_LOCKED_HOMING && Player->target_in_lock_cone) ) {
-			//The secondary lead indicator is handled farther below if it is a non-locking type
-			srange = -1.0f;
-		}
-	}
-	
 	bool in_frame;
 	if ( dist_to_target < prange ) {
 		// fire it up
@@ -6785,7 +6773,6 @@
 void HudGaugePrimaryWeapons::render(float frametime)
 {
 	ship_weapon	*sw;
-	int ship_is_ballistic;
 
 	int		num_primaries;		// np == num primary
 	char	name[NAME_LENGTH];	
@@ -6797,7 +6784,6 @@
 	Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS);
 
 	sw = &Ships[Player_obj->instance].weapons;
-	ship_is_ballistic = (Ship_info[Ships[Player_obj->instance].ship_info_index].flags & SIF_BALLISTIC_PRIMARIES);
 
 	num_primaries = sw->num_primary_banks;
 
@@ -6904,7 +6890,6 @@
 void HudGaugeSecondaryWeapons::render(float frametime)
 {
 	ship_weapon	*sw;
-	int ship_is_ballistic;
 
 	int num_primaries, num_secondaries;
 
@@ -6912,7 +6897,6 @@
 	Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS);
 
 	sw = &Ships[Player_obj->instance].weapons;
-	ship_is_ballistic = (Ship_info[Ships[Player_obj->instance].ship_info_index].flags & SIF_BALLISTIC_PRIMARIES);
 
 	num_primaries = sw->num_primary_banks;
 	num_secondaries = sw->num_secondary_banks;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudtargetbox.cpp C:\temp\fs2_open_3_7_0_RC2/code/hud/hudtargetbox.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/hud/hudtargetbox.cpp	2013-04-13 09:57:17.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/hud/hudtargetbox.cpp	2013-06-28 22:49:14.000000000 +0200
@@ -1717,8 +1717,10 @@
 	int w,h;									// width and height of string about to print
 	object		*target_objp;
 	ship			*shipp = NULL;
+#ifndef NDEBUG
 	debris		*debrisp = NULL;
 	ship_info	*sip = NULL;
+#endif
 	int is_ship = 0;
 	float		displayed_target_distance, displayed_target_speed, current_target_distance, current_target_speed;
 
@@ -1737,21 +1739,29 @@
 	switch( Objects[Player_ai->target_objnum].type ) {
 		case OBJ_SHIP:
 			shipp = &Ships[target_objp->instance];
+#ifndef NDEBUG
 			sip = &Ship_info[shipp->ship_info_index];
+#endif
 			is_ship = 1;
 			break;
 
 		case OBJ_DEBRIS:
+#ifndef NDEBUG
 			debrisp = &Debris[target_objp->instance]; 
 			sip = &Ship_info[debrisp->ship_info_index];
+#endif
 			break;
 
 		case OBJ_WEAPON:
+#ifndef NDEBUG
 			sip = NULL;
+#endif
 			break;
 
 		case OBJ_ASTEROID:
+#ifndef NDEBUG
 			sip = NULL;
+#endif
 			break;
 
 		case OBJ_JUMP_NODE:
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/math/vecmat.cpp C:\temp\fs2_open_3_7_0_RC2/code/math/vecmat.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/math/vecmat.cpp	2012-12-03 01:59:45.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/math/vecmat.cpp	2013-06-28 22:15:27.000000000 +0200
@@ -1341,7 +1341,7 @@
 //	Result returned in q.
 void compute_point_on_plane(vec3d *q, plane *planep, vec3d *p)
 {
-	float	k, tv;
+	float	k;
 	vec3d	normal;
 
 	normal.xyz.x = planep->A;
@@ -1351,8 +1351,6 @@
 	k = (planep->D + vm_vec_dot(&normal, p)) / vm_vec_dot(&normal, &normal);
 
 	vm_vec_scale_add(q, p, &normal, -k);
-
-	tv = planep->A * q->xyz.x + planep->B * q->xyz.y + planep->C * q->xyz.z + planep->D;
 }
 
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/menuui/readyroom.cpp C:\temp\fs2_open_3_7_0_RC2/code/menuui/readyroom.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/menuui/readyroom.cpp	2013-03-26 12:41:00.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/menuui/readyroom.cpp	2013-06-28 22:14:39.000000000 +0200
@@ -1172,17 +1172,10 @@
 void sim_room_do_frame(float frametime)
 {
 	char buf[256];
-	int i, k, y, z, line;
+	int i, k, y, line;
 	int font_height = gr_get_font_height();
 	int select_tease_line = -1;  // line mouse is down on, but won't be selected until button released	
 
-	z = -1;
-	for (i=0; i<Num_campaigns; i++)
-		if (!stricmp(Campaign_file_names[i], Campaign.filename)) {
-			z = i;
-			break;
-		}
-
 	if ( help_overlay_active(SIM_ROOM_OVERLAY) ) {
 		Buttons[gr_screen.res][HELP_BUTTON].button.reset_status();
 		Ui_window.set_ignore_gadgets(1);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missioncampaign.cpp C:\temp\fs2_open_3_7_0_RC2/code/mission/missioncampaign.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missioncampaign.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/mission/missioncampaign.cpp	2013-06-28 22:50:18.000000000 +0200
@@ -304,6 +304,7 @@
 	// NOTE: we don't do sorting here, but we assume CF_SORT_NAME, and do it manually below
 	rc = cf_get_file_list(MAX_CAMPAIGNS, Campaign_file_names, CF_TYPE_MISSIONS, wild_card, CF_SORT_NONE);
 	Assert( rc == Num_campaigns );
+	(void)rc;
 
 	// now sort everything, if we are supposed to
 	if (sort) {
@@ -1038,6 +1039,7 @@
 
 			sprintf(event_name, NOX("Event #%d"), i);
 			nprintf(("Warning", "Mission goal in mission %s must have a +Name field! using %s for campaign save file\n", mission->name, name));
+			(void)name;
 			strcpy_s( mission->events[i].name, event_name);
 		} else
 			strcpy_s( mission->events[i].name, Mission_events[i].name );
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionload.cpp C:\temp\fs2_open_3_7_0_RC2/code/mission/missionload.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionload.cpp	2013-03-24 11:18:58.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/mission/missionload.cpp	2013-06-28 22:10:54.000000000 +0200
@@ -111,6 +111,7 @@
 		int ret;
 		ret = create_default_player_ship();
 		Assert(!ret);
+		(void)ret;
 	}
 
 	ml_update_recent_missions(filename_ext);  // update recently played missions list (save the csg later)
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionlog.cpp C:\temp\fs2_open_3_7_0_RC2/code/mission/missionlog.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionlog.cpp	2012-11-21 00:42:12.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/mission/missionlog.cpp	2013-06-28 22:11:41.000000000 +0200
@@ -183,7 +183,9 @@
 // that this event is for.  Don't add entries with this function for multiplayer
 void mission_log_add_entry(int type, char *pname, char *sname, int info_index)
 {
+#ifndef NDEBUG
 	int last_entry_save;
+#endif
 	log_entry *entry;	
 
 	// multiplayer clients don't use this function to add log entries -- they will get
@@ -192,7 +194,9 @@
 		return;
 	}
 
+#ifndef NDEBUG
 	last_entry_save = last_entry;
+#endif
 
 	// mark any entries as obsolete.  Part of the pruning is done based on the type (and name) passed
 	// for a new entry
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionparse.cpp C:\temp\fs2_open_3_7_0_RC2/code/mission/missionparse.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/mission/missionparse.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/mission/missionparse.cpp	2013-06-28 22:50:50.000000000 +0200
@@ -3621,6 +3621,7 @@
 			
 		// We should never reach here with an unassigned loadout
 		Assert (loadout_assigned);
+		(void)loadout_assigned;
 	}
 }
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/missionui/missionshipchoice.cpp C:\temp\fs2_open_3_7_0_RC2/code/missionui/missionshipchoice.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/missionui/missionshipchoice.cpp	2013-05-07 21:25:28.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/missionui/missionshipchoice.cpp	2013-06-28 22:12:09.000000000 +0200
@@ -2401,6 +2401,7 @@
 							}
 						}
 						Assert(found_pobj);
+						(void)found_pobj;
 					}
 					else {
 						// AL 10/04/97
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/model/modelread.cpp C:\temp\fs2_open_3_7_0_RC2/code/model/modelread.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/model/modelread.cpp	2013-03-08 06:22:57.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/model/modelread.cpp	2013-06-28 22:12:53.000000000 +0200
@@ -3150,14 +3150,13 @@
 {
 	float t,w,h;
 	vertex pnt;
-	ubyte flags;
 	polymodel * po;
 
 	po = model_get(model_num);
 	float width = po->rad;
 	float height = po->rad;
 
-	flags = g3_rotate_vertex(&pnt,pos);
+	g3_rotate_vertex(&pnt,pos);
 
 	if ( pnt.flags & CC_BEHIND ) 
 		return 2;
@@ -3190,12 +3189,11 @@
 {
 	float t,w,h;
 	vertex pnt;
-	ubyte flags;
 
 	float width = radius;
 	float height = radius;
 
-	flags = g3_rotate_vertex(&pnt,pos);
+	g3_rotate_vertex(&pnt,pos);
 
 	if ( pnt.flags & CC_BEHIND ) 
 		return 2;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/network/chat_api.cpp C:\temp\fs2_open_3_7_0_RC2/code/network/chat_api.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/network/chat_api.cpp	2013-04-04 07:22:22.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/network/chat_api.cpp	2013-06-28 22:51:25.000000000 +0200
@@ -654,7 +654,6 @@
 
 	static char szResponse[MAXLOCALSTRING] = "";
 
-	int iNickLen;
 	int iPrefixLen = 0;	// JAS: Get rid of optimized warning
 
 	szRemLine[MAXLOCALSTRING-1] = '\0';
@@ -695,7 +694,6 @@
 			strncpy(szNick,szPrefix,31);
          szNick[31]=0;
 		}
-		iNickLen=strlen(szNick);
 		iPrefixLen=strlen(szPrefix);
 	}
 	else if(iMode==MSG_LOCAL)
@@ -703,7 +701,6 @@
 		strncpy(szRemLine, Line, sizeof(szRemLine)-1);
 		strncpy(szNick, Nick_name, sizeof(szNick)-1);
 		strncpy(szPrefix, Nick_name, sizeof(szPrefix)-1);
-		iNickLen=-2;
 		iPrefixLen=-2;
 	}
 	//Next is the command
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/network/multiutil.cpp C:\temp\fs2_open_3_7_0_RC2/code/network/multiutil.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/network/multiutil.cpp	2013-04-06 06:11:39.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/network/multiutil.cpp	2013-06-29 15:20:15.000000000 +0200
@@ -2345,7 +2345,6 @@
 {
 	char *filename;
 	int len,idx;
-	int force_dir;
 	int cf_type;
 	int is_mission = 0;	
 
@@ -2354,7 +2353,7 @@
 	filename = multi_xfer_get_filename(handle);
 
 	// get the directory the file is forced into
-	force_dir = multi_xfer_get_force_dir(handle);
+	multi_xfer_get_force_dir(handle);
 		
 	// something is messed up
 	if(filename == NULL){
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/network/psnet2.cpp C:\temp\fs2_open_3_7_0_RC2/code/network/psnet2.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/network/psnet2.cpp	2013-01-13 10:50:08.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/network/psnet2.cpp	2013-06-28 23:04:34.000000000 +0200
@@ -1129,7 +1129,7 @@
 
 void psnet_rel_send_ack(SOCKADDR *raddr, unsigned int sig, ubyte link_type, float time_sent)
 {
-	int ret, sig_tmp;
+	int sig_tmp;
 	reliable_header ack_header;
 	ack_header.type = RNT_ACK;	
 	ack_header.data_len = sizeof(unsigned int);
@@ -1144,7 +1144,7 @@
 			ml_string("No IPX in rel_send_ack()");
 			return;
 		}		
-		ret = SENDTO(Unreliable_socket, (char *)&ack_header, RELIABLE_PACKET_HEADER_ONLY_SIZE+ack_header.data_len, 0, raddr, sizeof(SOCKADDR), PSNET_TYPE_RELIABLE);
+		SENDTO(Unreliable_socket, (char *)&ack_header, RELIABLE_PACKET_HEADER_ONLY_SIZE+ack_header.data_len, 0, raddr, sizeof(SOCKADDR), PSNET_TYPE_RELIABLE);
 		break;
 #endif
 	case NET_TCP:
@@ -1152,7 +1152,7 @@
 			ml_string("No TCP in rel_send_ack()");
 			return;
 		}
-		ret = SENDTO(Unreliable_socket, (char *)&ack_header, RELIABLE_PACKET_HEADER_ONLY_SIZE+ack_header.data_len, 0, raddr, sizeof(SOCKADDR), PSNET_TYPE_RELIABLE);
+		SENDTO(Unreliable_socket, (char *)&ack_header, RELIABLE_PACKET_HEADER_ONLY_SIZE+ack_header.data_len, 0, raddr, sizeof(SOCKADDR), PSNET_TYPE_RELIABLE);
 		break;
 	default:		
 		ml_string("Unknown protocol type in nw_SendReliable()");
@@ -1424,7 +1424,7 @@
 
 	ubyte link_type;
 	net_addr d3_rcv_addr;
-	SOCKADDR_IN *rcvaddr,*rsockaddr;
+	SOCKADDR_IN *rcvaddr;
 #ifdef _WIN32
 	int ipx_has_data = 0;
 #endif
@@ -1525,7 +1525,6 @@
 			//Find out if this is a packet from someone we were expecting a packet.
 			rcvaddr = (SOCKADDR_IN *)&rcv_addr;
 			for(i=1; i<MAXRELIABLESOCKETS; i++){
-				rsockaddr = (SOCKADDR_IN *)&Reliable_sockets[i].addr;
 				if(memcmp(&d3_rcv_addr,&Reliable_sockets[i].m_net_addr,sizeof(net_addr)) == 0){
 					rsocket=&Reliable_sockets[i];
 					break;
@@ -1844,7 +1843,6 @@
 	int addrlen;
 	ubyte iaddr[6];
 	ushort port;
-	float time_sent_req = 0;
 	float first_sent_req = 0;
 	static reliable_header conn_header;
 	static reliable_header ack_header;
@@ -1958,7 +1956,6 @@
 
 	
 	first_sent_req = psnet_get_time();
-	time_sent_req = psnet_get_time();
 	
 	//Wait until we get a response from the server or we timeout
 	
@@ -2176,6 +2173,7 @@
 
 	// at this point, we should _always_ have found the buffer
 	Assert(found_buf);	
+	(void)found_buf;
 	
 	// copy out the buffer data
 	memcpy(data, l->psnet_buffers[idx].data, l->psnet_buffers[idx].len);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/object/collideshipship.cpp C:\temp\fs2_open_3_7_0_RC2/code/object/collideshipship.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/object/collideshipship.cpp	2012-12-09 07:28:56.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/object/collideshipship.cpp	2013-06-28 23:05:23.000000000 +0200
@@ -111,7 +111,9 @@
 {
 	object *heavy_obj	= ship_ship_hit_info->heavy;
 	object *light_obj = ship_ship_hit_info->light;
+#ifndef NDEBUG
 	int	player_involved;	// flag to indicate that A or B is the Player_obj
+#endif
 
 	Assert( heavy_obj->type == OBJ_SHIP );
 	Assert( light_obj->type == OBJ_SHIP );
@@ -122,6 +124,7 @@
 	ship_info *heavy_sip = &Ship_info[heavy_shipp->ship_info_index];
     ship_info *light_sip = &Ship_info[light_shipp->ship_info_index];
 
+#ifndef NDEBUG
 	// AL 12-4-97: we use the player_involved flag to ensure collisions are always
 	//             done with the player, regardless of team.
 	if ( heavy_obj == Player_obj || light_obj == Player_obj ) {
@@ -129,6 +132,7 @@
 	} else {
 		player_involved = 0;
 	}
+#endif
 
 	// Make ships that are warping in not get collision detection done
 	if ( heavy_shipp->flags & SF_ARRIVING_STAGE_1 ) { 
@@ -1156,9 +1160,7 @@
 				do_kamikaze_crash(A, B);
 
 				if (ship_ship_hit_info.impulse > 0) {
-					float	q;
-
-					q = vm_vec_dist_quick(&A->pos, &B->pos) / (A->radius + B->radius);
+					vm_vec_dist_quick(&A->pos, &B->pos);
 
 					//Only flash the "Collision" text if not landing
 					if ( player_involved && !ship_ship_hit_info.is_landing) {					
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/object/objcollide.cpp C:\temp\fs2_open_3_7_0_RC2/code/object/objcollide.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/object/objcollide.cpp	2012-12-10 09:23:19.000000000 +0100
+++ C:\temp\fs2_open_3_7_0_RC2/code/object/objcollide.cpp	2013-06-28 22:00:21.000000000 +0200
@@ -1219,8 +1219,6 @@
 	SCP_vector<int> overlappers;
 
 	float min;
-	float max;
-	float overlap_min;
 	float overlap_max;
 	
 	overlappers.clear();
@@ -1229,10 +1227,8 @@
 		overlapped = false;
 
 		min = obj_get_collider_endpoint((*list)[i], axis, true);
-		max = obj_get_collider_endpoint((*list)[i], axis, false);
 
 		for ( j = 0; j < overlappers.size(); ) {
-			overlap_min = obj_get_collider_endpoint(overlappers[j], axis, true);
 			overlap_max = obj_get_collider_endpoint(overlappers[j], axis, false);
 			if ( min <= overlap_max ) {
 				overlapped = true;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/object/object.cpp C:\temp\fs2_open_3_7_0_RC2/code/object/object.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/object/object.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/object/object.cpp	2013-06-28 22:00:47.000000000 +0200
@@ -344,6 +344,7 @@
 
 		num_freed = free_object_slots(MAX_OBJECTS-10);
 		nprintf(("warning", " *** Freed %i objects\n", num_freed));
+		(void)num_freed;
 	}
 
 	if (Num_objects >= MAX_OBJECTS) {
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/object/objectsort.cpp C:\temp\fs2_open_3_7_0_RC2/code/object/objectsort.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/object/objectsort.cpp	2012-09-06 17:51:52.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/object/objectsort.cpp	2013-06-28 21:59:39.000000000 +0200
@@ -45,9 +45,7 @@
 		model_num_a = sip->model_num;
 	} else if ( obj->type == OBJ_WEAPON ){
 		weapon_info *wip;
-		weapon *wp;
 
-		wp = &Weapons[obj->instance];
 		wip = &Weapon_info[Weapons[obj->instance].weapon_info_index];
 
 		if ( wip->render_type == WRT_POF ) {
@@ -71,9 +69,7 @@
 		model_num_b = sip->model_num;
 	} else if ( other.obj->type == OBJ_WEAPON ){
 		weapon_info *wip;
-		weapon *wp;
 
-		wp = &Weapons[other.obj->instance];
 		wip = &Weapon_info[Weapons[other.obj->instance].weapon_info_index];
 
 		if ( wip->render_type == WRT_POF ) {
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/palman/palman.cpp C:\temp\fs2_open_3_7_0_RC2/code/palman/palman.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/palman/palman.cpp	2011-10-08 08:22:41.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/palman/palman.cpp	2013-06-28 22:57:29.000000000 +0200
@@ -147,8 +147,9 @@
 		if ( fp==NULL)
 			Error( LOCATION, "Can't open palette file <%s>",palette_base_filename);
 
-		fsize	= cfilelength( fp );
+		fsize= cfilelength( fp );
 		Assert( fsize == 9472 );
+		(void)fsize;
 		cfread( palette_org, 256*3, 1, fp );
 		cfclose(fp);
 
@@ -575,6 +576,7 @@
 							gr = r*2;
 							gg = g*2;
 							gb = b*2;
+							(void)gi;
 						#endif
 				
 						x = l-24;			// x goes from 0 to 7
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/lua.cpp C:\temp\fs2_open_3_7_0_RC2/code/parse/lua.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/lua.cpp	2013-05-07 21:25:28.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/parse/lua.cpp	2013-06-28 22:02:47.000000000 +0200
@@ -4753,7 +4753,7 @@
 			sprintf(buf, "%s projectile", Weapon_info[Weapons[objh->objp->instance].weapon_info_index].name);
 			break;
 		default:
-			sprintf(buf, "Object %d [%d]", OBJ_INDEX(objh->objp), objh->sig);
+			sprintf(buf, "Object %ld [%d]", OBJ_INDEX(objh->objp), objh->sig);
 	}
 
 	return ade_set_args(L, "s", buf);
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/parselo.cpp C:\temp\fs2_open_3_7_0_RC2/code/parse/parselo.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/parselo.cpp	2013-05-07 21:25:28.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/parse/parselo.cpp	2013-06-28 22:58:10.000000000 +0200
@@ -1082,6 +1082,7 @@
 		
 		// We only want String variables
 		Assert (Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_STRING);
+		(void)sexp_variable_index;
 
 		result = PARSING_FOUND_VARIABLE; 
 	}
@@ -1116,6 +1117,7 @@
 		
 		// We only want String variables
 		Assert (Sexp_variables[sexp_variable_index].type & SEXP_VARIABLE_STRING);
+		(void)sexp_variable_index;
 
 		result = PARSING_FOUND_VARIABLE; 
 	}
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/sexp.cpp C:\temp\fs2_open_3_7_0_RC2/code/parse/sexp.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/parse/sexp.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/parse/sexp.cpp	2013-06-28 23:00:20.000000000 +0200
@@ -11476,11 +11476,10 @@
 void sexp_jettison_cargo(int n)
 {
 	char *shipname;
-	int jettison_delay, ship_index;	
+	int ship_index;	
 
 	// get some data
 	shipname = CTEXT(n);
-	jettison_delay = eval_num(CDR(n));
 
 	// lookup the ship
 	ship_index = ship_name_lookup(shipname);
@@ -17400,7 +17399,6 @@
 {
 	int sindex;
 	int flag;
-	char *whee;
 
 	// get the firing ship
 	sindex = ship_name_lookup(CTEXT(node));
@@ -17412,7 +17410,6 @@
 	}
 
 	// determine whether to add or remove it
-	whee = CTEXT(CDR(node));
 	flag = eval_num(CDR(node));
 
 	// add/remove
@@ -18608,7 +18605,8 @@
 		weapon_info_index = weapon_info_lookup(CTEXT(node));
 		if (weapon_info_index == -1) {
 			char *buf = CTEXT(node); 
-			mprintf(("Remove-weapons attempted to remove %s. Weapon not found. Remove-weapons will remove all weapons currently in the mission", buf)); 
+			mprintf(("Remove-weapons attempted to remove %s. Weapon not found. Remove-weapons will remove all weapons currently in the mission", buf));
+			(void)buf;
 		}
 	}
 
@@ -21408,6 +21406,7 @@
 									// which should be intercepted before we get here.  HOFFOSS
 	type = SEXP_NODE_TYPE(cur_node);
 	Assert( (type == SEXP_LIST) || (type == SEXP_ATOM) );
+	(void)type;
 
 	// trap known true and known false sexpressions.  We don't trap on SEXP_NAN sexpressions since
 	// they may yet evaluate to true or false.
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/pilotfile/csg.cpp C:\temp\fs2_open_3_7_0_RC2/code/pilotfile/csg.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/pilotfile/csg.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/pilotfile/csg.cpp	2013-06-28 23:06:13.000000000 +0200
@@ -1137,7 +1137,8 @@
 	for (idx = 0; idx < list_size; idx++) {
 		id1 = cfread_short(cfp);
 		id2 = cfread_short(cfp);
-		id3 = cfread_short(cfp);	// unused, at the moment
+		id3 = cfread_short(cfp);
+		(void)id3;	// unused, at the moment
 
 		if (idx < CCFG_MAX) {
 			Control_config[idx].key_id = id1;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/pilotfile/plr.cpp C:\temp\fs2_open_3_7_0_RC2/code/pilotfile/plr.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/pilotfile/plr.cpp	2013-04-07 02:46:59.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/pilotfile/plr.cpp	2013-06-28 21:56:49.000000000 +0200
@@ -593,7 +593,8 @@
 	for (idx = 0; idx < list_size; idx++) {
 		id1 = cfread_short(cfp);
 		id2 = cfread_short(cfp);
-		id3 = cfread_short(cfp);	// unused, at the moment
+		id3 = cfread_short(cfp);
+		(void)id3;	// unused, at the moment
 
 		if (idx < CCFG_MAX) {
 			Control_config[idx].key_id = id1;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ship/ship.cpp C:\temp\fs2_open_3_7_0_RC2/code/ship/ship.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ship/ship.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/ship/ship.cpp	2013-06-28 22:35:30.000000000 +0200
@@ -657,7 +657,7 @@
 	
 	sip->name[0] = '\0';
 	sip->alt_name[0] = '\0';
-	sprintf(sip->short_name, "ShipClass%d", (sip - Ship_info));
+	sprintf(sip->short_name, "ShipClass%ld", (sip - Ship_info));
 	sip->species = 0;
 	sip->class_type = -1;
 	
@@ -1386,11 +1386,10 @@
 		stuff_string(sip->short_name, F_NAME, NAME_LENGTH);
 	else if(first_time)
 	{
-		char *srcpos, *srcend, *destpos, *destend;
+		char *srcpos, *srcend, *destpos;
 		srcpos = sip->name;
 		destpos = sip->short_name;
 		srcend = srcpos + strlen(sip->name);
-		destend = destpos + sizeof(sip->short_name) - 1;
 		while(srcpos < srcend)
 		{
 			if(*srcpos != ' ')
@@ -6414,7 +6413,7 @@
 		return;
 	}
 
-	int i, tm_num, diffuse_target = -1, glow_target = -1, glow_handle = -1, diffuse_handle = -1;
+	int i, tm_num, glow_target = -1, glow_handle = -1, diffuse_handle = -1;
 	int w, h;
 	cockpit_display new_display;
 
@@ -6425,7 +6424,6 @@
 	{
 		tm_num = pm->maps[i].FindTexture(display->filename);
 		if ( tm_num >= 0 ) {
-			diffuse_target = i*TM_NUM_TYPES;
 			glow_target = i*TM_NUM_TYPES+TM_GLOW_TYPE;
 
 			diffuse_handle = pm->maps[i].textures[TM_BASE_TYPE].GetTexture();
@@ -6591,6 +6589,7 @@
 
 	objnum = OBJ_INDEX(obj);
 	Assert( Ships[num].objnum == objnum );
+	(void)objnum;
 
 	shipp = &Ships[num];
 
@@ -15416,6 +15415,7 @@
 				// we need to make sure that the load count for the model is correct
 				test_id = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
 				Assert( test_id == model_previously_loaded );
+				(void)test_id;
 
 				break;
 			}
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/ship/shiphit.cpp C:\temp\fs2_open_3_7_0_RC2/code/ship/shiphit.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/ship/shiphit.cpp	2013-06-02 19:09:03.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/ship/shiphit.cpp	2013-06-28 21:54:50.000000000 +0200
@@ -2122,18 +2122,12 @@
 	// Apply leftover damage to the ship's subsystem and hull.
 	if ( (damage > 0.0f) || (subsystem_damage > 0.0f) )	{
 		int	weapon_info_index;
-		int armor_flags = 0;		
 		float pre_subsys = subsystem_damage; // Nuke: should be the last time we need to do this in this function
 		bool apply_hull_armor = true;
 		bool apply_diff_scale = true;
 
 		subsystem_damage = do_subobj_hit_stuff(ship_obj, other_obj, hitpos, submodel_num, subsystem_damage, &apply_hull_armor);
 
-		if(shipp->armor_type_idx != -1)
-		{
-			armor_flags = Armor_types[shipp->armor_type_idx].flags;
-		}
-
 		if(subsystem_damage > 0.0f){
 			damage *= (subsystem_damage / pre_subsys);
 		} else {
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/sound/rtvoice.cpp C:\temp\fs2_open_3_7_0_RC2/code/sound/rtvoice.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/sound/rtvoice.cpp	2010-05-29 17:53:18.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/sound/rtvoice.cpp	2013-06-28 21:53:59.000000000 +0200
@@ -68,7 +68,9 @@
 // recording/encoding buffers
 static unsigned char *Rtv_capture_raw_buffer;
 static unsigned char *Rtv_capture_compressed_buffer;
+#if 0
 static int Rtv_capture_compressed_buffer_size;
+#endif
 static int Rtv_capture_raw_buffer_size;
 
 // playback/decoding buffers
@@ -278,8 +280,7 @@
 // NOTE: function converts voice data into compressed format
 void rtvoice_get_data(unsigned char **outbuf, int *size, double *gain)
 {
-	int max_size, raw_size;
-	max_size = dscap_max_buffersize();
+	int raw_size;
 
 	*outbuf=NULL;
 
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/sound/sound.cpp C:\temp\fs2_open_3_7_0_RC2/code/sound/sound.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/sound/sound.cpp	2012-09-06 18:45:52.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/sound/sound.cpp	2013-06-28 23:01:28.000000000 +0200
@@ -1495,8 +1495,8 @@
 
 uint nextSignature = 0;
 
-game_snd::game_snd() : name ( SCP_string("") ), default_volume( 0 ),
-	preload( false ), id( -1 ), id_sig( -1 ), flags( 0 ), signature( nextSignature++ )
+game_snd::game_snd() : name ( SCP_string("") ), signature( nextSignature++ ), default_volume( 0 ),
+	preload( false ), id( -1 ), id_sig( -1 ), flags( 0 )
 	{
 		filename[0] = 0;
 		min = 0;
diff -urN C:\temp\fs2_open_3_7_0_RC2.orig/code/weapon/shockwave.cpp C:\temp\fs2_open_3_7_0_RC2/code/weapon/shockwave.cpp
--- C:\temp\fs2_open_3_7_0_RC2.orig/code/weapon/shockwave.cpp	2012-06-11 12:12:09.000000000 +0200
+++ C:\temp\fs2_open_3_7_0_RC2/code/weapon/shockwave.cpp	2013-06-28 22:35:52.000000000 +0200
@@ -710,6 +710,7 @@
 			// that it's ref_count is sane for this mission
 			int idx = model_load( Shockwave_info[i].filename, 0, NULL );
 			Assert( idx == Shockwave_info[i].model_id );
+			(void)idx;
 
 			model_page_in_textures( Shockwave_info[i].model_id );
 		}
scp_clang_fixes.diff (55,416 bytes)   

chief1983

2013-06-29 13:09

administrator   ~0015147

Awesome, thanks for going through that!

z64555

2013-06-29 14:18

developer   ~0015148

Modifications to controlsconfig.cpp in this patch look good to go.

I'm unsure about the deliberate use of void-casting to ignore the "set, but not read" warnings. Since it seems most of the variables that you have applied the void cast to are used solely, I would suggest maybe using #ifndef NDEBUG {} #else {} directives. This might be more cluttered, however.

Echelon9

2014-06-14 23:05

developer   ~0015872

Can we have a redone set of Clang warnings against the latest RC source code?

There's been significant changes to the source code in the last year, so I'm not sure how much these old reports are still valid.

chief1983

2014-06-27 14:19

administrator   ~0015931

I wonder if the user who submitted it is even checking up on this still. Would be nice to see though. I don't have a Linux-Clang box unfortunately though, so I can't really reproduce these warnings myself. Closest I can get is Apple's Clang or FreeBSD 10's. That latter might be a good one to start with though.

oldlaptop

2014-06-29 19:48

reporter   ~0015933

Last edited: 2014-06-29 19:53

Build logs as of r10840 from clang 3.4.1 (Debian clang version 3.4.1-4 (tags/RELEASE_34/dot1-final) (based on LLVM 3.4.1)) on Debian testing amd64:

Default CFLAGS/CXXFLAGS:
http://plantmonster.servebeer.com/~oldlaptop/fso/clang-3.4.1.release.log

-Weverything (should be every warning clang knows how to emit) and C/C++ standards set to C99/C++03. This is probably uselessly long at 12MB(!), but posting for completeness.
http://plantmonster.servebeer.com/~oldlaptop/fso/clang-3.4.1.release.weverything-c99-c++03.log

I'm perfectly willing and able to make more builds with different CFLAGS/CXXFLAGS if anyone wants.

chief1983

2014-06-30 14:12

administrator   ~0015965

So I guess we need to try to apply this patch and see how many it cleans up, if any of the hunks still apply?

Echelon9

2014-06-30 14:38

developer   ~0015967

Actually, I think it may be easier to review the logs oldlaptop has provided directly. For instance, I just committed a number of the more straight forward ones in 10860.

Can I suggest to oldlaptop that you prepare the clang logs with a debug configuration. There are sections of debug only code, which for instance may mean an otherwise unused variable is used.

I'm not aware of any release only code.

Echelon9

2014-06-30 15:25

developer   ~0015968

oldlaptop should run the clang warning log again with debug config and r10862. Should be plenty less warnings.

oldlaptop

2014-06-30 21:00

reporter   ~0015975

Same build options (but with --enable-debug) as of r10862:

(defaults - this is almost 150K smaller) http://plantmonster.servebeer.com/~oldlaptop/fso/r10862.clang-3.4.1.debug.log


(-Weverything, C99, C++03 - still absurdly large) http://plantmonster.servebeer.com/~oldlaptop/fso/r10862.clang-3.4.1.debug-Weverything-c99-c++03.log

Echelon9

2014-07-01 00:16

developer   ~0015980

Last edited: 2014-07-01 14:13

Thanks oldlaptop for re-running. I think I can get that list down even further reasonably quickly. Give me a few days.

Update: Looks like oldlaptop's server is done for now.

ngld

2014-07-01 20:38

reporter   ~0016008

Last edited: 2014-07-02 16:42

I guess it's no-ip.com or Microsoft causing the problem rather than oldlaptop's server: https://www.noip.com/blog/2014/06/30/ips-formal-statement-microsoft-takedown/

Edit: oldlaptop created a new domain:
http://plantmonster.ddns.net/~oldlaptop/fso/r10862.clang-3.4.1.debug.log
http://plantmonster.ddns.net/~oldlaptop/fso/r10862.clang-3.4.1.debug-Weverything-c99-c++03.log

oldlaptop

2014-07-01 21:25

reporter   ~0016009

Last edited: 2014-07-02 19:20

plantmonster.ddns.net should also work now, or as soon as the DNS records get propagated.

[EDIT] as should plantmonster.net

Echelon9

2014-07-05 15:48

developer   ~0016026

Okay, I've address a great many more of the clang warnings with revision 10885.

Would be interested in seeing what is left. Am aware of the "missing field 'type' initializer" ones.

oldlaptop

2014-07-07 20:13

reporter   ~0016038

Last edited: 2014-07-07 20:13

Down to 56K with default flags now:

http://plantmonster.net/~oldlaptop/fso/r10887.clang-3.4.1.debug.log
http://plantmonster.net/~oldlaptop/fso/r10887.clang-3.4.1.debug-Weverything-c99-c++03.log

Echelon9

2014-07-09 10:03

developer   ~0016042

A number of the Weverything warnings have now been addressed as of r10904.

oldlaptop

2014-07-16 20:55

reporter   ~0016077

Sorry about the delay. Logs as of r10918:

http://plantmonster.net/~oldlaptop/fso/r10918.clang-3.4.1.debug.log
http://plantmonster.net/~oldlaptop/fso/r10918.clang-3.4.1.debug-Weverything-c99-c++03.log

niffiwan

2014-07-17 23:26

developer   ~0016086

Added another patch from MageKing17 that clears up some more issues, compiles OK with gcc 4.4.7 & 4.8.0, I'll commit this tonight.

MageKing17

2014-07-18 00:28

developer   ~0016088

It was already committed in r10921.

oldlaptop

2014-07-24 02:57

reporter   ~0016123

Logs as of r10963:

http://plantmonster.net/~oldlaptop/fso/r10934.clang-3.4.1.debug.log
http://plantmonster.net/~oldlaptop/fso/r10934.clang-3.4.1.debug-Weverything-c99-c++03.log

Goober5000

2020-04-13 19:12

administrator   ~0016967

We have clang checks in Github now, and there was a massive clang warning fix within the past couple of years, so I'm marking this as resolved.

Issue History

Date Modified Username Field Change
2013-06-29 12:36 Firewave New Issue
2013-06-29 12:36 Firewave Status new => assigned
2013-06-29 12:36 Firewave Assigned To => chief1983
2013-06-29 12:36 Firewave File Added: scp_clang_fixes.diff
2013-06-29 13:09 chief1983 Note Added: 0015147
2013-06-29 14:18 z64555 Note Added: 0015148
2013-06-30 04:56 Echelon9 Status assigned => code review
2014-06-14 23:05 Echelon9 Note Added: 0015872
2014-06-27 14:19 chief1983 Note Added: 0015931
2014-06-29 19:48 oldlaptop Note Added: 0015933
2014-06-29 19:53 oldlaptop Note Edited: 0015933
2014-06-30 14:12 chief1983 Note Added: 0015965
2014-06-30 14:38 Echelon9 Note Added: 0015967
2014-06-30 15:25 Echelon9 Note Added: 0015968
2014-06-30 15:25 Echelon9 Status code review => feedback
2014-06-30 21:00 oldlaptop Note Added: 0015975
2014-07-01 00:16 Echelon9 Note Added: 0015980
2014-07-01 14:13 Echelon9 Note Edited: 0015980
2014-07-01 20:38 ngld Note Added: 0016008
2014-07-01 21:25 oldlaptop Note Added: 0016009
2014-07-02 16:42 ngld Note Edited: 0016008
2014-07-02 19:20 oldlaptop Note Edited: 0016009
2014-07-02 19:20 oldlaptop Note Edited: 0016009
2014-07-05 15:48 Echelon9 Note Added: 0016026
2014-07-07 20:13 oldlaptop Note Added: 0016038
2014-07-07 20:13 oldlaptop Note Edited: 0016038
2014-07-09 10:03 Echelon9 Note Added: 0016042
2014-07-16 20:55 oldlaptop Note Added: 0016077
2014-07-17 23:25 niffiwan File Added: clang.patch
2014-07-17 23:26 niffiwan Note Added: 0016086
2014-07-18 00:28 MageKing17 Note Added: 0016088
2014-07-18 00:31 niffiwan File Deleted: clang.patch
2014-07-24 02:57 oldlaptop Note Added: 0016123
2020-04-13 19:12 Goober5000 Status feedback => resolved
2020-04-13 19:12 Goober5000 Resolution open => fixed
2020-04-13 19:12 Goober5000 Note Added: 0016967
2020-04-13 19:19 Goober5000 Relationship added related to 0002895