[compiler-rt] [win/asan] Avoid warnings in compiling interception_win_test.cpp. (PR #116887)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 19 15:30:48 PST 2024


https://github.com/bernhardu created https://github.com/llvm/llvm-project/pull/116887

Example:
  warning: unused variable 'kPatchableCode12' [-Wunused-const-variable]

>From 5091eeaadede71641928d7557b4702054c722007 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20=C3=9Cbelacker?= <bernhardu at mailbox.org>
Date: Thu, 7 Nov 2024 15:52:03 +0100
Subject: [PATCH] [win/asan] Avoid warnings in compiling
 interception_win_test.cpp.

Example:
  warning: unused variable 'kPatchableCode12' [-Wunused-const-variable]
---
 .../lib/interception/tests/interception_win_test.cpp        | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/compiler-rt/lib/interception/tests/interception_win_test.cpp b/compiler-rt/lib/interception/tests/interception_win_test.cpp
index c004d187768de6..17ff51457799e3 100644
--- a/compiler-rt/lib/interception/tests/interception_win_test.cpp
+++ b/compiler-rt/lib/interception/tests/interception_win_test.cpp
@@ -230,6 +230,7 @@ const u8 kUnpatchableCode6[] = {
     0x90, 0x90, 0x90, 0x90,
 };
 
+#if SANITIZER_WINDOWS64
 const u8 kUnpatchableCode7[] = {
     0x33, 0xc0,                     // xor     eax,eax
     0x48, 0x85, 0xd2,               // test    rdx,rdx
@@ -251,7 +252,9 @@ const u8 kUnpatchableCode9[] = {
     0x84, 0xc0,                     // test    al,al
     0x75, 0xf7,                     // jne     -9  (unpatchable)
 };
+#endif
 
+#if SANITIZER_WINDOWS64
 const u8 kPatchableCode6[] = {
     0x48, 0x89, 0x54, 0x24, 0xBB, // mov QWORD PTR [rsp + 0xBB], rdx
     0x33, 0xC9,                   // xor ecx,ecx
@@ -286,7 +289,9 @@ const u8 kPatchableCode11[] = {
     0x48, 0x83, 0xec, 0x38,         // sub     rsp,38h
     0x83, 0x64, 0x24, 0x28, 0x00,   // and     dword ptr [rsp+28h],0
 };
+#endif
 
+#if !SANITIZER_WINDOWS64
 const u8 kPatchableCode12[] = {
     0x55,                           // push    ebp
     0x53,                           // push    ebx
@@ -302,6 +307,7 @@ const u8 kPatchableCode13[] = {
     0x56,                           // push    esi
     0x8b, 0x5c, 0x24, 0x14,         // mov     ebx,dword ptr[esp+14h]
 };
+#endif
 
 const u8 kPatchableCode14[] = {
     0x55,                           // push    ebp



More information about the llvm-commits mailing list