[tor-commits] [tor/master] Add a "location" field for subsystems to declare which file they are in.

teor at torproject.org teor at torproject.org
Tue Apr 7 07:36:57 UTC 2020


commit 53d74c0954b989d478c868b12647e1088a079457
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Feb 14 09:39:36 2020 -0500

    Add a "location" field for subsystems to declare which file they are in.
---
 src/lib/subsys/subsys.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/lib/subsys/subsys.h b/src/lib/subsys/subsys.h
index c05b69af3..b29015746 100644
--- a/src/lib/subsys/subsys.h
+++ b/src/lib/subsys/subsys.h
@@ -42,6 +42,11 @@ typedef struct subsys_fns_t {
   const char *name;
 
   /**
+   * The file in which the subsystem object is declared. Used for debugging.
+   **/
+  const char *location;
+
+  /**
    * Whether this subsystem is supported -- that is, whether it is compiled
    * into Tor.  For most subsystems, this should be true.
    **/
@@ -187,6 +192,14 @@ typedef struct subsys_fns_t {
   int (*flush_state)(void *);
 } subsys_fns_t;
 
+#ifndef COCCI
+/**
+ * Macro to declare a subsystem's location.
+ **/
+#define SUBSYS_DECLARE_LOCATION() \
+  .location = __FILE__
+#endif
+
 /**
  * Lowest allowed subsystem level.
  **/





More information about the tor-commits mailing list