[clang] 4fa736b - [Clang] NFC Silence compiler warning spam (#86532)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 02:33:16 PDT 2024


Author: NagyDonat
Date: 2024-03-26T10:33:12+01:00
New Revision: 4fa736ba41fce885047bd5a242230b216ea85c70

URL: https://github.com/llvm/llvm-project/commit/4fa736ba41fce885047bd5a242230b216ea85c70
DIFF: https://github.com/llvm/llvm-project/commit/4fa736ba41fce885047bd5a242230b216ea85c70.diff

LOG: [Clang] NFC Silence compiler warning spam (#86532)

This non-functional change eliminates the compiler warning
```
/repo/llvm-project/clang/include/clang/Basic/SyncScope.h: In member function ‘virtual bool clang::AtomicScopeGenericModel::isValid(unsigned int) const’:
/repo/llvm-project/clang/include/clang/Basic/SyncScope.h:255:14: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     return S >= static_cast<unsigned>(System) &&
            ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
which was appearing repeatedly, as this header is included into very
many source files (through various chains of 6-7 header files).

Added: 
    

Modified: 
    clang/include/clang/Basic/SyncScope.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/SyncScope.h b/clang/include/clang/Basic/SyncScope.h
index bc7ec7b5cf777e..45beff41afa11d 100644
--- a/clang/include/clang/Basic/SyncScope.h
+++ b/clang/include/clang/Basic/SyncScope.h
@@ -252,8 +252,7 @@ class AtomicScopeGenericModel : public AtomicScopeModel {
   }
 
   bool isValid(unsigned S) const override {
-    return S >= static_cast<unsigned>(System) &&
-           S <= static_cast<unsigned>(Last);
+    return S <= static_cast<unsigned>(Last);
   }
 
   ArrayRef<unsigned> getRuntimeValues() const override {


        


More information about the cfe-commits mailing list