-fno-rtti (disable TypeInfo) support ready for testing

Johannes Pfau via D.gnu d.gnu at puremagic.com
Sun May 10 10:45:28 PDT 2015


I've just opened a pull request for -fno-rtti at [1]. The frontend part
needs to go into DMD but I'd like some testing feedback first. This is
especially important as I had literally no time to test this
updated code ;-) Please provide feedback here or at [1].


-fno-rtti should provide nice, readable error messages:
test.d:22:14: error: Can't use typeid: TypeInfo disabled using
-fno-rtti switch.
     auto a = typeid(A);
              ^
It's however likely that I missed some cases. If you get linker errors
or a backend ICE instead of a nice error message please report that.



This also prevents the frontend from searching for TypeInfo in object.d
which means you can remove those useless fake declarations. A minimal
object.d now looks like this:
------------
module object;

class Object
{
}
------------
It can also be empty if you don't need support for classes. If GDC still
complains about missing TypeInfo please report that.


Note: right now the -fno-rtti switch is not hooked up with
-fno-emit-moduleinfo. So you'll probably want all 'fno-invariants
-fno-rtti -fno-emit-moduleinfo' options.

[1] https://github.com/D-Programming-GDC/GDC/pull/100


More information about the D.gnu mailing list