mirror of
https://gcc.gnu.org/git/gcc.git
synced 2026-02-22 12:00:03 -05:00
D front-end changes: - Import dmd v2.112.0. - Bitfields feature is now enabled by default. - The compiler now accepts `-std=d2024' and `-std=d202y'. - An error is now issued for dangling `else' statements. - `finally' statements are no longer rewritten to a sequence if no `Exception' was thrown. - Some forms of `printf' calls are now treated as `@safe'. - Implicit integer conversions in `int op= float` assignments has been deprecated. D runtime changes: - Import druntime v2.112.0. - Added `filterCaughtThrowable' in `core.thread.ThreadBase'. Phobos changes: - Import phobos v2.112.0. gcc/d/ChangeLog: * dmd/VERSION: Bump version to v2.112.0. * dmd/MERGE: Merge upstream dmd 24a41073c2. * d-attribs.cc (build_attributes): Update for new front-end interface. * d-builtins.cc (build_frontend_type): Likewise. (matches_builtin_type): Likewise. (d_init_versions): Predefine D_Profile when compiling with profile enabled. * d-codegen.cc (get_array_length): Update for new front-end interface. (lower_struct_comparison): Likewise. (build_array_from_val): Likewise. (get_function_type): Likewise. (get_frameinfo): Likewise. * d-compiler.cc (Compiler::paintAsType): Likewise. * d-convert.cc (convert_expr): Likewise. (convert_for_rvalue): Likewise. (convert_for_assignment): Likewise. (d_array_convert): Likewise. * d-diagnostic.cc (verrorReport): Rename to ... (vreportDiagnostic): ... this. (verrorReportSupplemental): Rename to ... (vsupplementalDiagnostic): ... this. * d-lang.cc (d_handle_option): Handle -std=d2024 and -std=d202y. (d_parse_file): Update for new front-end interface. * d-target.cc (Target::fieldalign): Likewise. (Target::isVectorTypeSupported): Likewise. (Target::isVectorOpSupported): Likewise. * decl.cc (get_symbol_decl): Likewise. (DeclVisitor::visit): Likewise. (DeclVisitor::visit (FuncDeclaration *)): Do NRVO on `__result' decl. * expr.cc (needs_postblit): Remove. (needs_dtor): Remove. (lvalue_p): Remove. (ExprVisitor::visit): Update for new front-end interface. (ExprVisitor::visit (AssignExp *)): Update for front-end lowering expression using templates. * imports.cc (ImportVisitor::visit): Update for new front-end interface. * intrinsics.def (INTRINSIC_VA_ARG): Update signature. (INTRINSIC_C_VA_ARG): Update signature. (INTRINSIC_VASTART): Update signature. * lang.opt: Add -std=d2024 and -std=d202y. * toir.cc (IRVisitor::visit): Update for new front-end interface. * typeinfo.cc (TypeInfoVisitor::visit): Likewise. (TypeInfoVisitor::visit (TypeInfoStructDeclaration *)): Ensure semantic is ran on all TypeInfo members. (base_vtable_offset): Update for new front-end interface. * types.cc (TypeVisitor::visit): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 24a41073c2. * libdruntime/__importc_builtins.di: Reimplement. * src/MERGE: Merge upstream phobos 808314eb2. * testsuite/libphobos.aa/test_aa.d: Adjust test. * testsuite/libphobos.gc/forkgc2.d: Removed. * testsuite/libphobos.thread/filterthrownglobal.d: New test. * testsuite/libphobos.thread/filterthrownmethod.d: New test. gcc/testsuite/ChangeLog: * gdc.dg/pr90601.d: Adjust test. * lib/gdc-utils.exp: Handle new compiler options.
166 lines
4.6 KiB
D
166 lines
4.6 KiB
D
/**
|
|
* The vararg module is intended to facilitate vararg manipulation in D.
|
|
* It should be interface compatible with the C module "stdarg," and the
|
|
* two modules may share a common implementation if possible (as is done
|
|
* here).
|
|
* Copyright: Copyright Digital Mars 2000 - 2009.
|
|
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
|
* Authors: Walter Bright, Hauke Duden
|
|
* Source: $(DRUNTIMESRC core/_vararg.d)
|
|
*/
|
|
|
|
/* Copyright Digital Mars 2000 - 2009.
|
|
* Distributed under the Boost Software License, Version 1.0.
|
|
* (See accompanying file LICENSE or copy at
|
|
* http://www.boost.org/LICENSE_1_0.txt)
|
|
*/
|
|
module core.vararg;
|
|
|
|
public import core.stdc.stdarg;
|
|
|
|
|
|
version (GNU) { /* TypeInfo-based va_arg overload unsupported */ }
|
|
else:
|
|
|
|
version (ARM) version = ARM_Any;
|
|
version (AArch64) version = ARM_Any;
|
|
version (MIPS32) version = MIPS_Any;
|
|
version (MIPS64) version = MIPS_Any;
|
|
version (PPC) version = PPC_Any;
|
|
version (PPC64) version = PPC_Any;
|
|
version (RISCV32) version = RISCV_Any;
|
|
version (RISCV64) version = RISCV_Any;
|
|
|
|
version (ARM_Any)
|
|
{
|
|
// Darwin uses a simpler varargs implementation
|
|
version (OSX) {}
|
|
else version (iOS) {}
|
|
else version (TVOS) {}
|
|
else version (WatchOS) {}
|
|
else:
|
|
|
|
version (ARM) version = AAPCS32;
|
|
version (AArch64) version = AAPCS64;
|
|
}
|
|
|
|
|
|
///
|
|
alias va_arg = core.stdc.stdarg.va_arg;
|
|
|
|
|
|
/**
|
|
* Retrieve and store through parmn the next value that is of TypeInfo ti.
|
|
* Used when the static type is not known.
|
|
*/
|
|
void va_arg()(ref va_list ap, TypeInfo ti, void* parmn)
|
|
{
|
|
version (X86)
|
|
{
|
|
// Wait until everyone updates to get TypeInfo.talign
|
|
//auto talign = ti.talign;
|
|
//auto p = cast(void*)(cast(size_t)ap + talign - 1) & ~(talign - 1);
|
|
auto p = ap;
|
|
auto tsize = ti.tsize;
|
|
ap = cast(va_list) (p + tsize.alignUp);
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (Win64)
|
|
{
|
|
version (LDC) enum isLDC = true;
|
|
else enum isLDC = false;
|
|
|
|
// Wait until everyone updates to get TypeInfo.talign
|
|
//auto talign = ti.talign;
|
|
//auto p = cast(void*)(cast(size_t)ap + talign - 1) & ~(talign - 1);
|
|
auto p = ap;
|
|
auto tsize = ti.tsize;
|
|
void* q;
|
|
if (isLDC && tsize == 16 && cast(TypeInfo_Array) ti)
|
|
{
|
|
q = p;
|
|
ap = cast(va_list) (p + tsize);
|
|
}
|
|
else
|
|
{
|
|
q = (tsize > size_t.sizeof || (tsize & (tsize - 1)) != 0) ? *cast(void**) p : p;
|
|
ap = cast(va_list) (p + size_t.sizeof);
|
|
}
|
|
parmn[0..tsize] = q[0..tsize];
|
|
}
|
|
else version (X86_64)
|
|
{
|
|
static import core.internal.vararg.sysv_x64;
|
|
core.internal.vararg.sysv_x64.va_arg(ap, ti, parmn);
|
|
}
|
|
else version (AAPCS32)
|
|
{
|
|
const tsize = ti.tsize;
|
|
if (ti.talign >= 8)
|
|
ap.__ap = ap.__ap.alignUp!8;
|
|
auto p = ap.__ap;
|
|
version (BigEndian)
|
|
p = adjustForBigEndian(p, tsize);
|
|
ap.__ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (AAPCS64)
|
|
{
|
|
static import core.internal.vararg.aapcs64;
|
|
core.internal.vararg.aapcs64.va_arg(ap, ti, parmn);
|
|
}
|
|
else version (ARM_Any)
|
|
{
|
|
const tsize = ti.tsize;
|
|
auto p = cast(void*) ap;
|
|
version (BigEndian)
|
|
p = adjustForBigEndian(p, tsize);
|
|
ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (PPC_Any)
|
|
{
|
|
if (ti.talign >= 8)
|
|
ap = ap.alignUp!8;
|
|
const tsize = ti.tsize;
|
|
auto p = cast(void*) ap;
|
|
version (BigEndian)
|
|
p = adjustForBigEndian(p, tsize);
|
|
ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (LoongArch64)
|
|
{
|
|
const tsize = ti.tsize;
|
|
auto p = cast(void*) ap;
|
|
ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (MIPS_Any)
|
|
{
|
|
const tsize = ti.tsize;
|
|
auto p = cast(void*) ap;
|
|
version (BigEndian)
|
|
p = adjustForBigEndian(p, tsize);
|
|
ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else version (RISCV_Any)
|
|
{
|
|
const tsize = ti.tsize;
|
|
void* p;
|
|
if (tsize > (size_t.sizeof << 1))
|
|
p = *cast(void**) ap;
|
|
else
|
|
{
|
|
if (tsize == (size_t.sizeof << 1))
|
|
ap = ap.alignUp!(size_t.sizeof << 1);
|
|
p = cast(void*) ap;
|
|
}
|
|
ap += tsize.alignUp;
|
|
parmn[0..tsize] = p[0..tsize];
|
|
}
|
|
else
|
|
static assert(0, "Unsupported platform");
|
|
}
|