public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, libiberty]: Avoid "enum conversion when passing argument 1 of ‘getrusage’ is invalid in C++" warning
@ 2015-07-01 10:07 Uros Bizjak
  2015-07-08  7:06 ` Uros Bizjak
  2015-07-09 13:00 ` Ian Lance Taylor
  0 siblings, 2 replies; 5+ messages in thread
From: Uros Bizjak @ 2015-07-01 10:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ian Taylor

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

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  <ubizjak@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.

[-- Attachment #2: l.diff.txt --]
[-- Type: text/plain, Size: 577 bytes --]

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 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-09 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01 10:07 [PATCH, libiberty]: Avoid "enum conversion when passing argument 1 of ‘getrusage’ is invalid in C++" warning Uros Bizjak
2015-07-08  7:06 ` Uros Bizjak
2015-07-09 13:00 ` Ian Lance Taylor
2015-07-09 14:15   ` Uros Bizjak
2015-07-09 14:32     ` Ian Lance Taylor

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).