← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/compiler_warnings_mac into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/compiler_warnings_mac into lp:widelands.

Requested reviews:
  Widelands Developers (widelands-dev)

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/compiler_warnings_mac/+merge/329090

Let's see if this will shut up the compiler warnings for Mac.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/compiler_warnings_mac into lp:widelands.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2017-08-05 14:31:23 +0000
+++ CMakeLists.txt	2017-08-16 07:37:24 +0000
@@ -143,6 +143,11 @@
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Werror=non-pod-varargs")
 
   wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Qunused-arguments")
+
+  # For XCode builds on Mac, dummy .cc files are not enough to suppress warnings.
+  # https://stackoverflow.com/questions/4929255/building-static-libraries-on-mac-using-cmake-and-gcc
+  wl_add_flag(CMAKE_C_ARCHIVE_FINISH "-no_warning_for_no_symbols")
+  wl_add_flag(CMAKE_CXX_ARCHIVE_FINISH "-no_warning_for_no_symbols")
 else()
   # Assuming GCC 4.8 or higher.
   if(WIN32)

=== modified file 'src/ai/ai_help_structs.cc'
--- src/ai/ai_help_structs.cc	2017-07-25 20:56:04 +0000
+++ src/ai/ai_help_structs.cc	2017-08-16 07:37:24 +0000
@@ -552,9 +552,6 @@
 		case DnaParent::kSecondary:
 			set_military_number_at(i, AI_military_numbers_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for military numbers\n");
-			NEVER_HERE();
 		}
 	}
 
@@ -576,9 +573,6 @@
 			_persistent_data->neuron_weights.push_back(input_weights_P2[i]);
 			_persistent_data->neuron_functs.push_back(input_func_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for neurons\n");
-			NEVER_HERE();
 		}
 	}
 
@@ -593,9 +587,6 @@
 		case DnaParent::kSecondary:
 			_persistent_data->f_neurons.push_back(f_neurons_P2[i]);
 			break;
-		default:
-			log("Invalid dna_donor for f-neurons\n");
-			NEVER_HERE();
 		}
 	}
 

=== modified file 'src/ai/defaultai.cc'
--- src/ai/defaultai.cc	2017-08-01 12:03:03 +0000
+++ src/ai/defaultai.cc	2017-08-16 07:37:24 +0000
@@ -64,9 +64,7 @@
 constexpr int kMarineDecisionInterval = 20 * 1000;
 constexpr int kRemainingBasicBuildingsResetTime = 1 * 60 * 1000;
 
-// following two are used for roads management, for creating shortcuts and dismantling dispensable
-// roads
-constexpr int32_t kSpotsTooLittle = 15;
+// Used for roads management, for creating shortcuts and dismantling dispensable roads
 constexpr int32_t kSpotsEnough = 25;
 
 constexpr uint16_t kTargetQuantCap = 30;
@@ -686,7 +684,7 @@
 			for (const DescriptionIndex& temp_output : prod.output_ware_types()) {
 				bo.outputs.push_back(temp_output);
 			}
-			for (const auto temp_position : prod.working_positions()) {
+			for (const auto& temp_position : prod.working_positions()) {
 				bo.positions.push_back(temp_position.first);
 			}
 
@@ -6120,8 +6118,6 @@
 	case WoodPolicy::kStopRangers:
 		wpolicy = "Stop rangers";
 		break;
-	default:
-		wpolicy = "unknown";
 	}
 }
 

=== modified file 'src/map_io/map_players_view_packet.cc'
--- src/map_io/map_players_view_packet.cc	2017-06-24 08:47:46 +0000
+++ src/map_io/map_players_view_packet.cc	2017-08-16 07:37:24 +0000
@@ -78,7 +78,7 @@
 constexpr uint8_t kCurrentPacketVersionBorder = 1;
 #define BORDER_FILENAME_TEMPLATE DIRNAME_TEMPLATE "/border_%u"
 
-#define FILENAME_SIZE 48
+#define FILENAME_SIZE 50
 
 enum {
 	UNSEEN_NONE = 0,


Follow ups