diff options
Diffstat (limited to 'sca-cpp')
23 files changed, 79 insertions, 55 deletions
diff --git a/sca-cpp/trunk/components/queue/client-test.cpp b/sca-cpp/trunk/components/queue/client-test.cpp index a88d9576cb..30bfe07bf7 100644 --- a/sca-cpp/trunk/components/queue/client-test.cpp +++ b/sca-cpp/trunk/components/queue/client-test.cpp @@ -35,7 +35,7 @@ #include "qpid.hpp" // Ignore conversion issues and redundant declarations in Qpid headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/queue/qpid-test.cpp b/sca-cpp/trunk/components/queue/qpid-test.cpp index 1a650157b2..27db7734b0 100644 --- a/sca-cpp/trunk/components/queue/qpid-test.cpp +++ b/sca-cpp/trunk/components/queue/qpid-test.cpp @@ -34,7 +34,7 @@ #include "qpid.hpp" // Ignore conversion issues and redundant declarations in Qpid headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/queue/qpid.hpp b/sca-cpp/trunk/components/queue/qpid.hpp index 4fb4c7a1bd..63f27d2519 100644 --- a/sca-cpp/trunk/components/queue/qpid.hpp +++ b/sca-cpp/trunk/components/queue/qpid.hpp @@ -27,7 +27,7 @@ */ // Ignore conversion issues and redundant declarations in Qpid headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif @@ -260,7 +260,7 @@ const failable<bool> stop(QpidSubscription& qsub) { } // Re-enable conversion and redundant declarations warnings -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic warning "-Wconversion" #pragma GCC diagnostic warning "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/queue/queue-listener.cpp b/sca-cpp/trunk/components/queue/queue-listener.cpp index 394d462839..8d253a670d 100644 --- a/sca-cpp/trunk/components/queue/queue-listener.cpp +++ b/sca-cpp/trunk/components/queue/queue-listener.cpp @@ -33,7 +33,7 @@ #include "qpid.hpp" // Ignore conversion issues and redundant declarations in Qpid headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/queue/queue-sender.cpp b/sca-cpp/trunk/components/queue/queue-sender.cpp index 1d5978e9a6..ea6e45d988 100644 --- a/sca-cpp/trunk/components/queue/queue-sender.cpp +++ b/sca-cpp/trunk/components/queue/queue-sender.cpp @@ -32,7 +32,7 @@ #include "qpid.hpp" // Ignore conversion issues and redundant declarations in Qpid headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wconversion" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/webservice/axis2-service.cpp b/sca-cpp/trunk/components/webservice/axis2-service.cpp index 498f3aea92..4df0543370 100644 --- a/sca-cpp/trunk/components/webservice/axis2-service.cpp +++ b/sca-cpp/trunk/components/webservice/axis2-service.cpp @@ -85,7 +85,7 @@ axiom_node_t *AXIS2_CALL serviceInvoke(unused axis2_svc_skeleton_t* svc_skeleton axis2_out_transport_info_t* tinfo = axis2_msg_ctx_get_out_transport_info(msg_ctx, env); axis2_apache2_out_transport_info_t* httpinfo = (axis2_apache2_out_transport_info_t*)tinfo; request_rec* r = httpinfo->request; - httpdDebugRequest(r, "webservice::serviceInvoke"); + debug_httpdRequest(r, "webservice::serviceInvoke"); // Parse the request Axiom node and construct request expression Axis2Context ax(env); diff --git a/sca-cpp/trunk/components/webservice/axis2.hpp b/sca-cpp/trunk/components/webservice/axis2.hpp index 47813ccd6d..62797d86f2 100644 --- a/sca-cpp/trunk/components/webservice/axis2.hpp +++ b/sca-cpp/trunk/components/webservice/axis2.hpp @@ -28,7 +28,7 @@ #include "config.hpp" // Ignore redundant declarations in Axiom headers -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wredundant-decls" #endif #include <axiom.h> @@ -38,7 +38,7 @@ #include <axis2_conf_ctx.h> #include <axis2_disp.h> #include <axis2_http_out_transport_info.h> -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic warning "-Wredundant-decls" #endif diff --git a/sca-cpp/trunk/components/webservice/webservice-listener.cpp b/sca-cpp/trunk/components/webservice/webservice-listener.cpp index 3741f7a1a7..e3347fa186 100644 --- a/sca-cpp/trunk/components/webservice/webservice-listener.cpp +++ b/sca-cpp/trunk/components/webservice/webservice-listener.cpp @@ -59,7 +59,7 @@ const failable<value> handle(const list<value>& params) { // Extract HTTPD request from the params request_rec* r = httpd::request(car(params)); - httpdDebugRequest(r, "webservice::handle"); + debug_httpdRequest(r, "webservice::handle"); // Extract the relay lambda from the params and store it in the HTTPD request, // for later retrieval by our Axis2 service diff --git a/sca-cpp/trunk/configure.ac b/sca-cpp/trunk/configure.ac index 58d021aa8e..2e7270e1d4 100644 --- a/sca-cpp/trunk/configure.ac +++ b/sca-cpp/trunk/configure.ac @@ -117,7 +117,7 @@ AC_ARG_ENABLE(maintainer-mode, [AS_HELP_STRING([--enable-maintainer-mode], [comp esac ], [ AC_MSG_RESULT(no)]) if test "${want_maintainer_mode}" = "true"; then - cxxflags="${cxxflags} -D_DEBUG -ggdb -g3 -Werror -Wall -Wextra -Wno-ignored-qualifiers -Wno-strict-aliasing -Winit-self -Wmissing-include-dirs -Wcast-qual -Wcast-align -Wwrite-strings -Wpointer-arith -Waddress -Wredundant-decls -std=c++0x -fmessage-length=0" + cxxflags="${cxxflags} -ggdb -g3 -Werror -Wall -Wextra -Wno-ignored-qualifiers -Wno-strict-aliasing -Winit-self -Wmissing-include-dirs -Wcast-qual -Wcast-align -Wwrite-strings -Wpointer-arith -Waddress -Wredundant-decls -std=c++0x -fmessage-length=0" if test "${cxxtype}" = "clang"; then cxxflags="${cxxflags} -O1 -stdlib=libc++" else diff --git a/sca-cpp/trunk/kernel/config.hpp b/sca-cpp/trunk/kernel/config.hpp index 5b447e116b..944b9629e7 100644 --- a/sca-cpp/trunk/kernel/config.hpp +++ b/sca-cpp/trunk/kernel/config.hpp @@ -67,13 +67,32 @@ namespace tuscany #ifdef WANT_MAINTAINER_MODE /** + * Strict compile warnings. + */ +#define WANT_MAINTAINER_WARNINGS + +/** + * Fast fail assertion. + */ +#define WANT_MAINTAINER_ASSERT + +/** + * Debug log. + */ +#define WANT_MAINTAINER_LOG + +/** * Add string watch members to important classes to help watch them in a debugger. */ //#define WANT_MAINTAINER_WATCH /** - * Increment/decrement a debug counter. + * Maintain counters of important objects to help test garbage collection. */ +//#define WANT_MAINTAINER_COUNTERS + +#ifdef WANT_MAINTAINER_COUNTERS + bool debug_inc(long int& c) { c++; return true; @@ -91,5 +110,12 @@ bool debug_dec(long int& c) { #endif +#else + +#define debug_inc(c) +#define debug_dec(c) + +#endif + } #endif /* tuscany_config_hpp */ diff --git a/sca-cpp/trunk/kernel/fstream.hpp b/sca-cpp/trunk/kernel/fstream.hpp index fe95fc02e0..6afec8bd35 100644 --- a/sca-cpp/trunk/kernel/fstream.hpp +++ b/sca-cpp/trunk/kernel/fstream.hpp @@ -224,7 +224,7 @@ private: loghstream cinfo(APLOG_INFO); loghstream cfailure(APLOG_ERR); -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Debug log stream. @@ -234,9 +234,7 @@ loghstream cdebug(APLOG_DEBUG); /** * Return true if debug log is enabled. */ -const bool isDebugLog() { - return APLOG_MODULE_IS_LEVEL(ap_server_conf, APLOG_NO_MODULE, APLOG_DEBUG); -} +#define debug_islogging() (bool)(APLOG_MODULE_IS_LEVEL(ap_server_conf, APLOG_NO_MODULE, APLOG_DEBUG)) #endif @@ -321,7 +319,7 @@ private: logfstream cinfo(stderr, "info"); logfstream cfailure(stderr, "error"); -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Debug log stream. @@ -331,22 +329,18 @@ logfstream cdebug(stderr, "debug"); /** * Return true if debug log is enabled. */ -const bool isDebugLog() { - return true; -} +#define debug_islogging() true #endif #endif -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Log a debug message. */ const bool debugLog(const string& msg) { - if (!isDebugLog()) - return true; gc_scoped_pool(); cdebug << msg << endl; return true; @@ -356,17 +350,16 @@ const bool debugLog(const string& msg) { * Log a debug message and a value. */ template<typename V> const bool debugLog(const V& v, const string& msg) { - if (!isDebugLog()) - return true; gc_scoped_pool(); cdebug << msg << ": " << v << endl; return true; } -#define debug(...) tuscany::debugLog(__VA_ARGS__) +#define debug(...) if (debug_islogging()) tuscany::debugLog(__VA_ARGS__) #else +#define debug_islogging() false #define debug(...) #endif diff --git a/sca-cpp/trunk/kernel/function.hpp b/sca-cpp/trunk/kernel/function.hpp index 701e0f1fa9..60117dab98 100644 --- a/sca-cpp/trunk/kernel/function.hpp +++ b/sca-cpp/trunk/kernel/function.hpp @@ -33,7 +33,7 @@ namespace tuscany { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_COUNTERS /** * Debug counters. diff --git a/sca-cpp/trunk/kernel/gc.hpp b/sca-cpp/trunk/kernel/gc.hpp index 59947dd853..ed5482cfff 100644 --- a/sca-cpp/trunk/kernel/gc.hpp +++ b/sca-cpp/trunk/kernel/gc.hpp @@ -44,7 +44,7 @@ namespace tuscany { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_ASSERT /** * Force a core dump on assertion violation. diff --git a/sca-cpp/trunk/kernel/list.hpp b/sca-cpp/trunk/kernel/list.hpp index 60dcbb083a..d3736de62c 100644 --- a/sca-cpp/trunk/kernel/list.hpp +++ b/sca-cpp/trunk/kernel/list.hpp @@ -33,12 +33,10 @@ namespace tuscany { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_COUNTERS /** - * Debug utilities. Counters used to track instances of lists, and - * macro used to write the contents of a list in a string, easier to - * watch in a debugger than the list itself. + * Debug utilities. Counters used to track instances of lists. */ long countLists = 0; long countILists = 0; @@ -72,6 +70,10 @@ bool printListCounters() { #ifdef WANT_MAINTAINER_WATCH +/** + * Debug utilities. Macro used to write the contents of a list to + * a string, easier to watch in a debugger than the list itself. + */ #define debug_watchList() do { \ this->watch = watchList(*this); \ } while (0) diff --git a/sca-cpp/trunk/kernel/monad.hpp b/sca-cpp/trunk/kernel/monad.hpp index 2ae49308a9..b1bef7996c 100644 --- a/sca-cpp/trunk/kernel/monad.hpp +++ b/sca-cpp/trunk/kernel/monad.hpp @@ -277,7 +277,7 @@ template<typename V, typename F> const lambda<failable<V, F>(const V)> success() * Returns a failable monad with a failure in it. */ template<typename V, typename F> const failable<V, F> mkfailure(const F& f, const bool log = true) { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG if (!log) debug(f, "failable::mkfailure"); #endif diff --git a/sca-cpp/trunk/kernel/stream.hpp b/sca-cpp/trunk/kernel/stream.hpp index 2a27f5a948..8ccfed948f 100644 --- a/sca-cpp/trunk/kernel/stream.hpp +++ b/sca-cpp/trunk/kernel/stream.hpp @@ -152,7 +152,7 @@ template<typename T> ostream& operator<<(ostream& out, const gc_ptr<T>& p) { return out << p.ptr; } -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG /** * Debug stream implementation with no dependencies on anything else. diff --git a/sca-cpp/trunk/kernel/string.hpp b/sca-cpp/trunk/kernel/string.hpp index cf7b4092d2..e726a61b84 100644 --- a/sca-cpp/trunk/kernel/string.hpp +++ b/sca-cpp/trunk/kernel/string.hpp @@ -34,7 +34,7 @@ namespace tuscany { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_COUNTERS /** * Debug utilities. Counters used to track string copies. @@ -67,7 +67,7 @@ bool printStringCopyCounters() { * Instrumented memcpy. */ void* string_memcpy(void* t, const void* s, const size_t n) { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_COUNTERS countStringCopies += 1; #endif return memcpy(t, s, n); @@ -172,7 +172,7 @@ public: } private: -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_LOG friend class odebugstream; #endif friend class ostringstream; diff --git a/sca-cpp/trunk/kernel/value.hpp b/sca-cpp/trunk/kernel/value.hpp index 886897f20f..3b0e9beb73 100644 --- a/sca-cpp/trunk/kernel/value.hpp +++ b/sca-cpp/trunk/kernel/value.hpp @@ -40,12 +40,10 @@ namespace tuscany { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_COUNTERS /** - * Debug utilities. Counters used to track instances of values, and - * macro used to write the contents of a value in a string, easier to - * watch in a debugger than the value itself. + * Debug utilities. Counters used to track instances of values */ long int countValues = 0; long int countEValues = 0; @@ -79,6 +77,11 @@ bool printValueCounters() { #ifdef WANT_MAINTAINER_WATCH +/** + * Debug utilities. Macro used to write the contents of a value to + * a string, easier to watch in a debugger than the value itself. + */ + #define debug_watchValue() do { \ this->watch = watchValue(*this); \ } while (0) diff --git a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp index f6a239efe1..a23687d6b4 100644 --- a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp +++ b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp @@ -36,7 +36,7 @@ #include "http.hpp" // Ignore cast align warnings in APR macros -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wcast-align" #endif @@ -373,7 +373,7 @@ module AP_MODULE_DECLARE_DATA mod_tuscany_ssltunnel = { } // Reenable cast align warnings -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic warning "-Wcast-align" #endif diff --git a/sca-cpp/trunk/modules/java/eval.hpp b/sca-cpp/trunk/modules/java/eval.hpp index 1e119aac80..31fb09f741 100644 --- a/sca-cpp/trunk/modules/java/eval.hpp +++ b/sca-cpp/trunk/modules/java/eval.hpp @@ -72,7 +72,7 @@ public: options[args.nOptions].optionString = const_cast<char*>(c_str(cp)); options[args.nOptions++].extraInfo = NULL; -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_ASSERT // Enable assertions options[args.nOptions++].optionString = const_cast<char*>("-ea"); #endif diff --git a/sca-cpp/trunk/modules/js/eval.hpp b/sca-cpp/trunk/modules/js/eval.hpp index 17f73f2b43..149716e4ca 100644 --- a/sca-cpp/trunk/modules/js/eval.hpp +++ b/sca-cpp/trunk/modules/js/eval.hpp @@ -27,13 +27,13 @@ */ #define XP_UNIX -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wredundant-decls" #endif #include <jsapi.h> -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_WARNINGS #pragma GCC diagnostic warning "-Wunused-parameter" #pragma GCC diagnostic warning "-Wsign-compare" #pragma GCC diagnostic ignored "-Wredundant-decls" diff --git a/sca-cpp/trunk/modules/opencl/eval.hpp b/sca-cpp/trunk/modules/opencl/eval.hpp index 35eb6a3b3b..82706ff0f2 100644 --- a/sca-cpp/trunk/modules/opencl/eval.hpp +++ b/sca-cpp/trunk/modules/opencl/eval.hpp @@ -47,11 +47,11 @@ const string clError(const cl_int e) { return str(s); } -#ifdef WANT_MAINTAINER_MODE - /** * OpenCL profiling counters. */ +#ifdef WANT_MAINTAINER_OPENCL_PROF + cl_ulong memtime = 0; cl_ulong kernelqtime = 0; cl_ulong kerneltime = 0; @@ -209,7 +209,7 @@ public: for (cl_uint i = 0; i < ndevs; i++) { cl_int cqerr; -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_OPENCL_PROF cq[i] = clCreateCommandQueue(ctx, devid[i], CL_QUEUE_PROFILING_ENABLE, &cqerr); #else cq[i] = clCreateCommandQueue(ctx, devid[i], 0, &cqerr); @@ -594,7 +594,7 @@ const failable<OpenCLKernel> createKernel(const value& expr, const OpenCLProgram */ const failable<value> evalKernel(const failable<OpenCLKernel>& fkernel, const value& expr, const size_t gwsize, const value::ValueType type, const size_t n, const OpenCLContext& cl) { -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_OPENCL_PROF const cl_uint estart = (cl_uint)timens(); const cl_uint pstart = estart; #endif @@ -643,7 +643,7 @@ const failable<value> evalKernel(const failable<OpenCLKernel>& fkernel, const va return mkfailure<value>(string("Couldn't read from OpenCL device memory: ") + clError(rerr)); } -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_OPENCL_PROF const cl_uint pend = (cl_uint)timens(); preptime += (pend - pstart); #endif @@ -656,7 +656,7 @@ const failable<value> evalKernel(const failable<OpenCLKernel>& fkernel, const va return mkfailure<value>(string("Couldn't wait for kernel completion: ") + clError(werr)); } -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_OPENCL_PROF profileMemEvents(nwevt, wevt); profileKernelEvent(kevt); profileMemEvent(revt); @@ -669,7 +669,7 @@ const failable<value> evalKernel(const failable<OpenCLKernel>& fkernel, const va clReleaseEvent(revt); clReleaseEvent(kevt); -#ifdef WANT_MAINTAINER_MODE +#ifdef WANT_MAINTAINER_OPENCL_PROF const cl_uint eend = (cl_uint)timens(); evaltime += (eend - estart); #endif diff --git a/sca-cpp/trunk/modules/server/mod-eval.hpp b/sca-cpp/trunk/modules/server/mod-eval.hpp index 6595c36266..ef2a2f6575 100644 --- a/sca-cpp/trunk/modules/server/mod-eval.hpp +++ b/sca-cpp/trunk/modules/server/mod-eval.hpp @@ -1043,7 +1043,7 @@ int translate(request_rec *r) { // Create a scoped memory pool gc_scoped_pool pool(r->pool); - httpdDebugRequest(r, "modeval::translate::input"); + debug_httpdRequest(r, "modeval::translate::input"); // Get the server configuration const ServerConf& sc = httpd::serverConf<ServerConf>(r, &mod_tuscany_eval); @@ -1142,7 +1142,7 @@ int handler(request_rec *r) { gc_scoped_pool pool(r->pool); ScopedRequest sr(r); - httpdDebugRequest(r, "modeval::handler::input"); + debug_httpdRequest(r, "modeval::handler::input"); // Get the request configuration RequestConf& reqc = httpd::requestConf<RequestConf>(r, &mod_tuscany_eval); |