d: Add support for compiling without libphobos library.
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 23 Apr 2019 20:08:46 +0000 (20:08 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Tue, 23 Apr 2019 20:08:46 +0000 (20:08 +0000)
commitc0aebc60b2ac19816f0431241d8f7203e60afb01
tree4eec38d1f02e2a59de0dc908c56593c54d0d3960
parent32efff9f947137bb6f6bf47a846e3bf8a162170a
d: Add support for compiling without libphobos library.

Merges upstream dmd 3b3dca8be

Reviewed-on: https://github.com/dlang/dmd/pull/9678

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.

From-SVN: r270518
32 files changed:
gcc/d/ChangeLog
gcc/d/d-builtins.cc
gcc/d/d-codegen.cc
gcc/d/d-frontend.cc
gcc/d/d-lang.cc
gcc/d/d-spec.cc
gcc/d/d-tree.h
gcc/d/decl.cc
gcc/d/dmd/MERGE
gcc/d/dmd/clone.c
gcc/d/dmd/dcast.c
gcc/d/dmd/declaration.c
gcc/d/dmd/dinterpret.c
gcc/d/dmd/dmodule.c
gcc/d/dmd/dstruct.c
gcc/d/dmd/expressionsem.c
gcc/d/dmd/func.c
gcc/d/dmd/globals.h
gcc/d/dmd/idgen.c
gcc/d/dmd/opover.c
gcc/d/dmd/parse.c
gcc/d/dmd/statementsem.c
gcc/d/expr.cc
gcc/d/gdc.texi
gcc/d/lang.opt
gcc/d/modules.cc
gcc/d/toir.cc
gcc/d/typeinfo.cc
gcc/testsuite/ChangeLog
gcc/testsuite/gdc.test/fail_compilation/fail2456.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/test18312.d [new file with mode: 0644]
gcc/testsuite/gdc.test/gdc-test.exp