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@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11069>
This commit is contained in:
Roman Stratiienko 2021-05-28 19:00:50 +03:00 committed by Marge Bot
parent f389676173
commit 5987f71cb1
2 changed files with 2 additions and 4 deletions

View file

@ -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'

View file

@ -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