bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 11/12] timevar: get rid of a useless macro


From: Akim Demaille
Subject: [PATCH 11/12] timevar: get rid of a useless macro
Date: Sat, 22 Sep 2018 13:49:47 +0200

* lib/timevar.h (timevar_report): Rename as...
(timevar_enabled): this.
* lib/timevar.c (TIMEVAR_ENABLE): Remove.
---
 lib/timevar.c | 18 ++++++++----------
 lib/timevar.h |  3 ++-
 src/main.c    |  2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/lib/timevar.c b/lib/timevar.c
index 6a7d292b..ded64901 100644
--- a/lib/timevar.c
+++ b/lib/timevar.c
@@ -26,7 +26,6 @@
 #if HAVE_SYS_TIME_H
 # include <sys/time.h>
 #endif
-int timevar_report = 0;
 
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
@@ -103,8 +102,7 @@ static float clocks_to_msec;
 
 /* See timevar.h for an explanation of timing variables.  */
 
-/* This macro evaluates to nonzero if timing variables are enabled.  */
-#define TIMEVAR_ENABLE (timevar_report)
+int timevar_enabled = 0;
 
 /* A timing variable.  */
 
@@ -168,7 +166,7 @@ set_to_current_time (struct timevar_time_def *now)
   now->sys  = 0;
   now->wall = 0;
 
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   {
@@ -213,7 +211,7 @@ timevar_accumulate (struct timevar_time_def *timer,
 void
 timevar_init ()
 {
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   /* Zero all elapsed times.  */
@@ -235,7 +233,7 @@ timevar_init ()
 void
 timevar_push (timevar_id_t timevar)
 {
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   struct timevar_def *tv = &timevars[timevar];
@@ -280,7 +278,7 @@ timevar_push (timevar_id_t timevar)
 void
 timevar_pop (timevar_id_t timevar)
 {
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   if (&timevars[timevar] != stack->timevar)
@@ -309,7 +307,7 @@ timevar_pop (timevar_id_t timevar)
 void
 timevar_start (timevar_id_t timevar)
 {
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   struct timevar_def *tv = &timevars[timevar];
@@ -329,7 +327,7 @@ timevar_start (timevar_id_t timevar)
 void
 timevar_stop (timevar_id_t timevar)
 {
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   struct timevar_def *tv = &timevars[timevar];
@@ -368,7 +366,7 @@ timevar_print (FILE *fp)
 {
   /* Only print stuff if we have some sort of time information.  */
 #if defined HAVE_USER_TIME || defined HAVE_SYS_TIME || defined HAVE_WALL_TIME
-  if (!TIMEVAR_ENABLE)
+  if (!timevar_enabled)
     return;
 
   /* Update timing information in case we're calling this from GDB.  */
diff --git a/lib/timevar.h b/lib/timevar.h
index f1b697ae..a3c4e864 100644
--- a/lib/timevar.h
+++ b/lib/timevar.h
@@ -117,6 +117,7 @@ void timevar_get (timevar_id_t, struct timevar_time_def *);
 
 void timevar_print (FILE *);
 
-extern int timevar_report;
+/* Set to to nonzero to enable timing variables.  */
+extern int timevar_enabled;
 
 #endif /* ! _TIMEVAR_H */
diff --git a/src/main.c b/src/main.c
index 50c5c3eb..4a8129b6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -80,7 +80,7 @@ main (int argc, char *argv[])
 
   getargs (argc, argv);
 
-  timevar_report = trace_flag & trace_time;
+  timevar_enabled = trace_flag & trace_time;
   timevar_init ();
   timevar_start (TV_TOTAL);
 
-- 
2.19.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]