ignore midi on monitor-section and force strict-i/o
[ardour.git] / libs / pbd / boost_debug.cc
index 9d307f64af7ab3fdb9d7a36765f7390e3e1c9d18..e1c6571f9cf135fcaacff22afb99351c2ee16802 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2009 Paul Davis 
+    Copyright (C) 2009 Paul Davis
     From an idea by Carl Hetherington.
 
     This program is free software; you can redistribute it and/or modify
 #include <map>
 #include <set>
 #include <vector>
-#include <glibmm/thread.h>
+#include <glibmm/threads.h>
 #include <boost/shared_ptr.hpp>
 
 #include "pbd/stacktrace.h"
+#include "pbd/boost_debug.h"
 
 class Backtrace {
 public:
@@ -47,8 +48,8 @@ private:
 std::ostream& operator<< (std::ostream& str, const Backtrace& bt) { return bt.print (str); }
 
 
-Backtrace::Backtrace() 
-{ 
+Backtrace::Backtrace()
+{
 #ifdef HAVE_EXECINFO
        size = ::backtrace (trace, 200);
 #endif
@@ -63,7 +64,7 @@ Backtrace::print (std::ostream& str) const
        if (size) {
 #ifdef HAVE_EXECINFO
                strings = ::backtrace_symbols (trace, size);
-#endif         
+#endif
                if (strings) {
                        for (i = 3; i < 5+18 && i < size; i++) {
                                str << strings[i] << std::endl;
@@ -75,7 +76,7 @@ Backtrace::print (std::ostream& str) const
        return str;
 }
 
-struct BTPair { 
+struct BTPair {
 
     Backtrace* ref;
     Backtrace* rel;
@@ -93,10 +94,10 @@ std::ostream& operator<<(std::ostream& str, const BTPair& btp) {
        return str;
 }
 
-struct SPDebug { 
+struct SPDebug {
     Backtrace* constructor;
     Backtrace* destructor;
-    
+
     SPDebug (Backtrace* c) : constructor (c), destructor (0) {}
     ~SPDebug () {
            delete constructor;
@@ -120,7 +121,7 @@ typedef std::map<void const*,const char*> IPointerMap;
 using namespace std;
 
 static PointerMap* _sptrs;
-PointerMap& sptrs() { 
+PointerMap& sptrs() {
         if (_sptrs == 0) {
                 _sptrs = new PointerMap;
         }
@@ -128,17 +129,17 @@ PointerMap& sptrs() {
 }
 
 static IPointerMap* _interesting_pointers;
-IPointerMap& interesting_pointers() { 
+IPointerMap& interesting_pointers() {
         if (_interesting_pointers == 0) {
                 _interesting_pointers = new IPointerMap;
         }
         return *_interesting_pointers;
 }
 
-static Glib::Mutex* _the_lock;
-static Glib::Mutex& the_lock() {
+static Glib::Threads::Mutex* _the_lock;
+static Glib::Threads::Mutex& the_lock() {
         if (_the_lock == 0) {
-                _the_lock = new Glib::Mutex;
+                _the_lock = new Glib::Threads::Mutex;
         }
         return *_the_lock;
 }
@@ -150,7 +151,7 @@ is_interesting_object (void const* ptr)
        if (ptr == 0) {
                return false;
        }
-       
+
        return interesting_pointers().find (ptr) != interesting_pointers().end();
 }
 
@@ -167,7 +168,7 @@ boost_debug_shared_ptr_show_live_debugging (bool yn)
 void
 boost_debug_shared_ptr_mark_interesting (void* ptr, const char* type)
 {
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
        pair<void*,const char*> newpair (ptr, type);
        interesting_pointers().insert (newpair);
        if (debug_out) {
@@ -182,7 +183,7 @@ boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int
                return;
        }
 
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
 
        if (is_interesting_object  (old_obj) || is_interesting_object (obj)) {
                if (debug_out) {
@@ -192,15 +193,15 @@ boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int
 
        if (is_interesting_object (old_obj)) {
                if (debug_out) {
-                       cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count 
-                            << " (total sp's = " << sptrs().size() << ')' << endl;                     
+                       cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count
+                            << " (total sp's = " << sptrs().size() << ')' << endl;
                }
                PointerMap::iterator x = sptrs().find (sp);
-               
+
                if (x != sptrs().end()) {
                        sptrs().erase (x);
                        if (debug_out) {
-                               cerr << "\tRemoved (by assigment) sp for " << old_obj << " @ " << sp << " UC = " << old_use_count << " (total sp's = " << sptrs().size() << ')' << endl;
+                               cerr << "\tRemoved (by assignment) sp for " << old_obj << " @ " << sp << " UC = " << old_use_count << " (total sp's = " << sptrs().size() << ')' << endl;
                        }
                }
        }
@@ -213,14 +214,14 @@ boost_debug_shared_ptr_operator_equals (void const *sp, void const *old_obj, int
                newpair.second = new SPDebug (new Backtrace());
 
                sptrs().insert (newpair);
-               
+
                if (debug_out) {
-                       cerr << "assignment created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count 
-                            << " UC = " << new_use_count 
-                            << " (total sp's = " << sptrs().size() << ')' << endl;                     
+                       cerr << "assignment created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count
+                            << " UC = " << new_use_count
+                            << " (total sp's = " << sptrs().size() << ')' << endl;
                        cerr << *newpair.second << endl;
                }
-       } 
+       }
 }
 
 void
@@ -230,7 +231,7 @@ boost_debug_shared_ptr_reset (void const *sp, void const *old_obj, int old_use_c
                return;
        }
 
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
 
        if (is_interesting_object  (old_obj) || is_interesting_object (obj)) {
                if (debug_out) {
@@ -240,11 +241,11 @@ boost_debug_shared_ptr_reset (void const *sp, void const *old_obj, int old_use_c
 
        if (is_interesting_object (old_obj)) {
                if (debug_out) {
-                       cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count 
-                            << " (total sp's = " << sptrs().size() << ')' << endl;                     
+                       cerr << "\tlost old sp @ " << sp << " for " << old_obj << " UC = " << old_use_count << " now for " << obj << " UC = " << new_use_count
+                            << " (total sp's = " << sptrs().size() << ')' << endl;
                }
                PointerMap::iterator x = sptrs().find (sp);
-               
+
                if (x != sptrs().end()) {
                        sptrs().erase (x);
                        if (debug_out) {
@@ -261,20 +262,20 @@ boost_debug_shared_ptr_reset (void const *sp, void const *old_obj, int old_use_c
                newpair.second = new SPDebug (new Backtrace());
 
                sptrs().insert (newpair);
-               
+
                if (debug_out) {
-                       cerr << "reset created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count 
-                            << " UC = " << new_use_count 
-                            << " (total sp's = " << sptrs().size() << ')' << endl;                     
+                       cerr << "reset created sp for " << obj << " @ " << sp << " used to point to " << old_obj << " UC = " << old_use_count
+                            << " UC = " << new_use_count
+                            << " (total sp's = " << sptrs().size() << ')' << endl;
                        cerr << *newpair.second << endl;
                }
-       } 
+       }
 }
 
 void
 boost_debug_shared_ptr_destructor (void const *sp, void const *obj, int use_count)
 {
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
        PointerMap::iterator x = sptrs().find (sp);
 
        if (x != sptrs().end()) {
@@ -289,7 +290,7 @@ void
 boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_count)
 {
        if (is_interesting_object (obj)) {
-               Glib::Mutex::Lock guard (the_lock());
+               Glib::Threads::Mutex::Lock guard (the_lock());
                pair<void const*, SPDebug*> newpair;
 
                newpair.first = sp;
@@ -306,14 +307,14 @@ boost_debug_shared_ptr_constructor (void const *sp, void const *obj, int use_cou
 void
 boost_debug_count_ptrs ()
 {
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
        // cerr << "Tracking " << interesting_pointers().size() << " interesting objects with " << sptrs().size () << " shared ptrs\n";
 }
 
 void
 boost_debug_list_ptrs ()
 {
-       Glib::Mutex::Lock guard (the_lock());
+       Glib::Threads::Mutex::Lock guard (the_lock());
 
        if (sptrs().empty()) {
                cerr << "There are no dangling shared ptrs\n";
@@ -328,35 +329,35 @@ boost_debug_list_ptrs ()
 
 namespace boost {
 
-void sp_scalar_constructor_hook( void * object, std::size_t size, void * pn )
+void sp_scalar_constructor_hook( void *, std::size_t, void *)
 {
 }
 
-void sp_scalar_destructor_hook( void * object, std::size_t size, void * pn )
+void sp_scalar_destructor_hook( void *, std::size_t, void *)
 {
 }
 
-void sp_counter_ref_hook (void* pn, long use_count)
+void sp_counter_ref_hook (void* /*pn*/, long /* use count */)
 {
 }
 
-void sp_counter_release_hook (void* pn, long use_count) 
+void sp_counter_release_hook (void* /*pn*/, long /*use_count*/)
 {
 }
 
-void sp_array_constructor_hook(void * p)
+void sp_array_constructor_hook(void *)
 {
 }
 
-void sp_array_destructor_hook(void * p)
+void sp_array_destructor_hook(void *)
 {
 }
 
-void sp_scalar_constructor_hook(void * p)
+void sp_scalar_constructor_hook(void *)
 {
 }
 
-void sp_scalar_destructor_hook(void * p)
+void sp_scalar_destructor_hook(void *)
 {
 }