[libc-commits] [libc] [libc] Fix unused variable warning in utimes.cpp (#188347) (PR #188448)
via libc-commits
libc-commits at lists.llvm.org
Wed Mar 25 02:50:58 PDT 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: Jeff Bailey (kaladron)
<details>
<summary>Changes</summary>
Moved the declaration of 'ret' inside the SYS_utimes block to prevent an unused variable warning on the libc-riscv32-qemu-yocto-fullbuild-dbg builder, which doesn't define SYS_utimes.
---
Full diff: https://github.com/llvm/llvm-project/pull/188448.diff
1 Files Affected:
- (modified) libc/src/sys/time/linux/utimes.cpp (+1-3)
``````````diff
diff --git a/libc/src/sys/time/linux/utimes.cpp b/libc/src/sys/time/linux/utimes.cpp
index 037094630b824..1603f70f8f4db 100644
--- a/libc/src/sys/time/linux/utimes.cpp
+++ b/libc/src/sys/time/linux/utimes.cpp
@@ -22,11 +22,9 @@ namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(int, utimes,
(const char *path, const struct timeval times[2])) {
- int ret;
-
#ifdef SYS_utimes
// No need to define a timespec struct, use the syscall directly.
- ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_utimes, path, times);
+ int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_utimes, path, times);
if (ret < 0) {
libc_errno = -ret;
``````````
</details>
https://github.com/llvm/llvm-project/pull/188448
More information about the libc-commits
mailing list