When working on a couple of Cilk Plus issues lately (PRs target/60290,
target/68945), I noticed that you have to modify the libcilkplus sources
to enable various debugging output.  This seems silly, and the following
patch allows defining them from the command line.

Tested on i386-pc-solaris2.12 and sparc-sun-solaris2.12.

Ok for mainline?

        Rainer


2016-04-07  Rainer Orth  <r...@cebitec.uni-bielefeld.de>

        * runtime/except-gcc.cpp (DEBUG_EXCEPTIONS): Allow redefinition.
        * runtime/cilk_fiber.h (FIBER_DEBUG): Likewise.
        * runtime/scheduler.h (REDPAR_DEBUG): Likewise.

# HG changeset patch
# Parent  072a0724a080e27be15d001b8507af7a2490d73d
Allow redefinition of libcilkrts debug macros

diff --git a/libcilkrts/runtime/cilk_fiber.h b/libcilkrts/runtime/cilk_fiber.h
--- a/libcilkrts/runtime/cilk_fiber.h
+++ b/libcilkrts/runtime/cilk_fiber.h
@@ -63,7 +63,9 @@
  * A value of 0 means no debugging.
  * Higher values generate more debugging output.
  */
+#ifndef FIBER_DEBUG
 #define FIBER_DEBUG 0
+#endif
 
 /**
  * @brief Flag for validating reference counts.
diff --git a/libcilkrts/runtime/except-gcc.cpp b/libcilkrts/runtime/except-gcc.cpp
--- a/libcilkrts/runtime/except-gcc.cpp
+++ b/libcilkrts/runtime/except-gcc.cpp
@@ -49,7 +49,9 @@
 #include <stdint.h>
 #include <typeinfo>
 
+#ifndef DEBUG_EXCEPTIONS
 #define DEBUG_EXCEPTIONS 0
+#endif
 
 struct pending_exception_info
 {
diff --git a/libcilkrts/runtime/scheduler.h b/libcilkrts/runtime/scheduler.h
--- a/libcilkrts/runtime/scheduler.h
+++ b/libcilkrts/runtime/scheduler.h
@@ -74,7 +74,9 @@
  * Print debugging messages and assertions for parallel reducers. 0 is
  * no debugging.  A higher value generates more output.
  */
+#ifndef REDPAR_DEBUG
 #define REDPAR_DEBUG 0
+#endif
 
 /**
  * @brief Lock the worker mutex to allow exclusive access to the
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to