[Lldb-commits] [lldb] ee4b462 - [lldb] Fix a warning

Shafik Yaghmour via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 6 13:24:44 PST 2021


I am wondering if you also need to check if token != LLDB_INVALID_ADDRESS

> On Dec 4, 2021, at 6:34 PM, Kazu Hirata via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> 
> Author: Kazu Hirata
> Date: 2021-12-04T18:34:29-08:00
> New Revision: ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a
> 
> URL: https://github.com/llvm/llvm-project/commit/ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a
> DIFF: https://github.com/llvm/llvm-project/commit/ee4b462693b1ffeccfe1b8fcf0a0c12896ac6e6a.diff
> 
> LOG: [lldb] Fix a warning
> 
> This patch fixes:
> 
>  lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp:386:13:
>  error: comparison between NULL and non-pointer ('lldb::addr_t' (aka
>  'unsigned long') and NULL) [-Werror,-Wnull-arithmetic]
> 
> Added: 
> 
> 
> Modified: 
>    lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> 
> Removed: 
> 
> 
> 
> ################################################################################
> diff  --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> index 0e25e9a8199bd..d41d422576a9f 100644
> --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
> @@ -383,7 +383,7 @@ uint32_t PlatformWindows::DoLoadImage(Process *process,
>     return LLDB_INVALID_IMAGE_TOKEN;
>   }
> 
> -  if (token == NULL) {
> +  if (!token) {
>     // XXX(compnerd) should we use the compiler to get the sizeof(unsigned)?
>     uint64_t error_code =
>         process->ReadUnsignedIntegerFromMemory(injected_result + 2 * word_size + sizeof(unsigned),
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list