/* ** Command & Conquer Generals Zero Hour(tm) ** Copyright 2025 Electronic Arts Inc. ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see . */ /////////////////////////////////////////////////////////////////////////EA-V1 // $File: //depot/GeneralsMD/Staging/code/Libraries/Source/debug/debug_macro.h $ // $Author: mhoffe $ // $Revision: #2 $ // $DateTime: 2003/07/09 10:57:23 $ // // ©2003 Electronic Arts // // Debugging macros ////////////////////////////////////////////////////////////////////////////// #ifdef _MSC_VER # pragma once #endif #ifndef DEBUG_MACRO_H // Include guard #define DEBUG_MACRO_H // I'm putting the documentation for the following macros // here because Doxygen otherwise includes the values of each macro // in the documentation. I don't want that (it would expose some // internals) so I'm putting all comments for the following macros // here... #ifdef DOXYGEN // defined if Doxygen is running /** \addtogroup debug_macros Debugging and logging macros This module defines a number of macros. Usually only these macros should be used to access any debug functionality. All these macros are defined if either _DEBUG or _INTERNAL is defined. Otherwise all of them (with the exception of DCHECK and DCHECK_MSG) will be removed. */ ///@{ /** \brief Regular assert macro. This macro will generate an error message on screen if the evaluated expression returns false. The user will then have the choice of aborting the program, continuing once or continuing with completely ignoring that specific assertion. Assertions are completely removed if neither _DEBUG nor _INTERNAL are defined. \param expr expression, trigger assert window if false */ #define DASSERT(expr) /** \brief Assert macro with custom message. Like \ref DASSERT but a custom message will be given in addition to the expression. The message can be specified in a stream-like notation, e.g. \code DASSERT_MSG( n>=0 && n' \endcode If the expression given can't be evaluated at compile time the error message looks like this: \code debug.cpp(15) : error C2027: use of undefined type 'StaticAssertionFailed< ?? >' \endcode \param expr expression which can be evaluated at compile time */ #define DCTASSERT(expr) /** \brief Function macro, checks if the given expression is true, returns false if not. Additionally a message is written to the log file. This macro is usually used like this: \code if ( !DCHECK( n>=0 && n struct StaticAssertionFailed; template<> struct StaticAssertionFailed {}; template struct StaticAssertionTest {}; #define DCTASSERT(expr) typedef ::_Debug::StaticAssertionTest< \ sizeof(::_Debug::StaticAssertionFailed< (bool)(expr) >) \ > DebugStaticAssertTypedef__; }; // These are stolen from the WW3D Debug file. REALLY useful. :-) #define STRING_IT(a) #a #define TOKEN_IT(a) STRING_IT(,##a) /** The macro MESSAGE allows user to put: \code #pragma MESSAGE("Hello world") \endcode anywhere in a source file. The message: \code sourcefname.cpp (123) : Hello world \endcode would be printed if put in sourcefname.cpp on line 123 in compile window like an error. You can then use next/prev error hot keys to see where comment is. It is not an error and will be printed everytime it is compiled. Very useful to put comments in code that cannot be forgotten. */ #define MESSAGE(a) message (__FILE__ "(" TOKEN_IT(__LINE__) ") : " a) #endif // DEBUG_MACRO_H