From: malaterre Date: Thu, 13 Jan 2005 22:39:14 +0000 (+0000) Subject: ENH: If NDEBUG is passed to prepro then all debug stuff are yanked (should improve... X-Git-Tag: Version1.0.bp~341 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c8674b38365e7959fddbce5467e5bc82bb1ed550;p=gdcm.git ENH: If NDEBUG is passed to prepro then all debug stuff are yanked (should improve speed), use at your own risk --- diff --git a/ChangeLog b/ChangeLog index 5f3955f2..3854200e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ 2005-01-13 Mathieu Malaterre * src/gdcmDebug.h : Adding an option to redirect debug stream to a - file. + file. Debug is yanked if compiled with NDEBUG 2005-01-13 Benoit Regrain * src/gdcmDictSet.h : set the default output to the os variable diff --git a/src/gdcmDebug.h b/src/gdcmDebug.h index 35c61e71..c135290d 100644 --- a/src/gdcmDebug.h +++ b/src/gdcmDebug.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDebug.h,v $ Language: C++ - Date: $Date: 2005/01/13 22:30:11 $ - Version: $Revision: 1.22 $ + Date: $Date: 2005/01/13 22:39:15 $ + Version: $Revision: 1.23 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -96,6 +96,9 @@ public: * \brief Debug * @param msg message part */ +#ifdef NDEBUG +#define gdcmDebugMacro(msg) +#else #define gdcmDebugMacro(msg) \ { \ if( Debug::GetDebugFlag() ) \ @@ -111,11 +114,15 @@ public: std::cerr << osmacro.str() << std::endl; \ } \ } +#endif //NDEBUG /** * \brief Verbose * @param msg message part */ +#ifdef NDEBUG +#define gdcmVerboseMacro(msg) +#else #define gdcmVerboseMacro(msg) \ { \ if( Debug::GetDebugFlag() ) \ @@ -130,11 +137,15 @@ public: std::cerr << osmacro.str() << std::endl; \ } \ } +#endif //NDEBUG /** * \brief Error * @param msg second message part */ +#ifdef NDEBUG +#define gdcmErrorMacro(msg) +#else #define gdcmErrorMacro(msg) \ { \ if( Debug::GetDebugFlag() ) \ @@ -150,6 +161,7 @@ public: exit(1); \ } \ } +#endif //NDEBUG /** * \brief Assert @@ -157,6 +169,9 @@ public: * An easy solution to pass also a message is to do: * gdcmAssertMacro( "my message" && 2 < 3 ) */ +#ifdef NDEBUG +#define gdcmAssertMacro(arg) +#else #define gdcmAssertMacro(arg) \ { \ if( !(arg) ) \ @@ -172,5 +187,6 @@ public: assert ( arg ); \ } \ } +#endif //NDEBUG #endif