]> git.kernelconcepts.de Git - karo-tx-redboot.git/blobdiff - packages/infra/v2_0/src/delete.cxx
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / infra / v2_0 / src / delete.cxx
index 87c4a1b9327d9cb7b7069baf3b211e8ebe92ed6d..edd560edde2914c80ee1538c8ea5de613ac99b4a 100644 (file)
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2005 Andrew Lunn
 //
 // eCos 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
@@ -57,6 +58,7 @@
 #include <pkgconf/infra.h>
 
 #include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_ass.h>
 
 // see the description comment in infra.cdl for
 // CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS
 #ifdef CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS
 // then define these empty functions:
 
+#ifdef CYGPKG_INFRA_DEBUG
+static cyg_uint32 counter;
+#endif
+
 void operator delete(void *x) throw()
 {
+#ifndef CYGPKG_INFRA_DEBUG  
     CYG_EMPTY_STATEMENT;
+#else
+    counter++;
+    CYG_ASSERT(counter < CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD,
+               "Do you want an empty delete function?");
+#endif
 }
 
 void operator delete[](void *x) throw()
 {
+#ifndef CYGPKG_INFRA_DEBUG  
     CYG_EMPTY_STATEMENT;
+#else
+    counter++;
+    CYG_ASSERT(counter < CYGNUM_INFRA_EMPTY_DELETE_THRESHOLD,
+               "Do you want an empty delete function?");
+#endif
 }
 
 #endif // CYGFUN_INFRA_EMPTY_DELETE_FUNCTIONS