Skip to content

Commit b51c78e

Browse files
Add explicit casts to printing of function pointers
Compiling with clang on Windows fails here with a warning about implicit cast from function pointer to object pointer. Rather than disable that warning, this makes it an explicit cast. Since this is just test output, it's not critical that this be a completely safe operation. Part of flutter#16256
1 parent e43a100 commit b51c78e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

shell/platform/embedder/tests/embedder_assertions.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,16 @@ inline std::ostream& operator<<(std::ostream& out,
224224
const FlutterOpenGLTexture& item) {
225225
return out << "(FlutterOpenGLTexture) Target: 0x" << std::hex << item.target
226226
<< std::dec << " Name: " << item.name << " Format: " << item.format
227-
<< " User Data: " << item.user_data
228-
<< " Destruction Callback: " << item.destruction_callback;
227+
<< " User Data: " << item.user_data << " Destruction Callback: "
228+
<< reinterpret_cast<void*>(item.destruction_callback);
229229
}
230230

231231
inline std::ostream& operator<<(std::ostream& out,
232232
const FlutterOpenGLFramebuffer& item) {
233233
return out << "(FlutterOpenGLFramebuffer) Target: 0x" << std::hex
234234
<< item.target << std::dec << " Name: " << item.name
235-
<< " User Data: " << item.user_data
236-
<< " Destruction Callback: " << item.destruction_callback;
235+
<< " User Data: " << item.user_data << " Destruction Callback: "
236+
<< reinterpret_cast<void*>(item.destruction_callback);
237237
}
238238

239239
inline std::string FlutterPlatformViewMutationTypeToString(
@@ -318,8 +318,8 @@ inline std::ostream& operator<<(std::ostream& out,
318318
const FlutterSoftwareBackingStore& item) {
319319
return out << "(FlutterSoftwareBackingStore) Allocation: " << item.allocation
320320
<< " Row Bytes: " << item.row_bytes << " Height: " << item.height
321-
<< " User Data: " << item.user_data
322-
<< " Destruction Callback: " << item.destruction_callback;
321+
<< " User Data: " << item.user_data << " Destruction Callback: "
322+
<< reinterpret_cast<void*>(item.destruction_callback);
323323
}
324324

325325
inline std::ostream& operator<<(std::ostream& out,

0 commit comments

Comments
 (0)