From e8b8a12b7365c17cf0326be365b78bcb1da1bfac Mon Sep 17 00:00:00 2001
From: Graham Madarasz <graham@lindenlab.com>
Date: Tue, 12 Mar 2013 10:48:05 -0700
Subject: [PATCH] Mods to make compile on gcc 4.6.3 work mo betta

---
 indra/cmake/00-Common.cmake                       | 4 ++++
 indra/llmath/llvolume.cpp                         | 5 -----
 indra/llmessage/lliosocket.cpp                    | 1 +
 indra/llui/llconsole.cpp                          | 2 --
 indra/llui/llkeywords.cpp                         | 2 +-
 indra/llui/lllayoutstack.cpp                      | 2 +-
 indra/llui/lltextbase.cpp                         | 3 ++-
 indra/llui/lltexteditor.cpp                       | 1 -
 indra/llui/lltoolbar.cpp                          | 4 +---
 indra/lscript/lscript_execute/lscript_readlso.cpp | 6 +++---
 indra/test/io.cpp                                 | 1 +
 indra/test/llstreamtools_tut.cpp                  | 8 +++++++-
 indra/test/lltemplatemessagebuilder_tut.cpp       | 2 ++
 13 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 6bfd8c14d60..aa1d50b993a 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -135,6 +135,10 @@ if (LINUX)
     set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-uninitialized -Wno-unused-variable -Wno-unused-function ${CMAKE_CXX_FLAGS}")
   endif (${CXX_VERSION_NUMBER} LESS 420)
 
+  if(${CXX_VERSION_NUMBER} GREATER 459)
+    set(CMAKE_CXX_FLAGS "-Wno-deprecated -Wno-unused-but-set-variable -Wno-unused-variable ${CMAKE_CXX_FLAGS}")
+  endif (${CXX_VERSION_NUMBER} GREATER 459)
+
   # gcc 4.3 and above don't like the LL boost and also
   # cause warnings due to our use of deprecated headers
   if(${CXX_VERSION_NUMBER} GREATER 429)
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index eff224743ba..cb5633c1bb1 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -5314,12 +5314,7 @@ BOOL LLVolumeFace::createUnCutCubeCap(LLVolume* volume, BOOL partial_build)
 	S32 max_t = volume->getPath().mPath.size();
 
 	// S32 i;
-	S32 num_vertices = 0, num_indices = 0;
 	S32	grid_size = (profile.size()-1)/4;
-	S32	quad_count = (grid_size * grid_size);
-
-	num_vertices = (grid_size+1)*(grid_size+1);
-	num_indices = quad_count * 4;
 
 	LLVector4a& min = mExtents[0];
 	LLVector4a& max = mExtents[1];
diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp
index 0287026659a..7713e553ef6 100644
--- a/indra/llmessage/lliosocket.cpp
+++ b/indra/llmessage/lliosocket.cpp
@@ -592,6 +592,7 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(
 	PUMP_DEBUG;
 	apr_pool_t* new_pool = NULL;
 	apr_status_t status = apr_pool_create(&new_pool, mPool);
+	(void)status;
 	apr_socket_t* socket = NULL;
 	status = apr_socket_accept(
 		&socket,
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index 161496b1f5a..fdfaf284dec 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -243,8 +243,6 @@ void LLConsole::draw()
 void LLConsole::Paragraph::makeParagraphColorSegments (const LLColor4 &color) 
 {
 	LLSD paragraph_color_segments;
-	LLColor4 lcolor=color;
-	
 	paragraph_color_segments[0]["text"] =wstring_to_utf8str(mParagraphText);
 	LLSD color_sd = color.getValue();
 	paragraph_color_segments[0]["color"]=color_sd;
diff --git a/indra/llui/llkeywords.cpp b/indra/llui/llkeywords.cpp
index c1cd04186bd..537cc823021 100644
--- a/indra/llui/llkeywords.cpp
+++ b/indra/llui/llkeywords.cpp
@@ -368,7 +368,7 @@ void LLKeywords::findSegments(std::vector<LLTextSegmentPtr>* seg_list, const LLW
 	const llwchar* base = wtext.c_str();
 	const llwchar* cur = base;
 	const llwchar* line = NULL;
-
+        (void)line;
 	while( *cur )
 	{
 		if( *cur == '\n' || cur == base )
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index c93f5385700..32383b1f1d8 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -481,7 +481,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp)
 		{
 			LLResizeBar::Side side = (mOrientation == HORIZONTAL) ? LLResizeBar::RIGHT : LLResizeBar::BOTTOM;
 			LLRect resize_bar_rect = getRect();
-
+			(void)resize_bar_rect;
 			LLResizeBar::Params resize_params;
 			resize_params.name("resize");
 			resize_params.resizing_view(lp);
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 3815eec447e..ec66b6df566 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -351,7 +351,6 @@ void LLTextBase::drawSelectionBackground()
 
 		S32 selection_left		= llmin( mSelectionStart, mSelectionEnd );
 		S32 selection_right		= llmax( mSelectionStart, mSelectionEnd );
-		LLRect selection_rect = mVisibleTextRect;
 
 		// Skip through the lines we aren't drawing.
 		LLRect content_display_rect = getVisibleDocumentRect();
@@ -2241,6 +2240,8 @@ S32 LLTextBase::getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round,
 	// Figure out which line we're nearest to.
 	LLRect visible_region = getVisibleDocumentRect();
 	LLRect doc_rect = mDocumentView->getRect();
+	(void)visible_region;
+	(void)doc_rect;
 
 	S32 doc_y = local_y - doc_rect.mBottom;
 	
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 46fbd1e6a0f..e4bd51c8ce2 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2490,7 +2490,6 @@ void LLTextEditor::updateSegments()
 		mKeywords.findSegments(&segment_list, getWText(), mDefaultColor.get(), *this);
 
 		clearSegments();
-		segment_set_t::iterator insert_it = mSegments.begin();
 		for (segment_vec_t::iterator list_it = segment_list.begin(); list_it != segment_list.end(); ++list_it)
 		{
 			insertSegment(*list_it);
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 63b7e452d2a..62b6a0cd2fe 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -653,7 +653,6 @@ void LLToolBar::updateLayoutAsNeeded()
 	S32 max_row_length = 0;
 
 	S32 max_length;
-	S32 max_total_girth;
 	S32 cur_start;
 	S32 cur_row ;
 	S32 row_pad_start;
@@ -664,7 +663,6 @@ void LLToolBar::updateLayoutAsNeeded()
 	if (orientation == LLLayoutStack::HORIZONTAL)
 	{
 		max_length = getRect().getWidth() - mPadLeft - mPadRight;
-		max_total_girth = getRect().getHeight() - mPadTop - mPadBottom;
 		row_pad_start = mPadLeft;
 		row_pad_end = mPadRight;
 		cur_row = mPadTop;
@@ -673,7 +671,6 @@ void LLToolBar::updateLayoutAsNeeded()
 	else // VERTICAL
 	{
 		max_length = getRect().getHeight() - mPadTop - mPadBottom;
-		max_total_girth = getRect().getWidth() - mPadLeft - mPadRight;
 		row_pad_start = mPadTop;
 		row_pad_end = mPadBottom;
 		cur_row = mPadLeft;
@@ -842,6 +839,7 @@ void LLToolBar::draw()
 	{
 		LLRect caret_rect = caret->getRect();
 		LLRect toolbar_rect = getRect();
+		(void)toolbar_rect;
 		if (getOrientation(mSideType) == LLLayoutStack::HORIZONTAL)
 		{
 			caret->setRect(LLRect(mDragx-caret_rect.getWidth()/2+1,
diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp
index 35caa41ae18..3cdb41ac178 100644
--- a/indra/lscript/lscript_execute/lscript_readlso.cpp
+++ b/indra/lscript/lscript_execute/lscript_readlso.cpp
@@ -145,7 +145,7 @@ void LLScriptLSOParse::printGlobals(LLFILE *fp)
 		// get offset to skip past name
 		varoffset = global_v_offset;
 		offset = bytestream2integer(mRawData, global_v_offset);
-		
+		(void)offset; //hush little compiler
 		// get typeexport
 		type = *(mRawData + global_v_offset++);
 
@@ -262,8 +262,6 @@ void LLScriptLSOParse::printGlobalFunctions(LLFILE *fp)
 		fprintf(fp, "[Function #%d] [0x%X] %s\n", function_number, orig_function_offset, name);
 		fprintf(fp, "\tReturn Type: %s\n", LSCRIPTTypeNames[type]);
 		type = *(mRawData + function_offset++);
-		S32 params;
-		params = 0;
 		S32 pcount = 0;
 		while (type)
 		{
@@ -350,6 +348,7 @@ void LLScriptLSOParse::printStates(LLFILE *fp)
 				S32 dummy;
 
 				opcode_end = worst_case_opcode_end;
+				(void)opcode_end;
 
 				for (k = LSTT_STATE_BEGIN; k < LSTT_STATE_END; k++)
 				{
@@ -357,6 +356,7 @@ void LLScriptLSOParse::printStates(LLFILE *fp)
 					{
 						temp_end = bytestream2integer(mRawData, read_ahead);
 						dummy = bytestream2integer(mRawData, read_ahead);
+						(void)dummy;
 						if (  (temp_end < opcode_end)
 							&&(temp_end > event_offset))
 						{
diff --git a/indra/test/io.cpp b/indra/test/io.cpp
index ce747f667d2..7f26ac67246 100644
--- a/indra/test/io.cpp
+++ b/indra/test/io.cpp
@@ -1141,6 +1141,7 @@ namespace tut
 		ensure("Connected to server", connected);
 		lldebugs << "connected" << llendl;
 		F32 elapsed = pump_loop(mPump,0.1f);
+		(void)elapsed;
 		count = mPump->runningChains();
 		ensure_equals("server chain onboard", count, 2);
 		lldebugs << "** Client is connected." << llendl;
diff --git a/indra/test/llstreamtools_tut.cpp b/indra/test/llstreamtools_tut.cpp
index a93f2e8f65e..68e56b5ee2d 100644
--- a/indra/test/llstreamtools_tut.cpp
+++ b/indra/test/llstreamtools_tut.cpp
@@ -386,15 +386,17 @@ namespace tut
 		std::string actual_result;
 		std::istringstream is;
 		bool ret;
-
 		is.clear();
 		is.str(str = "  First Second \t \r  \n Third  Fourth-ShouldThisBePartOfFourth  Fifth\n");
 		actual_result = "";
 		ret = get_word(actual_result, is); // First
+		(void)ret;
 		actual_result = "";
 		ret = get_word(actual_result, is); // Second
+		(void)ret;
 		actual_result = "";
 		ret = get_word(actual_result, is); // Third
+		(void)ret;
 
 		// the current implementation of get_word seems inconsistent with
 		// skip_to_next_word. skip_to_next_word treats any character other
@@ -486,6 +488,7 @@ namespace tut
 		is.str(str = "First Second \t \r\n Third  Fourth-ShouldThisBePartOfFourth  IsThisFifth\n");
 		actual_result = "";
 		ret = get_line(actual_result, is);
+		(void)ret;
 		expected_result = "First Second \t \r\n";
 		ensure_equals("get_line: 1", actual_result, expected_result);
 
@@ -551,6 +554,7 @@ namespace tut
 		is.str(str = "Should not skip lone \r.\r\n");
 		actual_result = "";
 		ret = get_line(actual_result, is);
+		(void)ret;
 		expected_result = "Should not skip lone \r.\r\n";
 		ensure_equals("get_line: carriage return skipped even though not followed by newline", actual_result, expected_result);
 	}
@@ -569,6 +573,7 @@ namespace tut
 		is.str(str = "\n");
 		actual_result = "";
 		ret = get_line(actual_result, is);
+		(void)ret;
 		expected_result = "\n";
 		ensure_equals("get_line: Just newline", actual_result, expected_result);
 	}
@@ -588,6 +593,7 @@ namespace tut
 		is.str(str = "First Line.\nSecond Line.\n");
 		actual_result = "";
 		ret = get_line(actual_result, is, 255);
+		(void)ret;
 		expected_result = "First Line.\n";
 		ensure_equals("get_line: Basic Operation", actual_result, expected_result);
 
diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp
index 6e1c82bb246..0aad3cbc156 100644
--- a/indra/test/lltemplatemessagebuilder_tut.cpp
+++ b/indra/test/lltemplatemessagebuilder_tut.cpp
@@ -958,11 +958,13 @@ namespace tut
 		reader->validateMessage(buffer, builtSize, LLHost());
 		reader->readMessage(buffer, LLHost());
 		reader->getU32(_PREHASH_Test0, _PREHASH_Test0, outValue);
+		(void)outValue;
 		char outBuffer[bufferSize];
 		memset(buffer, 0xcc, bufferSize);
 		reader->getString(_PREHASH_Test1, _PREHASH_Test0, bufferSize, 
 						  outBuffer);
 		outValue2 = reader->getNumberOfBlocks(_PREHASH_Test1);
+		(void)outValue2;
 		ensure_equals("Ensure present value ", outValue, inValue);
 		ensure_equals("Ensure unchanged buffer ", strlen(outBuffer), 0);
 		delete reader;
-- 
GitLab