Mesa (main): nouveau: Don't require RTTI and use it only when enabled
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Jun 10 15:53:08 UTC 2021
Module: Mesa
Branch: main
Commit: 5987f71cb1dce7729618605cef1883a0240e9562
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5987f71cb1dce7729618605cef1883a0240e9562
Author: Roman Stratiienko <r.stratiienko at gmail.com>
Date: Fri May 28 19:00:50 2021 +0300
nouveau: Don't require RTTI and use it only when enabled
The only case RTTI is used in nouveau is type assertion at:
File src/gallium/drivers/nouveau/codegen/nv50_ir.cpp:
assert(typeid(*i) == typeid(*this));
This assertion is used 'to be on the safe side' only and not mandatory.
In Android we do not have rtti for libLLVM therefore this assertion
has to be skipped.
Signed-off-by: Roman Stratiienko <r.stratiienko at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11069>
---
meson.build | 4 +---
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/meson.build b/meson.build
index 620ae7adc11..e7d80820308 100644
--- a/meson.build
+++ b/meson.build
@@ -1649,9 +1649,7 @@ if with_llvm
_rtti = ['ON', 'YES'].contains(dep_llvm.get_variable(cmake : 'LLVM_ENABLE_RTTI', configtool: 'has-rtti'))
endif
if not _rtti
- if with_gallium_nouveau
- error('The Nouveau driver requires rtti. You either need to turn off nouveau or use an LLVM built with LLVM_ENABLE_RTTI.')
- elif with_gallium_opencl
+ if with_gallium_opencl
error('The Clover OpenCL state tracker requires rtti, you need to turn off clover or use an LLVM built with LLVM_ENABLE_RTTI.')
endif
if cc.get_id() == 'msvc'
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index a0ba15698dc..f5b75cd111a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -749,7 +749,7 @@ Instruction::clone(ClonePolicy<Function>& pol, Instruction *i) const
{
if (!i)
i = new_Instruction(pol.context(), op, dType);
-#ifndef NDEBUG // non-conformant assert, so this is required
+#if !defined(NDEBUG) && defined(__cpp_rtti)
assert(typeid(*i) == typeid(*this));
#endif
More information about the mesa-commit
mailing list