Hello!

This patch avoids "enum conversion when passing argument 1 of
‘getrusage’ is invalid in C++" warning when compiling getruntime.c.
The condition is copied from sys/resource.h.

2015-07-01  Uros Bizjak  <ubiz...@gmail.com>

    * getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as
    argument 1 of getrusage call.

Bootstrapped on x86_64-linux-gnu.

OK for mainline?

Uros.
Index: getruntime.c
===================================================================
--- getruntime.c        (revision 225221)
+++ getruntime.c        (working copy)
@@ -95,7 +95,11 @@ get_run_time (void)
 #if defined (HAVE_GETRUSAGE) && defined (HAVE_SYS_RESOURCE_H)
   struct rusage rusage;
 
+#if defined __USE_GNU && !defined __cplusplus
+  getrusage (RUSAGE_SELF, &rusage);
+#else
   getrusage (0, &rusage);
+#endif
   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
          + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
 #else /* ! HAVE_GETRUSAGE */

Reply via email to