[Lldb-commits] [PATCH] SBHostOS: Fix a pointer-to-function to void-pointer cast

David Majnemer david.majnemer at gmail.com
Tue Jul 22 13:13:30 PDT 2014


Hi zturner, tfiala,

reinterpret_cast may not convert a pointer-to-function to a
void-pointer.  Take a detour through intptr_t and *then* convert to a
pointer-to-function.

This fixes a warning emitted by GCC.

http://reviews.llvm.org/D4624

Files:
  source/API/SBHostOS.cpp

Index: source/API/SBHostOS.cpp
===================================================================
--- source/API/SBHostOS.cpp
+++ source/API/SBHostOS.cpp
@@ -51,7 +51,7 @@
 
     if (log)
         log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)",
-                     name, reinterpret_cast<void*>(thread_function),
+                     name, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(thread_function)),
                      static_cast<void*>(thread_arg),
                      static_cast<void*>(error_ptr));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4624.11775.patch
Type: text/x-patch
Size: 578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140722/24e40873/attachment.bin>


More information about the lldb-commits mailing list