[PATCH, d] Committed support for compiling without libphobos library.

Iain Buclaw ibuclaw@gdcproject.org
Tue Apr 23 20:28:00 GMT 2019


Hi,

This patch backports support from the dmd front-end the options to
omit generating code that depends on libdruntime existing, and enables
the controlling of them by adding the options -fdruntime, and -frtti.
The other two options -fexceptions and -fmoduleinfo have also been
adapted accordingly.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r270518.
--
Iain
---
gcc/d/ChangeLog:

2019-04-23  Iain Buclaw  <ibuclaw@gdcproject.org>

        * d-builtins.cc (d_init_versions): Add D_BetterC, D_ModuleInfo,
        D_Exceptions, D_TypeInfo as predefined version conditions.
        * d-codegen.cc (build_bounds_condition): Generate trap if D asserts
        are turned off.
        * d-frontend.cc (getTypeInfoType): Add error when -fno-rtti is set.
        * d-lang.cc (d_init_options): Initialize new front-end options.
        (d_handle_option): Handle -fdruntime, -fexceptions, and -frtti.
        (d_post_options): Turn off D runtime features if -fno-druntime is set.
        * d-spec.cc (lang_specific_driver): Handle -fdruntime.
        * d-tree.h (have_typeinfo_p): Add prototype.
        (build_typeinfo): Update prototype.
        * decl.cc (DeclVisitor::visit(StructDeclaration)): Create typeinfo
        only if TypeInfo exists.
        (DeclVisitor::visit(ClassDeclaration)): Likewise.
        (DeclVisitor::visit(InterfaceDeclaration)): Likewise.
        (DeclVisitor::visit(EnumDeclaration)): Likewise.
        * expr.cc: Update all calls to build_typeinfo.
        * gdc.texi (Runtime Options): Document -fdruntime and -frtti.
        * lang.opt: Add -fdruntime and -frtti.
        * modules.cc (build_module_tree): Create module info only if
        ModuleInfo exists.
        * toir.cc (IRVisitor::visit(ThrowStatement)): Update test for
        -fno-exceptions.
        * typeinfo.cc (create_tinfo_types): Build internal typeinfo classes
        only if Object exists.
        (have_typeinfo_p): New function.
        (class TypeInfoVisitor): Update all calls to build_typeinfo.
        (build_typeinfo): Add error when -fno-rtti is set.

gcc/testsuite/ChangeLog:

2019-04-23  Iain Buclaw  <ibuclaw@gdcproject.org>

        * gdc.test/fail_compilation/fail2456.d: New test.
        * gdc.test/fail_compilation/test18312.d: New test.
        * gdc.test/gdc-test.exp (gdc-convert-args): Handle -betterC.

---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nodruntime.patch
Type: text/x-patch
Size: 51525 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190423/050e1f7d/attachment.bin>


More information about the Gcc-patches mailing list