You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tcl.apache.org by mx...@apache.org on 2020/10/01 17:14:41 UTC

[tcl-rivet] branch master updated: conditional build of code for debugging

This is an automated email from the ASF dual-hosted git repository.

mxmanghi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tcl-rivet.git


The following commit(s) were added to refs/heads/master by this push:
     new 2426a54  conditional build of code for debugging
2426a54 is described below

commit 2426a547260215ff22d5eeabe413158b52760f0b
Author: Massimo Manghi <mx...@apache.org>
AuthorDate: Thu Oct 1 19:14:22 2020 +0200

    conditional build of code for debugging
---
 ChangeLog                    |  1 +
 configure.ac                 | 28 +++++++++++++++++++++++++---
 src/mod_rivet_ng/rivetCore.c | 12 ++++++------
 3 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d49b728..a99040f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2020-10-01 Massimo Manghi <mx...@apache.org>
 	* src/mod_rivet_ng/rivet_prefork_mpm.c: Fixed trivial bug in checking the
 	rivet cache size
+	* configure.ac: add macro to define preprocessor symbol	RIVET_DEBUG_CODE
 
 2020-09-29 Massimo Manghi <mx...@apache.org>
 	* src/mod_rivet_ng/mod_rivet.[c|h]:
diff --git a/configure.ac b/configure.ac
index 1f5c279..43a9885 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,8 +6,6 @@ dnl
 dnl You need at least autoconf 2.59
 dnl
 #
-# RCS: @(#) $Id$
-
 #-----------------------------------------------------------------------
 # Sample configure.in for Tcl Extensions.  The only places you should
 # need to modify this file are marked by the string __CHANGE__
@@ -573,7 +571,6 @@ AC_DEFUN([RIVET_TCL_LIB],[
     AC_MSG_RESULT([$with_rivet_target_dir])
 ])
 
-
 # DISPLAY_RIVET_VERSION
 #
 # --enable-version-display=[yes|no] (default: no)
@@ -700,6 +697,30 @@ AC_DEFUN([HTTP_REQUESTS_MUTEX],[
     fi
 ])
 
+# -- RIVET_DEBUG_BUILD
+#
+# Defining a symbol for conditional inclusion of code for debugging purposes
+#
+# Default: no
+#
+
+AC_DEFUN([BUILD_DEBUG_CODE],[
+    AC_ARG_ENABLE(
+        rivet_debug_build,
+        [  --enable-rivet-debug-build Includes optional debugging code],
+        [ rivet_debug_build=$enable_rivet_debug_build ],
+        [ rivet_debug_build="no" ]
+    )
+
+    AC_MSG_CHECKING([if we are building mod_rivet for debugging])
+    if test "$rivet_debug_build" = "yes"; then
+        AC_MSG_RESULT([yes])
+        AC_DEFINE(DEBUG_BUILD,1,[we are building mod_rivet with optional code])
+    else
+        AC_MSG_RESULT([no, ordinary build])
+    fi
+])
+
 # RIVET_COMMANDS_EXPORT (--enable-rivet-commands-export).
 # Enable export of commands in Rivet's namespace. Definining this symbols
 # sets the boolean configuration variable rivet_commands_export 
@@ -836,6 +857,7 @@ RIVET_CORE_CMDS
 RIVET_CHANNEL
 SINGLE_WORKER_TCL_THREAD
 HTTP_REQUESTS_MUTEX
+BUILD_DEBUG_CODE
 AC_HEADER_STDBOOL
 
 # Let's separate the point version from the major and minor version
diff --git a/src/mod_rivet_ng/rivetCore.c b/src/mod_rivet_ng/rivetCore.c
index e625ea6..9c36937 100644
--- a/src/mod_rivet_ng/rivetCore.c
+++ b/src/mod_rivet_ng/rivetCore.c
@@ -2034,10 +2034,11 @@ TCL_CMD_HEADER( Rivet_GetThreadId )
     return TCL_OK;
 }
 
+#ifdef RIVET_DEBUG_BUILD
 /*
  *-----------------------------------------------------------------------------
  *
- * Rivet_DumpCache --
+ * Rivet_CacheContent --
  *
  *      Dumping in a list the cache content. For debugging purposes.
  *      This command will be placed within conditional compilation and
@@ -2088,6 +2089,7 @@ TCL_CMD_HEADER( Rivet_CacheContent )
     return TCL_OK;
 }
 
+#endif /* RIVET_DEBUG_BUILD */
 
 /*
  *-----------------------------------------------------------------------------
@@ -2133,12 +2135,10 @@ Rivet_InitCore(Tcl_Interp *interp,rivet_thread_private* private)
     RIVET_OBJ_CMD ("url_script",Rivet_UrlScript,private);
     RIVET_OBJ_CMD ("thread_id",Rivet_GetThreadId,private);
     
-    /* dump_cache: To be put within conditional compilation
-     * and not to be exported 
-     */
-
+#ifdef RIVET_DEBUG_BUILD
+    /* code compiled conditionally for debugging */
     RIVET_OBJ_CMD ("cache_content",Rivet_CacheContent,private);
-
+#endif
 #ifdef TESTPANIC
     RIVET_OBJ_CMD ("testpanic",TestpanicCmd,private);
 #endif


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tcl.apache.org
For additional commands, e-mail: commits-help@tcl.apache.org