[Lldb-commits] [PATCH] D39580: Quash a few 'warning: comparison of function 'compression_decode_buffer' not equal to a null pointer is always true [-Wtautologica l-pointer-compare]'

Don Hinton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 2 16:50:58 PDT 2017


hintonda created this revision.

Quash several warnings of this type using clang's suggested fix:

[2741/3631] Building CXX object tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/GDBRemoteCommunication.cpp.o
/Users/dhinton/projects/llvm_project/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:603:7: warning: comparison of function 'compression_decode_buffer' not equal to a null pointer is always true [-Wtautological-pointer-compare]

  if (compression_decode_buffer != NULL &&
      ^~~~~~~~~~~~~~~~~~~~~~~~~    ~~~~

/Users/dhinton/projects/llvm_project/llvm/tools/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp:603:7: note: prefix with the address-of operator to silence this warning

  if (compression_decode_buffer != NULL &&
      ^
      &


https://reviews.llvm.org/D39580

Files:
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp


Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -1024,7 +1024,7 @@
 #if defined(HAVE_LIBCOMPRESSION)
   // libcompression is weak linked so test if compression_decode_buffer() is
   // available
-  if (compression_decode_buffer != NULL &&
+  if (&compression_decode_buffer != NULL &&
       avail_type == CompressionType::None) {
     for (auto compression : supported_compressions) {
       if (compression == "lzfse") {
@@ -1039,7 +1039,7 @@
 #if defined(HAVE_LIBCOMPRESSION)
   // libcompression is weak linked so test if compression_decode_buffer() is
   // available
-  if (compression_decode_buffer != NULL &&
+  if (&compression_decode_buffer != NULL &&
       avail_type == CompressionType::None) {
     for (auto compression : supported_compressions) {
       if (compression == "zlib-deflate") {
@@ -1066,7 +1066,7 @@
 #if defined(HAVE_LIBCOMPRESSION)
   // libcompression is weak linked so test if compression_decode_buffer() is
   // available
-  if (compression_decode_buffer != NULL &&
+  if (&compression_decode_buffer != NULL &&
       avail_type == CompressionType::None) {
     for (auto compression : supported_compressions) {
       if (compression == "lz4") {
@@ -1081,7 +1081,7 @@
 #if defined(HAVE_LIBCOMPRESSION)
   // libcompression is weak linked so test if compression_decode_buffer() is
   // available
-  if (compression_decode_buffer != NULL &&
+  if (&compression_decode_buffer != NULL &&
       avail_type == CompressionType::None) {
     for (auto compression : supported_compressions) {
       if (compression == "lzma") {
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===================================================================
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -600,7 +600,7 @@
 #if defined(HAVE_LIBCOMPRESSION)
   // libcompression is weak linked so check that compression_decode_buffer() is
   // available
-  if (compression_decode_buffer != NULL &&
+  if (&compression_decode_buffer != NULL &&
       (m_compression_type == CompressionType::ZlibDeflate ||
        m_compression_type == CompressionType::LZFSE ||
        m_compression_type == CompressionType::LZ4)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39580.121411.patch
Type: text/x-patch
Size: 2475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171102/87100296/attachment.bin>


More information about the lldb-commits mailing list