aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2024-10-31 08:46:35 -0700
committerGitHub <noreply@github.com>2024-10-31 08:46:35 -0700
commit9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858 (patch)
tree0348189ac2d8593b317649d3d42bba38a3f97dd4 /lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h
parent9234ae1bbeddd66d8bed3c55c26f8eee0c827aed (diff)
downloadllvm-9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858.zip
llvm-9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858.tar.gz
llvm-9ce0a61bdbf13d4d0f2e13e1bb6e7a4bb9d01858.tar.bz2
[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
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h5
1 files changed, 5 insertions, 0 deletions
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<bool> *g_fcxx_modules_workaround [[maybe_unused]];
// Include python for non windows machines
#include <Python.h>
+
+// 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