[Lldb-commits] [PATCH] D107840: [lldb] [gdb-server] Implement the vFile:fstat packet

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 9 11:56:46 PST 2021


shafik added inline comments.


================
Comment at: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp:762
+static void fill_clamp(T &dest, U src, typename T::value_type fallback) {
+  dest = src <= std::numeric_limits<typename T::value_type>::max() ? src
+                                                                   : fallback;
----------------
I am building on a macOS and I seeing the following diagnostic for this line:

```
warning: comparison of integers of different signs: 'int' and 'std::numeric_limits<unsigned int>::type' (aka 'unsigned int') [-Wsign-compare]
  dest = src <= std::numeric_limits<typename T::value_type>::max() ? src
         ~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

and it is triggered by:

```
fill_clamp(data.gdb_st_dev, file_stats.st_dev, 0);
```

In this case it will do the right thing but allowing mixed types is problematic, usually I see clamp done with homogeneous types. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D107840/new/

https://reviews.llvm.org/D107840



More information about the lldb-commits mailing list