bison-patches
[Top][All Lists]
Advanced

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

[PATCH 01/12] timevar: remove remains of GCC


From: Akim Demaille
Subject: [PATCH 01/12] timevar: remove remains of GCC
Date: Sat, 22 Sep 2018 13:49:37 +0200

* lib/timevar.h, lib/timevar.c: Rename the header guard.
Get rid of parts meant for GCC only.
---
 lib/timevar.c | 39 +++++----------------------------------
 lib/timevar.h |  6 +++---
 2 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/lib/timevar.c b/lib/timevar.c
index 27c7bf47..4ff63ca0 100644
--- a/lib/timevar.c
+++ b/lib/timevar.c
@@ -20,26 +20,13 @@
 
 #include <config.h>
 
-#if IN_GCC
-
-#include "system.h"
-#include "intl.h"
-#include "rtl.h"
-
-#else
-
-/* This source file is taken from the GCC source code, with slight
-   modifications that are under control of the IN_GCC preprocessor
-   variable.  The !IN_GCC part of this file is specific to Bison.  */
-
-# include "../src/system.h"
-# if HAVE_SYS_TIME_H
-#  include <sys/time.h>
-# endif
-int timevar_report = 0;
+/* This source file was taken from the GCC source code.  */
 
+#include "../src/system.h"
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
 #endif
-
+int timevar_report = 0;
 
 #ifdef HAVE_SYS_TIMES_H
 # include <sys/times.h>
@@ -72,10 +59,6 @@ extern clock_t times (struct tms *);
 extern clock_t clock (void);
 #endif
 
-#ifndef RUSAGE_SELF
-# define RUSAGE_SELF 0
-#endif
-
 /* Calculation of scale factor to convert ticks to microseconds.
    We mustn't use CLOCKS_PER_SEC except with clock().  */
 #if HAVE_SYSCONF && defined _SC_CLK_TCK
@@ -126,9 +109,6 @@ static float clocks_to_msec;
 #define CLOCKS_TO_MSEC (1.0 / CLOCKS_PER_SEC)
 #endif
 
-#if IN_GCC
-#include "flags.h"
-#endif
 #include "timevar.h"
 
 /* See timevar.h for an explanation of timing variables.  */
@@ -211,21 +191,12 @@ get_time (now)
 #ifdef USE_TIMES
     struct tms tms;
     now->wall = times (&tms)  * ticks_to_msec;
-#if IN_GCC
-    now->user = tms.tms_utime * ticks_to_msec;
-    now->sys  = tms.tms_stime * ticks_to_msec;
-#else
     now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
     now->sys  = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
 #endif
-#endif
 #ifdef USE_GETRUSAGE
     struct rusage rusage;
-#if IN_GCC
-    getrusage (RUSAGE_SELF, &rusage);
-#else
     getrusage (RUSAGE_CHILDREN, &rusage);
-#endif
     now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
     now->sys  = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
 #endif
diff --git a/lib/timevar.h b/lib/timevar.h
index 14366c96..37c2cae5 100644
--- a/lib/timevar.h
+++ b/lib/timevar.h
@@ -18,8 +18,8 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef GCC_TIMEVAR_H
-#define GCC_TIMEVAR_H
+#ifndef _TIMEVAR_H
+#define _TIMEVAR_H
 
 /* Timing variables are used to measure elapsed time in various
    portions of the compiler.  Each measures elapsed user, system, and
@@ -89,4 +89,4 @@ extern void print_time (const char *, long);
 
 extern int timevar_report;
 
-#endif /* ! GCC_TIMEVAR_H */
+#endif /* ! _TIMEVAR_H */
-- 
2.19.0




reply via email to

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