1
0

Fix debug macro situation (#5114)

Use the standard NDEBUG.
This commit is contained in:
Tiger Wang 2021-01-26 09:41:55 +00:00 committed by GitHub
parent 19302eeb87
commit 50a94f972d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 99 additions and 131 deletions

View File

@ -45,11 +45,6 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# TODO: use standard NDEBUG in place of _DEBUG
if("${CMAKE_BUILD_TYPE}" MATCHES "DEBUG")
add_definitions(-D_DEBUG)
endif()
# The need for speed (in Release):
if(WHOLE_PROGRAM_OPTIMISATION)
include(CheckIPOSupported)

View File

@ -88,15 +88,6 @@ function(set_global_flags)
# Make build use Unicode:
add_compile_definitions(UNICODE _UNICODE)
else()
# TODO: is this needed? NDEBUG is standard. Also, why are we using _DEBUG?
# Add the preprocessor macros used for distinguishing between debug and release builds (CMake does this automatically for MSVC):
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -D_DEBUG")
set(CMAKE_C_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG")
endif()
# Allow for a forced 32-bit build under 64-bit OS:

View File

@ -100,7 +100,7 @@ public:
void * space = malloc(sizeof(T));
if (space != nullptr)
{
#if defined(_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
// The debugging-new that is set up using macros in Globals.h doesn't support the placement-new syntax used here.
// Temporarily disable the macro
#pragma push_macro("new")
@ -109,7 +109,7 @@ public:
return new(space) T;
#if defined(_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
// Re-enable the debugging-new macro
#pragma pop_macro("new")
#endif
@ -127,7 +127,7 @@ public:
}
// placement new, used to initalize the object
#if defined(_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
// The debugging-new that is set up using macros in Globals.h doesn't support the placement-new syntax used here.
// Temporarily disable the macro
#pragma push_macro("new")
@ -136,7 +136,7 @@ public:
T * ret = new (m_FreeList.front()) T;
#if defined(_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
// Re-enable the debugging-new macro
#pragma pop_macro("new")
#endif

View File

@ -388,10 +388,8 @@ cLuaState::cStackTable::cStackTable(cLuaState & a_LuaState, int a_StackPos):
void cLuaState::cStackTable::ForEachArrayElement(cFunctionRef<bool(cLuaState & a_LuaState, int a_Index)> a_ElementCallback) const
{
auto numElements = luaL_getn(m_LuaState, m_StackPos);
#ifdef _DEBUG
auto stackTop = lua_gettop(m_LuaState);
#endif
const auto numElements = luaL_getn(m_LuaState, m_StackPos);
[[maybe_unused]] const auto stackTop = lua_gettop(m_LuaState);
for (int idx = 1; idx <= numElements; idx++)
{
// Push the idx-th element of the array onto stack top and call the callback:
@ -413,9 +411,7 @@ void cLuaState::cStackTable::ForEachArrayElement(cFunctionRef<bool(cLuaState & a
void cLuaState::cStackTable::ForEachElement(cFunctionRef<bool(cLuaState & a_LuaState)> a_ElementCallback) const
{
#ifdef _DEBUG
auto stackTop = lua_gettop(m_LuaState);
#endif
[[maybe_unused]] const auto stackTop = lua_gettop(m_LuaState);
lua_pushvalue(m_LuaState, m_StackPos); // Stk: <table>
lua_pushnil(m_LuaState); // Stk: <table> nil
while (lua_next(m_LuaState, -2)) // Stk: <table> <key> <val>
@ -2255,11 +2251,10 @@ int cLuaState::CopyStackFrom(cLuaState & a_SrcLuaState, int a_SrcStart, int a_Sr
bool cLuaState::CopyTableFrom(cLuaState & a_SrcLuaState, int a_SrcStackIdx, int a_NumAllowedNestingLevels)
{
[[maybe_unused]] const auto srcTop = lua_gettop(a_SrcLuaState);
[[maybe_unused]] const auto dstTop = lua_gettop(m_LuaState);
// Create the dest table:
#ifdef _DEBUG
auto srcTop = lua_gettop(a_SrcLuaState);
auto dstTop = lua_gettop(m_LuaState);
#endif
lua_createtable(m_LuaState, 0, 0); // DST: <table>
lua_pushvalue(a_SrcLuaState, a_SrcStackIdx); // SRC: <table>
lua_pushnil(a_SrcLuaState); // SRC: <table> <key>

View File

@ -58,7 +58,7 @@ class cLuaState
{
public:
#ifdef _DEBUG
#ifndef NDEBUG
/** Asserts that the Lua stack has the same amount of entries when this object is destructed, as when it was constructed.
Used for checking functions that should preserve Lua stack balance. */
class cStackBalanceCheck

View File

@ -115,7 +115,7 @@ bool cByteBuffer::Write(const void * a_Bytes, size_t a_Count)
// Store the current free space for a check after writing:
size_t CurFreeSpace = GetFreeSpace();
#ifdef _DEBUG
#ifndef NDEBUG
size_t CurReadableSpace = GetReadableSpace();
#endif
size_t WrittenBytes = 0;

View File

@ -149,7 +149,7 @@ protected:
size_t m_WritePos; // Where the data ends in the ringbuffer
size_t m_ReadPos; // Where the next read will start in the ringbuffer
#ifdef _DEBUG
#ifndef NDEBUG
/** The ID of the thread currently accessing the object.
Used for checking that only one thread accesses the object at a time, via cSingleThreadAccessChecker. */
mutable std::thread::id m_ThreadID;

View File

@ -338,7 +338,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
m_BlockEntities = std::move(a_SetChunkData.GetBlockEntities());
// Check that all block entities have a valid blocktype at their respective coords (DEBUG-mode only):
#ifdef _DEBUG
#ifndef NDEBUG
for (auto & KeyPair : m_BlockEntities)
{
cBlockEntity * Block = KeyPair.second.get();
@ -346,7 +346,7 @@ void cChunk::SetAllData(cSetChunkData & a_SetChunkData)
BLOCKTYPE WorldBlockType = GetBlock(Block->GetRelX(), Block->GetPosY(), Block->GetRelZ());
ASSERT(WorldBlockType == EntityBlockType);
} // for KeyPair - m_BlockEntities
#endif // _DEBUG
#endif // !NDEBUG
// Set all block entities' World variable:
for (auto & KeyPair : m_BlockEntities)

View File

@ -250,15 +250,10 @@ void cChunkGeneratorThread::DoGenerate(cChunkCoords a_Coords)
m_Generator->Generate(ChunkDesc);
m_PluginInterface->CallHookChunkGenerated(ChunkDesc);
#ifdef _DEBUG
#ifndef NDEBUG
// Verify that the generator has produced valid data:
ChunkDesc.VerifyHeightmap();
#endif
m_ChunkSink->OnChunkGenerated(ChunkDesc);
}

View File

@ -196,9 +196,7 @@ void cCraftingGrid::Dump(void)
{
for (int y = 0; y < m_Height; y++) for (int x = 0; x < m_Width; x++)
{
#ifdef _DEBUG
int idx = x + m_Width * y;
#endif
[[maybe_unused]] const int idx = x + m_Width * y;
LOGD("Slot (%d, %d): Type %d, health %d, count %d",
x, y, m_Items[idx].m_ItemType, m_Items[idx].m_ItemDamage, m_Items[idx].m_ItemCount
);

View File

@ -105,9 +105,9 @@ public:
cChunkDef::HeightMap & a_HeightMap
);
#ifdef _DEBUG
#ifndef NDEBUG
AString ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) const;
#endif // _DEBUG
#endif // !NDEBUG
} ;
typedef std::vector<cCaveTunnel *> cCaveTunnels;
@ -530,7 +530,7 @@ void cCaveTunnel::ProcessChunk(
} // for itr - m_Points[]
/*
#ifdef _DEBUG
#ifndef NDEBUG
// For debugging purposes, outline the shape of the cave using glowstone, after carving the entire cave:
for (cCaveDefPoints::const_iterator itr = m_Points.begin(), end = m_Points.end(); itr != end; ++itr)
{
@ -545,7 +545,7 @@ void cCaveTunnel::ProcessChunk(
cChunkDef::SetBlock(a_BlockTypes, DifX, itr->m_BlockY, DifZ, E_BLOCK_GLOWSTONE);
}
} // for itr - m_Points[]
#endif // _DEBUG
#endif // !NDEBUG
//*/
}
@ -553,7 +553,7 @@ void cCaveTunnel::ProcessChunk(
#ifdef _DEBUG
#ifndef NDEBUG
AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) const
{
AString SVG;
@ -568,7 +568,7 @@ AString cCaveTunnel::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) cons
SVG.append("\"/>\n");
return SVG;
}
#endif // _DEBUG
#endif // !NDEBUG

View File

@ -647,7 +647,7 @@ void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
#ifdef _DEBUG
#ifndef NDEBUG
void cChunkDesc::VerifyHeightmap(void)
{
@ -669,7 +669,7 @@ void cChunkDesc::VerifyHeightmap(void)
} // for x
}
#endif // _DEBUG
#endif // !NDEBUG

View File

@ -229,10 +229,10 @@ public:
/** Compresses the metas from the BlockArea format (1 meta per byte) into regular format (2 metas per byte) */
void CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas);
#ifdef _DEBUG
#ifndef NDEBUG
/** Verifies that the heightmap corresponds to blocktype contents; if not, asserts on that column */
void VerifyHeightmap(void);
#endif // _DEBUG
#endif // !NDEBUG
private:
cChunkCoords m_Coords;

View File

@ -364,13 +364,13 @@ cCompoGenCache::~cCompoGenCache()
void cCompoGenCache::ComposeTerrain(cChunkDesc & a_ChunkDesc, const cChunkDesc::Shape & a_Shape)
{
#ifdef _DEBUG
#ifndef NDEBUG
if (((m_NumHits + m_NumMisses) % 1024) == 10)
{
// LOGD("CompoGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses));
// LOGD("CompoGenCache: Avg cache chain length: %.2f", static_cast<float>(m_TotalChain) / m_NumHits);
}
#endif // _DEBUG
#endif // !NDEBUG
int ChunkX = a_ChunkDesc.GetChunkX();
int ChunkZ = a_ChunkDesc.GetChunkZ();

View File

@ -63,10 +63,10 @@ public:
cRavine(int a_GridX, int a_GridZ, int a_OriginX, int a_OriginZ, int a_Size, cNoise & a_Noise);
#ifdef _DEBUG
#ifndef NDEBUG
/** Exports itself as a SVG line definition */
AString ExportAsSVG(int a_Color, int a_OffsetX = 0, int a_OffsetZ = 0) const;
#endif // _DEBUG
#endif // !NDEBUG
protected:
// cGridStructGen::cStructure overrides:
@ -277,7 +277,7 @@ void cStructGenRavines::cRavine::FinishLinear(void)
#ifdef _DEBUG
#ifndef NDEBUG
AString cStructGenRavines::cRavine::ExportAsSVG(int a_Color, int a_OffsetX, int a_OffsetZ) const
{
AString SVG;
@ -318,7 +318,7 @@ AString cStructGenRavines::cRavine::ExportAsSVG(int a_Color, int a_OffsetX, int
}
return SVG;
}
#endif // _DEBUG
#endif // !NDEBUG
@ -349,13 +349,13 @@ void cStructGenRavines::cRavine::DrawIntoChunk(cChunkDesc & a_ChunkDesc)
int DifZ = BlockStartZ - itr->m_BlockZ; // substitution for faster calc
for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++)
{
#ifdef _DEBUG
#ifndef NDEBUG
// DEBUG: Make the ravine shapepoints visible on a single layer (so that we can see with Minutor what's going on)
if ((DifX + x == 0) && (DifZ + z == 0))
{
a_ChunkDesc.SetBlockType(x, 4, z, E_BLOCK_LAPIS_ORE);
}
#endif // _DEBUG
#endif // !NDEBUG
int DistSq = (DifX + x) * (DifX + x) + (DifZ + z) * (DifZ + z);
if (DistSq <= RadiusSq)

View File

@ -181,13 +181,13 @@ protected:
float DifZ = BlockStartZ - itr->m_Z; // substitution for faster calc
for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++)
{
#ifdef _DEBUG
#ifndef NDEBUG
// DEBUG: Make the roughravine shapepoints visible on a single layer (so that we can see with Minutor what's going on)
if ((FloorC(DifX + x) == 0) && (FloorC(DifZ + z) == 0))
{
a_ChunkDesc.SetBlockType(x, 4, z, E_BLOCK_LAPIS_ORE);
}
#endif // _DEBUG
#endif // !NDEBUG
// If the column is outside the enlarged radius, bail out completely
float DistSq = (DifX + x) * (DifX + x) + (DifZ + z) * (DifZ + z);

View File

@ -45,22 +45,20 @@
// Use non-standard defines in <cmath>
#define _USE_MATH_DEFINES
#ifdef _DEBUG
#ifndef NDEBUG
// Override the "new" operator to include file and line specification for debugging memory leaks
// Ref.: https://social.msdn.microsoft.com/Forums/en-US/ebc7dd7a-f3c6-49f1-8a60-e381052f21b6/debugging-memory-leaks?forum=vcgeneral#53f0cc89-62fe-45e8-bbf0-56b89f2a1901
// This causes MSVC Debug runs to produce a report upon program exit, that contains memory-leaks
// together with the file:line information about where the memory was allocated.
// Note that this doesn't work with placement-new, which needs to temporarily #undef the macro
// (See AllocationPool.h for an example).
#ifdef _DEBUG
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_CLIENTBLOCK new(_CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_CLIENTBLOCK
// For some reason this works magically - each "new X" gets replaced as "new(_CLIENT_BLOCK, "file", line) X"
// The CRT has a definition for this operator new that stores the debugging info for leak-finding later.
#endif
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#define DEBUG_CLIENTBLOCK new(_CLIENT_BLOCK, __FILE__, __LINE__)
#define new DEBUG_CLIENTBLOCK
// For some reason this works magically - each "new X" gets replaced as "new(_CLIENT_BLOCK, "file", line) X"
// The CRT has a definition for this operator new that stores the debugging info for leak-finding later.
#endif
#elif defined(__GNUC__)
@ -277,10 +275,10 @@ template class SizeChecker<UInt8, 1>;
int lineNumber() const { return mLineNumber; }
};
#ifdef _DEBUG
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure(#x, __FILE__, __LINE__);} } while (0)
#ifdef NDEBUG
#define ASSERT(x)
#else
#define ASSERT(...)
#define ASSERT(x) do { if (!(x)) { throw cAssertFailure(#x, __FILE__, __LINE__);} } while (0)
#endif
// Pretty much the same as ASSERT() but stays in Release builds
@ -288,10 +286,10 @@ template class SizeChecker<UInt8, 1>;
#else // TEST_GLOBALS
#ifdef _DEBUG
#define ASSERT(x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), std::abort(), 0))
#else
#ifdef NDEBUG
#define ASSERT(x)
#else
#define ASSERT(x) ( !!(x) || ( LOGERROR("Assertion failed: %s, file %s, line %i", #x, __FILE__, __LINE__), std::abort(), 0))
#endif
// Pretty much the same as ASSERT() but stays in Release builds

View File

@ -123,11 +123,10 @@ template <typename TYPE> void LinearUpscale2DArray(
RatioY[y] = static_cast<TYPE>(y) / a_UpscaleY;
}
const int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1;
[[maybe_unused]] const int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1;
// Interpolate each XY cell:
int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1;
#ifdef _DEBUG
int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1;
#endif
for (int y = 0; y < (a_SrcSizeY - 1); y++)
{
int DstY = y * a_UpscaleY;
@ -204,12 +203,11 @@ template <typename TYPE> void LinearUpscale3DArray(
RatioZ[z] = static_cast<TYPE>(z) / a_UpscaleZ;
}
const int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1;
const int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1;
[[maybe_unused]] const int DstSizeZ = (a_SrcSizeZ - 1) * a_UpscaleZ + 1;
// Interpolate each XYZ cell:
int DstSizeX = (a_SrcSizeX - 1) * a_UpscaleX + 1;
int DstSizeY = (a_SrcSizeY - 1) * a_UpscaleY + 1;
#ifdef _DEBUG
int DstSizeZ = (a_SrcSizeZ - 1) * a_UpscaleZ + 1;
#endif
for (int z = 0; z < (a_SrcSizeZ - 1); z++)
{
int DstZ = z * a_UpscaleZ;

View File

@ -22,7 +22,7 @@ static void WriteLogOpener(fmt::memory_buffer & Buffer)
localtime_r(&rawtime, &timeinfo);
#endif
#ifdef _DEBUG
#ifndef NDEBUG
const auto ThreadID = std::hash<std::thread::id>()(std::this_thread::get_id());
fmt::format_to(
Buffer, "[{0:04x}|{1:02d}:{2:02d}:{3:02d}] ",

View File

@ -45,7 +45,7 @@
{
}
#ifdef _DEBUG
#ifndef NDEBUG
virtual void Log(std::string_view a_Message, eLogLevel a_LogLevel) override
{
Super::Log(a_Message, a_LogLevel);

View File

@ -79,18 +79,18 @@ void LOGERROR(std::string_view a_Format, const Args & ... args)
// Macro variants
// In debug builds, translate LOGD to LOG, otherwise leave it out altogether:
#if defined(_DEBUG) || defined(TEST_GLOBALS)
#if !defined(NDEBUG) || defined(TEST_GLOBALS)
#define LOGD LOG
#else
#define LOGD(...)
#endif // _DEBUG
#endif // !NDEBUG
#define LOGWARN LOGWARNING
#if defined(_DEBUG) || defined(TEST_GLOBALS)
#if !defined(NDEBUG) || defined(TEST_GLOBALS)
#define FLOGD FLOG
#else
#define FLOGD(...)
#endif // _DEBUG
#endif // !NDEBUG
#define FLOGWARN FLOGWARNING

View File

@ -52,7 +52,7 @@ private:
struct sValue
{
sValue(AString value):
#ifdef _DEBUG
#ifndef NDEBUG
m_Type(eType::String),
#endif
m_stringValue (std::move(value))
@ -60,7 +60,7 @@ private:
}
sValue(Int64 value):
#ifdef _DEBUG
#ifndef NDEBUG
m_Type(eType::Int64),
#endif
m_intValue(value)
@ -68,7 +68,7 @@ private:
}
sValue(bool value):
#ifdef _DEBUG
#ifndef NDEBUG
m_Type(eType::Bool),
#endif
m_boolValue(value)
@ -81,7 +81,7 @@ private:
private:
#ifdef _DEBUG
#ifndef NDEBUG
enum class eType
{
String,

View File

@ -11,7 +11,7 @@
#if defined(_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
// Code adapted from MSDN: https://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx
const DWORD MS_VC_EXCEPTION = 0x406D1388;
@ -39,7 +39,7 @@
{
}
}
#endif // _MSC_VER && _DEBUG
#endif // _MSC_VER && !NDEBUG
@ -84,7 +84,7 @@ bool cIsThread::Start(void)
// Initialize the thread:
m_Thread = std::thread(&cIsThread::DoExecute, this);
#if defined (_MSC_VER) && defined(_DEBUG)
#if defined(_MSC_VER) && !defined(NDEBUG)
if (!m_ThreadName.empty())
{
SetThreadName(&m_Thread, m_ThreadName.c_str());

View File

@ -3913,7 +3913,7 @@ void cProtocol_1_8_0::HandlePacket(cByteBuffer & a_Buffer)
// Unknown packet, already been reported, but without the length. Log the length here:
LOGWARNING("Unhandled packet: type 0x%x, state %d, length %u", PacketType, m_State, a_Buffer.GetUsedSpace());
#ifdef _DEBUG
#ifndef NDEBUG
// Dump the packet contents into the log:
a_Buffer.ResetRead();
ContiguousByteBuffer Packet;
@ -3922,7 +3922,7 @@ void cProtocol_1_8_0::HandlePacket(cByteBuffer & a_Buffer)
AString Out;
CreateHexDump(Out, Packet.data(), Packet.size(), 24);
LOGD("Packet contents:\n%s", Out.c_str());
#endif // _DEBUG
#endif // !NDEBUG
// Put a message in the comm log:
if (g_ShouldLogCommIn && m_CommLogFile.IsOpen())

View File

@ -16,21 +16,23 @@ BEGIN
2 "A lightweight, fast and extensible game server for Minecraft"
END
#define VERSION 0,0,13,37
#define VERSION_STRING "0.0.13.37"
#define VERSION 1,3,3,7
#define VERSION_STRING "1.3.3.7"
#define INTERNAL_NAME "MCServer"
#define ORIGINAL_FILENAME "Cuberite.exe"
#ifdef NDEBUG
#define FILE_FLAGS 0
#else
#define FILE_FLAGS VS_FF_DEBUG
#endif
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION
PRODUCTVERSION VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEFLAGS FILE_FLAGS
FILEOS 0x40004L
FILETYPE VFT_APP
FILESUBTYPE 0
@ -59,11 +61,7 @@ VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION
PRODUCTVERSION VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEFLAGS FILE_FLAGS
FILEOS 0x40004L
FILETYPE VFT_APP
FILESUBTYPE 0

View File

@ -613,11 +613,11 @@ bool cWorld::SetSpawn(double a_X, double a_Y, double a_Z)
void cWorld::InitializeSpawn(void)
{
// For the debugging builds, don't make the server build too much world upon start:
#if defined(_DEBUG) || defined(ANDROID)
#if !defined(NDEBUG) || defined(ANDROID)
const int DefaultViewDist = 9;
#else
const int DefaultViewDist = 20; // Always prepare an area 20 chunks across, no matter what the actual cClientHandle::VIEWDISTANCE is
#endif // _DEBUG
#endif // !NDEBUG
if (!m_IsSpawnExplicitlySet)
{

View File

@ -53,10 +53,10 @@ bool cMapSerializer::Save(void)
SaveMapToNBT(Writer);
Writer.Finish();
#ifdef _DEBUG
#ifndef NDEBUG
cParsedNBT TestParse(Writer.GetResult());
ASSERT(TestParse.IsValid());
#endif // _DEBUG
#endif // !NDEBUG
GZipFile::Write(m_Path, Writer.GetResult());
@ -229,10 +229,10 @@ bool cIDCountSerializer::Save(void)
Writer.Finish();
#ifdef _DEBUG
#ifndef NDEBUG
cParsedNBT TestParse(Writer.GetResult());
ASSERT(TestParse.IsValid());
#endif // _DEBUG
#endif // !NDEBUG
cFile File;
if (!File.Open(m_Path, cFile::fmWrite))

View File

@ -60,10 +60,10 @@ bool cScoreboardSerializer::Save(void)
SaveScoreboardToNBT(Writer);
Writer.Finish();
#ifdef _DEBUG
#ifndef NDEBUG
cParsedNBT TestParse(Writer.GetResult());
ASSERT(TestParse.IsValid());
#endif // _DEBUG
#endif // !NDEBUG
GZipFile::Write(m_Path, Writer.GetResult());

View File

@ -289,7 +289,7 @@ int main(int argc, char ** argv)
// Only useful when the leak is in the same sequence all the time
// _CrtSetBreakAlloc(85950);
#endif // _DEBUG && _MSC_VER
#endif // !NDEBUG && _MSC_VER
std::signal(SIGSEGV, NonCtrlHandler);
std::signal(SIGTERM, NonCtrlHandler);

View File

@ -13,7 +13,7 @@
// #define ENABLE_SSL_DEBUG_MSG
#if defined(_DEBUG) && defined(ENABLE_SSL_DEBUG_MSG)
#if !defined(NDEBUG) && defined(ENABLE_SSL_DEBUG_MSG)
#include "mbedtls/debug.h"
@ -95,7 +95,7 @@
return 0;
}
}
#endif // defined(_DEBUG) && defined(ENABLE_SSL_DEBUG_MSG)
#endif // !defined(NDEBUG) && defined(ENABLE_SSL_DEBUG_MSG)
@ -238,7 +238,7 @@ std::shared_ptr<cSslConfig> cSslConfig::MakeDefaultConfig(bool a_IsClient)
Ret->SetAuthMode(eSslAuthMode::None); // We cannot verify because we don't have a CA chain
#ifdef _DEBUG
#ifndef NDEBUG
#ifdef ENABLE_SSL_DEBUG_MSG
Ret->SetDebugCallback(&SSLDebugMessage, nullptr);
Ret->SetVerifyCallback(SSLVerifyCert, nullptr);

View File

@ -199,11 +199,11 @@ public:
/** Checks that the statement causes an ASSERT trigger. */
#ifdef _DEBUG
#define TEST_ASSERTS(Stmt) TEST_THROWS(Stmt, cAssertFailure)
#else
#ifdef NDEBUG
#define TEST_ASSERTS(Stmt) LOG("Skipped, cannot test in Release mode: TEST_ASSERT(%s); (%s:%d)", #Stmt, __FILE__, __LINE__)
#endif // else _DEBUG
#else
#define TEST_ASSERTS(Stmt) TEST_THROWS(Stmt, cAssertFailure)
#endif // else NDEBUG