[Lldb-commits] [lldb] [lldb] Fix misleading indentiation warning in ScriptInterpreterPython (NFC) (PR #70732)

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 30 14:52:45 PDT 2023


https://github.com/medismailben created https://github.com/llvm/llvm-project/pull/70732

This should silence the "misleading indentiation" warnings introduced by b2929be, by ignoring the flag for that specific chunk of code, if the surrounding if-statement have been compiled out.

>From 4b21aec8bb9866ae4061dfb837fdb4bab2dbe926 Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani <ismail at bennani.ma>
Date: Mon, 30 Oct 2023 14:51:07 -0700
Subject: [PATCH] [lldb] Fix misleading indentiation warning in
 ScriptInterpreterPython (NFC)

This should silence the "misleading indentiation" warnings introduced by
b2929be, by ignoring the flag for that specific chunk of code, if the
surrounding if-statement have been compiled out.

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
---
 .../ScriptInterpreter/Python/ScriptInterpreterPython.cpp     | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 968cc8ca03001e5..dc68571d3c47a1a 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -183,6 +183,9 @@ struct InitializePythonRAII {
 // Python 3.13. It has been returning `true` always since Python 3.7.
 #if (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION < 9) || (PY_MAJOR_VERSION < 3)
     if (PyEval_ThreadsInitialized()) {
+#else
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wmisleading-indentation"
 #endif
       Log *log = GetLog(LLDBLog::Script);
 
@@ -199,6 +202,8 @@ struct InitializePythonRAII {
 
     // InitThreads acquires the GIL if it hasn't been called before.
     PyEval_InitThreads();
+#else
+#pragma clang diagnostic pop
 #endif
   }
 



More information about the lldb-commits mailing list