public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Don't guard dump_die and dump_die calls with '#if DEVEL'
@ 2019-01-01  0:00 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-01-01  0:00 UTC (permalink / raw)
  To: dwz, jakub

Hi,

I've used this pattern to enable the --devel-dump-dies code:
...
  #if DEVEL
  static int dump_dies_p;
  #else
  #define dump_dies_p 0
  #endif

  #if DEVEL
    if (dump_dies_p)
      dump_dies (...);
  #endif
...
but the second '#if DEVEL' is not required.

Without -DDEVEL, the call evaluates to:
...
    if (0)
      dump_dies (...);
...
which will be optimized out, as well as the dump_dies function itself.

Drop the '#if DEVEL' guard dump_dies and dump_dies calls.

Committed to trunk.

Thanks,
- Tom

Don't guard dump_die and dump_die calls with '#if DEVEL'

2019-11-05  Tom de Vries  <tdevries@suse.de>

	* dwz.c (dump_dies): Don't guard with '#if DEVEL'.
	(read_debug_info): Don't guard calls to dump_dies with '#if DEVEL'.

---
 dwz.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/dwz.c b/dwz.c
index 6b95216..7593f68 100644
--- a/dwz.c
+++ b/dwz.c
@@ -3984,7 +3984,6 @@ find_dups_fi (dw_die_ref parent)
   return 0;
 }
 
-#if DEVEL
 /* Debugging helper function to dump hash values to stdout.  */
 static void
 dump_dies (int depth, dw_die_ref die)
@@ -3998,7 +3997,6 @@ dump_dies (int depth, dw_die_ref die)
   for (child = die->die_child; child; child = child->die_sib)
     dump_dies (depth + 1, child);
 }
-#endif
 
 /* Hash table for .debug_str.  Depending on multifile optimization
    phase this hash table has 3 different hash/equality functions.
@@ -4943,11 +4941,9 @@ read_debug_info (DSO *dso, int kind)
 	      for (cu = cuf; cu; cu = cu->cu_next)
 		checksum_ref_die (cu, NULL, cu->cu_die, NULL, NULL);
 
-#if DEVEL
 	      if (dump_dies_p)
 		for (cu = cuf; cu; cu = cu->cu_next)
 		  dump_dies (0, cu->cu_die);
-#endif
 
 	      for (cu = cuf; cu; cu = cu->cu_next)
 		if (find_dups (cu->cu_die))
@@ -5364,10 +5360,8 @@ read_debug_info (DSO *dso, int kind)
 	    goto fail;
 	  checksum_ref_die (cu, NULL, cu->cu_die, NULL, NULL);
 
-#if DEVEL
 	  if (dump_dies_p)
 	    dump_dies (0, cu->cu_die);
-#endif
 
 	  if (find_dups (cu->cu_die))
 	    goto fail;
@@ -5436,11 +5430,9 @@ read_debug_info (DSO *dso, int kind)
       for (cu = first_cu; cu; cu = cu->cu_next)
 	checksum_ref_die (cu, NULL, cu->cu_die, NULL, NULL);
 
-#if DEVEL
       if (dump_dies_p)
 	for (cu = first_cu; cu; cu = cu->cu_next)
 	  dump_dies (0, cu->cu_die);
-#endif
 
       if (rd_multifile)
 	{

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-05  9:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01  0:00 [committed] Don't guard dump_die and dump_die calls with '#if DEVEL' Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).