From a5f5d75e8231f411231865cf93502e1071f33dfe Mon Sep 17 00:00:00 2001 From: Daniel Gibson Date: Fri, 14 Dec 2012 00:52:31 +0100 Subject: [PATCH] Use -O0 for Debug builds, make sure that compiles because of some GCC bug the included refactoring in PacketProcessor.* was necessary --- neo/CMakeLists.txt | 2 +- neo/sys/PacketProcessor.cpp | 11 +++++++++++ neo/sys/PacketProcessor.h | 18 +++++++++++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 1895b2f9..3c42cb3f 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -32,7 +32,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") add_definitions(-DUSE_EXCEPTIONS) #endif() - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O1 -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0 -ggdb -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch") #set(CMAKE_C_FLAGS_DEBUGALL "${CMAKE_C_FLAGS_DEBUGALL} -g -ggdb -D_DEBUG -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch") #set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} -g -ggdb -D_DEBUG -O1 -fno-omit-frame-pointer -Wunknown-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -ffast-math -fno-unsafe-math-optimizations -fomit-frame-pointer -Wno-pragmas -fno-strict-aliasing -Wno-unused-variable -Wno-unused-but-set-variable -Wno-switch") diff --git a/neo/sys/PacketProcessor.cpp b/neo/sys/PacketProcessor.cpp index c2c243d5..63e6fe60 100644 --- a/neo/sys/PacketProcessor.cpp +++ b/neo/sys/PacketProcessor.cpp @@ -28,6 +28,17 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "../idlib/precompiled.h" +#include "PacketProcessor.h" + +// DG: workaround for GCC bug +const int idPacketProcessor::RETURN_TYPE_NONE = 0; +const int idPacketProcessor::RETURN_TYPE_OOB = 1; +const int idPacketProcessor::RETURN_TYPE_INBAND = 2; + +const int idPacketProcessor::FRAGMENT_START = 0; +const int idPacketProcessor::FRAGMENT_MIDDLE = 1; +const int idPacketProcessor::FRAGMENT_END = 2; +// DG end idCVar net_maxRate( "net_maxRate", "50", CVAR_INTEGER, "max send rate in kilobytes per second" ); diff --git a/neo/sys/PacketProcessor.h b/neo/sys/PacketProcessor.h index 15b7525e..e76c1245 100644 --- a/neo/sys/PacketProcessor.h +++ b/neo/sys/PacketProcessor.h @@ -36,10 +36,11 @@ idPacketProcessor class idPacketProcessor { public: - static const int RETURN_TYPE_NONE = 0; - static const int RETURN_TYPE_OOB = 1; - static const int RETURN_TYPE_INBAND = 2; - + // DG: workaround for GCC bug (can't link when compiling with -O0): put definitions in PacketProcessor.cpp + static const int RETURN_TYPE_NONE; // = 0; + static const int RETURN_TYPE_OOB; // = 1; + static const int RETURN_TYPE_INBAND; // = 2; + // DG end typedef uint16 sessionId_t; static const int NUM_LOBBY_TYPE_BITS = 2; @@ -229,10 +230,13 @@ private: static const int PACKET_TYPE_RELIABLE_ACK = 2; // Header type used to piggy-back on top of msgs to ack reliable msg's static const int PACKET_TYPE_FRAGMENTED = 3; // The msg is fragmented, fragment type stored in the userData portion of header + // PACKET_TYPE_FRAGMENTED userData values - static const int FRAGMENT_START = 0; - static const int FRAGMENT_MIDDLE = 1; - static const int FRAGMENT_END = 2; + // DG: workaround for GCC bug (can't link when compiling with -O0): put definitions in PacketProcessor.cpp + static const int FRAGMENT_START; // = 0; + static const int FRAGMENT_MIDDLE; // = 1; + static const int FRAGMENT_END; // = 2; + // DG end class idOuterPacketHeader {