[glibc/azanella/clang] posix: Use unsigned to check for _POSIX_VDISABLE

Adhemerval Zanella azanella@sourceware.org
Tue Apr 2 15:53:06 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a167c11a2cfec90ab95c165fd5db1ac807a3eb3e

commit a167c11a2cfec90ab95c165fd5db1ac807a3eb3e
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 15 18:09:10 2022 -0300

    posix: Use unsigned to check for _POSIX_VDISABLE
    
    Clang warns:
    
      ../sysdeps/posix/fpathconf.c:118:21: error: right side of operator
      converted from negative value to unsigned: -1 to 18446744073709551615
      [-Werror]
      #if _POSIX_VDISABLE == -1
        ~~~~~~~~~~~~~~~ ^  ~~

Diff:
---
 sysdeps/posix/fpathconf.c | 2 +-
 sysdeps/posix/pathconf.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sysdeps/posix/fpathconf.c b/sysdeps/posix/fpathconf.c
index 3284e88b8e..f7b68da779 100644
--- a/sysdeps/posix/fpathconf.c
+++ b/sysdeps/posix/fpathconf.c
@@ -115,7 +115,7 @@ __fpathconf (int fd, int name)
       return _POSIX_NO_TRUNC;
 
     case _PC_VDISABLE:
-#if _POSIX_VDISABLE == -1
+#if _POSIX_VDISABLE == -1U
 # error "Invalid value for _POSIX_VDISABLE"
 #endif
       return _POSIX_VDISABLE;
diff --git a/sysdeps/posix/pathconf.c b/sysdeps/posix/pathconf.c
index 2a17082301..61d7469acc 100644
--- a/sysdeps/posix/pathconf.c
+++ b/sysdeps/posix/pathconf.c
@@ -113,7 +113,7 @@ __pathconf (const char *path, int name)
       return _POSIX_NO_TRUNC;
 
     case _PC_VDISABLE:
-#if _POSIX_VDISABLE == -1
+#if _POSIX_VDISABLE == -1U
 # error "Invalid value for _POSIX_VDISABLE"
 #endif
       return _POSIX_VDISABLE;


More information about the Glibc-cvs mailing list