aboutsummaryrefslogtreecommitdiff
path: root/libiberty/getruntime.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2015-11-28 16:39:29 +0000
committerPedro Alves <palves@redhat.com>2015-11-28 16:39:29 +0000
commitaaae08a7e4ac526975403ebb5f93b7f24ea16b90 (patch)
tree81c701db21565ddc9ef14036996af73a9c027296 /libiberty/getruntime.c
parente3e3b08c81fec50ab1623a64bae164856ce215cf (diff)
downloadgdb-aaae08a7e4ac526975403ebb5f93b7f24ea16b90.zip
gdb-aaae08a7e4ac526975403ebb5f93b7f24ea16b90.tar.gz
gdb-aaae08a7e4ac526975403ebb5f93b7f24ea16b90.tar.bz2
Avoid "enum conversion when passing argument 1 of 'getrusage' is invalid in C++" warning
* getruntime.c (get_run_time) [__USE_GNU]: Use RUSAGE_SELF as argument 1 of getrusage call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225534 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/getruntime.c')
-rw-r--r--libiberty/getruntime.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libiberty/getruntime.c b/libiberty/getruntime.c
index 82f3d2e..9d5eed1 100644
--- a/libiberty/getruntime.c
+++ b/libiberty/getruntime.c
@@ -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 */