[libcxx-commits] [PATCH] D99373: [SystemZ][z/OS] tune down warning about unused parameter on nanosleep()
Zibi Sarbino via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 25 13:16:42 PDT 2021
zibi created this revision.
zibi requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
The first parametr of nanosleep() is not used and caused failures in check-cxx.
This patch will eliminate this warning.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99373
Files:
libcxx/include/__support/ibm/nanosleep.h
Index: libcxx/include/__support/ibm/nanosleep.h
===================================================================
--- libcxx/include/__support/ibm/nanosleep.h
+++ libcxx/include/__support/ibm/nanosleep.h
@@ -12,27 +12,25 @@
#include <unistd.h>
-inline int nanosleep(const struct timespec* req, struct timespec* rem)
-{
- // The nanosleep() function is not available on z/OS. Therefore, we will call
- // sleep() to sleep for whole seconds and usleep() to sleep for any remaining
- // fraction of a second. Any remaining nanoseconds will round up to the next
- // microsecond.
+inline int nanosleep(const struct timespec*, struct timespec* rem) {
+ // The nanosleep() function is not available on z/OS. Therefore, we will call
+ // sleep() to sleep for whole seconds and usleep() to sleep for any remaining
+ // fraction of a second. Any remaining nanoseconds will round up to the next
+ // microsecond.
- useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000;
- if (__micro_sec > 999999)
- {
- ++rem->tv_sec;
- __micro_sec -= 1000000;
- }
- while (rem->tv_sec)
- rem->tv_sec = sleep(rem->tv_sec);
- if (__micro_sec) {
- rem->tv_nsec = __micro_sec * 1000;
- return usleep(__micro_sec);
- }
- rem->tv_nsec = 0;
- return 0;
+ useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000;
+ if (__micro_sec > 999999) {
+ ++rem->tv_sec;
+ __micro_sec -= 1000000;
+ }
+ while (rem->tv_sec)
+ rem->tv_sec = sleep(rem->tv_sec);
+ if (__micro_sec) {
+ rem->tv_nsec = __micro_sec * 1000;
+ return usleep(__micro_sec);
+ }
+ rem->tv_nsec = 0;
+ return 0;
}
#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99373.333408.patch
Type: text/x-patch
Size: 1666 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210325/584cd7c3/attachment.bin>
More information about the libcxx-commits
mailing list