From 01bb53d67eb8e8ecdbdda775b172e4c8eeb72990 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 4 Jun 2025 12:01:52 -0500 Subject: [PATCH 1/4] Fix definition of `_Py_RemoteDebug_` symbols for static linking --- Python/remote_debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index 6cbf1c8deaaed9..ab494ea71da772 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -131,7 +131,7 @@ _Py_RemoteDebug_FreePageCache(proc_handle_t *handle) } } -void +static void _Py_RemoteDebug_ClearCache(proc_handle_t *handle) { for (int i = 0; i < MAX_PAGES; i++) { @@ -989,7 +989,7 @@ _Py_RemoteDebug_ReadRemoteMemory(proc_handle_t *handle, uintptr_t remote_address #endif } -int +static int _Py_RemoteDebug_PagedReadRemoteMemory(proc_handle_t *handle, uintptr_t addr, size_t size, From 6fcd698bbc93ce6f48f99a7baf032f5143d67934 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 4 Jun 2025 16:35:25 -0500 Subject: [PATCH 2/4] Add warning ignores --- Tools/build/.warningignore_macos | 1 + Tools/build/.warningignore_ubuntu | 1 + 2 files changed, 2 insertions(+) diff --git a/Tools/build/.warningignore_macos b/Tools/build/.warningignore_macos index d7b62bc6a43ba6..90ea26690602be 100644 --- a/Tools/build/.warningignore_macos +++ b/Tools/build/.warningignore_macos @@ -7,3 +7,4 @@ Modules/expat/siphash.h 7 Modules/expat/xmlparse.c 13 Modules/expat/xmltok.c 3 Modules/expat/xmltok_impl.c 26 +Python/remote_debug.h 2 diff --git a/Tools/build/.warningignore_ubuntu b/Tools/build/.warningignore_ubuntu index 469c727abfb11c..a800a4d9c6e9fa 100644 --- a/Tools/build/.warningignore_ubuntu +++ b/Tools/build/.warningignore_ubuntu @@ -3,3 +3,4 @@ # Keep lines sorted lexicographically to help avoid merge conflicts. # Format example: # /path/to/file (number of warnings in file) +Python/remote_debug.h 2 From 629fb91488de594c9175f7bc9c89908f3cd8b764 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 9 Jun 2025 08:36:28 -0500 Subject: [PATCH 3/4] Use `UNUSED` macro --- Python/remote_debug.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Python/remote_debug.h b/Python/remote_debug.h index ab494ea71da772..1cd88354cf696a 100644 --- a/Python/remote_debug.h +++ b/Python/remote_debug.h @@ -13,6 +13,16 @@ If you need to add a new function ensure that is declared 'static'. extern "C" { #endif +#ifdef __clang__ + #define UNUSED __attribute__((unused)) +#elif defined(__GNUC__) + #define UNUSED __attribute__((unused)) +#elif defined(_MSC_VER) + #define UNUSED __pragma(warning(suppress: 4505)) +#else + #define UNUSED +#endif + #if !defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) # error "this header requires Py_BUILD_CORE or Py_BUILD_CORE_MODULE define" #endif @@ -131,7 +141,7 @@ _Py_RemoteDebug_FreePageCache(proc_handle_t *handle) } } -static void +UNUSED static void _Py_RemoteDebug_ClearCache(proc_handle_t *handle) { for (int i = 0; i < MAX_PAGES; i++) { @@ -989,7 +999,7 @@ _Py_RemoteDebug_ReadRemoteMemory(proc_handle_t *handle, uintptr_t remote_address #endif } -static int +UNUSED static int _Py_RemoteDebug_PagedReadRemoteMemory(proc_handle_t *handle, uintptr_t addr, size_t size, From 6e5d552cec3d45856303265965c3fb7699df0363 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Mon, 9 Jun 2025 08:36:34 -0500 Subject: [PATCH 4/4] Revert "Add warning ignores" This reverts commit 6fcd698bbc93ce6f48f99a7baf032f5143d67934. --- Tools/build/.warningignore_macos | 1 - Tools/build/.warningignore_ubuntu | 1 - 2 files changed, 2 deletions(-) diff --git a/Tools/build/.warningignore_macos b/Tools/build/.warningignore_macos index 90ea26690602be..d7b62bc6a43ba6 100644 --- a/Tools/build/.warningignore_macos +++ b/Tools/build/.warningignore_macos @@ -7,4 +7,3 @@ Modules/expat/siphash.h 7 Modules/expat/xmlparse.c 13 Modules/expat/xmltok.c 3 Modules/expat/xmltok_impl.c 26 -Python/remote_debug.h 2 diff --git a/Tools/build/.warningignore_ubuntu b/Tools/build/.warningignore_ubuntu index a800a4d9c6e9fa..469c727abfb11c 100644 --- a/Tools/build/.warningignore_ubuntu +++ b/Tools/build/.warningignore_ubuntu @@ -3,4 +3,3 @@ # Keep lines sorted lexicographically to help avoid merge conflicts. # Format example: # /path/to/file (number of warnings in file) -Python/remote_debug.h 2