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

Michał Górny via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 9 12:06:36 PST 2021


mgorny 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;
----------------
shafik wrote:
> 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. 
Could you suggest how to fix it? Some platforms have different signedness than the GDB struct type.


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