From 9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 31 Oct 2024 08:46:35 -0700 Subject: [lldb] Use PY_VERSION_HEX to simplify conditional compilation (NFC) (#114346) Use PY_VERSION_HEX to simplify conditional compilation depending on the Python version. This also adds a static_assert to lldb-python to error out with a meaningful diagnostic when you try building LLDB with an older Python version in preparation for [1]. [1] https://discourse.llvm.org/t/rfc-lets-document-and-enforce-a-minimum-python-version-for-lldb/82731/15 --- lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h index 378b9fa..b68598b 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h @@ -47,6 +47,11 @@ static llvm::Expected *g_fcxx_modules_workaround [[maybe_unused]]; // Include python for non windows machines #include + +// Provide a meaningful diagnostic error if someone tries to compile this file +// with a version of Python we don't support. +static_assert(PY_VERSION_HEX >= 0x03000000, + "LLDB requires at least Python 3.0"); #endif #endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H -- cgit v1.1