public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com
Subject: [committed] Enable developer-only options only with -DDEVEL
Date: Tue, 01 Jan 2019 00:00:00 -0000	[thread overview]
Message-ID: <20190406170227.GA17128@delia> (raw)

Hi,

For the --devel-ignore-locus option, we changed the code implementing that
option to test ignore_locus at run-time, instead of testing IGNORE_LOCUS, by
default defined to 0 at compile time.  This caused a performance regression on
cc1 of ~0.5%.

Fix this by only enabling the developer-only options if DEVEL is defined.

Committed to trunk.

Thanks,
- Tom

Enable developer-only options only with -DDEVEL

2019-04-06  Tom de Vries  <tdevries@suse.de>

	* Makefile (dwz-for-test): Add -DDEVEL.
	* dwz.c [!DEVEL] (tracing, ignore_size, ignore_locus): Define to 0.
	[!DEVEL] (dwz_options): Remove --devel options.
	* testsuite/dwz.tests/devel-ignore-locus.sh: Use dwz-for-test instead
	* of dwz.
	* testsuite/dwz.tests/devel-ignore-size.sh: Same.
	* testsuite/dwz.tests/devel-trace.sh: Same.

---
 Makefile                                  | 2 +-
 dwz.c                                     | 8 ++++++++
 testsuite/dwz.tests/devel-ignore-locus.sh | 4 ++--
 testsuite/dwz.tests/devel-ignore-size.sh  | 4 ++--
 testsuite/dwz.tests/devel-trace.sh        | 2 +-
 5 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 9b4fb7f..69058a9 100644
--- a/Makefile
+++ b/Makefile
@@ -35,7 +35,7 @@ DWZ_TEST_SOURCES := $(patsubst %.o,%-for-test.c,$(OBJECTS))
 	sed 's/__GNUC__/NOT_DEFINED/' $< > $@
 
 dwz-for-test: $(DWZ_TEST_SOURCES)
-	$(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W \
+	$(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W -DDEVEL \
 	  -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"'
 
 min:
diff --git a/dwz.c b/dwz.c
index 9dba649..d31be82 100644
--- a/dwz.c
+++ b/dwz.c
@@ -132,9 +132,15 @@ static struct obstack ob2;
    and restored during final cleanup.  */
 static struct obstack alt_ob, alt_ob2;
 
+#if DEVEL
 static int tracing;
 static int ignore_size;
 static int ignore_locus;
+#else
+#define tracing 0
+#define ignore_size 0
+#define ignore_locus 0
+#endif
 
 typedef struct
 {
@@ -11821,9 +11827,11 @@ static struct option dwz_options[] =
   { "multifile-name",	 required_argument, 0, 'M' },
   { "relative",		 no_argument,	    0, 'r' },
   { "version",		 no_argument,	    0, 'v' },
+#if DEVEL
   { "devel-trace",	 no_argument,	    &tracing, 1 },
   { "devel-ignore-size", no_argument,	    &ignore_size, 1 },
   { "devel-ignore-locus",no_argument,	    &ignore_locus, 1 },
+#endif
   { NULL,		 no_argument,	    0, 0 }
 };
 
diff --git a/testsuite/dwz.tests/devel-ignore-locus.sh b/testsuite/dwz.tests/devel-ignore-locus.sh
index e856cc6..1cd0735 100644
--- a/testsuite/dwz.tests/devel-ignore-locus.sh
+++ b/testsuite/dwz.tests/devel-ignore-locus.sh
@@ -6,7 +6,7 @@ cnt=$(readelf -wi 1 \
 
 [ $cnt -eq 2 ]
 
-dwz 1 2>/dev/null
+../dwz-for-test 1 2>/dev/null
 
 cnt=$(readelf -wi 1 \
 	    | grep 'DW_AT_name.*: aaa' \
@@ -16,7 +16,7 @@ cnt=$(readelf -wi 1 \
 
 cp ../two-typedef 1
 
-dwz --devel-ignore-locus --devel-ignore-size 1
+../dwz-for-test --devel-ignore-locus --devel-ignore-size 1
 
 cnt=$(readelf -wi 1 \
 	    | grep 'DW_AT_name.*: aaa' \
diff --git a/testsuite/dwz.tests/devel-ignore-size.sh b/testsuite/dwz.tests/devel-ignore-size.sh
index 31cc923..db1c3eb 100644
--- a/testsuite/dwz.tests/devel-ignore-size.sh
+++ b/testsuite/dwz.tests/devel-ignore-size.sh
@@ -6,7 +6,7 @@ cnt=$(readelf -wi 1 \
 
 [ $cnt -eq 0 ]
 
-dwz 1 2>/dev/null
+../dwz-for-test 1 2>/dev/null
 
 cnt=$(readelf -wi 1 \
 	    | grep '(DW_TAG_partial_unit' \
@@ -16,7 +16,7 @@ cnt=$(readelf -wi 1 \
 
 cp ../min 1
 
-dwz --devel-ignore-size 1
+../dwz-for-test --devel-ignore-size 1
 
 cnt=$(readelf -wi 1 \
 	    | grep '(DW_TAG_partial_unit' \
diff --git a/testsuite/dwz.tests/devel-trace.sh b/testsuite/dwz.tests/devel-trace.sh
index 089cb52..7b3eb6b 100644
--- a/testsuite/dwz.tests/devel-trace.sh
+++ b/testsuite/dwz.tests/devel-trace.sh
@@ -1,5 +1,5 @@
 cp ../hello 1
 
-dwz --devel-trace 1 2>/dev/null
+../dwz-for-test --devel-trace 1 2>/dev/null
 
 rm -f 1

                 reply	other threads:[~2019-04-06 17:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190406170227.GA17128@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).