]> Creatis software - gdcm.git/commitdiff
ENH: If NDEBUG is passed to prepro then all debug stuff are yanked (should improve...
authormalaterre <malaterre>
Thu, 13 Jan 2005 22:39:14 +0000 (22:39 +0000)
committermalaterre <malaterre>
Thu, 13 Jan 2005 22:39:14 +0000 (22:39 +0000)
ChangeLog
src/gdcmDebug.h

index 5f3955f2f02b798d0627ec0546e19aa4de774d42..3854200e07b6e4c843462c484b028c35366fae79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
 2005-01-13 Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
    * 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 <Benoit.Regrain@creatis.insa-lyon.fr>
    * src/gdcmDictSet.h : set the default output to the os variable
index 35c61e71112d710503969b988aabc71403a0d6cf..c135290d7f4bb347717b4b30e7f3b6b7abf3fd0d 100644 (file)
@@ -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