diff --git a/dmd/access.d b/dmd/access.d index 1871f601b6e..09515ac3a5c 100644 --- a/dmd/access.d +++ b/dmd/access.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/attribute.html#visibility_attributes, Visibility Attributes) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/access.d, _access.d) diff --git a/dmd/aggregate.d b/dmd/aggregate.d index 73dccb365ca..1c464fd0f68 100644 --- a/dmd/aggregate.d +++ b/dmd/aggregate.d @@ -4,7 +4,7 @@ * Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions), * $(LINK2 https://dlang.org/spec/class.html, Class). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/aggregate.d, _aggregate.d) @@ -20,21 +20,15 @@ import core.checkedint; import dmd.aliasthis; import dmd.arraytypes; import dmd.astenums; -import dmd.attrib; import dmd.declaration; import dmd.dscope; -import dmd.dstruct; import dmd.dsymbol; -import dmd.dtemplate; import dmd.errors; import dmd.expression; import dmd.func; -import dmd.hdrgen; -import dmd.id; import dmd.identifier; import dmd.location; import dmd.mtype; -import dmd.tokens; import dmd.visitor; /** @@ -158,24 +152,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol visibility = Visibility(Visibility.Kind.public_); } - /*************************************** - * Create a new scope from sc. - * semantic, semantic2 and semantic3 will use this for aggregate members. - */ - Scope* newScope(Scope* sc) - { - auto sc2 = sc.push(this); - sc2.stc &= STC.flowThruAggregate; - sc2.parent = this; - sc2.inunion = isUnionDeclaration(); - sc2.visibility = Visibility(Visibility.Kind.public_); - sc2.explicitVisibility = false; - sc2.aligndecl = null; - sc2.userAttribDecl = null; - sc2.namespace = null; - return sc2; - } - /*************************************** * Returns: * The total number of fields minus the number of hidden fields. @@ -206,120 +182,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol return enclosing !is null; } - /* Append vthis field (this.tupleof[$-1]) to make this aggregate type nested. - */ - extern (D) final void makeNested() - { - if (enclosing) // if already nested - return; - if (sizeok == Sizeok.done) - return; - if (isUnionDeclaration() || isInterfaceDeclaration()) - return; - if (storage_class & STC.static_) - return; - - // If nested struct, add in hidden 'this' pointer to outer scope - auto s = toParentLocal(); - if (!s) - s = toParent2(); - if (!s) - return; - Type t = null; - if (auto fd = s.isFuncDeclaration()) - { - enclosing = fd; - - /* https://issues.dlang.org/show_bug.cgi?id=14422 - * If a nested class parent is a function, its - * context pointer (== `outer`) should be void* always. - */ - t = Type.tvoidptr; - } - else if (auto ad = s.isAggregateDeclaration()) - { - if (isClassDeclaration() && ad.isClassDeclaration()) - { - enclosing = ad; - } - else if (isStructDeclaration()) - { - if (auto ti = ad.parent.isTemplateInstance()) - { - enclosing = ti.enclosing; - } - } - t = ad.handleType(); - } - if (enclosing) - { - //printf("makeNested %s, enclosing = %s\n", toChars(), enclosing.toChars()); - assert(t); - if (t.ty == Tstruct) - t = Type.tvoidptr; // t should not be a ref type - - assert(!vthis); - vthis = new ThisDeclaration(loc, t); - //vthis.storage_class |= STC.ref_; - - // Emulate vthis.addMember() - members.push(vthis); - - // Emulate vthis.dsymbolSemantic() - vthis.storage_class |= STC.field; - vthis.parent = this; - vthis.visibility = Visibility(Visibility.Kind.public_); - vthis.alignment = t.alignment(); - vthis.semanticRun = PASS.semanticdone; - - if (sizeok == Sizeok.fwd) - fields.push(vthis); - - makeNested2(); - } - } - - /* Append vthis2 field (this.tupleof[$-1]) to add a second context pointer. - */ - extern (D) final void makeNested2() - { - if (vthis2) - return; - if (!vthis) - makeNested(); // can't add second before first - if (!vthis) - return; - if (sizeok == Sizeok.done) - return; - if (isUnionDeclaration() || isInterfaceDeclaration()) - return; - if (storage_class & STC.static_) - return; - - auto s0 = toParentLocal(); - auto s = toParent2(); - if (!s || !s0 || s == s0) - return; - auto cd = s.isClassDeclaration(); - Type t = cd ? cd.type : Type.tvoidptr; - - vthis2 = new ThisDeclaration(loc, t); - //vthis2.storage_class |= STC.ref_; - - // Emulate vthis2.addMember() - members.push(vthis2); - - // Emulate vthis2.dsymbolSemantic() - vthis2.storage_class |= STC.field; - vthis2.parent = this; - vthis2.visibility = Visibility(Visibility.Kind.public_); - vthis2.alignment = t.alignment(); - vthis2.semanticRun = PASS.semanticdone; - - if (sizeok == Sizeok.fwd) - fields.push(vthis2); - } - override final bool isExport() const { return visibility.kind == Visibility.Kind.export_; diff --git a/dmd/aggregate.h b/dmd/aggregate.h index 42a01adf3e3..2b6170692cc 100644 --- a/dmd/aggregate.h +++ b/dmd/aggregate.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -121,7 +121,6 @@ class AggregateDeclaration : public ScopeDsymbol d_bool disableNew; // disallow allocations using `new` Sizeok sizeok; // set when structsize contains valid data - virtual Scope *newScope(Scope *sc); bool isDeprecated() const override final; // is aggregate deprecated? bool isNested() const; bool isExport() const override final; @@ -173,6 +172,7 @@ class StructDeclaration : public AggregateDeclaration static StructDeclaration *create(Loc loc, Identifier *id, bool inObject); StructDeclaration *syntaxCopy(Dsymbol *s) override; const char *kind() const override; + bool hasCopyConstruction(); bool zeroInit() const; // !=0 if initialize with 0 fill bool zeroInit(bool v); bool hasIdentityAssign() const; // true if has identity opAssign @@ -277,7 +277,6 @@ class ClassDeclaration : public AggregateDeclaration static ClassDeclaration *create(Loc loc, Identifier *id, BaseClasses *baseclasses, Dsymbols *members, bool inObject); const char *toPrettyChars(bool QualifyTypes = false) override; ClassDeclaration *syntaxCopy(Dsymbol *s) override; - Scope *newScope(Scope *sc) override; #define OFFSET_RUNTIME 0x76543210 #define OFFSET_FWDREF 0x76543211 @@ -292,8 +291,6 @@ class ClassDeclaration : public AggregateDeclaration virtual int vtblOffset() const; const char *kind() const override; - void addObjcSymbols(ClassDeclarations *classes, ClassDeclarations *categories) override final; - #if !IN_LLVM // Back end Dsymbol *vtblsym; @@ -306,7 +303,6 @@ class InterfaceDeclaration final : public ClassDeclaration { public: InterfaceDeclaration *syntaxCopy(Dsymbol *s) override; - Scope *newScope(Scope *sc) override; bool isBaseOf(ClassDeclaration *cd, int *poffset) override; const char *kind() const override; int vtblOffset() const override; diff --git a/dmd/aliasthis.d b/dmd/aliasthis.d index 632cf95e80c..98380cb90f3 100644 --- a/dmd/aliasthis.d +++ b/dmd/aliasthis.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/class.html#alias-this, Alias This) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/aliasthis.d, _aliasthis.d) @@ -41,7 +41,7 @@ extern (C++) final class AliasThis : Dsymbol { assert(!s); auto at = new AliasThis(loc, ident); - at.comment = comment; + at.addComment(comment); return at; } diff --git a/dmd/aliasthis.h b/dmd/aliasthis.h index 249da70fd6a..ae90722983a 100644 --- a/dmd/aliasthis.h +++ b/dmd/aliasthis.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2009-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2009-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/argtypes.h b/dmd/argtypes.h index 968bf5d6279..91e4a5cdd93 100644 --- a/dmd/argtypes.h +++ b/dmd/argtypes.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/argtypes_aarch64.d b/dmd/argtypes_aarch64.d index f936fec95a4..7c01e1723ba 100644 --- a/dmd/argtypes_aarch64.d +++ b/dmd/argtypes_aarch64.d @@ -1,7 +1,7 @@ /** * Break down a D type into basic (register) types for the AArch64 ABI. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Martin Kinkelin * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_aarch64.d, _argtypes_aarch64.d) @@ -11,10 +11,12 @@ module dmd.argtypes_aarch64; +import core.stdc.stdio; import dmd.astenums; import dmd.dsymbolsem : isPOD; import dmd.mtype; import dmd.typesem; +import dmd.expressionsem : toUInteger; /**************************************************** * This breaks a type down into 'simpler' types that can be passed to a function @@ -31,6 +33,7 @@ import dmd.typesem; */ TypeTuple toArgTypes_aarch64(Type t) { + //printf("toArgTypes_aarch64() %s\n", t.toChars()); if (t == Type.terror) return new TypeTuple(t); diff --git a/dmd/argtypes_sysv_x64.d b/dmd/argtypes_sysv_x64.d index 0be02ff2b49..1b1308a00c7 100644 --- a/dmd/argtypes_sysv_x64.d +++ b/dmd/argtypes_sysv_x64.d @@ -1,7 +1,7 @@ /** * Break down a D type into basic (register) types for the x86_64 System V ABI. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Martin Kinkelin * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_sysv_x64.d, _argtypes_sysv_x64.d) @@ -11,11 +11,13 @@ module dmd.argtypes_sysv_x64; +import core.stdc.stdio; import dmd.astenums; import dmd.declaration; import dmd.dsymbolsem : isPOD; import dmd.mtype; import dmd.typesem; +import dmd.expressionsem : toInteger; import dmd.target; import dmd.visitor; @@ -94,7 +96,10 @@ TypeTuple toArgTypes_sysv_x64(Type t) Type.tfloat32; } else + { + debug printf("class: %d\n", c); assert(0, "Unexpected class"); + } } return N == 1 diff --git a/dmd/argtypes_x86.d b/dmd/argtypes_x86.d index b77683b3131..c05f2bdb684 100644 --- a/dmd/argtypes_x86.d +++ b/dmd/argtypes_x86.d @@ -1,7 +1,7 @@ /** * Break down a D type into basic (register) types for the 32-bit x86 ABI. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/argtypes_x86.d, _argtypes_x86.d) @@ -17,6 +17,7 @@ import core.checkedint; import dmd.astenums; import dmd.declaration; import dmd.dsymbolsem : isPOD; +import dmd.expressionsem : toInteger; import dmd.location; import dmd.mtype; import dmd.typesem; diff --git a/dmd/arrayop.d b/dmd/arrayop.d index ea6f87f60ec..c8776901579 100644 --- a/dmd/arrayop.d +++ b/dmd/arrayop.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/arrays.html#array-operations, Array Operations) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/arrayop.d, _arrayop.d) @@ -19,7 +19,6 @@ import dmd.astenums; import dmd.dcast : implicitConvTo; import dmd.declaration; import dmd.dscope; -import dmd.dsymbol; import dmd.errors; import dmd.expression; import dmd.expressionsem; @@ -31,7 +30,7 @@ import dmd.location; import dmd.mtype; import dmd.common.outbuffer; import dmd.tokens; -import dmd.typesem : isAssignable; +import dmd.typesem : isAssignable, nextOf, toBasetype; import dmd.visitor; /********************************************** diff --git a/dmd/arraytypes.d b/dmd/arraytypes.d index bed684b3a42..1d73cfc175e 100644 --- a/dmd/arraytypes.d +++ b/dmd/arraytypes.d @@ -1,7 +1,7 @@ /** * Provide aliases for arrays of certain declarations or statements. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/arraytypes.d, _arraytypes.d) diff --git a/dmd/arraytypes.h b/dmd/arraytypes.h index a06144332db..2ab5ea07bb9 100644 --- a/dmd/arraytypes.h +++ b/dmd/arraytypes.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2006-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2006-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/ast_node.d b/dmd/ast_node.d index ad491699473..2693fcb9bb4 100644 --- a/dmd/ast_node.d +++ b/dmd/ast_node.d @@ -1,7 +1,7 @@ /** * Defines the base class for all nodes which are part of the AST. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ast_node.d, _ast_node.d) diff --git a/dmd/ast_node.h b/dmd/ast_node.h index 0782d7eb460..ff7ad1c6ae9 100644 --- a/dmd/ast_node.h +++ b/dmd/ast_node.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/astcodegen.d b/dmd/astcodegen.d index 109208b1c93..ae0c3629178 100644 --- a/dmd/astcodegen.d +++ b/dmd/astcodegen.d @@ -32,13 +32,12 @@ struct ASTCodegen public import dmd.nspace; public import dmd.statement; public import dmd.staticassert; - public import dmd.typesem; - public import dmd.ctfeexpr; public import dmd.init : Designator; + public import dmd.typesem; - + alias addSTC = dmd.typesem.addSTC; alias initializerToExpression = dmd.initsem.initializerToExpression; - alias typeToExpression = dmd.typesem.typeToExpression; + alias typeToExpression = dmd.mtype.typeToExpression; alias UserAttributeDeclaration = dmd.attrib.UserAttributeDeclaration; alias Ensure = dmd.func.Ensure; // workaround for bug in older DMD frontends alias ErrorExp = dmd.expression.ErrorExp; diff --git a/dmd/astenums.d b/dmd/astenums.d index 417cb9f3960..756d249d668 100644 --- a/dmd/astenums.d +++ b/dmd/astenums.d @@ -1,7 +1,7 @@ /** * Defines enums common to dmd and dmd as parse library. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/astenums.d, _astenums.d) * Documentation: https://dlang.org/phobos/dmd_astenums.html @@ -150,7 +150,7 @@ enum STC : ulong // transfer changes to declaration.h alias StorageClass = ulong; /******** - * Determine if it's the ambigous case of where `return` attaches to. + * Determine if it's the ambiguous case of where `return` attaches to. * Params: * stc = STC flags * Returns: diff --git a/dmd/asttypename.d b/dmd/asttypename.d index 8642288f58f..7962a891f5b 100644 --- a/dmd/asttypename.d +++ b/dmd/asttypename.d @@ -1,7 +1,7 @@ /** * Development utility for printing AST nodes by their internal name, instead of as D source code. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Stefan Koch * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/asttypename.d, _asttypename.d) @@ -16,20 +16,16 @@ import dmd.attrib; import dmd.aliasthis; import dmd.aggregate; import dmd.cond; -import dmd.ctfeexpr; import dmd.dclass; import dmd.declaration; import dmd.denum; import dmd.dimport; -import dmd.declaration; import dmd.dstruct; import dmd.dsymbol; import dmd.dtemplate; import dmd.dversion; import dmd.expression; import dmd.func; -import dmd.denum; -import dmd.dimport; import dmd.dmodule; import dmd.mtype; import dmd.identifier; diff --git a/dmd/attrib.d b/dmd/attrib.d index 97dfa5ef683..687fba8e78a 100644 --- a/dmd/attrib.d +++ b/dmd/attrib.d @@ -14,7 +14,7 @@ * - Protection (`private`, `public`) * - Deprecated declarations (`@deprecated`) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/attrib.d, _attrib.d) @@ -24,24 +24,18 @@ module dmd.attrib; -import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; import dmd.cond; -import dmd.declaration; import dmd.dmodule; import dmd.dscope; import dmd.dsymbol; import dmd.expression; -import dmd.func; import dmd.hdrgen : visibilityToBuffer; import dmd.id; import dmd.identifier; import dmd.location; -import dmd.mtype; -import dmd.objc; // for objc.addSymbols import dmd.common.outbuffer; -import dmd.root.array; // for each import dmd.visitor; /*********************************************************** @@ -108,13 +102,6 @@ extern (C++) abstract class AttribDeclaration : Dsymbol return "attribute"; } - /**************************************** - */ - override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories) - { - objc.addSymbols(this, classes, categories); - } - override void accept(Visitor v) { v.visit(this); diff --git a/dmd/attrib.h b/dmd/attrib.h index 24d91abc627..630131fd005 100644 --- a/dmd/attrib.h +++ b/dmd/attrib.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/attribsem.d b/dmd/attribsem.d index bc966bb8eb9..0059884d54f 100644 --- a/dmd/attribsem.d +++ b/dmd/attribsem.d @@ -14,7 +14,7 @@ * - Protection (`private`, `public`) * - Deprecated declarations (`@deprecated`) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/attribsem.d, _attrib.d) diff --git a/dmd/blockexit.d b/dmd/blockexit.d index ae2f12f3232..935fc1edf52 100644 --- a/dmd/blockexit.d +++ b/dmd/blockexit.d @@ -1,7 +1,7 @@ /** * Find out in what ways control flow can exit a statement block. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/blockexit.d, _blockexit.d) @@ -20,6 +20,8 @@ import dmd.dclass; import dmd.declaration; import dmd.errorsink; import dmd.expression; +import dmd.expressionsem : toBool; +import dmd.typesem : toBasetype; import dmd.func; import dmd.globals; import dmd.id; diff --git a/dmd/builtin.d b/dmd/builtin.d index 81bee929c32..af3c57900b1 100644 --- a/dmd/builtin.d +++ b/dmd/builtin.d @@ -3,7 +3,7 @@ * * Currently includes functions from `std.math`, `core.math` and `core.bitop`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/builtin.d, _builtin.d) @@ -17,6 +17,8 @@ import dmd.arraytypes; import dmd.astenums; import dmd.errors; import dmd.expression; +import dmd.expressionsem : toInteger, toReal; +import dmd.typesem : isFloating, toBasetype; import dmd.func; import dmd.location; import dmd.mangle; @@ -234,6 +236,7 @@ Expression eval_ctfeWrite(Loc loc, FuncDeclaration fd, Expression[] arguments) import core.stdc.stdio: fprintf, stderr; import dmd.expression: CTFEExp; import dmd.ctfeexpr: resolveSlice; + import dmd.expressionsem : toStringExp; Expression e = arguments[0]; const se = resolveSlice(e).toStringExp(); diff --git a/dmd/canthrow.d b/dmd/canthrow.d index bd4aa197ab9..2780f81a513 100644 --- a/dmd/canthrow.d +++ b/dmd/canthrow.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/function.html#nothrow-functions, Nothrow Functions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/canthrow.d, _canthrow.d) @@ -14,19 +14,16 @@ module dmd.canthrow; import dmd.aggregate; -import dmd.arraytypes; -import dmd.attrib; import dmd.astenums; import dmd.blockexit : BE, checkThrow; -import dmd.declaration; import dmd.dsymbol; import dmd.dsymbolsem : include, toAlias; import dmd.errorsink; import dmd.expression; -import dmd.expressionsem : errorSupplementalInferredAttr; +import dmd.expressionsem; +import dmd.typesem; import dmd.func; import dmd.globals; -import dmd.init; import dmd.mtype; import dmd.tokens; import dmd.visitor; diff --git a/dmd/chkformat.d b/dmd/chkformat.d index 8b2d5b4dd4b..2a62fb3dc92 100644 --- a/dmd/chkformat.d +++ b/dmd/chkformat.d @@ -1,7 +1,7 @@ /** * Check the arguments to `printf` and `scanf` against the `format` string. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/chkformat.d, _chkformat.d) @@ -25,6 +25,39 @@ import dmd.typesem; import dmd.target; +/********************************************** + * While in general printf is not @safe (and should be marked @system), many uses of printf are safe. + * This function determines if a particular call of printf is safe. + * Params: + * format = printf format string + * Returns: + * true if @safe + */ +public +bool isFormatSafe(scope const char[] format) +{ + //printf("isFormatSafe('%.*s')\n", cast(int)format.length, format.ptr); + /* Only need to check the format string, any other errors are checked + * for later with checkPrintfFormat() + */ + for (size_t i = 0; i < format.length;) + { + if (format[i] != '%') + { + ++i; + continue; + } + bool widthStar; + bool precisionStar; + size_t j = i; + const fmt = parsePrintfFormatSpecifier(format, j, widthStar, precisionStar); + i = j; + if (fmt == Format.s || fmt == Format.ls || fmt == Format.error) + return false; + } + return true; +} + /****************************************** * Check that arguments to a printf format string are compatible * with that string. Issue errors for incompatibilities. @@ -65,7 +98,7 @@ import dmd.target; public bool checkPrintfFormat(Loc loc, scope const char[] format, scope Expression[] args, bool isVa_list, ErrorSink eSink) { - //printf("checkPrintFormat('%.*s')\n", cast(int)format.length, format.ptr); + //printf("checkPrintfFormat('%.*s')\n", cast(int)format.length, format.ptr); size_t n; // index in args for (size_t i = 0; i < format.length;) { diff --git a/dmd/cli.d b/dmd/cli.d index 573d3e8acd5..51b8d47b78d 100644 --- a/dmd/cli.d +++ b/dmd/cli.d @@ -5,7 +5,7 @@ * However, this file will be used to generate the * $(LINK2 https://dlang.org/dmd-linux.html, online documentation) and MAN pages. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cli.d, _cli.d) @@ -14,6 +14,8 @@ */ module dmd.cli; +nothrow @safe: + version (IN_LLVM) {} else { /* The enum TargetOS is an exact copy of the one in dmd.globals. @@ -95,21 +97,16 @@ Params: w = ASCII i string to capitalize Returns: capitalized string */ -static string capitalize(string w) +private string capitalize(string w) @trusted { - char[] result = cast(char[]) w; - char c1 = w.length ? w[0] : '\0'; - - if (c1 >= 'a' && c1 <= 'z') + if (w.length && w[0] >= 'a' && w[0] <= 'z') { - enum adjustment = 'A' - 'a'; - - result = new char[] (w.length); - result[0] = cast(char) (c1 + adjustment); + char[] result = new char[] (w.length); + result[0] = cast(char)(w[0] + 'A' - 'a'); result[1 .. $] = w[1 .. $]; + w = cast(string) result; } - - return cast(string) result; + return w; } /** @@ -217,7 +214,7 @@ version (IN_LLVM) {} else ), Option("check=[assert|bounds|in|invariant|out|switch][=[on|off]]", "enable or disable specific checks", - `Overrides default, -boundscheck, -release and -unittest options to enable or disable specific checks. + q"{Overrides default, `-boundscheck`, `-release` and `-unittest` options to enable or disable specific checks. $(UL $(LI $(B assert): assertion checking) $(LI $(B bounds): array bounds) @@ -229,7 +226,7 @@ version (IN_LLVM) {} else $(UL $(LI $(B on) or not specified: specified check is enabled.) $(LI $(B off): specified check is disabled.) - )` + )}" ), Option("check=[h|help|?]", "list information on all available checks" @@ -261,14 +258,10 @@ version (IN_LLVM) {} else )` ), Option("conf=", - "use config file at filename" + "use config file at " ), Option("cov", - "do code coverage analysis" - ), - Option("cov=ctfe", "Include code executed during CTFE in coverage report"), - Option("cov=", - "require at least nnn% code coverage", + "perform code coverage and generate `.lst` file", `Perform $(LINK2 $(ROOT_DIR)code_coverage.html, code coverage analysis) and generate $(TT .lst) file with report.) --- @@ -276,11 +269,17 @@ dmd -cov -unittest myprog.d --- `, ), + Option("cov=ctfe", "Include code executed during CTFE in coverage report"), + Option("cov=", + "require at least % code coverage", + "Perform code coverage analysis, requiring at least % code coverage. + Options can be combined, e.g. `-cov=100 -cov=ctfe`." + ), Option("cpp=", - "use filename as the name of the C preprocessor to use for ImportC files", - `Normally the C preprocessor used by the associated C compiler is used to - preprocess ImportC files, - this is overridden by the $(TT -cpp) switch.` + "use as the name of the C preprocessor to use for ImportC files", + `Sets the C preprocessor to . + Normally the C preprocessor used by the associated C compiler is used to + preprocess ImportC files.` ), Option("D", "generate documentation", @@ -289,13 +288,13 @@ dmd -cov -unittest myprog.d `, ), Option("Dd", - "write documentation file to directory", + "write documentation file to ", `Write documentation file to $(I directory) . $(SWLINK -op) can be used if the original package hierarchy should be retained`, ), Option("Df", - "write documentation file to filename" + "write documentation file to " ), Option("d", "silently allow deprecated features and symbols", @@ -312,22 +311,18 @@ dmd -cov -unittest myprog.d "compile in debug code", `Compile in $(LINK2 spec/version.html#debug, debug) code`, ), - Option("debug=", - "compile in debug code <= level", - `Compile in $(LINK2 spec/version.html#debug, debug level) <= $(I level)`, - ), Option("debug=", - "compile in debug code identified by ident", - `Compile in $(LINK2 spec/version.html#debug, debug identifier) $(I ident)`, + "compile in debug code identified by ", + `Compile in debug code with $(LINK2 spec/version.html#debug_specification, debug identifier) $(I ident)`, ), - Option("debuglib=", - "set symbolic debug library to name", + Option("debuglib=", + "set symbolic debug library to ", `Link in $(I libname) as the default library when compiling for symbolic debugging instead of $(B $(LIB)). If $(I libname) is not supplied, then no default library is linked in.` ), - Option("defaultlib=", - "set default library to name", + Option("defaultlib=", + "set default library to ", `Link in $(I libname) as the default library when not compiling for symbolic debugging instead of $(B $(LIB)). If $(I libname) is not supplied, then no default library is linked in.`, @@ -336,14 +331,12 @@ dmd -cov -unittest myprog.d "print module dependencies (imports/file/version/debug/lib)" ), Option("deps=", - "write module dependencies to filename (only imports)", - `Without $(I filename), print module dependencies - (imports/file/version/debug/lib). - With $(I filename), write module dependencies as text to $(I filename) + "write module dependencies to (only imports)", + `Write module dependencies as text to $(I filename) (only imports).`, ), - Option("dllimport=", - "Windows only: select symbols to dllimport (none/defaultLibsOnly/externalOnly/all)", + Option("dllimport=[none|defaultLibsOnly|externalOnly|all]", + "Windows only: select symbols to dllimport", `Which symbols to dllimport implicitly if not defined in a module that is being compiled $(UL $(LI $(I none): None) @@ -352,13 +345,14 @@ dmd -cov -unittest myprog.d $(LI $(I all): All) )`, ), - Option("edition[=G[]]", - "set language edition to edition year, apply to ", - "set edition to default, to a particular year NNNN, apply only to a particular $(I filename)" + Option("edition[=[]]", + "set language edition to year , apply to ", + "set edition to default which is 2023, to a particular year $(I NNNN), apply edition only to $(I filename)" ), Option("extern-std=", "set C++ name mangling compatibility with ", - "Standards supported are: + "set C++ name mangling compatibility with . + Standards supported are: $(UL $(LI $(I c++98): Use C++98 name mangling, Sets `__traits(getTargetInfo, \"cppStd\")` to `199711`) @@ -390,23 +384,26 @@ dmd -cov -unittest myprog.d ), Option("ftime-trace", "turn on compile time profiler, generate JSON file with results", - "Per function, the time to analyze it, call it from CTFE, generate code for it etc. will be measured, - and events with a time longer than 500 microseconds (adjustable with `-ftime-trace-granularity`) + "Measure the time to analyze, call from CTFE, and generate code for a function. + Events with a time longer than 500 microseconds (adjustable with `-ftime-trace-granularity`) will be recorded. The profiling result is output in the Chrome Trace Event Format, $(LINK2 https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview, described here). This can be turned into a more readable text file with the included tool `timetrace2txt`, or inspected with an interactive viewer such as $(LINK2 https://ui.perfetto.dev/, Perfetto)." ), - Option("ftime-trace-granularity=", + Option("ftime-trace-granularity=<μsecs>", "Minimum time granularity (in microseconds) traced by time profiler (default: 500)", - "Measured events shorter than the specified time will be discarded from the output. + "Minimum time granularity (in microseconds) traced by time profiler. + The default is `500`. + Measured events shorter than the specified time will be discarded from the output. Set it too high, and interesting events may not show up in the output. Set too low, and the profiler overhead will be larger, and the output will be cluttered with tiny events." ), Option("ftime-trace-file=", - "specify output file for -ftime-trace", - "By default, the output name is the same as the first object file name, but with the `.time-trace` extension appended. + "specify output file for `-ftime-trace`", + "Specify output file for `-ftime-trace`. + By default, the output name is the same as the first object file name, but with the `.time-trace` extension appended. A different filename can be chosen with this option, including a path relative to the current directory or an absolute path." ), Option("g", @@ -417,18 +414,19 @@ dmd -cov -unittest myprog.d ) $(UNIX Add symbolic debug info in DWARF format - for debuggers such as - $(D gdb) + for debuggers such as $(D gdb). )`, ), Option("gdwarf=", - "add DWARF symbolic debug info", - "The value of version may be 3, 4 or 5, defaulting to 3.", + "add DWARF symbolic debug info (default: 3)", + "Add DWARF symbolic debug info. + The value of may be 3, 4 or 5, defaulting to 3.", cast(TargetOS) (TargetOS.all & ~cast(uint)TargetOS.Windows) ), Option("gf", "emit debug info for all referenced types", - `Symbolic debug info is emitted for all types referenced by the compiled code, + `Emit debug info for all referenced types. + Symbolic debug info is emitted for all types referenced by the compiled code, even if the definition is in an imported file not currently being compiled.`, ), Option("gs", @@ -443,35 +441,37 @@ dmd -cov -unittest myprog.d `Generate $(RELATIVE_LINK2 $(ROOT_DIR)interface-files, D interface file)`, ), Option("Hd=", - "write 'header' file to directory", + "write 'header' file to ", `Write D interface file to $(I directory). $(SWLINK -op) can be used if the original package hierarchy should be retained.`, ), Option("Hf=", - "write 'header' file to filename" + "write 'header' file to " ), - Option("HC[=[?|h|help|silent|verbose]]", + Option("HC=[silent|verbose]", "write C++ 'header' equivalent to stdout", - `write C++ 'header' equivalent to stdout configured with:", + `write C++ 'header' equivalent to stdout configured with: $(DL - $(DT ?|h|help)$(DD list available options for C++ 'header' file generation) $(DT silent)$(DD only list extern(C[++]) declarations (default)) $(DT verbose)$(DD also add comments for ignored declarations (e.g. extern(D))) )`, ), + Option("HC=[?|h|help]", + "list available options for C++ 'header' file generation" + ), Option("HCd=", - "write C++ 'header' file to directory", - "write C++ 'header' file to directory, ignored if -HCf= is not present", + "write C++ 'header' file to ", + "write C++ 'header' file to , ignored if `-HCf=` is not present", ), Option("HCf=", - "write C++ 'header' file to filename instead of stdout" + "write C++ 'header' file to instead of stdout" ), Option("-help", "print help and exit" ), Option("I=", - "look for imports also in directory", + "look for imports also in ", q"{$(P Adds $(I directory) to the list of paths to be searched for imports. Multiple `-I`'s can be used, and the paths are searched in the same order.) @@ -563,7 +563,7 @@ dmd -cov -unittest myprog.d $(P Note that multiple `-i=...` options are allowed, each one adds a pattern.)}" ), - Option("identifiers=", + Option("identifiers=[UAX31|c99|c11|all]", "Specify the non-ASCII tables for D identifiers", `Set the identifier table to use for the non-ASCII values. $(UL @@ -573,7 +573,7 @@ dmd -cov -unittest myprog.d $(LI $(I all): All, the least restrictive set, which comes with all others (default)) )` ), - Option("identifiers-importc=
", + Option("identifiers-importc=[UAX31|c99|c11|all]", "Specify the non-ASCII tables for ImportC identifiers", `Set the identifier table to use for the non-ASCII values. $(UL @@ -593,16 +593,16 @@ dmd -cov -unittest myprog.d it more difficult to use a debugger on it.`, ), Option("J=", - "look for string imports also in directory", - `Where to look for files for + "look for string imports also in ", + "Where to look for files for $(LINK2 $(ROOT_DIR)spec/expression.html#ImportExpression, $(I ImportExpression))s. This switch is required in order to use $(I ImportExpression)s. - $(I path) is a ; separated - list of paths. Multiple $(B -J)'s can be used, and the paths - are searched in the same order.`, + $(I directory) is a `;` separated + list of paths. Multiple $(TT -J)'s can be used, and the paths + are searched in the same order.", ), Option("L=", - "pass linkerflag to link", + "pass to link", `Pass $(I linkerflag) to the $(WINDOWS linker $(OPTLINK)) $(UNIX linker), for example, ld`, @@ -630,7 +630,7 @@ dmd -cov -unittest myprog.d cast(TargetOS) (TargetOS.all & ~cast(uint)TargetOS.DragonFlyBSD) // available on all OS'es except DragonFly, which does not support 32-bit binaries ), Option("m32mscoff", - "generate 32 bit code and write MS-COFF object files (deprecated use -m32)", + "generate 32 bit code and write MS-COFF object files (deprecated use `-m32`)", TargetOS.Windows ), Option("m64", @@ -647,11 +647,11 @@ dmd -cov -unittest myprog.d in a library without having to manually define an entry-point function.`, ), Option("makedeps[=]", - "print dependencies in Makefile compatible format to filename or stdout.", + "print dependencies in Makefile compatible format to or stdout.", `Print dependencies in Makefile compatible format. - If filename is omitted, it prints to stdout. + If is omitted, it prints to stdout. The emitted targets are the compiled artifacts (executable, object files, libraries). - The emitted dependencies are imported modules and imported string files (via $(B -J) switch). + The emitted dependencies are imported modules and imported string files (via $(SWLINK -J) switch). Special characters in a dependency or target filename are escaped in the GNU Make manner. `, ), @@ -680,12 +680,11 @@ dmd -cov -unittest myprog.d "generate linker .map file", `Generate a $(TT .map) file`, ), - Option("mcpu=", - "generate instructions for architecture identified by 'id'", + Option("mcpu=[baseline|avx|native]", + "Set the target architecture for code generation", `Set the target architecture for code generation, where: $(DL - $(DT help)$(DD list alternatives) $(DT baseline)$(DD the minimum architecture for the target platform (default)) $(DT avx)$(DD generate $(LINK2 https://en.wikipedia.org/wiki/Advanced_Vector_Extensions, AVX) @@ -726,7 +725,7 @@ dmd -cov -unittest myprog.d can be omitted if they are the same.`, ), Option("noboundscheck", - "no array bounds checking (deprecated, use -boundscheck=off)", + "no array bounds checking (deprecated, use `-boundscheck=off`)", `Turns off all array bounds checking, even for safe functions. $(RED Deprecated (use $(TT $(SWLINK -boundscheck)=off) instead).)`, ), @@ -740,6 +739,14 @@ dmd -cov -unittest myprog.d function attribute for partial disabling of Exceptions instead, and only use this flag to globally disable Exceptions.", ), + Option("nothrow-optimizations", + "allow skipping destructors when an Error unwinds through a nothrow function", + `Controls whether $(D finally) blocks are emitted when the try body is $(D nothrow). + By default, finally blocks always run, ensuring cleanup on $(D Error) as well. + With this option, finally blocks are skipped in nothrow try bodies, which may prevent + destructors and scope(exit) blocks (which implicitly generate a try-finally block) + from running when an $(D Error) is thrown.` + ), Option("O", "optimize", `Optimize generated code. For fastest executables, compile @@ -752,14 +759,14 @@ dmd -cov -unittest myprog.d conjuction with $(SWLINK -D) or $(SWLINK -H) flags.` ), Option("od=", - "write object & library files to directory", - `Write object files relative to directory $(I objdir) + "write object & library files to ", + `Write object files relative to $(I directory) instead of to the current directory. $(SWLINK -op) can be used if the original package hierarchy should be retained`, ), Option("of=", - "name output file to filename", + "name output file to ", `Set output file name to $(I filename) in the output directory. The output file can be an object file, executable file, or library file depending on the other @@ -767,15 +774,17 @@ dmd -cov -unittest myprog.d ), Option("op", "preserve source path for output files", - `Normally the path for $(B .d) source files is stripped + `Preserve source path for output files. + Normally the path for $(B .d) source files is stripped off when generating an object, interface, or Ddoc file - name. $(SWLINK -op) will leave it on.`, + name.`, ), Option("oq", "Write object files with fully qualified file names", - `When compiling pkg/app.d, the resulting object file name will be pkg_app.obj - instead of app.o. This helps to prevent name conflicts when compiling multiple - packages in the same directory with the $(SWLINK -od) flag.`, + "Write object files with fully qualified file names. + When compiling `pkg/app.d`, the resulting object file name will be `pkg_app.o` + instead of `app.o`. This helps to prevent name conflicts when compiling multiple + packages in the same directory with the $(SWLINK -od) flag.", ), Option("os=", "sets target operating system to ", @@ -792,14 +801,14 @@ dmd -cov -unittest myprog.d )` ), Option("P=", - "pass preprocessorflag to C preprocessor", - `Pass $(I preprocessorflag) to - $(WINDOWS cl.exe) - $(UNIX cpp)`, + "pass to C preprocessor", + "Pass $(I preprocessorflag) to + $(WINDOWS `cl.exe`) + $(UNIX `cpp`). See also $(SWLINK -cpp)", ), Option("preview=", - "enable an upcoming language change identified by 'name'", - `Preview an upcoming language change identified by $(I id)`, + "enable an upcoming language change identified by ", + `Preview an upcoming language change identified by `, ), Option("preview=[h|help|?]", "list all upcoming language changes" @@ -809,7 +818,7 @@ dmd -cov -unittest myprog.d `Instrument the generated code so that runtime performance data is collected when the generated program is run. Upon completion of the generated program, the files $(TT trace.log) and $(TT trace.def) - are generated. $(TT trace.log) has two sections, + are generated. $(TT trace.log) has two sections: $(OL $(LI Fan in and fan out for each profiled function. The name of the function is left-justified, the functions immediately preceding it are the other functions that call it (fan in) and how many times @@ -823,13 +832,12 @@ dmd -cov -unittest myprog.d ) The $(TT trace.def) file contains linker commands to associate functions which are strongly coupled so they appear adjacent in the resulting executable file. - For more information see $(LINK2 https://www.digitalmars.com/ctg/trace.html, profile) + For more information see $(LINK2 https://www.digitalmars.com/ctg/trace.html, profile). `, ), Option("profile=gc", "profile runtime allocations", - `$(UL - $(LI $(B gc): Instrument calls to GC memory allocation and + `Instrument calls to GC memory allocation and write a report to the file $(TT profilegc.log) upon program termination. $(B Note:) Only instrumented calls will be logged. These include: @@ -839,8 +847,8 @@ dmd -cov -unittest myprog.d $(LI GC allocations via core.memory.GC) ) Allocations made by other means will not be logged, - including direct calls to the GC's C API.) - )`, + including direct calls to the GC's C API. + `, ), Option("release", "contracts and asserts are not emitted, and bounds checking is performed only in @safe functions", @@ -850,18 +858,18 @@ dmd -cov -unittest myprog.d are undefined behaviour.` ), Option("revert=", - "revert language change identified by 'name'", - `Revert language change identified by $(I id)`, + "revert language change identified by ", + `Revert language change identified by `, ), Option("revert=[h|help|?]", "list all revertable language changes" ), - Option("run ", - "compile, link, and run the program srcfile", + Option("run ", + "compile, link, and run the program ", `Compile, link, and run the program $(I srcfile) with the rest of the command line, $(I args...), as the arguments to the program. - No .$(OBJEXT) or executable file is left behind.` + No $(TT .$(OBJEXT)) or executable file is left behind.` ), Option("shared", "generate shared library (DLL)", @@ -885,8 +893,8 @@ dmd -cov -unittest myprog.d " ), Option("transition=", - "help with language change identified by 'name'", - `Show additional info about language change identified by $(I id)`, + "help with language change identified by ", + `Show additional info about language change identified by `, ), Option("transition=[h|help|?]", "list all language changes" @@ -931,37 +939,33 @@ dmd -cov -unittest myprog.d )`, ), Option("verrors=spec", - "show errors from speculative compiles such as __traits(compiles,...)" + "show errors from speculative compiles such as `__traits(compiles, ...)`" ), Option("-version", "print compiler version and exit" ), - Option("version=", - "compile in version code >= level", - `Compile in $(LINK2 $(ROOT_DIR)spec/version.html#version, version level) >= $(I level)`, - ), Option("version=", - "compile in version code identified by ident", + "compile in version code identified by ", `Compile in $(LINK2 $(ROOT_DIR)spec/version.html#version, version identifier) $(I ident)` ), Option("vgc", - "list all gc allocations including hidden ones" + "list all GC allocations including hidden ones" ), - Option("visibility=", - "default visibility of symbols (default/hidden/public)", + Option("visibility=[default|hidden|public]", + "default visibility of symbols", "$(UL - $(LI $(I default): Hidden for Windows targets without -shared, otherwise public) - $(LI $(I hidden): Only export symbols marked with 'export') + $(LI $(I default): for Windows targets without $(SWLINK -shared), otherwise ) + $(LI $(I hidden): Only export symbols marked with `export`) $(LI $(I public): Export all symbols) )", ), Option("vtls", "list all variables going into thread local storage" ), - Option("vtemplates=[list-instances]", + Option("vtemplates[=list-instances]", "list statistics on template instantiations", - `An optional argument determines extra diagnostics, - where: + `List statistics on template instantiations. + An optional argument determines extra diagnostics: $(DL $(DT list-instances)$(DD Also shows all instantiation contexts for each template.) )`, @@ -972,8 +976,8 @@ dmd -cov -unittest myprog.d ), Option("wi", "warnings as messages (compilation will continue)", - `Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings (i.e. compilation - still proceeds normally))`, + `Enable $(LINK2 $(ROOT_DIR)articles/warnings.html, informational warnings) (i.e. compilation + still proceeds normally)`, ), Option("wo", "warnings about use of obsolete features (compilation will continue)", @@ -984,10 +988,10 @@ dmd -cov -unittest myprog.d "generate JSON file" ), Option("Xf=", - "write JSON file to filename" + "write JSON file to " ), Option("Xcc=", - "pass driverflag to linker driver (cc)", + "pass to linker driver (cc)", "Pass $(I driverflag) to the linker driver (`$CC` or `cc`)", cast(TargetOS) (TargetOS.all & ~cast(uint)TargetOS.Windows) ), @@ -1080,6 +1084,8 @@ dmd -cov -unittest myprog.d Feature("systemVariables", "systemVariables", "disable access to variables marked '@system' from @safe code", "https://dlang.org/spec/attribute.html#system-variables"), + Feature("fastdfa", "useFastDFA", + "Fast dataflow analysis engine, experimental"), ]; } @@ -1196,6 +1202,7 @@ version (IN_LLVM) {} else =invariant[=[on|off]] Class/struct invariants =out[=[on|off]] Out contracts =switch[=[on|off]] Final switch failure checking + =nullderef[=[on|off]] Null dereference error =on Enable all assertion checking (default for non-release builds) =off Disable all assertion checking diff --git a/dmd/clone.d b/dmd/clone.d index f3f359ee312..610dd756ec6 100644 --- a/dmd/clone.d +++ b/dmd/clone.d @@ -2,7 +2,7 @@ * Builds struct member functions if needed and not defined by the user. * Includes `opEquals`, `opAssign`, post blit, copy constructor and destructor. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/clone.d, _clone.d) diff --git a/dmd/common/bitfields.d b/dmd/common/bitfields.d index 5732f9d385f..ce2c9386366 100644 --- a/dmd/common/bitfields.d +++ b/dmd/common/bitfields.d @@ -1,7 +1,7 @@ /** * A library bitfields utility * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Dennis Korpel * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/bitfields.d, common/bitfields.d) @@ -10,6 +10,9 @@ */ module dmd.common.bitfields; +nothrow: +@safe: + //version = Has_Bitfields; // does not work (yet) because hashOf doesn't work on bitfields version(Has_Bitfields) version = Debugger_friendly; // without Has_Bitfields, this uses more space by using S diff --git a/dmd/common/charactertables.d b/dmd/common/charactertables.d index 78b740e857e..620c04cfffc 100644 --- a/dmd/common/charactertables.d +++ b/dmd/common/charactertables.d @@ -3,7 +3,7 @@ * * Supports UAX31, C99, C11 and least restrictive (All). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/charactertables.d, common/charactertables.d) diff --git a/dmd/common/charactertables.h b/dmd/common/charactertables.h index b38409e302e..86558a18620 100644 --- a/dmd/common/charactertables.h +++ b/dmd/common/charactertables.h @@ -3,7 +3,7 @@ * * Supports UAX31, C99, C11 and least restrictive (All). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/charactertables.h, common/charactertables.d) diff --git a/dmd/common/file.d b/dmd/common/file.d index 57740432a3d..7b7c2bf6a7d 100644 --- a/dmd/common/file.d +++ b/dmd/common/file.d @@ -4,7 +4,7 @@ * Functions and objects dedicated to file I/O and management. TODO: Move here artifacts * from places such as root/ so both the frontend and the backend have access to them. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/file.d, common/_file.d) @@ -32,22 +32,10 @@ version (Windows) { import core.stdc.wchar_; import core.sys.windows.winbase; - -version (IN_LLVM) -{ import core.sys.windows.winnls : CP_UTF8; import core.sys.windows.winnt; - enum CodePage = CP_UTF8; -} -else -{ - import core.sys.windows.winnls : CP_ACP; - import core.sys.windows.winnt; - - enum CodePage = CP_ACP; // assume filenames encoded in system default Windows ANSI code page -} - + enum CodePage = CP_UTF8; // assume filenames already gone through Windows ANSI code page -> UTF8 conversion enum invalidHandle = INVALID_HANDLE_VALUE; } else version (Posix) @@ -66,7 +54,6 @@ else - nothrow: /** @@ -134,7 +121,7 @@ struct FileMapping(Datum) if (size > 0 && size != ulong.max && size <= size_t.max) { - auto p = mmap(null, cast(size_t) size, is(Datum == const) ? PROT_READ : PROT_WRITE, MAP_SHARED, handle, 0); + auto p = mmap(null, cast(size_t) size, is(Datum == const) ? PROT_READ : (PROT_READ | PROT_WRITE), MAP_SHARED, handle, 0); if (p == MAP_FAILED) { fprintf(stderr, "mmap(null, %zu) for \"%s\" failed: %s\n", cast(size_t) size, filename, strerror(errno)); @@ -395,8 +382,8 @@ struct FileMapping(Datum) } if (size > 0) { - auto p = mmap(null, size, PROT_WRITE, MAP_SHARED, handle, 0); - if (cast(ssize_t) p == -1) + auto p = mmap(null, size, PROT_READ | PROT_WRITE, MAP_SHARED, handle, 0); + if (p == MAP_FAILED) { fprintf(stderr, "mmap() failed for \"%s\": %s\n", filename, strerror(errno)); exit(1); diff --git a/dmd/common/int128.d b/dmd/common/int128.d index aaf38c51577..865cb1e3fe1 100644 --- a/dmd/common/int128.d +++ b/dmd/common/int128.d @@ -2,7 +2,7 @@ * * Not optimized for speed. * - * Copyright: Copyright (C) 2022-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 2022-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Authors: Walter Bright * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/int128.d, root/_int128.d) diff --git a/dmd/common/outbuffer.d b/dmd/common/outbuffer.d index a5340ef8058..d569c98b3fb 100644 --- a/dmd/common/outbuffer.d +++ b/dmd/common/outbuffer.d @@ -1,7 +1,7 @@ /** * An expandable buffer in which you can write text or binary data. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/outbuffer.d, root/_outbuffer.d) diff --git a/dmd/common/outbuffer.h b/dmd/common/outbuffer.h index 9630f122015..435193d7163 100644 --- a/dmd/common/outbuffer.h +++ b/dmd/common/outbuffer.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/common/smallbuffer.d b/dmd/common/smallbuffer.d index fe0afcc72cd..cbcd6e1380a 100644 --- a/dmd/common/smallbuffer.d +++ b/dmd/common/smallbuffer.d @@ -1,7 +1,7 @@ /** * Common string functions including filename manipulation. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/common/smallbuffer.d, common/_smallbuffer.d) @@ -121,24 +121,20 @@ version(Windows) wchar[] toWStringz(scope const(char)[] narrow, ref SmallBuffer! size_t charsToWchars(scope const(char)[] narrow, scope wchar[] buffer) { // https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar - import core.sys.windows.winnls : MultiByteToWideChar, CP_ACP; -version (IN_LLVM) -{ - import dmd.common.file : CodePage; - return MultiByteToWideChar(CodePage, 0, narrow.ptr, cast(int) narrow.length, buffer.ptr, cast(int) buffer.length); -} -else -{ - return MultiByteToWideChar(CP_ACP, 0, narrow.ptr, cast(int) narrow.length, buffer.ptr, cast(int) buffer.length); -} + import core.sys.windows.winnls : MultiByteToWideChar, CP_UTF8; + return MultiByteToWideChar(CP_UTF8, 0, narrow.ptr, cast(int) narrow.length, buffer.ptr, cast(int) buffer.length); } - size_t length = charsToWchars(narrow, buffer[]); - if (length >= buffer.length) // not enough room in buffer[] + size_t length = charsToWchars(narrow, buffer[0..$-1]); + if (length == 0 && narrow.length > 0) // not enough room in buffer[] { + import core.sys.windows.winbase : GetLastError; + import core.sys.windows.winerror : ERROR_INSUFFICIENT_BUFFER; + assert(GetLastError() == ERROR_INSUFFICIENT_BUFFER); + length = charsToWchars(narrow, []); buffer.create(length + 1); // extend buffer length - length = charsToWchars(narrow, buffer[]); // try again - assert(length < buffer.length); + length = charsToWchars(narrow, buffer[0..length]); // try again + assert(length > 0 && length < buffer.length); } buffer[length] = 0; return buffer[0 .. length]; diff --git a/dmd/compiler.d b/dmd/compiler.d index cccf90061b9..3894237e84f 100644 --- a/dmd/compiler.d +++ b/dmd/compiler.d @@ -1,7 +1,7 @@ /** * Describes a back-end compiler and implements compiler-specific actions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/compiler.d, _compiler.d) @@ -19,6 +19,7 @@ import dmd.ctfeexpr; import dmd.dmodule; import dmd.errors; import dmd.expression; +import dmd.expressionsem : toInteger, toReal; import dmd.globals; import dmd.id; import dmd.identifier; diff --git a/dmd/compiler.h b/dmd/compiler.h index ca085c6649c..ac9d60630b8 100644 --- a/dmd/compiler.h +++ b/dmd/compiler.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/cond.d b/dmd/cond.d index 1d994f0dcb8..b1cdbbcade1 100644 --- a/dmd/cond.d +++ b/dmd/cond.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/version.html, Conditional Compilation) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cond.d, _cond.d) @@ -17,25 +17,20 @@ import core.stdc.string; import dmd.arraytypes; import dmd.astenums; import dmd.ast_node; -import dmd.dcast; -import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; -import dmd.dsymbol; import dmd.errors; import dmd.expression; import dmd.globals; import dmd.identifier; import dmd.location; import dmd.mtype; -import dmd.optimize; import dmd.common.outbuffer; import dmd.rootobject; import dmd.root.string; import dmd.tokens; import dmd.utils; import dmd.visitor; -import dmd.id; import dmd.statement; import dmd.declaration; import dmd.dstruct; @@ -154,6 +149,7 @@ extern (C++) final class StaticForeach : RootObject auto tf = new TypeFunction(ParameterList(), null, LINK.default_, STC.none); auto fd = new FuncLiteralDeclaration(loc, loc, tf, TOK.reserved, null); fd.fbody = s; + fd.skipCodegen = true; auto fe = new FuncExp(loc, fd); auto ce = new CallExp(loc, fe, new Expressions()); return ce; @@ -234,15 +230,6 @@ extern (C++) final class StaticForeach : RootObject { // TODO: move to druntime? return new CallExp(loc, new TypeExp(loc, type), e); } - - /***************************************** - * Returns: - * `true` iff ready to call `dmd.statementsem.makeTupleForeach`. - */ - extern(D) bool ready() - { - return aggrfe && aggrfe.aggr && aggrfe.aggr.type && aggrfe.aggr.type.toBasetype().ty == Ttuple; - } } /*********************************************************** diff --git a/dmd/cond.h b/dmd/cond.h index 0afa042f9da..1892d2c9cfc 100644 --- a/dmd/cond.h +++ b/dmd/cond.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/console.d b/dmd/console.d index 29dc9fb3001..cc78b083dd2 100644 --- a/dmd/console.d +++ b/dmd/console.d @@ -2,7 +2,7 @@ * Control the various text mode attributes, such as color, when writing text * to the console. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/console.d, _console.d) diff --git a/dmd/constfold.d b/dmd/constfold.d index 7916f0e013d..2a43c8e2753 100644 --- a/dmd/constfold.d +++ b/dmd/constfold.d @@ -5,7 +5,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/float.html#fp_const_folding, Floating Point Constant Folding) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/constfold.d, _constfold.d) @@ -25,7 +25,7 @@ import dmd.declaration; import dmd.dstruct; import dmd.errors; import dmd.expression; -import dmd.expressionsem : getField, isIdentical; +import dmd.expressionsem; import dmd.globals; import dmd.location; import dmd.mtype; @@ -37,7 +37,7 @@ import dmd.root.utf; import dmd.sideeffect; import dmd.target; import dmd.tokens; -import dmd.typesem : toDsymbol, equivalent, sarrayOf, size; +import dmd.typesem; private enum LOG = false; @@ -1267,7 +1267,7 @@ UnionExp Slice(Type type, Expression e1, Expression lwr, Expression upr) { auto elements = new Expressions(cast(size_t)(iupr - ilwr)); memcpy(elements.tdata(), es1.elements.tdata() + ilwr, cast(size_t)(iupr - ilwr) * ((*es1.elements)[0]).sizeof); - emplaceExp!(ArrayLiteralExp)(&ue, e1.loc, type, elements); + emplaceExp!(ArrayLiteralExp)(&ue, e1.loc, type, es1.basis, elements); } } else diff --git a/dmd/cparse.d b/dmd/cparse.d index 4d51786fc71..2b2c4fab8d8 100644 --- a/dmd/cparse.d +++ b/dmd/cparse.d @@ -3,7 +3,7 @@ * * Specification: C11 * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cparse.d, _cparse.d) @@ -27,7 +27,7 @@ import dmd.root.array; import dmd.common.outbuffer; import dmd.root.rmem; import dmd.tokens; -import dmd.typesem : size; +import dmd.typesem : size, makeImmutable, nextOf; version (LDC) private enum LDC_pre_2084 = __VERSION__ < 2084; // workaround bug with LDC < v1.14 host compilers else private enum LDC_pre_2084 = false; @@ -39,6 +39,8 @@ final class CParser(AST) : Parser!AST AST.Dsymbols* symbols; // symbols declared in current scope bool addFuncName; /// add declaration of __func__ to function symbol table + bool refFuncName; // declaration of __FUNCTION__ + bool pretFuncName; // declaration for __PRETTY_FUNCTION__ bool importBuiltins; /// seen use of C compiler builtins, so import __importc_builtins; private @@ -755,6 +757,12 @@ final class CParser(AST) : Parser!AST const id = token.ident.toString(); if (id.length > 2 && id[0] == '_' && id[1] == '_') // leading double underscore { + if (token.ident is Id.FUNCTION) + refFuncName = true; // implicitly declare __FUNCTION__ + + if (token.ident is Id.PRETTY_FUNCTION) + pretFuncName = true; // implicitly declare __PRETTY_FUNCTION__ + if (token.ident is Id.__func__) { addFuncName = true; // implicitly declare __func__ @@ -2227,7 +2235,10 @@ final class CParser(AST) : Parser!AST } } - addFuncName = false; // gets set to true if somebody references __func__ in this function + /* gets set to true if somebody references __func__ in this function, //ditto for __FUNCTION__ */ + addFuncName = false; + refFuncName = false; + pretFuncName = false; const locFunc = token.loc; auto body = cparseStatement(ParseStatementFlags.curly); // don't start a new scope; continue with parameter scope @@ -2238,11 +2249,20 @@ final class CParser(AST) : Parser!AST auto fd = new AST.FuncDeclaration(id.loc, prevloc, id.name, stc, ft, specifier.noreturn); specifiersToFuncDeclaration(fd, specifier); + auto stmts = new AST.Statements(); + if (addFuncName) - { - auto s = createFuncName(locFunc, id.name); - body = new AST.CompoundStatement(locFunc, s, body); - } + stmts.push(createFuncName(locFunc, id.name, Id.__func__)); + + if (refFuncName) + stmts.push(createFuncName(locFunc, id.name, Id.FUNCTION)); + + if (pretFuncName) + stmts.push(createPrettyFunc(locFunc, fd)); + + stmts.push(body); + + body = new AST.CompoundStatement(locFunc, stmts); fd.fbody = body; // TODO add `symbols` to the function's local symbol table `sc2` in FuncDeclaration::semantic3() @@ -2378,7 +2398,6 @@ final class CParser(AST) : Parser!AST xllong = 0x40, xfloat = 0x80, xdouble = 0x100, - xldouble = 0x200, xtag = 0x400, xident = 0x800, xvoid = 0x1000, @@ -3640,109 +3659,108 @@ final class CParser(AST) : Parser!AST if (!isGnuAttributeName()) return; - if (token.value == TOK.identifier) + if (token.value != TOK.identifier) { - if (token.ident == Id.aligned) - { - nextToken(); - if (token.value == TOK.leftParenthesis) - { - nextToken(); - AST.Expression exp = cparseConstantExp(); - if (!specifier.alignAttrs) - specifier.alignAttrs = new AST.Expressions(); - specifier.alignAttrs.push(exp); - check(TOK.rightParenthesis); - } - else - { - /* ignore __attribute__((aligned)), which sets the alignment to the largest value for any data - * type on the target machine. It's the opposite of __attribute__((packed)) - */ - } - } - else if (token.ident == Id.packed) - { - specifier.packalign.set(1); - specifier.packalign.setPack(); - nextToken(); - } - else if (token.ident == Id.always_inline) // https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html - { - specifier.scw |= SCW.xinline; - nextToken(); - } - else if (token.ident == Id._deprecated) - { - specifier._deprecated = true; - nextToken(); - if (token.value == TOK.leftParenthesis) // optional deprecation message - { - nextToken(); - specifier.depMsg = cparseExpression(); - check(TOK.rightParenthesis); - } - } - else if (token.ident == Id.dllimport) - { - specifier.dllimport = true; - nextToken(); - } - else if (token.ident == Id.dllexport) - { - specifier.dllexport = true; - nextToken(); - } - else if (token.ident == Id.naked) - { - specifier.naked = true; - nextToken(); - } - else if (token.ident == Id.noinline) + nextToken(); + if (token.value == TOK.leftParenthesis) + cparseParens(); + return; + } + + if (token.ident == Id.aligned) + { + nextToken(); + if (token.value == TOK.leftParenthesis) { - specifier.scw |= SCW.xnoinline; - nextToken(); - } - else if (token.ident == Id.noreturn) - { - specifier.noreturn = true; nextToken(); + AST.Expression exp = cparseConstantExp(); + if (!specifier.alignAttrs) + specifier.alignAttrs = new AST.Expressions(); + specifier.alignAttrs.push(exp); + check(TOK.rightParenthesis); } - else if (token.ident == Id._nothrow) + else { - specifier._nothrow = true; - nextToken(); + /* ignore __attribute__((aligned)), which sets the alignment to the largest value for any data + * type on the target machine. It's the opposite of __attribute__((packed)) + */ } - else if (token.ident == Id._pure) + } + else if (token.ident == Id.packed) + { + specifier.packalign.set(1); + specifier.packalign.setPack(); + nextToken(); + } + else if (token.ident == Id.always_inline) // https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html + { + specifier.scw |= SCW.xinline; + nextToken(); + } + else if (token.ident == Id._deprecated) + { + specifier._deprecated = true; + nextToken(); + if (token.value == TOK.leftParenthesis) // optional deprecation message { - specifier._pure = true; nextToken(); + specifier.depMsg = cparseExpression(); + check(TOK.rightParenthesis); } - else if (token.ident == Id.vector_size) + } + else if (token.ident == Id.dllimport) + { + specifier.dllimport = true; + nextToken(); + } + else if (token.ident == Id.dllexport) + { + specifier.dllexport = true; + nextToken(); + } + else if (token.ident == Id.naked) + { + specifier.naked = true; + nextToken(); + } + else if (token.ident == Id.noinline) + { + specifier.scw |= SCW.xnoinline; + nextToken(); + } + else if (token.ident == Id.noreturn) + { + specifier.noreturn = true; + nextToken(); + } + else if (token.ident == Id._nothrow) + { + specifier._nothrow = true; + nextToken(); + } + else if (token.ident == Id._pure) + { + specifier._pure = true; + nextToken(); + } + else if (token.ident == Id.vector_size) + { + nextToken(); + check(TOK.leftParenthesis); + if (token.value == TOK.int32Literal) { + const n = token.unsvalue; + if (n < 1 || n & (n - 1) || ushort.max < n) + error("__attribute__((vector_size(%lld))) must be an integer positive power of 2 and be <= 32,768", cast(ulong)n); + specifier.vector_size = cast(uint) n; nextToken(); - check(TOK.leftParenthesis); - if (token.value == TOK.int32Literal) - { - const n = token.unsvalue; - if (n < 1 || n & (n - 1) || ushort.max < n) - error("__attribute__((vector_size(%lld))) must be an integer positive power of 2 and be <= 32,768", cast(ulong)n); - specifier.vector_size = cast(uint) n; - nextToken(); - } - else - { - error("value for vector_size expected, not `%s`", token.toChars()); - nextToken(); - } - check(TOK.rightParenthesis); } else { + error("value for vector_size expected, not `%s`", token.toChars()); nextToken(); - if (token.value == TOK.leftParenthesis) - cparseParens(); } + check(TOK.rightParenthesis); } else { @@ -4852,18 +4870,48 @@ final class CParser(AST) : Parser!AST * loc = location for this declaration * id = identifier of function * Returns: - * statement representing the declaration of __func__ + * statement representing the declaration of __func__, __FUNCTION__, or __PRETTY-FUNCTION__ */ - private AST.Statement createFuncName(Loc loc, Identifier id) + private AST.Statement createFuncName(Loc loc, Identifier id, Identifier cident) { const fn = id.toString(); // function-name auto efn = new AST.StringExp(loc, fn, fn.length, 1, 'c'); auto ifn = new AST.ExpInitializer(loc, efn); - auto lenfn = new AST.IntegerExp(loc, fn.length + 1, AST.Type.tuns32); // +1 for terminating 0 + auto lenfn = new AST.IntegerExp(loc, fn.length + 1, AST.Type.tuns32); // +1 for terminating 0, ditto for __pretty_chars__ auto tfn = new AST.TypeSArray(AST.Type.tchar, lenfn); efn.type = tfn.makeImmutable(); efn.committed = true; - auto sfn = new AST.VarDeclaration(loc, tfn, Id.__func__, ifn, STC.gshared | STC.immutable_); + auto sfn = new AST.VarDeclaration(loc, tfn, cident, ifn, STC.gshared | STC.immutable_); + auto e = new AST.DeclarationExp(loc, sfn); + return new AST.ExpStatement(loc, e); + } + + /* function for C __PRETTY_FUNCTION__ for non-linux systems */ + private AST.Statement createPrettyFunc(Loc loc, AST.FuncDeclaration fd) + { + auto tf = fd.type.isTypeFunction(); + auto funcSig = tf.next.toString(); + funcSig ~= " "; + funcSig ~= fd.ident.toString(); + funcSig ~= "("; + + foreach (i, fparam ; tf.parameterList) + { + if (i > 0) + funcSig ~= ", "; + + AST.Type t = tf.parameterList[i].type; + funcSig ~= t.toString(); + } + funcSig ~= ")"; + + auto efn = new AST.StringExp(loc, funcSig); + auto ifn = new AST.ExpInitializer(loc, efn); + auto lenfn = new AST.IntegerExp(loc, funcSig.length + 1, AST.Type.tuns32); // +1 for terminating 0 + auto tfn = new AST.TypeSArray(AST.Type.tchar, lenfn); + efn.type = tfn.makeImmutable(); + efn.committed = true; + auto sfn = new AST.VarDeclaration(loc, tfn, Id.PRETTY_FUNCTION, ifn, STC.gshared | STC.immutable_); auto e = new AST.DeclarationExp(loc, sfn); return new AST.ExpStatement(loc, e); } @@ -4890,7 +4938,7 @@ final class CParser(AST) : Parser!AST // `const` is always applied to the return type, not the // type function itself. if (auto tf = t.isTypeFunction()) - tf.next = tf.next.addSTC(STC.const_); + tf.next = AST.addSTC(tf.next, STC.const_); else if (auto tt = t.isTypeTag()) tt.mod |= MODFlags.const_; else @@ -4899,7 +4947,7 @@ final class CParser(AST) : Parser!AST */ auto tn = t.nextOf(); if (!tn || tn.isConst()) - t = t.addSTC(STC.const_); + t = AST.addSTC(t, STC.const_); } return t; } @@ -5032,8 +5080,7 @@ final class CParser(AST) : Parser!AST if (pt && *pt) t = *pt; } - if (t.mcache && t.mcache.typedefIdent) - { + if ((t.mcache && t.mcache.typedefIdent) || t.isTypeBasic()) { t = t.copy(); t.mcache = null; } @@ -5592,6 +5639,24 @@ final class CParser(AST) : Parser!AST ++p; // advance to start of next line } + /* Create a nullary template function from an expression: + * auto id()() { return exp; } + */ + void addNullaryTemplate(AST.Expression exp, Identifier id) + { + auto ret = new AST.ReturnStatement(exp.loc, exp); + auto parameterList = AST.ParameterList(new AST.Parameters(), VarArg.none, STC.none); + STC stc = STC.auto_; + auto tf = new AST.TypeFunction(parameterList, null, LINK.d, stc); + auto fd = new AST.FuncDeclaration(exp.loc, exp.loc, id, stc, tf, 0); + fd.fbody = ret; + AST.Dsymbols* decldefs = new AST.Dsymbols(); + decldefs.push(fd); + AST.TemplateParameters* tpl = new AST.TemplateParameters(); + auto tempdecl = new AST.TemplateDeclaration(exp.loc, id, tpl, null, decldefs, false); + addSym(tempdecl); + } + while (p < endp) { //printf("|%s|\n", p); @@ -5715,6 +5780,32 @@ final class CParser(AST) : Parser!AST } break; + case TOK.identifier: + { + /* Look for: + * #define ID identifier ( args ) + * where the macro body is exactly a function-like macro call + * (no additional operators that could cause precedence issues). + * Rewrite to a template function: + * auto ID()() { return identifier(args); } + */ + assert(!params); // would be TOK.leftParenthesis + eLatch.sawErrors = false; + auto exp = cparseExpression(); + if (eLatch.sawErrors) // parsing errors + break; // abandon this #define + if (token.value != TOK.endOfFile) // did not consume the entire line + break; + // Only allow bare function calls to avoid precedence issues. + // E.g., `#define X FUNC(5)` is safe, but `#define X FUNC(5) + 1` + // would have different semantics in D vs C when used as `X * 2`. + if (!exp.isCallExp()) + break; + addNullaryTemplate(exp, id); + ++p; + continue; + } + case TOK.leftParenthesis: { /* Look for: @@ -5734,18 +5825,7 @@ final class CParser(AST) : Parser!AST nextToken(); if (token.value != TOK.endOfFile) break; - auto ret = new AST.ReturnStatement(exp.loc, exp); - auto parameterList = AST.ParameterList(new AST.Parameters(), VarArg.none, STC.none); - STC stc = STC.auto_; - auto tf = new AST.TypeFunction(parameterList, null, LINK.d, stc); - auto fd = new AST.FuncDeclaration(exp.loc, exp.loc, id, stc, tf, 0); - fd.fbody = ret; - AST.Dsymbols* decldefs = new AST.Dsymbols(); - decldefs.push(fd); - AST.TemplateParameters* tpl = new AST.TemplateParameters(); - AST.Expression constraint = null; - auto tempdecl = new AST.TemplateDeclaration(exp.loc, id, tpl, constraint, decldefs, false); - addSym(tempdecl); + addNullaryTemplate(exp, id); ++p; continue; } diff --git a/dmd/ctfe.h b/dmd/ctfe.h index e022d7c2a24..cff61f880ca 100644 --- a/dmd/ctfe.h +++ b/dmd/ctfe.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/ctfeexpr.d b/dmd/ctfeexpr.d index 367300bafaa..6cd32bd5e2f 100644 --- a/dmd/ctfeexpr.d +++ b/dmd/ctfeexpr.d @@ -1,7 +1,7 @@ /** * CTFE for expressions involving pointers, slices, array concatenation etc. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ctfeexpr.d, _ctfeexpr.d) @@ -25,19 +25,17 @@ import dmd.dstruct; import dmd.dtemplate; import dmd.errors; import dmd.expression; -import dmd.expressionsem : isIdentical; +import dmd.expressionsem; import dmd.func; import dmd.globals : dinteger_t, sinteger_t, uinteger_t; import dmd.location; import dmd.mtype; import dmd.root.bitarray; -import dmd.root.complex; import dmd.root.ctfloat; import dmd.root.port; import dmd.root.rmem; import dmd.tokens; import dmd.typesem; -import dmd.visitor; /****************************************************************/ /* A type meant as a union of all the Expression types, diff --git a/dmd/ctorflow.d b/dmd/ctorflow.d index e604700e1f9..4207c681e2c 100644 --- a/dmd/ctorflow.d +++ b/dmd/ctorflow.d @@ -1,7 +1,7 @@ /** * Manage flow analysis for constructors. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ctorflow.d, _ctorflow.d) diff --git a/dmd/cxxfrontend.d b/dmd/cxxfrontend.d index 2e7d5876410..d27111b0a11 100644 --- a/dmd/cxxfrontend.d +++ b/dmd/cxxfrontend.d @@ -1,7 +1,7 @@ /** * Contains C++ interfaces for interacting with DMD as a library. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/cxxfrontend.d, _cxxfrontend.d) @@ -16,7 +16,7 @@ import dmd.astenums; import dmd.attrib; import dmd.common.outbuffer : OutBuffer; import dmd.dclass : ClassDeclaration, BaseClass; -import dmd.declaration : TypeInfoDeclaration, VarDeclaration; +import dmd.declaration : TypeInfoDeclaration, VarDeclaration, TupleDeclaration; import dmd.denum : EnumDeclaration; import dmd.dmodule /*: Module*/; import dmd.dscope : Scope; @@ -32,6 +32,9 @@ import dmd.init : Initializer, NeedInterpret; import dmd.location : Loc; import dmd.mtype /*: Covariant, Type, Parameter, ParameterList*/; import dmd.rootobject : RootObject; +import dmd.root.optional; +import dmd.root.longdouble : real_t = longdouble; +import dmd.root.complex; import dmd.semantic3; import dmd.statement : Statement, AsmStatement, GccAsmStatement; @@ -110,14 +113,6 @@ void mangleToBuffer(TemplateInstance ti, ref OutBuffer buf) return dmd.mangle.mangleToBuffer(ti, buf); } -/*********************************************************** - * dmodule.d - */ -FuncDeclaration findGetMembers(ScopeDsymbol dsym) -{ - return dmd.dmodule.findGetMembers(dsym); -} - /*********************************************************** * doc.d */ @@ -297,11 +292,37 @@ void runDeferredSemantic3() return dmd.dsymbolsem.runDeferredSemantic3(); } -bool isOverlappedWith(VarDeclaration vd, VarDeclaration v){ +bool isOverlappedWith(VarDeclaration vd, VarDeclaration v) +{ import dmd.dsymbolsem; return dmd.dsymbolsem.isOverlappedWith(vd, v); } +Scope* newScope(AggregateDeclaration ad, Scope* sc) +{ + import dmd.dsymbolsem; + return dmd.dsymbolsem.newScope(ad, sc); +} + +Dsymbol search(Scope* sc, Loc loc, Identifier ident, out Dsymbol pscopesym, + SearchOptFlags flags = SearchOpt.all) +{ + import dmd.dsymbolsem; + return dmd.dsymbolsem.search(sc, loc, ident, pscopesym, flags); +} + +void addObjcSymbols(Dsymbol sym, ClassDeclarations* classes, ClassDeclarations* categories) +{ + import dmd.dsymbolsem; + return dmd.dsymbolsem.addObjcSymbols(sym, classes, categories); +} + +FuncDeclaration findGetMembers(ScopeDsymbol dsym) +{ + import dmd.dsymbolsem; + return dmd.dsymbolsem.findGetMembers(dsym); +} + /*********************************************************** * dtemplate.d */ @@ -345,6 +366,11 @@ void printTemplateStats(bool listInstances, ErrorSink eSink) return dmd.dtemplate.printTemplateStats(listInstances, eSink); } +void printInstantiationTrace(TemplateInstance ti) +{ + return ti.printInstantiationTrace(); +} + /*********************************************************** * dtoh.d */ @@ -363,17 +389,17 @@ Expression getDefaultValue(EnumDeclaration ed, Loc loc) return dmd.enumsem.getDefaultValue(ed, loc); } + /*********************************************************** - * expression.d + * expressionsem.d */ + void expandTuples(Expressions* exps, ArgumentLabels* names = null) { - return dmd.expression.expandTuples(exps, names); + import dmd.expressionsem; + return dmd.expressionsem.expandTuples(exps, names); } -/*********************************************************** - * expressionsem.d - */ Expression expressionSemantic(Expression e, Scope* sc) { import dmd.expressionsem; @@ -399,22 +425,87 @@ bool equals(const Expression exp, const Expression e) return dmd.expressionsem.equals(exp, e); } +bool isLvalue(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.isLvalue(exp); +} + +bool canElideCopy(Expression exp, Type to, bool checkMod) +{ + import dmd.expressionsem; + return dmd.expressionsem.canElideCopy(exp, to, checkMod); +} + +int getFieldIndex(ClassReferenceExp cre, Type fieldtype, uint fieldoffset) +{ + import dmd.expressionsem; + return dmd.expressionsem.getFieldIndex(cre, fieldtype, fieldoffset); +} + +void fillTupleExpExps(TupleExp te, TupleDeclaration tup) +{ + import dmd.expressionsem; + return dmd.expressionsem.fillTupleExpExps(te, tup); +} + +Optional!bool toBool(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toBool(exp); +} + +StringExp toStringExp(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toStringExp(exp); +} + +dinteger_t toInteger(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toInteger(exp); +} + +uinteger_t toUInteger(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toUInteger(exp); +} + +real_t toReal(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toReal(exp); +} + +complex_t toComplex(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toComplex(exp); +} + +real_t toImaginary(Expression exp) +{ + import dmd.expressionsem; + return dmd.expressionsem.toImaginary(exp); +} + /*********************************************************** - * func.d + * funcsem.d */ FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, StorageClass stc = STC.none) { - return FuncDeclaration.genCfunc(fparams, treturn, name, cast(STC) stc); + import dmd.funcsem; + return dmd.funcsem.genCfunc(fparams, treturn, name, cast(STC) stc); } FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, StorageClass stc = STC.none) { - return FuncDeclaration.genCfunc(fparams, treturn, id, cast(STC) stc); + import dmd.funcsem; + return dmd.funcsem.genCfunc(fparams, treturn, id, cast(STC) stc); } -/*********************************************************** - * funcsem.d - */ bool functionSemantic(FuncDeclaration fd) { import dmd.funcsem; @@ -445,6 +536,24 @@ bool needsClosure(FuncDeclaration fd) return dmd.funcsem.needsClosure(fd); } +bool hasNestedFrameRefs(FuncDeclaration fd) +{ + import dmd.funcsem; + return dmd.funcsem.hasNestedFrameRefs(fd); +} + +bool isVirtualMethod(FuncDeclaration fd) +{ + import dmd.funcsem; + return dmd.funcsem.isVirtualMethod(fd); +} + +bool isVirtual(const FuncDeclaration fd) +{ + import dmd.funcsem; + return dmd.funcsem.isVirtual(fd); +} + /*********************************************************** * hdrgen.d */ @@ -555,14 +664,6 @@ JsonFieldFlags tryParseJsonField(const(char)* fieldName) return dmd.json.tryParseJsonField(fieldName); } -/*********************************************************** - * mtype.d - */ -AggregateDeclaration isAggregate(Type t) -{ - return dmd.mtype.isAggregate(t); -} - /*********************************************************** * optimize.d */ @@ -622,6 +723,18 @@ bool tpsemantic(TemplateParameter tp, Scope* sc, TemplateParameters* parameters) /*********************************************************** * typesem.d */ +bool hasDeprecatedAliasThis(Type type) +{ + import dmd.typesem; + return dmd.typesem.hasDeprecatedAliasThis(type); +} + +AggregateDeclaration isAggregate(Type t) +{ + import dmd.typesem; + return dmd.typesem.isAggregate(t); +} + bool hasPointers(Type t) { import dmd.typesem; @@ -652,6 +765,12 @@ Type merge2(Type type) return dmd.typesem.merge2(type); } +Type toBasetype(Type type) +{ + import dmd.typesem; + return dmd.typesem.toBasetype(type); +} + Expression defaultInit(Type mt, Loc loc, const bool isCfile = false) { import dmd.typesem; @@ -815,6 +934,12 @@ Type referenceTo(Type type) return dmd.typesem.referenceTo(type); } +Type memType(TypeEnum type) +{ + import dmd.typesem; + return dmd.typesem.memType(type); +} + uinteger_t size(Type type) { import dmd.typesem; @@ -827,6 +952,18 @@ uinteger_t size(Type type, Loc loc) return dmd.typesem.size(type, loc); } +structalign_t alignment(Type type) +{ + import dmd.typesem; + return dmd.typesem.alignment(type); +} + +uint alignsize(Type type) +{ + import dmd.typesem; + return dmd.typesem.alignsize(type); +} + MATCH implicitConvTo(Type from, Type to) { import dmd.dcast; @@ -845,6 +982,186 @@ Expression defaultInitLiteral(Type t, Loc loc) return dmd.typesem.defaultInitLiteral(t, loc); } +bool hasUnsafeBitpatterns(Type type) +{ + import dmd.typesem; + return dmd.typesem.hasUnsafeBitpatterns(type); +} + +bool hasInvariant(Type type) +{ + import dmd.typesem; + return dmd.typesem.hasInvariant(type); +} + +bool hasVoidInitPointers(Type type) +{ + import dmd.typesem; + return dmd.typesem.hasVoidInitPointers(type); +} + +void Type_init() +{ + import dmd.typesem; + return dmd.typesem.Type_init(); +} + +void transitive(TypeNext type) +{ + import dmd.typesem; + return dmd.typesem.transitive(type); +} + +Type makeConst(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeConst(type); +} + +Type makeImmutable(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeImmutable(type); +} + +Type makeMutable(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeMutable(type); +} + +Type makeShared(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeShared(type); +} + +Type makeSharedConst(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeSharedConst(type); +} + +Type makeWild(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeWild(type); +} + +Type makeWildConst(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeWildConst(type); +} + +Type makeSharedWild(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeSharedWild(type); +} + +Type makeSharedWildConst(Type type) +{ + import dmd.typesem; + return dmd.typesem.makeSharedWildConst(type); +} + +Type nextOf(Type type) +{ + import dmd.typesem; + return dmd.typesem.nextOf(type); +} + +Type baseElemOf(Type type) +{ + import dmd.typesem; + return dmd.typesem.baseElemOf(type); +} + +Type isLazyArray(Parameter param) +{ + import dmd.typesem; + return dmd.typesem.isLazyArray(param); +} + +MOD deduceWild(Type type, Type t, bool isRef) +{ + import dmd.typesem; + return dmd.typesem.deduceWild(type, t, isRef); +} + +bool isIntegral(Type type) +{ + import dmd.typesem; + return dmd.typesem.isIntegral(type); +} + +bool isFloating(Type type) +{ + import dmd.typesem; + return dmd.typesem.isFloating(type); +} + +bool isScalar(Type type) +{ + import dmd.typesem; + return dmd.typesem.isScalar(type); +} + +bool isReal(Type type) +{ + import dmd.typesem; + return dmd.typesem.isReal(type); +} + +bool isComplex(Type type) +{ + import dmd.typesem; + return dmd.typesem.isComplex(type); +} + +bool isImaginary(Type type) +{ + import dmd.typesem; + return dmd.typesem.isImaginary(type); +} + +bool isString(Type type) +{ + import dmd.typesem; + return dmd.typesem.isString(type); +} + +bool isBoolean(Type type) +{ + import dmd.typesem; + return dmd.typesem.isBoolean(type); +} + +bool isUnsigned(Type type) +{ + import dmd.typesem; + return dmd.typesem.isUnsigned(type); +} + +bool needsNested(Type type) +{ + import dmd.typesem; + return dmd.typesem.needsNested(type); +} + +bool needsDestruction(Type type) +{ + import dmd.typesem; + return dmd.typesem.needsDestruction(type); +} + +bool needsCopyOrPostblit(Type type) +{ + import dmd.typesem; + return dmd.typesem.needsCopyOrPostblit(type); +} + /*********************************************************** * typinf.d */ @@ -882,6 +1199,12 @@ TypeInfoDeclaration getTypeInfoAssocArrayDeclaration(TypeAArray t, Scope* sc) /** * templatesem.d */ +bool declareParameter(TemplateParameter tp, Scope* sc) +{ + import dmd.templatesem; + return dmd.templatesem.declareParameter(tp, sc); +} + bool needsCodegen(TemplateInstance ti) { import dmd.templatesem; diff --git a/dmd/dcast.d b/dmd/dcast.d index acb5edd668f..fdc29094aa0 100644 --- a/dmd/dcast.d +++ b/dmd/dcast.d @@ -1,7 +1,7 @@ /** * Semantic analysis for cast-expressions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dcast.d, _dcast.d) @@ -14,7 +14,6 @@ module dmd.dcast; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; -import dmd.aliasthis; import dmd.arrayop; import dmd.arraytypes; import dmd.astenums; @@ -51,6 +50,50 @@ import dmd.typesem; enum LOG = false; +IntRange _cast(IntRange _this, Type type) +{ + if (!type.isIntegral() || type.toBasetype().isTypeVector()) + return _this; + if (!type.isUnsigned()) + return _this.castSigned(type.sizemask()); + if (type.toBasetype().ty == Tdchar) + return _this.castDchar(); + return _this.castUnsigned(type.sizemask()); +} + +IntRange castUnsigned(IntRange _this, Type type) +{ + if (!type.isIntegral() || type.toBasetype().isTypeVector()) + return _this.castUnsigned(ulong.max); + if (type.toBasetype().ty == Tdchar) + return _this.castDchar(); + return _this.castUnsigned(type.sizemask()); +} + +IntRange intRangeFromType(Type type) +{ + return intRangeFromType(type, type.isUnsigned()); +} + +IntRange intRangeFromType(Type type, bool isUnsigned) +{ + if (!type.isIntegral() || type.toBasetype().isTypeVector()) + return IntRange.widest(); + + uinteger_t mask = type.sizemask(); + auto lower = SignExtendedNumber(0); + auto upper = SignExtendedNumber(mask); + if (type.toBasetype().ty == Tdchar) + upper.value = 0x10FFFFUL; + else if (!isUnsigned) + { + lower.value = ~(mask >> 1); + lower.negative = true; + upper.value = (mask >> 1); + } + return IntRange(lower, upper); +} + /** * Attempt to implicitly cast the expression into type `t`. * @@ -90,44 +133,42 @@ Expression implicitCastTo(Expression e, Scope* sc, Type t) } auto ad = isAggregate(e.type); - if (ad && ad.aliasthis) + if (!ad || !ad.aliasthis) + return e.castTo(sc, t); + + if (!ad.type || ad.type.isTypeError()) + return e; + auto ts = ad.type.isTypeStruct(); + const adMatch = ts + ? ts.implicitConvToWithoutAliasThis(t) + : ad.type.isTypeClass().implicitConvToWithoutAliasThis(t); + + if (adMatch) + return e.castTo(sc, t); + + Type tob = t.toBasetype(); + Type t1b = e.type.toBasetype(); + if (ad == isAggregate(tob)) + return e.castTo(sc, t); + + if (t1b.ty == Tclass && tob.ty == Tclass) { - if (!ad.type || ad.type.isTypeError()) - return e; - auto ts = ad.type.isTypeStruct(); - const adMatch = ts - ? ts.implicitConvToWithoutAliasThis(t) - : ad.type.isTypeClass().implicitConvToWithoutAliasThis(t); - - if (!adMatch) + ClassDeclaration t1cd = t1b.isClassHandle(); + ClassDeclaration tocd = tob.isClassHandle(); + int offset; + if (tocd.isBaseOf(t1cd, &offset)) { - Type tob = t.toBasetype(); - Type t1b = e.type.toBasetype(); - if (ad != isAggregate(tob)) - { - if (t1b.ty == Tclass && tob.ty == Tclass) - { - ClassDeclaration t1cd = t1b.isClassHandle(); - ClassDeclaration tocd = tob.isClassHandle(); - int offset; - if (tocd.isBaseOf(t1cd, &offset)) - { - auto result = new CastExp(e.loc, e, t); - result.type = t; - return result; - } - } - - /* Forward the cast to our alias this member, rewrite to: - * cast(to)e1.aliasthis - */ - auto result = resolveAliasThis(sc, e); - return result.castTo(sc, t); - } + auto result = new CastExp(e.loc, e, t); + result.type = t; + return result; } } - return e.castTo(sc, t); + /* Forward the cast to our alias this member, rewrite to: + * cast(to)e1.aliasthis + */ + auto result = resolveAliasThis(sc, e); + return result.castTo(sc, t); } auto result = e.optimize(WANTvalue); @@ -136,54 +177,54 @@ Expression implicitCastTo(Expression e, Scope* sc, Type t) return implicitCastTo(result, sc, t); } - if (t.ty != Terror && e.type.ty != Terror) + if (t.ty == Terror || e.type.ty == Terror) + return ErrorExp.get(); + + if (!t.deco) + { + error(e.loc, "forward reference to type `%s`", t.toChars()); + return ErrorExp.get(); + } + + //printf("type %p ty %d deco %p\n", type, type.ty, type.deco); + //type = type.typeSemantic(loc, sc); + //printf("type %s t %s\n", type.deco, t.deco); + auto ts = toAutoQualChars(e.type, t); + + // Special case for improved diagnostic when const to mutable conversion + // fails due to struct/union having pointers + if (e.type.ty == Tstruct && t.ty == Tstruct && + e.type.isTypeStruct().sym == t.isTypeStruct().sym && + e.type.mod == MODFlags.const_ && t.mod == 0 && e.type.hasPointers) + { + auto sym = e.type.isTypeStruct().sym; + error(e.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s` because %s `%s` contains pointers or references", + e.toErrMsg(), ts[0], ts[1], sym.kind(), sym.toErrMsg()); + return ErrorExp.get(); + } + + // Special case for pointer conversions + if (e.type.toBasetype().ty == Tpointer && t.toBasetype().ty == Tpointer) { - if (!t.deco) + Type fromPointee = e.type.nextOf(); + Type toPointee = t.nextOf(); + // Const -> mutable conversion (disallowed) + if (fromPointee.isConst() && !toPointee.isConst()) { - error(e.loc, "forward reference to type `%s`", t.toChars()); + error(e.loc, "cannot implicitly convert `%s` to `%s`", e.type.toChars(), t.toChars()); + errorSupplemental(e.loc, "Note: Converting const to mutable requires an explicit cast (`cast(int*)`)."); + return ErrorExp.get(); } - else + // Incompatible pointee types (e.g., int* -> float* ) + else if (fromPointee.toBasetype().ty != toPointee.toBasetype().ty) { - //printf("type %p ty %d deco %p\n", type, type.ty, type.deco); - //type = type.typeSemantic(loc, sc); - //printf("type %s t %s\n", type.deco, t.deco); - auto ts = toAutoQualChars(e.type, t); - - // Special case for improved diagnostic when const to mutable conversion - // fails due to struct/union having pointers - if (e.type.ty == Tstruct && t.ty == Tstruct && - e.type.isTypeStruct().sym == t.isTypeStruct().sym && - e.type.mod == MODFlags.const_ && t.mod == 0 && e.type.hasPointers) - { - auto sym = e.type.isTypeStruct().sym; - error(e.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s` because %s `%s` contains pointers or references", - e.toErrMsg(), ts[0], ts[1], sym.kind(), sym.toErrMsg()); - return ErrorExp.get(); - } - - // Special case for pointer conversions - if (e.type.toBasetype().ty == Tpointer && t.toBasetype().ty == Tpointer) - { - Type fromPointee = e.type.nextOf(); - Type toPointee = t.nextOf(); - // Const -> mutable conversion (disallowed) - if (fromPointee.isConst() && !toPointee.isConst()) - { - error(e.loc, "cannot implicitly convert `%s` to `%s`", e.type.toChars(), t.toChars()); - errorSupplemental(e.loc, "Note: Converting const to mutable requires an explicit cast (`cast(int*)`)."); - return ErrorExp.get(); - } - // Incompatible pointee types (e.g., int* -> float* ) - else if (fromPointee.toBasetype().ty != toPointee.toBasetype().ty) - { - error(e.loc, "cannot implicitly convert `%s` to `%s`", e.type.toChars(), t.toChars()); - errorSupplemental(e.loc, "Note: Pointer types point to different base types (`%s` vs `%s`)", fromPointee.toChars(), toPointee.toChars()); - return ErrorExp.get(); - } - } - error(e.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`", e.toErrMsg(), ts[0], ts[1]); + error(e.loc, "cannot implicitly convert `%s` to `%s`", e.type.toChars(), t.toChars()); + errorSupplemental(e.loc, "Note: Pointer types point to different base types (`%s` vs `%s`)", fromPointee.toChars(), toPointee.toChars()); + return ErrorExp.get(); } } + error(e.loc, "cannot implicitly convert expression `%s` of type `%s` to `%s`", e.toErrMsg(), ts[0], ts[1]); + return ErrorExp.get(); } @@ -307,7 +348,7 @@ MATCH implicitConvTo(Expression e, Type t) if (e.type.isIntegral() && t.isIntegral() && e.type.isTypeBasic() && t.isTypeBasic()) { IntRange src = getIntRange(e); - IntRange target = IntRange.fromType(t); + IntRange target = intRangeFromType(t); if (target.contains(src)) { return MATCH.convert; @@ -683,7 +724,10 @@ MATCH implicitConvTo(Expression e, Type t) { if (e.committed && tynto != tyn) return MATCH.nomatch; - size_t fromlen = e.numberOfCodeUnits(tynto); + string s; + size_t fromlen = e.numberOfCodeUnits(tynto, s); + if (s) + error(e.loc, "%.*s", cast(int)s.length, s.ptr); size_t tolen = cast(size_t)t.isTypeSArray().dim.toInteger(); if (tolen < fromlen) return MATCH.nomatch; @@ -705,7 +749,10 @@ MATCH implicitConvTo(Expression e, Type t) { if (e.committed && tynto != tyn) return MATCH.nomatch; - size_t fromlen = e.numberOfCodeUnits(tynto); + string s; + size_t fromlen = e.numberOfCodeUnits(tynto, s); + if (s) + error(e.loc, "%.*s", cast(int)s.length, s.ptr); size_t tolen = cast(size_t)t.isTypeSArray().dim.toInteger(); if (tolen < fromlen) return MATCH.nomatch; @@ -1316,73 +1363,69 @@ MATCH implicitConvTo(Expression e, Type t) if (sd.isNested()) return MATCH.nomatch; } - if (ntb.isZeroInit(e.loc)) + if (!ntb.isZeroInit(e.loc)) { - /* Zeros are implicitly convertible, except for special cases. - */ - if (auto tc = ntb.isTypeClass()) - { - /* With new() must look at the class instance initializer. - */ - ClassDeclaration cd = tc.sym; + Expression earg = e.newtype.defaultInitLiteral(e.loc); + Type targ = e.newtype.toBasetype(); + + if (implicitMod(earg, targ, mod) == MATCH.nomatch) + return MATCH.nomatch; + return MATCH.constant; + } + /* Zeros are implicitly convertible, except for special cases. + */ + auto tc = ntb.isTypeClass(); + if (!tc) + return MATCH.constant; + + /* With new() must look at the class instance initializer. + */ + ClassDeclaration cd = tc.sym; - cd.size(e.loc); // resolve any forward references + cd.size(e.loc); // resolve any forward references - if (cd.isNested()) - return MATCH.nomatch; // uplevel reference may not be convertible + if (cd.isNested()) + return MATCH.nomatch; // uplevel reference may not be convertible - assert(!cd.isInterfaceDeclaration()); + assert(!cd.isInterfaceDeclaration()); - struct ClassCheck + static bool convertible(Expression e, ClassDeclaration cd, MOD mod) + { + for (size_t i = 0; i < cd.fields.length; i++) + { + VarDeclaration v = cd.fields[i]; + Initializer _init = v._init; + if (_init) { - extern (C++) static bool convertible(Expression e, ClassDeclaration cd, MOD mod) + if (_init.isVoidInitializer()) { - for (size_t i = 0; i < cd.fields.length; i++) - { - VarDeclaration v = cd.fields[i]; - Initializer _init = v._init; - if (_init) - { - if (_init.isVoidInitializer()) - { - } - else if (ExpInitializer ei = _init.isExpInitializer()) - { - // https://issues.dlang.org/show_bug.cgi?id=21319 - // This is to prevent re-analyzing the same expression - // over and over again. - if (ei.exp == e) - return false; - Type tb = v.type.toBasetype(); - if (implicitMod(ei.exp, tb, mod) == MATCH.nomatch) - return false; - } - else - { - /* Enhancement: handle StructInitializer and ArrayInitializer - */ - return false; - } - } - else if (!v.type.isZeroInit(e.loc)) - return false; - } - return cd.baseClass ? convertible(e, cd.baseClass, mod) : true; + } + else if (ExpInitializer ei = _init.isExpInitializer()) + { + // https://issues.dlang.org/show_bug.cgi?id=21319 + // This is to prevent re-analyzing the same expression + // over and over again. + if (ei.exp == e) + return false; + Type tb = v.type.toBasetype(); + if (implicitMod(ei.exp, tb, mod) == MATCH.nomatch) + return false; + } + else + { + /* Enhancement: handle StructInitializer and ArrayInitializer + */ + return false; } } - - if (!ClassCheck.convertible(e, cd, mod)) - return MATCH.nomatch; + else if (!v.type.isZeroInit(e.loc)) + return false; } + return cd.baseClass ? convertible(e, cd.baseClass, mod) : true; } - else - { - Expression earg = e.newtype.defaultInitLiteral(e.loc); - Type targ = e.newtype.toBasetype(); - if (implicitMod(earg, targ, mod) == MATCH.nomatch) - return MATCH.nomatch; - } + if (!convertible(e, cd, mod)) + return MATCH.nomatch; /* Success */ @@ -1662,40 +1705,42 @@ MATCH implicitConvTo(Type from, Type to) } return MATCH.nomatch; } - if (auto tsa = to.isTypeSArray()) - { - if (from == to) - return MATCH.exact; + auto tsa = to.isTypeSArray(); + if (!tsa) + return MATCH.nomatch; - if (from.dim.equals(tsa.dim)) - { - MATCH m = from.next.implicitConvTo(tsa.next); + if (from == to) + return MATCH.exact; - /* Allow conversion to non-interface base class. - */ - if (m == MATCH.convert && - from.next.ty == Tclass) - { - if (auto toc = tsa.next.isTypeClass) - { - if (!toc.sym.isInterfaceDeclaration) - return MATCH.convert; - } - } + if (!from.dim.equals(tsa.dim)) + return MATCH.nomatch; - /* Since static arrays are value types, allow - * conversions from const elements to non-const - * ones, just like we allow conversion from const int - * to int. - */ - if (m >= MATCH.constant) - { - if (from.mod != to.mod) - m = MATCH.constant; - return m; - } + MATCH m = from.next.implicitConvTo(tsa.next); + + /* Allow conversion to non-interface base class. + */ + if (m == MATCH.convert && + from.next.ty == Tclass) + { + if (auto toc = tsa.next.isTypeClass) + { + if (!toc.sym.isInterfaceDeclaration) + return MATCH.convert; } } + + /* Since static arrays are value types, allow + * conversions from const elements to non-const + * ones, just like we allow conversion from const int + * to int. + */ + if (m >= MATCH.constant) + { + if (from.mod != to.mod) + m = MATCH.constant; + return m; + } + return MATCH.nomatch; } @@ -1705,25 +1750,26 @@ MATCH implicitConvTo(Type from, Type to) if (from.equals(to)) return MATCH.exact; - if (auto ta = to.isTypeDArray()) - { - if (!MODimplicitConv(from.next.mod, ta.next.mod)) - return MATCH.nomatch; // not const-compatible + auto ta = to.isTypeDArray(); + if (!ta) + return visitType(from); - /* Allow conversion to void[] - */ - if (from.next.ty != Tvoid && ta.next.ty == Tvoid) - { - return MATCH.convert; - } + if (!MODimplicitConv(from.next.mod, ta.next.mod)) + return MATCH.nomatch; // not const-compatible - MATCH m = from.next.constConv(ta.next); - if (m > MATCH.nomatch) - { - if (m == MATCH.exact && from.mod != to.mod) - m = MATCH.constant; - return m; - } + /* Allow conversion to void[] + */ + if (from.next.ty != Tvoid && ta.next.ty == Tvoid) + { + return MATCH.convert; + } + + MATCH m = from.next.constConv(ta.next); + if (m > MATCH.nomatch) + { + if (m == MATCH.exact && from.mod != to.mod) + m = MATCH.constant; + return m; } return visitType(from); @@ -1735,21 +1781,23 @@ MATCH implicitConvTo(Type from, Type to) if (from.equals(to)) return MATCH.exact; - if (auto ta = to.isTypeAArray()) - { - if (!MODimplicitConv(from.next.mod, ta.next.mod)) - return MATCH.nomatch; // not const-compatible + auto ta = to.isTypeAArray(); + if (!ta) + return visitType(from); - if (!MODimplicitConv(from.index.mod, ta.index.mod)) - return MATCH.nomatch; // not const-compatible + if (!MODimplicitConv(from.next.mod, ta.next.mod)) + return MATCH.nomatch; // not const-compatible - MATCH m = from.next.constConv(ta.next); - MATCH mi = from.index.constConv(ta.index); - if (m > MATCH.nomatch && mi > MATCH.nomatch) - { - return MODimplicitConv(from.mod, to.mod) ? MATCH.constant : MATCH.nomatch; - } + if (!MODimplicitConv(from.index.mod, ta.index.mod)) + return MATCH.nomatch; // not const-compatible + + MATCH m = from.next.constConv(ta.next); + MATCH mi = from.index.constConv(ta.index); + if (m > MATCH.nomatch && mi > MATCH.nomatch) + { + return MODimplicitConv(from.mod, to.mod) ? MATCH.constant : MATCH.nomatch; } + return visitType(from); } @@ -1772,26 +1820,24 @@ MATCH implicitConvTo(Type from, Type to) if (tf.equals(to)) return MATCH.constant; - if (tf.covariant(to) == Covariant.yes) + if (tf.covariant(to) != Covariant.yes) + return MATCH.nomatch; + + Type tret = tf.nextOf(); + Type toret = to.nextOf(); + if (tret.ty == Tclass && toret.ty == Tclass) { - Type tret = tf.nextOf(); - Type toret = to.nextOf(); - if (tret.ty == Tclass && toret.ty == Tclass) - { - /* https://issues.dlang.org/show_bug.cgi?id=10219 - * Check covariant interface return with offset tweaking. - * interface I {} - * class C : Object, I {} - * I function() dg = function C() {} // should be error - */ - int offset = 0; - if (toret.isBaseOf(tret, &offset) && offset != 0) - return MATCH.nomatch; - } - return MATCH.convert; + /* https://issues.dlang.org/show_bug.cgi?id=10219 + * Check covariant interface return with offset tweaking. + * interface I {} + * class C : Object, I {} + * I function() dg = function C() {} // should be error + */ + int offset = 0; + if (toret.isBaseOf(tret, &offset) && offset != 0) + return MATCH.nomatch; } - - return MATCH.nomatch; + return MATCH.convert; } MATCH visitPointer(TypePointer from) @@ -1841,19 +1887,17 @@ MATCH implicitConvTo(Type from, Type to) if (from.equals(to)) return MATCH.exact; - if (auto toDg = to.isTypeDelegate()) - { - MATCH m = implicitPointerConv(from.next.isTypeFunction(), toDg.next); + auto toDg = to.isTypeDelegate(); + if (!toDg) + return MATCH.nomatch; - // Retain the old behaviour for this refactoring - // Should probably be changed to constant to match function pointers - if (m > MATCH.convert) - m = MATCH.convert; + MATCH m = implicitPointerConv(from.next.isTypeFunction(), toDg.next); - return m; - } - - return MATCH.nomatch; + // Retain the old behaviour for this refactoring + // Should probably be changed to constant to match function pointers + if (m > MATCH.convert) + return MATCH.convert; + return m; } MATCH visitStruct(TypeStruct from) @@ -1889,23 +1933,23 @@ MATCH implicitConvTo(Type from, Type to) { if (from == to) return MATCH.exact; - if (auto tt = to.isTypeTuple()) + auto tt = to.isTypeTuple(); + if (!tt) + return MATCH.nomatch; + + if (from.arguments.length != tt.arguments.length) + return MATCH.nomatch; + + MATCH m = MATCH.exact; + for (size_t i = 0; i < tt.arguments.length; i++) { - if (from.arguments.length == tt.arguments.length) - { - MATCH m = MATCH.exact; - for (size_t i = 0; i < tt.arguments.length; i++) - { - Parameter arg1 = (*from.arguments)[i]; - Parameter arg2 = (*tt.arguments)[i]; - MATCH mi = arg1.type.implicitConvTo(arg2.type); - if (mi < m) - m = mi; - } - return m; - } + Parameter arg1 = (*from.arguments)[i]; + Parameter arg2 = (*tt.arguments)[i]; + MATCH mi = arg1.type.implicitConvTo(arg2.type); + if (mi < m) + m = mi; } - return MATCH.nomatch; + return m; } MATCH visitNull(TypeNull from) @@ -2299,34 +2343,32 @@ Expression castTo(Expression e, Scope* sc, Type t, Type att = null) Expression visitReal(RealExp e) { - if (!e.type.equals(t)) + if (e.type.equals(t)) + return e; + + if ((e.type.isReal() && t.isReal()) || (e.type.isImaginary() && t.isImaginary())) { - if ((e.type.isReal() && t.isReal()) || (e.type.isImaginary() && t.isImaginary())) - { - auto result = e.copy(); - result.type = t; - return result; - } - else - return visit(e); + auto result = e.copy(); + result.type = t; + return result; } - return e; + else + return visit(e); } Expression visitComplex(ComplexExp e) { - if (!e.type.equals(t)) + if (e.type.equals(t)) + return e; + + if (e.type.isComplex() && t.isComplex()) { - if (e.type.isComplex() && t.isComplex()) - { - auto result = e.copy(); - result.type = t; - return result; - } - else - return visit(e); + auto result = e.copy(); + result.type = t; + return result; } - return e; + else + return visit(e); } Expression visitStructLiteral(StructLiteralExp e) @@ -3173,47 +3215,50 @@ Expression inferType(Expression e, Type t, int flag = 0) Expression visitAle(ArrayLiteralExp ale) { Type tb = t.toBasetype(); - if (tb.isStaticOrDynamicArray()) + if (!tb.isStaticOrDynamicArray()) + return ale; + + Type tn = tb.nextOf(); + if (ale.basis) + ale.basis = inferType(ale.basis, tn, flag); + for (size_t i = 0; i < ale.elements.length; i++) { - Type tn = tb.nextOf(); - if (ale.basis) - ale.basis = inferType(ale.basis, tn, flag); - for (size_t i = 0; i < ale.elements.length; i++) + if (Expression e = (*ale.elements)[i]) { - if (Expression e = (*ale.elements)[i]) - { - e = inferType(e, tn, flag); - (*ale.elements)[i] = e; - } + e = inferType(e, tn, flag); + (*ale.elements)[i] = e; } } + return ale; } Expression visitAar(AssocArrayLiteralExp aale) { Type tb = t.toBasetype(); - if (auto taa = tb.isTypeAArray()) + auto taa = tb.isTypeAArray(); + if (!taa) + return aale; + + Type ti = taa.index; + Type tv = taa.nextOf(); + for (size_t i = 0; i < aale.keys.length; i++) { - Type ti = taa.index; - Type tv = taa.nextOf(); - for (size_t i = 0; i < aale.keys.length; i++) + if (Expression e = (*aale.keys)[i]) { - if (Expression e = (*aale.keys)[i]) - { - e = inferType(e, ti, flag); - (*aale.keys)[i] = e; - } + e = inferType(e, ti, flag); + (*aale.keys)[i] = e; } - for (size_t i = 0; i < aale.values.length; i++) + } + for (size_t i = 0; i < aale.values.length; i++) + { + if (Expression e = (*aale.values)[i]) { - if (Expression e = (*aale.values)[i]) - { - e = inferType(e, tv, flag); - (*aale.values)[i] = e; - } + e = inferType(e, tv, flag); + (*aale.values)[i] = e; } } + return aale; } @@ -3450,6 +3495,60 @@ Lagain: t1b = t1.toBasetype(); t2b = t2.toBasetype(); + static bool isComplexStruct(Type t) + { + if (t.ty != Tstruct) + return false; + + TypeStruct ts = t.isTypeStruct(); + + return ts.sym.toString() == "_Complex"; + } + + static bool isComplexStructOfType(Type t, Type t2) + { + if (!isComplexStruct(t)) + return false; + + TypeStruct ts = t.toBasetype().isTypeStruct(); + + Type memberType = ts.sym.fields[0].type.toBasetype(); + + /* encure the complex member types fall under one of the complex types */ + switch (memberType.toBasetype().ty) + { + case Tfloat32: + case Tfloat64: + case Tfloat80: + break; + default: + return false; + } + + switch (t2.toBasetype().ty) + { + case Tfloat32: + case Tfloat64: + case Tfloat80: + return true; + default: + return false; + } + } + + /* check for complex structure and an associate complex type in a single condexp */ + if (sc && sc.inCfile) + { + if (isComplexStructOfType(t1b, t2b)) + { + return Lret(e1.type.toBasetype()); + } + else if (isComplexStructOfType(t2b, t1b)) + { + return Lret(e2.type.toBasetype()); + } + } + const ty = implicitConvCommonTy(t1b.ty, t2b.ty); if (ty != Terror) { @@ -4242,26 +4341,27 @@ Expression integralPromotions(Expression e, Scope* sc) void fix16997(Scope* sc, UnaExp ue) { if (global.params.fix16997 || sc.inCfile) + { ue.e1 = integralPromotions(ue.e1, sc); // desired C-like behavor - else + return; + } + + switch (ue.e1.type.toBasetype.ty) { - switch (ue.e1.type.toBasetype.ty) - { - case Tint8: - case Tuns8: - case Tint16: - case Tuns16: - //case Tbool: // these operations aren't allowed on bool anyway - case Tchar: - case Twchar: - case Tdchar: - deprecation(ue.loc, "integral promotion not done for `%s`, remove '-revert=intpromote' switch or `%scast(int)(%s)`", - ue.toChars(), EXPtoString(ue.op).ptr, ue.e1.toChars()); - break; + case Tint8: + case Tuns8: + case Tint16: + case Tuns16: + //case Tbool: // these operations aren't allowed on bool anyway + case Tchar: + case Twchar: + case Tdchar: + deprecation(ue.loc, "integral promotion not done for `%s`, remove '-revert=intpromote' switch or `%scast(int)(%s)`", + ue.toChars(), EXPtoString(ue.op).ptr, ue.e1.toChars()); + return; - default: - break; - } + default: + return; } } @@ -4300,7 +4400,7 @@ IntRange getIntRange(Expression e) { IntRange visit(Expression e) { - return IntRange.fromType(e.type); + return intRangeFromType(e.type); } IntRange visitInteger(IntegerExp e) @@ -4404,7 +4504,7 @@ IntRange getIntRange(Expression e) IntRange visitUshr(UshrExp e) { - IntRange ir1 = getIntRange(e.e1).castUnsigned(e.e1.type); + IntRange ir1 = castUnsigned(getIntRange(e.e1), e.e1.type); IntRange ir2 = getIntRange(e.e2); return (ir1 >>> ir2)._cast(e.type); @@ -4428,7 +4528,7 @@ IntRange getIntRange(Expression e) Expression ie; VarDeclaration vd = e.var.isVarDeclaration(); if (vd && vd.range) - return vd.range._cast(e.type); + return _cast(*vd.range, e.type); if (vd && vd._init && !vd.type.isMutable() && (ie = vd.getConstInitializer()) !is null) return getIntRange(ie); return visit(e); @@ -4483,7 +4583,7 @@ IntRange getIntRange(Expression e) * However, the dmd backend does not like a naive cast from a noreturn expression * (particularly an `assert(0)`) so this function generates: * - * `(assert(0), value)` instead of `cast(to)(assert(0))`. + * `(value, assert(0))` instead of `cast(to)(assert(0))`. * * `value` is currently `to.init` however it cannot be read so could be made simpler. * Params: diff --git a/dmd/dclass.d b/dmd/dclass.d index d9661335989..5bf5566dc8b 100644 --- a/dmd/dclass.d +++ b/dmd/dclass.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/class.html, Classes) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dclass.d, _dclass.d) @@ -20,7 +20,6 @@ import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; import dmd.declaration; -import dmd.dscope; import dmd.dsymbol; import dmd.errors; import dmd.func; @@ -30,7 +29,6 @@ import dmd.location; import dmd.mtype; import dmd.objc; import dmd.root.rmem; -import dmd.target; import dmd.visitor; /*********************************************************** @@ -261,19 +259,6 @@ extern (C++) class ClassDeclaration : AggregateDeclaration return cd; } - override Scope* newScope(Scope* sc) - { - auto sc2 = super.newScope(sc); - if (isCOMclass()) - { - /* This enables us to use COM objects under Linux and - * work with things like XPCOM - */ - sc2.linkage = target.systemLinkage(); - } - return sc2; - } - /********************************************* * Determine if 'this' is a base class of cd. * This is used to detect circular inheritance only. @@ -398,13 +383,6 @@ extern (C++) class ClassDeclaration : AggregateDeclaration return "class"; } - /**************************************** - */ - override final void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories) - { - .objc.addSymbols(this, classes, categories); - } - version (IN_LLVM) { /* not needed */ } else { // Back end @@ -446,19 +424,6 @@ extern (C++) final class InterfaceDeclaration : ClassDeclaration return id; } - - override Scope* newScope(Scope* sc) - { - auto sc2 = super.newScope(sc); - if (com) - sc2.linkage = LINK.windows; - else if (classKind == ClassKind.cpp) - sc2.linkage = LINK.cpp; - else if (classKind == ClassKind.objc) - sc2.linkage = LINK.objc; - return sc2; - } - /******************************************* * Determine if 'this' is a base class of cd. * (Actually, if it is an interface supported by cd) diff --git a/dmd/declaration.d b/dmd/declaration.d index 918743237ec..2614290b871 100644 --- a/dmd/declaration.d +++ b/dmd/declaration.d @@ -2,7 +2,7 @@ * Miscellaneous declarations, including typedef, alias, variable declarations including the * implicit this declaration, type tuples, ClassInfo, ModuleInfo and various TypeInfos. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/declaration.d, _declaration.d) @@ -16,11 +16,6 @@ import core.stdc.stdio; import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; -import dmd.ctorflow; -import dmd.dclass; -import dmd.delegatize; -import dmd.dscope; -import dmd.dstruct; import dmd.dsymbol; import dmd.dtemplate; import dmd.errors; @@ -28,7 +23,6 @@ import dmd.errorsink; import dmd.expression; import dmd.func; import dmd.globals; -import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.init; @@ -36,11 +30,9 @@ import dmd.intrange; import dmd.location; import dmd.mtype; import dmd.common.outbuffer; -import dmd.rootobject; import dmd.root.filename; import dmd.target; import dmd.targetcompiler; -import dmd.tokens; import dmd.visitor; @@ -375,7 +367,7 @@ extern (C++) final class AliasDeclaration : Declaration //printf("AliasDeclaration::syntaxCopy()\n"); assert(!s); AliasDeclaration sa = type ? new AliasDeclaration(loc, ident, type.syntaxCopy()) : new AliasDeclaration(loc, ident, aliassym.syntaxCopy(null)); - sa.comment = comment; + sa.addComment(comment); sa.storage_class = storage_class; return sa; } @@ -435,6 +427,8 @@ extern (C++) final class OverDeclaration : Declaration } /*********************************************************** + * Note: dsymbolSemantic turns a VarDeclaration inside a function into + * AssignExp(e1: VarExp, e2: ConstructExp or BlitExp). */ extern (C++) class VarDeclaration : Declaration { @@ -528,7 +522,7 @@ version (IN_LLVM) //printf("VarDeclaration::syntaxCopy(%s)\n", toChars()); assert(!s); auto v = new VarDeclaration(loc, type ? type.syntaxCopy() : null, ident, _init ? _init.syntaxCopy() : null, storage_class); - v.comment = comment; + v.addComment(comment); return v; } @@ -681,9 +675,9 @@ extern (C++) class BitFieldDeclaration : VarDeclaration uint fieldWidth; uint bitOffset; - final extern (D) this(Loc loc, Type type, Identifier ident, Expression width) + final extern (D) this(Loc loc, Type type, Identifier ident, Expression width, Initializer _init = null) { - super(loc, type, ident, null); + super(loc, type, ident, _init); this.dsym = DSYM.bitFieldDeclaration; this.width = width; this.storage_class |= STC.field; @@ -693,8 +687,8 @@ extern (C++) class BitFieldDeclaration : VarDeclaration { //printf("BitFieldDeclaration::syntaxCopy(%s)\n", toChars()); assert(!s); - auto bf = new BitFieldDeclaration(loc, type ? type.syntaxCopy() : null, ident, width.syntaxCopy()); - bf.comment = comment; + auto bf = new BitFieldDeclaration(loc, type ? type.syntaxCopy() : null, ident, width.syntaxCopy(), _init ? _init.syntaxCopy() : null); + bf.addComment(comment); return bf; } @@ -702,32 +696,6 @@ extern (C++) class BitFieldDeclaration : VarDeclaration { v.visit(this); } - - /*********************************** - * Retrieve the .min or .max values. - * Only valid after semantic analysis. - * Params: - * id = Id.min or Id.max - * Returns: - * the min or max value - */ - final ulong getMinMax(Identifier id) - { - const width = fieldWidth; - const uns = type.isUnsigned(); - const min = id == Id.min; - ulong v; - assert(width != 0); // should have been rejected in semantic pass - if (width == ulong.sizeof * 8) - v = uns ? (min ? ulong.min : ulong.max) - : (min ? long.min : long.max); - else - v = uns ? (min ? 0 - : (1L << width) - 1) - : (min ? -(1L << (width - 1)) - : (1L << (width - 1)) - 1); - return v; - } } /*********************************************************** @@ -987,8 +955,8 @@ extern (C++) final class TypeInfoStaticArrayDeclaration : TypeInfoDeclaration extern (C++) final class TypeInfoAssociativeArrayDeclaration : TypeInfoDeclaration { Type entry; // type of TypeInfo_AssociativeArray.Entry!(t.index, t.next) - Dsymbol xopEqual; // implementation of TypeInfo_AssociativeArray.equals - Dsymbol xtoHash; // implementation of TypeInfo_AssociativeArray.getHash + Declaration xopEqual; // implementation of TypeInfo_AssociativeArray.equals + Declaration xtoHash; // implementation of TypeInfo_AssociativeArray.getHash extern (D) this(Type tinfo) { diff --git a/dmd/declaration.h b/dmd/declaration.h index 75333483745..1170f9ff919 100644 --- a/dmd/declaration.h +++ b/dmd/declaration.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -43,6 +43,9 @@ namespace dmd bool isAbstract(ClassDeclaration *cd); bool overloadInsert(Dsymbol *ds, Dsymbol *s); bool equals(const Dsymbol * const ds, const Dsymbol * const s); + bool hasNestedFrameRefs(FuncDeclaration *fd); + bool isVirtualMethod(FuncDeclaration *fd); + bool isVirtual(const FuncDeclaration * const fd); } //enum STC : ulong from astenums.d: @@ -394,8 +397,8 @@ class TypeInfoAssociativeArrayDeclaration final : public TypeInfoDeclaration { public: Type* entry; - Dsymbol* xopEqual; - Dsymbol* xtoHash; + Declaration* xopEqual; + Declaration* xtoHash; static TypeInfoAssociativeArrayDeclaration *create(Type *tinfo); @@ -637,6 +640,8 @@ class FuncDeclaration : public Declaration AttributeViolation* pureViolation; AttributeViolation* nothrowViolation; + void* parametersDFAInfo; + // Formerly FUNCFLAGS uint32_t flags; bool purityInprocess() const; @@ -738,13 +743,9 @@ class FuncDeclaration : public Declaration virtual bool isNested() const; AggregateDeclaration *isThis() override; bool needThis() override final; - bool isVirtualMethod(); - virtual bool isVirtual() const; + bool isVirtual() const { return dmd::isVirtual(this); }; bool isFinalFunc() const; - virtual bool addPreInvariant(); - virtual bool addPostInvariant(); const char *kind() const override; - bool hasNestedFrameRefs(); ParameterList getParameterList(); virtual FuncDeclaration *toAliasFunc() { return this; } @@ -775,9 +776,6 @@ class FuncLiteralDeclaration final : public FuncDeclaration FuncLiteralDeclaration *syntaxCopy(Dsymbol *) override; bool isNested() const override; AggregateDeclaration *isThis() override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; const char *kind() const override; const char *toPrettyChars(bool QualifyTypes = false) override; @@ -791,9 +789,6 @@ class CtorDeclaration final : public FuncDeclaration d_bool isMoveCtor; CtorDeclaration *syntaxCopy(Dsymbol *) override; const char *kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -802,9 +797,6 @@ class PostBlitDeclaration final : public FuncDeclaration { public: PostBlitDeclaration *syntaxCopy(Dsymbol *) override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -814,9 +806,6 @@ class DtorDeclaration final : public FuncDeclaration public: DtorDeclaration *syntaxCopy(Dsymbol *) override; const char *kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -826,9 +815,6 @@ class StaticCtorDeclaration : public FuncDeclaration public: StaticCtorDeclaration *syntaxCopy(Dsymbol *) override; AggregateDeclaration *isThis() override final; - bool isVirtual() const override final; - bool addPreInvariant() override final; - bool addPostInvariant() override final; void accept(Visitor *v) override { v->visit(this); } }; @@ -849,9 +835,6 @@ class StaticDtorDeclaration : public FuncDeclaration StaticDtorDeclaration *syntaxCopy(Dsymbol *) override; AggregateDeclaration *isThis() override final; - bool isVirtual() const override final; - bool addPreInvariant() override final; - bool addPostInvariant() override final; void accept(Visitor *v) override { v->visit(this); } }; @@ -868,9 +851,7 @@ class InvariantDeclaration final : public FuncDeclaration { public: InvariantDeclaration *syntaxCopy(Dsymbol *) override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; + void accept(Visitor *v) override { v->visit(this); } }; @@ -885,9 +866,6 @@ class UnitTestDeclaration final : public FuncDeclaration UnitTestDeclaration *syntaxCopy(Dsymbol *) override; AggregateDeclaration *isThis() override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -897,9 +875,6 @@ class NewDeclaration final : public FuncDeclaration public: NewDeclaration *syntaxCopy(Dsymbol *) override; const char *kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor *v) override { v->visit(this); } }; diff --git a/dmd/delegatize.d b/dmd/delegatize.d index c28af9ba07e..ff44d5895d6 100644 --- a/dmd/delegatize.d +++ b/dmd/delegatize.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/function.html#lazy-params, Lazy Parameters) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/delegatize.d, _delegatize.d) diff --git a/dmd/denum.d b/dmd/denum.d index 09bb138d75e..f34d46d13b5 100644 --- a/dmd/denum.d +++ b/dmd/denum.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/enum.html, Enums) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/denum.d, _denum.d) diff --git a/dmd/deps.d b/dmd/deps.d index 4330ff2d93c..5137a2d5a2e 100644 --- a/dmd/deps.d +++ b/dmd/deps.d @@ -22,7 +22,7 @@ * source/importb.d * --- * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/deps.d, makedeps.d) * Documentation: https://dlang.org/phobos/dmd_deps.html diff --git a/dmd/dfa/entry.d b/dmd/dfa/entry.d new file mode 100644 index 00000000000..d29b9631247 --- /dev/null +++ b/dmd/dfa/entry.d @@ -0,0 +1,188 @@ +/** + * Entry point into Data Flow Analysis engine. + * + * This engine performs a structural analysis of the code to detect + * issues like nullability and truthiness. + * + * Design: + * - Structural Definition Algorithm: It performs a single forward pass + * over the AST (O(1) cost per node), minimizing compilation time. + * - Non-Iterative: Unlike "chaotic iteration" solvers (which can be O(n^2)), + * this engine does not loop until convergence. It tries to limit its visitation of each node to once. + * + * See_Also: + * https://forum.dlang.org/post/xmssfygefvldeiyodfya@forum.dlang.org + * (Why we should not enable a slow DFA by default) + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/entry.d, dfa/entry.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_entry.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/entry.d + */ +module dmd.dfa.entry; +import dmd.common.outbuffer; +import dmd.func; +import dmd.astenums; +import dmd.globals; +import dmd.mangle; +import dmd.dscope; +import dmd.dsymbol; +import core.stdc.stdio; +import core.stdc.string; + +void dfaEntry(FuncDeclaration fd, Scope* sc) +{ + version (none) + { + import core.memory; + + auto before = GC.stats; + + fastDFA(fd, sc); + + auto after = GC.stats; + if (before.allocatedInCurrentThread != after.allocatedInCurrentThread) + printf("edelta %lld\n", after.allocatedInCurrentThread - before + .allocatedInCurrentThread); + } + else + { + fastDFA(fd, sc); + } +} + +private: +/*********************************************************** + * Performs the fast Data Flow Analysis on a function declaration. + * + * This function acts as the coordinator. It: + * 1. Checks if the function needs analysis (skips CTFE-only code). + * 2. Instantiates the components: + * - StatementWalker: Traverses statements (if, while, return). + * - ExpressionWalker: Traverses expressions (a + b, func()). + * - DFAAnalyzer: Tracks the state of variables (The Brain). + * - DFAReporter: Reports errors and handles inferring. + * 3. Wires them together but separates them for separation of concerns reasons. + * 4. Starts the single-pass walk. + * + * Params: + * fd = The function to analyze. + * sc = The scope of the function. + */ +void fastDFA(FuncDeclaration fd, Scope* sc) +{ + import dmd.dfa.fast.structure; + import dmd.dfa.fast.expression; + import dmd.dfa.fast.statement; + import dmd.dfa.fast.analysis; + import dmd.dfa.fast.report; + + if (fd.skipCodegen) + { + // No point running DFA on code that'll never run but has already passed CTFE. + // Takes into account CTFE, typeof, traits compiles, CTFE, and static if/assert. + return; + } + else if (fd.isInstantiated) + { + // If its a template instantiation, + // we'll also check the scopes to see if it known to have a CT only access. + + if (sc.isKnownToHaveACompileTimeContext) + return; + } + + // Use these if statements for debugging specific things. + //if (fd.ident.toString != "checkFloatInit5") return; + //if (!(fd.ident.toString == "replaceReferenceDefinition" || fd.ident.toString == "extractReferences")) return; + //if (fd.loc.linnum != 54) return; + //if (fd.getModule.ident.toString != "start") return; + //if (strcmp(mangleExact(fd), "_D4core9exception15ArraySliceError6__ctorMFNaNbNiNfmmmAyamC6object9ThrowableZCQCyQCwQCp") != 0) return; + + // Protect functions based upon safetiness of it. + // It may be desirable to disable some behaviors in @system code, or completely. + version (none) + { + auto ty = fd.type.isTypeFunction; + assert(ty !is null); + if (ty.trust != TRUST.safe) + return; + } + + DFACommon dfaCommon; + scope StatementWalker stmtWalker = new StatementWalker; + ExpressionWalker expWalker; + DFAAnalyzer analyzer; + DFAReporter reporter; + + dfaCommon.allocator.dfaCommon = &dfaCommon; + + stmtWalker.dfaCommon = &dfaCommon; + expWalker.dfaCommon = &dfaCommon; + analyzer.dfaCommon = &dfaCommon; + reporter.dfaCommon = &dfaCommon; + + stmtWalker.expWalker = &expWalker; + expWalker.stmtWalker = stmtWalker; + + stmtWalker.analyzer = &analyzer; + expWalker.analyzer = &analyzer; + + analyzer.reporter = &reporter; + reporter.errorSink = global.errorSink; + + dfaCommon.printIfStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("============================== %s : %s = %s at ", + fd.getModule.ident.toChars, mangleExact(fd), fd.toFullSignature); + + appendLoc(ob, fd.loc); + ob.writestring("\n"); + }); + + scope (failure) + { + if (!dfaCommon.debugStructure) + { + printf("ICE: ERROR %s : %s = %s at %s\n", fd.getModule.ident.toChars, + mangleExact(fd), fd.toFullSignature, fd.loc.toChars); + fflush(stdout); + } + } + + version (none) + { + printf("function s %s : %s = %s at %s\n", fd.getModule.ident.toChars, + mangleExact(fd), fd.toFullSignature, fd.loc.toChars); + fflush(stdout); + } + + version (none) + { + import dmd.hdrgen; + + OutBuffer buf; + HdrGenState hgs; + hgs.vcg_ast = true; + toCBuffer(fd, buf, hgs); + printf(buf.extractChars); + } + + stmtWalker.start(fd); + + version (none) + { + printf("function e %s : %s = %s at %s\n", fd.getModule.ident.toChars, + mangleExact(fd), fd.toFullSignature, fd.loc.toChars); + fflush(stdout); + } + + dfaCommon.printIfStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("------------------------------ %s : %s = %s at ", + fd.getModule.ident.toChars, mangleExact(fd), fd.toFullSignature); + + appendLoc(ob, fd.loc); + ob.writestring("\n"); + }); +} diff --git a/dmd/dfa/fast/analysis.d b/dmd/dfa/fast/analysis.d new file mode 100644 index 00000000000..efb89cd948b --- /dev/null +++ b/dmd/dfa/fast/analysis.d @@ -0,0 +1,2619 @@ +/** + * Analysis engine for the fast Data Flow Analysis engine. + * + * This module implements the mathematical core of the DFA. + * It is responsible for: + * 1. Transfer Functions: Calculating how specific operations (Assign, Math, Equal) + * transform the abstract state (Lattice) of variables. + * 2. Convergence (Confluence): Merging states from different control flow paths + * (e.g., merging the "True" and "False" branches of an if-statement). + * 3. Loop Approximation: Handling loops in O(1) time by making conservative + * assumptions rather than iterating to a fixed point. + * + * Has the convergence and transfer functions. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/fast/analysis.d, dfa/fast/analysis.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_fast_analysis.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/fast/analysis.d + */ +module dmd.dfa.fast.analysis; +import dmd.dfa.fast.structure; +import dmd.dfa.fast.report; +import dmd.dfa.utils; +import dmd.location; +import dmd.identifier; +import dmd.func; +import dmd.declaration; +import dmd.astenums; +import dmd.mtype; +import dmd.root.array; +import dmd.common.outbuffer; +import core.stdc.stdio; + +//version = DebugJoinMeetOp; + +/*********************************************************** + * The core analyzer that manipulates the Lattice state. + * + * This struct provides the overarching join/meet logic, while the specific + * merge logic is handled in `DFAConsequence`. + * + * It is responsible for: + * - Orchestrating the convergence of scopes (calculating the final state after a block exits). + * - Managing high-level state transfers between the AST walkers and the internal lattice. + */ +struct DFAAnalyzer +{ + DFACommon* dfaCommon; + DFAReporter* reporter; + + DFAScopeVar* convergeExpression(DFALatticeRef lr, bool isSideEffect = false) + { + if (lr.isNull) + return null; + + DFAVar* ctxVar; + DFAConsequence* ctx = lr.getContext(ctxVar); + assert(ctx !is null); + + lr.cleanupConstant(ctxVar); + + version (DebugJoinMeetOp) + { + printf("converge expression for var %p isSideEffect=%d\n", ctxVar, isSideEffect); + lr.printState("after cleanup"); + flush(stdout); + } + + DFAScope* sc = isSideEffect ? dfaCommon.getSideEffectScope() : dfaCommon.currentDFAScope; + DFAScopeVar* ret = sc.getScopeVar(ctxVar); + + while (sc !is null) + { + version (DebugJoinMeetOp) + { + printf("on sc %p\n", sc); + flush(stdout); + } + + DFAScopeVar* scv; + + if (ctx.truthiness == Truthiness.Maybe) + { + scv = sc.getScopeVar(ctxVar); + + if (!ctx.maybeTopSeen && ctxVar !is null && !ctxVar.haveBase) + { + scv.lr = join(scv.lr, lr.copy, 0, null, false, true); + assert(scv.lr.getContextVar() is ctxVar); + } + } + else + { + foreach (c; lr) + { + if (!c.maybeTopSeen && c.var !is null && !c.var.haveBase) + { + scv = sc.getScopeVar(c.var); + + DFAConsequence* oldC = scv.lr.getContext; + assert(oldC !is null); + + oldC.joinConsequence(oldC, c, null, false, false, true); + assert(scv.lr.getContextVar() is c.var); + } + } + } + + sc = sc.child; + } + + return ret; + } + + /*********************************************************** + * Merges the states from the True and False branches of an If statement. + * + * This handles the "Diamond" control flow pattern. + * 1. It compares the state at the end of the "True" block vs the "False" block. + * 2. It identifies "Gates" (variables used in the condition, e.g., `if (ptr)`). + * 3. It calculates the union (Join) of the states to determine the state + * after the If statement completes. + * + * Params: + * condition = The lattice state of the condition expression. + * scrTrue = The final state of the True scope. + * scrFalse = The final state of the False scope. + * haveFalseBody = True if the if-statement has an `else` block. + * unknownBranchTaken = True if the condition result is not statically known (Maybe). + * predicateNegation = State of the predicate negation (0: unknown, 1: negated, 2: not negated). + */ + void convergeStatementIf(DFALatticeRef condition, DFAScopeRef scrTrue, + DFAScopeRef scrFalse, bool haveFalseBody, bool unknownBranchTaken, + int predicateNegation) + { + const lastLoopyLabelDepth = dfaCommon.lastLoopyLabel.depth; + bool bothJumped, bothReturned; + + // False body should never be null. + assert(!scrFalse.isNull); + + version (none) + { + printf("Converging an if statement %d %d, haveFalseBody=%d, unknownBranchTaken=%d, predicateNegation=%d\n", + scrTrue.isNull, scrFalse.isNull, haveFalseBody, + unknownBranchTaken, predicateNegation); + condition.printActual("condition"); + scrTrue.printActual("true"); + scrFalse.printActual("false"); + } + + void protectLoopAgainst(ref DFAScopeRef scr) + { + if (dfaCommon.lastLoopyLabel is null) + return; + + /* + We have whats looks like: + + for(;condition1;) { + if (condition2) { + ??? + } else { + ??? + } + } + + Where either true or false branch could alter a variable outside of itself. + */ + + foreach (contextVar, l, scv; scr) + { + // Ignore any variables declared within the loop + if (contextVar.declaredAtDepth >= lastLoopyLabelDepth) + continue; + + DFAScopeVar* scvParent = dfaCommon.acquireScopeVar(contextVar); + if (scvParent is null) + continue; + + DFAConsequence* c = l.context; + assert(c !is null); + + DFAConsequence* cParent = scvParent.lr.getContext; + assert(cParent !is null); + + if (c.truthiness != cParent.truthiness) + c.truthiness = Truthiness.Unknown; + if (c.nullable != cParent.nullable) + c.nullable = Nullable.Unknown; + if (c.pa != cParent.pa) + c.pa = DFAPAValue.Unknown; + } + } + + /* + Gates look like: + + bool gate; + if(gate) { + ??? + } else { + ??? + } + + Not: + + bool gate1, gate2; + if (gate1 && gate2) { + ??? + } else { + ??? + } + */ + DFAConsequence* gateConsequence = condition.getGateConsequence; + + /* + Given a gate, store any output state of a if statement branch into it. + Ignoring the nature of consequences, and instead look limitedly at the maybe tops. + */ + void storeGateState(ref DFALatticeRef onto, ref DFAScopeRef scr) + { + foreach (contextVar, l; scr) + { + l.walkMaybeTops((DFAConsequence* branchC) { + // Do no change the state of the gate. Causes bugs. + // Stuff like a null checked if statement results in a dereference on null. + + if (gateConsequence.var !is branchC.var + && branchC.var !is null && !branchC.var.haveBase) + { + DFAConsequence* into = onto.findConsequence(branchC.var); + + if (into !is null) + { + if (into.writeOnVarAtThisPoint < branchC.writeOnVarAtThisPoint) + into.meetConsequence(into, branchC); + } + else if ((branchC.var.isTruthy && branchC.truthiness > Truthiness.Maybe) + || (branchC.var.isNullable && branchC.nullable != Nullable.Unknown)) + { + onto.addConsequence(branchC.var, branchC); + } + } + + return true; + }); + } + } + + if (gateConsequence !is null && !gateConsequence.var.haveBase) + { + DFAScopeVar* gateScv = dfaCommon.lastLoopyLabel.getScopeVar(gateConsequence.var); + + if (gateScv !is null) + { + if (gateScv.gatePredicateWriteCount == 0 + || gateScv.gatePredicateWriteCount != gateConsequence.writeOnVarAtThisPoint) + { + gateScv.lrGatePredicate = dfaCommon.makeLatticeRef; + gateScv.lrGateNegatedPredicate = dfaCommon.makeLatticeRef; + gateScv.gatePredicateWriteCount = gateConsequence.writeOnVarAtThisPoint; + } + + if (predicateNegation == 1) + { + storeGateState(gateScv.lrGateNegatedPredicate, scrTrue); + if (haveFalseBody) + storeGateState(gateScv.lrGatePredicate, scrFalse); + } + else if (predicateNegation == 2) + { + storeGateState(gateScv.lrGatePredicate, scrTrue); + if (haveFalseBody) + storeGateState(gateScv.lrGateNegatedPredicate, scrFalse); + } + } + } + + void protectGate() + { + if (gateConsequence is null) + return; + + foreach (contextVar, lTrue, scvTrue; scrTrue) + { + DFAScopeVar* scvParent = dfaCommon.acquireScopeVar(contextVar); + if (scvParent is null) + continue; + + DFAConsequence* cTrue = lTrue.context; + assert(cTrue !is null); + + DFAConsequence* cParent = scvParent.lr.getContext; + assert(cParent !is null); + + DFAScopeVar* scvFalse = scrFalse.findScopeVar(contextVar); + DFAConsequence* cFalse = scvFalse !is null ? scvFalse.lr.getContext : null; + + if (cFalse !is null) + { + // If true and false branches disagree on state, and if either of them are above parent, set as unknown. + + if ((cTrue.truthiness != cFalse.truthiness + && (cTrue.truthiness > cParent.truthiness + || cFalse.truthiness > cParent.truthiness))) + { + cTrue.truthiness = Truthiness.Unknown; + cFalse.truthiness = Truthiness.Unknown; + } + else if (haveFalseBody && cParent.truthiness != Truthiness.Unknown + && (cTrue.truthiness == Truthiness.Unknown + || cFalse.truthiness == Truthiness.Unknown)) + { + } + else if (cTrue.nullable != cFalse.nullable + && (cTrue.nullable > cParent.nullable + || cFalse.nullable > cParent.nullable)) + { + cTrue.nullable = Nullable.Unknown; + cFalse.nullable = Nullable.Unknown; + } + else if (haveFalseBody && cParent.nullable != Nullable.Unknown + && (cTrue.nullable == Nullable.Unknown + || cFalse.nullable == Nullable.Unknown)) + { + } + } + else + { + if (cTrue.truthiness > cParent.truthiness) + cTrue.truthiness = Truthiness.Unknown; + else if (cParent.truthiness != Truthiness.Unknown + && cTrue.truthiness == Truthiness.Unknown) + { + } + + if (cTrue.nullable > cParent.nullable) + cTrue.nullable = Nullable.Unknown; + else if (cParent.nullable != Nullable.Unknown + && cTrue.nullable == Nullable.Unknown) + { + } + } + } + + foreach (contextVar, lFalse, scvFalse; scrFalse) + { + DFAScopeVar* scvParent = dfaCommon.acquireScopeVar(contextVar); + if (scvParent is null) + continue; + + DFAConsequence* cFalse = lFalse.context; + assert(cFalse !is null); + + DFAConsequence* cParent = scvParent.lr.getContext; + assert(cParent !is null); + + if (!scrTrue.isNull && scrTrue.findScopeVar(contextVar) !is null) + continue; // handled already + + if (cFalse.truthiness > cParent.truthiness + || (cParent.truthiness != Truthiness.Unknown + && cFalse.truthiness == Truthiness.Unknown)) + { + contextVar.unmodellable = true; + cFalse.truthiness = Truthiness.Unknown; + } + + if (cFalse.nullable > cParent.nullable + || (cParent.nullable != Nullable.Unknown + && cFalse.nullable == Nullable.Unknown)) + { + contextVar.unmodellable = true; + cFalse.nullable = Nullable.Unknown; + } + } + } + + protectGate; + + /* + We have a true body which means we could be in one of the following cases: + Where ... means user code. + 1. + if (condition) + else { + ??? + } + 2. + if (condition) { + ... + } else { + ... + } + 3. + if (condition) { + ... + } else { + } + */ + + if (scrTrue.isNull) + { + // If the true body is missing, that means it could not have executed. + // Converge the false branch assuming that it will always have executed. + // This covers scenario 1. + + bothJumped = scrFalse.isNull ? false : scrFalse.sc.haveJumped; + bothReturned = scrFalse.isNull ? false : scrFalse.sc.haveReturned; + + protectLoopAgainst(scrFalse); + convergeScope(scrFalse); + } + else if (haveFalseBody) + { + // We have both a true branch and a false branch with user code. + // This is scenario 2, except it isn't the full scenario. + // One of these branches or both may jump. + + /* + a. + if (condition) { + condition + ... + } else { + !condition + ... + } + b. + if (condition) { + condition + ... + jump; + } else { + !condition + ... + } + c. + if (condition) { + condition + ... + } else { + !condition + ... + jump; + } + d. + if (condition) { + condition + ... + jump; + } else { + !condition + ... + jump; + } + */ + + bothJumped = scrTrue.sc.haveJumped && scrFalse.sc.haveJumped; + bothReturned = scrTrue.sc.haveReturned && scrFalse.sc.haveReturned; + + if (scrTrue.sc.haveJumped == scrFalse.sc.haveJumped) + { + // In scenario d we've both jumped, any effects at that time were already copied to the jump point. + // Nothing for us to do in that scenario. + + if (scrTrue.sc.haveJumped) + { + // Both jumped, no state to converge. + } + { + // In scenario a, neither has jumped, any effects at the end of their bodies should be meet'd. + // Then we can converge that into parent scope. + protectGate; + DFAScopeRef meeted = meetScope(scrTrue, scrFalse, true); + assert(!meeted.isNull); + protectLoopAgainst(meeted); + convergeScope(meeted); + } + } + else if (scrTrue.sc.haveJumped) + { + // In scenario b the true branch has jumped, but not the false. + // Any effects seen at the true branch have been already copied to the jump point. + protectLoopAgainst(scrFalse); + convergeScope(scrFalse); + } + else if (scrFalse.sc.haveJumped) + { + // In scenario c, the false branch has jumped, but not the true. + // Any effects seen at the false branch have been already copied to the jump point. + protectLoopAgainst(scrTrue); + convergeScope(scrTrue); + } + else + assert(0); + } + else + { + // In scenario 3. + // We have a true branch with user code, but not a false branch. + // The false branch contains the effects of the negated condition. + + if (scrTrue.sc.haveJumped) + { + /* + The true branch jumped, which means only the false branch matters. + if (condition) { + condition + ... + jumped; + } else { + !condition + } + */ + protectLoopAgainst(scrFalse); + convergeScope(scrFalse); + } + else + { + /* + The false branch will modify the condition by negating it from within it. + We really are not interested in it. + + if (condition) { + condition + ... + } else { + !condition + } + + Consider: + if (var !is null) { + assert(var !is null); + } else { + assert(var is null); + } + Which behavior is correct? That would be the parent. + */ + + protectLoopAgainst(scrTrue); + + // I spent over a month trying to get this to be convergeScope (join instead of meet). ~Rikki + // It is a giant ball of false positives, that cannot be unraveled. + // It may appear to be a great idea to change this, but I can assure you, + // without accepting a false positive or two or three you will not be changing it from this. + // LEAVE THIS ALONE! + convergeStatement(scrTrue, false, true); + } + } + + if (bothJumped) + dfaCommon.currentDFAScope.haveJumped = true; + if (bothReturned) + dfaCommon.currentDFAScope.haveReturned = true; + } + + void applyGateOnBranch(DFAVar* gateVar, int predicateNegation, bool branch) + { + if (gateVar is null || predicateNegation == 0) + return; + + DFAScopeVar* scv = dfaCommon.lastLoopyLabel.findScopeVar(gateVar); + if (scv is null || scv.gatePredicateWriteCount != gateVar.writeCount) + return; + + void handle(ref DFALatticeRef lr) + { + foreach (cGate; lr) + { + if (cGate.writeOnVarAtThisPoint < cGate.var.writeCount) + continue; + + DFAScopeVar* scv2 = dfaCommon.acquireScopeVar(cGate.var); + if (scv2 is null) + continue; + + DFAConsequence* cCurrent = scv2.lr.getContext; + assert(cCurrent !is null); + + cCurrent.joinConsequence(cCurrent, cGate, null, false); + } + } + + if (branch) + { + if (predicateNegation == 1) + handle(scv.lrGateNegatedPredicate); + else + handle(scv.lrGatePredicate); + } + else + { + if (predicateNegation == 1) + handle(scv.lrGatePredicate); + else + handle(scv.lrGateNegatedPredicate); + } + } + /*********************************************************** + * Converges a loop or labelled block. + * + * Fast-DFA Optimization: + * Unlike traditional "Slow DFAs" which iterate a loop until the state settles + * (Fixed Point Iteration), this engine visits the loop body once. + * + * To ensure safety without iteration: + * 1. It checks if variables modified in the loop are used inconsistently. + * 2. If a variable is modified in a way that creates uncertainty (e.g., incrementing), + * it assumes the "Worst Case" (Unknown state) for that variable after the loop. + */ + void convergeStatementLoopyLabels(DFAScopeRef containing, ref Loc loc) + { + const scopeHaveRun = containing.sc.isLoopyLabelKnownToHaveRun; + + /* + A loopy label when scope is known to have ran (once): + + Label: { + ... + if (condition) { + increment; + goto Label; + } + } + + When it isn't known to ran once: + + if (condition) { + Label: { + ... + if (condition) { + increment; + goto Label; + } + } + } + + */ + + DFAScopeRef afterScopeState = containing.sc.afterScopeState; + + loopyLabelBeforeContainingCheck(containing, containing.sc.beforeScopeState, loc); + if (scopeHaveRun) + convergeScope(containing); + else + { + if (containing.sc.haveReturned) + dfaCommon.currentDFAScope.haveReturned = true; + convergeStatement(containing, false, true); + } + + convergeStatement(afterScopeState, false); + } + + void loopyLabelBeforeContainingCheck(ref DFAScopeRef containing, + DFAScopeRef beforeScopeState, ref const(Loc) loc) + { + void checkForNull(DFAScopeVar* assertedVar, DFAConsequence* oldC, DFAConsequence* newC) + { + version (none) + { + printf("check for null on %p\n", assertedVar.var); + printf(" %p %p %d %d %d\n", oldC, newC, assertedVar.derefDepth, + oldC !is null ? oldC.nullable : -1, newC !is null ? newC.nullable : -1); + } + + if (assertedVar.var.var is null || oldC is null || newC is null + || oldC.nullable != Nullable.NonNull + || newC.nullable != Nullable.Null || assertedVar.derefDepth == 0) + return; + + version (none) + { + printf(" next %d %d\n", assertedVar.derefAssertedDepth, assertedVar.derefDepth); + } + + if (assertedVar.derefAssertedDepth > 0 + && assertedVar.derefDepth < assertedVar.derefAssertedDepth) + reporter.onLoopyLabelLessNullThan(assertedVar.var, loc); + else if (assertedVar.derefAssertedDepth == 0) + reporter.onLoopyLabelLessNullThan(assertedVar.var, loc); + } + + void checkForAssignAfterAssert(ref DFAScopeRef toProcessScope, + DFAScopeVar* assertedVar, DFALattice* assertedLattice) + { + if (assertedVar.var is null || assertedVar.var.var is null) + return; + + version (none) + { + printf("checkForAssignAfterAssert %p `%s` %d:%d\n", assertedVar.var, + assertedVar.var.var.toChars, assertedVar.assertDepth, + assertedVar.assignDepth); + } + + DFALatticeRef assertedLatticeRef; + assertedLatticeRef.lattice = assertedLattice; + scope (exit) + assertedLatticeRef.lattice = null; + + foreach (c; assertedLatticeRef) + { + if (c.var is null || c.var.var is null) + continue; + + DFAScopeVar* newSCV = toProcessScope.findScopeVar(c.var); + DFAConsequence* newC; + if (newSCV is null || (newC = newSCV.lr.findConsequence(c.var)) is null) + continue; + + DFAScopeVar* currentSCV = dfaCommon.acquireScopeVar(c.var); + DFAConsequence* currentC; + if (currentSCV is null || (currentC = currentSCV.lr.findConsequence(c.var)) is null) + continue; + + version (none) + { + printf(" %p `%s`\n", c.var, c.var.var.toChars); + printf(" new assert=%d, assign=%d\n", + newSCV.assertDepth, newSCV.assignDepth); + printf(" %d:%d\n", newC.truthiness, newC.nullable); + printf(" current assert=%d, assign=%d \n", + currentSCV.assertDepth, currentSCV.assignDepth); + printf(" %d:%d\n", currentC.truthiness, currentC.nullable); + } + + const truthinessNotEqual = currentC.truthiness != Truthiness.Unknown + && currentC.truthiness != newC.truthiness; + const nullableNotEqual = currentC.nullable != Nullable.Unknown + && currentC.nullable != newC.nullable; + const assertLessThanAssign = assertedVar.assertDepth <= newSCV.assignDepth; + + if (!assertLessThanAssign || !(truthinessNotEqual || nullableNotEqual)) + continue; + else if (nullableNotEqual) + { + // If the nullability is changing, that means its not predictable + newC.nullable = Nullable.Unknown; + newC.truthiness = Truthiness.Unknown; + } + else if (truthinessNotEqual) + { + // If the truthiness is changing, that means its not predictable + newC.truthiness = Truthiness.Unknown; + } + } + } + + void checkForDifferentObjects(DFAConsequence* oldC, DFAConsequence* newC) + { + if (oldC.obj !is newC.obj) + newC.obj = null; + } + + void checkForPA(DFAConsequence* oldC, DFAConsequence* newC) + { + if (oldC.pa != newC.pa) + newC.pa = DFAPAValue.Unknown; + } + + foreach (var, l2; beforeScopeState) + { + DFAScopeVar* oldState = dfaCommon.acquireScopeVar(var); + DFAScopeVar* newState = containing.findScopeVar(var); + if (oldState is null || newState is null) + continue; + + checkForDifferentObjects(oldState.lr.lattice.context, l2.context); + checkForPA(oldState.lr.lattice.context, l2.context); + checkForNull(newState, oldState.lr.lattice.context, l2.context); + checkForAssignAfterAssert(beforeScopeState, newState, l2); + } + + foreach (var, l2, newState; containing) + { + if (var.var is null) + continue; + + DFAScopeVar* oldState = dfaCommon.acquireScopeVar(var); + if (oldState is null || newState is null) + continue; + + checkForDifferentObjects(oldState.lr.lattice.context, l2.context); + checkForPA(oldState.lr.lattice.context, l2.context); + checkForNull(newState, oldState.lr.lattice.context, l2.context); + checkForAssignAfterAssert(containing, newState, l2); + } + } + + void convergeScope(DFAScopeRef scr) + { + if (scr.isNull) + return; + + const jumped = scr.sc.haveJumped, returned = scr.sc.haveReturned; + + DFALatticeRef lr; + DFAScopeVarMergable mergable; + DFAVar* var; + + for (;;) + { + lr = scr.consumeNext(var, mergable); + if (lr.isNull) + break; + + lr.cleanupConstant(var); + + dfaCommon.check; + dfaCommon.acquireScopeVar(var); + + DFAScopeVar* scv = dfaCommon.swapLattice(var, (lattice) { + assert(!lattice.isNull); + lattice.check; + + DFAVar* lrCtx = lr.getContextVar; + assert(lrCtx is var); + assert(!lr.isNull); + lr.check; + return lr; + }); + + if (scv !is null) + scv.mergable.merge(mergable); + dfaCommon.check; + } + + if (jumped) + dfaCommon.currentDFAScope.haveJumped = true; + if (returned) + dfaCommon.currentDFAScope.haveReturned = true; + } + + void convergeStatement(DFAScopeRef scr, bool allBranchesTaken = true, + bool couldScopeNotHaveRan = false, bool ignoreWriteCount = false, + bool unknownAware = false) + { + const depth = dfaCommon.currentDFAScope.depth; + + DFALatticeRef lr; + DFAScopeVarMergable mergable; + DFAVar* var; + + for (;;) + { + dfaCommon.check; + + lr = scr.consumeNext(var, mergable); + if (var is null) + break; + + lr.cleanupConstant(var); + + DFAScopeVar* scv = dfaCommon.swapLattice(var, (lattice) { + assert(!lattice.isNull); + lattice.check; + + DFAVar* lrCtx = lr.getContextVar; + assert(lrCtx is var); + + // make sure it exists in parent + DFALatticeRef lr = allBranchesTaken ? join(lattice, lr, depth, + null, couldScopeNotHaveRan || ignoreWriteCount, unknownAware) : meet(lattice, + lr, depth, couldScopeNotHaveRan); + + assert(!lr.isNull); + lr.check; + return lr; + }); + + if (scv !is null) + scv.mergable.merge(mergable); + dfaCommon.check; + } + } + + void convergeFunctionCallArgument(DFALatticeRef lr, ParameterDFAInfo* paramInfo, + ulong paramStorageClass, FuncDeclaration calling, ref Loc loc) + { + + const isByRef = (paramStorageClass & (STC.ref_ | STC.out_)) != 0; + const couldEscape = (paramStorageClass & STC.scope_) == 0 + || (paramStorageClass & (STC.return_ | STC.returnScope | STC.returnRef)) != 0; + + // A function call argument, may initialize the parameter if its by-ref or if its the this pointer. + this.onRead(lr, loc, paramInfo is null || paramInfo.parameterId == -1 || isByRef, isByRef); + + DFAVar* ctx; + DFAConsequence* cctx = lr.getContext(ctx); + + if (paramInfo !is null && cctx !is null) + { + // ok we have a context variable, check it against paramInfo + if (paramInfo.notNullIn == Fact.Guaranteed && cctx.nullable == Nullable.Null) + reporter.onFunctionCallArgumentLessThan(cctx, paramInfo, calling, loc); + } + + bool seePointer(DFAVar* var) + { + bool handledVar; + + // If the variable can point to something we can model (i.e. symbol offset) to its base variable + // Or if the parameter is by-ref, then we must consider the output state of the parameter. + if (isByRef || var.haveBase) + { + var.walkRoots((root) { + // If the var could be escaped out, forget about reporting on it ever again + // If we had escape analysis we could temporarily disable it, but that isn't implemented. + if (couldEscape) + root.unmodellable = true; + + DFAConsequence* rootCctx = lr.findConsequence(root); + + // Put the state of the var into an unknown state, + // this prevents it from infesting other variables. + DFALatticeRef temp = dfaCommon.makeLatticeRef; + DFAConsequence* newCctx = temp.setContext(root); + + if (isByRef && root.isNullable && (cctx.nullable != Nullable.Null + || paramInfo is null || paramInfo.notNullOut != Fact.NotGuaranteed)) + { + // Object could've changed. + newCctx.obj = dfaCommon.makeObject(rootCctx !is null ? rootCctx.obj : null); + } + + seeWrite(root, temp); + this.convergeExpression(temp, true); + + // now its all set to unknown + + if (root !is var) + { + if (rootCctx !is null) + rootCctx.maybeTopSeen = true; + } + else + handledVar = true; + }); + } + + return handledVar; + } + + void seeObject(DFAObject* obj) + { + obj.walkRoots((DFAObject* root) { + if (root.storageFor !is null) + { + DFAScope* sideEffectScope = dfaCommon.getSideEffectScope(); + DFAScopeVar* scv = sideEffectScope.getScopeVar(root.storageFor); + seeWrite(root.storageFor, scv.lr); + } + }); + } + + if (ctx is null) + { + lr.walkMaybeTops((c) { + if (c.var is null) + return true; + + seePointer(c.var); + if (c.obj !is null) + seeObject(c.obj); + return true; + }); + } + else + { + if (seePointer(ctx)) + cctx.maybeTopSeen = true; + if (cctx !is null && cctx.obj !is null) + seeObject(cctx.obj); + } + + this.convergeExpression(lr, true); + } + + void transferAssert(DFALatticeRef lr, ref Loc loc, bool ignoreWriteCount, + bool dueToConditional = false) + { + if (lr.isNull) + return; + onRead(lr, loc); + + const currentDepth = dfaCommon.currentDFAScope.depth; + bool modellable = true; + + lr.walkMaybeTops((DFAConsequence* c) { + if (c.var is null) + return true; + else if (!c.var.isModellable) + { + modellable = false; + return false; + } + + if (c.var.isLength) + { + DFAConsequence* bCctx = lr.addConsequence(c.var.base1); + bCctx.pa = c.pa; + + if ((c.pa.kind == DFAPAValue.Kind.Concrete + || c.pa.kind == DFAPAValue.Kind.Lower) && c.pa.value > 0) + { + bCctx.truthiness = Truthiness.True; + bCctx.nullable = Nullable.NonNull; + } + } + + return true; + }); + + void handle(DFAConsequence* c) + { + if (c.var is null || c.var.haveBase) + return; + DFAScopeVar* scv = dfaCommon.acquireScopeVar(c.var); + c.var.assertedCount++; + + version (none) + { + printf("asserting %d %p %d:%d %d:%d\n", ignoreWriteCount, c.var, c.var.writeCount, + c.writeOnVarAtThisPoint, currentDepth, c.var.declaredAtDepth); + printf(" %d && %d\n", !ignoreWriteCount, + c.var.writeCount > c.writeOnVarAtThisPoint); + printf(" %d <\n", currentDepth < c.var.declaredAtDepth); + printf(" write on var %d vs %d\n", c.var.writeCount, c.writeOnVarAtThisPoint); + } + + if (currentDepth < c.var.declaredAtDepth || (!ignoreWriteCount + && c.var.writeCount > c.writeOnVarAtThisPoint)) + return; + + if ((scv = dfaCommon.lastLoopyLabel.findScopeVar(c.var)) !is null) + { + if (c.nullable == Nullable.NonNull && (scv.derefAssertedDepth == 0 + || scv.derefAssertedDepth > currentDepth)) + { + scv.derefAssertedDepth = currentDepth; + } + } + + dfaCommon.swapLattice(c.var, (lattice) { + DFAConsequence* old = lattice.addConsequence(c.var); + + version (none) + { + printf("swapping %p %d:%d and %d:%d\n", c.var, + old.truthiness, old.nullable, c.truthiness, c.nullable); + } + + old.joinConsequence(old, c, null, false, ignoreWriteCount, false); + + version (none) + { + printf(" %d:%d\n", old.truthiness, old.nullable); + } + + return lattice; + }); + } + + // We want the constant context if it exists, to handle equality. + if (DFAConsequence* cctx = lr.getContext) + { + if (modellable && !dueToConditional && cctx.truthiness == Truthiness.False + && loc.isValid) + { + bool disable; + + /* + Supports: + if (gate) + assert(!gate); + and + if (!gate) + assert(gate); + We also have to consider if its the same value based upon write count. + Note: we don't care what the truthiness value actually is for the gate consequence, + we're interested in its inversion status. + However we don't need the actual predicate integer (see ExpressionWalker.walkCondition). + The flag in the consequence is enough, as !!gate should set the lr to unknown not false. + */ + + if (DFAConsequence* gateCctx = lr.getGateConsequence) + { + if (DFAScopeVar* gateSCV = dfaCommon.lastLoopyLabel.findScopeVar(gateCctx.var)) + { + version (none) + { + printf("gate for %p, %d != %d - %d\n", gateCctx.var, gateSCV.gatePredicateWriteCount, + gateCctx.writeOnVarAtThisPoint, + cast(int)(gateCctx.var.param !is null)); + + printf(" %d %d %d %d\n", gateCctx.invertedOnce, + gateSCV.assertTrueDepth, gateSCV.assertFalseDepth, currentDepth); + } + + if (gateSCV.gatePredicateWriteCount != gateCctx.writeOnVarAtThisPoint - cast( + int)(gateCctx.var.param !is null)) + { + } + else if (!gateCctx.invertedOnce) + { + disable = gateSCV.assertTrueDepth != 0 + && gateSCV.assertTrueDepth > gateSCV.assertFalseDepth; + } + else + disable = gateSCV.assertFalseDepth <= currentDepth; + } + } + + if (!disable) + reporter.onAssertIsFalse(lr, loc); + } + } + + // We want the gate consequence, not the constant context. + // Not interested in an equality. It is about any variable state. + // Update the depths, to give future asserts information needed. + if (DFAConsequence* gateCctx = lr.getGateConsequence) + { + if (DFAScopeVar* gateSCV = dfaCommon.lastLoopyLabel.getScopeVar(gateCctx.var)) + { + version (none) + { + printf("gate store %p, %d %d %d\n", gateCctx.var, + gateSCV.assignDepth, gateSCV.assertDepth, currentDepth); + printf(" %d %d %d\n", gateCctx.truthiness, + gateSCV.assertTrueDepth, gateSCV.assertFalseDepth); + } + + if (gateSCV.assignDepth == 0 || gateSCV.assertDepth > currentDepth) + { + gateSCV.assertDepth = currentDepth; + + /* + Set the depth of assert when not unknown to true/false values. + This should not be normalized onto the actual state of the variable, + but the resulting expression value. + + Given: + if (gate) + assert(!gate); + Regardless of gate being known as true/maybe/false, + this will allow us to do a primitivate variation of VRP and effectively make the argument false. + */ + if (gateCctx.truthiness == Truthiness.False + && (gateSCV.assertFalseDepth == 0 + || gateSCV.assertFalseDepth > currentDepth)) + gateSCV.assertFalseDepth = currentDepth; + else if (gateCctx.truthiness >= Truthiness.Maybe + && (gateSCV.assertTrueDepth == 0 + || gateSCV.assertTrueDepth > currentDepth)) + { + gateSCV.assertTrueDepth = currentDepth; + gateSCV.assertFalseDepth = 0; + } + } + } + } + + foreach (c; lr) + { + handle(c); + } + } + + /*********************************************************** + * Updates the state of a variable after an assignment (`a = b`). + * + * This moves the state from the RHS (Right Hand Side) lattice to the + * LHS (Left Hand Side) variable. + * + * Logic: + * - Direct Assignment: `a = 5` (a becomes 5). + * - Pointer Assignment: `*p = 5` (We don't change `p`, we assume memory at `p` changed). + * - Construct: `int a = 5` (Initialization). + */ + DFALatticeRef transferAssign(DFALatticeRef assignTo, bool construct, bool isBlit, + DFALatticeRef lr, int alteredState, ref Loc loc, + DFALatticeRef indexLR = DFALatticeRef.init) + { + + DFAVar* assignToCtx = assignTo.getContextVar; + DFAVar* lrCtx; + DFAConsequence* lrCctx = lr.getContext(lrCtx); + const noLR = lrCctx is null; + const lrIsTruthy = !noLR ? lrCctx.truthiness == Truthiness.True : false; + const unmodellable = lrCtx !is null && !lrCtx.isModellable; + DFALatticeRef ret; + + this.onRead(assignTo, loc, true); + // Explicitly allow returns of uninitialized variables. + this.onRead(lr, loc, assignToCtx !is null && assignToCtx is dfaCommon.getReturnVariable); + + if (assignToCtx !is null) + { + // *var = expr; + // is very different from: + // var = expr; + + bool wasDereferenced; + + assignToCtx.visitIfReferenceToAnotherVar((contextVar) { + wasDereferenced = true; + + // This is a dereference: *contextVar = expr; + // Which means the effects of lr don't really apply to the lhs. + + if (contextVar.isTruthy || contextVar.isNullable) + { + // The only thing we know for 100% certainty is that contextVar at this point is going to be non-null. + + DFALatticeRef temp = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = temp.addConsequence(contextVar); + temp.setContext(cctx); + + if (contextVar.isTruthy) + cctx.truthiness = Truthiness.True; + if (contextVar.isNullable) + cctx.nullable = Nullable.NonNull; + + ret = join(ret, temp, 0, null); + } + }); + + if (!wasDereferenced) + { + // We're in a direct assignment + // Any effects from the lr directly apply to our lhs variable. + + ret = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = ret.addConsequence(assignToCtx, lrCctx); + ret.setContext(cctx); + + if (!construct && noLR) + assignToCtx.unmodellable = true; + } + } + else + { + ret = join(assignTo, lr.copyWithoutInfiniteLifetime, 0, null); + DFAConsequence* c = ret.addConsequence(null); + ret.setContext(c); + + if (lrCtx !is null && lrCtx.haveInfiniteLifetime) + { + c.truthiness = Truthiness.True; + c.nullable = Nullable.NonNull; + } + + if (construct && isBlit) + { + if (noLR) + { + c.truthiness = Truthiness.False; + c.nullable = Nullable.Unknown; + } + } + } + + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + if (!indexLR.isNull) + ret = this.transferLogicalAnd(ret, indexLR); + DFAConsequence* retCctx = ret.addConsequence(assignToCtx); + ret.setContext(retCctx); + + if (alteredState == 1) + { + // True + retCctx.truthiness = Truthiness.True; + } + else if (alteredState == 2) + { + // NonNull + retCctx.nullable = Nullable.NonNull; + } + else if (alteredState == 3) + { + // True & NonNull + retCctx.truthiness = Truthiness.True; + retCctx.nullable = Nullable.NonNull; + } + else if (alteredState == 4) + { + // False & Null + retCctx.truthiness = Truthiness.False; + retCctx.nullable = Nullable.Null; + } + else if (alteredState == 5) + { + retCctx.truthiness = Truthiness.Unknown; + retCctx.nullable = Nullable.Unknown; + } + + if (lrIsTruthy && assignToCtx !is null && assignToCtx.isNullable) + retCctx.nullable = Nullable.NonNull; + + if (retCctx.truthiness == Truthiness.Maybe) + retCctx.truthiness = Truthiness.Unknown; + + if (assignToCtx !is null) + { + bool exactlyOneRoot; + + assignToCtx.visitIfReadOfReferenceToAnotherVar((root) { + DFAConsequence* c = assignTo.findConsequence(root); + + if (c !is null && c.obj !is null) + { + DFAVar* firstRoot; + int rootCount; + + c.obj.walkRoots((objRoot) { + if (objRoot.storageFor !is null && !objRoot.storageFor.haveBase) + { + if (firstRoot !is null) + { + objRoot.storageFor.unmodellable = true; + DFAConsequence* cUnk = ret.addConsequence(objRoot.storageFor); + cUnk.truthiness = Truthiness.Unknown; + cUnk.nullable = Nullable.Unknown; + } + else + firstRoot = objRoot.storageFor; + + rootCount++; + } + }); + + if (rootCount == 1) + { + exactlyOneRoot = true; + this.seeWrite(firstRoot, ret); + + DFAConsequence* c2 = ret.addConsequence(firstRoot); + c2.truthiness = retCctx.truthiness; + c2.nullable = retCctx.nullable; + c2.pa = retCctx.pa; + } + else if (rootCount > 1) + { + firstRoot.unmodellable = true; + DFAConsequence* cUnk = ret.addConsequence(firstRoot); + cUnk.truthiness = Truthiness.Unknown; + cUnk.nullable = Nullable.Unknown; + } + } + }); + + if ((!assignToCtx.haveBase && assignToCtx.var is null) + || (assignToCtx.haveBase && !exactlyOneRoot)) + { + if (lrCctx !is null && lrCctx.obj !is null) + { + lrCctx.obj.walkRoots((objRoot) { + if (objRoot.storageFor !is null && !objRoot.storageFor.haveBase) + { + objRoot.storageFor.unmodellable = true; + DFAConsequence* cUnk = ret.addConsequence(objRoot.storageFor); + cUnk.truthiness = Truthiness.Unknown; + cUnk.nullable = Nullable.Unknown; + } + }); + } + } + + seeWrite(assignToCtx, ret); + + ret.setContext(assignToCtx); + DFAScopeVar* scv = this.convergeExpression(ret.copy, true); + assert(scv !is null); + + if (assignToCtx.isNullable && retCctx.nullable == Nullable.Null) + { + scv.mergable.nullAssignWriteCount = assignToCtx.writeCount; + scv.mergable.nullAssignAssertedCount = assignToCtx.assertedCount; + } + + if (unmodellable) + assignToCtx.unmodellable = true; + } + + return ret; + } + + DFALatticeRef transferNegate(DFALatticeRef lr, Type type, + bool protectElseNegate = false, bool limitToContext = false) + { + bool requireMaybeContext; + + bool negate(DFAConsequence* c) + { + c.pa.negate(type); + + if (c.invertedOnce || (protectElseNegate && c.protectElseNegate)) + { + c.truthiness = Truthiness.Unknown; + c.nullable = Nullable.Unknown; + } + else if (c.var !is null && c.var.haveInfiniteLifetime) + { + // nothing can invert this + } + else + { + c.invertedOnce = true; + + if (c.var !is null && c.var.isBoolean) + { + /* + Handle the case where: + assert(!condition); + + You don't want the condition variable to effect the output lattice truthiness, + but you do want the variable to alter. + */ + requireMaybeContext = c.truthiness <= Truthiness.Maybe; + c.truthiness = c.truthiness == Truthiness.False + ? Truthiness.True : Truthiness.False; + } + else if (c.truthiness > Truthiness.Maybe) + { + c.truthiness = c.truthiness == Truthiness.True + ? Truthiness.Unknown : Truthiness.True; + } + + if (c.nullable != Nullable.Unknown) + c.nullable = c.nullable == Nullable.NonNull ? Nullable.Unknown + : Nullable.NonNull; + } + + return true; + } + + if (auto cctx = lr.getContext) + { + // !(a && b) only negate the outer expression + // !(a) want to negate the inner condition + if (cctx.var is null || limitToContext) + negate(cctx); + else + lr.walkMaybeTops(&negate); + + if (requireMaybeContext) + { + DFAConsequence* newCctx = lr.acquireConstantAsContext(Truthiness.Maybe, + Nullable.Unknown, null); + // Don't forget to patch the maybe's, impacts asserts. + newCctx.maybe = cctx.var; + } + } + + return lr; + } + + DFALatticeRef transferMathOp(DFALatticeRef lhs, DFALatticeRef rhs, Type type, PAMathOp op) + { + DFAConsequence* lhsCctx = lhs.getContext; + DFAConsequence* rhsCctx = rhs.getContext; + + assert(lhsCctx !is null); + assert(rhsCctx !is null); + + if (lhsCctx.obj !is null) + lhsCctx.obj.mayNotBeExactPointer = true; + if (rhsCctx.obj !is null) + rhsCctx.obj.mayNotBeExactPointer = true; + + DFAPAValue newValue = lhsCctx.pa; + final switch (op) + { + case PAMathOp.add: + newValue.addFrom(rhsCctx.pa, type); + break; + case PAMathOp.sub: + newValue.subtractFrom(rhsCctx.pa, type); + break; + case PAMathOp.mul: + newValue.multiplyFrom(rhsCctx.pa, type); + break; + case PAMathOp.div: + newValue.divideFrom(rhsCctx.pa, type); + break; + case PAMathOp.mod: + newValue.modulasFrom(rhsCctx.pa, type); + break; + case PAMathOp.and: + newValue.bitwiseAndBy(rhsCctx.pa, type); + break; + case PAMathOp.or: + newValue.bitwiseOrBy(rhsCctx.pa, type); + break; + case PAMathOp.xor: + newValue.bitwiseXorBy(rhsCctx.pa, type); + break; + case PAMathOp.pow: + newValue.powerBy(rhsCctx.pa, type); + break; + case PAMathOp.leftShift: + newValue.leftShiftBy(rhsCctx.pa, type); + break; + case PAMathOp.rightShiftSigned: + newValue.rightShiftSignedBy(rhsCctx.pa, type); + break; + case PAMathOp.rightShiftUnsigned: + newValue.rightShiftUnsignedBy(rhsCctx.pa, type); + break; + + case PAMathOp.postInc: + case PAMathOp.postDec: + assert(0); + } + + DFALatticeRef ret = transferLogicalAnd(lhs, rhs); + ret.check; + + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = ret.acquireConstantAsContext(); + cctx.pa = newValue; + + ret.check; + return ret; + } + + DFALatticeRef transferDereference(DFALatticeRef lr, ref Loc loc) + { + DFAConsequence* ctx = lr.getContext; + bool couldBeNull; + + if (ctx !is null) + { + DFAVar* var = ctx.var; + + if (var !is null) + { + DFAScopeVar* scv; + + if ((scv = dfaCommon.lastLoopyLabel.findScopeVar(var)) !is null) + { + if (scv.derefDepth == 0 || scv.derefDepth > dfaCommon.currentDFAScope.depth) + scv.derefDepth = dfaCommon.currentDFAScope.depth; + } + + if ((scv = dfaCommon.currentDFAScope.findScopeVar(var)) !is null) + { + if (var.writeCount > 0 && scv.mergable.nullAssignAssertedCount == var.assertedCount + && scv.mergable.nullAssignWriteCount == var.writeCount + && var.var !is null) + couldBeNull = true; + } + + var = dfaCommon.findDereferenceVar(var); + lr.setContext(var); + } + + if (ctx.nullable == Nullable.Unknown) + { + // Infer input nullability + + if (couldBeNull) + reporter.onDereference(ctx, loc); + else if (ctx.var !is null && ctx.var.param !is null + && !ctx.var.param.specifiedByUser && !dfaCommon.currentDFAScope.inConditional + && ctx.writeOnVarAtThisPoint == 1 && ctx.var.assertedCount == 0) + { + if (dfaCommon.debugIt) + printf("Infer variable as non-null `%s` at %s\n", + ctx.var.var.ident.toChars, loc.toChars); + + ctx.nullable = Nullable.NonNull; + if (!ctx.var.doNotInferNonNull) + ctx.var.param.notNullIn = ParameterDFAInfo.Fact.Guaranteed; + } + } + else if (ctx.nullable == Nullable.Null) + reporter.onDereference(ctx, loc); + } + + return lr; + } + + /// See_Also: equalityArgTypes + DFALatticeRef transferEqual(DFALatticeRef lhs, DFALatticeRef rhs, + bool equalityIsTrue, EqualityArgType equalityType, bool isIdentity) + { + // struct + // floating point + // lhs && rhs static or dynamic array + // cpu op + + DFAConsequence* lhsCctx = lhs.getContext, rhsCctx = rhs.getContext; + if (lhsCctx is null || rhsCctx is null) + return DFALatticeRef.init; + + DFAVar* lhsVar = lhsCctx.var, rhsVar = rhsCctx.var; + Truthiness expectedTruthiness; + + bool couldBeUnknown; + + checkPAVar(lhsVar, couldBeUnknown); + checkPAVar(rhsVar, couldBeUnknown); + + const treatAsInteger = equalityType == EqualityArgType.Unknown; + const treatAsPointer = equalityType == EqualityArgType.DynamicArray + || equalityType == EqualityArgType.AssociativeArray + || equalityType == EqualityArgType.Nullable; + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Transfer equal treatAsInteger=%d, treatAsPointer=%d, couldBeUnknown=%d", + treatAsInteger, treatAsPointer, couldBeUnknown); + ob.writestring("\n"); + + prefix(""); + ob.printf("lhs cctx %p, lhs var %p, rhs cctx %p, rhs var %p", + lhsCctx, lhsVar, rhsCctx, rhsVar); + ob.writestring("\n"); + }); + + if ((lhsVar is null || lhsVar.isModellable) && (rhsVar is null || rhsVar.isModellable)) + { + expectedTruthiness = Truthiness.Maybe; + + if (equalityIsTrue) + { + if (treatAsPointer) + { + if (lhsCctx.nullable == Nullable.NonNull && rhsCctx.nullable == Nullable.NonNull + && lhsCctx.obj !is null && lhsCctx.obj is rhsCctx.obj + && !lhsCctx.obj.mayNotBeExactPointer) + expectedTruthiness = isIdentity ? Truthiness.True : Truthiness.Maybe; + else if (lhsCctx.nullable == Nullable.Null + && lhsCctx.nullable == rhsCctx.nullable) + expectedTruthiness = Truthiness.True; + else if (lhsCctx.truthiness == Truthiness.False + && lhsCctx.truthiness == rhsCctx.truthiness) + expectedTruthiness = Truthiness.True; + else if (lhsCctx.truthiness != rhsCctx.truthiness && (lhsCctx.truthiness == Truthiness.False + || rhsCctx.truthiness == Truthiness.False) + && (lhsCctx.truthiness == Truthiness.True + || rhsCctx.truthiness == Truthiness.True)) + expectedTruthiness = Truthiness.False; + } + else + { + expectedTruthiness = lhsCctx.pa.compareEqual(rhsCctx.pa); + + if (expectedTruthiness < Truthiness.False) + { + if (lhsCctx.truthiness == Truthiness.False + && lhsCctx.truthiness == rhsCctx.truthiness) + expectedTruthiness = Truthiness.True; + else if (!treatAsInteger && lhsCctx.truthiness != rhsCctx.truthiness + && (lhsCctx.truthiness == Truthiness.False + || rhsCctx.truthiness == Truthiness.False) + && (lhsCctx.truthiness == Truthiness.True + || rhsCctx.truthiness == Truthiness.True)) + expectedTruthiness = Truthiness.False; + else + expectedTruthiness = Truthiness.Maybe; + } + else if (couldBeUnknown || !treatAsInteger) + expectedTruthiness = Truthiness.Maybe; + } + } + else + { + if (treatAsPointer) + { + if ((lhsCctx.nullable == Nullable.NonNull + || rhsCctx.nullable == Nullable.NonNull) + && lhsCctx.nullable != rhsCctx.nullable) + expectedTruthiness = Truthiness.True; + else if (lhsCctx.nullable == Nullable.NonNull + && lhsCctx.nullable == rhsCctx.nullable) + { + if (lhsCctx.obj !is null && lhsCctx.obj is rhsCctx.obj + && !lhsCctx.obj.mayNotBeExactPointer) + expectedTruthiness = isIdentity ? Truthiness.False : Truthiness.Maybe; + else + expectedTruthiness = Truthiness.Maybe; + } + else if (lhsCctx.nullable == Nullable.Null + && lhsCctx.nullable == rhsCctx.nullable) + expectedTruthiness = Truthiness.False; + } + else + { + expectedTruthiness = lhsCctx.pa.compareNotEqual(rhsCctx.pa); + + if (expectedTruthiness >= Truthiness.False) + { + if (couldBeUnknown || !treatAsInteger) + expectedTruthiness = Truthiness.Maybe; + } + else + expectedTruthiness = Truthiness.Maybe; + } + } + } + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Expected truthiness of equality %d", expectedTruthiness); + ob.writestring("\n"); + }); + + if (expectedTruthiness == Truthiness.Maybe) + { + // Copy over the effects from a constant to non-constant with variable. + // Allows for a == non-null to make a non-null. + DFAConsequence* toEffectCctx, fromEffectCctx; + + if (lhsVar is null) + { + fromEffectCctx = lhsCctx; + toEffectCctx = rhsCctx; + } + else if (rhsVar is null) + { + toEffectCctx = lhsCctx; + fromEffectCctx = rhsCctx; + } + + if (toEffectCctx !is null && toEffectCctx.var !is null) + { + const copy = (toEffectCctx.var.isTruthy + && toEffectCctx.truthiness == Truthiness.Unknown) + || (toEffectCctx.var.isNullable && toEffectCctx.nullable == Nullable.Unknown); + + if (copy) + { + if (equalityIsTrue) + { + if (toEffectCctx.var.isTruthy) + toEffectCctx.truthiness = fromEffectCctx.truthiness; + if (toEffectCctx.var.isNullable) + toEffectCctx.nullable = fromEffectCctx.nullable; + } + else + { + if (toEffectCctx.var.isTruthy) + toEffectCctx.truthiness = fromEffectCctx.truthiness == Truthiness.True ? Truthiness.False + : (fromEffectCctx.truthiness == Truthiness.False + ? Truthiness.True : Truthiness.Unknown); + if (toEffectCctx.var.isNullable) + toEffectCctx.nullable = fromEffectCctx.nullable == Nullable.NonNull ? Nullable.Null + : (fromEffectCctx.nullable == Nullable.Null + ? Nullable.NonNull : Nullable.Unknown); + } + } + } + } + + const expectedInvertedOnce = lhsCctx.invertedOnce || rhsCctx.invertedOnce; + DFALatticeRef ret = transferLogicalAnd(lhs, rhs); + + { + DFAConsequence* c = ret.acquireConstantAsContext(expectedTruthiness, + Nullable.Unknown, null); + c.invertedOnce = expectedInvertedOnce; + + if (DFAConsequence* c2 = ret.findConsequence(rhsVar)) + { + c.maybe = rhsVar; + c2.maybe = lhsVar; + } + else + c.maybe = lhsVar; + } + + if (treatAsPointer) + { + if (equalityIsTrue) + { + // var is !null -> var non-null + // !null is var -> var non-null + + // if lhs or rhs is constant + // if lhs or rhs is non-constant && lhs or rhs !is null + // upgrade the non-constant to !is null + + if (lhsVar is null && rhsVar !is null && lhsCctx.nullable == Nullable.Null) + { + if (rhsCctx.nullable == Nullable.NonNull) + rhsCctx.nullable = Nullable.NonNull; + } + else if (lhsVar !is null && rhsVar is null && rhsCctx.nullable == Nullable.Null) + { + if (lhsCctx.nullable == Nullable.NonNull) + lhsCctx.nullable = Nullable.NonNull; + } + + ret.walkMaybeTops((c) => c.protectElseNegate = true); + } + else + { + // var !is null -> var non-null + // null !is var -> var non-null + + // if lhs or rhs is constant + // if lhs or rhs is non-constant && lhs or rhs is null + // upgrade the non-constant to !is null + + if (lhsVar is null && rhsVar !is null && lhsCctx.nullable == Nullable.Null) + { + if (rhsCctx.nullable == Nullable.Null) + rhsCctx.nullable = Nullable.NonNull; + } + else if (lhsVar !is null && rhsVar is null && rhsCctx.nullable == Nullable.Null) + { + if (lhsCctx.nullable == Nullable.Null) + lhsCctx.nullable = Nullable.NonNull; + } + } + } + + if (equalityIsTrue) + ret.walkMaybeTops((c) => c.protectElseNegate = true); + else + ret.walkMaybeTops((c) => c.invertedOnce = true); + + return ret; + } + + DFALatticeRef transferGreaterThan(bool orEqualTo, DFALatticeRef lhs, DFALatticeRef rhs) + { + DFAVar* lhsVar, rhsVar; + DFAConsequence* lhsCctx = lhs.getContext(lhsVar); + DFAConsequence* rhsCctx = rhs.getContext(rhsVar); + + assert(lhsCctx !is null); + assert(rhsCctx !is null); + + bool couldBeUnknown; + checkPAVar(lhsCctx.var, couldBeUnknown); + checkPAVar(rhsCctx.var, couldBeUnknown); + + Truthiness expectedTruthiness; + + if ((lhsVar is null || lhsVar.isModellable) && (rhsVar is null || rhsVar.isModellable)) + { + expectedTruthiness = orEqualTo ? lhsCctx.pa.greaterThanOrEqual( + rhsCctx.pa) : lhsCctx.pa.greaterThan(rhsCctx.pa); + + if (couldBeUnknown) + expectedTruthiness = Truthiness.Maybe; + + if (lhsVar !is null) + { + if (rhsCctx.pa.kind == DFAPAValue.Kind.Concrete + && (rhsCctx.pa.value > 0 || (!orEqualTo && rhsCctx.pa.value == 0))) + { + // ok clearly non-null + + if (lhsVar.isTruthy) + lhsCctx.truthiness = Truthiness.True; + if (lhsVar.isNullable) + lhsCctx.nullable = Nullable.NonNull; + } + + lhsVar.walkRoots((var) { + if (var is lhsVar) + return; + + DFAConsequence* cctx = lhs.findConsequence(var); + if (cctx is null) + return; + + cctx.truthiness = lhsCctx.truthiness; + cctx.nullable = lhsCctx.nullable; + cctx.pa = lhsCctx.pa; + }); + } + + if (rhsVar !is null) + { + rhsVar.walkRoots((var) { var.doNotInferNonNull = true; }); + } + } + + DFALatticeRef ret = this.transferLogicalAnd(lhs, rhs); + ret.acquireConstantAsContext(expectedTruthiness, Nullable.Unknown, null); + return ret; + } + + void transferGoto(DFAScope* toSc, bool isAfter) + { + DFAScopeRef temp = dfaCommon.currentDFAScope.copy; + + if (isAfter) + { + if (!toSc.afterScopeState.isNull) + temp = joinScope(toSc.afterScopeState, temp); + } + else + { + if (!toSc.beforeScopeState.isNull) + temp = joinScope(toSc.beforeScopeState, temp); + } + + toSc.beforeScopeState = temp; + } + + void transferForwardsGoto(Identifier ident) + { + DFAScopeRef temp = dfaCommon.currentDFAScope.copy; + + dfaCommon.swapForwardLabelScope(ident, (old) { + if (old.isNull) + return temp; + return joinScope(old, temp); + }); + } + + DFALatticeRef transferLogicalAnd(DFALatticeRef lhs, DFALatticeRef rhs) + { + DFAConsequence* cctxLHS = lhs.getContext; + DFAConsequence* cctxRHS = rhs.getContext; + const lhsCctxMaybe = cctxLHS !is null && cctxLHS.truthiness == Truthiness.Maybe; + + if (lhsCctxMaybe) + cctxLHS.truthiness = Truthiness.True; + + /* + We have two trees that look like: + constant + / \ + leaf leaf + + And need to recombine them into this form, where the constants are discarded from the origin. + */ + + DFALatticeRef ret = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = ret.acquireConstantAsContext; + ret.check; + + DFAVar* firstMaybe; + DFAVar** lastMaybe = &firstMaybe; + + lhs.walkMaybeTops((DFAConsequence* oldC) { + if (oldC.var is null) + return true; + + DFAConsequence* newC = ret.addConsequence(oldC.var, oldC); + + *lastMaybe = newC.var; + lastMaybe = &newC.maybe; + + ret.check; + return true; + }); + + rhs.walkMaybeTops((DFAConsequence* oldC) { + if (oldC.var is null) + return true; + + DFAConsequence* result = ret.findConsequence(oldC.var); + + if (result is null) + { + DFAConsequence* newC = ret.addConsequence(oldC.var, oldC); + + *lastMaybe = newC.var; + lastMaybe = &newC.maybe; + } + else + result.joinConsequence(result, oldC, null, false, false, true); + + ret.check; + return true; + }); + + foreach (oldC; lhs) + { + if (oldC.var is null) + continue; + + if (!oldC.maybeTopSeen) + { + ret.addConsequence(oldC.var, oldC); + ret.check; + } + } + + foreach (oldC; rhs) + { + if (oldC.var is null) + continue; + + if (!oldC.maybeTopSeen) + { + ret.addConsequence(oldC.var, oldC); + ret.check; + } + } + + cctx.maybe = firstMaybe; + + if (cctxLHS !is null && cctxRHS !is null) + { + if (cctxLHS.truthiness == cctxRHS.truthiness) + cctx.truthiness = cctxLHS.truthiness; + else if (cctxLHS.truthiness == Truthiness.False) + cctx.truthiness = Truthiness.False; + else if (lhsCctxMaybe || cctxRHS.truthiness == Truthiness.Maybe) + cctx.truthiness = Truthiness.Maybe; + else + cctx.truthiness = Truthiness.Unknown; + } + else + cctx.truthiness = Truthiness.Unknown; + + ret.check; + return ret; + } + + DFALatticeRef transferLogicalOr(DFALatticeRef lhs, DFALatticeRef rhs) + { + DFAConsequence* lhsCctx = lhs.getContext; + DFAConsequence* rhsCctx = rhs.getContext; + DFAVar* lhsCtx = lhsCctx !is null ? lhsCctx.var : null, + rhsCtx = rhsCctx !is null ? rhsCctx.var : null; + + /* + We have two trees that look like: + constant + / \ + leaf leaf + + And need to recombine them into this form, where the constants are discarded from the origin. + + (a && b && e) || (c && d && e) -> (e) || (e) -> e + + We are not interested in a, b, c, or d. + This is due to us having no knowledge if the effect is in effect. + */ + + DFALatticeRef ret = dfaCommon.makeLatticeRef; + DFAVar* lastMaybe; + + // Add maybe tops, that are in both + lhs.walkMaybeTops((DFAConsequence* oldC) { + if (oldC.var is null) + return true; + + DFAConsequence* result = ret.addConsequence(oldC.var); + DFAConsequence* oldC2 = rhs.findConsequence(oldC.var); + + if (oldC2 is null) + return true; + + result.meetConsequence(oldC, oldC2, true); + + result.maybe = lastMaybe; + lastMaybe = result.var; + return true; + }); + + // Now add the consequences that are both in lhs and rhs, + // that are not maybe tops. + + foreach (oldC; lhs) + { + if (oldC.var is null || oldC.maybeTopSeen) + continue; + + DFAConsequence* result = ret.addConsequence(oldC.var); + DFAConsequence* oldC2 = rhs.findConsequence(oldC.var); + if (oldC2 is null) + continue; + + result.meetConsequence(oldC, oldC2, true); + } + + DFAVar* newCtx = dfaCommon.findVariablePair(lhsCtx, rhsCtx); + DFAConsequence* cctx = ret.addConsequence(newCtx); + ret.setContext(cctx); + cctx.maybe = lastMaybe; + + if (lhsCctx !is null && rhsCctx !is null) + { + if (lhsCctx.truthiness == Truthiness.True || rhsCctx.truthiness == Truthiness.True) + cctx.truthiness = Truthiness.True; + else if (lhsCctx.truthiness != Truthiness.Unknown + && rhsCctx.truthiness != Truthiness.Unknown) + cctx.truthiness = Truthiness.Maybe; + } + + return ret; + } + + DFALatticeRef transferConditional(DFALatticeRef condition, DFAScopeRef scrTrue, DFALatticeRef lrTrue, + DFAScopeRef scrFalse, DFALatticeRef lrFalse, bool unknownBranchTaken, + int predicateNegation) + { + + this.convergeStatementIf(condition, scrTrue, scrFalse, false, + unknownBranchTaken, predicateNegation); + + DFAVar* trueVar, falseVar; + DFAConsequence* trueCctx = lrTrue.getContext(trueVar), + falseCctx = lrFalse.getContext(falseVar); + + DFAObject* trueObj = trueCctx !is null ? trueCctx.obj : null; + DFAObject* falseObj = falseCctx !is null ? falseCctx.obj : null; + + DFAVar* asContext = dfaCommon.findVariablePair(trueVar, falseVar); + + DFALatticeRef ret = meet(lrTrue, lrFalse, 0, true); + + DFAConsequence* cctx = ret.setContext(asContext); + cctx.obj = dfaCommon.makeObject(trueObj, falseObj); + return ret; + } + + DFAScopeRef transferLoopyLabelAwareStage(DFAScopeRef previous, DFAScopeRef next) + { + assert(!next.isNull); + + if (next.sc.haveJumped || next.sc.haveReturned) + { + /* + Handles the case where you have: + + int* ptr; + switch(thing) { + case 0: + ptr = new int; + break; + default: + return; + } + */ + return previous; + } + + if (previous.isNull) + return next; + + const allJumped = previous.sc.haveJumped && next.sc.haveJumped, + allReturned = previous.sc.haveReturned && next.sc.haveReturned; + + DFAScopeRef ret = meetScope(previous, next, true, true); + assert(!ret.isNull); + + if (allJumped) + ret.sc.haveJumped = true; + if (allReturned) + ret.sc.haveReturned = true; + + return ret; + } + + void onRead(ref DFALatticeRef lr, ref Loc loc, bool willInit = false, + bool isByRef = false, bool forMathOp = false) + { + version (none) + { + lr.printStructure("READ READ READ"); + printf("READ READ value %d %d\n", willInit, isByRef); + } + + // Called by statement, expressions and analysis. + DFAVar* contextVar; + DFAConsequence* cctx = lr.getContext(contextVar); + + if (contextVar is null) + return; + assert(cctx !is null); + + DFALatticeRef toStore; + + void seeRootObject(DFAObject* root) + { + version (none) + { + printf("root object %p var %p\n", root, root.storageFor); + } + + // Don't apply effects from a variable that isn't actually modelled i.e. indirection. + + if (root.storageFor !is null && !root.storageFor.haveBase) + { + DFALatticeRef lr = dfaCommon.acquireLattice(root.storageFor); + DFAConsequence* cctx = lr.getContext; + + if (cctx !is null && cctx.writeOnVarAtThisPoint == 0) + reporter.onReadOfUninitialized(root.storageFor, lr, loc, forMathOp); + + if (toStore.isNull) + toStore = lr; + else + toStore = meet(toStore, lr); + } + } + + if (willInit) + { + // We differentiate if it is some form of initialize either lhs or rhs and isByRef because initialization of a struct member + // does not necessarily read the struct itself (offsets are fine), whereas ref parameters + // likely imply a read or dependency that requires initialization. + + // When initializing (writing), we only care if we are reading a variable to determine the address. + // e.g. `*ptr = 2` reads `ptr`. `struct.field = 2` does NOT read `struct`. + // `visitIfReadOfReferenceToAnotherVar` implements this logic (dereferences read base, offsets do not). + + contextVar.visitIfReadOfReferenceToAnotherVar((DFAVar* root) { + if (root.var is null || root is contextVar || root.unmodellable + || root.haveInfiniteLifetime) + return; + + DFAConsequence* c = lr.findConsequence(root); + if (c is null) + return; + + if (c.writeOnVarAtThisPoint == 0) + reporter.onReadOfUninitialized(root, lr, loc, forMathOp); + }); + } + else if (isByRef) + { + // For ref params, we generally require initialization unless it's 'out', but 'out' should be handled elsewhere/differently? + // Existing logic assumes 'ref' requires init. + + contextVar.visitIfReferenceToAnotherVar((DFAVar* root) { + if (root.var is null || root is contextVar || root.unmodellable + || root.haveInfiniteLifetime) + return; + + DFAConsequence* c = lr.findConsequence(root); + if (c is null) + return; + + if (c.writeOnVarAtThisPoint == 0) + reporter.onReadOfUninitialized(root, lr, loc, forMathOp); + else if (c.obj !is null) + c.obj.walkRoots(&seeRootObject); + }); + } + else + { + // We don't care about the case where indirection is involved. + // int val1 = void; + // int* ptr = &val1; + // int val2 = *ptr; // no error + + if (!contextVar.haveBase) + { + if (contextVar.var !is null && cctx.writeOnVarAtThisPoint == 0) + reporter.onReadOfUninitialized(contextVar, lr, loc, forMathOp); + } + + contextVar.visitIfReadOfReferenceToAnotherVar((DFAVar* root) { + version (none) + { + printf("got a variable %p %p\n", root, root.var); + printf(" %d %d %d\n", root.haveBase, root.unmodellable, + root.haveInfiniteLifetime); + } + + if (root.haveBase || root.unmodellable || root.haveInfiniteLifetime) + return; + + DFAConsequence* c = lr.findConsequence(root); + if (c is null) + return; + + version (none) + { + printf(" %d\n", c.writeOnVarAtThisPoint); + } + + if (root.var !is null && c.writeOnVarAtThisPoint == 0) + reporter.onReadOfUninitialized(root, lr, loc, forMathOp); + else if (c.obj !is null) + c.obj.walkRoots(&seeRootObject); + }); + + cctx.copyFrom(toStore.getContext); + } + } + +private: + + DFAScopeRef meetScope(DFAScopeRef scr1, DFAScopeRef scr2, bool copyAll, + bool couldScopeNotHaveRan = false) + { + scr1.check; + scr2.check; + + const depth = dfaCommon.currentDFAScope.depth; + + DFAScopeRef ret; + ret.sc = dfaCommon.allocator.makeScope(dfaCommon, dfaCommon.currentDFAScope); + ret.sc.depth = depth; + ret.sc.haveJumped = scr1.sc.haveJumped && scr2.sc.haveJumped; + ret.sc.haveReturned = scr1.sc.haveReturned && scr2.sc.haveReturned; + + DFALatticeRef lr1, lr2; + DFAScopeVarMergable mergable1, mergable2; + DFAVar* var; + + for (;;) + { + lr1 = scr1.consumeNext(var, mergable1); + if (lr1.isNull) + break; + + lr2 = scr2.consumeVar(var, mergable2); + + if (!copyAll && lr2.isNull) + continue; + + lr1.check; + lr2.check; + + DFALatticeRef meeted = meet(lr1, lr2, depth, couldScopeNotHaveRan); + assert(!meeted.isNull); + meeted.check; + + DFAScopeVar* scv = ret.assignLattice(var, meeted); + scv.mergable.merge(mergable1); + scv.mergable.merge(mergable2); + } + + if (copyAll) + { + for (;;) + { + lr2 = scr2.consumeNext(var, mergable2); + if (lr2.isNull) + break; + + lr2.check; + DFAScopeVar* scv = ret.assignLattice(var, lr2); + scv.mergable.merge(mergable2); + } + } + + ret.check; + return ret; + } + + DFAScopeRef joinScope(DFAScopeRef scr1, DFAScopeRef scr2) + { + scr1.check; + scr2.check; + + const depth = dfaCommon.currentDFAScope.depth; + + DFAScopeRef ret; + ret.sc = dfaCommon.allocator.makeScope(dfaCommon, dfaCommon.currentDFAScope); + ret.sc.depth = depth; + ret.sc.haveJumped = scr1.sc.haveJumped && scr2.sc.haveJumped; + ret.sc.haveReturned = scr1.sc.haveReturned && scr2.sc.haveReturned; + + DFALatticeRef lr1, lr2; + DFAScopeVarMergable mergable1, mergable2; + DFAVar* var; + + for (;;) + { + lr1 = scr1.consumeNext(var, mergable1); + if (lr1.isNull) + break; + + lr2 = scr2.consumeVar(var, mergable2); + + lr1.check; + lr2.check; + + DFALatticeRef joined = join(lr1, lr2, depth); + assert(!joined.isNull); + joined.check; + + DFAScopeVar* scv = ret.assignLattice(var, joined); + scv.mergable.merge(mergable1); + scv.mergable.merge(mergable2); + } + + ret.check; + return ret; + } + + /*********************************************************** + * The Lattice 'Meet' operation (Intersection / Lower Bound). + * + * Used when we are combining facts that MUST be true. + * Example: If `x` is NonNull in path A AND `x` is NonNull in path B, + * then `x` is NonNull. + */ + DFALatticeRef meet(DFALatticeRef lhs, DFALatticeRef rhs, + int filterDepthOfVariable = 0, bool couldScopeNotHaveRan = false) + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + DFAConsequence* constantRHS = rhs.findConsequence(null); + DFAVar* lhsVar = lhs.getContextVar; + + version (DebugJoinMeetOp) + { + printf("meet %p %d %d\n", lhsVar, filterDepthOfVariable, couldScopeNotHaveRan); + fflush(stdout); + } + + foreach (c1; lhs) + { + if (c1.var is null) + continue; + + version (DebugJoinMeetOp) + { + printf("meet lhs %p %d\n", c1.var, c1.var.declaredAtDepth); + fflush(stdout); + } + + if (filterDepthOfVariable < c1.var.declaredAtDepth && filterDepthOfVariable > 0) + continue; + + DFAConsequence* result = ret.addConsequence(c1.var); + DFAConsequence* c2 = rhs.findConsequence(c1.var); + + result.meetConsequence(c1, c2, couldScopeNotHaveRan); + + if (c1.var is lhsVar && constantRHS !is null) + { + result.meetConsequence(c1, constantRHS, couldScopeNotHaveRan); + } + } + + foreach (c2; rhs) + { + if (c2.var is null || lhs.findConsequence(c2.var) !is null) + continue; + + version (DebugJoinMeetOp) + { + printf("meet rhs %p %d\n", c2.var, c2.var.declaredAtDepth); + fflush(stdout); + } + + if (filterDepthOfVariable < c2.var.declaredAtDepth && filterDepthOfVariable > 0) + continue; + + DFAConsequence* result = ret.addConsequence(c2.var); + result.meetConsequence(c2, null, couldScopeNotHaveRan); + } + + ret.setContext(lhsVar); + ret.check; + return ret; + } + + /*********************************************************** + * The Lattice 'Join' operation (Union / Upper Bound). + * + * Used when merging diverging paths where EITHER could have happened. + * Example: If `x` is 5 in path A, and `x` is 6 in path B. + * Join(A, B) -> `x` is "Unknown Integer" (because it could be either). + */ + DFALatticeRef join(DFALatticeRef lhs, DFALatticeRef rhs, int filterDepthOfVariable = 0, + DFAVar* ignoreLHSCtx = null, bool ignoreWriteCount = false, bool unknownAware = false) + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + DFAConsequence* constantRHS = rhs.findConsequence(null); + + DFAVar* lhsVar, rhsVar; + DFAConsequence* lhsCtx = lhs.getContext(lhsVar), rhsCtx = rhs.getContext(rhsVar); + + version (DebugJoinMeetOp) + { + printf("Running join on %p and %p, constantRHS=%p, filter=%d, ignoreLHS=%p, ignoreWriteCount=%d, unknownAware=%d\n", + lhsVar, rhsVar, constantRHS, filterDepthOfVariable, + ignoreLHSCtx, ignoreWriteCount, unknownAware); + fflush(stdout); + } + + void processLHSVar(DFAConsequence* c1) + { + version (DebugJoinMeetOp) + { + printf("Processing LHS var %p\n", c1.var); + fflush(stdout); + } + + if (filterDepthOfVariable < c1.var.declaredAtDepth && filterDepthOfVariable > 0) + return; + + DFAConsequence* result = ret.addConsequence(c1.var); + DFAConsequence* c2 = rhs.findConsequence(c1.var); + + const isC1LHSCtx = lhsVar is c1.var; + result.joinConsequence(c1, c2, null, isC1LHSCtx, ignoreWriteCount, unknownAware); + + if (isC1LHSCtx && constantRHS !is null) + result.joinConsequence(c1, constantRHS, rhsCtx, true, + ignoreWriteCount, unknownAware); + } + + version (DebugJoinMeetOp) + { + printf("joining lhs\n"); + fflush(stdout); + } + + if (ignoreLHSCtx is null || lhsVar !is ignoreLHSCtx) + { + foreach (c1; lhs) + { + if (c1.var is null) + continue; + + processLHSVar(c1); + } + } + else if (lhsVar !is null && lhsVar.haveBase) + { + lhsVar.visitFirstBase((firstBase) { + firstBase.walkToRoot((var) { + processLHSVar(lhs.findConsequence(var)); + }); + }); + } + + version (DebugJoinMeetOp) + { + printf("joining rhs\n"); + fflush(stdout); + } + + foreach (c2; rhs) + { + version (DebugJoinMeetOp) + { + printf("Processing RHS var %p\n", c2.var); + fflush(stdout); + } + + if (c2.var is null || ret.findConsequence(c2.var) !is null) + continue; + + if (filterDepthOfVariable < c2.var.declaredAtDepth && filterDepthOfVariable > 0) + continue; + + DFAConsequence* result = ret.addConsequence(c2.var); + result.joinConsequence(c2, null, rhsCtx, false, ignoreWriteCount, unknownAware); + } + + version (DebugJoinMeetOp) + { + printf("joining rhs ctx\n"); + fflush(stdout); + } + + if (rhsCtx !is null && rhsVar is null && lhsVar !is null) + { + version (DebugJoinMeetOp) + { + printf("Processing RHS context var %p to lhs context var %p\n", rhsCtx.var, lhsVar); + fflush(stdout); + } + + DFAConsequence* result = ret.addConsequence(lhsVar); + result.joinConsequence(rhsCtx, null, null, false, false, unknownAware); + if (result.writeOnVarAtThisPoint < lhsCtx.writeOnVarAtThisPoint) + result.writeOnVarAtThisPoint = lhsCtx.writeOnVarAtThisPoint; + } + + ret.setContext(lhsVar); + ret.check; + + version (DebugJoinMeetOp) + { + printf("joining done\n"); + fflush(stdout); + } + + return ret; + } + + void checkPAVar(DFAVar* var, ref bool couldBeUnknown) + { + if (var is null) + return; + + if (var.declaredAtDepth > 0 && dfaCommon.lastLoopyLabel.depth > var.declaredAtDepth) + couldBeUnknown = true; + } + + void seeWrite(ref DFAVar* assignTo, ref DFALatticeRef from) + { + assert(assignTo !is null); + const currentDepth = dfaCommon.currentDFAScope.depth; + + assignTo.walkRoots((root) { + root.writeCount++; + + dfaCommon.acquireScopeVar(root); + + if (DFAScopeVar* scv = dfaCommon.lastLoopyLabel.findScopeVar(root)) + { + if (scv.assignDepth == 0 || scv.assignDepth > currentDepth) + scv.assignDepth = currentDepth; + } + + DFAConsequence* c = from.addConsequence(root); + c.writeOnVarAtThisPoint = root.writeCount; + }); + } +} diff --git a/dmd/dfa/fast/expression.d b/dmd/dfa/fast/expression.d new file mode 100644 index 00000000000..9ebf88c6e13 --- /dev/null +++ b/dmd/dfa/fast/expression.d @@ -0,0 +1,2725 @@ +/** + * Expression walker for the fast Data Flow Analysis engine. + * + * This module tracks how values flow through expressions. + * It is responsible for: + * 1. Tracking Assignments: Updating the state of variables when they are written to. + * 2. Inferring Facts: Learning about variables from conditions (e.g., `if (ptr)`). + * 3. Handling Function Calls: Managing side effects and return values. + * 4. Modeling Arithmetic: Tracking ranges of values (Point Analysis) to detect overflows. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/fast/expression.d, dfa/fast/expression.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_fast_expression.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/fast/expression.d + */ +module dmd.dfa.fast.expression; +import dmd.dfa.fast.analysis; +import dmd.dfa.fast.report; +import dmd.dfa.fast.statement; +import dmd.dfa.fast.structure; +import dmd.dfa.utils; +import dmd.common.outbuffer; +import dmd.location; +import dmd.expression; +import dmd.expressionsem; +import dmd.typesem; +import dmd.astenums; +import dmd.tokens; +import dmd.func; +import dmd.declaration; +import dmd.mtype; +import dmd.dtemplate; +import dmd.arraytypes; +import dmd.rootobject; +import dmd.id; +import dmd.dsymbol; +import core.stdc.stdio; + +/*********************************************************** + * Visits Expression nodes to track data flow. + * + * This struct implements the logic for how expressions affect the DFA state. + * It translates AST operations (like `+`, `=`, `==`) into `DFALatticeRef` updates. + */ +struct ExpressionWalker +{ + DFACommon* dfaCommon; + StatementWalker stmtWalker; + DFAAnalyzer* analyzer; + + __gshared immutable(string[]) AllExprOpNames = [__traits(allMembers, EXP)]; + + void seeConvergeExpression(DFALatticeRef lr, bool isSideEffect = false) + { + dfaCommon.printStateln("Converging expression:"); + lr.printState("", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + lr.check; + + dfaCommon.check; + analyzer.convergeExpression(lr, isSideEffect); + dfaCommon.check; + + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + } + + void seeConvergeFunctionCallArgument(DFALatticeRef lr, ParameterDFAInfo* paramInfo, + ulong paramStorageClass, FuncDeclaration calling, ref Loc loc) + { + dfaCommon.printStateln("Converging argument:"); + lr.printState("", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + lr.check; + + dfaCommon.check; + analyzer.convergeFunctionCallArgument(lr, paramInfo, paramStorageClass, calling, loc); + dfaCommon.check; + + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + } + + /*********************************************************** + * Handles variable assignment (e.g., `x = y`). + * + * This function updates the `assignTo` variable in the current scope + * to reflect the new state derived from `lr` (the right-hand side). + * + * Params: + * assignTo = The variable being written to. + * construct = True if this is an initialization (e.g., `int x = 5;`), false if reassignment. + * lr = The lattice state of the value being assigned. + * loc = Source file location of the assignment. + * isBlit = True if the assignment is a bitwise copy (blit). + * alteredState = An integer representing a specific state alteration or flag. + */ + DFALatticeRef seeAssign(DFAVar* assignTo, bool construct, DFALatticeRef lr, + ref Loc loc, bool isBlit = false, int alteredState = 0) + { + DFALatticeRef assignTo2 = dfaCommon.makeLatticeRef; + assignTo2.setContext(assignTo); + + dfaCommon.check; + DFALatticeRef ret = seeAssign(assignTo2, construct, lr, loc, isBlit); + dfaCommon.check; + + return ret; + } + + DFALatticeRef seeAssign(DFALatticeRef assignTo, bool construct, DFALatticeRef lr, ref Loc loc, + bool isBlit = false, int alteredState = 0, DFALatticeRef indexLR = DFALatticeRef.init) + { + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf( + "Assigning construct?%d:%d %d\n", construct, isBlit, alteredState)); + assignTo.printState("to", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + assignTo.check; + lr.printState("from", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + lr.check; + indexLR.printState("index", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + indexLR.check; + + assert(analyzer !is null); + dfaCommon.check; + DFALatticeRef ret = analyzer.transferAssign(assignTo, construct, + isBlit, lr, alteredState, loc, indexLR); + dfaCommon.check; + + ret.check; + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + return ret; + } + + /*********************************************************** + * Handles equality checks (e.g., `x == y`). + * + * This is critical for control flow. If the DFA sees `if (x == null)`, + * this function records that relationship so the `StatementWalker` can + * create a scope where `x` is known to be null. + */ + DFALatticeRef seeEqual(DFALatticeRef lhs, DFALatticeRef rhs, bool truthiness, + Type lhsType, Type rhsType) + { + const equalityType = equalityArgTypes(lhsType, rhsType); + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Equal iff=%d, ty=%d:%d, ety=%d", truthiness, lhsType.ty, + rhsType !is null ? rhsType.ty : -1, equalityType); + ob.writestring("\n"); + }); + + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferEqual(lhs, rhs, truthiness, equalityType, false); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + /*********************************************************** + * Handles equality checks (e.g., `x is y`). + * + * This is critical for control flow. If the DFA sees `if (x == null)`, + * this function records that relationship so the `StatementWalker` can + * create a scope where `x` is known to be null. + */ + DFALatticeRef seeEqualIdentity(DFALatticeRef lhs, DFALatticeRef rhs, + bool truthiness, Type lhsType, Type rhsType) + { + const equalityType = equalityArgTypes(lhsType, rhsType); + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Equal identity iff=%d, ty=%d:%d, ety=%d", truthiness, + lhsType.ty, rhsType !is null ? rhsType.ty : -1, equalityType); + ob.writestring("\n"); + }); + + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferEqual(lhs, rhs, truthiness, equalityType, true); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + DFALatticeRef seeNegate(DFALatticeRef lr, Type type, + bool protectElseNegate = false, bool limitToContext = false) + { + lr.printState("Negate", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferNegate(lr, type, protectElseNegate, limitToContext); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + DFALatticeRef seeMathOp(DFALatticeRef lhs, DFALatticeRef rhs, Type type, PAMathOp op) + { + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Math op %d", op); + ob.writestring("\n"); + }); + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferMathOp(lhs, rhs, type, op); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + DFALatticeRef seeDereference(ref Loc loc, DFALatticeRef lr) + { + dfaCommon.printStateln("Dereferencing"); + lr.printState("Dereference", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferDereference(lr, loc); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + void seeAssert(DFALatticeRef lr, ref Loc loc, bool dueToConditional = false) + { + lr.printState("Assert", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.currentDFAScope.printState("scope", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + + dfaCommon.check; + analyzer.transferAssert(lr, loc, false, dueToConditional); + dfaCommon.check; + + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + } + + void seeSilentAssert(DFALatticeRef lr, bool ignoreWriteCount = false, + bool dueToConditional = false) + { + lr.printState("Assert silent", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.currentDFAScope.printState("scope", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + + Loc loc; + dfaCommon.check; + analyzer.transferAssert(lr, loc, ignoreWriteCount, dueToConditional); + dfaCommon.check; + + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.check; + } + + DFALatticeRef seeLogicalAnd(DFALatticeRef lhs, DFALatticeRef rhs) + { + dfaCommon.printStateln("Logical and:"); + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + lhs.check; + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.check; + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferLogicalAnd(lhs, rhs); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + ret.check; + return ret; + } + + DFALatticeRef seeLogicalOr(DFALatticeRef lhs, DFALatticeRef rhs) + { + dfaCommon.printStateln("Logical or:"); + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferLogicalOr(lhs, rhs); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + DFALatticeRef seeConditional(DFALatticeRef condition, DFAScopeRef scrTrue, DFALatticeRef lrTrue, + DFAScopeRef scrFalse, DFALatticeRef lrFalse, bool unknownBranchTaken, + int predicateNegation) + { + dfaCommon.printStateln("Condition:"); + condition.printState("condition", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + scrTrue.printState("true sc", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + lrTrue.printState("true lr", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + scrFalse.printState("false sc", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + lrFalse.printState("false lr", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferConditional(condition, scrTrue, + lrTrue, scrFalse, lrFalse, unknownBranchTaken, predicateNegation); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + dfaCommon.currentDFAScope.printState("so far", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + + ret.check; + dfaCommon.currentDFAScope.check; + return ret; + } + + DFALatticeRef seeGreaterThan(bool orEqualTo, DFALatticeRef lhs, DFALatticeRef rhs) + { + dfaCommon.printStateln(orEqualTo ? "Greater than or equal to:" : "Greater than:"); + lhs.printState("lhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + rhs.printState("rhs", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + dfaCommon.check; + DFALatticeRef ret = analyzer.transferGreaterThan(orEqualTo, lhs, rhs); + dfaCommon.check; + + ret.printState("result", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + return ret; + } + + void seeRead(ref DFALatticeRef lr, ref Loc loc) + { + dfaCommon.printStateln("Seeing read of lr"); + lr.printState("read lr", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + analyzer.onRead(lr, loc); + } + + void seeReadMathOp(ref DFALatticeRef lr, ref Loc loc) + { + dfaCommon.printStateln("Seeing read of math op lr"); + lr.printState("read lr", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + analyzer.onRead(lr, loc, false, false, true); + } + + DFALatticeRef adaptConditionForBranch(Expression expr, bool truthiness) + { + if (expr is null) + return DFALatticeRef.init; + + return this.adaptConditionForBranch(this.walk(expr), expr.type, truthiness); + } + + DFALatticeRef adaptConditionForBranch(DFALatticeRef ret, Type type, bool truthiness) + { + if (ret.isNull) + { + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + } + + DFAVar* ctx; + DFAConsequence* cctx = ret.getContext(ctx); + assert(cctx !is null); + + if (ctx !is null && ctx.isNullable && cctx.truthiness == Truthiness.Unknown) + { + DFALatticeRef against = dfaCommon.makeLatticeRef; + + if (truthiness) + against.acquireConstantAsContext(Truthiness.True, Nullable.NonNull, null); + else + against.acquireConstantAsContext(Truthiness.False, Nullable.Null, null); + + ret = this.seeEqual(ret, against, truthiness, type, null); + } + else if (!truthiness) + { + if ((cctx = ret.getGateConsequence) !is null) + { + ret.setContext(cctx); + ret = this.seeNegate(ret, type); + } + else + { + // Unfortunately negation is a bit overactive for else bodies. + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + } + } + + return ret; + } + + /*********************************************************** + * The main dispatch loop for expressions. + * + * Visits an expression node and returns the resulting Lattice state. + * This handles the recursion for complex expressions like `(a + b) * c`. + * + * Returns: + * A `DFALatticeRef` representing the computed value/state of the expression. + */ + DFALatticeRef walk(Expression expr) + { + if (expr is null) + return DFALatticeRef.init; + + dfaCommon.edepth++; + dfaCommon.check; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("[%p]%3d walk (%s): at ", expr, expr.op, AllExprOpNames[expr.op].ptr); + appendLoc(ob, expr.loc); + ob.writestring("\n"); + }); + + scope (exit) + { + dfaCommon.check; + dfaCommon.edepth--; + } + + final switch (expr.op) + { + case EXP.not: // !x + case EXP.equal: + case EXP.notEqual: + case EXP.identity: // is + case EXP.notIdentity: // !is + case EXP.string_: + case EXP.typeid_: + case EXP.arrayLiteral: + case EXP.assocArrayLiteral: + case EXP.arrayLength: + case EXP.int64: + case EXP.null_: + case EXP.cast_: + case EXP.variable: + int predicateNegation; + return this.walkCondition(expr, predicateNegation); + + case EXP.this_: + auto vd = expr.isThisExp.var; + + if (vd is null) + vd = dfaCommon.currentFunction.vthis; + + if (!dfaCommon.debugUnknownAST && vd is null) + return DFALatticeRef.init; + else if (vd is null) + assert(0); + + DFAVar* var = dfaCommon.findVariable(vd); + return dfaCommon.acquireLattice(var); + + case EXP.dotVariable: + auto dve = expr.isDotVarExp; + + dfaCommon.printStateln("Dot var lhs"); + DFALatticeRef ret = this.walk(dve.e1); + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + DFAConsequence* context = ret.getContext; + DFAVar* var; + + // for indirection we start with a clean slate on each access + if (auto vd = dve.var.isVarDeclaration) + { + if (context is null || context.var is null) + var = dfaCommon.findVariable(vd); + else + var = dfaCommon.findVariable(vd, context.var); + } + + DFAConsequence* c = ret.addConsequence(var); + ret.setContext(c); + return ret; + + case EXP.symbolOffset: + // similar to address except has a variable offset + auto soe = expr.isSymOffExp; + DFALatticeRef ret; + DFAVar* varBase, varOffset; + + if (auto vd = soe.var.isVarDeclaration) + { + varBase = dfaCommon.findVariable(vd); + if (varBase is null) + return DFALatticeRef.init; + + ret = dfaCommon.acquireLattice(varBase); + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + varOffset = dfaCommon.findOffsetVar(soe.offset, varBase); + assert(varOffset is null || varOffset.haveBase); + + DFAConsequence* c = ret.addConsequence(varOffset); + ret.setContext(c); + + c.obj = dfaCommon.makeObject(varBase); + + if (varBase.declaredAtDepth > 0) + { + c.truthiness = Truthiness.True; + c.nullable = Nullable.NonNull; + } + + if (soe.offset != 0) + c.obj.mayNotBeExactPointer = true; + } + else if (auto fd = soe.var.isFuncDeclaration) + { + // For some reason, sometimes people like to do an offset that isn't zero for functions. + // So we'll ignore that and assume the offset is "right", + // even if it probably doesn't make sense to be doing it. + + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext(Truthiness.True, Nullable.NonNull, + dfaCommon.makeObject); + } + else + { + if (!dfaCommon.debugUnknownAST) + return DFALatticeRef.init; + else + assert(0); + } + + return ret; + + case EXP.address: + // Similar to symbolOffset except is always at offset 0 + auto ae = expr.isAddrExp; + + DFALatticeRef ret = this.walk(ae.e1); + + if (!ret.isNull) + { + DFAVar* ctx = ret.getContextVar; + + if (ctx !is null) + { + DFAVar* varOffset = dfaCommon.findOffsetVar(0, ctx); + DFAConsequence* cctx = ret.setContext(varOffset); + + cctx.obj = dfaCommon.makeObject(ctx); + + if (ctx.declaredAtDepth > 0) + { + cctx.truthiness = Truthiness.True; + cctx.nullable = Nullable.NonNull; + } + } + } + + return ret; + + case EXP.declaration: + { + auto symbol = expr.isDeclarationExp.declaration; + + void eachDeclarationSymbol(Dsymbol symbol) + { + if (auto var = symbol.isVarDeclaration) + { + if (var.ident !is null) + { + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Declaring variable: %s\n", var.ident.toChars); + }); + } + + DFAVar* dfaVar = dfaCommon.findVariable(var); + dfaVar.declaredAtDepth = dfaCommon.currentDFAScope.depth; + DFAScopeVar* scv = dfaCommon.acquireScopeVar(dfaVar); + DFAConsequence* cctx = scv.lr.getContext; + + // ImportC supports syntax as: Type var = var; + // Bit of a problem that... + // Due to the construct expression on rhs, is going to see var as being uninitialized. + // What we'll do instead, is init ALL VARIABLES, and based upon the init expression, uninitialize it. + + { + dfaVar.writeCount = 1; + cctx.writeOnVarAtThisPoint = 1; + } + + if (var._init !is null) + { + final switch (var._init.kind) + { + case InitKind.exp: + auto ei = var._init.isExpInitializer; + + if (ei.loc == var.loc && (var.storage_class & STC.foreach_) == 0) + { + // This is default initialization + + if (dfaVar.isFloatingPoint) + { + // Floating point initializes to NaN which is NOT a good default. + // Allow explicit, but not default initialization. + dfaVar.wasDefaultInitialized = true; + goto case InitKind.void_; + } + } + + // does this var escape another? Can't model that. + if ((var.storage_class & STC.ref_) == STC.ref_) + markUnmodellable(ei.exp); + + DFALatticeRef lr = this.walk(ei.exp); + + if (!(ei.exp.isConstructExp || ei.exp.isBlitExp)) + seeAssign(dfaVar, true, lr, ei.exp.loc); + break; + + case InitKind.array: + auto ai = var._init.isArrayInitializer; + DFALatticeRef lr = dfaCommon.makeLatticeRef; + DFAConsequence* c = lr.addConsequence(dfaVar); + lr.setContext(c); + + seeAssign(dfaVar, true, lr, ai.loc, false, + ai.value.length > 0 ? 3 : 2); + break; + + case InitKind.void_: + dfaVar.writeCount = 0; + cctx.writeOnVarAtThisPoint = 0; + break; + + case InitKind.error: + case InitKind.struct_: + case InitKind.C_: + case InitKind.default_: + break; + } + } + } + } + + if (auto ad = symbol.isAttribDeclaration) + { + // ImportC wraps their declarations + + if (ad.decl !is null) + { + foreach (symbol2; *ad.decl) + { + eachDeclarationSymbol(symbol2); + } + } + } + else + eachDeclarationSymbol(symbol); + + return DFALatticeRef.init; + } + + case EXP.construct: + auto ce = expr.isConstructExp; + + dfaCommon.printStateln("construct lhs"); + DFALatticeRef lhs = this.walk(ce.e1); + + dfaCommon.printStateln("construct rhs"); + DFALatticeRef rhs = this.walk(ce.e2); + + return seeAssign(lhs, true, rhs, ce.loc); + + case EXP.negate: // -x + auto ue = expr.isUnaExp; + DFALatticeRef ret = this.walk(ue.e1); + return this.seeNegate(ret, ue.type, false, true); + + // Basic types + case EXP.void_: + case EXP.float64: + case EXP.complex80: + DFALatticeRef ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + return ret; + + case EXP.call: + auto ce = expr.isCallExp; + assert(ce !is null); + assert(ce.e1 !is null); + return callFunction(ce.f, ce.e1, null, ce.arguments, ce.loc); + + case EXP.blit: + auto be = expr.isBlitExp; + + dfaCommon.printStateln("blit lhs"); + DFALatticeRef lhs, rhs; + + if (auto se = be.e1.isSliceExp) + { + // if we're bliting to a static array, let's ignore the empty slice. + assert(se.upr is null); + assert(se.lwr is null); + lhs = this.walk(se.e1); + } + else + lhs = this.walk(be.e1); + + if (auto e2ve = be.e2.isVarExp) + { + if (auto sd = e2ve.var.isSymbolDeclaration) + { + // this evaluates out to a type + + rhs = dfaCommon.makeLatticeRef; + rhs.acquireConstantAsContext(Truthiness.True, + Nullable.NonNull, dfaCommon.makeObject); + + goto BlitAssignRet; + } + } + + dfaCommon.printStateln("blit rhs"); + rhs = this.walk(be.e2); + + BlitAssignRet: + DFALatticeRef ret = seeAssign(lhs, true, rhs, be.loc, true); + return ret; + + case EXP.assign: + auto ae = expr.isAssignExp; + + Expression lhsContext = ae.e1, lhsIndex; + + if (auto ie = ae.e1.isIndexExp) + { + // Is this AA assignment? + + if (isIndexContextAA(ie)) + { + // ae.e1 resolves to a ctx[idx] + // ie.e1 is ctx, and ie.e2 is idx + + lhsContext = ie.e1; + lhsIndex = ie.e2; + } + } + + dfaCommon.printStateln("assign lhs"); + DFALatticeRef lhs = this.walk(lhsContext); + DFALatticeRef indexLR; + + if (lhsIndex !is null) + { + dfaCommon.printStateln("assign lhs index"); + indexLR = this.walk(lhsIndex); + } + + dfaCommon.printStateln("assign rhs"); + DFALatticeRef rhs = this.walk(ae.e2); + DFALatticeRef ret = seeAssign(lhs, false, rhs, ae.loc, false, + lhsIndex !is null ? 3 : 0, indexLR); + + if (ret.isNull) + { + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + } + + return ret; + + case EXP.star: + auto pe = expr.isPtrExp; + dfaCommon.printStateln("Derefencing exp"); + DFALatticeRef lr = walk(pe.e1); + return seeDereference(pe.loc, lr); + + case EXP.index: + { + // See Slice + auto ie = expr.isIndexExp; + + dfaCommon.printStateln("index lhs"); + DFALatticeRef lhs = this.walk(ie.e1); + dfaCommon.printStateln("index rhs"); + DFALatticeRef index = this.walk(ie.e2); + + DFAVar* lhsCtx; + DFAConsequence* lhsCctx = lhs.getContext(lhsCtx); + + DFAObject* lhsObject; + + Type lhsType = ie.e1.type; + bool resultHasEffect; + + if (lhsCctx !is null) + { + // Apply effects that this operation will have on to the lhs + + bool effectIndexBase = ie.indexIsInBounds; + + if (lhsType.isTypeAArray !is null) + { + if (ie.modifiable) + effectIndexBase = true; + } + else + resultHasEffect = true; + + if (effectIndexBase) + { + lhsCctx.truthiness = Truthiness.True; + lhsCctx.nullable = Nullable.NonNull; + } + + if (lhsCctx.obj !is null) + { + lhsObject = lhsCctx.obj; + lhsObject.mayNotBeExactPointer = true; + } + } + + if (lhsCtx !is null && lhsCtx.isNullable) + { + // Dereference the lhs if its a pointer, + // this really should be the case, but it prevents unnecessary work for static arrays. + lhs = seeDereference(ie.loc, lhs); + } + + DFAVar* indexVar = dfaCommon.findIndexVar(lhsCtx); + DFALatticeRef combined = this.seeLogicalAnd(lhs, index); + DFAConsequence* newCctx = combined.addConsequence(indexVar); + combined.setContext(newCctx); + + if (resultHasEffect && indexVar !is null) + { + if (indexVar.isTruthy) + newCctx.truthiness = Truthiness.True; + if (indexVar.isNullable) + newCctx.nullable = Nullable.NonNull; + } + + return combined; + } + + case EXP.slice: + { + // See index + auto se = expr.isSliceExp; + + dfaCommon.printStateln("Slice base"); + DFALatticeRef base = this.walk(se.e1); + DFAVar* baseCtx; + DFAConsequence* baseCctx = base.getContext(baseCtx); + + if (se.lwr is null && se.upr is null) + { + // Equivalent to doing slice[] + DFAVar* asSliceVar = dfaCommon.findAsSliceVar(baseCtx); + DFAConsequence* newCctx = base.addConsequence(asSliceVar); + base.setContext(newCctx); + + if (baseCctx !is null && baseCctx.obj !is null) + newCctx.obj = baseCctx.obj; + else + newCctx.obj = dfaCommon.makeObject(baseCtx); + return base; + } + + Truthiness expectedTruthiness; + DFALatticeRef ret = base; + + { + dfaCommon.printStateln("Slice [lwr"); + DFALatticeRef lower = this.walk(se.lwr); + dfaCommon.printStateln("Slice upr]"); + DFALatticeRef upper = this.walk(se.upr); + + DFAConsequence* lowerCctx = lower.getContext, upperCctx = upper.getContext; + DFAPAValue newPA; + + if (lowerCctx !is null && upperCctx !is null) + { + newPA = upperCctx.pa; + newPA.subtractFrom(lowerCctx.pa, Type.tuns64); + } + + DFALatticeRef together = this.seeLogicalAnd(lower, upper); + ret = this.seeLogicalAnd(ret, together); + + DFAConsequence* cctx = ret.addConsequence(baseCtx); + cctx.pa = newPA; + + if (se.upperIsInBounds + || (newPA.kind == DFAPAValue.Kind.Concrete && newPA.value > 0)) + { + expectedTruthiness = Truthiness.True; + cctx.truthiness = Truthiness.True; + cctx.nullable = Nullable.NonNull; + } + } + + if (baseCtx !is null && baseCtx.isNullable) + { + // Dereference if its a pointer, + // this really should be the case, but it prevents unnecessary work for static arrays. + ret = seeDereference(se.loc, ret); + } + + DFAVar* indexVar = dfaCommon.findIndexVar(baseCtx); + DFAConsequence* newCctx = ret.addConsequence(indexVar); + ret.setContext(newCctx); + + if (indexVar !is null) + { + if (indexVar.isTruthy) + newCctx.truthiness = expectedTruthiness; + + // If this expression were to succeed, the resulting slice will be non-null. + // Thanks to the read barrier for bounds checking. + if (indexVar.isNullable) + newCctx.nullable = Nullable.NonNull; + } + + return ret; + } + + case EXP.assert_: + // User assertions act as facts for the DFA. + // `assert(x != null)` tells the engine that `x` is NonNull + // for all subsequent code in this scope. + auto ae = expr.isAssertExp; + DFALatticeRef lr = this.walk(ae.e1); + seeAssert(lr, ae.e1.loc); + return DFALatticeRef.init; + + case EXP.halt: + DFALatticeRef lr = dfaCommon.makeLatticeRef; + lr.acquireConstantAsContext(Truthiness.False, Nullable.Unknown, null); + + seeAssert(lr, expr.loc); + // Evaluates to void + return DFALatticeRef.init; + + case EXP.new_: + auto ne = expr.isNewExp; + + DFALatticeRef ret = this.callFunction(ne.member, ne.thisexp, + ne.argprefix, ne.arguments, ne.loc); + + if (ne.placement !is null) + markUnmodellable(ne.placement); + + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + DFAVar* var = dfaCommon.getInfiniteLifetimeVariable; + DFAConsequence* c = ret.addConsequence(var); + ret.setContext(c); + + c.truthiness = Truthiness.True; + c.nullable = Nullable.NonNull; + c.obj = dfaCommon.makeObject; + return ret; + + case EXP.andAnd: + auto be = expr.isBinExp; + + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + DFALatticeRef inProgress; + + // if lhs is false, so will the andAnd + + // assume rhs could be andAnd + while (be !is null) + { + DFALatticeRef lhs = this.walk(be.e1); + seeRead(lhs, be.e1.loc); + + { + lhs = this.adaptConditionForBranch(lhs, be.e1.type, true); + DFAConsequence* c = lhs.getContext; + + if (c !is null && c.truthiness == Truthiness.False) + { + inProgress = dfaCommon.makeLatticeRef; + inProgress.acquireConstantAsContext(Truthiness.False, + Nullable.Unknown, null); + break; + } + } + + this.seeSilentAssert(lhs.copy); + + if (inProgress.isNull) + inProgress = lhs; + else + inProgress = seeLogicalAnd(inProgress, lhs); + + if (be.e2.op == EXP.andAnd) + { + be = be.e2.isBinExp; + continue; + } + else + { + DFALatticeRef rhs = this.walk(be.e2); + seeRead(rhs, be.e2.loc); + rhs = this.adaptConditionForBranch(rhs, be.e2.type, true); + + { + rhs = this.adaptConditionForBranch(rhs, be.e1.type, true); + DFAConsequence* c = rhs.getContext; + + if (c !is null && c.truthiness == Truthiness.False) + { + inProgress = dfaCommon.makeLatticeRef; + inProgress.acquireConstantAsContext(Truthiness.False, + Nullable.Unknown, null); + break; + } + } + + inProgress = seeLogicalAnd(inProgress, rhs); + break; + } + } + + stmtWalker.endScope; + return inProgress; + + case EXP.orOr: + int predicateNegation; + return this.walkCondition(expr.isLogicalExp, predicateNegation); + + case EXP.lessThan: + // < becomes > + auto be = expr.isBinExp; + DFALatticeRef lhs = this.walk(be.e2); + DFALatticeRef rhs = this.walk(be.e1); + return this.seeGreaterThan(false, lhs, rhs); + + case EXP.lessOrEqual: + // <= becomes >= + auto be = expr.isBinExp; + DFALatticeRef lhs = this.walk(be.e2); + DFALatticeRef rhs = this.walk(be.e1); + return this.seeGreaterThan(true, lhs, rhs); + + case EXP.greaterThan: + auto be = expr.isBinExp; + DFALatticeRef lhs = this.walk(be.e1); + DFALatticeRef rhs = this.walk(be.e2); + return this.seeGreaterThan(false, lhs, rhs); + + case EXP.greaterOrEqual: + auto be = expr.isBinExp; + DFALatticeRef lhs = this.walk(be.e1); + DFALatticeRef rhs = this.walk(be.e2); + return this.seeGreaterThan(true, lhs, rhs); + + case EXP.in_: + auto be = expr.isBinExp; + + DFALatticeRef lhs = this.walk(be.e1); + lhs.check; + + DFALatticeRef rhs = this.walk(be.e2); + rhs.check; + + DFAVar* rhsVar = rhs.getContextVar; + + // change comparison to: lhs in rhs[...] + if (rhsVar !is null) + rhs.setContext(dfaCommon.findIndexVar(rhsVar)); + + return this.seeEqual(lhs, rhs, true, be.e1.type, be.e2.type); + + case EXP.addAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.add); + case EXP.minAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.sub); + case EXP.mulAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.mul); + case EXP.divAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.div); + case EXP.modAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.mod); + case EXP.andAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.and); + case EXP.orAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.or); + case EXP.xorAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.xor); + case EXP.powAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.pow); + case EXP.leftShiftAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.leftShift); + case EXP.rightShiftAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.rightShiftSigned); + case EXP.unsignedRightShiftAssign: + return walkMathAssignOp(expr.isBinExp, PAMathOp.rightShiftUnsigned); + + case EXP.concatenateAssign: // ~= + return concatenateTwo(expr.isBinExp, 0, true); + case EXP.concatenateElemAssign: + return concatenateTwo(expr.isBinExp, 1, true); + case EXP.concatenateDcharAssign: + return concatenateTwo(expr.isBinExp, 2, true); + + case EXP.loweredAssignExp: + { + // Used for changing the length of lhs. + // While we can just walk the lowering and it'll "work", + // it won't be good enough. + auto be = expr.isLoweredAssignExp; + + if (auto ale = be.e1.isArrayLengthExp) + { + // See: slice.length = rhs + dfaCommon.printStateln("length assign lhs"); + DFALatticeRef lhs = this.walk(ale.e1); + dfaCommon.printStateln("length assign rhs"); + DFALatticeRef rhs = this.walk(be.e2); + + DFAConsequence* lhsCctx = lhs.getContext, rhsCctx = rhs.getContext; + assert(lhsCctx !is null); + assert(rhsCctx !is null); + + { + // remove anything that added to the calculation of the point analysis value + DFAPAValue rhsPA = rhsCctx.pa; + + rhs = dfaCommon.makeLatticeRef; + rhsCctx = rhs.acquireConstantAsContext; + rhsCctx.pa = rhsPA; + } + + // We use the rhs truthiness to model the new length + // If it is false, the new length is zero, and therefore null. + // If it is true, the new length is greater than zero, and therefore non-null. + int alteredState; + + if (rhsCctx is null || rhsCctx.truthiness == Truthiness.Unknown + || rhsCctx.truthiness == Truthiness.Maybe) + { + alteredState = 5; + } + else + { + if (rhsCctx.truthiness == Truthiness.True) + alteredState = 3; + else + alteredState = 4; + } + + { + DFAVar* lhsLengthVar = dfaCommon.findSliceLengthVar(lhsCctx.var); + lhs.addConsequence(lhsLengthVar, lhsCctx); + } + + return this.seeAssign(lhs, false, rhs, be.loc, false, alteredState); + } + else + { + // unknown lowered assign exp, use the lowering. + return this.walk(be.lowering); + } + } + + case EXP.add: + return walkMathOp(expr.isBinExp, PAMathOp.add); + case EXP.min: + return walkMathOp(expr.isBinExp, PAMathOp.sub); + case EXP.mul: + return walkMathOp(expr.isBinExp, PAMathOp.mul); + case EXP.div: + return walkMathOp(expr.isBinExp, PAMathOp.div); + case EXP.mod: + return walkMathOp(expr.isBinExp, PAMathOp.mod); + case EXP.and: + return walkMathOp(expr.isBinExp, PAMathOp.and); + case EXP.or: + return walkMathOp(expr.isBinExp, PAMathOp.or); + case EXP.xor: + return walkMathOp(expr.isBinExp, PAMathOp.xor); + case EXP.pow: + return walkMathOp(expr.isBinExp, PAMathOp.pow); + case EXP.leftShift: + return walkMathOp(expr.isBinExp, PAMathOp.leftShift); + case EXP.rightShift: + return walkMathOp(expr.isBinExp, PAMathOp.rightShiftSigned); + case EXP.unsignedRightShift: + return walkMathOp(expr.isBinExp, PAMathOp.rightShiftUnsigned); + + case EXP.plusPlus: + return walkMathAssignOp(expr.isBinExp, PAMathOp.postInc); + case EXP.minusMinus: + return walkMathAssignOp(expr.isBinExp, PAMathOp.postDec); + + case EXP.prePlusPlus: + DFALatticeRef effect = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = effect.acquireConstantAsContext; + cctx.pa = DFAPAValue(1); + + return walkMathAssignOp(expr.isUnaExp, effect, PAMathOp.add); + case EXP.preMinusMinus: + DFALatticeRef effect = dfaCommon.makeLatticeRef; + DFAConsequence* cctx = effect.acquireConstantAsContext; + cctx.pa = DFAPAValue(1); + + return walkMathAssignOp(expr.isUnaExp, effect, PAMathOp.sub); + + case EXP.tilde: + { + auto ue = expr.isUnaExp; + + DFALatticeRef ret = this.walk(ue.e1); + + if (ret.isNull) + { + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + } + else + { + DFAConsequence* cctx = ret.getContext; + cctx.pa.bitwiseInvert(ue.type); + } + + return ret; + } + + case EXP.comma: + { + auto ce = expr.isCommaExp; + + { + // We need to recognize the following AST: + // (((declaration), (loweredAssignExp)), (var)) + // arrayLengthExp + + auto ce2 = ce.e1.isCommaExp; + auto var = ce.e2.isVarExp; + + if (ce2 !is null && var !is null) + { + auto de = ce2.e1.isDeclarationExp; + auto lae = ce2.e2.isLoweredAssignExp; + + if (de !is null && lae !is null) + { + auto vd = de.declaration.isVarDeclaration; + auto laeLength = lae.e1.isArrayLengthExp; + + if (var.var.isVarDeclaration is vd && laeLength !is null) + { + // (((vd), (lae)), (var)) + // laeLength + + // ce.e1 can now be walked just fine, its ce.e2 that is the problem. + + dfaCommon.printStateln("comma lhs"); + DFALatticeRef lhs = this.walk(ce.e1); + dfaCommon.printStateln("comma rhs"); + DFALatticeRef rhs = this.walk(ce.e2); + + DFAConsequence* rhsCctx = rhs.getContext; + DFAConsequence* cctx = lhs.acquireConstantAsContext; + + cctx.truthiness = rhsCctx.truthiness; + cctx.nullable = rhsCctx.nullable; + cctx.pa = rhsCctx.pa; + + return lhs; + } + } + } + } + + dfaCommon.printStateln("comma lhs"); + DFALatticeRef lhs = this.walk(ce.e1); + dfaCommon.printStateln("comma rhs"); + DFALatticeRef rhs = this.walk(ce.e2); + + DFAVar* rhsVar = rhs.getContextVar; + DFALatticeRef ret = this.seeLogicalAnd(lhs, rhs); + + if (rhsVar !is null) + ret.setContext(rhsVar); + + return ret; + } + + case EXP.structLiteral: + { + auto sle = expr.isStructLiteralExp; + + if (sle.elements !is null) + { + foreach (ele; *sle.elements) + { + if (ele is null) + continue; + + if (auto ae = ele.isAddrExp) + { + if (auto sle2 = ae.e1.isStructLiteralExp) + { + if (sle.origin is sle2.origin) + continue; + } + } + + DFALatticeRef temp = this.walk(ele); + this.seeConvergeFunctionCallArgument(temp, null, 0, null, sle.loc); + } + } + + DFALatticeRef ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + return ret; + } + + case EXP.tuple: + { + auto te = expr.isTupleExp; + + DFAVar* expectedContext; + DFALatticeRef inProgress; + + if (te.e0 !is null) + { + inProgress = this.walk(te.e0); + expectedContext = inProgress.getContextVar; + } + + if (inProgress.isNull) + inProgress = dfaCommon.makeLatticeRef; + + if (te.exps !is null) + { + foreach (exp; *te.exps) + { + inProgress = this.seeLogicalAnd(inProgress, this.walk(exp)); + } + } + + if (inProgress.isNull) + inProgress = dfaCommon.makeLatticeRef; + + DFAConsequence* c = inProgress.addConsequence(expectedContext); + inProgress.setContext(c); + + if (expectedContext is null) + { + c.nullable = Nullable.Unknown; + c.truthiness = Truthiness.Unknown; + } + + return inProgress; + } + + case EXP.question: + { + auto qe = expr.isCondExp; + + auto origScope = dfaCommon.currentDFAScope; + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Question expression %p:%p ", dfaCommon.currentDFAScope, origScope); + appendLoc(ob, qe.loc); + ob.writestring("\n"); + }); + + bool ignoreTrueBranch, ignoreFalseBranch; + bool unknownBranchTaken; + int predicateNegation; + DFALatticeRef conditionLR; + DFAVar* conditionVar; + + { + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + + dfaCommon.printStateln("Question condition:"); + conditionLR = this.walkCondition(qe.econd, predicateNegation); + conditionVar = conditionLR.getGateConsequenceVariable; + + stmtWalker.endScope; + } + + { + dfaCommon.printStateln("Question true branch:"); + stmtWalker.startScope; + dfaCommon.currentDFAScope.inConditional = true; + + DFAConsequence* c = conditionLR.getContext; + if (c !is null) + { + if (c.truthiness == Truthiness.False) + ignoreTrueBranch = true; + else if (c.truthiness == Truthiness.True) + ignoreFalseBranch = true; + else + unknownBranchTaken = true; + } + else + unknownBranchTaken = true; + + DFALatticeRef trueCondition = this.adaptConditionForBranch(conditionLR.copy, + qe.econd.type, true); + this.seeSilentAssert(trueCondition, true, true); + stmtWalker.applyGateOnBranch(conditionVar, predicateNegation, true); + } + + DFAScopeRef scrTrue, scrFalse; + DFALatticeRef lrTrue, lrFalse; + + if (!ignoreTrueBranch) + { + lrTrue = this.walk(qe.e1); + assert(dfaCommon.currentDFAScope !is origScope); + } + + scrTrue = stmtWalker.endScope; + scrTrue.check; + + assert(dfaCommon.currentDFAScope is origScope); + + { + dfaCommon.printStateln("Question false branch:"); + stmtWalker.startScope; + dfaCommon.currentDFAScope.inConditional = true; + + if (!ignoreTrueBranch) + { + DFALatticeRef falseCondition = this.adaptConditionForBranch(conditionLR.copy, + qe.econd.type, false); + this.seeSilentAssert(falseCondition, true, true); + } + + stmtWalker.applyGateOnBranch(conditionVar, predicateNegation, false); + + if (!ignoreFalseBranch) + lrFalse = this.walk(qe.e2); + + scrFalse = stmtWalker.endScope; + scrFalse.check; + } + + return this.seeConditional(conditionLR, scrTrue, lrTrue, + scrFalse, lrFalse, unknownBranchTaken, predicateNegation); + } + + case EXP.delegate_: + case EXP.function_: + // known no-op + return DFALatticeRef.init; + + case EXP.concatenate: + { + auto be = expr.isBinExp; + auto beTypeBT = be.type.toBasetype; + const lhsIsArray = be.e1.type.toBasetype.equals(beTypeBT); + const rhsIsArray = be.e2.type.toBasetype.equals(beTypeBT); + const op = [3, 1, 4, 0][lhsIsArray + (rhsIsArray * 2)]; + + return concatenateTwo(be, op); + } + + case EXP.vector: + case EXP.vectorArray: + case EXP.delegatePointer: + case EXP.delegateFunctionPointer: + auto ue = expr.isUnaExp; + return this.walk(ue.e1); + + case EXP.throw_: + auto te = expr.isThrowExp; + dfaCommon.currentDFAScope.haveJumped = true; + dfaCommon.currentDFAScope.haveReturned = true; + return this.walk(te.e1); + + case EXP.type: + // holds a type, known no-op + return DFALatticeRef.init; + + case EXP.reserved: + + // Other + case EXP.is_: //is() + case EXP.array: + case EXP.delete_: + case EXP.dotIdentifier: + case EXP.dotTemplateInstance: + case EXP.dotType: + case EXP.dollar: + case EXP.template_: + case EXP.dotTemplateDeclaration: + case EXP.dSymbol: + case EXP.uadd: + case EXP.remove: + case EXP.newAnonymousClass: + case EXP.classReference: + case EXP.thrownException: + + // Operators + + case EXP.dot: + + // Leaf operators + case EXP.identifier: + case EXP.interpolated: + case EXP.super_: + case EXP.error: + + case EXP.import_: + case EXP.mixin_: + case EXP.break_: + case EXP.continue_: + case EXP.goto_: + case EXP.scope_: + + case EXP.traits: + case EXP.overloadSet: + case EXP.line: + case EXP.file: + case EXP.fileFullPath: + case EXP.moduleString: // __MODULE__ + case EXP.functionString: // __FUNCTION__ + case EXP.prettyFunction: // __PRETTY_FUNCTION__ + + case EXP.voidExpression: + case EXP.cantExpression: + case EXP.showCtfeContext: + case EXP.objcClassReference: + case EXP.compoundLiteral: // ( type-name ) { initializer-list } + case EXP._Generic: + case EXP.interval: + + case EXP.rvalue: + if (dfaCommon.debugUnknownAST) + { + fprintf(stderr, "Unknown DFA walk expression %d at %s\n", + expr.op, expr.loc.toChars); + assert(0); + } + else + return DFALatticeRef.init; + } + } + + /// Walks an expression that is used for a condition i.e. and if statement. + /// Tells you if the expression for the gate variable, will be exact, vs negated state. + /// Applying by test is for when (expr) > 0, use 0 for unknown, 1 is <= 0 and 2 is > 0 + /// Returns: 0 for unknown negation, 1 or has been negated from gate variable or 2 if it hasn't been. + DFALatticeRef walkCondition(Expression expr, out int predicateNegation) + { + bool allGateConditional = true; + bool outComeNegated; + + dfaCommon.edepth++; + + scope (exit) + { + dfaCommon.edepth--; + + if (!allGateConditional) + predicateNegation = 0; + else + predicateNegation = outComeNegated ? 1 : 2; + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("[%p]%3d walkCondition (%s): at ", expr, expr.op, + AllExprOpNames[expr.op].ptr); + appendLoc(ob, expr.loc); + ob.writestring("\n"); + }); + + int negateApplyByTest(int val) + { + if (val == 1) + return 2; + else if (val == 2) + return 1; + else + return 0; + } + + bool canBeInverted(Expression expr) + { + switch (expr.op) + { + + case EXP.typeid_: + case EXP.arrayLiteral: + case EXP.assocArrayLiteral: + case EXP.arrayLength: + case EXP.null_: + case EXP.cast_: + case EXP.variable: + default: + return false; + + case EXP.int64: + case EXP.string_: + return true; + + case EXP.not: // !x + auto ue = expr.isUnaExp; + if (ue.e1.isInExp) + return false; + return canBeInverted(ue.e1); + + case EXP.orOr: + case EXP.notEqual: // != + case EXP.notIdentity: // !is + case EXP.equal: // == + case EXP.identity: // is + case EXP.lessThan: + case EXP.lessOrEqual: + case EXP.greaterThan: + case EXP.greaterOrEqual: + auto be = expr.isBinExp; + return canBeInverted(be.e1) && canBeInverted(be.e2); + } + } + + DFALatticeRef seeExp(Expression expr, ref bool negated, int applyByTest) + { + dfaCommon.check; + dfaCommon.edepth++; + scope (exit) + { + dfaCommon.check; + dfaCommon.edepth--; + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("[%p]%3d walkCondition.seeExp (%s): at ", expr, + expr.op, AllExprOpNames[expr.op].ptr); + appendLoc(ob, expr.loc); + ob.writestring("\n"); + }); + + switch (expr.op) + { + case EXP.not: // !x + { + negated = !negated; // !!x + auto ue = expr.isUnaExp; + + if (auto ie = ue.e1.isInExp) + { + allGateConditional = false; + + DFALatticeRef lhs = seeExp(ie.e1, negated, 0); + lhs.check; + + DFALatticeRef rhs = seeExp(ie.e2, negated, 0); + rhs.check; + + DFAVar* rhsVar = rhs.getContextVar; + + // change comparison to: lhs in rhs[...] + if (rhsVar !is null) + rhs.setContext(dfaCommon.findIndexVar(rhsVar)); + + return this.seeEqual(lhs, rhs, false, ie.e1.type, ie.e2.type); + } + else + { + DFALatticeRef lr = seeExp(ue.e1, negated, negateApplyByTest(applyByTest)); + return (applyByTest != 0) ? lr : seeNegate(lr, ue.type); + } + } + + case EXP.notEqual: // != + { + negated = !negated; + auto be = expr.isBinExp; + + bool negated2; + + dfaCommon.printStateln("!equal lhs"); + DFALatticeRef lhs = seeExp(be.e1, negated2, 0); + dfaCommon.printStateln("!equal rhs"); + DFALatticeRef rhs = seeExp(be.e2, negated2, 0); + + return seeEqual(lhs, rhs, applyByTest == 2, be.e1.type, be.e2.type); + } + + case EXP.notIdentity: // !is + { + negated = !negated; + auto be = expr.isBinExp; + + bool negated2; + + dfaCommon.printStateln("!is lhs"); + DFALatticeRef lhs = seeExp(be.e1, negated2, 0); + dfaCommon.printStateln("!is rhs"); + DFALatticeRef rhs = seeExp(be.e2, negated2, 0); + + return seeEqualIdentity(lhs, rhs, applyByTest == 2, be.e1.type, be.e2.type); + } + + case EXP.equal: // == + { + auto be = expr.isBinExp; + bool negated2; + + dfaCommon.printStateln("equal lhs"); + DFALatticeRef lhs = seeExp(be.e1, negated2, 0); + dfaCommon.printStateln("equal rhs"); + DFALatticeRef rhs = seeExp(be.e2, negated2, 0); + + return seeEqual(lhs, rhs, applyByTest != 1, be.e1.type, be.e2.type); + } + + case EXP.identity: // is + { + auto be = expr.isBinExp; + bool negated2; + + dfaCommon.printStateln("is lhs"); + DFALatticeRef lhs = seeExp(be.e1, negated2, 0); + dfaCommon.printStateln("is rhs"); + DFALatticeRef rhs = seeExp(be.e2, negated2, 0); + + return seeEqualIdentity(lhs, rhs, applyByTest != 1, be.e1.type, be.e2.type); + } + + case EXP.string_: + { + auto se = expr.isStringExp; + + // A string literal even when empty will be non-null and true. + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + DFAVar* var = dfaCommon.getInfiniteLifetimeVariable; + DFAConsequence* cctx = ret.addConsequence(var); + ret.setContext(cctx); + + cctx.truthiness = se.len > 0 ? Truthiness.True : Truthiness.Maybe; + cctx.nullable = Nullable.NonNull; + cctx.obj = dfaCommon.makeObject; + cctx.pa = DFAPAValue(se.len); + return ret; + } + + case EXP.typeid_: + { + auto te = expr.isTypeidExp; + DFALatticeRef ret; + + void seeTypeIdObject(RootObject ro) + { + if (auto e = isExpression(te.obj)) + { + // [!val] does not effect the literal, gate capabilitiy + DFALatticeRef temp = seeExp(e, negated, 0); + + if (!ret.isNull) + ret = this.seeLogicalAnd(ret, temp); + else + ret = temp; + } + else if (auto v = isTuple(te.obj)) + { + foreach (obj; v.objects) + { + seeTypeIdObject(obj); + } + } + } + + seeTypeIdObject(te.obj); + + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + DFAVar* var = dfaCommon.getInfiniteLifetimeVariable; + DFAConsequence* cctx = ret.addConsequence(var); + ret.setContext(cctx); + + cctx.truthiness = Truthiness.True; + cctx.nullable = Nullable.NonNull; + cctx.obj = dfaCommon.makeObject; + return ret; + } + + case EXP.arrayLiteral: + { + auto ale = expr.isArrayLiteralExp; + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + if (ale.elements !is null && ale.elements.length > 0) + { + foreach (ele; *ale.elements) + { + if (ele !is null) + this.seeConvergeFunctionCallArgument(seeExp(ele, + negated, 0), null, 0, null, ele.loc); + } + + DFAVar* var = dfaCommon.getInfiniteLifetimeVariable; + DFAConsequence* cctx = ret.addConsequence(var); + ret.setContext(cctx); + + cctx.truthiness = Truthiness.True; + cctx.nullable = Nullable.NonNull; + cctx.pa = DFAPAValue(ale.elements.length); + cctx.obj = dfaCommon.makeObject; + } + else + ret.acquireConstantAsContext(Truthiness.Maybe, Nullable.Null, null); + + return ret; + } + + case EXP.assocArrayLiteral: + { + auto aale = expr.isAssocArrayLiteralExp; + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + if (aale.keys !is null && aale.keys.length > 0) + { + DFAVar* var = dfaCommon.getInfiniteLifetimeVariable; + DFAConsequence* cctx = ret.addConsequence(var); + ret.setContext(cctx); + + cctx.truthiness = Truthiness.True; + cctx.nullable = Nullable.NonNull; + cctx.obj = dfaCommon.makeObject; + } + else + ret.acquireConstantAsContext(Truthiness.False, Nullable.Null, null); + + return ret; + } + + case EXP.arrayLength: + { + // This is supposed to be a read only, + // Lowered assign expression will handle the write version. + + auto ue = expr.isUnaExp; + + DFALatticeRef ret = seeExp(ue.e1, negated, 0); + DFAConsequence* cctx = ret.getContext; + + if (ret.isNull) + { + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext; + } + else if (cctx is null || cctx.var is null) + ret.acquireConstantAsContext; + else + { + DFAVar* ctx = dfaCommon.findSliceLengthVar(cctx.var); + + DFAConsequence* newCctx = ret.addConsequence(ctx); + newCctx.truthiness = cctx.truthiness; + newCctx.pa = cctx.pa; + newCctx.maybe = cctx.var; + + ret.setContext(newCctx); + } + + return ret; + } + + case EXP.null_: + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + DFAConsequence* c = ret.addConsequence(null); + ret.setContext(c); + + c.truthiness = Truthiness.False; + c.nullable = Nullable.Null; + c.pa = DFAPAValue(0); + + return ret; + } + + case EXP.int64: + { + auto ie = expr.isIntegerExp; + + auto b = ie.toBool; + if (!b.isPresent) + return DFALatticeRef.init; + + DFALatticeRef ret = dfaCommon.makeLatticeRef; + DFAConsequence* c = ret.addConsequence(null); + ret.setContext(c); + + auto ty = ie.type.toBasetype().ty; + + if (ty != Tpointer) + { + c.pa = DFAPAValue(0); + const value = ie.getInteger(); + + switch (ty) + { + case Tbool: + c.pa.value = value != 0; + break; + + case Tint8: + c.pa.value = cast(byte) value; + break; + + case Tchar: + case Tuns8: + c.pa.value = cast(ubyte) value; + break; + + case Tint16: + c.pa.value = cast(short) value; + break; + + case Twchar: + case Tuns16: + c.pa.value = cast(ushort) value; + break; + + case Tint32: + c.pa.value = cast(int) value; + break; + + case Tdchar: + case Tuns32: + c.pa.value = cast(uint) value; + break; + + case Tint64: + c.pa.value = cast(long) value; + break; + + case Tuns64: + c.pa.value = cast(ulong) value; + + if (value > long.max) + c.pa.kind = DFAPAValue.Kind.UnknownUpperPositive; + break; + + default: + printf("integer type %d\n", ty); + assert(0, "Unknown integer type"); + } + + c.truthiness = c.pa.value > 0 ? Truthiness.True : Truthiness.False; + } + + return ret; + } + + case EXP.cast_: + { + auto ce = expr.isCastExp; + + dfaCommon.printState((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("cast to %d\n", + ce.to !is null ? ce.to.ty : -1)); + + DFALatticeRef ret = seeExp(ce.e1, negated, 0); + ret.check; + + if (ce.to is null || ce.to.isTypeClass || ce.to is Type.tvoid) + { + // For classes: ideally we'd model up casts, and only disallow down casts + // For void: no side effects wrt. convergance + + ret = dfaCommon.makeLatticeRef; + ret.acquireConstantAsContext(Truthiness.Unknown, Nullable.Unknown, null); + } + else + { + if (ret.isNull) + ret = dfaCommon.makeLatticeRef; + + bool paHandled; + + DFAVar* baseVar; + DFAConsequence* cctx = ret.getContext(baseVar); + if (cctx is null) + cctx = ret.acquireConstantAsContext; + + if (baseVar !is null) + { + if (baseVar.isNullable && !isTypeNullable(ce.to)) + { + // This prevents pointer integer checks from infecting pointers + + cctx = ret.acquireConstantAsContext(cctx.truthiness, + cctx.nullable, null); + } + else if (baseVar.isStaticArray && ce.to.isTypeDArray) + { + DFAVar* asSliceVar = dfaCommon.findAsSliceVar(baseVar); + + Truthiness truthiness = cctx.truthiness; + DFAPAValue oldPA = cctx.pa; + DFAObject* newObj = cctx.obj !is null ? cctx.obj + : dfaCommon.makeObject(baseVar); + + cctx = ret.addConsequence(asSliceVar); + ret.setContext(cctx); + + cctx.nullable = Nullable.NonNull; + cctx.truthiness = truthiness; + cctx.pa = oldPA; + cctx.obj = newObj; + } + } + + // If we're doing any kind of cast to anything that is not an integer, + // we have no idea if VRP is going to still be accurate. + if (!paHandled && !cctx.pa.canFitIn(ce.to)) + cctx.pa = DFAPAValue.Unknown; + } + + return ret; + } + + case EXP.variable: + { + auto ve = expr.isVarExp; + assert(ve !is null); + + DFALatticeRef ret; + + if (ve.var !is null) + { + if (auto vd = ve.var.isVarDeclaration) + { + if (vd.ident is Id.withSym) + { + // Copied from function semantic analysis checkNestedReference function. + // With statements sometimes have temporaries that do get written out, + // pretend we're the initializer instead. + + auto ez = vd._init.isExpInitializer(); + assert(ez); + + Expression e = ez.exp; + if (e.op == EXP.construct || e.op == EXP.blit) + e = (cast(AssignExp) e).e2; + + return this.walk(e); + } + + DFAVar* var = dfaCommon.findVariable(vd); + + if (var !is null) + { + ret = dfaCommon.acquireLattice(var); + ret.check; + assert(!ret.isNull); + + if (applyByTest != 0) + { + DFAConsequence* cctx = ret.getContext; + assert(cctx !is null); + + if (var.isNullable && cctx.nullable == Nullable.Unknown) + cctx.nullable = applyByTest == 2 + ? Nullable.NonNull : Nullable.Null; + + if (var.isTruthy && cctx.truthiness == Truthiness.Unknown) + cctx.truthiness = applyByTest == 2 + ? Truthiness.True : Truthiness.False; + } + + return ret; + } + } + } + + // no other declarations really apply for the DFA + ret = dfaCommon.makeLatticeRef; + ret.setContext(dfaCommon.getUnknownVar); + + return ret; + } + + default: + allGateConditional = false; + return this.walk(expr); + } + } + + DFALatticeRef seeExpInOr(Expression expr, bool invert) + { + dfaCommon.check; + dfaCommon.edepth++; + scope (exit) + { + dfaCommon.check; + dfaCommon.edepth--; + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("[%p]%3d walkCondition.seeExpInOr (%s): at ", expr, + expr.op, AllExprOpNames[expr.op].ptr); + appendLoc(ob, expr.loc); + ob.writestring("\n"); + }); + + switch (expr.op) + { + case EXP.orOr: + int predicateNegation; + DFALatticeRef ret = walkCondition(expr.isLogicalExp, predicateNegation); + if (invert) + return this.seeNegate(ret, expr.type); + else + return ret; + + case EXP.lessThan: + if (invert) + goto GreaterThan; + LessThan: + // < becomes > + auto be = expr.isBinExp; + bool negated; + + DFALatticeRef lhs = seeExp(be.e2, negated, 0); + DFALatticeRef rhs = seeExp(be.e1, negated, 0); + return this.seeGreaterThan(false, lhs, rhs); + + case EXP.lessOrEqual: + if (invert) + goto GreaterThanEqual; + LessThanEqual: + // <= becomes >= + auto be = expr.isBinExp; + bool negated; + + DFALatticeRef lhs = seeExp(be.e2, negated, 0); + DFALatticeRef rhs = seeExp(be.e1, negated, 0); + return this.seeGreaterThan(true, lhs, rhs); + + case EXP.greaterThan: + if (invert) + goto LessThan; + GreaterThan: + auto be = expr.isBinExp; + bool negated; + + DFALatticeRef lhs = seeExp(be.e1, negated, 0); + DFALatticeRef rhs = seeExp(be.e2, negated, 0); + return this.seeGreaterThan(false, lhs, rhs); + + case EXP.greaterOrEqual: + if (invert) + goto LessThanEqual; + GreaterThanEqual: + auto be = expr.isBinExp; + bool negated; + + DFALatticeRef lhs = seeExp(be.e1, negated, 0); + DFALatticeRef rhs = seeExp(be.e2, negated, 0); + return this.seeGreaterThan(true, lhs, rhs); + + default: + bool negated; + return seeExp(expr, negated, invert ? 1 : 2); + } + } + + // In theory a gate condition can support more expressions, but to be on the safe side, let's call this good. + switch (expr.op) + { + case EXP.not: // !x + case EXP.variable: + case EXP.cast_: + case EXP.null_: + case EXP.int64: + case EXP.arrayLength: + case EXP.string_: + case EXP.typeid_: + case EXP.arrayLiteral: + case EXP.assocArrayLiteral: + case EXP.equal: // == + case EXP.identity: // is + case EXP.notEqual: // != + case EXP.notIdentity: // !is + return seeExp(expr, outComeNegated, 0); + + case EXP.orOr: + { + const canThisBeInverted = canBeInverted(expr); + auto oe = expr.isLogicalExp; + DFALatticeRef inProgress; + + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + scope (exit) + stmtWalker.endScope; + + while (oe !is null) + { + DFALatticeRef lhs; + DFALatticeRef toNegate; + + { + // Make sure any effects converged into the scope by and expressions ext. don't effect rhs + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + + if (canThisBeInverted) + { + dfaCommon.printStructureln("Or expression lhs:"); + + lhs = seeExpInOr(oe.e1, false); + } + else + { + dfaCommon.printStructureln("Or expression lhs walk-adapt:"); + lhs = this.walk(oe.e1); + toNegate = this.adaptConditionForBranch(lhs.copy, oe.e1.type, false); + } + + seeRead(lhs, oe.e1.loc); + lhs.printState("or lhs", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + + stmtWalker.endScope; + + if (inProgress.isNull) + inProgress = lhs; + else + inProgress = seeLogicalOr(inProgress, lhs); + } + + if (toNegate.isNull) + { + dfaCommon.printStructureln("Or expression lhs inverted:"); + this.seeSilentAssert(seeExpInOr(oe.e1, true)); + } + else + { + this.seeSilentAssert(toNegate, false, true); + } + + if (oe.e2.op == EXP.orOr) + { + oe = oe.e2.isLogicalExp; + continue; + } + else + { + // Make sure any effects converged into the scope by and expressions ext. don't effect rhs or return + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + + // e2 is the right most or expression in chain (a || b || c) where it is c + dfaCommon.printStructureln("Or expression rhs:"); + // don't care about seeExpInOr here, can just do a normal walk + DFALatticeRef rhs = this.walk(oe.e2); + rhs.printState("or rhs", dfaCommon.sdepth, + dfaCommon.currentFunction, dfaCommon.edepth); + seeRead(rhs, oe.e2.loc); + + stmtWalker.endScope; + + inProgress = seeLogicalOr(inProgress, rhs); + break; + } + } + + return inProgress; + } + + default: + return this.walk(expr); + } + } + + DFALatticeRef walkMathOp(BinExp be, PAMathOp op) + { + dfaCommon.printStateln("math op lhs"); + DFALatticeRef lhs = this.walk(be.e1); + seeReadMathOp(lhs, be.e1.loc); + lhs.check; + + dfaCommon.printStateln("math op rhs"); + DFALatticeRef rhs = this.walk(be.e2); + seeReadMathOp(rhs, be.e2.loc); + rhs.check; + + DFALatticeRef ret = this.seeMathOp(lhs, rhs, be.type, op); + ret.check; + return ret; + } + + DFALatticeRef walkMathAssignOp(BinExp be, PAMathOp op) + { + dfaCommon.printStateln("math assign1 op lhs"); + DFALatticeRef lhs = this.walk(be.e1); + assert(!lhs.isNull); + lhs.check; + + DFAConsequence* lhsCctx = lhs.getContext; + assert(lhsCctx !is null); + + dfaCommon.printStateln("math assign1 op rhs"); + DFALatticeRef rhs = this.walk(be.e2); + rhs.check; + seeReadMathOp(rhs, be.e2.loc); + + DFAPAValue oldPA; + bool useOldPA; + + if (op == PAMathOp.postInc) + { + op = PAMathOp.add; + useOldPA = true; + oldPA = lhsCctx.pa; + } + else if (op == PAMathOp.postDec) + { + op = PAMathOp.sub; + useOldPA = true; + oldPA = lhsCctx.pa; + } + + DFAObject* lhsObject = lhsCctx.obj; + DFALatticeRef ret = this.seeMathOp(lhs.copy, rhs, be.type, op); + ret.check; + + ret = this.seeAssign(lhs, false, ret, be.loc); + ret.check; + + { + DFAConsequence* cctx; + + if (useOldPA) + { + cctx = ret.acquireConstantAsContext; + cctx.pa = oldPA; + } + else + cctx = ret.getContext; + + cctx.obj = lhsObject; + + if (lhsObject !is null) + lhsObject.mayNotBeExactPointer = true; + } + + return ret; + } + + DFALatticeRef walkMathAssignOp(UnaExp ue, DFALatticeRef rhs, PAMathOp op) + { + dfaCommon.printStateln("math assign2 op lhs"); + DFALatticeRef lhs = this.walk(ue.e1); + assert(!lhs.isNull); + lhs.check; + + DFAConsequence* lhsCctx = lhs.getContext; + assert(lhsCctx !is null); + DFAObject* lhsObject = lhsCctx.obj; + + DFALatticeRef ret = this.seeMathOp(lhs.copy, rhs, ue.type, op); + ret.check; + seeReadMathOp(rhs, ue.loc); + + ret = this.seeAssign(lhs, false, ret, ue.loc); + ret.check; + + DFAConsequence* cctx = ret.getContext; + cctx.obj = lhsObject; + + if (lhsObject !is null) + lhsObject.mayNotBeExactPointer = true; + + ret.printStructure("math assign2 ret"); + return ret; + } + + DFALatticeRef callFunction(FuncDeclaration toCallFunction, Expression thisPointer, + Expression argPrefix, Expressions* arguments, ref Loc loc) + { + TypeFunction toCallFunctionType = toCallFunction !is null ? toCallFunction + .type.isFunction_Delegate_PtrToFunction : null; + + if (thisPointer !is null) + { + // Extract from the this pointer expression the function to call. + + if (auto dve = thisPointer.isDotVarExp) + { + if (auto fd = dve.var.isFuncDeclaration) + { + // e1.method() + thisPointer = dve.e1; + toCallFunction = fd; + toCallFunctionType = toCallFunction.type.isFunction_Delegate_PtrToFunction; + } + } + else if (auto ve = thisPointer.isVarExp) + { + // method() + thisPointer = null; + toCallFunctionType = ve.var.type.isFunction_Delegate_PtrToFunction; + } + } + + if (toCallFunction !is null && toCallFunction.ident !is null) + { + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Calling function `%s` at ", toCallFunction.ident.toChars); + appendLoc(ob, loc); + ob.writestring(" from "); + appendLoc(ob, toCallFunction.loc); + ob.writestring("\n"); + }); + } + else if (loc.isValid) + { + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("Calling function at "); + appendLoc(ob, loc); + + if (toCallFunction !is null) + { + ob.writestring(" from "); + appendLoc(ob, toCallFunction.loc); + } + + ob.writestring("\n"); + }); + } + else + dfaCommon.printStateln("Calling function"); + + const functionIsNoReturn = (toCallFunction !is null && toCallFunction.noreturn) || (toCallFunctionType !is null + && toCallFunctionType.next !is null + && toCallFunctionType.next.isTypeNoreturn !is null); + + { + ParametersDFAInfo* calledFunctionInfo; + ParameterDFAInfo* thisPointerInfo; + ParameterDFAInfo* returnInfo; + + if (toCallFunction !is null && toCallFunction.parametersDFAInfo) + { + calledFunctionInfo = toCallFunction.parametersDFAInfo; + thisPointerInfo = &calledFunctionInfo.thisPointer; + returnInfo = &calledFunctionInfo.returnValue; + } + + stmtWalker.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + + if (thisPointer !is null) + { + dfaCommon.printStateln("This:"); + DFALatticeRef thisExp = this.walk(thisPointer); + + if (isTypeNullable(thisPointer.type)) + thisExp = this.seeDereference(thisPointer.loc, thisExp); + + this.seeConvergeFunctionCallArgument(thisExp, thisPointerInfo, + 0, toCallFunction, thisPointer.loc); + } + + if (argPrefix !is null) + { + dfaCommon.printStateln("Argument prefix:"); + DFALatticeRef argPrefixLR = this.walk(argPrefix); + this.seeConvergeFunctionCallArgument(argPrefixLR, null, 0, + toCallFunction, argPrefix.loc); + } + + if (arguments !is null && arguments.length > 0) + { + Parameter[] allParameters; + VarDeclaration[] allParameterVars; + ParameterDFAInfo[] allInfos = calledFunctionInfo !is null ? calledFunctionInfo.parameters + : null; + + if (toCallFunctionType !is null) + { + TypeFunction functionType = toCallFunctionType.toTypeFunction; + + if (functionType.parameterList.parameters !is null + && functionType.parameterList.parameters.length != 0) + { + allParameters = (*functionType.parameterList.parameters)[]; + } + } + + if (toCallFunction !is null) + { + if (toCallFunction.parameters !is null && toCallFunction.parameters.length != 0) + { + allParameterVars = (*toCallFunction.parameters)[]; + } + } + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("Calling function parameter info\n"); + + prefix(" "); + ob.printf("count=%zd, calledFunctionInfo=%p:%zd\n", arguments.length, calledFunctionInfo, + calledFunctionInfo !is null ? calledFunctionInfo.parameters.length : 0); + + prefix(" "); + ob.printf("allParameters=%zd, allParameterVars=%zd\n", + allParameters.length, allParameterVars.length); + }); + + foreach (i, arg; *arguments) + { + Parameter* param = i < allParameters.length ? &allParameters.ptr[i] : null; + VarDeclaration paramVar = i < allParameterVars.length + ? allParameterVars.ptr[i] : null; + const storageClass = (param !is null ? param.storageClass : 0) | (paramVar !is null + ? paramVar.storage_class : 0); + ParameterDFAInfo* info = i < allInfos.length ? &allInfos.ptr[i] : null; + + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Argument %zd, stc=%lld", i, storageClass); + ob.writestring("\n"); + + if (info !is null) + { + ob.printf(" info %d:%d", info.notNullIn, info.notNullOut); + ob.writestring("\n"); + } + }); + + DFALatticeRef argExp = this.walk(arg); + this.seeConvergeFunctionCallArgument(argExp, info, + storageClass, toCallFunction, loc); + + if (dfaCommon.currentDFAScope.haveJumped) + break; + } + } + + stmtWalker.endScope; + + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + if (returnInfo !is null && returnInfo.notNullOut == Fact.Guaranteed) + ret.acquireConstantAsContext(Truthiness.True, + Nullable.NonNull, dfaCommon.makeObject); + else + ret.acquireConstantAsContext; + + // If the function is no return, or it hasn't been semantically analysed yet, + // we'll assume it can't return. + // Otherwise we get false positives. + if (functionIsNoReturn) + { + dfaCommon.currentDFAScope.haveJumped = true; + dfaCommon.currentDFAScope.haveReturned = true; + } + + return ret; + } + } + } + + DFALatticeRef concatenateTwo(BinExp be, int op, bool assign = false) + { + // Whatever lhs started out as, it'll be non-null once we're done with it. + + const nullableResult = concatNullableResult(be.e1.type, be.e2.type); + dfaCommon.printState((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf( + "concat nullableResult=%d, op=%d\n", nullableResult, op)); + + dfaCommon.printStateln("concat lhs"); + DFALatticeRef lhs = this.walk(be.e1); + dfaCommon.printStateln("concat rhs"); + DFALatticeRef rhs = this.walk(be.e2); + + DFAConsequence* lhsCctx = lhs.getContext, rhsCctx = rhs.getContext; + + if (lhsCctx is null || rhsCctx is null) + { + // We can't analyse this. + return DFALatticeRef.init; + } + + DFAPAValue pa; + + if (op == 0) + { + // T[] ~ T[] + pa = rhsCctx.pa; + pa.addFrom(lhsCctx.pa, Type.tuns64); + } + else if (op == 1) + { + // T[] ~ T + pa = lhsCctx.pa; + pa.addFrom(DFAPAValue(1), Type.tuns64); + } + else if (op == 2) + { + // T[] ~ dchar + // We have no idea how many code units the dchar will encode as + pa = DFAPAValue.Unknown; + } + else if (op == 3) + { + // T ~ T + pa = DFAPAValue(2); + } + else if (op == 4) + { + // T ~ T[] + pa = rhsCctx.pa; + pa.addFrom(DFAPAValue(1), Type.tuns64); + } + + DFALatticeRef ret; + + if (assign) + { + rhsCctx.pa = pa; + ret = this.seeAssign(lhs, false, rhs, be.loc, false, + nullableResult == 1 || nullableResult == 2 ? 3 : 0); + } + else + { + + Truthiness expectedTruthiness; + Nullable expectedNullable; + + if (nullableResult == 2) + { + expectedTruthiness = Truthiness.True; + expectedNullable = Nullable.NonNull; + } + else if (nullableResult == 1) + { + expectedNullable = lhsCctx.nullable; + if (expectedNullable < rhsCctx.nullable) + expectedNullable = rhsCctx.nullable; + + if (expectedNullable == Nullable.NonNull) + expectedTruthiness = Truthiness.True; + } + + ret = this.seeLogicalAnd(lhs, rhs); + DFAConsequence* cctx = ret.acquireConstantAsContext; + + cctx.truthiness = expectedTruthiness; + cctx.nullable = expectedNullable; + cctx.pa = pa; + } + + return ret; + } + + void markUnmodellable(Expression e) + { + void perVar(VarDeclaration vd) + { + DFAVar* var = dfaCommon.findVariable(vd); + if (var !is null) + var.unmodellable = true; + } + + void perExpr(Expression expr) + { + if (auto ve = expr.isVarExp) + { + if (auto vd = ve.var.isVarDeclaration) + perVar(vd); + } + else if (auto be = expr.isBinExp) + { + perExpr(be.e1); + perExpr(be.e2); + } + else if (auto ue = expr.isUnaExp) + { + perExpr(ue.e1); + } + } + + perExpr(e); + } +} diff --git a/dmd/dfa/fast/report.d b/dmd/dfa/fast/report.d new file mode 100644 index 00000000000..5257b1ed339 --- /dev/null +++ b/dmd/dfa/fast/report.d @@ -0,0 +1,315 @@ +/** + * Reporting mechanism for the fast Data Flow Analysis engine. + * + * This module translates the abstract state of the DFA into concrete compiler errors. + * It is responsible for: + * 1. Null Checks: Reporting errors when null pointers are dereferenced. + * 2. Contract Validation: Ensuring functions fulfill their `out` contracts (e.g., returning non-null). + * 3. Logic Errors: Detecting assertions that are provably false at compile time. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/fast/report.d, dfa/fast/report.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_fast_report.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/fast/report.d + */ +module dmd.dfa.fast.report; +import dmd.dfa.fast.structure; +import dmd.location; +import dmd.func; +import dmd.errorsink; +import dmd.declaration; +import dmd.astenums; +import core.stdc.stdio; + +alias Fact = ParameterDFAInfo.Fact; + +/*********************************************************** + * The interface for reporting DFA errors and warnings. + * + * This struct acts as the sink for all findings. It checks if a specific + * violation (like a null dereference) should be reported based on the + * variable's modellability and depth, then sends it to the global `ErrorSink`. + */ +struct DFAReporter +{ + DFACommon* dfaCommon; + ErrorSink errorSink; + + /*********************************************************** + * Reports an error if a variable is dereferenced while known to be null. + * + * This is triggered by expressions like `*ptr` or `ptr.field` when the DFA + * determines `ptr` has a `Nullable.Null` state. + * + * Params: + * on = The consequence containing the variable state (must be Nullable). + * loc = The source location of the dereference. + */ + void onDereference(DFAConsequence* on, ref Loc loc) + { + if (!dfaCommon.debugUnknownAST && on is null) + return; + assert(on !is null); + if (on.var is null) + return; + + int fail; + assert(on.nullable != Nullable.NonNull); + + if (on.var is null || on.var.var is null) + fail = __LINE__; + else if (!on.var.isModellable) + fail = __LINE__; + else + { + if (on.var.declaredAtDepth >= dfaCommon.lastLoopyLabel.depth) + errorSink.error(loc, "Dereference on null variable `%s`", + on.var.var.ident.toChars); + else + fail = __LINE__; + } + } + + void onLoopyLabelLessNullThan(DFAVar* var, ref const Loc loc) + { + if (var !is null && !var.isModellable) + return; + + errorSink.error(loc, "Variable `%s` was required to be non-null and has become null", + var.var.ident.toChars); + } + + /*********************************************************** + * Validates constraints at the end of a scope. + * + * This checks if output parameters (like `out` or `ref` parameters) meet their + * guaranteed post-conditions. For example, if a function parameter is marked + * to guarantee a non-null output, this ensures the variable is actually non-null + * when the scope exits. + */ + void onEndOfScope(FuncDeclaration fd, ref const Loc loc) + { + // this is where we validate escapes, for a specific location + + if (!dfaCommon.currentDFAScope.haveReturned) + return; + + // validate/infer on to function + foreachFunctionVariable(dfaCommon, fd, (scv) { + ParameterDFAInfo* param = scv.var.param; + + if (scv.var.unmodellable || param is null) + return; + + DFAConsequence* cctx = scv.lr.getContext; + + assert(cctx !is null); + assert(cctx.var is scv.var); + + Fact suggestedNotNullOut = param.notNullOut; + + if (suggestedNotNullOut == Fact.Guaranteed && cctx.nullable != Nullable.NonNull) + suggestedNotNullOut = Fact.NotGuaranteed; + else if (suggestedNotNullOut == Fact.Unspecified && cctx.nullable == Nullable.NonNull) + suggestedNotNullOut = Fact.Guaranteed; + + assert(!param.specifiedByUser); + param.notNullOut = suggestedNotNullOut; + }); + } + + void onEndOfFunction(FuncDeclaration fd, ref Loc loc) + { + version (none) + { + printf("End of function attributes for `%s` at %s\n", fd.ident.toChars, loc.toChars); + } + + // validate/infer on to function + foreachFunctionVariable(dfaCommon, fd, (scv) { + ParameterDFAInfo* param = scv.var.param; + if (param is null) + return; + + version (none) + { + if (scv.var.var !is null) + printf("Variable %p `%s` ", scv.var, scv.var.var.ident.toChars); + else + printf("Variable %p ", scv.var); + + printf("%d %d:%d %d:%d %d\n", scv.var.unmodellable, scv.var.isTruthy, + scv.var.isNullable, scv.var.isByRef, scv.var.writeCount, + param.specifiedByUser); + printf(" notNullIn=%d, notNullOut=%d\n", param.notNullIn, param.notNullOut); + } + + if (scv.var.unmodellable) + { + if (!param.specifiedByUser) + { + param.specifiedByUser = false; + + if (scv.var.isNullable) + { + param.notNullIn = Fact.Unspecified; + param.notNullOut = Fact.Unspecified; + } + } + } + else if (!param.specifiedByUser) + { + if (scv.var.isNullable) + { + if (param.notNullIn == Fact.Unspecified) + param.notNullIn = Fact.NotGuaranteed; + + if (scv.var.isByRef) + { + if (scv.var.writeCount > 1) + { + if (param.notNullOut == Fact.Unspecified) + param.notNullOut = Fact.NotGuaranteed; + } + else + param.notNullOut = param.notNullIn; + } + else + { + param.notNullOut = Fact.Unspecified; + } + } + } + + version (none) + { + printf(" notNullIn=%d, notNullOut=%d\n", + cast(int) param.notNullIn, param.notNullOut); + } + }); + } + + /*********************************************************** + * Reports an error if an assertion is statically provable to be false. + * + * If the DFA determines that the condition `x` in `assert(x)` is definitively false + * (e.g., `assert(null)` or `assert(0)` after analysis), it reports this logic error. + */ + void onAssertIsFalse(ref DFALatticeRef lr, ref Loc loc) + { + DFAConsequence* cctx; + if (!(lr.isModellable && (lr.haveNonContext || (cctx = lr.getContext).var !is null))) + return; // ignore literals, too false positive heavy + + errorSink.error(loc, "Assert can be proven to be false"); + } + + /*********************************************************** + * Reports an error if a function argument violates the callee's expectations. + * + * Example: Passing `null` to a function parameter marked as requiring non-null. + */ + void onFunctionCallArgumentLessThan(DFAConsequence* c, + ParameterDFAInfo* paramInfo, FuncDeclaration calling, ref Loc loc) + { + if (c.var !is null && !c.var.isModellable) + return; + + errorSink.error(loc, "Argument is expected to be non-null but was null"); + + if (paramInfo.parameterId >= 0) + { + VarDeclaration param = (*calling.parameters)[paramInfo.parameterId]; + int argId = paramInfo.parameterId + calling.needThis; + errorSink.errorSupplemental(param.loc, + "For parameter `%s` in argument %d", param.ident.toChars, argId); + } + else + errorSink.errorSupplemental(calling.loc, "For parameter `this` in called function"); + } + + void onReadOfUninitialized(DFAVar* var, ref DFALatticeRef lr, ref Loc loc, bool forMathOp) + { + if (!var.isModellable || var.declaredAtDepth == 0 || (!forMathOp + && var.isFloatingPoint) || var.var is null) + return; + else if ((var.var.storage_class & STC.temp) != 0) + return; // Compiler generated, likely to be "fine" + else if (var.declaredAtDepth < dfaCommon.lastLoopyLabel.depth) + return; // Can we really know what state the variable is in? I don't think so. + + // The reason floating point is special cased here, is to allow catching of mathematical operations, + // on a floating point typed variable, that was default initialized. + // The NaN will propagate on that operation, which is basically never wanted. + // It is essentially a special case of uninitialized variables, + // where the default could never be what someone wants, even if it was zero. + const floatingPointDefaultInit = var.isFloatingPoint && var.wasDefaultInitialized; + + if (floatingPointDefaultInit) + { + errorSink.error(loc, + "Expression reads a default initialized variable that is a floating point type"); + errorSink.errorSupplemental(loc, + "It will have the value of Not Any Number(nan), it will be propagated with mathematical operations"); + + errorSink.errorSupplemental(var.var.loc, "For variable `%s`", var.var.ident.toChars); + errorSink.errorSupplemental(var.var.loc, + "Initialize to %s.nan or 0 explicitly to disable this error", var.var.type.kind); + } + else + { + errorSink.error(loc, + "Expression reads from an uninitialized variable, it must be written to at least once before reading"); + errorSink.errorSupplemental(var.var.loc, "For variable `%s`", var.var.ident.toChars); + } + + version (none) + { + lr.printActual("uninit report"); + + dfaCommon.allocator.allVariables((DFAVar* var) { + printf("var %p base1=%p, base2=%p, writeCount=%d, isStaticArray=%d", + var, var.base1, var.base2, var.writeCount, var.isStaticArray); + + if (var.var !is null) + { + printf(", `%s` at %s", var.var.ident.toChars, var.var.loc.toChars); + } + + printf("\n"); + }); + } + } +} + +private: + +void foreachFunctionVariable(DFACommon* dfaCommon, FuncDeclaration fd, + scope void delegate(DFAScopeVar* scv) del) +{ + DFAVar* var; + DFAScopeVar* scv; + + if (fd.vthis !is null) + { + var = dfaCommon.findVariable(fd.vthis); + scv = dfaCommon.acquireScopeVar(var); + del(scv); + } + + var = dfaCommon.getReturnVariable(); + scv = dfaCommon.acquireScopeVar(var); + del(scv); + + if (fd.parameters !is null) + { + foreach (i, param; *fd.parameters) + { + var = dfaCommon.findVariable(param); + scv = dfaCommon.acquireScopeVar(var); + del(scv); + } + } +} diff --git a/dmd/dfa/fast/statement.d b/dmd/dfa/fast/statement.d new file mode 100644 index 00000000000..9d0065a7ef0 --- /dev/null +++ b/dmd/dfa/fast/statement.d @@ -0,0 +1,1663 @@ +/** + * Statement walker for the fast Data Flow Analysis engine. + * + * This module implements the AST visitor that handles Control Flow. + * It is responsible for: + * 1. Managing Scopes: Pushing and popping `DFAScope` as it enters/leaves blocks. + * 2. Handling Branching: Splitting execution for `if` and `switch` statements. + * 3. Handling Loops: Managing state for `for`, `while`, and `do` loops. + * 4. Handling Jumps: Resolving `break`, `continue`, `goto`, and `return`. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/fast/statement.d, dfa/fast/statement.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_fast_statement.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/fast/statement.d + */ +module dmd.dfa.fast.statement; +import dmd.dfa.fast.analysis; +import dmd.dfa.fast.report; +import dmd.dfa.fast.expression; +import dmd.dfa.fast.structure; +import dmd.dfa.utils; +import dmd.common.outbuffer; +import dmd.visitor; +import dmd.visitor.foreachvar; +import dmd.location; +import dmd.func; +import dmd.identifier; +import dmd.statement; +import dmd.expression; +import dmd.typesem; +import dmd.timetrace; +import dmd.astenums; +import dmd.mtype; +import dmd.declaration; +import core.stdc.stdio; + +/*********************************************************** + * Visits Statement nodes to drive the Data Flow Analysis. + * + * This class navigates the structure of the function. When it encounters + * control flow (like an `if` statement), it acts as a traffic director: + * 1. It creates a new Scope for the "True" branch. + * 2. It analyzes that branch. + * 3. It creates a new Scope for the "False" branch. + * 4. It analyzes that branch. + * 5. It calls `analyzer.converge...` to merge the results back together. + */ +extern (D) class StatementWalker : SemanticTimeTransitiveVisitor +{ + alias visit = SemanticTimeTransitiveVisitor.visit; + + DFACommon* dfaCommon; + ExpressionWalker* expWalker; + DFAAnalyzer* analyzer; + int inLoopyLabel; + +final: + + void startScope() + { + DFAScopeRef scr; + scr.sc = dfaCommon.currentDFAScope; + scr.check; + scr.sc = null; + + dfaCommon.pushScope; + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf("Start scope %p:%p\n", + dfaCommon.currentDFAScope, dfaCommon.currentDFAScope.parent)); + dfaCommon.sdepth++; + } + + DFAScopeRef endScope() + { + Loc loc; + return this.endScope(loc); + } + + DFAScopeRef endScope(ref Loc endLoc, bool handleLabelPopping = true) + { + DFAScopeRef ret = dfaCommon.popScope; + dfaCommon.sdepth--; + + if (handleLabelPopping) + { + while (ret.sc.label !is null) + { + Loc loc = *cast(Loc*)&ret.sc.label.loc; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("End label scope %p:%p %s", ret.sc, + dfaCommon.currentDFAScope, ret.sc.label.ident.toChars); + if (loc.isValid) + appendLoc(ob, loc); + ob.writestring("\n"); + }); + + ret.printStructure("*=", dfaCommon.sdepth, dfaCommon.currentFunction); + ret.check; + + seeConvergeStatementLoopyLabels(ret, loc); + inLoopyLabel--; + + ret = dfaCommon.popScope; + dfaCommon.sdepth--; + } + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("End scope %p:%p", ret.sc, dfaCommon.currentDFAScope); + if (endLoc.isValid) + appendLoc(ob, endLoc); + ob.writestring("\n"); + }); + + ret.printStructure("*=", dfaCommon.sdepth, dfaCommon.currentFunction); + ret.check; + + dfaCommon.currentDFAScope.printStructure("parent", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + return ret; + } + + DFAScopeRef endScopeAndReport(ref Loc endLoc, bool endFunction = false) + { + analyzer.reporter.onEndOfScope(dfaCommon.currentFunction, endLoc); + if (endFunction) + analyzer.reporter.onEndOfFunction(dfaCommon.currentFunction, endLoc); + + DFAScopeRef ret = dfaCommon.popScope; + dfaCommon.sdepth--; + + while (ret.sc.label !is null) + { + Loc loc = *cast(Loc*)&ret.sc.label.loc; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("End label scope %p:%p %s", ret.sc, + dfaCommon.currentDFAScope, ret.sc.label.ident.toChars); + if (loc.isValid) + appendLoc(ob, loc); + ob.writestring("\n"); + }); + + ret.printStructure("*=", dfaCommon.sdepth, dfaCommon.currentFunction); + ret.check; + + seeConvergeStatementLoopyLabels(ret, loc); + inLoopyLabel--; + + ret = dfaCommon.popScope; + dfaCommon.sdepth--; + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("End scope %p:%p", ret.sc, dfaCommon.currentDFAScope); + if (endLoc.isValid) + appendLoc(ob, endLoc); + ob.writestring("\n"); + }); + + ret.printStructure("*=", dfaCommon.sdepth, dfaCommon.currentFunction); + ret.check; + + if (dfaCommon.currentDFAScope !is null) + { + dfaCommon.currentDFAScope.printStructure("parent", + dfaCommon.sdepth, dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + return ret; + } + + void seeConvergeStatement(DFAScopeRef scr, bool ignoreWriteCount = false, + bool unknownAware = false) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("Converging statement: %d\n", + unknownAware)); + scr.printStructure("input", dfaCommon.sdepth, dfaCommon.currentFunction); + scr.check; + + dfaCommon.check; + dfaCommon.currentDFAScope.printStructure("scope", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.check; + + analyzer.convergeStatement(scr, true, false, ignoreWriteCount, unknownAware); + + dfaCommon.currentDFAScope.printStructure("so far", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + + void seeConvergeScope(DFAScopeRef scr) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("Converging scope:\n")); + scr.printStructure("input", dfaCommon.sdepth, dfaCommon.currentFunction); + scr.check; + + dfaCommon.check; + dfaCommon.currentDFAScope.printStructure("scope", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.check; + + analyzer.convergeScope(scr); + + dfaCommon.currentDFAScope.printStructure("so far", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + + void seeConvergeStatementIf(DFALatticeRef condition, DFAScopeRef scrTrue, + DFAScopeRef scrFalse, bool haveFalseBody, bool unknownBranchTaken, + int predicateNegation) + { + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf( + "Converging statement if haveFalseBody=%d, unknownBranchTaken=%d, predicateNegation=%d:\n", + haveFalseBody, unknownBranchTaken, predicateNegation)); + condition.printState("condition", dfaCommon.sdepth, dfaCommon.currentFunction); + scrTrue.printStructure("true", dfaCommon.sdepth, dfaCommon.currentFunction); + scrFalse.printStructure("false", dfaCommon.sdepth, dfaCommon.currentFunction); + + dfaCommon.currentDFAScope.printStructure("scope", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + + dfaCommon.check; + analyzer.convergeStatementIf(condition, scrTrue, scrFalse, + haveFalseBody, unknownBranchTaken, predicateNegation); + dfaCommon.check; + + dfaCommon.currentDFAScope.printStructure("so far", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + + void applyGateOnBranch(DFAVar* gateVar, int predicateNegation, bool branch) + { + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf( + "Applying gate condition effect on branch %d, predicateNegation=%d for %p:\n", + branch, predicateNegation, gateVar)); + + analyzer.applyGateOnBranch(gateVar, predicateNegation, branch); + dfaCommon.currentDFAScope.check; + } + + void seeConvergeStatementLoopyLabels(DFAScopeRef scr) + { + Loc loc; + seeConvergeStatementLoopyLabels(scr, loc); + } + + void seeConvergeStatementLoopyLabels(DFAScopeRef scr, ref Loc loc) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring( + "Converging statement loopy labels:\n")); + scr.printStructure("input", dfaCommon.sdepth, dfaCommon.currentFunction); + scr.check; + + dfaCommon.currentDFAScope.printStructure("scope", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + + dfaCommon.check; + analyzer.convergeStatementLoopyLabels(scr, loc); + dfaCommon.check; + + dfaCommon.currentDFAScope.printStructure("so far", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + + void seeCheckForCaseBefore(ref DFAScopeRef containing, DFAScopeRef jumpedTo, ref const(Loc) loc) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring( + "Check case before & containing state:\n")); + + containing.printStructure("containing"); + containing.check; + + jumpedTo.printStructure("jumpedTo"); + jumpedTo.check; + + dfaCommon.check; + analyzer.loopyLabelBeforeContainingCheck(containing, jumpedTo, loc); + dfaCommon.check; + } + + void seeConvergeForwardGoto(DFAScopeRef scr) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("Converging forward goto:\n")); + scr.printStructure("input", dfaCommon.sdepth, dfaCommon.currentFunction); + scr.check; + + dfaCommon.currentDFAScope.printStructure("scope", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + + dfaCommon.check; + analyzer.convergeStatement(scr, false); + dfaCommon.check; + + dfaCommon.currentDFAScope.printStructure("so far", dfaCommon.sdepth, + dfaCommon.currentFunction); + dfaCommon.currentDFAScope.check; + } + + DFAScopeRef seeLoopyLabelAwareStage(DFAScopeRef previous, DFAScopeRef next) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("Loop stage:\n")); + previous.printStructure("previous", dfaCommon.sdepth, dfaCommon.currentFunction); + next.printStructure("next", dfaCommon.sdepth, dfaCommon.currentFunction); + + dfaCommon.check; + DFAScopeRef ret = analyzer.transferLoopyLabelAwareStage(previous, next); + dfaCommon.check; + + ret.printStructure("result", dfaCommon.sdepth, dfaCommon.currentFunction); + return ret; + } + + void seeGoto(DFAScope* toSc, bool isAfter) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf( + "Going to scope adding state after=%d\n", isAfter)); + + dfaCommon.check; + analyzer.transferGoto(toSc, isAfter); + dfaCommon.check; + } + + void seeForwardsGoto(Identifier ident) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("Going to label %s\n", ident.toChars)); + + dfaCommon.check; + analyzer.transferForwardsGoto(ident); + dfaCommon.check; + } + + void seeRead(ref DFALatticeRef lr, ref Loc loc) + { + dfaCommon.printStructureln("Seeing read of lr"); + lr.printState("read lr", dfaCommon.sdepth, dfaCommon.currentFunction, dfaCommon.edepth); + + analyzer.onRead(lr, loc); + } + + void constructVariable(VarDeclaration vd, bool isNonNull) + { + DFAVar* var = dfaCommon.findVariable(vd); + + DFALatticeRef lr = dfaCommon.makeLatticeRef; + DFAConsequence* c = lr.addConsequence(var); + lr.setContext(c); + c.nullable = isNonNull ? Nullable.NonNull : Nullable.Null; + + dfaCommon.check; + expWalker.seeConvergeExpression(expWalker.seeAssign(var, true, lr, *cast(Loc*)&vd.loc)); + dfaCommon.check; + } + + void start(FuncDeclaration fd) + { + dfaCommon.currentFunction = fd; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("Starting DFA walk on %s at ", fd.ident.toChars); + appendLoc(ob, fd.loc); + ob.writestring("\n"); + }); + + timeTraceBeginEvent(TimeTraceEventType.dfa); + scope (exit) + timeTraceEndEvent(TimeTraceEventType.dfa, fd); + + this.startScope; + dfaCommon.setScopeAsLoopyLabel; + + dfaCommon.check; + DFAScopeVar* scv; + + { + if (fd.parametersDFAInfo is null) + fd.parametersDFAInfo = new ParametersDFAInfo; + + if (fd.vthis !is null) + { + DFAVar* var = dfaCommon.findVariable(fd.vthis); + var.declaredAtDepth = dfaCommon.currentDFAScope.depth; + var.writeCount = 1; + var.param = &fd.parametersDFAInfo.thisPointer; + var.param.parameterId = -1; + scv = dfaCommon.acquireScopeVar(var); + + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("vthis is %p scv %p\n", + var, scv)); + assert(scv.var is var); + + DFAScopeVar* scv2 = dfaCommon.currentDFAScope.findScopeVar(var); + assert(scv is scv2); + + dfaCommon.check; + } + + if (fd.parameters !is null) + { + if (fd.parametersDFAInfo.parameters.length != fd.parameters.length) + fd.parametersDFAInfo.parameters.length = fd.parameters.length; + + foreach (i, param; *fd.parameters) + { + DFAVar* var = dfaCommon.findVariable(param); + var.declaredAtDepth = dfaCommon.currentDFAScope.depth; + var.writeCount = 1; + var.param = &fd.parametersDFAInfo.parameters[i]; + *var.param = ParameterDFAInfo.init; // Array won't initialize it + var.param.parameterId = cast(int) i; + scv = dfaCommon.acquireScopeVar(var); + + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("param (%zd) is `%s` %p scv %p stc %lld\n", + i, param.ident !is null ? param.ident.toChars : null, + var, scv, param.storage_class)); + assert(scv.var is var); + + DFAScopeVar* scv2 = dfaCommon.currentDFAScope.findScopeVar(var); + assert(scv is scv2); + + var.isByRef = (param.storage_class & STC.ref_) == STC.ref_; + + if ((param.storage_class & STC.out_) == STC.out_) + { + var.isByRef = true; + + // blit is effectively a write + var.writeCount = 1; + } + + dfaCommon.check; + } + } + + if (fd.v_argptr !is null) + { + // C vararg _argptr + DFAVar* var = dfaCommon.findVariable(fd.v_argptr); + var.unmodellable = true; + } + + if (fd.v_arguments !is null) + { + // D vararg _arguments + DFAVar* var = dfaCommon.findVariable(fd.v_arguments); + var.unmodellable = true; + } + } + + { + DFAVar* var = dfaCommon.getReturnVariable(); + var.declaredAtDepth = dfaCommon.currentDFAScope.depth; + var.writeCount = 1; + var.param = &fd.parametersDFAInfo.returnValue; + var.param.parameterId = -2; + + TypeFunction tf = fd.type.isTypeFunction(); + assert(tf !is null); + + var.isNullable = tf.isRef || isTypeNullable(tf.next); + scv = dfaCommon.acquireScopeVar(var); + + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("return is %p scv %p l %p\n", + var, scv, scv.lr.lattice)); + assert(scv.var is var); + + DFAScopeVar* scv2 = dfaCommon.currentDFAScope.findScopeVar(var); + assert(scv is scv2); + + dfaCommon.check; + } + + { + // make any variables that cross the function boundary for nested function unmodelled + + foreach (vd; fd.closureVars) + { + DFAVar* var = dfaCommon.findVariable(vd); + var.unmodellable = true; + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("closureVars %s ", vd.ident.toChars); + appendLoc(ob, vd.loc); + ob.writestring("\n"); + }); + } + + foreach (vd; fd.outerVars) + { + DFAVar* var = dfaCommon.findVariable(vd); + var.unmodellable = true; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("outerVars %s ", vd.ident.toChars); + appendLoc(ob, vd.loc); + ob.writestring("\n"); + }); + } + } + + this.visit(fd.fbody); + + // implicit return + // endScope call automatically infers/validates scope on to function. + dfaCommon.currentDFAScope.haveJumped = true; + dfaCommon.currentDFAScope.haveReturned = true; + this.endScopeAndReport(fd.endloc, true); + + dfaCommon.printIfStructure((ref OutBuffer ob, scope void delegate(const(char)*) prefix) { + dfaCommon.allocator.allVariables((DFAVar* var) { + prefix("var"); + ob.printf(" %p base1=%p, base2=%p", var, var.base1, var.base2); + + if (var.var !is null) + { + ob.printf(", `%s` at ", var.var.ident.toChars); + appendLoc(ob, var.var.loc); + } + + ob.printf("\n"); + }); + dfaCommon.allocator.allObjects((DFAObject* obj) { + prefix("object"); + ob.printf(" %p base1=%p, base2=%p, storageFor=%p, mayNotBeExactPointer=%d\n", obj, + obj.base1, obj.base2, obj.storageFor, obj.mayNotBeExactPointer); + }); + }); + + if (fd.parametersDFAInfo !is null) + { + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("return=%d:%d", fd.parametersDFAInfo.returnValue.notNullIn, + fd.parametersDFAInfo.returnValue.notNullOut); + ob.writestring("\n"); + + ob.printf("this=%d:%d", fd.parametersDFAInfo.thisPointer.notNullIn, + fd.parametersDFAInfo.thisPointer.notNullOut); + ob.writestring("\n"); + + foreach (i, param; fd.parametersDFAInfo.parameters) + { + ob.printf("%zd: %d:%d", i, param.notNullIn, param.notNullOut); + ob.writestring("\n"); + } + }); + } + } + + extern (C++) override void visit(Statement st) + { + __gshared immutable(string[]) AllStmtOpNames = [ + __traits(allMembers, STMT) + ]; + + if (st is null) + return; + + dfaCommon.sdepth++; + dfaCommon.check; + + scope (exit) + { + dfaCommon.check; + dfaCommon.sdepth--; + } + + if (dfaCommon.currentDFAScope.haveReturned) + { + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("%3d (%s): ignoring at ", st.stmt, AllStmtOpNames[st.stmt].ptr); + appendLoc(ob, st.loc); + ob.writestring("\n"); + }); + return; + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("%3d (%s): at ", st.stmt, AllStmtOpNames[st.stmt].ptr); + appendLoc(ob, st.loc); + ob.writestring("\n"); + }); + + /* + If you need to see the state of the engine, enable this and set the line number here. + Also remember to set the function name in entry, + and to enable dfaCommon.debugStructure to true with dfaCommon.debugIt set to false, + otherwise you will get lost in the output. + */ + version (none) + { + if (st.loc.linnum == 423) + { + DFAScope* sc = dfaCommon.currentDFAScope; + while (sc !is null) + { + sc.printStructure("----"); + sc = sc.parent; + } + + fflush(stdout); + assert(0); + } + } + + final switch (st.stmt) + { + case STMT.DtorExp: + expWalker.seeConvergeExpression(expWalker.walk(st.isDtorExpStatement.exp)); + break; + + case STMT.Exp: + Expression exp = st.isExpStatement.exp; + + DFALatticeRef lr = expWalker.walk(exp); + seeRead(lr, exp.loc); + expWalker.seeConvergeExpression(lr); + break; + case STMT.Return: + Expression exp = st.isReturnStatement.exp; + + if (exp !is null) + { + DFALatticeRef lr = expWalker.seeAssign(dfaCommon.getReturnVariable, + true, expWalker.walk(exp), exp.loc); + expWalker.seeConvergeExpression(lr); + } + + // Mark the current scope as having returned. + // This signals that no code after this point in the current block is reachable. + dfaCommon.currentDFAScope.haveJumped = true; + dfaCommon.currentDFAScope.haveReturned = true; + analyzer.reporter.onEndOfScope(dfaCommon.currentFunction, st.loc); + break; + + case STMT.Compound: + auto cs = st.isCompoundStatement; + if (cs.statements is null) + break; + + // We need to know which statement we are in and what the next ones are + // so that we can find labels and run finally statements + + dfaCommon.printStructureln("Compound statements:"); + this.startScope; + dfaCommon.currentDFAScope.compoundStatement = cs; + + foreach (i, st2; *cs.statements) + { + dfaCommon.printStructureln("Compound statement:"); + dfaCommon.currentDFAScope.inProgressCompoundStatement = i; + this.visit(st2); + + if (dfaCommon.currentDFAScope.haveReturned) + { + dfaCommon.printStructureln("Compound returned"); + break; + } + } + + DFAScopeRef scr = this.endScope; + + dfaCommon.printStructureln("Compound converge:"); + this.seeConvergeScope(scr); + break; + + case STMT.If: + auto ifs = st.isIfStatement; + auto origScope = dfaCommon.currentDFAScope; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.printf("If statement %p:%p ", dfaCommon.currentDFAScope, origScope); + appendLoc(ob, ifs.loc); + ob.writestring("\n"); + }); + + // CRITICAL: We split the analysis here. + // 1. We analyze the condition to see if it implies anything about variables + // (e.g., `if (ptr)` implies `ptr` is NonNull in the true branch). + // 2. We visit the `ifbody` with that knowledge. + // 3. We visit the `elsebody` (if it exists). + // 4. We merge the resulting states from both branches. + + bool takeTrueBranch, takeFalseBranch; + bool unknownBranchTaken; + + dfaCommon.printStructureln("If condition:"); + int predicateNegation; + DFALatticeRef conditionLR; + DFALatticeRef trueCondition, falseCondition; + DFAVar* conditionVar; + + { + this.startScope; + dfaCommon.currentDFAScope.sideEffectFree = true; + + conditionLR = expWalker.walkCondition(ifs.condition, predicateNegation); + conditionVar = conditionLR.getGateConsequenceVariable; + + seeRead(conditionLR, ifs.condition.loc); + this.endScope; + } + + { + trueCondition = expWalker.adaptConditionForBranch(conditionLR.copy, + ifs.condition.type, true); + falseCondition = expWalker.adaptConditionForBranch(conditionLR.copy, + ifs.condition.type, false); + + this.isBranchTakenIf(trueCondition, falseCondition, ifs, + takeTrueBranch, takeFalseBranch); + + DFAConsequence* cctx = conditionLR.getContext; + if (cctx is null || cctx.truthiness <= Truthiness.Maybe) + unknownBranchTaken = true; + + version (none) + { + printf("if %d %d %d\n", takeTrueBranch, takeFalseBranch, unknownBranchTaken); + conditionLR.printStructure("condition"); + trueCondition.printStructure("true condition"); + falseCondition.printStructure("false condition"); + } + } + + { + dfaCommon.printStructureln("If true branch:"); + this.startScope; + dfaCommon.currentDFAScope.inConditional = true; + + expWalker.seeSilentAssert(trueCondition, true, true); + this.applyGateOnBranch(conditionVar, predicateNegation, true); + } + + DFAScopeRef ifbody, elsebody; + + if (takeTrueBranch) + { + if (auto scs = ifs.ifbody.isScopeStatement) + this.visit(scs.statement); + else + this.visit(ifs.ifbody); + + assert(dfaCommon.currentDFAScope !is origScope); + + ifbody = this.endScope; + ifbody.check; + } + else + { + this.endScope; + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("true ignored\n")); + } + + assert(dfaCommon.currentDFAScope is origScope); + + { + dfaCommon.printStructureln("If false branch:"); + + this.startScope; + dfaCommon.currentDFAScope.inConditional = true; + + // If the true branch can be taken, the false branch needs the condition inverted. + // But if it won't be taken, its clearly false already no need to invert. + if (takeTrueBranch) + expWalker.seeSilentAssert(falseCondition, true, true); + + this.applyGateOnBranch(conditionVar, predicateNegation, false); + + if (takeFalseBranch) + { + if (auto scs = ifs.elsebody.isScopeStatement) + this.visit(scs.statement); + else + this.visit(ifs.elsebody); + } + + elsebody = this.endScope; + elsebody.check; + } + + seeConvergeStatementIf(conditionLR, ifbody, elsebody, + takeFalseBranch, unknownBranchTaken, predicateNegation); + break; + + case STMT.Scope: + auto sc = st.isScopeStatement; + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("Starting scope body at "); + appendLoc(ob, sc.loc); + ob.writestring("\n"); + }); + + this.startScope; + this.visit(sc.statement); + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("Completed scope body at "); + appendLoc(ob, sc.endloc); + ob.writestring("\n"); + }); + + DFAScopeRef scbody = this.endScope; + this.seeConvergeScope(scbody); + break; + + case STMT.Label: + // Note: it is the responsibility of endScope to handle poping these scopes off + auto ls = st.isLabelStatement; + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("label %s %p %p\n", + ls.ident !is null ? ls.ident.toChars : null, ls.gotoTarget, ls.gotoTarget)); + + inLoopyLabel++; + + this.startScope; + dfaCommon.currentDFAScope.label = ls; + dfaCommon.setScopeAsLoopyLabel; + dfaCommon.currentDFAScope.isLoopyLabelKnownToHaveRun = true; + + { + // sometimes we can by-pass needing to look up the for loop + dfaCommon.currentDFAScope.controlStatement = ls.gotoTarget !is null + ? ls.gotoTarget.isForStatement : null; + + if (dfaCommon.currentDFAScope.controlStatement is null && ls.statement !is null) + { + if (dfaCommon.currentDFAScope.controlStatement is null) + dfaCommon.currentDFAScope.controlStatement = ls.statement.isForStatement; + if (dfaCommon.currentDFAScope.controlStatement is null) + dfaCommon.currentDFAScope.controlStatement = ls.statement.isDoStatement; + if (dfaCommon.currentDFAScope.controlStatement is null) + dfaCommon.currentDFAScope.controlStatement = ls.statement.isSwitchStatement; + } + } + + dfaCommon.swapForwardLabelScope(ls.ident, (old) { + if (!old.isNull) + this.seeConvergeForwardGoto(old); + return DFAScopeRef.init; + }); + + DFAScopeRef scr; + + // by-pass scope statement processing with a dedicated variation here. + if (ls.statement is null) + { + } + else if (auto scs = ls.statement.isScopeStatement) + { + this.visit(scs.statement); + scr = this.endScope(*cast(Loc*)&ls.loc, false); + inLoopyLabel--; + } + else + { + this.visit(ls.statement); + } + + if (!scr.isNull) + seeConvergeStatementLoopyLabels(scr, *cast(Loc*)&ls.loc); + break; + + case STMT.For: + auto fs = st.isForStatement; + // fs._init should be handled already + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("starting for loop at "); + appendLoc(ob, fs.endloc); + ob.writestring("\n"); + }); + + // Loops are handled by creating a "LoopyLabel" scope. + // This allows `break` and `continue` statements inside the loop + // to find this scope and update the state accordingly. + // + // Since this is a single-pass engine, we do not iterate until convergence. + // Instead, we analyze the body once, and then use `convergeStatementLoopyLabels` + // to assume the worst-case scenario for variables modified in the loop. + + inLoopyLabel++; + scope (exit) + inLoopyLabel--; + + Expression theCondition = fs.condition; + Statement theBody = fs._body; + + /* + Check to see if the for statement is a while loop. + for(;true;) { + if (condition) { + ... + } else { + break; + } + } + May also be: + for(;condition;) { + ... + } + */ + if (theCondition !is null) + { + auto ie = theCondition.isIntegerExp; + + if (ie !is null && ie.type is Type.tbool && ie.getInteger == 1) + { + auto ifs = theBody.isIfStatement; + + if (ifs !is null && ifs.elsebody !is null && ifs.elsebody.isBreakStatement) + { + // Okay this is actually a while loop + + theCondition = ifs.condition; + theBody = ifs.ifbody; + } + } + } + + DFALatticeRef lrCondition; + DFALatticeRef lrConditionTrue; + + if (theCondition !is null) + { + lrCondition = expWalker.walk(theCondition); + seeRead(lrCondition, theCondition.loc); + lrCondition.printStructure("lrCondition"); + + lrConditionTrue = expWalker.adaptConditionForBranch(lrCondition.copy, + theCondition.type, true); + lrConditionTrue.printStructure("lrConditionTrue"); + } + + if (theCondition is null || isBranchTaken(lrConditionTrue, theBody)) + { + this.startScope; + dfaCommon.currentDFAScope.controlStatement = st; + dfaCommon.currentDFAScope.inConditional = true; + dfaCommon.setScopeAsLoopyLabel; + + if (theCondition !is null) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("For condition:\n")); + + if (auto c = lrConditionTrue.getContext) + { + dfaCommon.currentDFAScope.isLoopyLabelKnownToHaveRun + = c.truthiness == Truthiness.True; + } + + expWalker.seeAssert(lrConditionTrue, theCondition.loc, true); + } + else + dfaCommon.currentDFAScope.isLoopyLabelKnownToHaveRun = true; + + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("For body:\n")); + this.visit(theBody); + + if (!dfaCommon.currentDFAScope.haveJumped) + { + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring("For increment:\n")); + DFALatticeRef lrIncrement = expWalker.walk(fs.increment); + seeRead(lrIncrement, fs.increment.loc); + expWalker.seeConvergeExpression(lrIncrement); + } + + DFAScopeRef scr = this.endScopeAndReport(fs.endloc); + assert(!scr.isNull); + this.seeConvergeStatementLoopyLabels(scr, *cast(Loc*)&fs.loc); + + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.writestring( + "For (effect) condition:\n")); + + if (theCondition !is null) + { + DFALatticeRef lrConditionFalse = expWalker.adaptConditionForBranch(lrCondition, + theCondition.type, false); + expWalker.seeSilentAssert(lrConditionFalse, true, true); + } + + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring("finished for loop at "); + appendLoc(ob, fs.endloc); + ob.writestring("\n"); + }); + } + + break; + + case STMT.Do: + auto ds = st.isDoStatement; + + inLoopyLabel++; + scope (exit) + inLoopyLabel--; + + this.startScope; + dfaCommon.currentDFAScope.controlStatement = st; + dfaCommon.setScopeAsLoopyLabel; + dfaCommon.currentDFAScope.isLoopyLabelKnownToHaveRun = true; + dfaCommon.currentDFAScope.inConditional = true; + + this.visit(ds._body); + + DFALatticeRef lrCondition = expWalker.walk(ds.condition); + seeRead(lrCondition, ds.condition.loc); + expWalker.seeSilentAssert(lrCondition, false, true); + + DFAScopeRef scr = this.endScope(ds.endloc); + this.seeConvergeStatementLoopyLabels(scr, *cast(Loc*)&ds.loc); + break; + + case STMT.UnrolledLoop: + auto uls = st.isUnrolledLoopStatement; + + inLoopyLabel++; + scope (exit) + inLoopyLabel--; + + if (uls.statements !is null && uls.statements.length > 0) + { + this.startScope; + + dfaCommon.currentDFAScope.controlStatement = st; + dfaCommon.setScopeAsLoopyLabel; + + foreach (stmt; *uls.statements) + { + this.startScope; + this.visit(stmt); + + DFAScopeRef scr = this.endScope; + + if (scr.sc.haveReturned) + { + this.seeConvergeScope(scr); + break; + } + else + this.seeConvergeScope(scr); + } + + DFAScopeRef scr = this.endScope(); + this.seeConvergeStatementLoopyLabels(scr); + } + + break; + + case STMT.Switch: + auto ss = st.isSwitchStatement; + + this.startScope; + dfaCommon.currentDFAScope.controlStatement = ss; + dfaCommon.currentDFAScope.inConditional = true; + + DFALatticeRef lrCondition = expWalker.walk(ss.condition); + lrCondition.check; + seeRead(lrCondition, ss.condition.loc); + + DFAScope* oldScope = dfaCommon.currentDFAScope; + + { + // initial pass over the case bodies + + if (ss.sdefault !is null) + { + DFACaseState* caState = dfaCommon.acquireCaseState(ss.sdefault); + + this.startScope; + dfaCommon.currentDFAScope.controlStatement = ss.sdefault; + dfaCommon.setScopeAsLoopyLabel; + + lrCondition.check; + DFALatticeRef lrCondition2 = lrCondition.copy; + lrCondition2.check; + expWalker.seeConvergeExpression(lrCondition2); + + if (ss.sdefault.statement !is null) + { + if (auto scs = ss.sdefault.statement.isScopeStatement) + this.visit(scs.statement); + else + this.visit(ss.sdefault.statement); + } + + caState.containing = this.endScope; + assert(dfaCommon.currentDFAScope is oldScope); + } + + if (ss.cases !is null) + { + foreach (cs; *ss.cases) + { + DFACaseState* caState = dfaCommon.acquireCaseState(cs); + this.startScope; + + dfaCommon.currentDFAScope.controlStatement = cs; + dfaCommon.setScopeAsLoopyLabel; + + DFALatticeRef equalTo = expWalker.walk(cs.exp); + lrCondition.check; + DFALatticeRef lrCondition2 = lrCondition.copy; + lrCondition2.check; + + expWalker.seeConvergeExpression(expWalker.seeEqual(lrCondition2, equalTo, true, + ss.condition.type.toBasetype, cs.exp.type.toBasetype)); + + if (auto scs = cs.statement.isScopeStatement) + this.visit(scs.statement); + else + this.visit(cs.statement); + + caState.containing = this.endScope; + assert(dfaCommon.currentDFAScope is oldScope); + } + } + } + + { + DFAScopeRef inProgress; + + // now let's make sure that nobody has done something bad wrt. input state + + if (ss.sdefault !is null) + { + DFACaseState* caState = dfaCommon.acquireCaseState(ss.sdefault); + + if (!caState.jumpedTo.isNull) + this.seeCheckForCaseBefore(caState.containing, + caState.jumpedTo, ss.sdefault.loc); + + inProgress = this.seeLoopyLabelAwareStage(inProgress, caState.containing); + } + + if (ss.cases !is null) + { + foreach (cs; *ss.cases) + { + DFACaseState* caState = dfaCommon.acquireCaseState(cs); + + if (!caState.jumpedTo.isNull) + this.seeCheckForCaseBefore(caState.containing, + caState.jumpedTo, cs.loc); + + inProgress = this.seeLoopyLabelAwareStage(inProgress, caState.containing); + } + } + + if (!inProgress.isNull) + { + this.seeConvergeScope(inProgress); + } + } + + DFAScopeRef scr = this.endScope(ss.endloc); + this.seeConvergeScope(scr); + break; + + case STMT.Continue: + auto cs = st.isContinueStatement; + dfaCommon.printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) => ob.printf( + "Continue statement %s\n", cs.ident !is null ? cs.ident.toChars : null)); + + auto sc = dfaCommon.findScopeGivenLabel(cs.ident); + assert(sc !is null); + + if (!dfaCommon.debugUnknownAST && sc.controlStatement is null) + break; + else + assert(sc.controlStatement !is null); + + { + // Look for control statements in the scope stack, + // specifically for a control statement that does not match the one for the continue. + // This covers things like if statements. + bool haveParentControlStatement; + DFAScope* parentScope = dfaCommon.currentDFAScope; + + while (parentScope !is sc) + { + if (parentScope.controlStatement !is null + && parentScope.controlStatement !is sc.controlStatement) + { + haveParentControlStatement = true; + break; + } + + parentScope = parentScope.parent; + } + + if (haveParentControlStatement) + dfaCommon.currentDFAScope.haveJumped = true; + } + + if (auto forLoop = sc.controlStatement.isForStatement) + { + DFALatticeRef lr = expWalker.walk(forLoop.increment); + expWalker.seeConvergeExpression(lr); + } + + seeGoto(sc, false); + runFinalizersUntilScope(sc); + break; + + case STMT.Break: + auto bs = st.isBreakStatement; + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("Break statement %s\n", + bs.ident !is null ? bs.ident.toChars : null)); + + auto sc = dfaCommon.findScopeGivenLabel(bs.ident); + assert(sc !is null); + + if (!dfaCommon.debugUnknownAST && sc.controlStatement is null) + break; + else + assert(sc.controlStatement !is null); + + { + // Look for control statements in the scope stack, + // specifically for a control statement that does not match the one for the break. + // This covers things like if statements. + bool haveParentControlStatement; + DFAScope* parentScope = dfaCommon.currentDFAScope; + + while (parentScope !is sc) + { + if (parentScope.controlStatement !is null + && parentScope.controlStatement !is sc.controlStatement) + { + haveParentControlStatement = true; + break; + } + + parentScope = parentScope.parent; + } + + if (haveParentControlStatement) + dfaCommon.currentDFAScope.haveJumped = true; + } + + seeGoto(sc, true); + runFinalizersUntilScope(sc); + break; + + case STMT.Case: + break; // do nothing, already handled in switch statement + + case STMT.GotoDefault: + auto gds = st.isGotoDefaultStatement; + + auto targetScope = dfaCommon.findScopeForControlStatement(gds.sw); + assert(targetScope !is null); + + targetScope = targetScope.child; // into the case statement + assert(targetScope !is null); + assert(targetScope.controlStatement.isCaseStatement !is null + || targetScope.controlStatement.isDefaultStatement !is null); + + this.runFinalizersUntilScope(targetScope); + + DFACaseState* caState = dfaCommon.acquireCaseState(gds.sw.sdefault); + caState.jumpedTo = this.seeLoopyLabelAwareStage(caState.jumpedTo, targetScope.copy); + break; + + case STMT.GotoCase: + auto gcs = st.isGotoCaseStatement; + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("Goto case statement target %p\n", + gcs.cs)); + + DFAScope* targetScope; + auto sw = dfaCommon.findSwitchGivenCase(gcs.cs, targetScope); + assert(sw !is null); + assert(targetScope !is null); + + this.runFinalizersUntilScope(targetScope); + + DFACaseState* caState = dfaCommon.acquireCaseState(gcs.cs); + caState.jumpedTo = this.seeLoopyLabelAwareStage(caState.jumpedTo, targetScope.copy); + break; + + case STMT.TryFinally: + auto tfs = st.isTryFinallyStatement; + dfaCommon.printStructure((ref OutBuffer ob, + scope PrintPrefixType prefix) => ob.printf("try finally %p %p\n", + tfs._body, tfs.finalbody)); + + this.startScope; + dfaCommon.currentDFAScope.tryFinallyStatement = tfs; + + // normal path execute both + this.visit(tfs._body); + this.visit(tfs.finalbody); + + dfaCommon.currentDFAScope.tryFinallyStatement = null; + + DFAScopeRef scr = this.endScope; + this.seeConvergeScope(scr); + break; + + case STMT.Goto: + auto gs = st.isGotoStatement; + dfaCommon.currentDFAScope.haveJumped = true; + + auto sc = dfaCommon.findScopeGivenLabel(gs.ident); + + if (sc !is null) + { + // backwards goto + seeGoto(sc, false); + } + else + seeForwardsGoto(gs.ident); + break; + + case STMT.Import: + break; // do nothing + + case STMT.With: + auto ws = st.isWithStatement; + + this.startScope; + + DFALatticeRef lr = expWalker.walk(ws.exp); + seeRead(lr, ws.exp.loc); + expWalker.seeConvergeExpression(lr); + + if (auto ss = ws._body.isScopeStatement) + this.visit(ss.statement); + else + this.visit(ws._body); + + DFAScopeRef scr = this.endScope(ws.endloc); + this.seeConvergeScope(scr); + break; + + case STMT.TryCatch: + // For the initial version we'll visit and then foreach var as unmodellable. + auto tc = st.isTryCatchStatement; + + this.startScope; + this.visit(tc._body); + DFAScopeRef inProgress = this.endScope(); + + if (tc.catches !is null) + { + // Mark everything as unmodellable as we have no idea how it effects anything outside the catch. + foreach (cat; *tc.catches) + { + markUnmodellable(cat.handler); + } + } + + this.seeConvergeScope(inProgress); + break; + + case STMT.Throw: + auto ts = st.isThrowStatement; + DFALatticeRef lr = expWalker.walk(ts.exp); + expWalker.seeConvergeExpression(lr); + + dfaCommon.currentDFAScope.haveJumped = true; + dfaCommon.currentDFAScope.haveReturned = true; + break; + + case STMT.Asm: + case STMT.InlineAsm: + case STMT.GccAsm: + case STMT.CompoundAsm: + // All variables that we've seen so far are now unmodellable + // no way to know what state they actually are in :( + dfaCommon.allocatedVariablesAllUnmodellable; + break; + + case STMT.SwitchError: + case STMT.Pragma: + case STMT.Error: + break; // ignore these + + case STMT.Default: + case STMT.CompoundDeclaration: + case STMT.ScopeGuard: + case STMT.Foreach: + case STMT.ForeachRange: + case STMT.Debug: + case STMT.CaseRange: + case STMT.StaticForeach: + case STMT.StaticAssert: + case STMT.Conditional: + case STMT.While: + case STMT.Forwarding: + case STMT.Mixin: + case STMT.Peel: + case STMT.Synchronized: + if (dfaCommon.debugUnknownAST) + { + fprintf(stderr, "Unknown DFA walk statement %d\n", st.stmt); + assert(0); + } + else + break; + } + } + + void runFinalizersUntilLabel(Identifier target) + { + DFAScope* targetHeadScope = dfaCommon.findScopeHeadOfLabelStatement(target); + + version (none) + { + printf("Run finalizers up to scope %p", targetHeadScope); + + if (targetHeadScope !is null && targetHeadScope.label !is null) + printf("%s\n", targetHeadScope.label.ident.toChars); + else + printf("\n"); + } + + runFinalizersUntilScope(targetHeadScope); + } + + void runFinalizersUntilScope(DFAScope* targetScope) + { + DFAScope* scv = dfaCommon.currentDFAScope; + + while (scv !is null) + { + if (scv.tryFinallyStatement !is null && scv.tryFinallyStatement.finalbody !is null) + { + this.visit(scv.tryFinallyStatement.finalbody); + } + + if (scv is targetScope) + break; + scv = scv.parent; + } + } + + void markUnmodellable(Statement s) + { + void perVar(VarDeclaration vd) + { + DFAVar* var = dfaCommon.findVariable(vd); + if (var !is null) + var.unmodellable = true; + } + + foreachExpAndVar(s, &expWalker.markUnmodellable, &perVar); + } + + /// Check if a if statement will be branched into by a goto or by the condition + void isBranchTakenIf(ref DFALatticeRef trueLR, ref DFALatticeRef falseLR, + IfStatement ifs, out bool forTrue, out bool forFalse) + { + DFAConsequence* cctx = trueLR.getContext; + + if (cctx !is null) + { + if (cctx.truthiness == Truthiness.True) + { + forTrue = ifs.ifbody !is null; + return; + } + else if (cctx.truthiness == Truthiness.False) + { + forFalse = ifs.elsebody !is null; + return; + } + } + + forTrue = isBranchTaken(trueLR, ifs.ifbody); + + { + cctx = falseLR.getContext; + + if (ifs.elsebody is null) + forFalse = false; + else if (cctx is null || cctx.truthiness != Truthiness.False) + forFalse = true; + else + forFalse = isBranchTaken(ifs.elsebody); + } + } + + /// Check if a statement will be branched into either by a goto or by the condition. + bool isBranchTaken(ref DFALatticeRef condition, Statement stmt) + { + DFAConsequence* cctx = condition.getContext; + + if (stmt is null) + return false; + else if (cctx is null || cctx.truthiness != Truthiness.False) + return true; + else + return isBranchTaken(stmt); + } + + /// Check if a statement will be branched into either by a goto. + bool isBranchTaken(Statement stmt) + { + if (stmt is null) + return false; + + bool walkExpression(Expression e) + { + if (auto de = e.isDeclarationExp) + { + return de.declaration.isVarDeclaration !is null + || de.declaration.isAttribDeclaration !is null; + } + else if (auto be = e.isBinExp) + return walkExpression(be.e1) || walkExpression(be.e2); + else if (auto ue = e.isUnaExp) + return walkExpression(ue.e1); + else + return false; + } + + int check(Statement stmt) + { + int ret = -1; + + void attempt(Statement stmt2) + { + if (ret != -1 || stmt2 is null) + return; + + ret = check(stmt2); + } + + switch (stmt.stmt) + { + case STMT.Exp: + auto es = stmt.isExpStatement; + if (es.exp !is null && walkExpression(es.exp)) + return 0; + return ret; + + case STMT.Compound: + auto cs = stmt.isCompoundStatement; + + if (cs.statements !is null) + { + foreach (s; *cs.statements) + { + attempt(s); + } + } + + return ret; + + case STMT.UnrolledLoop: + auto uls = stmt.isUnrolledLoopStatement; + + if (uls.statements !is null) + { + foreach (s; *uls.statements) + { + attempt(s); + } + } + + return ret; + + case STMT.Scope: + auto ss = stmt.isScopeStatement; + attempt(ss.statement); + return ret; + + case STMT.Do: + auto ds = stmt.isDoStatement; + attempt(ds._body); + return ret; + + case STMT.For: + auto fs = stmt.isForStatement; + attempt(fs._body); + return ret; + + case STMT.If: + auto ifs = stmt.isIfStatement; + attempt(ifs.ifbody); + attempt(ifs.elsebody); + return ret; + + case STMT.Switch: + auto ss = stmt.isSwitchStatement; + + if (ss.cases !is null) + { + foreach (c; *ss.cases) + { + attempt(c.statement); + + if (ret != -1) + return ret; + } + } + + return ret; + + case STMT.With: + auto ws = stmt.isWithStatement; + attempt(ws._body); + return ret; + + case STMT.TryCatch: + auto tcs = stmt.isTryCatchStatement; + attempt(tcs._body); + + if (ret == -1 && tcs.catches !is null && tcs.catches.length > 0) + ret = 0; // catch statements have a var declaration + return ret; + + case STMT.TryFinally: + auto tfs = stmt.isTryFinallyStatement; + attempt(tfs._body); + attempt(tfs.finalbody); + return ret; + + case STMT.Label: + auto ls = stmt.isLabelStatement; + return cast(int) dfaCommon.haveForwardLabelState(ls.ident); + + default: + return ret; + } + } + + int got = check(stmt); + if (got == -1) + return false; + else + return cast(bool) got; + } +} diff --git a/dmd/dfa/fast/structure.d b/dmd/dfa/fast/structure.d new file mode 100644 index 00000000000..a5c94226427 --- /dev/null +++ b/dmd/dfa/fast/structure.d @@ -0,0 +1,4035 @@ +/** + * Structure and representation of the fast Data Flow Analysis engine. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/fast/structure.d, dfa/fast/structure.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_fast_structure.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/fast/structure.d + */ +module dmd.dfa.fast.structure; +import dmd.dfa.utils; +import dmd.common.outbuffer; +import dmd.declaration; +import dmd.statement; +import dmd.func; +import dmd.mtype; +import dmd.typesem; +import dmd.identifier; +import dmd.globals; +import dmd.dsymbol; +import dmd.location; +import dmd.expression; +import dmd.astenums; +import dmd.id; +import core.stdc.stdio; + +package static immutable PrintPipeText = "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"; + +void appendLoc(ref OutBuffer ob, ref const(Loc) loc) +{ + writeSourceLoc(ob, SourceLoc(loc), true, Loc.messageStyle); +} + +alias PrintPrefixType = void delegate(const(char)*); + +// Old compiler versions have bugs with their copy constructors. +// Don't try to save memory by using moving to cleanup. +// Only relevant for bootstrapping purposes. +// We also require that GC.inFinalizer to exist. +enum DFACleanup = __VERSION__ >= 2102; + +//version = DebugJoinMeetOp; + +/*********************************************************** + * The central context for a DFA run. + * + * This structure manages the memory allocator, holds references to global + * variables (like return values), and tracks the current scope being analyzed. + * + * Performance Note: + * It uses a custom `DFAAllocator` (bump-pointer allocator) to avoid the overhead + * of the GC or standard `malloc` for the thousands of tiny nodes created during analysis. + */ +struct DFACommon +{ + DFAAllocator allocator; + DFAScope* currentDFAScope; + DFAScope* lastLoopyLabel; + DFAScope* lastCatch; + + int sdepth, edepth; + FuncDeclaration currentFunction; + + // Making these enum's instead of fields allows for significant performance gains + enum debugIt = false; + //enum debugIt = true; + enum debugStructure = false; + //enum debugStructure = true; + enum debugUnknownAST = false; + //enum debugUnknownAST = true; + enum debugVerify = false; // Disable to improve performance + + private + { + DFAVar*[16] vars; + DFAVar*[16] varPairs; // do not change, 16 is hardcoded in usage + DFAObject*[16] objects; + DFAObject*[16] objectPairs; + DFAVar* returnVar; + DFAVar* infiniteLifetimeVar; + DFAVar* unknownVar; + + DFALabelState*[16] forwardLabels; + DFACaseState*[16] caseEntries; + } + + void printIfStructure(scope void delegate(ref OutBuffer ob, + scope void delegate(const(char)*) prefix) del) + { + static if (debugStructure) + { + OutBuffer ob; + + void prefix(const(char)* pre) + { + printPrefix(ob, pre, sdepth, currentFunction, edepth); + } + + del(ob, &prefix); + + if (ob.length > 0) + printf(ob.peekChars); + + fflush(stdout); + } + } + + void printStructureln(const(char)[] text) + { + printStructure((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring(text); + ob.writestring("\n"); + }); + } + + void printStructure(scope void delegate(ref OutBuffer ob, + scope void delegate(const(char)*) prefix) del) + { + static if (debugStructure) + { + OutBuffer ob; + + void prefix(const(char)* pre) + { + printPrefix(ob, pre, sdepth, currentFunction, edepth); + } + + prefix(""); + del(ob, &prefix); + + if (ob.length > 0) + printf(ob.peekChars); + + fflush(stdout); + } + } + + void printStateln(const(char)[] text) + { + printState((ref OutBuffer ob, scope PrintPrefixType prefix) { + ob.writestring(text); + ob.writestring("\n"); + }); + } + + void printState(scope void delegate(ref OutBuffer ob, scope PrintPrefixType prefix) del) + { + static if (debugIt) + { + OutBuffer ob; + + void prefix(const(char)* pre) + { + printPrefix(ob, pre, sdepth, currentFunction, edepth); + } + + prefix(""); + del(ob, &prefix); + + if (ob.length > 0) + printf(ob.peekChars); + + fflush(stdout); + } + } + + void pushScope() + { + DFAScope* oldScope = currentDFAScope; + currentDFAScope = allocator.makeScope(&this, oldScope); + + assert(currentDFAScope.parent !is currentDFAScope); + assert(currentDFAScope.parent is oldScope); + + if (oldScope !is null) + { + oldScope.child = currentDFAScope; + currentDFAScope.depth = oldScope.depth + 1; + currentDFAScope.inConditional = oldScope.inConditional; + } + else + { + currentDFAScope.depth = 1; + } + } + + DFAScopeRef popScope() + { + DFAScopeRef ret; + ret.sc = currentDFAScope; + + if (lastLoopyLabel is currentDFAScope) + lastLoopyLabel = lastLoopyLabel.previousLoopyLabel; + if (lastCatch is currentDFAScope) + lastCatch = lastCatch.previousCatch; + + currentDFAScope = currentDFAScope.parent; + ret.sc.parent = null; + + if (currentDFAScope !is null) + currentDFAScope.child = null; + return ret; + } + + void setScopeAsLoopyLabel() + { + this.currentDFAScope.isLoopyLabel = true; + this.currentDFAScope.previousLoopyLabel = this.lastLoopyLabel; + lastLoopyLabel = this.currentDFAScope; + } + + void setScopeAsCatch() + { + this.currentDFAScope.previousCatch = this.lastCatch; + lastCatch = this.currentDFAScope; + } + + DFAVar* findVariable(VarDeclaration vd, DFAVar* childOf = null) + { + if (vd is null) + return null; + + DFAVar* ret; + + if (childOf is null) + { + DFAVar** bucket = &vars[(cast(size_t) cast(void*) vd) % vars.length]; + + while (*bucket !is null && cast(void*)(*bucket).var < cast(void*) vd) + { + bucket = &(*bucket).next; + } + + if (*bucket !is null && (*bucket).var is vd) + return *bucket; + + ret = allocator.makeVar(vd); + ret.next = *bucket; + *bucket = ret; + } + else + ret = allocator.makeVar(vd, childOf); + + if (vd.ident is Id.dollar) + { + // __dollar creates problems because it isn't a real variable + // https://issues.dlang.org/show_bug.cgi?id=3326 + + ret.unmodellable = true; + } + + return ret; + } + + DFAVar* findVariablePair(DFAVar* a, DFAVar* b) + { + if (a is null) + return b; + else if (b is null) + return a; + else if (a is b) + return a; + + if (a > b) + { + DFAVar* temp = a; + a = b; + b = temp; + } + + const a1 = (cast(size_t) a) % 0xF, b1 = (cast(size_t) b) % 0xF; + const ab1 = (b1 << 4) | a1; + const ab2 = ab1 % 16; + + DFAVar** bucket = &varPairs[ab2]; + + while (*bucket !is null && cast(size_t)(*bucket).base1 < cast(size_t) a) + { + bucket = &(*bucket).next; + } + + if (*bucket is a) + { + while ((*bucket).base1 is a && cast(size_t)(*bucket).base2 < cast(size_t) b) + { + bucket = &(*bucket).next; + } + } + + if (*bucket is null || (*bucket).base1 !is a || (*bucket).base2 !is b) + { + DFAVar* next = *bucket; + *bucket = allocator.makeVar(null, null); + (*bucket).haveInfiniteLifetime = a.haveInfiniteLifetime && b.haveInfiniteLifetime; + (*bucket).next = next; + } + + return *bucket; + } + + DFAVar* findDereferenceVar(DFAVar* childOf) + { + if (childOf is null) + return null; + + if (childOf.dereferenceVar is null) + { + childOf.dereferenceVar = allocator.makeVar(null); + childOf.dereferenceVar.base1 = childOf; + childOf.dereferenceVar.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + } + + return childOf.dereferenceVar; + } + + DFAVar* findIndexVar(DFAVar* childOf) + { + if (childOf is null) + return null; + + if (childOf.indexVar is null) + { + childOf.indexVar = allocator.makeVar(null); + childOf.indexVar.base1 = childOf; + childOf.indexVar.isAnIndex = true; + childOf.indexVar.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + } + + return childOf.indexVar; + } + + DFAVar* findAsSliceVar(DFAVar* childOf) + { + if (childOf is null) + return null; + + if (childOf.asSliceVar is null) + { + childOf.asSliceVar = allocator.makeVar(null); + childOf.asSliceVar.base1 = childOf; + childOf.asSliceVar.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + } + + return childOf.asSliceVar; + } + + DFAVar* findSliceLengthVar(DFAVar* childOf) + { + if (childOf is null) + return null; + + if (childOf.lengthVar is null) + { + childOf.lengthVar = allocator.makeVar(null); + childOf.lengthVar.base1 = childOf; + childOf.lengthVar.isLength = true; + childOf.lengthVar.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + } + + return childOf.lengthVar; + } + + DFAVar* findOffsetVar(dinteger_t offset, DFAVar* childOf) + { + if (childOf is null) + return null; + + DFAVar** bucket = &childOf.childOffsetVars; + + while (*bucket !is null && (*bucket).offsetFromBase < offset) + { + bucket = &(*bucket).next; + } + + if (*bucket !is null && (*bucket).offsetFromBase == offset) + return *bucket; + + DFAVar* ret = allocator.makeVar(null); + ret.base1 = childOf; + ret.offsetFromBase = offset; + ret.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + + ret.next = *bucket; + *bucket = ret; + return ret; + } + + DFAScope* findScopeForControlStatement(Statement st) + { + DFAScope* current = this.currentDFAScope; + + while (current !is null && current.controlStatement !is st) + { + current = current.parent; + } + + return current; + } + + DFAScope* findScopeHeadOfLabelStatement(Identifier label) + { + bool walkExpression(Expression e) + { + if (auto de = e.isDeclarationExp) + { + if (auto ad = de.declaration.isAttribDeclaration) + { + // ImportC wraps their declarations + + if (ad.decl !is null) + { + foreach (symbol; *ad.decl) + { + if (symbol.isVarDeclaration !is null) + return true; + } + } + + return false; + } + else + return de.declaration.isVarDeclaration !is null; + } + else if (auto be = e.isBinExp) + return walkExpression(be.e1) || walkExpression(be.e2); + else if (auto ue = e.isUnaExp) + return walkExpression(ue.e1); + else + return false; + } + + bool walkStatement(Statement s) + { + if (s is null) + return false; + + with (STMT) + { + final switch (s.stmt) + { + // could prevent it + case Exp: + auto s2 = s.isExpStatement; + return walkExpression(s2.exp); + + // could be this + case Label: + auto s2 = s.isLabelStatement; + if (s2.ident is label) + return true; + else + return walkStatement(s2.statement); + + // can be in this + case Debug: + auto s2 = s.isDebugStatement; + return walkStatement(s2.statement); + case Default: + auto s2 = s.isDefaultStatement; + return walkStatement(s2.statement); + case CaseRange: + auto s2 = s.isCaseRangeStatement; + return walkStatement(s2.statement); + case Case: + auto s2 = s.isCaseStatement; + return walkStatement(s2.statement); + case Peel: + auto s2 = s.isPeelStatement; + return walkStatement(s2.s); + case Forwarding: + auto s2 = s.isForwardingStatement; + return walkStatement(s2.statement); + case If: + auto s2 = s.isIfStatement; + return walkStatement(s2.ifbody) || walkStatement(s2.elsebody); + case Do: + auto s2 = s.isDoStatement; + return walkStatement(s2._body); + case For: + auto s2 = s.isForStatement; + return walkStatement(s2._body); + case Switch: + auto s2 = s.isSwitchStatement; + if (s2.cases !is null) + { + foreach (c; *s2.cases) + { + if (walkStatement(c)) + return true; + } + } + return false; + case UnrolledLoop: + auto s2 = s.isUnrolledLoopStatement; + if (s2.statements !is null) + { + foreach (s3; *s2.statements) + { + if (walkStatement(s3)) + return true; + } + } + return false; + case Scope: + auto s2 = s.isScopeStatement; + return walkStatement(s2.statement); + case Compound: + case CompoundDeclaration: + auto s2 = s.isCompoundStatement; + if (s2.statements !is null) + { + foreach (s3; *s2.statements) + { + if (walkStatement(s3)) + return true; + } + } + return false; + + // can't be in this + case Error: + case DtorExp: + case Mixin: + case CompoundAsm: + case Synchronized: + case With: + case TryCatch: + case TryFinally: + case ScopeGuard: + case While: + case Conditional: + case ForeachRange: + case Foreach: + case StaticForeach: + case Pragma: + case StaticAssert: + case GotoDefault: + case GotoCase: + case SwitchError: + case Return: + case Break: + case Continue: + case Throw: + case Goto: + case Asm: + case InlineAsm: + case GccAsm: + case Import: + return false; + } + } + } + + DFAScope* current = this.currentDFAScope; + + while (current !is null) + { + if (current.compoundStatement !is null) + { + foreach (s; (*current.compoundStatement.statements)[current.inProgressCompoundStatement + .. $]) + { + if (walkStatement(s)) + return current; + } + } + + current = current.parent; + } + + return null; + } + + SwitchStatement findSwitchGivenCase(CaseStatement cs, out DFAScope* target) + { + DFAScope* current = this.currentDFAScope; + + while (current !is null) + { + if (current.controlStatement !is null) + { + auto sw = current.controlStatement.isSwitchStatement; + + if (sw !is null && sw.cases !is null) + { + foreach (cs2; *sw.cases) + { + if (cs2 is cs) + { + target = current; + return sw; + } + } + } + } + + current = current.parent; + } + + return null; + } + + DFAVar* getReturnVariable() + { + if (this.returnVar is null) + this.returnVar = allocator.makeVar(null); + return this.returnVar; + } + + DFAVar* getInfiniteLifetimeVariable() + { + if (this.infiniteLifetimeVar is null) + { + this.infiniteLifetimeVar = allocator.makeVar(null); + this.infiniteLifetimeVar.haveInfiniteLifetime = true; + this.infiniteLifetimeVar.isTruthy = true; + this.infiniteLifetimeVar.isNullable = true; + } + + return this.infiniteLifetimeVar; + } + + DFAVar* getUnknownVar() + { + if (this.unknownVar is null) + { + this.unknownVar = allocator.makeVar(null); + this.unknownVar.unmodellable = true; + } + + return this.unknownVar; + } + + DFAScope* getSideEffectScope() + { + DFAScope* current = this.currentDFAScope; + + while (current.sideEffectFree) + { + current = current.parent; + } + + return current; + } + + DFAObject* makeObject(DFAVar* storageForVar) + { + if (storageForVar is null) + return null; + else if (storageForVar.storageFor !is null) + return storageForVar.storageFor; + + DFAObject* ret = allocator.makeObject; + ret.storageFor = storageForVar; + + storageForVar.storageFor = ret; + return ret; + } + + DFAObject* makeObject(DFAObject* base1 = null, DFAObject* base2 = null) + { + if (base2 !is null && base1 is null) + { + base1 = base2; + base2 = null; + } + + DFAObject* ret = allocator.makeObject; + ret.base1 = base1; + ret.base2 = base2; + return ret; + } + + DFALatticeRef makeLatticeRef() + { + DFALatticeRef ret; + ret.lattice = allocator.makeLattice(&this); + ret.check; + return ret; + } + + DFAScopeVar* swapLattice(DFAVar* contextVar, scope DFALatticeRef delegate(DFALatticeRef) dg) + { + if (contextVar is null || this.currentDFAScope.depth < contextVar.declaredAtDepth) + return null; + + DFAScopeVar* scv = this.acquireScopeVar(contextVar); + + if (scv.lr.isNull) + { + scv.lr = this.makeLatticeRef; + scv.lr.setContext(contextVar); + } + + DFALatticeRef got = dg(scv.lr); + + if (!got.isNull) + { + if (got.getContextVar !is contextVar) + scv.lr.setContext(contextVar); + + scv.lr = got; + } + + scv.lr.check; + return scv; + } + + bool haveForwardLabelState(Identifier ident) + { + DFALabelState** bucket = &this.forwardLabels[( + cast(size_t) cast(void*) ident) % this.forwardLabels.length]; + + while (*bucket !is null && cast(void*)(*bucket).ident < cast(void*) ident) + { + bucket = &(*bucket).next; + } + + return *bucket !is null && (*bucket).ident is ident; + } + + void swapForwardLabelScope(Identifier ident, scope DFAScopeRef delegate(DFAScopeRef) del) + { + DFALabelState** bucket = &this.forwardLabels[( + cast(size_t) cast(void*) ident) % this.forwardLabels.length]; + + while (*bucket !is null && cast(void*)(*bucket).ident < cast(void*) ident) + { + bucket = &(*bucket).next; + } + + if (*bucket is null || (*bucket).ident !is ident) + { + DFALabelState* temp = allocator.makeLabelState(ident); + temp.next = *bucket; + *bucket = temp; + } + + (*bucket).scr = del((*bucket).scr); + } + + DFACaseState* acquireCaseState(Statement caseStatement) + { + DFACaseState** bucket = &this.caseEntries[( + cast(size_t) cast(void*) caseStatement) % this.caseEntries.length]; + + while (*bucket !is null && cast(void*)(*bucket).caseStatement < cast(void*) caseStatement) + { + bucket = &(*bucket).next; + } + + if (*bucket is null || (*bucket).caseStatement !is caseStatement) + { + DFACaseState* temp = allocator.makeCaseState(caseStatement); + temp.next = *bucket; + *bucket = temp; + } + + return *bucket; + } + + DFALatticeRef acquireLattice(DFAVar* var) + { + DFAScopeVar* scv = this.acquireScopeVar(var); + if (scv is null) + return DFALatticeRef.init; + + return scv.lr.copy; + } + + DFAScopeVar* acquireScopeVar(DFAVar* var) + { + if (var is null || this.currentDFAScope.depth < var.declaredAtDepth) + return null; + + DFAScope* sc; + sc = this.currentDFAScope; + DFAScopeVar* scv, ret; + + while (sc !is null && sc.depth >= var.declaredAtDepth) + { + if ((scv = sc.findScopeVar(var)) !is null) + break; + + sc = sc.parent; + } + + assert(scv is null || scv.var is var); + DFAConsequence* c; + + if (scv is null) + { + // init new state + sc = this.currentDFAScope; + ret = sc.getScopeVar(var); + + c = ret.lr.getContext; + assert(ret.var is var); + assert(c !is null); + assert(c.var is var); + + return ret; + } + else + { + assert(!scv.lr.isNull); + c = scv.lr.getContext; + assert(c !is null); + assert(c.var is var); + } + + sc = sc.child; + ret = scv; + + while (sc !is null) + { + ret = sc.getScopeVar(var); + assert(ret.var is var); + // if we had state that we wanted copied, we'd do it here + + ret.lr = scv.lr.copy; + ret.mergable = scv.mergable; + + c = ret.lr.getContext; + assert(c !is null); + assert(c.var is var); + + sc = sc.child; + } + + assert(ret !is null); + return ret; + } + + DFAScope* findScopeGivenLabel(Identifier ident) + { + DFAScope* current = this.currentDFAScope; + + if (ident is null) + { + while (current.parent !is null && current.controlStatement is null) + { + current = current.parent; + } + } + else + { + while (current.parent !is null && (current.label is null || current + .label.ident !is ident)) + { + current = current.parent; + } + } + + return (current !is null && ((current.label !is null + && current.label.ident is ident) || current.controlStatement !is null)) ? current + : null; + } + + void allocatedVariablesAllUnmodellable() + { + // If we're calling this, that means we have literally no idea what state these variables are in. + // Its anything after this point in the AST walk. + + DFAVar* current = allocator.allocatedlistvar; + + while (current !is null) + { + current.unmodellable = true; + current = current.listnext; + } + } + + void print() + { + DFAScope* sc = this.currentDFAScope; + + while (sc !is null) + { + printf("- scope %p\n", sc); + + foreach (i; 0 .. sc.buckets.length) + { + printf(" - bucket %zd:\n", i); + + DFAScopeVar* bucket = sc.buckets[i]; + while (bucket !is null) + { + printf(" - scope var %p for var %p\n", bucket, bucket.var); + DFAConsequence* cctx = bucket.lr.getContext; + printf(" cctx.var %p\n", cctx !is null ? cctx.var : null); + bucket = bucket.next; + } + } + + sc = sc.parent; + } + + fflush(stdout); + } + + void check() + { + static if (DFACommon.debugVerify) + { + DFAScope* sc = this.currentDFAScope; + + while (sc !is null) + { + foreach (var, l, scv; *sc) + { + assert(l !is null); + + DFAConsequence* cctx = l.context; + assert(cctx !is null); + + if (cctx.var !is var) + { + printf("check scv var %p !is %p\n", cctx.var, var); + fflush(stdout); + } + + assert(cctx.var is var); + } + + sc = sc.parent; + } + } + } +} + +struct DFAAllocator +{ + package(dmd.dfa) + { + DFACommon* dfaCommon; + } + + private + { + static struct Region + { + align(1): + Region* previous; + Region* next; + size_t length; + } + + // 8kb for regions of memory + //enum RegionAllocationStep = 8_192; + // 128kb for regions of memory + enum RegionAllocationStep = 131_072; + // 256kb for regions of memory + //enum RegionAllocationStep = 262_144; + // 1mb for regions of memory + //enum RegionAllocationStep = 1_048_576; + + DFAVar* allocatedlistvar, allocatedlistlastvar; + DFAObject* allocatedlistobject; + + // We use free lists to reuse memory, during our operation. + DFALabelState* freelistlabel; + DFACaseState* freelistcase; + DFAVar* freelistvar; + DFAScopeVar* freelistscopevar; + DFAObject* freelistobject; + DFAScope* freelistscope; + DFALattice* freelistlattice; + DFAConsequence* freelistconsequence; + + Region* currentRegion; + size_t regionUsed; + + __gshared + { + Region* lastRegion; + void[RegionAllocationStep] staticRegion = void; + } + } + + static void deinitialize() + { + import dmd.root.rmem; + + while (lastRegion !is null) + { + void* toFree; + if (lastRegion.previous !is null) + toFree = cast(void*) lastRegion; + lastRegion = lastRegion.previous; + + assert(toFree !is staticRegion.ptr); + if (toFree !is null) + Mem.xfree(toFree); + } + } + + static void checkfreelist() + { + version (none) + { + DFAVar* v = freelistvar; + DFAScopeVar* scv = freelistscopevar; + DFAScope* sc = freelistscope; + DFALattice* l = freelistlattice; + DFAConsequence* c = freelistconsequence; + + while (v !is null) + { + v = v.listnext; + } + + while (scv !is null) + { + scv = scv.listnext; + } + + while (sc !is null) + { + sc = sc.listnext; + } + + while (l !is null) + { + l = l.listnext; + } + + while (c !is null) + { + c = c.listnext; + } + } + } + + DFAVar* makeVar(VarDeclaration vd, DFAVar* childOf = null) + { + DFAVar** bucket; + + if (childOf !is null) + { + bucket = &childOf.childVars[(cast(size_t) cast(void*) vd) % childOf.childVars.length]; + + while (*bucket !is null && cast(void*)(*bucket).var < cast(void*) vd) + { + bucket = &(*bucket).next; + } + + if (*bucket !is null && (*bucket).var is vd) + return *bucket; + } + + DFAVar* ret = allocInternal!DFAVar(freelistvar); + ret.var = vd; + ret.base1 = childOf; + ret.offsetFromBase = -1; + + if (vd !is null) + applyType(ret, vd); + + if (childOf !is null) + { + ret.haveInfiniteLifetime = childOf.haveInfiniteLifetime; + ret.offsetFromBase = vd.offset; + + ret.next = *bucket; + *bucket = ret; + } + + if (this.allocatedlistlastvar is null) + { + this.allocatedlistlastvar = ret; + this.allocatedlistvar = ret; + } + else + { + ret.listnext = this.allocatedlistvar; + this.allocatedlistvar = ret; + } + + return ret; + } + + DFAScopeVar* makeScopeVar(DFACommon* dfaCommon, DFAVar* var) + { + DFAScopeVar* ret = allocInternal!DFAScopeVar(freelistscopevar); + ret.var = var; + return ret; + } + + DFAScope* makeScope(DFACommon* dfaCommon, DFAScope* parent) + { + DFAScope* ret = allocInternal!DFAScope(freelistscope); + ret.dfaCommon = dfaCommon; + ret.parent = parent; + return ret; + } + + DFAObject* makeObject() + { + DFAObject* ret = allocInternal!DFAObject(freelistobject); + + ret.listnext = this.allocatedlistobject; + this.allocatedlistobject = ret; + return ret; + } + + DFALattice* makeLattice(DFACommon* dfaCommon) + { + DFALattice* ret = allocInternal!DFALattice(freelistlattice); + ret.dfaCommon = dfaCommon; + return ret; + } + + DFAConsequence* makeConsequence(DFAVar* var, DFAConsequence* copyFrom = null) + { + DFAConsequence* ret = allocInternal!DFAConsequence(freelistconsequence); + ret.dfaCommon = dfaCommon; + ret.var = var; + + if (copyFrom !is null) + { + ret.copyFrom(copyFrom); + + if (var !is null) + { + if (!var.isTruthy) + ret.truthiness = Truthiness.Unknown; + if (!var.isNullable) + ret.nullable = Nullable.Unknown; + } + } + + ret.var = var; + return ret; + } + + DFALabelState* makeLabelState(Identifier ident) + { + DFALabelState* ret = allocInternal!DFALabelState(freelistlabel); + ret.ident = ident; + return ret; + } + + DFACaseState* makeCaseState(Statement caseStatement) + { + DFACaseState* ret = allocInternal!DFACaseState(freelistcase); + ret.caseStatement = caseStatement; + return ret; + } + + void free(DFAScopeVar* s) + { + s.lr = DFALatticeRef.init; + s.lrGatePredicate = DFALatticeRef.init; + s.lrGateNegatedPredicate = DFALatticeRef.init; + s.var = null; + s.next = null; + + s.listnext = freelistscopevar; + freelistscopevar = s; + } + + void free(DFAScope* s) + { + static if (DFACommon.debugVerify) + { + DFAScope* current = s.dfaCommon.currentDFAScope; + + while (current !is null) + { + assert(current !is s); + current = current.parent; + } + } + + s.parent = null; + s.child = null; + s.previousLoopyLabel = null; + s.previousCatch = null; + + s.controlStatement = null; + s.compoundStatement = null; + s.tryFinallyStatement = null; + + s.beforeScopeState = DFAScopeRef.init; + s.afterScopeState = DFAScopeRef.init; + + foreach (ref bucket; s.buckets) + { + DFAScopeVar* next; + + while (bucket !is null) + { + next = bucket.next; + this.free(bucket); + bucket = next; + } + } + + s.listnext = freelistscope; + freelistscope = s; + } + + void free(DFALattice* l) + { + + l.firstInSequence = null; + l.lastInSequence = null; + l.constant = null; + l.context = null; + + l.listnext = freelistlattice; + freelistlattice = l; + } + + void free(DFAConsequence* c) + { + c.listnext = freelistconsequence; + freelistconsequence = c; + } + + void allObjects(scope void delegate(DFAObject* obj) del) + { + DFAObject* current = allocatedlistobject; + + while (current !is null) + { + del(current); + current = current.listnext; + } + } + + void allVariables(scope void delegate(DFAVar* obj) del) + { + DFAVar* current = allocatedlistvar; + + while (current !is null) + { + del(current); + current = current.listnext; + } + } + +private: + T* allocInternal(T)(ref T* freelist) + { + import core.stdc.string; + import dmd.root.rmem; + + T* ret = freelist; + + if (ret !is null) + { + freelist = freelist.listnext; + } + else + { + if (currentRegion is null) + { + Region* got = cast(Region*) staticRegion.ptr; + + if (lastRegion is null) + *got = Region(null, null, RegionAllocationStep); + + currentRegion = got; + regionUsed = Region.sizeof; + } + else if (regionUsed + T.sizeof >= currentRegion.length) + { + if (currentRegion.next !is null) + { + currentRegion = currentRegion.next; + regionUsed = Region.sizeof; + } + else + { + // Acquire the next block of memory to allocate from + Region* got = cast(Region*) Mem.xmalloc(RegionAllocationStep); + assert(got !is null); + + *got = Region(currentRegion, null, RegionAllocationStep); + currentRegion.next = got; + currentRegion = got; + + lastRegion = got; + regionUsed = Region.sizeof; + } + } + + assert(currentRegion !is null); + assert(regionUsed + T.sizeof <= currentRegion.length); + + void* pos = cast(void*) currentRegion + regionUsed; + ret = cast(T*) pos; + regionUsed += T.sizeof; + } + + // Initialize it to the right type + // Note: D has changed its behavior surrounding getting the init value over many years. + // A variable like this, is guaranteed good for all of them. + __gshared immutable(T) valInit; + memcpy(ret, cast(void*)&valInit, T.sizeof); + + assert(ret !is null); + return ret; + } +} + +struct DFALabelState +{ + private + { + DFALabelState* listnext; + DFALabelState* next; + } + + Identifier ident; + DFAScopeRef scr; +} + +struct DFACaseState +{ + private + { + DFACaseState* listnext; + DFACaseState* next; + } + + Statement caseStatement; // default case or case + DFAScopeRef containing; + DFAScopeRef jumpedTo; // When its jumped to this case, this is the meet'd state +} + +/*********************************************************** + * Represents the identity of a variable being tracked. + * + * This does NOT store the current value of the variable (that changes depending on + * where you are in the code). Instead, it stores immutable properties like: + * - Is it a boolean? (`isBoolean`) + * - Can it be null? (`isNullable`) + * - Is it a reference to another variable? (`base1`, `indexVar`) + * + * Think of this as the "Key" in a map, where the "Value" is the DFALattice. + */ +struct DFAVar +{ + private + { + DFAVar* listnext; + DFAVar* next; + DFAVar*[16] childVars; + DFAVar* childOffsetVars; + } + + DFAVar* base1; + DFAVar* base2; + + DFAVar* indexVar; + DFAVar* lengthVar; + DFAVar* asSliceVar; + + VarDeclaration var; + dinteger_t offsetFromBase; // -1 if its not an offset + + bool isAnIndex; // base1[index] = this + bool isLength; // T[].length + + bool isTruthy; + bool isNullable; + + bool isBoolean; + bool isStaticArray; + bool isFloatingPoint; + bool isByRef; + + bool haveInfiniteLifetime; + bool wasDefaultInitialized; // may not be accurate for all variables + + int declaredAtDepth; + int writeCount; + + DFAVar* dereferenceVar; // child var + + bool unmodellable; // DO NOT REPORT!!!! + bool doNotInferNonNull; // i.e. was the rhs of > + int assertedCount; + + ParameterDFAInfo* param; + + DFAObject* storageFor; + + bool haveBase() + { + return this.base1 !is null; + } + + /// Finds the root variables for this one, where base1 is null + void walkRoots(scope void delegate(DFAVar* var) del) + { + void handle(DFAVar* temp) + { + while (temp.base1 !is null && temp.base2 is null) + { + temp = temp.base1; + } + + if (temp.base2 !is null) + { + handle(temp.base1); + handle(temp.base2); + } + else + del(temp); + } + + handle(&this); + } + + /// Walk all variables that end up at a root + void walkToRoot(scope void delegate(DFAVar* var) del) + { + void handle(DFAVar* temp) + { + while (temp.base1 !is null && temp.base2 is null) + { + del(temp); + temp = temp.base1; + } + + if (temp.base2 !is null) + { + handle(temp.base1); + handle(temp.base2); + } + else + del(temp); + } + + handle(&this); + } + + /// Visit the base1 and base2 if present + void visitFirstBase(scope void delegate(DFAVar* var) del) + { + if (this.base1 is null) + return; + + del(this.base1); + + if (this.base2 !is null) + del(this.base2); + } + + void visitDereferenceBases(scope void delegate(DFAVar* var) del) + { + void handle(DFAVar* var) + { + while (var.base2 is null && var.base1 !is null + && (var.base1.dereferenceVar is var + || (var.offsetFromBase != -1 && var.var is null))) + { + var = var.base1; + } + + if (var.base2 !is null) + { + handle(var.base1); + handle(var.base2); + } + else + del(var); + } + + handle(&this); + } + + /// If this variable is a reference to another variable, visit the base variable. + void visitIfReferenceToAnotherVar(scope void delegate(DFAVar* var) del) + { + void handle(DFAVar* var, int refed) + { + while (var.base2 is null && var.base1 !is null) + { + if (var.offsetFromBase != -1) + refed++; + else if (var.base1.dereferenceVar is var) + refed++; + else if (var.base1.indexVar is var) + refed++; + else + break; + + var = var.base1; + } + + if (var.base2 !is null) + { + handle(var.base1, refed); + handle(var.base2, refed); + } + else if (refed != 0) + del(var); + } + + handle(&this, 0); + } + + /// If this variable is a reference to another, takes into account dereferencing. + void visitReferenceToAnotherVar(scope void delegate(DFAVar* var) hasIndirection, + scope void delegate(DFAVar* var) noIndirection = null) + { + void handle(DFAVar* var, int refed) + { + while (var.base2 is null && var.base1 !is null) + { + if (var.offsetFromBase != -1 && var.var is null) + refed++; + else if (var.base1.dereferenceVar is var) + refed--; + else if (var.base1.indexVar is var) + refed++; + else + break; + + var = var.base1; + } + + if (var.base2 !is null) + { + handle(var.base1, refed); + handle(var.base2, refed); + } + else if (refed > 0) + { + if (hasIndirection !is null) + hasIndirection(var); + } + else if (noIndirection !is null) + noIndirection(var); + } + + handle(&this, 0); + } + + /// If this variable is a reference to another, takes into account dereferencing. + void visitIfReadOfReferenceToAnotherVar(scope void delegate(DFAVar* var) resolvedIndirection) + { + void handle(DFAVar* var, int refed) + { + if (!(var.base1 !is null || var.base2 !is null || refed != 0)) + return; + + while (var.base2 is null && var.base1 !is null) + { + if (var.offsetFromBase != -1 && var.var is null) + refed++; + else if (var.base1.dereferenceVar is var) + refed--; + else if (var.base1.indexVar is var) + refed++; + else if (var.base1.lengthVar is var && var.base1.isStaticArray + && !var.base1.haveBase) + return; // Statically known length, base doesn't matter as it won't be read + else if (var.base1.asSliceVar is var && !var.base1.haveBase && refed == 0) + return; // base1[] is a slice this does not inherently make it a read + else + break; + + var = var.base1; + } + + if (var.base2 !is null) + { + handle(var.base1, refed); + handle(var.base2, refed); + } + else if (refed < 0) + resolvedIndirection(var); + } + + handle(&this, 0); + } + + bool isModellable() + { + bool ret = true; + + void handle(DFAVar* var) + { + if (var.base1 is null) + { + if (var.unmodellable) + ret = false; + } + else + { + handle(var.base1); + if (ret && var.base2 !is null) + handle(var.base2); + } + } + + handle(&this); + return ret; + } + +} + +struct DFAScopeVar +{ + private + { + DFAScopeVar* listnext; + DFAScopeVar* next; + } + + DFAVar* var; + DFALatticeRef lr; + + int gatePredicateWriteCount; + DFALatticeRef lrGatePredicate; + DFALatticeRef lrGateNegatedPredicate; + + int derefDepth; + int derefAssertedDepth; + + int assignDepth; + int assertDepth, assertTrueDepth, assertFalseDepth; + + DFAScopeVarMergable mergable; +} + +struct DFAScopeVarMergable +{ + int nullAssignWriteCount; + int nullAssignAssertedCount; + + void merge(DFAScopeVarMergable other) + { + if (other.nullAssignWriteCount > this.nullAssignWriteCount) + this.nullAssignWriteCount = other.nullAssignWriteCount; + if (other.nullAssignAssertedCount > this.nullAssignAssertedCount) + this.nullAssignAssertedCount = other.nullAssignAssertedCount; + } +} + +struct DFAObject +{ + private + { + DFAObject* listnext; + } + + DFAVar* storageFor; + + DFAObject* base1; + DFAObject* base2; + + // Pointer arithmetic may mean this object isn't 1:1 with the object start. + bool mayNotBeExactPointer; + + void walkRoots(scope void delegate(DFAObject* root) del) + { + DFAObject* obj = &this; + + while (obj.base1 !is null) + { + if (obj.base2 !is null) + obj.base2.walkRoots(del); + + obj = obj.base1; + } + + del(obj); + } +} + +struct DFAScopeRef +{ + package DFAScope* sc; + + static if (DFACleanup) + { + this(ref DFAScopeRef other) + { + this.sc = other.sc; + other.sc = null; + } + + ~this() + { + if (sc is null) + return; + + sc.dfaCommon.allocator.free(sc); + sc = null; + } + } + + bool isNull() + { + return sc is null; + } + + DFAScopeVar* findScopeVar(DFAVar* contextVar) + { + if (sc is null) + return null; + + return sc.findScopeVar(contextVar); + } + + DFAScopeVar* getScopeVar(DFAVar* contextVar) + { + if (sc is null) + return null; + + return this.sc.getScopeVar(contextVar); + } + + DFALatticeRef consumeNext(out DFAVar* contextVar, out DFAScopeVarMergable mergable) + { + if (sc is null) + return DFALatticeRef.init; + + foreach (ref bucket; sc.buckets) + { + if (bucket is null) + continue; + + DFAScopeVar* scv = bucket; + contextVar = scv.var; + mergable = scv.mergable; + bucket = scv.next; + + DFALatticeRef lr = scv.lr; + sc.dfaCommon.allocator.free(scv); + return lr; + } + + return DFALatticeRef.init; + } + + DFALatticeRef consumeVar(DFAVar* contextVar, out DFAScopeVarMergable mergable) + { + if (sc is null) + return DFALatticeRef.init; + + DFAScopeVar** bucket = &sc.buckets[cast(size_t) contextVar % sc.buckets.length]; + + while (*bucket !is null && (*bucket).var < contextVar) + bucket = &(*bucket).next; + + if (*bucket is null || (*bucket).var !is contextVar) + return DFALatticeRef.init; + + DFAScopeVar* scv = *bucket; + mergable = scv.mergable; + DFALatticeRef lr = scv.lr; + + *bucket = scv.next; + sc.dfaCommon.allocator.free(scv); + return lr; + } + + DFAScopeVar* assignLattice(DFAVar* contextVar, DFALatticeRef lr) + { + if (this.isNull) + return null; + this.check; + + DFAScopeVar* ret = sc.assignLattice(contextVar, lr); + + this.check; + return ret; + } + + void printStructure(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + + this.sc.printStructure(prefix, sdepth, currentFunction, depth); + } + + void printState(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + + this.sc.printState(prefix, sdepth, currentFunction, depth); + } + + void printActual(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + + this.sc.printActual(prefix, sdepth, currentFunction, depth); + } + + int opApply(scope int delegate(DFALattice*) dg) + { + if (this.sc is null) + return 0; + + return this.sc.opApply(dg); + } + + int opApply(scope int delegate(DFAVar*, DFALattice*) dg) + { + if (this.sc is null) + return 0; + + return this.sc.opApply(dg); + } + + int opApply(scope int delegate(DFAVar*, DFALattice*, DFAScopeVar*) dg) + { + if (this.sc is null) + return 0; + + return this.sc.opApply(dg); + } + + DFAScopeRef copy() + { + if (this.isNull) + return DFAScopeRef.init; + + return this.sc.copy; + } + + void check() + { + if (!this.isNull) + this.sc.check; + } +} + +/*********************************************************** + * Represents a specific region of code execution (a scope). + * + * As the DFA walks through the code, it pushes and pops scopes. + * Each scope holds a table (`buckets`) of the current state of variables + * within that block. + * + * When the analysis branches (e.g., inside an `if`), a new child scope is + * created to track the state changes specific to that branch. + */ +struct DFAScope +{ + private + { + DFACommon* dfaCommon; + DFAScope* listnext; + DFAScope* previousLoopyLabel; + DFAScope* previousCatch; + } + + DFAScope* parent, child; + DFAScopeVar*[16] buckets; + int depth; + + bool haveJumped; // thrown, goto, break, continue, return + bool haveReturned; + bool isLoopyLabel; // Is a loop or label + bool isLoopyLabelKnownToHaveRun; // was the loopy label guaranteed to have at least one iteration? + bool inConditional; + bool sideEffectFree; // No side effects should be stored in this scope use a parent instead. + + Statement controlStatement; // needed to apply on iteration for continue, loops switch statements ext. + LabelStatement label; + + CompoundStatement compoundStatement; + size_t inProgressCompoundStatement; + + TryFinallyStatement tryFinallyStatement; + + DFAScopeRef beforeScopeState, afterScopeState; + + DFALattice* findLattice(DFAVar* contextVar) + { + assert(contextVar !is null); // if this is null idk what is going on! + + DFAScopeVar** bucket = &this.buckets[cast(size_t) contextVar % this.buckets.length]; + + while (*bucket !is null && (*bucket).var < contextVar) + { + bucket = &(*bucket).next; + } + + if (*bucket is null || (*bucket).var !is contextVar) + return null; + + DFAConsequence* cctx = (*bucket).lr.getContext; + if (cctx !is null) + { + assert(cctx.var is contextVar); + } + + return (*bucket).lr.lattice; + } + + DFAScopeVar* findScopeVar(DFAVar* contextVar) + { + assert(contextVar !is null); // if this is null idk what is going on! + + DFAScopeVar** bucket = &this.buckets[cast(size_t) contextVar % this.buckets.length]; + + DFAVar* lastVar; + + while (*bucket !is null && (*bucket).var < contextVar && lastVar < (*bucket).var) + { + lastVar = (*bucket).var; + bucket = &(*bucket).next; + } + + if (*bucket is null || (*bucket).var !is contextVar) + return null; + return *bucket; + } + + DFAScopeVar* getScopeVar(DFAVar* contextVar) + { + if (contextVar is null) + return null; + + this.check; + DFAScopeVar** bucket = &buckets[cast(size_t) contextVar % buckets.length]; + + while (*bucket !is null && (*bucket).var < contextVar) + bucket = &(*bucket).next; + + DFAScopeVar* scv = *bucket; + + if (scv is null || scv.var !is contextVar) + { + scv = dfaCommon.allocator.makeScopeVar(dfaCommon, contextVar); + + DFALatticeRef temp = dfaCommon.makeLatticeRef; + temp.setContext(contextVar); + scv.lr = temp; + + scv.next = *bucket; + *bucket = scv; + } + + this.check; + return scv; + } + + DFAScopeVar* createAndInheritLattice(DFAVar* contextVar, DFALattice* copyFrom) + { + assert(contextVar !is null); // if this is null idk what is going on! + + DFAScopeVar** bucket = &this.buckets[cast(size_t) contextVar % this.buckets.length]; + + while (*bucket !is null && (*bucket).var < contextVar) + bucket = &(*bucket).next; + + DFAScopeVar* scv = *bucket; + + if (scv is null || scv.var !is contextVar) + { + scv = dfaCommon.allocator.makeScopeVar(dfaCommon, contextVar); + scv.next = *bucket; + *bucket = scv; + } + + if (scv.lr.isNull) + { + scv.lr = copyFrom !is null ? copyFrom.copy : dfaCommon.makeLatticeRef; + scv.lr.setContext(contextVar); + } + + return scv; + } + + DFAScopeVar* assignLattice(DFAVar* contextVar, DFALatticeRef lr) + { + if (lr.isNull) + return null; + + DFAScopeVar** bucket = &this.buckets[cast(size_t) contextVar % this.buckets.length]; + + while (*bucket !is null && (*bucket).var < contextVar) + bucket = &(*bucket).next; + + DFAScopeVar* scv = *bucket; + + if (scv is null || scv.var !is contextVar) + { + scv = dfaCommon.allocator.makeScopeVar(this.dfaCommon, contextVar); + scv.next = *bucket; + *bucket = scv; + } + + lr.setContext(contextVar); + scv.lr = lr; + scv.lr.check; + + return scv; + } + + void printStructure(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + static if (!this.dfaCommon.debugStructure) + return; + else + printActual(prefix, sdepth, currentFunction, depth); + } + + void printState(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + static if (!this.dfaCommon.debugIt) + return; + else + printActual(prefix, sdepth, currentFunction, depth); + } + + void printActual(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + printPrefix("%s Scope", sdepth, currentFunction, depth, prefix); + printf(" %p depth=%d, completed=%d:%d", &this, this.depth, + this.haveReturned, this.haveJumped); + + if (this.label !is null) + printf(", label=`%s`\n", this.label.ident.toChars); + else + printf("\n"); + + if (!this.beforeScopeState.isNull) + { + printPrefix("%s before scope state:\n", sdepth, currentFunction, depth, prefix); + this.beforeScopeState.sc.printActual(prefix, sdepth, currentFunction, depth + 1); + } + + if (!this.afterScopeState.isNull) + { + printPrefix("%s after scope state:\n", sdepth, currentFunction, depth, prefix); + this.afterScopeState.sc.printActual(prefix, sdepth, currentFunction, depth + 1); + } + + printPrefix("%s scv's:\n", sdepth, currentFunction, depth, prefix); + foreach (contextVar, l, scv; this) + { + printPrefix("%s on %p", sdepth, currentFunction, depth + 1, prefix, contextVar); + + if (contextVar !is null) + { + printf(";%d", contextVar.declaredAtDepth); + + if (contextVar.base1 !is null) + printf(":%p", contextVar.base1); + if (contextVar.base2 !is null) + printf(":%p", contextVar.base2); + + if (contextVar.var !is null) + printf("@%p=`%s`", contextVar.var, contextVar.var.toChars); + + printf(", unmodel=%d, write=%d", contextVar.unmodellable, contextVar.writeCount); + printf(", deref=%d:%d", scv.derefDepth, scv.derefAssertedDepth); + printf(", assign=%d, assert=%d/%d/%d", scv.assignDepth, + scv.assertDepth, scv.assertTrueDepth, scv.assertFalseDepth); + } + + printf(", nullassign=%d\n", scv.mergable.nullAssignWriteCount); + + if (this.isLoopyLabel) + { + printPrefix("%s predicate:\n", sdepth, currentFunction, depth, prefix); + scv.lrGatePredicate.printActual(prefix, sdepth, currentFunction, depth + 1); + printPrefix("%s !predicate:\n", sdepth, currentFunction, depth, prefix); + scv.lrGateNegatedPredicate.printActual(prefix, sdepth, currentFunction, depth + 1); + } + + printPrefix("%s lattice:\n", sdepth, currentFunction, depth, prefix); + l.printActual(prefix, sdepth, currentFunction, depth + 1); + } + } + + DFAScopeRef copy() + { + DFAScopeRef ret; + ret.sc = dfaCommon.allocator.makeScope(this.dfaCommon, this.parent); + ret.sc.depth = this.depth; + + // not everything is copied over as it isn't important + + foreach (var, lr, scv; this) + { + ret.sc.createAndInheritLattice(var, lr); + } + + ret.check; + return ret; + } + + void check() + { + static if (DFACommon.debugVerify) + { + foreach (scv; this.buckets) + { + while (scv !is null) + { + assert(scv.lr.lattice !is null); + + if (scv.next !is null) + assert(scv.next.var > scv.var); + + scv.lr.check; + scv = scv.next; + } + } + } + } + + int opApply(scope int delegate(DFALattice*) dg) + { + int ret; + + foreach (scv; this.buckets) + { + while (scv !is null) + { + ret = dg(scv.lr.lattice); + if (ret) + return ret; + + scv = scv.next; + } + } + + return ret; + } + + int opApply(scope int delegate(DFAVar*, DFALattice*) dg) + { + int ret; + + foreach (scv; this.buckets) + { + while (scv !is null) + { + ret = dg(scv.var, scv.lr.lattice); + if (ret) + return ret; + + scv = scv.next; + } + } + + return ret; + } + + int opApply(scope int delegate(DFAVar*, DFALattice*, DFAScopeVar*) dg) + { + int ret; + + foreach (scv; this.buckets) + { + while (scv !is null) + { + ret = dg(scv.var, scv.lr.lattice, scv); + if (ret) + return ret; + + scv = scv.next; + } + } + + return ret; + } +} + +struct DFALatticeRef +{ + package DFALattice* lattice; + + static if (DFACleanup) + { + this(ref DFALatticeRef other) + { + this.lattice = other.lattice; + other.lattice = null; + } + + ~this() + { + if (isNull) + return; + + DFAConsequence* c = lattice.lastInSequence; + + while (c !is null) + { + DFAConsequence* next = c.next; + assert(next !is c); + + lattice.dfaCommon.allocator.free(c); + c = next; + } + + lattice.lastInSequence = null; + + if (lattice.constant !is null) + { + lattice.dfaCommon.allocator.free(lattice.constant); + lattice.constant = null; + } + + lattice.dfaCommon.allocator.free(lattice); + } + } + + bool isNull() + { + return lattice is null; + } + + bool haveNonContext() + { + if (isNull) + return false; + + DFAConsequence* cctx = this.getContext; + + foreach (c; this) + { + if (c !is cctx) + return true; + } + + return false; + } + + bool isModellable() + { + bool ret = true; + + bool walker(DFAConsequence* c) + { + if (c.var !is null && !c.var.isModellable) + { + ret = false; + return false; + } + + return true; + } + + this.walkMaybeTops(&walker); + return ret; + } + + DFAConsequence* findConsequence(DFAVar* var) + { + if (isNull) + return null; + + return lattice.findConsequence(var); + } + + DFAConsequence* addConsequence(DFAVar* var, DFAConsequence* copyFrom = null) + { + if (this.isNull) + return null; + + return this.lattice.addConsequence(var, copyFrom); + } + + DFAConsequence* getContext() + { + if (this.isNull) + return null; + + return this.lattice.context; + } + + DFAConsequence* getContext(out DFAVar* var) + { + if (this.isNull || this.lattice.context is null) + return null; + + var = this.lattice.context.var; + return this.lattice.context; + } + + DFAVar* getContextVar() + { + if (this.isNull || this.lattice.context is null) + return null; + return this.lattice.context.var; + } + + DFAConsequence* setContext(DFAConsequence* c) + { + if (c is null) + return null; + + this.lattice.context = c; + return c; + } + + DFAConsequence* setContext(DFAVar* var) + { + if (isNull) + return null; + + DFAConsequence* ret = this.addConsequence(var); + this.lattice.context = ret; + return ret; + } + + DFAConsequence* getGateConsequence() + { + if (isNull || lattice.context is null) + return null; + else if (lattice.context.var !is null && lattice.context.maybe is null) + return lattice.context; + else if (lattice.context.var is null && lattice.context.maybe !is null) + { + if (DFAConsequence* c = this.findConsequence(lattice.context.maybe)) + return c.maybe is null ? c : null; + } + + return null; + } + + DFAVar* getGateConsequenceVariable() + { + if (isNull || lattice.context is null) + return null; + else if (lattice.context.var !is null && lattice.context.maybe is null) + return lattice.context.var; + else if (lattice.context.var is null && lattice.context.maybe !is null) + { + if (DFAConsequence* c = this.findConsequence(lattice.context.maybe)) + return c.maybe is null ? c.var : null; + } + + return null; + } + + DFAConsequence* acquireConstantAsContext() + { + assert(!isNull); + return this.lattice.acquireConstantAsContext; + } + + DFAConsequence* acquireConstantAsContext(Truthiness truthiness, + Nullable nullable, DFAObject* obj) + { + assert(!isNull); + + DFAConsequence* ret = this.addConsequence(cast(DFAVar*) null); + this.setContext(ret); + + ret.truthiness = truthiness; + ret.nullable = nullable; + ret.obj = obj; + return ret; + } + + /// DFAConsequence.maybeTopSeen will be set on the DFAConsequence if it was visited + void walkMaybeTops(scope bool delegate(DFAConsequence*) del) + { + if (isNull || del is null) + return; + + this.lattice.walkMaybeTops(del); + } + + void cleanupConstant(DFAVar* contextVar) + { + if (!isNull) + this.lattice.cleanupConstant(contextVar); + } + + int opApply(scope int delegate(DFAConsequence* consequence) dg) + { + if (isNull) + return 0; + + return this.lattice.opApply(dg); + } + + void printStructure(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + this.lattice.printStructure(prefix, sdepth, currentFunction, depth); + } + + void printState(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + this.lattice.printState(prefix, sdepth, currentFunction, depth); + } + + void printActual(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + if (this.isNull) + return; + this.lattice.printActual(prefix, sdepth, currentFunction, depth); + } + + DFALatticeRef copy() + { + if (this.lattice is null) + return DFALatticeRef.init; + return this.lattice.copy(); + } + + DFALatticeRef copyWithoutInfiniteLifetime() + { + if (this.lattice is null) + return DFALatticeRef.init; + return this.lattice.copyWithoutInfiniteLifetime(); + } + + void check() + { + if (!isNull) + this.lattice.check; + } +} + +/*********************************************************** + * The collection of values and facts known about a variable. + * + * A DFALattice contains one or more `DFAConsequence` nodes. + * Each `DFAConsequence` represents the state of a variable at the current + * point in time. + */ +struct DFALattice +{ + private + { + DFALattice* listnext; + + DFACommon* dfaCommon; + DFAConsequence* firstInSequence, lastInSequence; + DFAConsequence*[16] buckets; + + DFAConsequence* constant; + } + + DFAConsequence* context; + + DFAConsequence* findConsequence(DFAVar* var) + { + if (var is null) + return this.constant; + + DFAConsequence** bucket = this.findBucketForVar(var); + if (*bucket !is null && (*bucket).var is var) + return *bucket; + else + return null; + } + + DFAConsequence* addConsequence(DFAVar* var, DFAConsequence* copyFrom = null) + { + DFAConsequence* ret; + + if (var is null) + { + if (this.constant is null) + { + ret = dfaCommon.allocator.makeConsequence(var, copyFrom); + } + else + ret = this.constant; + + this.constant = ret; + } + else + { + DFAConsequence** bucket = this.findBucketForVar(var); + if (*bucket !is null && (*bucket).var is var) + return *bucket; + + ret = dfaCommon.allocator.makeConsequence(var, copyFrom); + + if (this.lastInSequence !is null) + this.lastInSequence.previous = ret; + if (this.firstInSequence is null) + this.firstInSequence = ret; + + ret.next = this.lastInSequence; + this.lastInSequence = ret; + + if (copyFrom is null) + { + ret.writeOnVarAtThisPoint = var.writeCount; + } + + ret.bucketNext = *bucket; + *bucket = ret; + } + + assert(ret !is ret.next); + return ret; + } + + DFAConsequence** findBucketForVar(DFAVar* var) + { + DFAConsequence** bucket = &buckets[cast(size_t) var % buckets.length]; + + while (*bucket !is null && (*bucket).var < var) + { + bucket = &(*bucket).bucketNext; + } + + return bucket; + } + + DFAConsequence* acquireConstantAsContext() + { + DFAConsequence* ret = this.addConsequence(cast(DFAVar*) null); + this.context = ret; + + ret.truthiness = Truthiness.Unknown; + ret.nullable = Nullable.Unknown; + return ret; + } + + /// DFAConsequence.maybeTopSeen will be set on the DFAConsequence if it was visited + void walkMaybeTops(scope bool delegate(DFAConsequence*) del) + { + bool handle(DFAConsequence* c) + { + if (c is null || c.maybeTopSeen) + return true; + + c.maybeTopSeen = true; + if (!del(c)) + return false; + + if (handle(this.findConsequence(c.maybe))) + return true; + return false; + } + + foreach (c; this) + { + c.maybeTopSeen = false; + } + + if (DFAConsequence* c = this.context) + { + if (c.var !is null && c.maybe is null) + handle(c); + } + + foreach (c; this) + { + if (c.maybeTopSeen) + continue; + + if (c.maybe !is null) + { + if (!handle(c)) + break; + } + } + } + + void printStructure(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + static if (!dfaCommon.debugStructure) + return; + else + printActual(prefix, sdepth, currentFunction, depth); + } + + void printState(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + static if (!dfaCommon.debugIt) + return; + else + printActual(prefix, sdepth, currentFunction, depth); + } + + private void printActual(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0) + { + printPrefix("%s Lattice:\n", sdepth, currentFunction, depth, prefix); + + foreach (consequence; this) + { + consequence.print(prefix, sdepth, currentFunction, depth, consequence is this.context); + } + } + + int opApply(scope int delegate(DFAConsequence* consequence) dg) + { + DFAConsequence* c = this.lastInSequence; + int i; + + while (c !is null) + { + i = dg(c); + if (i) + return i; + + assert(c !is c.next); + c = c.next; + } + + if (this.constant !is null) + return dg(this.constant); + else + return 0; + } + + DFALatticeRef copy() + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + if (this.constant !is null) + { + DFAConsequence* newC = ret.addConsequence(null, this.constant); + + if (this.context is this.constant) + ret.setContext(newC); + } + + DFAConsequence* oldC = this.firstInSequence; + + while (oldC !is null) + { + DFAConsequence* newC = ret.addConsequence(oldC.var, oldC); + + if (this.context is oldC) + ret.setContext(newC); + + oldC = oldC.previous; + } + + ret.check; + return ret; + } + + DFALatticeRef copyWithoutInfiniteLifetime() + { + DFALatticeRef ret = dfaCommon.makeLatticeRef; + + if (this.constant !is null) + { + DFAConsequence* newC = ret.addConsequence(null, this.constant); + + if (this.context is this.constant) + ret.setContext(newC); + } + + DFAConsequence* oldC = this.firstInSequence; + + while (oldC !is null) + { + if (!oldC.var.haveInfiniteLifetime) + { + DFAConsequence* newC = ret.addConsequence(oldC.var, oldC); + + if (this.context is oldC) + ret.setContext(newC); + + } + oldC = oldC.previous; + } + + if (ret.getContext is null) + ret.acquireConstantAsContext; + + ret.check; + return ret; + } + + /// Remove constant if not context + void cleanupConstant(DFAVar* contextVar) + { + if (contextVar is null) + return; + + if (this.constant !is null) + { + dfaCommon.allocator.free(this.constant); + + if (this.context is this.constant) + this.context = this.addConsequence(contextVar); + + this.constant = null; + } + } + + void check() + { + static if (DFACommon.debugVerify) + { + assert((this.firstInSequence is null && this.constant is null) || this.context !is null); + + foreach (c1; this) + { + size_t countFind, countPrevious; + bool foundOurPrevious = c1.previous is null; + + foreach (c2; this) + { + if (c1.var is c2.var) + countFind++; + if (c2.previous is c1) + countPrevious++; + if (c1.previous !is null && c1.previous is c2) + foundOurPrevious = true; + } + + if (firstInSequence is c1) + countPrevious++; + + assert(countFind == 1); + assert(countPrevious <= 1); + assert(foundOurPrevious); + } + + { + DFAConsequence* temp = lastInSequence; + + while (temp !is null) + { + assert(temp.listnext is null); + temp = temp.next; + } + } + + { + DFAConsequence* temp = firstInSequence; + + while (temp !is null) + { + assert(temp.listnext is null); + temp = temp.previous; + } + } + } + } +} + +enum Truthiness : ubyte +{ + Unknown, // unmodelled + Maybe, // if assert'd non-constant consequences apply in true branch + False, // if false branch of if statement will be taken + True, // if true branch of if statement will be taken +} + +enum Nullable : ubyte +{ + Unknown, + Null, + NonNull +} + +enum PAMathOp : ubyte +{ + add, + sub, + mul, + div, + mod, + and, + or, + xor, + pow, + leftShift, + rightShiftSigned, + rightShiftUnsigned, + + postInc, + postDec +} + +// Point analysis, tracking of integral values such as a slice length or an integer typed variable/constant. +// Note that the math op functions here may not be correct. +// They'll just have to be fixed once a test case appears. +struct DFAPAValue +{ + enum Unknown = DFAPAValue(DFAPAValue.Kind.Unknown); + + Kind kind; + + // We use long to represent the VRP value, however this cuts off long.max .. ulong.max, represent this with UnknownUpperPositive. + // By doing long we can ignore signedness and lower negative long.min .. int.min, making things simpler. + long value; + + enum Kind : ubyte + { + Unknown, + UnknownUpperPositive, + Lower, // VRP lower inclusive + Upper, // VRP upper inclusive + Concrete + } + + this(Kind kind) + { + this.kind = kind; + } + + this(long value) + { + this.kind = Kind.Concrete; + this.value = value; + } + + int opCmp(const ref DFAPAValue other) const + { + if (this.kind != other.kind) + { + const difference = cast(int) this.kind - cast(int) other.kind; + return difference < 0 ? -1 : 1; + } + else if (this.kind == Kind.Concrete && other.kind == Kind.Concrete) + return this.value < other.value ? -1 : (this.value == other.value ? 0 : 1); + else + return 0; + } + + DFAPAValue meet(DFAPAValue other) + { + if (this.kind != other.kind || this.kind != Kind.Concrete || this.value != other.value) + return Unknown; + else + return this; + } + + DFAPAValue join(DFAPAValue other) + { + if (this > other) + return this; + else + return other; + } + + bool canFitIn(Type type) + { + if (this.kind < Kind.Lower) + return false; + + switch (type.ty) + { + case TY.Tint8: + return byte.min <= this.value && this.value <= byte.max; + + case TY.Tuns8: + return 0 <= this.value && this.value <= ubyte.max; + + case TY.Tint16: + return short.min <= this.value && this.value <= short.max; + + case TY.Tuns16: + return 0 <= this.value && this.value <= ushort.max; + + case TY.Tint32: + return int.min <= this.value && this.value <= int.max; + + case TY.Tuns32: + return 0 <= this.value && this.value <= uint.max; + + case TY.Tuns64: + case TY.Tuns128: + return 0 <= this.value; + + case TY.Tint64: + case TY.Tint128: + return true; + + default: + return false; + } + } + + Truthiness compareEqual(ref DFAPAValue other) + { + if (this.kind == DFAPAValue.Kind.Unknown || other.kind == DFAPAValue.Kind.Unknown) + return Truthiness.Unknown; + + const lhsConcrete = this.kind == DFAPAValue.Kind.Concrete; + const rhsConcrete = other.kind == DFAPAValue.Kind.Concrete; + + if (lhsConcrete && rhsConcrete) + return this.value == other.value ? Truthiness.True : Truthiness.False; + else if ((lhsConcrete || rhsConcrete) && (this.kind == DFAPAValue.Kind.UnknownUpperPositive + || other.kind == DFAPAValue.Kind.UnknownUpperPositive)) + return Truthiness.False; + + return Truthiness.Maybe; + } + + Truthiness compareNotEqual(ref DFAPAValue other) + { + if (this.kind == DFAPAValue.Kind.Unknown || other.kind == DFAPAValue.Kind.Unknown) + return Truthiness.Unknown; + else if (this.kind < DFAPAValue.Kind.Concrete || other.kind < DFAPAValue.Kind.Concrete) + return Truthiness.Maybe; // we can't know the value at this time of development but it could be equal + + if (this.kind == DFAPAValue.Kind.Concrete && other.kind == DFAPAValue.Kind.Concrete) + return (this.value == other.value) ? Truthiness.False : Truthiness.True; + + return Truthiness.Maybe; + } + + Truthiness greaterThan(ref DFAPAValue other) + { + Truthiness ret = Truthiness.Maybe; + + if (this.kind == DFAPAValue.Kind.Concrete && other.kind == DFAPAValue.Kind.Concrete) + ret = this.value > other.value ? Truthiness.True : Truthiness.False; + else if (this.kind == DFAPAValue.Kind.Concrete + && other.kind == DFAPAValue.Kind.UnknownUpperPositive) + ret = Truthiness.False; + + if (ret == Truthiness.False) + { + this = Unknown; + other = Unknown; + } + else + { + DFAPAValue temp = other; + + if (temp.kind == DFAPAValue.Kind.Concrete) + { + if (temp.value < long.max) + temp.value++; + else + temp.kind = DFAPAValue.Kind.UnknownUpperPositive; + } + + other = other.meet(this); + this = this.join(temp); + + if (other.kind > Kind.Lower) + other.kind = Kind.Upper; + if (this.kind >= Kind.Lower) + this.kind = Kind.Lower; + } + + return ret; + } + + Truthiness greaterThanOrEqual(ref DFAPAValue other) + { + Truthiness ret = Truthiness.Maybe; + + if (this.kind == DFAPAValue.Kind.Concrete && other.kind == DFAPAValue.Kind.Concrete) + ret = this.value >= other.value ? Truthiness.True : Truthiness.False; + else if (this.kind == DFAPAValue.Kind.Concrete + && other.kind == DFAPAValue.Kind.UnknownUpperPositive) + ret = Truthiness.False; + + if (ret == Truthiness.False) + { + this = Unknown; + other = Unknown; + } + else + { + other = other.meet(this); + this = this.join(other); + + if (other.kind > Kind.Lower) + other.kind = Kind.Upper; + if (this.kind >= Kind.Lower) + this.kind = Kind.Lower; + } + + return ret; + } + + void negate(Type type) + { + if (this.kind != Kind.Concrete || type is null) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = -cast(int)(cast(byte) this.value); + break; + case TY.Tint16: + this.value = -cast(int)(cast(short) this.value); + break; + case TY.Tint32: + this.value = -cast(int) this.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = -this.value; + break; + + case TY.Tuns8: + this.value = -cast(int)(cast(ubyte) this.value); + break; + case TY.Tuns16: + this.value = -cast(int)(cast(ushort) this.value); + break; + case TY.Tuns32: + this.value = -cast(uint) this.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = -this.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void addFrom(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + if (type.isUnsigned) + { + if (this.value > 0 && other.value > 0 && this.value > (long.max - other.value)) + { + // long.max .. ulong.max + this.kind = Kind.UnknownUpperPositive; + return; + } + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value + cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value + cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value + cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value + other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value + cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value + cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value + cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = this.value + other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void subtractFrom(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + if (type.isUnsigned) + { + if (other.value > this.value) + { + this.kind = Kind.Unknown; + return; + } + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value - cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value - cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value - cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value - other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value - cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value - cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value - cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = this.value - other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void multiplyFrom(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + if (type.isUnsigned) + { + if (this.value > 1 && other.value > 1 && this.value > (long.max / other.value)) + { + this.kind = Kind.UnknownUpperPositive; + return; + } + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value * cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value * cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value * cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value * other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value * cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value * cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value * cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = this.value * other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void divideFrom(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + this.kind = Kind.Unknown; + + if (!type.isUnsigned && this.value == long.min && other.value == -1) + { + return; + } + + switch (type.ty) + { + case TY.Tint8: + if (cast(byte) other.value == 0) + return; + this.value = cast(byte) this.value / cast(byte) other.value; + break; + case TY.Tint16: + if (cast(short) other.value == 0) + return; + this.value = cast(short) this.value / cast(short) other.value; + break; + case TY.Tint32: + if (cast(int) other.value == 0) + return; + this.value = cast(int) this.value / cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + if (other.value == 0) + return; + this.value = this.value / other.value; + break; + + case TY.Tuns8: + if (cast(ubyte) other.value == 0) + return; + this.value = cast(ubyte) this.value / cast(ubyte) other.value; + break; + case TY.Tuns16: + if (cast(ushort) other.value == 0) + return; + this.value = cast(ushort) this.value / cast(ushort) other.value; + break; + case TY.Tuns32: + if (cast(uint) other.value == 0) + return; + this.value = cast(uint) this.value / cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + if (cast(ulong) other.value == 0) + return; + // Must cast to ulong to perform correct unsigned 64-bit division before final assignment. + this.value = cast(long)(cast(ulong) this.value / cast(ulong) other.value); + break; + + default: + return; + } + + this.kind = Kind.Concrete; + } + + void modulasFrom(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete || other.value == 0) + { + this.kind = Kind.Unknown; + return; + } + + if (!type.isUnsigned) + { + if (this.value == long.min && other.value == -1) + { + this.kind = Kind.Unknown; + return; + } + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value % cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value % cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value % cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value % other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value % cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value % cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value % cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(long)(cast(ulong) this.value % cast(ulong) other.value); + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void leftShiftBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete || other.value < 0) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value << cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value << cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value << cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value << other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value << cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value << cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value << cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(ulong) this.value << cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void rightShiftSignedBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete || other.value < 0) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value >> cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value >> cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value >> cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value >> other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value >>> cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value >>> cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value >>> cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(ulong) this.value >>> cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void rightShiftUnsignedBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete || other.value < 0) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + // We cast to the unsigned equivalent of the target size (ubyte, ushort, uint) + // to force the logical shift behavior (zero-filling). + case TY.Tint8: + case TY.Tuns8: + this.value = cast(ubyte) this.value >>> cast(ubyte) other.value; + break; + case TY.Tint16: + case TY.Tuns16: + this.value = cast(ushort) this.value >>> cast(ushort) other.value; + break; + case TY.Tint32: + case TY.Tuns32: + this.value = cast(uint) this.value >>> cast(uint) other.value; + break; + case TY.Tint64: + case TY.Tuns64: + case TY.Tint128: + case TY.Tuns128: + // For 64-bit, we use ulong to perform the logical shift before casting back to long. + this.value = cast(ulong) this.value >>> cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void powerBy(DFAPAValue other, Type type) + { + const exponent = other.value; + const base = this.value; + + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete || exponent < 0) + { + this.kind = Kind.Unknown; + return; + } + else if (exponent == 0) + { + // base ^^ 0 + this.value = 1; + return; + } + else if (base == 0) + { + // 0 ^^ exponent + this.value = 0; + return; + } + else if (exponent == 1) + { + // base ^^ 1 + return; + } + + const temp = cast(ulong) base ^^ cast(ulong) exponent; + + if (temp > long.max) + { + this.kind = Kind.UnknownUpperPositive; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) temp; + break; + case TY.Tint16: + this.value = cast(short) temp; + break; + case TY.Tint32: + this.value = cast(int) temp; + break; + case TY.Tint64: + case TY.Tint128: + this.value = cast(long) temp; + break; + + case TY.Tuns8: + this.value = cast(ubyte) temp; + break; + case TY.Tuns16: + this.value = cast(ushort) temp; + break; + case TY.Tuns32: + this.value = cast(uint) temp; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = temp; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void bitwiseAndBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value & cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value & cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value & cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value & other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value & cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value & cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value & cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(ulong) this.value & cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void bitwiseOrBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value | cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value | cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value | cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value | other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value | cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value | cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value | cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(ulong) this.value | cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void bitwiseXorBy(DFAPAValue other, Type type) + { + if (this.kind != Kind.Concrete || other.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = cast(byte) this.value ^ cast(byte) other.value; + break; + case TY.Tint16: + this.value = cast(short) this.value ^ cast(short) other.value; + break; + case TY.Tint32: + this.value = cast(int) this.value ^ cast(int) other.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = this.value ^ other.value; + break; + + case TY.Tuns8: + this.value = cast(ubyte) this.value ^ cast(ubyte) other.value; + break; + case TY.Tuns16: + this.value = cast(ushort) this.value ^ cast(ushort) other.value; + break; + case TY.Tuns32: + this.value = cast(uint) this.value ^ cast(uint) other.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = cast(ulong) this.value ^ cast(ulong) other.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } + + void bitwiseInvert(Type type) + { + if (this.kind != Kind.Concrete) + { + this.kind = Kind.Unknown; + return; + } + + switch (type.ty) + { + case TY.Tint8: + this.value = ~cast(int)(cast(byte) this.value); + break; + case TY.Tint16: + this.value = ~cast(int)(cast(short) this.value); + break; + case TY.Tint32: + this.value = ~cast(int) this.value; + break; + case TY.Tint64: + case TY.Tint128: + this.value = ~this.value; + break; + + case TY.Tuns8: + this.value = ~cast(int)(cast(ubyte) this.value); + break; + case TY.Tuns16: + this.value = ~cast(int)(cast(ushort) this.value); + break; + case TY.Tuns32: + this.value = ~cast(uint) this.value; + break; + case TY.Tuns64: + case TY.Tuns128: + this.value = ~this.value; + break; + + default: + this.kind = Kind.Unknown; + break; + } + } +} + +/*********************************************************** + * A specific fact known about a variable at the current point in time. + * + * Examples of consequences: + * - "This variable is definitely not null" (`nullable == NonNull`) + * - "This variable is True" (`truthiness == True`) + * - "This variable has the integer value 5" (`pa` - Point Analysis) + */ +struct DFAConsequence +{ + private + { + DFACommon* dfaCommon; + DFAConsequence* listnext; + DFAConsequence* previous, next, bucketNext; + } + + // This will be null if it is a constant or effect + DFAVar* var; + // only valid when var.writeCount == writeOnVarAtThisPoint + uint writeOnVarAtThisPoint; + + // Must be asserted to be true, at which point a join takes place + Truthiness truthiness; + // Ditto + Nullable nullable; + // Boolean logic can be inverted once, + // thanks to or and equality expressions we won't be tracking it beyond that one invert. + bool invertedOnce; + // Protect else bodies assertion of the condition from introducing unknowable things + bool protectElseNegate; + // When the context is maybe, look at this instead + DFAVar* maybe; + bool maybeTopSeen; + // Point analysis value, tracking of integral/length values + DFAPAValue pa; + // The object that this is if its non-null + DFAObject* obj; + + void copyFrom(DFAConsequence* other) + { + if (other is null) + return; + + if (this.var is other.var) + this.writeOnVarAtThisPoint = other.writeOnVarAtThisPoint; + + this.truthiness = other.truthiness; + this.nullable = other.nullable; + this.invertedOnce = other.invertedOnce; + this.maybe = other.maybe; + this.protectElseNegate = other.protectElseNegate; + this.pa = other.pa; + this.obj = other.obj; + } + + void meetConsequence(DFAConsequence* c1, DFAConsequence* c2, bool couldScopeNotHaveRan = false) + { + void doOne(DFAConsequence* c) + { + version (DebugJoinMeetOp) + { + printf("meet one c1 %p %d %d %d\n", c.var, c.truthiness, + c.nullable, c.writeOnVarAtThisPoint); + fflush(stdout); + } + + this.invertedOnce = c.invertedOnce; + this.writeOnVarAtThisPoint = c.writeOnVarAtThisPoint; + this.pa = couldScopeNotHaveRan ? DFAPAValue.Unknown : c.pa; + this.obj = couldScopeNotHaveRan ? dfaCommon.makeObject(c.obj) : c.obj; + + if (this.var is null || this.var.isTruthy) + this.truthiness = couldScopeNotHaveRan ? Truthiness.Unknown : c.truthiness; + if (this.var is null || this.var.isNullable) + this.nullable = couldScopeNotHaveRan ? Nullable.Unknown : c.nullable; + } + + void doMulti() + { + version (DebugJoinMeetOp) + { + printf("meet multi c1 %p %d %d %d\n", c1.var, c1.truthiness, + c1.nullable, c1.writeOnVarAtThisPoint); + printf("meet multi c2 %p %d %d %d\n", c2.var, c2.truthiness, + c2.nullable, c2.writeOnVarAtThisPoint); + fflush(stdout); + } + + this.writeOnVarAtThisPoint = c1.writeOnVarAtThisPoint > c2.writeOnVarAtThisPoint + ? c1.writeOnVarAtThisPoint : c2.writeOnVarAtThisPoint; + + this.invertedOnce = this.truthiness == Truthiness.Unknown + ? false : (c1.invertedOnce || c2.invertedOnce); + + this.pa = couldScopeNotHaveRan ? DFAPAValue.Unknown : c1.pa.meet(c2.pa); + + if (this.var is null || this.var.isTruthy) + { + this.truthiness = (couldScopeNotHaveRan && c1.truthiness != c2.truthiness) + ? Truthiness.Unknown : (c1.truthiness < c2.truthiness + ? c1.truthiness : c2.truthiness); + if (this.truthiness == Truthiness.Maybe) + this.truthiness = Truthiness.Unknown; + } + + if (this.var is null || this.var.isNullable) + { + this.nullable = (couldScopeNotHaveRan && c1.nullable != c2.nullable) + ? Nullable.Unknown : (c1.nullable < c2.nullable ? c1.nullable : c2.nullable); + + if (c1.obj !is null || c2.obj !is null) + { + if (c1.obj !is c2.obj) + this.obj = dfaCommon.makeObject(c1.obj, c2.obj); + else + this.obj = c1.obj !is null ? c1.obj : c2.obj; + } + } + } + + const writeCount = this.var.writeCount; + + version (DebugJoinMeetOp) + { + printf("meet consequence c1=%p, c2=%p\n", c1, c2); + printf(" vars c1=%p, c2=%p\n", c1 !is null ? c1.var : null, + c2 !is null ? c2.var : null); + printf(" writeCount=%d/%d:%d\n", writeCount, + c1.writeOnVarAtThisPoint, c2 !is null ? c2.writeOnVarAtThisPoint : -1); + printf(" couldScopeNotHaveRan=%d\n", couldScopeNotHaveRan); + fflush(stdout); + } + + if (c2 is null || c2.writeOnVarAtThisPoint < writeCount) + doOne(c1); + else + doMulti; + } + + // c1 may be the same consequence as this + void joinConsequence(DFAConsequence* c1, DFAConsequence* c2, DFAConsequence* rhsCtx, + bool isC1Context, bool ignoreWriteCount = false, bool unknownAware = false) + { + void doOne(DFAConsequence* c) + { + version (DebugJoinMeetOp) + { + printf("join one c %p %d %d %d, isC1=%d, isC2=%d\n", c.var, + c.truthiness, c.nullable, c.writeOnVarAtThisPoint, c is c1, c is c2); + fflush(stdout); + } + + this.invertedOnce = c.invertedOnce; + this.writeOnVarAtThisPoint = c.writeOnVarAtThisPoint; + this.maybe = c.maybe; + this.pa = c.pa; + this.obj = c.obj; + + if (this.var is null || this.var.isTruthy) + this.truthiness = c.truthiness; + if (this.var is null || this.var.isNullable) + this.nullable = c.nullable; + } + + void doMulti(DFAConsequence* c2) + { + version (DebugJoinMeetOp) + { + printf("join multi c1 %p %d %d %d\n", c1.var, c1.truthiness, + c1.nullable, c1.writeOnVarAtThisPoint); + printf("join multi c2 %p %d %d %d\n", c2.var, c2.truthiness, + c2.nullable, c2.writeOnVarAtThisPoint); + fflush(stdout); + } + + this.invertedOnce = c1.invertedOnce || c2.invertedOnce; + this.writeOnVarAtThisPoint = c1.writeOnVarAtThisPoint < c2.writeOnVarAtThisPoint + ? c2.writeOnVarAtThisPoint : c1.writeOnVarAtThisPoint; + this.pa = c1.pa.join(c2.pa); + + if (this.var is null || this.var.isTruthy) + { + if (unknownAware && c1.truthiness == Truthiness.Unknown + || c2.truthiness == Truthiness.Unknown) + this.truthiness = Truthiness.Unknown; + else + this.truthiness = c1.truthiness < c2.truthiness ? c2.truthiness : c1.truthiness; + } + + if (this.var is null || this.var.isNullable) + { + if (unknownAware && c1.nullable == Nullable.Unknown + || c2.nullable == Nullable.Unknown) + this.nullable = Nullable.Unknown; + else + this.nullable = c1.nullable < c2.nullable ? c2.nullable : c1.nullable; + + if (c1.obj !is null || c2.obj !is null) + { + if (c1.obj !is c2.obj) + this.obj = dfaCommon.makeObject(c1.obj, c2.obj); + else + this.obj = c1.obj !is null ? c1.obj : c2.obj; + } + } + + this.maybe = c2.maybe; + + version (DebugJoinMeetOp) + { + printf(" result %d %d\n", this.truthiness, this.nullable); + fflush(stdout); + } + } + + const writeCount = this.var.writeCount; + + version (DebugJoinMeetOp) + { + printf("join consequence c1=%p, c2=%p, rhsCtx=%p, this=%p\n", c1, c2, rhsCtx, &this); + printf(" vars c1=%p, c2=%p, rhsCtx=%p, this=%p\n", c1 !is null + ? c1.var : null, c2 !is null ? c2.var : null, rhsCtx !is null + ? rhsCtx.var : null, this.var); + printf(" writeCount=%d/%d:%d\n", writeCount, + c1.writeOnVarAtThisPoint, c2 !is null ? c2.writeOnVarAtThisPoint : -1); + printf(" isC1Context=%d, unknownAware=%d, ignoreWriteCount=%d\n", + isC1Context, unknownAware, ignoreWriteCount); + fflush(stdout); + } + + if (ignoreWriteCount) + { + if (c2 !is null) + doMulti(c2); + else + doOne(c1); + } + else if (c2 !is null && c2.writeOnVarAtThisPoint >= writeCount) + { + if (c2.writeOnVarAtThisPoint < c1.writeOnVarAtThisPoint) + doMulti(c2); + else + doOne(c2); + } + else + { + if (isC1Context && rhsCtx !is null && rhsCtx.writeOnVarAtThisPoint == writeCount + && (rhsCtx.var is null || rhsCtx.var is c1.var)) + { + if (rhsCtx.writeOnVarAtThisPoint < c1.writeOnVarAtThisPoint) + doMulti(rhsCtx); + } + else + doOne(c1); + } + } + + void print(const(char)* prefix = "", int sdepth = 0, + FuncDeclaration currentFunction = null, int depth = 0, bool context = false) + { + static immutable TruthinessStr = [ + "unkno".ptr, "maybe".ptr, "false".ptr, " true".ptr + ]; + static immutable NullableStr = ["unkno".ptr, " null".ptr, "!null".ptr]; + + printPrefix(" %s%s ", sdepth, currentFunction, depth, context ? "+".ptr : " ".ptr, prefix); + printf("%p: ", &this); + printf("truthiness=%s, nullable=%s, write=%d, ", TruthinessStr[this.truthiness], + NullableStr[this.nullable], this.writeOnVarAtThisPoint); + printf("maybe=%p:%d, protectElseNegate=%d, invertedOnce=%d ", maybe, + maybeTopSeen, protectElseNegate, invertedOnce); + printf("previous=%p, next=%p, pa=%03d/%lld", this.previous, this.next, + this.pa.kind, this.pa.value); + + printf(", %p", this.var); + if (this.var !is null) + { + printf("=%d:%lld:b/%p/%p", this.var.assertedCount, + this.var.offsetFromBase, this.var.base1, this.var.base2); + + if (this.var !is null && this.var.var !is null) + printf("@%p=`%s`", this.var.var, this.var.var.toChars); + } + + printf(", obj=%p", this.obj); + printf("\n", this.var); + } +} + +private: +void applyType(DFAVar* var, VarDeclaration vd) +{ + var.isNullable = vd.isRef || isTypeNullable(vd.type); + var.isTruthy = isTypeTruthy(vd.type); + + var.isStaticArray = vd.type.isTypeSArray !is null; + var.isBoolean = vd.type.ty == Tbool; + var.isFloatingPoint = vd.type.isTypeBasic !is null + && (vd.type.isTypeBasic.flags & TFlags.floating) != 0; + + // Unfortunately isDataseg can have very undesirable side effects that kill compilation, + // even if it shouldn't when this is ran. + if (vd.parent !is null && vd.parent.isFuncDeclaration) + { + // make sure the parent of this variable is a function, if it isn't then we can't model it. + if (!(vd.canTakeAddressOf + && (vd.storage_class & (STC.static_ | STC.extern_ | STC.gshared)) == 0)) + var.unmodellable = true; + } + else + var.unmodellable = true; +} + +void printPrefix(Args...)(ref OutBuffer ob, const(char)* prefix, int sdepth, + FuncDeclaration currentFunction, int edepth, Args args) +{ + ob.printf("%.*s[%p]", sdepth, PrintPipeText.ptr, currentFunction); + + if (edepth == 0) + ob.write(">"); + else + ob.printf(";%.*s>", edepth, PrintPipeText.ptr); + + ob.printf(prefix, args); +} + +void printPrefix(Args...)(const(char)* prefix, int sdepth, + FuncDeclaration currentFunction, int edepth, Args args) +{ + printf("%.*s[%p]", sdepth, PrintPipeText.ptr, currentFunction); + + if (edepth == 0) + printf(">"); + else + printf(";%.*s>", edepth, PrintPipeText.ptr); + + printf(prefix, args); +} diff --git a/dmd/dfa/utils.d b/dmd/dfa/utils.d new file mode 100644 index 00000000000..74da0a3e401 --- /dev/null +++ b/dmd/dfa/utils.d @@ -0,0 +1,163 @@ +/** + * Utilities for Data Flow Analysis. + * + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved + * Authors: $(LINK2 https://cattermole.co.nz, Richard (Rikki) Andrew Cattermole) + * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) + * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dfa/utils.d, dfa/utils.d) + * Documentation: https://dlang.org/phobos/dmd_dfa_utils.html + * Coverage: https://codecov.io/gh/dlang/dmd/src/master/compiler/src/dmd/dfa/utils.d + */ +module dmd.dfa.utils; +import dmd.tokens; +import dmd.astenums; +import dmd.mtype; +import dmd.visitor; +import dmd.identifier; +import dmd.expression; +import dmd.typesem : isFloating; + +/*********************************************************** + * Checks if a type is capable of being null at runtime. + * + * The DFA uses this to determine if a null-check is required + * for a specific variable. + * + * Returns: + * true if the type is a pointer, array, class, delegate, etc. + */ +bool isTypeNullable(Type type) +{ + if (type is null) + return false; + + switch (type.ty) + { + case TY.Tarray, TY.Taarray, TY.Tpointer, TY.Treference, TY.Tfunction, + TY.Tclass, TY.Tdelegate: + return true; + + default: + return false; + } +} + +/*********************************************************** + * Checks if a type can be evaluated as a boolean (truthy/falsey). + * + * Used by the DFA to determine if control flow (like `if` statements) + * depends on this variable. + * + * Returns: + * false for types like `void` (noreturn) or `struct` (unless they define opCast), + * true for integers, pointers, bools, etc. + */ +bool isTypeTruthy(Type type) +{ + if (type is null) + return false; + + switch (type.ty) + { + case TY.Tident: + case TY.Terror: + case TY.Ttypeof: + case TY.Ttuple: + case TY.Treturn: + case TY.Ttraits: + case TY.Tmixin: + case TY.Tnoreturn: + case TY.Ttag: + case TY.Tsarray: + case TY.Tstruct: + case TY.Tvector: + return false; + + default: + return true; + } +} + +bool isIndexContextAA(IndexExp ie) +{ + if (ie is null || ie.e1 is null || ie.e1.type is null) + return false; + return ie.e1.type.isTypeAArray !is null; +} + +int concatNullableResult(Type lhs, Type rhs) +{ + // T[] ~ T[] + // T[] ~ T + // T ~ T[] + // T ~ T + + if (lhs.isStaticOrDynamicArray) + { + if (rhs.isStaticOrDynamicArray) + return 1; // Depends on lhs and rhs + return 2; // non-null + } + else if (rhs.isStaticOrDynamicArray) + return 2; + + return 0; // Unknown +} + +enum EqualityArgType +{ + Unknown, + Struct, + FloatingPoint, + StaticArray, + StaticArrayLHS, + StaticArrayRHS, + DynamicArray, + AssociativeArray, + Nullable +} + +/*********************************************************** + * Classifies how two types are compared for equality at runtime. + * + * This mirrors the logic in the compiler backend/glue layer. + * The DFA needs this to accurately predict if an equality check (`==`) + * involves simple integer comparison, array comparison, or struct comparison. + */ +/// See_Also: EqualityArgType +EqualityArgType equalityArgTypes(Type lhs, Type rhs) +{ + // This logic originally came from dmd's glue layer. + // It was copied over and modified so that the DFA is accruate to runtime actions. + + // struct + // floating point + // lhs && rhs static, dyamic array + // lhs && rhs associative array + // otherwise integral + + if (lhs.ty == Tstruct) + return EqualityArgType.Struct; + else if (lhs.isFloating) + return EqualityArgType.FloatingPoint; + + if (rhs is null) + rhs = lhs; // Assume rhs is similar to lhs + + const lhsSArray = lhs.isTypeSArray !is null, rhsSArray = rhs.isTypeSArray !is null; + if (lhsSArray && rhsSArray) + return EqualityArgType.StaticArray; + else if (lhsSArray) + return EqualityArgType.StaticArrayLHS; + else if (rhsSArray) + return EqualityArgType.StaticArrayRHS; + + if (lhs.isTypeDArray || rhs.isTypeDArray) + return EqualityArgType.DynamicArray; + else if (lhs.ty == Taarray && rhs.ty == Taarray) + return EqualityArgType.AssociativeArray; + else if (isTypeNullable(lhs)) + return EqualityArgType.Nullable; + else + return EqualityArgType.Unknown; +} diff --git a/dmd/dimport.d b/dmd/dimport.d index e634081e86f..349f439ac2c 100644 --- a/dmd/dimport.d +++ b/dmd/dimport.d @@ -1,7 +1,7 @@ /** * A `Dsymbol` representing a renamed import. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dimport.d, _dimport.d) @@ -95,7 +95,7 @@ extern (C++) final class Import : Dsymbol { assert(!s); auto si = new Import(loc, packages, id, aliasId, isstatic); - si.comment = comment; + si.addComment(comment); assert(!(isstatic && names.length)); if (names.length && !si.aliasId) si.ident = null; diff --git a/dmd/dinterpret.d b/dmd/dinterpret.d index 6f5083549e8..fb07953ace4 100644 --- a/dmd/dinterpret.d +++ b/dmd/dinterpret.d @@ -3,7 +3,7 @@ * * Specification: ($LINK2 https://dlang.org/spec/function.html#interpretation, Compile Time Function Execution (CTFE)) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dinterpret.d, _dinterpret.d) @@ -51,7 +51,7 @@ import dmd.root.utf; import dmd.statement; import dmd.semantic2 : findFunc; import dmd.tokens; -import dmd.typesem : mutableOf, equivalent, pointerTo, sarrayOf, arrayOf, size, merge, defaultInitLiteral; +import dmd.typesem; import dmd.utils : arrayCastBigEndian; import dmd.visitor; @@ -4702,34 +4702,6 @@ public: result = CTFEExp.voidexp; return; } - else if (isArrayConstruction(fd.ident)) - { - // In expressionsem.d, `T[x] ea = eb;` was lowered to: - // `_d_array{,set}ctor(ea[], eb[]);`. - // The following code will rewrite it back to `ea = eb` and - // then interpret that expression. - - if (fd.ident == Id._d_arrayctor) - assert(e.arguments.length == 3); - else - assert(e.arguments.length == 2); - - Expression ea = (*e.arguments)[0]; - if (ea.isCastExp) - ea = ea.isCastExp.e1; - - Expression eb = (*e.arguments)[1]; - if (eb.isCastExp() && fd.ident == Id._d_arrayctor) - eb = eb.isCastExp.e1; - - ConstructExp ce = new ConstructExp(e.loc, ea, eb); - ce.type = ea.type; - - ce.type = ea.type; - result = interpret(ce, istate); - - return; - } } else if (auto soe = ecall.isSymOffExp()) { diff --git a/dmd/dmacro.d b/dmd/dmacro.d index 307b43fb63f..f42ef3f7839 100644 --- a/dmd/dmacro.d +++ b/dmd/dmacro.d @@ -1,7 +1,7 @@ /** * Text macro processor for Ddoc. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dmacro.d, _dmacro.d) diff --git a/dmd/dmodule.d b/dmd/dmodule.d index a2cb13156c9..007faf0738e 100644 --- a/dmd/dmodule.d +++ b/dmd/dmodule.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/module.html, Modules) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dmodule.d, _dmodule.d) @@ -25,13 +25,9 @@ import dmd.common.outbuffer; import dmd.compiler; import dmd.cparse; import dmd.declaration; -import dmd.dimport; import dmd.dmacro; -import dmd.doc; -import dmd.dscope; import dmd.dsymbol; import dmd.errors; -import dmd.errorsink; import dmd.expression; import dmd.file_manager; import dmd.func; @@ -44,13 +40,8 @@ import dmd.root.array; import dmd.root.file; import dmd.root.filename; import dmd.root.port; -import dmd.root.rmem; import dmd.root.string; -import dmd.rootobject; -import dmd.semantic2; -import dmd.semantic3; import dmd.target; -import dmd.utils; import dmd.visitor; version (Windows) @@ -408,7 +399,7 @@ extern (C++) final class Module : Package Identifiers* versionidsNot; // forward referenced version identifiers MacroTable macrotable; // document comment macros - Escape* _escapetable; // document comment escapes + void* _escapetable; // document comment escapes (Escape*) size_t nameoffset; // offset of module name from start of ModuleInfo size_t namelen; // length of module name in characters @@ -471,7 +462,7 @@ else if (doHdrGen) hdrfile = setOutfilename(global.params.dihdr.name, global.params.dihdr.dir, arg, hdr_ext); - this.edition = Edition.min; + this.edition = global.params.edition; } extern (D) this(const(char)[] filename, Identifier ident, int doDocComment, int doHdrGen) @@ -764,7 +755,7 @@ else */ if (buf.length>= 4 && buf[0..4] == "Ddoc") { - comment = buf.ptr + 4; + this.addComment(buf.ptr + 4); filetype = FileType.ddoc; if (!docfile) setDocfile(); @@ -777,7 +768,7 @@ else */ if (FileName.equalsExt(arg, dd_ext)) { - comment = buf.ptr; // the optional Ddoc, if present, is handled above. + this.addComment(buf.ptr); // the optional Ddoc, if present, is handled above. filetype = FileType.ddoc; if (!docfile) setDocfile(); @@ -1100,15 +1091,6 @@ else } } - /** Lazily initializes and returns the escape table. - Turns out it eats a lot of memory. - */ - extern(D) Escape* escapetable() nothrow - { - if (!_escapetable) - _escapetable = new Escape(); - return _escapetable; - } } /*********************************************************** @@ -1341,35 +1323,3 @@ private const(char)[] processSource (const(ubyte)[] src, Module mod) return buf; } - -/******************************************* - * Look for member of the form: - * const(MemberInfo)[] getMembers(string); - * Returns NULL if not found - */ -FuncDeclaration findGetMembers(ScopeDsymbol dsym) -{ - import dmd.opover : search_function; - Dsymbol s = search_function(dsym, Id.getmembers); - FuncDeclaration fdx = s ? s.isFuncDeclaration() : null; - version (none) - { - // Finish - __gshared TypeFunction tfgetmembers; - if (!tfgetmembers) - { - Scope sc; - sc.eSink = global.errorSink; - Parameters* p = new Parameter(STC.in_, Type.tchar.constOf().arrayOf(), null, null); - auto parameters = new Parameters(p); - Type tret = null; - TypeFunction tf = new TypeFunction(parameters, tret, VarArg.none, LINK.d); - tfgetmembers = tf.dsymbolSemantic(Loc.initial, &sc).isTypeFunction(); - } - if (fdx) - fdx = fdx.overloadExactMatch(tfgetmembers); - } - if (fdx && fdx.isVirtual()) - fdx = null; - return fdx; -} diff --git a/dmd/doc.d b/dmd/doc.d index 3c9f3fafb79..e75dc215f8a 100644 --- a/dmd/doc.d +++ b/dmd/doc.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/ddoc.html, Documentation Generator) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/doc.d, _doc.d) @@ -33,6 +33,7 @@ import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem; +import dmd.templatesem : computeOneMember; import dmd.dtemplate; import dmd.errorsink; import dmd.func; @@ -44,8 +45,6 @@ import dmd.lexer; import dmd.location; import dmd.mtype; import dmd.root.array; -import dmd.root.file; -import dmd.root.filename; import dmd.common.outbuffer; import dmd.root.port; import dmd.root.rmem; @@ -54,6 +53,7 @@ import dmd.root.utf; import dmd.tokens; import dmd.visitor; + /**************************************************** * Generate Ddoc text for Module `m` and append it to `outbuf`. * Params: @@ -77,7 +77,7 @@ version (IN_LLVM) // Ddoc files override default macros DocComment.parseMacros(m.escapetable, m.macrotable, ddoctext); - Scope* sc = Scope.createGlobal(m, eSink); // create root scope + Scope* sc = scopeCreateGlobal(m, eSink); // create root scope DocComment* dc = DocComment.parse(m, m.comment); dc.pmacrotable = &m.macrotable; dc.escapetable = m.escapetable; @@ -218,44 +218,6 @@ void gendocfile(Module m, const char* ddoctext_ptr, size_t ddoctext_length, cons gendocfile(m, ddoctext_ptr[0 .. ddoctext_length], datetime, eSink, outbuf); } -public -struct Escape -{ - const(char)[][char.max] strings; - - /*************************************** - * Find character string to replace c with. - */ - const(char)[] escapeChar(char c) @safe - { - version (all) - { - //printf("escapeChar('%c') => %p, %p\n", c, strings, strings[c].ptr); - return strings[c]; - } - else - { - const(char)[] s; - switch (c) - { - case '<': - s = "<"; - break; - case '>': - s = ">"; - break; - case '&': - s = "&"; - break; - default: - s = null; - break; - } - return s; - } - } -} - /*********************************************************** */ public @@ -666,6 +628,53 @@ struct DocComment private: +/** Lazily initializes and returns the escape table. +Turns out it eats a lot of memory. +*/ +Escape* escapetable(Module _this) nothrow +{ + if (!_this._escapetable) + _this._escapetable = new Escape(); + return cast(Escape*) _this._escapetable; +} + +struct Escape +{ + const(char)[][char.max] strings; + + /*************************************** + * Find character string to replace c with. + */ + const(char)[] escapeChar(char c) @safe + { + version (all) + { + //printf("escapeChar('%c') => %p, %p\n", c, strings, strings[c].ptr); + return strings[c]; + } + else + { + const(char)[] s; + switch (c) + { + case '<': + s = "<"; + break; + case '>': + s = ">"; + break; + case '&': + s = "&"; + break; + default: + s = null; + break; + } + return s; + } + } +} + /*********************************************************** */ class Section @@ -914,8 +923,9 @@ bool isCVariadicParameter(Dsymbols* a, const(char)[] p) @safe return false; } -Dsymbol getEponymousMember(TemplateDeclaration td) @safe +Dsymbol getEponymousMember(TemplateDeclaration td) { + td.computeOneMember(); if (!td.onemember) return null; if (AggregateDeclaration ad = td.onemember.isAggregateDeclaration()) @@ -929,7 +939,7 @@ Dsymbol getEponymousMember(TemplateDeclaration td) @safe return null; } -TemplateDeclaration getEponymousParent(Dsymbol s) @safe +TemplateDeclaration getEponymousParent(Dsymbol s) { if (!s.parent) return null; @@ -1096,8 +1106,9 @@ bool emitAnchorName(ref OutBuffer buf, Dsymbol s, Scope* sc, bool includeParent) if (dot) buf.writeByte('.'); // Use "this" not "__ctor" - TemplateDeclaration td; - if (s.isCtorDeclaration() || ((td = s.isTemplateDeclaration()) !is null && td.onemember && td.onemember.isCtorDeclaration())) + TemplateDeclaration td = s.isTemplateDeclaration(); + td.computeOneMember(); + if (s.isCtorDeclaration() || (td !is null && td.onemember && td.onemember.isCtorDeclaration())) { buf.writestring("this"); } @@ -1385,11 +1396,11 @@ void emitComment(Dsymbol s, ref OutBuffer buf, Scope* sc) { if (s && sc.lastdc && isDitto(com)) { - sc.lastdc.a.push(s); + (cast(DocComment*) sc.lastdc).a.push(s); return; } // Put previous doc comment if exists - if (DocComment* dc = sc.lastdc) + if (auto dc = cast(DocComment*) sc.lastdc) { assert(dc.a.length > 0, "Expects at least one declaration for a" ~ "documentation comment"); @@ -2627,11 +2638,12 @@ Parameter isFunctionParameter(Dsymbols* a, const(char)[] p) @safe /**************************************************** */ -Parameter isEponymousFunctionParameter(Dsymbols* a, const(char)[] p) @safe +Parameter isEponymousFunctionParameter(Dsymbols* a, const(char)[] p) { foreach (Dsymbol dsym; *a) { TemplateDeclaration td = dsym.isTemplateDeclaration(); + td.computeOneMember(); if (td && td.onemember) { /* Case 1: we refer to a template declaration inside the template @@ -3114,7 +3126,9 @@ struct MarkdownLink { size_t iStart = i + 1; size_t iEnd = iStart; - if (iEnd >= buf.length || buf[iEnd] != '[' || (iEnd+1 < buf.length && buf[iEnd+1] == ']')) + if (iEnd >= buf.length) + return i; + if (buf[iEnd] != '[' || (iEnd+1 < buf.length && buf[iEnd+1] == ']')) { // collapsed reference [foo][] or shortcut reference [foo] iStart = delimiter.iStart + delimiter.count - 1; diff --git a/dmd/doc.h b/dmd/doc.h index 61a51a0b82b..142374da1f6 100644 --- a/dmd/doc.h +++ b/dmd/doc.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/dscope.d b/dmd/dscope.d index 8d249f6556e..4cce50722aa 100644 --- a/dmd/dscope.d +++ b/dmd/dscope.d @@ -3,7 +3,7 @@ * * Not to be confused with the `scope` storage class. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dscope.d, _dscope.d) @@ -16,33 +16,21 @@ module dmd.dscope; import core.stdc.stdio; import core.stdc.string; import dmd.aggregate; -import dmd.arraytypes; import dmd.astenums; import dmd.attrib; import dmd.ctorflow; import dmd.dclass; import dmd.declaration; import dmd.dmodule; -import dmd.doc; import dmd.dstruct; import dmd.dsymbol; -import dmd.dsymbolsem; import dmd.dtemplate; -import dmd.expression; -import dmd.errors; import dmd.errorsink; import dmd.func; import dmd.globals; -import dmd.id; import dmd.identifier; -import dmd.importc; -import dmd.location; -import dmd.common.outbuffer; import dmd.root.rmem; -import dmd.root.speller; import dmd.statement; -import dmd.target; -import dmd.tokens; //version=LOGSEARCH; @@ -73,6 +61,14 @@ private extern (D) struct FlagBitFields bool canFree; /// is on free list bool fullinst; /// fully instantiate templates bool ctfeBlock; /// inside a `if (__ctfe)` block + + /** + Is any symbol this scope is applied to known to have a compile time only accessible context. + This is not the same as `skipCodegen` nor can it be used to contribute to this. + It is meant for analysis engines to be conservative in what functions they analyse, + to prevent perceived false positives for meta-programming heavy code. + */ + bool knownACompileTimeOnlyContext; } private extern (D) struct NonFlagBitFields @@ -198,7 +194,7 @@ version (IN_LLVM) // user defined attributes UserAttributeDeclaration userAttribDecl; - DocComment* lastdc; /// documentation comment for last symbol at this scope + void* lastdc; /// documentation comment for last symbol at this scope (DocComment*) uint[void*] anchorCounts; /// lookup duplicate anchor name count Identifier prevAnchor; /// qualified symbol name of last doc anchor @@ -222,32 +218,6 @@ version (IN_LLVM) return new Scope(); } - extern (D) static Scope* createGlobal(Module _module, ErrorSink eSink) - { - Scope* sc = Scope.alloc(); - *sc = Scope.init; - sc._module = _module; - sc.minst = _module; - sc.scopesym = new ScopeDsymbol(); - sc.scopesym.symtab = new DsymbolTable(); - sc.eSink = eSink; - assert(eSink); - // Add top level package as member of this global scope - Dsymbol m = _module; - while (m.parent) - m = m.parent; - m.addMember(null, sc.scopesym); - m.parent = null; // got changed by addMember() - sc.previews.setFromParams(global.params); - - if (_module.filetype == FileType.c) - sc.inCfile = true; - // Create the module scope underneath the global scope - sc = sc.push(_module); - sc.parent = _module; - return sc; - } - extern (D) Scope* copy() { Scope* sc = Scope.alloc(); @@ -293,6 +263,7 @@ version (IN_LLVM) s.ctfeBlock = this.ctfeBlock; s.previews = this.previews; s.lastdc = null; + s.knownACompileTimeOnlyContext = this.knownACompileTimeOnlyContext; assert(&this != s); return s; } @@ -385,312 +356,6 @@ version (IN_LLVM) return pop(); } - - /******************************* - * Merge results of `ctorflow` into `this`. - * Params: - * loc = for error messages - * ctorflow = flow results to merge in - */ - extern (D) void merge(Loc loc, const ref CtorFlow ctorflow) - { - if (!mergeCallSuper(this.ctorflow.callSuper, ctorflow.callSuper)) - error(loc, "one path skips constructor"); - - const fies = ctorflow.fieldinit; - if (!this.ctorflow.fieldinit.length || !fies.length) - return; - FuncDeclaration f = func; - if (fes) - f = fes.func; - auto ad = f.isMemberDecl(); - assert(ad); - foreach (i, v; ad.fields) - { - bool mustInit = (v.storage_class & STC.nodefaultctor || v.type.needsNested()); - auto fieldInit = &this.ctorflow.fieldinit[i]; - const fiesCurrent = fies[i]; - if (fieldInit.loc is Loc.init) - fieldInit.loc = fiesCurrent.loc; - if (!mergeFieldInit(this.ctorflow.fieldinit[i].csx, fiesCurrent.csx) && mustInit) - { - error(loc, "one path skips field `%s`", v.toChars()); - } - } - } - - /************************************ - * Perform unqualified name lookup by following the chain of scopes up - * until found. - * - * Params: - * loc = location to use for error messages - * ident = name to look up - * pscopesym = if supplied and name is found, set to scope that ident was found in, otherwise set to null - * flags = modify search based on flags - * - * Returns: - * symbol if found, null if not - */ - extern (C++) Dsymbol search(Loc loc, Identifier ident, out Dsymbol pscopesym, SearchOptFlags flags = SearchOpt.all) - { - version (LOGSEARCH) - { - printf("Scope.search(%p, '%s' flags=x%x)\n", &this, ident.toChars(), flags); - // Print scope chain - for (Scope* sc = &this; sc; sc = sc.enclosing) - { - if (!sc.scopesym) - continue; - printf("\tscope %s\n", sc.scopesym.toChars()); - } - - static void printMsg(string txt, Dsymbol s) - { - printf("%.*s %s.%s, kind = '%s'\n", cast(int)txt.length, txt.ptr, - s.parent ? s.parent.toChars() : "", s.toChars(), s.kind()); - } - } - - // This function is called only for unqualified lookup - assert(!(flags & (SearchOpt.localsOnly | SearchOpt.importsOnly))); - - /* If ident is "start at module scope", only look at module scope - */ - if (ident == Id.empty) - { - // Look for module scope - for (Scope* sc = &this; sc; sc = sc.enclosing) - { - assert(sc != sc.enclosing); - if (!sc.scopesym) - continue; - if (Dsymbol s = sc.scopesym.isModule()) - { - //printMsg("\tfound", s); - pscopesym = sc.scopesym; - return s; - } - } - return null; - } - - Dsymbol checkAliasThis(AggregateDeclaration ad, Identifier ident, SearchOptFlags flags, Expression* exp) - { - import dmd.mtype; - if (!ad || !ad.aliasthis) - return null; - - Declaration decl = ad.aliasthis.sym.isDeclaration(); - if (!decl) - return null; - - Type t = decl.type; - ScopeDsymbol sds; - TypeClass tc; - TypeStruct ts; - switch(t.ty) - { - case Tstruct: - ts = cast(TypeStruct)t; - sds = ts.sym; - break; - case Tclass: - tc = cast(TypeClass)t; - sds = tc.sym; - break; - case Tinstance: - sds = (cast(TypeInstance)t).tempinst; - break; - case Tenum: - sds = (cast(TypeEnum)t).sym; - break; - default: break; - } - - if (!sds) - return null; - - Dsymbol ret = sds.search(loc, ident, flags); - if (ret) - { - *exp = new DotIdExp(loc, *exp, ad.aliasthis.ident); - *exp = new DotIdExp(loc, *exp, ident); - return ret; - } - - if (!ts && !tc) - return null; - - Dsymbol s; - *exp = new DotIdExp(loc, *exp, ad.aliasthis.ident); - if (ts && !(ts.att & AliasThisRec.tracing)) - { - ts.att = cast(AliasThisRec)(ts.att | AliasThisRec.tracing); - s = checkAliasThis(sds.isAggregateDeclaration(), ident, flags, exp); - ts.att = cast(AliasThisRec)(ts.att & ~AliasThisRec.tracing); - } - else if(tc && !(tc.att & AliasThisRec.tracing)) - { - tc.att = cast(AliasThisRec)(tc.att | AliasThisRec.tracing); - s = checkAliasThis(sds.isAggregateDeclaration(), ident, flags, exp); - tc.att = cast(AliasThisRec)(tc.att & ~AliasThisRec.tracing); - } - return s; - } - - Dsymbol searchScopes(SearchOptFlags flags) - { - for (Scope* sc = &this; sc; sc = sc.enclosing) - { - assert(sc != sc.enclosing); - if (!sc.scopesym) - continue; - //printf("\tlooking in scopesym '%s', kind = '%s', flags = x%x\n", sc.scopesym.toChars(), sc.scopesym.kind(), flags); - - if (sc.scopesym.isModule()) - flags |= SearchOpt.unqualifiedModule; // tell Module.search() that SearchOpt.localsOnly is to be obeyed - else if (sc.inCfile && sc.scopesym.isStructDeclaration()) - continue; // C doesn't have struct scope - - if (Dsymbol s = sc.scopesym.search(loc, ident, flags)) - { - if (flags & SearchOpt.tagNameSpace) - { - // ImportC: if symbol is not a tag, look for it in tag table - if (!s.isScopeDsymbol()) - { - auto ps = cast(void*)s in sc._module.tagSymTab; - if (!ps) - goto NotFound; - s = *ps; - } - } - //printMsg("\tfound local", s); - pscopesym = sc.scopesym; - return s; - } - - NotFound: - if (sc.previews.fixAliasThis) - { - Expression exp = new ThisExp(loc); - if (Dsymbol aliasSym = checkAliasThis(sc.scopesym.isAggregateDeclaration(), ident, flags, &exp)) - { - //printf("found aliassym: %s\n", aliasSym.toChars()); - pscopesym = new ExpressionDsymbol(exp); - return aliasSym; - } - } - - // Stop when we hit a module, but keep going if that is not just under the global scope - if (sc.scopesym.isModule() && !(sc.enclosing && !sc.enclosing.enclosing)) - break; - } - return null; - } - - if (this.ignoresymbolvisibility) - flags |= SearchOpt.ignoreVisibility; - - // First look in local scopes - Dsymbol s = searchScopes(flags | SearchOpt.localsOnly); - version (LOGSEARCH) if (s) printMsg("-Scope.search() found local", s); - if (!s) - { - // Second look in imported modules - s = searchScopes(flags | SearchOpt.importsOnly); - version (LOGSEARCH) if (s) printMsg("-Scope.search() found import", s); - } - return s; - } - - extern (D) Dsymbol search_correct(Identifier ident) - { - if (global.gag) - return null; // don't do it for speculative compiles; too time consuming - - /************************************************ - * Given the failed search attempt, try to find - * one with a close spelling. - * Params: - * seed = identifier to search for - * cost = set to the cost, which rises with each outer scope - * Returns: - * Dsymbol if found, null if not - */ - extern (D) Dsymbol scope_search_fp(const(char)[] seed, out int cost) - { - //printf("scope_search_fp('%s')\n", seed); - /* If not in the lexer's string table, it certainly isn't in the symbol table. - * Doing this first is a lot faster. - */ - if (!seed.length) - return null; - Identifier id = Identifier.lookup(seed); - if (!id) - return null; - Scope* sc = &this; - Module.clearCache(); - Dsymbol scopesym; - Dsymbol s = sc.search(Loc.initial, id, scopesym, SearchOpt.ignoreErrors); - if (!s) - return null; - - // Do not show `@disable`d declarations - if (auto decl = s.isDeclaration()) - if (decl.storage_class & STC.disable) - return null; - // Or `deprecated` ones if we're not in a deprecated scope - if (s.isDeprecated() && !sc.isDeprecated()) - return null; - - for (cost = 0; sc; sc = sc.enclosing, ++cost) - if (sc.scopesym == scopesym) - break; - if (scopesym != s.parent) - { - ++cost; // got to the symbol through an import - if (s.visible().kind == Visibility.Kind.private_) - return null; - } - return s; - } - - Dsymbol scopesym; - // search for exact name first - if (auto s = search(Loc.initial, ident, scopesym, SearchOpt.ignoreErrors)) - return s; - return speller!scope_search_fp(ident.toString()); - } - - /************************************ - * Maybe `ident` was a C or C++ name. Check for that, - * and suggest the D equivalent. - * Params: - * ident = unknown identifier - * Returns: - * D identifier string if found, null if not - */ - extern (D) static const(char)* search_correct_C(Identifier ident) - { - import dmd.astenums : Twchar; - TOK tok; - if (ident == Id.NULL) - tok = TOK.null_; - else if (ident == Id.TRUE) - tok = TOK.true_; - else if (ident == Id.FALSE) - tok = TOK.false_; - else if (ident == Id.unsigned) - tok = TOK.uns32; - else if (ident == Id.wchar_t) - tok = target.c.wchar_tsize == 2 ? TOK.wchar_ : TOK.dchar_; - else - return null; - return Token.toChars(tok); - } - /*************************** * Find the innermost scope with a symbol table. * Returns: @@ -706,61 +371,6 @@ version (IN_LLVM) return null; } - /****************************** - * Add symbol s to innermost symbol table. - * Params: - * s = symbol to insert - * Returns: - * null if already in table, `s` if not - */ - extern (D) Dsymbol insert(Dsymbol s) - { - //printf("insert() %s\n", s.toChars()); - if (VarDeclaration vd = s.isVarDeclaration()) - { - if (lastVar) - vd.lastVar = lastVar; - lastVar = vd; - } - else if (WithScopeSymbol ss = s.isWithScopeSymbol()) - { - if (VarDeclaration vd = ss.withstate.wthis) - { - if (lastVar) - vd.lastVar = lastVar; - lastVar = vd; - } - return null; - } - - auto scopesym = inner().scopesym; - //printf("\t\tscopesym = %p\n", scopesym); - if (!scopesym.symtab) - scopesym.symtab = new DsymbolTable(); - if (!this.inCfile) - return scopesym.symtabInsert(s); - - // ImportC insert - if (!scopesym.symtabInsert(s)) // if already in table - { - Dsymbol s2 = scopesym.symtabLookup(s, s.ident); // s2 is existing entry - - auto svar = s.isVarDeclaration(); - auto s2var = s2.isVarDeclaration(); - if (((svar && svar.storage_class & STC.extern_) && - (s2var && s2var.storage_class & STC.extern_) && this.func) || - s.isFuncDeclaration()) - { - return handleSymbolRedeclarations(*s._scope, s, s2, scopesym); - } - else // aside externs and func decls, we should be free to handle tags - { - return handleTagSymbols(this, s, s2, scopesym); - } - } - return s; // inserted - } - /******************************************** * Search enclosing scopes for ScopeDsymbol. */ @@ -851,22 +461,7 @@ version (IN_LLVM) // assert(0); } } - /****************************** - */ - extern (D) structalign_t alignment() - { - if (aligndecl) - { - auto ad = aligndecl.getAlignment(&this); - return ad.salign; - } - else - { - structalign_t sa; - sa.setDefault(); - return sa; - } - } + @safe @nogc pure nothrow const: /********************************** * Checks whether the current scope (or any of its parents) is deprecated. @@ -935,4 +530,10 @@ version (IN_LLVM) { return _module && _module.edition >= edition; } + + extern (D) bool isKnownToHaveACompileTimeContext() + { + return this.knownACompileTimeOnlyContext || this.intypeof != 0 || this.traitsCompiles || this.ctfe || + this.condition || this.inTemplateConstraint || this.ctfeBlock; + } } diff --git a/dmd/dstruct.d b/dmd/dstruct.d index 0297165ded0..c2b54b5b6ac 100644 --- a/dmd/dstruct.d +++ b/dmd/dstruct.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/struct.html, Structs, Unions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dstruct.d, _dstruct.d) @@ -18,22 +18,13 @@ import core.stdc.stdio; import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; -import dmd.attrib; -import dmd.declaration; import dmd.dmodule; -import dmd.dscope; import dmd.dsymbol; -import dmd.dtemplate; -import dmd.expression; import dmd.func; import dmd.id; import dmd.identifier; import dmd.location; import dmd.mtype; -import dmd.opover; -import dmd.target; -import dmd.tokens; -import dmd.typinf; import dmd.visitor; enum StructFlags : int diff --git a/dmd/dsymbol.d b/dmd/dsymbol.d index 1d38f15bff0..b2f2a30b559 100644 --- a/dmd/dsymbol.d +++ b/dmd/dsymbol.d @@ -1,7 +1,7 @@ /** * The base class for a D symbol, which can be a module, variable, function, enum, etc. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dsymbol.d, _dsymbol.d) @@ -17,7 +17,6 @@ import core.stdc.string; import core.stdc.stdlib; import dmd.aggregate; -import dmd.aliasthis; import dmd.arraytypes; import dmd.attrib; import dmd.astenums; @@ -34,10 +33,7 @@ import dmd.dtemplate; import dmd.errors; import dmd.expression; import dmd.func; -import dmd.id; import dmd.identifier; -import dmd.init; -import dmd.lexer; import dmd.location; import dmd.mtype; import dmd.nspace; @@ -49,7 +45,6 @@ import dmd.statement; import dmd.staticassert; import dmd.tokens; import dmd.visitor; - import dmd.common.outbuffer; version (IN_LLVM) @@ -111,6 +106,62 @@ void foreachDsymbol(Dsymbols* symbols, scope void delegate(Dsymbol) dg) } } +private void addComment(Dsymbol d, const(char)* comment) +{ + scope v = new AddCommentVisitor(comment); + d.accept(v); +} + +extern (C++) private class AddCommentVisitor: Visitor +{ + alias visit = Visitor.visit; + + const(char)* comment; + + this(const(char)* comment) + { + this.comment = comment; + } + + override void visit(Dsymbol d) + { + if (!comment || !*comment) + return; + + //printf("addComment '%s' to Dsymbol %p '%s'\n", comment, this, toChars()); + void* h = cast(void*)d; // just the pointer is the key + auto p = h in d.commentHashTable; + if (!p) + { + d.commentHashTable[h] = comment; + return; + } + if (strcmp(*p, comment) != 0) + { + // Concatenate the two + import dmd.lexer; + *p = Lexer.combineComments((*p).toDString(), comment.toDString(), true); + } + } + override void visit(AttribDeclaration atd) + { + if (comment && atd.decl) + { + atd.decl.foreachDsymbol( s => s.addComment(comment) ); + } + } + override void visit(ConditionalDeclaration cd) + { + if (comment) + { + cd.decl .foreachDsymbol( s => s.addComment(comment) ); + cd.elsedecl.foreachDsymbol( s => s.addComment(comment) ); + } + } + override void visit(StaticForeachDeclaration sfd) {} +} + + struct Visibility { /// @@ -186,8 +237,8 @@ enum PASS : ubyte semantic2done, // semantic2() done semantic3, // semantic3() started semantic3done, // semantic3() done - inline, // inline started - inlinedone, // inline done + inlinePragma, // inline pragma(inline, true) functions started + inlineAll, // inline all functions started obj, // toObjFile() run } @@ -805,20 +856,6 @@ version (IN_LLVM) assert(0); } - void addObjcSymbols(ClassDeclarations* classes, ClassDeclarations* categories) - { - } - - /**************************************** - * Add documentation comment to Dsymbol. - * Ignore NULL comments. - */ - void addComment(const(char)* comment) - { - import dmd.dsymbolsem; - dmd.dsymbolsem.addComment(this, comment); - } - /// get documentation comment for this Dsymbol final const(char)* comment() { @@ -830,10 +867,10 @@ version (IN_LLVM) } return null; } - - /* Shell around addComment() to avoid disruption for the moment */ - final void comment(const(char)* comment) { addComment(comment); } - + final void addComment(const(char)* c) + { + .addComment(this, c); + } extern (D) __gshared const(char)*[void*] commentHashTable; @@ -1116,7 +1153,7 @@ public: { //printf("ScopeDsymbol::syntaxCopy('%s')\n", toChars()); ScopeDsymbol sds = s ? cast(ScopeDsymbol)s : new ScopeDsymbol(ident); - sds.comment = comment; + sds.addComment(comment); sds.members = arraySyntaxCopy(members); sds.endlinnum = endlinnum; return sds; diff --git a/dmd/dsymbol.h b/dmd/dsymbol.h index c3ae586f24b..d5a074ad264 100644 --- a/dmd/dsymbol.h +++ b/dmd/dsymbol.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -140,8 +140,8 @@ enum class PASS : uint8_t semantic2done, // semantic2() done semantic3, // semantic3() started semantic3done, // semantic3() done - inline_, // inline started - inlinedone, // inline done + inlinePragma, // inline pragma(inline, true) functions started + inlineAll, // inline all functions started obj // toObjFile() run }; @@ -248,9 +248,7 @@ class Dsymbol : public ASTNode virtual bool needThis(); // need a 'this' pointer? virtual Visibility visible(); virtual Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees - virtual void addObjcSymbols(ClassDeclarations *, ClassDeclarations *) { } - virtual void addComment(const utf8_t *comment); const utf8_t *comment(); // current value of comment UnitTestDeclaration *ddocUnittest(); @@ -443,4 +441,7 @@ namespace dmd void runDeferredSemantic2(); void runDeferredSemantic3(); bool isOverlappedWith(VarDeclaration *vd, VarDeclaration *v); + Dsymbol* search(Scope *sc, Loc loc, Identifier* ident, Dsymbol*& pscopesym, uint32_t flags = 0u); + Scope *newScope(AggregateDeclaration * ad, Scope *sc); + void addObjcSymbols(Dsymbol *s, ClassDeclarations *, ClassDeclarations *); } diff --git a/dmd/dsymbolsem.d b/dmd/dsymbolsem.d index f78794e0331..f4ec1f1ff42 100644 --- a/dmd/dsymbolsem.d +++ b/dmd/dsymbolsem.d @@ -2,7 +2,7 @@ * Does the semantic 1 pass on the AST, which looks at symbol declarations but not initializers * or function bodies. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dsymbolsem.d, _dsymbolsem.d) @@ -41,7 +41,7 @@ import dmd.dtemplate; import dmd.dversion; import dmd.enumsem; import dmd.errors; -import dmd.escape; +import dmd.errorsink; import dmd.expression; import dmd.expressionsem; import dmd.func; @@ -52,7 +52,6 @@ import dmd.identifier; import dmd.importc; import dmd.init; import dmd.initsem; -import dmd.intrange; import dmd.hdrgen; import dmd.lexer; import dmd.location; @@ -60,15 +59,13 @@ import dmd.mtype; import dmd.mustuse; import dmd.nspace; import dmd.objc; -import dmd.opover; import dmd.optimize; import dmd.parse; -debug import dmd.printast; import dmd.root.array; -import dmd.root.filename; import dmd.root.string; -import dmd.common.outbuffer; import dmd.root.rmem; +import dmd.root.speller; +import dmd.common.outbuffer; import dmd.rootobject; import dmd.safe; import dmd.semantic2; @@ -76,17 +73,630 @@ import dmd.semantic3; import dmd.sideeffect; import dmd.staticassert; import dmd.tokens; -import dmd.utils; import dmd.statement; +import dmd.statementsem : ready; import dmd.target; import dmd.targetcompiler; -import dmd.templateparamsem; import dmd.templatesem; import dmd.typesem; import dmd.visitor; enum LOG = false; +/*************************************** + * Create a new scope from sc. + * semantic, semantic2 and semantic3 will use this for aggregate members. + */ +Scope* newScope(AggregateDeclaration _this, Scope* sc) +{ + static Scope* defaultNewScope(AggregateDeclaration _this, Scope* sc) + { + auto sc2 = sc.push(_this); + sc2.stc &= STC.flowThruAggregate; + sc2.parent = _this; + sc2.inunion = _this.isUnionDeclaration(); + sc2.visibility = Visibility(Visibility.Kind.public_); + sc2.explicitVisibility = false; + sc2.aligndecl = null; + sc2.userAttribDecl = null; + sc2.namespace = null; + return sc2; + } + + static Scope* classNewScope(ClassDeclaration _this, Scope* sc) + { + auto sc2 = defaultNewScope(_this, sc); + if (_this.isCOMclass()) + { + /* This enables us to use COM objects under Linux and + * work with things like XPCOM + */ + sc2.linkage = target.systemLinkage(); + } + return sc2; + } + + static Scope* interfaceNewScope(InterfaceDeclaration _this, Scope* sc) + { + auto sc2 = classNewScope(_this, sc); + if (_this.com) + sc2.linkage = LINK.windows; + else if (_this.classKind == ClassKind.cpp) + sc2.linkage = LINK.cpp; + else if (_this.classKind == ClassKind.objc) + sc2.linkage = LINK.objc; + return sc2; + } + + if (auto _id = _this.isInterfaceDeclaration()) + return interfaceNewScope(_id, sc); + else if (auto cd = _this.isClassDeclaration()) + return classNewScope(cd, sc); + return defaultNewScope(_this, sc); +} + +void addObjcSymbols(Dsymbol _this, ClassDeclarations* classes, ClassDeclarations* categories) +{ + if (auto ad = _this.isAttribDeclaration()) + objc.addSymbols(ad, classes, categories); + else if (auto cd = _this.isClassDeclaration()) + objc.addSymbols(cd, classes, categories); +} + +private void fixupInvariantIdent(InvariantDeclaration invd, size_t offset) +{ + OutBuffer idBuf; + idBuf.writestring("__invariant"); + idBuf.print(offset); + + invd.ident = Identifier.idPool(idBuf[]); +} + +/************************************ + * Maybe `ident` was a C or C++ name. Check for that, + * and suggest the D equivalent. + * Params: + * ident = unknown identifier + * Returns: + * D identifier string if found, null if not + */ +const(char)* search_correct_C(Identifier ident) +{ + import dmd.astenums : Twchar; + TOK tok; + if (ident == Id.NULL) + tok = TOK.null_; + else if (ident == Id.TRUE) + tok = TOK.true_; + else if (ident == Id.FALSE) + tok = TOK.false_; + else if (ident == Id.unsigned) + tok = TOK.uns32; + else if (ident == Id.wchar_t) + tok = target.c.wchar_tsize == 2 ? TOK.wchar_ : TOK.dchar_; + else + return null; + return Token.toChars(tok); +} + +/****************************** + * Add symbol s to innermost symbol table. + * Params: + * _this = scope object + * s = symbol to insert + * Returns: + * null if already in table, `s` if not + */ +Dsymbol insert(Scope* _this, Dsymbol s) +{ + //printf("insert() %s\n", s.toChars()); + if (VarDeclaration vd = s.isVarDeclaration()) + { + if (_this.lastVar) + vd.lastVar = _this.lastVar; + _this.lastVar = vd; + } + else if (WithScopeSymbol ss = s.isWithScopeSymbol()) + { + if (VarDeclaration vd = ss.withstate.wthis) + { + if (_this.lastVar) + vd.lastVar = _this.lastVar; + _this.lastVar = vd; + } + return null; + } + + auto scopesym = _this.inner().scopesym; + //printf("\t\tscopesym = %p\n", scopesym); + if (!scopesym.symtab) + scopesym.symtab = new DsymbolTable(); + if (!_this.inCfile) + return scopesym.symtabInsert(s); + + // ImportC insert + if (!scopesym.symtabInsert(s)) // if already in table + { + Dsymbol s2 = scopesym.symtabLookup(s, s.ident); // s2 is existing entry + + auto svar = s.isVarDeclaration(); + auto s2var = s2.isVarDeclaration(); + if (((svar && svar.storage_class & STC.extern_) && + (s2var && s2var.storage_class & STC.extern_) && _this.func) || + s.isFuncDeclaration()) + { + return handleSymbolRedeclarations(*_this, s, s2, scopesym); + } + else // aside externs and func decls, we should be free to handle tags + { + return handleTagSymbols(*_this, s, s2, scopesym); + } + } + return s; // inserted +} + +/******************************************* + * Look for member of the form: + * const(MemberInfo)[] getMembers(string); + * Returns NULL if not found + */ +FuncDeclaration findGetMembers(ScopeDsymbol dsym) +{ + import dmd.opover : search_function; + Dsymbol s = search_function(dsym, Id.getmembers); + FuncDeclaration fdx = s ? s.isFuncDeclaration() : null; + version (none) + { + // Finish + __gshared TypeFunction tfgetmembers; + if (!tfgetmembers) + { + Scope sc; + sc.eSink = global.errorSink; + Parameters* p = new Parameter(STC.in_, Type.tchar.constOf().arrayOf(), null, null); + auto parameters = new Parameters(p); + Type tret = null; + TypeFunction tf = new TypeFunction(parameters, tret, VarArg.none, LINK.d); + tfgetmembers = tf.dsymbolSemantic(Loc.initial, &sc).isTypeFunction(); + } + if (fdx) + fdx = fdx.overloadExactMatch(tfgetmembers); + } + if (fdx && fdx.isVirtual()) + fdx = null; + return fdx; +} + +/*********************************** + * Retrieve the .min or .max values. + * Only valid after semantic analysis. + * Params: + * _this = bit field instance + * id = Id.min or Id.max + * Returns: + * the min or max value + */ +ulong getMinMax(BitFieldDeclaration _this, Identifier id) +{ + const width = _this.fieldWidth; + const uns = _this.type.isUnsigned(); + const min = id == Id.min; + ulong v; + assert(width != 0); // should have been rejected in semantic pass + if (width == ulong.sizeof * 8) + v = uns ? (min ? ulong.min : ulong.max) + : (min ? long.min : long.max); + else + v = uns ? (min ? 0 + : (1L << width) - 1) + : (min ? -(1L << (width - 1)) + : (1L << (width - 1)) - 1); + return v; +} + +/* Append vthis field (this.tupleof[$-1]) to make this aggregate type nested. + */ +void makeNested(AggregateDeclaration _this) +{ + if (_this.enclosing) // if already nested + return; + if (_this.sizeok == Sizeok.done) + return; + if (_this.isUnionDeclaration() || _this.isInterfaceDeclaration()) + return; + if (_this.storage_class & STC.static_) + return; + + // If nested struct, add in hidden 'this' pointer to outer scope + auto s = _this.toParentLocal(); + if (!s) + s = _this.toParent2(); + if (!s) + return; + Type t = null; + if (auto fd = s.isFuncDeclaration()) + { + _this.enclosing = fd; + + /* https://issues.dlang.org/show_bug.cgi?id=14422 + * If a nested class parent is a function, its + * context pointer (== `outer`) should be void* always. + */ + t = Type.tvoidptr; + } + else if (auto ad = s.isAggregateDeclaration()) + { + if (_this.isClassDeclaration() && ad.isClassDeclaration()) + { + _this.enclosing = ad; + } + else if (_this.isStructDeclaration()) + { + if (auto ti = ad.parent.isTemplateInstance()) + { + _this.enclosing = ti.enclosing; + } + } + t = ad.handleType(); + } + if (_this.enclosing) + { + import dmd.typesem : alignment; + //printf("makeNested %s, enclosing = %s\n", toChars(), enclosing.toChars()); + assert(t); + if (t.ty == Tstruct) + t = Type.tvoidptr; // t should not be a ref type + + assert(!_this.vthis); + _this.vthis = new ThisDeclaration(_this.loc, t); + //vthis.storage_class |= STC.ref_; + + // Emulate vthis.addMember() + _this.members.push(_this.vthis); + + // Emulate vthis.dsymbolSemantic() + _this.vthis.storage_class |= STC.field; + _this.vthis.parent = _this; + _this.vthis.visibility = Visibility(Visibility.Kind.public_); + _this.vthis.alignment = t.alignment(); + _this.vthis.semanticRun = PASS.semanticdone; + + if (_this.sizeok == Sizeok.fwd) + _this.fields.push(_this.vthis); + + _this.makeNested2(); + } +} + +/* Append vthis2 field (this.tupleof[$-1]) to add a second context pointer. + */ +void makeNested2(AggregateDeclaration _this) +{ + import dmd.typesem : alignment; + + if (_this.vthis2) + return; + if (!_this.vthis) + _this.makeNested(); // can't add second before first + if (!_this.vthis) + return; + if (_this.sizeok == Sizeok.done) + return; + if (_this.isUnionDeclaration() || _this.isInterfaceDeclaration()) + return; + if (_this.storage_class & STC.static_) + return; + + auto s0 = _this.toParentLocal(); + auto s = _this.toParent2(); + if (!s || !s0 || s == s0) + return; + auto cd = s.isClassDeclaration(); + Type t = cd ? cd.type : Type.tvoidptr; + + _this.vthis2 = new ThisDeclaration(_this.loc, t); + //vthis2.storage_class |= STC.ref_; + + // Emulate vthis2.addMember() + _this.members.push(_this.vthis2); + + // Emulate vthis2.dsymbolSemantic() + _this.vthis2.storage_class |= STC.field; + _this.vthis2.parent = _this; + _this.vthis2.visibility = Visibility(Visibility.Kind.public_); + _this.vthis2.alignment = t.alignment(); + _this.vthis2.semanticRun = PASS.semanticdone; + + if (_this.sizeok == Sizeok.fwd) + _this.fields.push(_this.vthis2); +} + +/************************************ + * Perform unqualified name lookup by following the chain of scopes up + * until found. + * + * Params: + * _this = Scope object + * loc = location to use for error messages + * ident = name to look up + * pscopesym = if supplied and name is found, set to scope that ident was found in, otherwise set to null + * flags = modify search based on flags + * + * Returns: + * symbol if found, null if not + */ +Dsymbol search(Scope* _this, Loc loc, Identifier ident, out Dsymbol pscopesym, SearchOptFlags flags = SearchOpt.all) +{ + version (LOGSEARCH) + { + printf("Scope.search(%p, '%s' flags=x%x)\n", _this, ident.toChars(), flags); + // Print scope chain + for (Scope* sc = _this; sc; sc = sc.enclosing) + { + if (!sc.scopesym) + continue; + printf("\tscope %s\n", sc.scopesym.toChars()); + } + + static void printMsg(string txt, Dsymbol s) + { + printf("%.*s %s.%s, kind = '%s'\n", cast(int)txt.length, txt.ptr, + s.parent ? s.parent.toChars() : "", s.toChars(), s.kind()); + } + } + + // This function is called only for unqualified lookup + assert(!(flags & (SearchOpt.localsOnly | SearchOpt.importsOnly))); + + /* If ident is "start at module scope", only look at module scope + */ + if (ident == Id.empty) + { + // Look for module scope + for (Scope* sc = _this; sc; sc = sc.enclosing) + { + assert(sc != sc.enclosing); + if (!sc.scopesym) + continue; + if (Dsymbol s = sc.scopesym.isModule()) + { + //printMsg("\tfound", s); + pscopesym = sc.scopesym; + return s; + } + } + return null; + } + + Dsymbol checkAliasThis(AggregateDeclaration ad, Identifier ident, SearchOptFlags flags, Expression* exp) + { + if (!ad || !ad.aliasthis) + return null; + + Declaration decl = ad.aliasthis.sym.isDeclaration(); + if (!decl) + return null; + + Type t = decl.type; + ScopeDsymbol sds; + TypeClass tc; + TypeStruct ts; + switch(t.ty) + { + case Tstruct: + ts = cast(TypeStruct)t; + sds = ts.sym; + break; + case Tclass: + tc = cast(TypeClass)t; + sds = tc.sym; + break; + case Tinstance: + sds = (cast(TypeInstance)t).tempinst; + break; + case Tenum: + sds = (cast(TypeEnum)t).sym; + break; + default: break; + } + + if (!sds) + return null; + + Dsymbol ret = sds.search(loc, ident, flags); + if (ret) + { + *exp = new DotIdExp(loc, *exp, ad.aliasthis.ident); + *exp = new DotIdExp(loc, *exp, ident); + return ret; + } + + if (!ts && !tc) + return null; + + Dsymbol s; + *exp = new DotIdExp(loc, *exp, ad.aliasthis.ident); + if (ts && !(ts.att & AliasThisRec.tracing)) + { + ts.att = cast(AliasThisRec)(ts.att | AliasThisRec.tracing); + s = checkAliasThis(sds.isAggregateDeclaration(), ident, flags, exp); + ts.att = cast(AliasThisRec)(ts.att & ~AliasThisRec.tracing); + } + else if(tc && !(tc.att & AliasThisRec.tracing)) + { + tc.att = cast(AliasThisRec)(tc.att | AliasThisRec.tracing); + s = checkAliasThis(sds.isAggregateDeclaration(), ident, flags, exp); + tc.att = cast(AliasThisRec)(tc.att & ~AliasThisRec.tracing); + } + return s; + } + + Dsymbol searchScopes(SearchOptFlags flags) + { + for (Scope* sc = _this; sc; sc = sc.enclosing) + { + assert(sc != sc.enclosing); + if (!sc.scopesym) + continue; + //printf("\tlooking in scopesym '%s', kind = '%s', flags = x%x\n", sc.scopesym.toChars(), sc.scopesym.kind(), flags); + + if (sc.scopesym.isModule()) + flags |= SearchOpt.unqualifiedModule; // tell Module.search() that SearchOpt.localsOnly is to be obeyed + else if (sc.inCfile && sc.scopesym.isStructDeclaration()) + continue; // C doesn't have struct scope + + if (Dsymbol s = sc.scopesym.search(loc, ident, flags)) + { + if (flags & SearchOpt.tagNameSpace) + { + // ImportC: if symbol is not a tag, look for it in tag table + if (!s.isScopeDsymbol()) + { + auto ps = cast(void*)s in sc._module.tagSymTab; + if (!ps) + goto NotFound; + s = *ps; + } + } + //printMsg("\tfound local", s); + pscopesym = sc.scopesym; + return s; + } + + NotFound: + if (sc.previews.fixAliasThis) + { + Expression exp = new ThisExp(loc); + if (Dsymbol aliasSym = checkAliasThis(sc.scopesym.isAggregateDeclaration(), ident, flags, &exp)) + { + //printf("found aliassym: %s\n", aliasSym.toChars()); + pscopesym = new ExpressionDsymbol(exp); + return aliasSym; + } + } + + // Stop when we hit a module, but keep going if that is not just under the global scope + if (sc.scopesym.isModule() && !(sc.enclosing && !sc.enclosing.enclosing)) + break; + } + return null; + } + + if (_this.ignoresymbolvisibility) + flags |= SearchOpt.ignoreVisibility; + + // First look in local scopes + Dsymbol s = searchScopes(flags | SearchOpt.localsOnly); + version (LOGSEARCH) if (s) printMsg("-Scope.search() found local", s); + if (!s) + { + // Second look in imported modules + s = searchScopes(flags | SearchOpt.importsOnly); + version (LOGSEARCH) if (s) printMsg("-Scope.search() found import", s); + } + return s; +} + +Dsymbol search_correct(Scope* _this, Identifier ident) +{ + if (global.gag) + return null; // don't do it for speculative compiles; too time consuming + + /************************************************ + * Given the failed search attempt, try to find + * one with a close spelling. + * Params: + * seed = identifier to search for + * cost = set to the cost, which rises with each outer scope + * Returns: + * Dsymbol if found, null if not + */ + Dsymbol scope_search_fp(const(char)[] seed, out int cost) + { + //printf("scope_search_fp('%s')\n", seed); + /* If not in the lexer's string table, it certainly isn't in the symbol table. + * Doing this first is a lot faster. + */ + if (!seed.length) + return null; + Identifier id = Identifier.lookup(seed); + if (!id) + return null; + Scope* sc = _this; + Module.clearCache(); + Dsymbol scopesym; + Dsymbol s = sc.search(Loc.initial, id, scopesym, SearchOpt.ignoreErrors); + if (!s) + return null; + + // Do not show `@disable`d declarations + if (auto decl = s.isDeclaration()) + if (decl.storage_class & STC.disable) + return null; + // Or `deprecated` ones if we're not in a deprecated scope + if (s.isDeprecated() && !sc.isDeprecated()) + return null; + + for (cost = 0; sc; sc = sc.enclosing, ++cost) + if (sc.scopesym == scopesym) + break; + if (scopesym != s.parent) + { + ++cost; // got to the symbol through an import + if (s.visible().kind == Visibility.Kind.private_) + return null; + } + return s; + } + + Dsymbol scopesym; + // search for exact name first + if (auto s = _this.search(Loc.initial, ident, scopesym, SearchOpt.ignoreErrors)) + return s; + return speller!scope_search_fp(ident.toString()); +} + +structalign_t alignment(Scope* _this) +{ + if (_this.aligndecl) + { + auto ad = _this.aligndecl.getAlignment(_this); + return ad.salign; + } + else + { + structalign_t sa; + sa.setDefault(); + return sa; + } +} + +Scope* scopeCreateGlobal(Module _module, ErrorSink eSink) +{ + Scope* sc = Scope.alloc(); + *sc = Scope.init; + sc._module = _module; + sc.minst = _module; + sc.scopesym = new ScopeDsymbol(); + sc.scopesym.symtab = new DsymbolTable(); + sc.eSink = eSink; + assert(eSink); + // Add top level package as member of this global scope + Dsymbol m = _module; + while (m.parent) + m = m.parent; + m.addMember(null, sc.scopesym); + m.parent = null; // got changed by addMember() + sc.previews.setFromParams(global.params); + + if (_module.filetype == FileType.c) + sc.inCfile = true; + // Create the module scope underneath the global scope + sc = sc.push(_module); + sc.parent = _module; + return sc; +} + /************************************* * Does semantic analysis on the public face of declarations. */ @@ -516,9 +1126,6 @@ private bool aliasOverloadInsert(AliasDeclaration ad, Dsymbol s) */ auto sa = ad.aliassym.toAlias(); - if (auto td = s.toAlias().isTemplateDeclaration()) - s = td.funcroot ? td.funcroot : td; - if (auto fd = sa.isFuncDeclaration()) { auto fa = new FuncAliasDeclaration(ad.ident, fd); @@ -1015,6 +1622,8 @@ bool checkDeprecated(Dsymbol d, Loc loc, Scope* sc) else deprecation(loc, "%s `%s` is deprecated", d.kind, d.toPrettyChars); + deprecationSupplemental(d.loc, "`%s` is declared here", d.toErrMsg); + if (auto ti = sc.parent ? sc.parent.isInstantiated() : null) ti.printInstantiationTrace(Classification.deprecation); else if (auto ti = sc.parent ? sc.parent.isTemplateInstance() : null) @@ -1079,7 +1688,6 @@ bool isPOD(StructDeclaration sd) if (sd.ispod != ThreeState.none) return (sd.ispod == ThreeState.yes); - import dmd.clone; bool hasCpCtorLocal; bool hasMoveCtorLocal; @@ -1669,6 +2277,188 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor dsym.inuse--; sc2.pop(); } + static bool hasDollarDimension(TypeSArray tsa) + { + auto d = tsa.dim; + if (!d) + return false; + auto ide = d.isIdentifierExp(); + if (!ide) + return false; + return ide.ident == Id.dollar; + } + static bool hasUnresolvedDollar(Type t) + { + auto tsa = t.isTypeSArray(); + if (!tsa) + return false; + if (hasDollarDimension(tsa)) + return true; + return hasUnresolvedDollar(tsa.next); + } + + static void resolveDollarToZero(Type t, Loc loc) + { + auto tsa = t.isTypeSArray(); + if (!tsa) + return; + if (hasDollarDimension(tsa)) { + tsa.dim = new IntegerExp(loc, 0, Type.tsize_t); + } + resolveDollarToZero(tsa.next, loc); + } + + static bool inferExprLength(Expression e, out dinteger_t len) + { + if (!e) + return false; + + if (auto ale = e.isArrayLiteralExp()) + { + len = ale.elements.length; + return true; + } + + if (auto ce = e.isCatExp()) + { + dinteger_t l1; + dinteger_t l2; + if (inferExprLength(ce.e1, l1) && inferExprLength(ce.e2, l2)) + { + len = l1 + l2; + return true; + } + } + + if (!e.type) + return false; + + auto tsan = e.type.toBasetype().isTypeSArray(); + if (!tsan) + return false; + + auto dim = tsan.dim.isIntegerExp(); + if (!dim) + return false; + + len = dim.value; + return true; + } + + static bool inferSArrayDim(TypeSArray tsa, Expression ie, Loc loc, Scope* sc) + { + if (!tsa || !ie) + return false; + + if (!hasDollarDimension(tsa)) + return false; + + if (auto ale = ie.isArrayLiteralExp()) + { + dinteger_t len = ale.elements.length; + tsa.dim = new IntegerExp(loc, len, Type.tsize_t); + if (auto innerTsa = tsa.next.isTypeSArray()) + { + if (ale.elements.length > 0) + { + auto firstElem = (*ale.elements)[0]; + inferSArrayDim(innerTsa, firstElem, loc, sc); + } + } + return true; + } + else if (auto se = ie.isStringExp()) + { + Type next = tsa.next.toBasetype(); + if (next.ty == TY.Tchar || next.ty == TY.Twchar || next.ty == TY.Tdchar) + { + tsa.dim = new IntegerExp(loc, se.len, Type.tsize_t); + return true; + } + return false; + } + + // For other initializer forms, infer `$` only when the extent is + // compile-time known: either a concatenation whose operands are + // inferable, or any expression whose type is a static array. + dinteger_t len; + if (!inferExprLength(ie, len)) + return false; + + tsa.dim = new IntegerExp(loc, len, Type.tsize_t); + return true; + } + + static bool shouldTryDeepSArrayDimInference(Expression ie, Scope* sc) + { + if (!ie) + return false; + + // `new` expressions cannot provide a compile-time static extent + // for inferring `$`, and may recurse through incomplete aggregates. + if (ie.isNewExp()) + return false; + + // Field initializers are especially prone to recursive semantic + // evaluation against incompletely defined aggregates. + if (sc && sc.parent && sc.parent.isAggregateDeclaration()) + return false; + + return true; + } + + auto tsa = dsym.type.isTypeSArray(); + + if (tsa && hasDollarDimension(tsa)) + { + if (!dsym._init || dsym._init.isVoidInitializer()) + { + .error(dsym.loc, "cannot infer static array length from `$`, provide an initializer"); + tsa.dim = new IntegerExp(dsym.loc, 0, Type.tsize_t); + dsym._init = new ErrorInitializer(); + dsym.type = Type.terror; + dsym.errors = true; + dsym.semanticRun = PASS.semanticdone; + return; + } + else + { + Expression ie = dsym._init.initializerToExpression(null, sc.inCfile); + if (ie && ie.op != EXP.error) + { + // Infer from literal syntax first to avoid prematurely + // semantic-analyzing expressions that may depend on + // incomplete types (e.g. recursive initializers). + // https://github.com/dlang/dmd/issues/22887 + bool dimInferred = inferSArrayDim(tsa, ie, dsym.loc, sc); + if (!dimInferred && shouldTryDeepSArrayDimInference(ie, sc)) + { + ie = ie.expressionSemantic(sc); + ie = ie.optimize(WANTvalue); + dimInferred = inferSArrayDim(tsa, ie, dsym.loc, sc); + } + if (!dimInferred) + { + .error(dsym.loc, "cannot infer static array length from `$`, provide an initializer"); + tsa.dim = new IntegerExp(dsym.loc, 0, Type.tsize_t); + dsym._init = new ErrorInitializer(); + dsym.type = Type.terror; + dsym.errors = true; + dsym.semanticRun = PASS.semanticdone; + return; + } + if (auto ale = ie.isArrayLiteralExp()) + dsym._init = new ExpInitializer(dsym.loc, ale); + } + } + } + if (tsa && hasUnresolvedDollar(tsa.next)) + { + .error(dsym.loc, "cannot infer static array length from `$`, provide an initializer"); + resolveDollarToZero(tsa.next, dsym.loc); + return; + } + //printf(" semantic type = %s\n", dsym.type ? dsym.type.toChars() : "null"); if (dsym.type.ty == Terror) dsym.errors = true; @@ -1680,6 +2470,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor /* If scope's alignment is the default, use the type's alignment, * otherwise the scope overrrides. */ + import dmd.typesem : alignment; if (dsym.alignment.isDefault()) dsym.alignment = dsym.type.alignment(); // use type's alignment @@ -1881,7 +2672,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor if (i == 0) einit = Expression.combine(te.e0, einit); } - ti = new ExpInitializer(einit.loc, einit); + // Use the original initializer location, not the tuple element's location, + // so error messages point to the declaration site + ti = new ExpInitializer(dsym._init ? dsym._init.loc : einit.loc, einit); } else ti = dsym._init ? dsym._init.syntaxCopy() : null; @@ -2130,7 +2923,7 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor "`void` initializing a struct with an invariant"); else if (dsym.type.toBasetype().ty == Tbool) sc.setUnsafePreview(global.params.systemVariables, false, dsym.loc, - "void intializing a bool (which must always be 0 or 1)"); + "`void` initializing a `bool` (which must always be 0 or 1)"); else if (dsym.type.hasUnsafeBitpatterns()) sc.setUnsafePreview(global.params.systemVariables, false, dsym.loc, "`void` initializing a type with unsafe bit patterns"); @@ -2245,6 +3038,15 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor // Preset the required type to fail in FuncLiteralDeclaration::semantic3 ei.exp = inferType(ei.exp, dsym.type); + /* + * https://issues.dlang.org/show_bug.cgi?id=24474 + * at function scope, the compiler thinks the type of the variable is not known yet + * (semantically complete) so looks like typeof gets locked in a cyclic situation + * semantics is actually done. just set it for importc + */ + if (sc.func && dsym.type && dsym.type.deco && sc.inCfile) + dsym.semanticRun = PASS.semanticdone; + // If inside function, there is no semantic3() call if (sc.func || sc.intypeof == 1) { @@ -2589,6 +3391,14 @@ else if (dsym.semanticRun >= PASS.semanticdone) return; + const bool isAnonymous = dsym.isAnonymous(); + if (isAnonymous && dsym._init) + { + .error(dsym._init.loc, "anonymous bitfield cannot have default initializer"); + dsym._init = null; + dsym.errors = true; + } + visit(cast(VarDeclaration)dsym); if (dsym.errors) return; @@ -2610,8 +3420,12 @@ else if (!dsym.type.isIntegral()) { // C11 6.7.2.1-5 - error(width.loc, "bitfield type `%s` is not an integer type", dsym.type.toChars()); + if (isAnonymous) + error(dsym.loc, "anonymous bitfield cannot be of non-integral type `%s`", dsym.type.toChars()); + else + error(dsym.loc, "bitfield `%s` cannot be of non-integral type `%s`", dsym.toChars(), dsym.type.toChars()); dsym.errors = true; + return; } if (!width.isIntegerExp()) { @@ -2619,20 +3433,34 @@ else dsym.errors = true; } const uwidth = width.toInteger(); // uwidth is unsigned - if (uwidth == 0 && !dsym.isAnonymous()) + if (uwidth == 0 && !isAnonymous) { - error(width.loc, "bitfield `%s` has zero width", dsym.toChars()); + error(dsym.loc, "bitfield `%s` cannot have zero width", dsym.toChars()); dsym.errors = true; } - const sz = dsym.type.size(); - if (sz == SIZE_INVALID) - dsym.errors = true; - const max_width = sz * 8; - if (uwidth > max_width) + if (cast(long)uwidth < 0) { - error(width.loc, "width `%lld` of bitfield `%s` does not fit in type `%s`", cast(long)uwidth, dsym.toChars(), dsym.type.toChars()); + if (isAnonymous) + error(width.loc, "anonymous bitfield has negative width `%lld`", cast(long)uwidth); + else + error(width.loc, "bitfield `%s` has negative width `%lld`", dsym.toChars(), cast(long)uwidth); dsym.errors = true; } + else + { + const sz = dsym.type.size(); + if (sz == SIZE_INVALID) + dsym.errors = true; + const max_width = sz * 8; + if (uwidth > max_width) + { + if (isAnonymous) + error(width.loc, "width `%lld` of anonymous bitfield does not fit in type `%s`", cast(long)uwidth, dsym.type.toChars()); + else + error(width.loc, "width `%lld` of bitfield `%s` does not fit in type `%s`", cast(long)uwidth, dsym.toChars(), dsym.type.toChars()); + dsym.errors = true; + } + } dsym.fieldWidth = cast(uint)uwidth; } @@ -2819,7 +3647,7 @@ else sc = sc.push(); sc.stc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.gshared); - sc.inunion = scd.isunion ? scd : null; + sc.inunion = scd.isunion ? scd : sc.inunion; sc.resetAllFlags(); for (size_t i = 0; i < scd.decl.length; i++) { @@ -3032,7 +3860,7 @@ else Scope* sc = m._scope; // see if already got one from importAll() if (!sc) { - sc = Scope.createGlobal(m, global.errorSink); // create root scope + sc = scopeCreateGlobal(m, global.errorSink); // create root scope } //printf("Module = %p, linkage = %d\n", sc.scopesym, sc.linkage); @@ -3051,7 +3879,7 @@ else if (!m._scope) { sc = sc.pop(); - sc.pop(); // 2 pops because Scope.createGlobal() created 2 + sc.pop(); // 2 pops because scopeCreateGlobal() created 2 } m.semanticRun = PASS.semanticdone; //printf("-Module::semantic(this = %p, '%s'): parent = %p\n", this, toChars(), parent); @@ -5432,6 +6260,8 @@ private extern(C++) class AddMemberVisitor : Visitor if (!s2.overloadInsert(dsym)) { + if (auto _td = s2.isTemplateDeclaration()) + _td.computeOneMember(); sds.multiplyDefined(Loc.initial, dsym, s2); dsym.errors = true; } @@ -6453,10 +7283,20 @@ bool determineFields(AggregateDeclaration ad) { if (ad == tvs.sym) { + if (ad.type.ty == Terror || ad.errors) + return 1; // failed already + const(char)* psz = (v.type.toBasetype().ty == Tsarray) ? "static array of " : ""; - .error(ad.loc, "%s `%s` cannot have field `%s` with %ssame struct type", ad.kind, ad.toPrettyChars, v.toChars(), psz); - ad.type = Type.terror; - ad.errors = true; + if (!v.isAnonymous()) + .error(v.loc, "%s `%s` cannot have field `%s` with %ssame struct type", ad.kind, ad.toPrettyChars, v.toChars(), psz); + else + .error(v.loc, "%s `%s` cannot have anonymous field with %ssame struct type", ad.kind, ad.toPrettyChars, psz); + // Don't cache errors from speculative semantic + if (!global.gag) + { + ad.type = Type.terror; + ad.errors = true; + } return 1; } } @@ -7536,7 +8376,7 @@ extern(C++) class ImportAllVisitor : Visitor * gets imported, it is unaffected by context. * Ignore prevsc. */ - Scope* sc = Scope.createGlobal(m, global.errorSink); // create root scope + Scope* sc = scopeCreateGlobal(m, global.errorSink); // create root scope if (m.md && m.md.msg) m.md.msg = semanticString(sc, m.md.msg, "deprecation message"); @@ -7581,7 +8421,7 @@ extern(C++) class ImportAllVisitor : Visitor s.importAll(sc); } sc = sc.pop(); - sc.pop(); // 2 pops because Scope.createGlobal() created 2 + sc.pop(); // 2 pops because scopeCreateGlobal() created 2 } override void visit(AttribDeclaration atb) @@ -7811,8 +8651,8 @@ private extern(C++) class SetFieldOffsetVisitor : Visitor ad.structsize, ad.alignsize, isunion); - //printf("\t%s: memalignsize = %d\n", toChars(), memalignsize); - //printf(" addField '%s' to '%s' at offset %d, size = %d\n", toChars(), ad.toChars(), offset, memsize); + //printf("\t%s: memalignsize = %d\n", vd.toChars(), memalignsize); + //printf(" addField '%s' to '%s' at offset %d, size = %d\n", vd.toChars(), ad.toChars(), fieldState.offset, memsize); } override void visit(BitFieldDeclaration bfd) @@ -7846,10 +8686,9 @@ private extern(C++) class SetFieldOffsetVisitor : Visitor uint memalignsize = target.fieldalign(t); // size of member for alignment purposes if (log) printf(" memsize: %u memalignsize: %u\n", memsize, memalignsize); - if (bfd.fieldWidth == 0 && !anon) - error(bfd.loc, "named bit fields cannot have 0 width"); - if (bfd.fieldWidth > memsize * 8) - error(bfd.loc, "bit field width %d is larger than type", bfd.fieldWidth); + // Handled in dsymbolSemantic as errors + assert(bfd.fieldWidth != 0 || anon, "named bit fields cannot have 0 width"); + assert(bfd.fieldWidth <= memsize * 8, "bit field width is larger than type"); const style = target.c.bitFieldStyle; if (style != TargetC.BitFieldStyle.MS && style != TargetC.BitFieldStyle.Gcc_Clang) @@ -8069,14 +8908,56 @@ private extern(C++) class SetFieldOffsetVisitor : Visitor isunion); // Add to the anon fields the base offset of this anonymous aggregate - //printf("anon fields, anonoffset = %d\n", anonoffset); - foreach (const i; fieldstart .. ad.fields.length) + //printf("anon fields, anonoffset = %d\n", anond.anonoffset); + if (anond.anonoffset) + anond.decl.foreachDsymbol( (s) => s.adjustBaseOffset(anond.anonoffset) ); + } + } +} + +// Adds `offset` as the new base offset of all field members in `d`. +private void adjustBaseOffset(Dsymbol d, uint offset) +{ + switch (d.dsym) + { + case DSYM.nspace: + auto ns = cast(Nspace)d; + ns.members.foreachDsymbol( s => s.adjustBaseOffset(offset) ); + break; + + case DSYM.templateMixin: + auto tm = cast(TemplateMixin)d; + tm.members.foreachDsymbol( s => s.adjustBaseOffset(offset) ); + break; + + case DSYM.anonDeclaration: + auto ad = cast(AnonDeclaration)d; + if (ad.decl) + ad.decl.foreachDsymbol( s => s.adjustBaseOffset(offset) ); + break; + + case DSYM.bitFieldDeclaration: + auto bfd = cast(BitFieldDeclaration)d; + bfd.offset += offset; + //printf("\t%s %d : %d\n", bfd.toChars(), bfd.offset, bfd.bitOffset); + break; + + default: + if (auto vd = d.isVarDeclaration()) + { + if (vd.aliasTuple) + vd.aliasTuple.foreachVar( s => s.adjustBaseOffset(offset) ); + else if (vd.isField()) + { + vd.offset += offset; + //printf("\t%s %d\n", vd.toChars(), vd.offset); + } + } + else if (auto atd = d.isAttribDeclaration()) { - VarDeclaration v = ad.fields[i]; - //printf("\t[%d] %s %d\n", i, v.toChars(), v.offset); - v.offset += anond.anonoffset; + atd.include(null).foreachDsymbol( s => s.adjustBaseOffset(offset) ); } - } + break; } } @@ -8597,60 +9478,6 @@ Lfail: return false; } -void addComment(Dsymbol d, const(char)* comment) -{ - scope v = new AddCommentVisitor(comment); - d.accept(v); -} - -extern (C++) class AddCommentVisitor: Visitor -{ - alias visit = Visitor.visit; - - const(char)* comment; - - this(const(char)* comment) - { - this.comment = comment; - } - - override void visit(Dsymbol d) - { - if (!comment || !*comment) - return; - - //printf("addComment '%s' to Dsymbol %p '%s'\n", comment, this, toChars()); - void* h = cast(void*)d; // just the pointer is the key - auto p = h in d.commentHashTable; - if (!p) - { - d.commentHashTable[h] = comment; - return; - } - if (strcmp(*p, comment) != 0) - { - // Concatenate the two - *p = Lexer.combineComments((*p).toDString(), comment.toDString(), true); - } - } - override void visit(AttribDeclaration atd) - { - if (comment) - { - atd.include(null).foreachDsymbol( s => s.addComment(comment) ); - } - } - override void visit(ConditionalDeclaration cd) - { - if (comment) - { - cd.decl .foreachDsymbol( s => s.addComment(comment) ); - cd.elsedecl.foreachDsymbol( s => s.addComment(comment) ); - } - } - override void visit(StaticForeachDeclaration sfd) {} -} - void checkCtorConstInit(Dsymbol d) { scope v = new CheckCtorConstInitVisitor(); @@ -9314,7 +10141,7 @@ private extern(C++) class FinalizeSizeVisitor : Visitor override void visit(StructDeclaration sd) { - //printf("StructDeclaration::finalizeSize() %s, sizeok = %d\n", toChars(), sizeok); + //printf("StructDeclaration::finalizeSize() %s, sizeok = %d\n", sd.toChars(), sd.sizeok); assert(sd.sizeok != Sizeok.done); if (sd.sizeok == Sizeok.inProcess) @@ -9345,16 +10172,30 @@ private extern(C++) class FinalizeSizeVisitor : Visitor if (sd.structsize == 0) { sd.hasNoFields = true; - sd.alignsize = 1; + + // alignsize has already been set when the struct consists only of + // zero sized fields. + if (sd.alignsize == 0) + sd.alignsize = 1; // A fine mess of what size a zero sized struct should be final switch (sd.classKind) { case ClassKind.d: - case ClassKind.cpp: sd.structsize = 1; break; + case ClassKind.cpp: + if (sd.fields.length == 0 || + target.c.bitFieldStyle == TargetC.BitFieldStyle.MS) + { + // Give struct a size when there's no named fields + sd.structsize = 1; + } + else + sd.structsize = 0; + break; + case ClassKind.c: case ClassKind.objc: if (target.c.bitFieldStyle == TargetC.BitFieldStyle.MS) diff --git a/dmd/dtemplate.d b/dmd/dtemplate.d index 10190c31d7a..753b5dd72f0 100644 --- a/dmd/dtemplate.d +++ b/dmd/dtemplate.d @@ -28,7 +28,7 @@ * arguments, and uses it if found. * - Otherwise, the rest of semantic is run on the `TemplateInstance`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dtemplate.d, _dtemplate.d) @@ -40,41 +40,27 @@ module dmd.dtemplate; import core.stdc.stdio; import core.stdc.string; -import dmd.aggregate; -import dmd.aliasthis; import dmd.arraytypes; import dmd.astenums; import dmd.ast_node; -import dmd.attrib; -import dmd.dcast; -import dmd.dclass; import dmd.declaration; -import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; import dmd.dsymbol; -import dmd.dsymbolsem : oneMembers; import dmd.errors; import dmd.errorsink; import dmd.expression; import dmd.func; import dmd.globals; import dmd.hdrgen; -import dmd.id; import dmd.identifier; -import dmd.impcnvtab; -import dmd.init; import dmd.location; import dmd.mangle; import dmd.mtype; -import dmd.opover; -import dmd.optimize; import dmd.root.array; import dmd.common.outbuffer; import dmd.rootobject; -import dmd.templatesem : TemplateInstanceBox; import dmd.tokens; -import dmd.typesem : typeSemantic; import dmd.visitor; //debug = FindExistingInstance; // print debug stats of findExistingInstance @@ -255,7 +241,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol Expression constraint; // Hash table to look up TemplateInstance's of this TemplateDeclaration - TemplateInstance[TemplateInstanceBox] instances; + void* instances; TemplateDeclaration overnext; // next overloaded TemplateDeclaration TemplateDeclaration overroot; // first in overnext list @@ -270,6 +256,7 @@ extern (C++) final class TemplateDeclaration : ScopeDsymbol bool isTrivialAlias; /// matches pattern `template Alias(T) { alias Alias = qualifiers(T); }` bool deprecated_; /// this template declaration is deprecated bool isCmacro; /// Whether this template is a translation of a C macro + bool haveComputedOneMember; /// Whether computeOneMeber has been called Visibility visibility; // threaded list of previous instantiation attempts on stack @@ -313,54 +300,8 @@ version (IN_LLVM) this.literal = literal; this.ismixin = ismixin; this.isstatic = true; + this.haveComputedOneMember = false; this.visibility = Visibility(Visibility.Kind.undefined); - - // Compute in advance for Ddoc's use - // https://issues.dlang.org/show_bug.cgi?id=11153: ident could be NULL if parsing fails. - if (!members || !ident) - return; - - Dsymbol s; - if (!oneMembers(members, s, ident) || !s) - return; - - onemember = s; - s.parent = this; - - /* Set isTrivialAliasSeq if this fits the pattern: - * template AliasSeq(T...) { alias AliasSeq = T; } - * or set isTrivialAlias if this fits the pattern: - * template Alias(T) { alias Alias = qualifiers(T); } - */ - if (!(parameters && parameters.length == 1)) - return; - - auto ad = s.isAliasDeclaration(); - if (!ad || !ad.type) - return; - - auto ti = ad.type.isTypeIdentifier(); - - if (!ti || ti.idents.length != 0) - return; - - if (auto ttp = (*parameters)[0].isTemplateTupleParameter()) - { - if (ti.ident is ttp.ident && - ti.mod == 0) - { - //printf("found isTrivialAliasSeq %s %s\n", s.toChars(), ad.type.toChars()); - isTrivialAliasSeq = true; - } - } - else if (auto ttp = (*parameters)[0].isTemplateTypeParameter()) - { - if (ti.ident is ttp.ident) - { - //printf("found isTrivialAlias %s %s\n", s.toChars(), ad.type.toChars()); - isTrivialAlias = true; - } - } } override TemplateDeclaration syntaxCopy(Dsymbol) @@ -470,384 +411,6 @@ extern (C++) final class TypeDeduced : Type } } -/* ======================== Type ============================================ */ - -/*********************************************************** - * Check whether the type t representation relies on one or more the template parameters. - * Params: - * t = Tested type, if null, returns false. - * tparams = Template parameters. - * iStart = Start index of tparams to limit the tested parameters. If it's - * nonzero, tparams[0..iStart] will be excluded from the test target. - */ -bool reliesOnTident(Type t, TemplateParameters* tparams, size_t iStart = 0) -{ - return reliesOnTemplateParameters(t, (*tparams)[0 .. tparams.length]); -} - -/*********************************************************** - * Check whether the type t representation relies on one or more the template parameters. - * Params: - * t = Tested type, if null, returns false. - * tparams = Template parameters. - */ -bool reliesOnTemplateParameters(Type t, TemplateParameter[] tparams) -{ - bool visitVector(TypeVector t) - { - return t.basetype.reliesOnTemplateParameters(tparams); - } - - bool visitAArray(TypeAArray t) - { - return t.next.reliesOnTemplateParameters(tparams) || - t.index.reliesOnTemplateParameters(tparams); - } - - bool visitFunction(TypeFunction t) - { - foreach (i, fparam; t.parameterList) - { - if (fparam.type.reliesOnTemplateParameters(tparams)) - return true; - } - return t.next.reliesOnTemplateParameters(tparams); - } - - bool visitIdentifier(TypeIdentifier t) - { - foreach (tp; tparams) - { - if (tp.ident.equals(t.ident)) - return true; - } - return false; - } - - bool visitInstance(TypeInstance t) - { - foreach (tp; tparams) - { - if (t.tempinst.name == tp.ident) - return true; - } - - if (t.tempinst.tiargs) - foreach (arg; *t.tempinst.tiargs) - { - if (Type ta = isType(arg)) - { - if (ta.reliesOnTemplateParameters(tparams)) - return true; - } - } - - return false; - } - - bool visitTypeof(TypeTypeof t) - { - //printf("TypeTypeof.reliesOnTemplateParameters('%s')\n", t.toChars()); - return t.exp.reliesOnTemplateParameters(tparams); - } - - bool visitTuple(TypeTuple t) - { - if (t.arguments) - foreach (arg; *t.arguments) - { - if (arg.type.reliesOnTemplateParameters(tparams)) - return true; - } - - return false; - } - - if (!t) - return false; - - Type tb = t.toBasetype(); - switch (tb.ty) - { - case Tvector: return visitVector(tb.isTypeVector()); - case Taarray: return visitAArray(tb.isTypeAArray()); - case Tfunction: return visitFunction(tb.isTypeFunction()); - case Tident: return visitIdentifier(tb.isTypeIdentifier()); - case Tinstance: return visitInstance(tb.isTypeInstance()); - case Ttypeof: return visitTypeof(tb.isTypeTypeof()); - case Ttuple: return visitTuple(tb.isTypeTuple()); - case Tenum: return false; - default: return tb.nextOf().reliesOnTemplateParameters(tparams); - } -} - -/*********************************************************** - * Check whether the expression representation relies on one or more the template parameters. - * Params: - * e = expression to test - * tparams = Template parameters. - * Returns: - * true if it does - */ -private bool reliesOnTemplateParameters(Expression e, TemplateParameter[] tparams) -{ - extern (C++) final class ReliesOnTemplateParameters : Visitor - { - alias visit = Visitor.visit; - public: - TemplateParameter[] tparams; - bool result; - - extern (D) this(TemplateParameter[] tparams) @safe - { - this.tparams = tparams; - } - - override void visit(Expression e) - { - //printf("Expression.reliesOnTemplateParameters('%s')\n", e.toChars()); - } - - override void visit(IdentifierExp e) - { - //printf("IdentifierExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - foreach (tp; tparams) - { - if (e.ident == tp.ident) - { - result = true; - return; - } - } - } - - override void visit(TupleExp e) - { - //printf("TupleExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (e.exps) - { - foreach (ea; *e.exps) - { - ea.accept(this); - if (result) - return; - } - } - } - - override void visit(ArrayLiteralExp e) - { - //printf("ArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (e.elements) - { - foreach (el; *e.elements) - { - el.accept(this); - if (result) - return; - } - } - } - - override void visit(AssocArrayLiteralExp e) - { - //printf("AssocArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - foreach (ek; *e.keys) - { - ek.accept(this); - if (result) - return; - } - foreach (ev; *e.values) - { - ev.accept(this); - if (result) - return; - } - } - - override void visit(StructLiteralExp e) - { - //printf("StructLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (e.elements) - { - foreach (ea; *e.elements) - { - ea.accept(this); - if (result) - return; - } - } - } - - override void visit(TypeExp e) - { - //printf("TypeExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - result = e.type.reliesOnTemplateParameters(tparams); - } - - override void visit(NewExp e) - { - //printf("NewExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (e.placement) - e.placement.accept(this); - if (e.thisexp) - e.thisexp.accept(this); - result = e.newtype.reliesOnTemplateParameters(tparams); - if (!result && e.arguments) - { - foreach (ea; *e.arguments) - { - ea.accept(this); - if (result) - return; - } - } - } - - override void visit(NewAnonClassExp e) - { - //printf("NewAnonClassExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - result = true; - } - - override void visit(FuncExp e) - { - //printf("FuncExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - result = true; - } - - override void visit(TypeidExp e) - { - //printf("TypeidExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (auto ea = isExpression(e.obj)) - ea.accept(this); - else if (auto ta = isType(e.obj)) - result = ta.reliesOnTemplateParameters(tparams); - } - - override void visit(TraitsExp e) - { - //printf("TraitsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - if (e.args) - { - foreach (oa; *e.args) - { - if (auto ea = isExpression(oa)) - ea.accept(this); - else if (auto ta = isType(oa)) - result = ta.reliesOnTemplateParameters(tparams); - if (result) - return; - } - } - } - - override void visit(IsExp e) - { - //printf("IsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - result = e.targ.reliesOnTemplateParameters(tparams); - } - - override void visit(UnaExp e) - { - //printf("UnaExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - e.e1.accept(this); - } - - override void visit(DotTemplateInstanceExp e) - { - //printf("DotTemplateInstanceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - visit(e.isUnaExp()); - if (!result && e.ti.tiargs) - { - foreach (oa; *e.ti.tiargs) - { - if (auto ea = isExpression(oa)) - ea.accept(this); - else if (auto ta = isType(oa)) - result = ta.reliesOnTemplateParameters(tparams); - if (result) - return; - } - } - } - - override void visit(CallExp e) - { - //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - visit(e.isUnaExp()); - if (!result && e.arguments) - { - foreach (ea; *e.arguments) - { - ea.accept(this); - if (result) - return; - } - } - } - - override void visit(CastExp e) - { - //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - visit(e.isUnaExp()); - // e.to can be null for cast() with no type - if (!result && e.to) - result = e.to.reliesOnTemplateParameters(tparams); - } - - override void visit(SliceExp e) - { - //printf("SliceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - visit(e.isUnaExp()); - if (!result && e.lwr) - e.lwr.accept(this); - if (!result && e.upr) - e.upr.accept(this); - } - - override void visit(IntervalExp e) - { - //printf("IntervalExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - e.lwr.accept(this); - if (!result) - e.upr.accept(this); - } - - override void visit(ArrayExp e) - { - //printf("ArrayExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - visit(e.isUnaExp()); - if (!result && e.arguments) - { - foreach (ea; *e.arguments) - ea.accept(this); - } - } - - override void visit(BinExp e) - { - //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - e.e1.accept(this); - if (!result) - e.e2.accept(this); - } - - override void visit(CondExp e) - { - //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); - e.econd.accept(this); - if (!result) - visit(e.isBinExp()); - } - } - - scope ReliesOnTemplateParameters v = new ReliesOnTemplateParameters(tparams); - e.accept(v); - return v.result; -} - /*********************************************************** * https://dlang.org/spec/template.html#TemplateParameter */ @@ -900,8 +463,6 @@ extern (C++) class TemplateParameter : ASTNode abstract TemplateParameter syntaxCopy(); - abstract bool declareParameter(Scope* sc); - abstract void print(RootObject oarg, RootObject oded); abstract RootObject specialization(); @@ -953,14 +514,6 @@ extern (C++) class TemplateTypeParameter : TemplateParameter return new TemplateTypeParameter(loc, ident, specType ? specType.syntaxCopy() : null, defaultType ? defaultType.syntaxCopy() : null); } - override final bool declareParameter(Scope* sc) - { - //printf("TemplateTypeParameter.declareParameter('%s')\n", ident.toChars()); - auto ti = new TypeIdentifier(loc, ident); - Declaration ad = new AliasDeclaration(loc, ident, ti); - return sc.insert(ad) !is null; - } - override final void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); @@ -1056,27 +609,6 @@ extern (C++) final class TemplateValueParameter : TemplateParameter defaultValue ? defaultValue.syntaxCopy() : null); } - override bool declareParameter(Scope* sc) - { - /* - Do type semantic earlier. - - This means for certain erroneous value parameters - their "type" can be known earlier and thus a better - error message given. - - For example: - `template test(x* x) {}` - now yields "undefined identifier" rather than the opaque - "variable `x` is used as a type". - */ - if (valType) - valType = valType.typeSemantic(loc, sc); - auto v = new VarDeclaration(loc, valType, ident, null); - v.storage_class = STC.templateparameter; - return sc.insert(v) !is null; - } - override void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); @@ -1133,13 +665,6 @@ extern (C++) final class TemplateAliasParameter : TemplateParameter return new TemplateAliasParameter(loc, ident, specType ? specType.syntaxCopy() : null, objectSyntaxCopy(specAlias), objectSyntaxCopy(defaultAlias)); } - override bool declareParameter(Scope* sc) - { - auto ti = new TypeIdentifier(loc, ident); - Declaration ad = new AliasDeclaration(loc, ident, ti); - return sc.insert(ad) !is null; - } - override void print(RootObject oarg, RootObject oded) { printf(" %s\n", ident.toChars()); @@ -1186,13 +711,6 @@ extern (C++) final class TemplateTupleParameter : TemplateParameter return new TemplateTupleParameter(loc, ident); } - override bool declareParameter(Scope* sc) - { - auto ti = new TypeIdentifier(loc, ident); - Declaration ad = new AliasDeclaration(loc, ident, ti); - return sc.insert(ad) !is null; - } - override void print(RootObject oarg, RootObject oded) { printf(" %s... [", ident.toChars()); diff --git a/dmd/dtoh.d b/dmd/dtoh.d index 0679192b599..10a4824d57c 100644 --- a/dmd/dtoh.d +++ b/dmd/dtoh.d @@ -2,7 +2,7 @@ * This module contains the implementation of the C++ header generation available through * the command line switch -Hc. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dtoh.d, _dtoh.d) @@ -18,9 +18,10 @@ import core.stdc.ctype; import dmd.astcodegen; import dmd.astenums; import dmd.arraytypes; -import dmd.attrib; -import dmd.dsymbol; import dmd.dsymbolsem; +import dmd.templatesem : computeOneMember; +import dmd.expressionsem : toInteger; +import dmd.funcsem : isVirtual; import dmd.errors; import dmd.errorsink; import dmd.globals; @@ -580,7 +581,6 @@ public: debug (Debug_DtoH) { mixin(traceVisit!s); - import dmd.asttypename; printf("[AST.Dsymbol enter] %s\n", s.astTypeName().ptr); } } @@ -1754,7 +1754,6 @@ public: // `this` but accessible via `outer` if (auto td = s.isThisDeclaration()) { - import dmd.id; this.ident = Id.outer; } else @@ -2147,6 +2146,7 @@ public: if (!shouldEmitAndMarkVisited(td)) return; + td.computeOneMember(); if (!td.parameters || !td.onemember || (!td.onemember.isStructDeclaration && !td.onemember.isClassDeclaration && !td.onemember.isFuncDeclaration)) { visit(cast(AST.Dsymbol)td); @@ -2703,7 +2703,6 @@ public: } else { - import dmd.hdrgen; // Hex floating point literals were introduced in C++ 17 const allowHex = global.params.cplusplus >= CppStdRevision.cpp17; floatToBuffer(e.type, e.value, *buf, allowHex); diff --git a/dmd/dversion.d b/dmd/dversion.d index 1561ebb0b7c..2036f783042 100644 --- a/dmd/dversion.d +++ b/dmd/dversion.d @@ -4,7 +4,7 @@ * Specification: $(LINK2 https://dlang.org/spec/version.html#version-specification, Version Specification), * $(LINK2 https://dlang.org/spec/version.html#debug_specification, Debug Specification). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/dversion.d, _dversion.d) @@ -14,15 +14,9 @@ module dmd.dversion; -import dmd.arraytypes; -import dmd.cond; -import dmd.dmodule; -import dmd.dscope; import dmd.dsymbol; -import dmd.dsymbolsem; import dmd.identifier; import dmd.location; -import dmd.common.outbuffer; import dmd.visitor; /*********************************************************** @@ -45,7 +39,7 @@ extern (C++) final class DebugSymbol : Dsymbol { assert(!s); auto ds = new DebugSymbol(loc, ident); - ds.comment = comment; + ds.addComment(comment); return ds; } @@ -81,7 +75,7 @@ extern (C++) final class VersionSymbol : Dsymbol { assert(!s); auto ds = new VersionSymbol(loc, ident); - ds.comment = comment; + ds.addComment(comment); return ds; } diff --git a/dmd/entity.d b/dmd/entity.d index a70029b3749..6ae71b4513c 100644 --- a/dmd/entity.d +++ b/dmd/entity.d @@ -3,7 +3,7 @@ * * Specification $(LINK2 https://dlang.org/spec/entity.html, Named Character Entities) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/entity.d, _entity.d) diff --git a/dmd/enum.h b/dmd/enum.h index 011f486bb31..435ea670b01 100644 --- a/dmd/enum.h +++ b/dmd/enum.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/enumsem.d b/dmd/enumsem.d index cdf8a61bd88..99aaa6c8c93 100644 --- a/dmd/enumsem.d +++ b/dmd/enumsem.d @@ -1,7 +1,7 @@ /** * Does the semantic passes on enums. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/enumsem.d, _enumsem.d) @@ -488,21 +488,30 @@ void enumMemberSemantic(Scope* sc, EnumMember em) else if (first) { Type t; + bool terror; if (em.ed.memtype) + { t = em.ed.memtype; + if (!t.isScalar()) + { + t = Type.terror; // print more relevant error message later + terror = true; + } + } else { t = Type.tint32; if (!em.ed.isAnonymous()) em.ed.memtype = t; } + const errors = global.startGagging(); Expression e = new IntegerExp(em.loc, 0, t); e = e.ctfeInterpret(); - if (global.endGagging(errors)) + if (global.endGagging(errors) || terror) { error(em.loc, "cannot generate 0 value of type `%s` for `%s`", - t.toChars(), em.toChars()); + em.ed.memtype.toChars(), em.toChars()); } // save origValue for better json output em.origValue = e; diff --git a/dmd/errors.d b/dmd/errors.d index 7fecc0c4f1d..a6f63dc40f0 100644 --- a/dmd/errors.d +++ b/dmd/errors.d @@ -1,7 +1,7 @@ /** * Functions for raising errors. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/errors.d, _errors.d) @@ -719,8 +719,6 @@ private void printDiagnostic(const(char)* format, va_list ap, ref DiagnosticCont __gshared SourceLoc old_loc; auto loc = info.loc; if (global.params.v.errorPrintMode != ErrorPrintMode.simpleError && - // ignore supplemental messages with same loc - (loc != old_loc || !info.supplemental) && // ignore invalid files loc != SourceLoc.init && // ignore mixins for now diff --git a/dmd/errors.h b/dmd/errors.h index a2d0f36e038..13a716c0302 100644 --- a/dmd/errors.h +++ b/dmd/errors.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/errorsink.d b/dmd/errorsink.d index 5793ef1c0e5..0d4a3d4b773 100644 --- a/dmd/errorsink.d +++ b/dmd/errorsink.d @@ -1,7 +1,7 @@ /** * Provides an abstraction for what to do with error messages. * - * Copyright: Copyright (C) 2023-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 2023-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/errorsink.d, _errorsink.d) diff --git a/dmd/escape.d b/dmd/escape.d index d3473f691d5..3a2297d1615 100644 --- a/dmd/escape.d +++ b/dmd/escape.d @@ -1,7 +1,7 @@ /** * Most of the logic to implement scoped pointers and scoped references is here. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/escape.d, _escape.d) @@ -24,9 +24,11 @@ import dmd.dscope; import dmd.dsymbol; import dmd.errors; import dmd.expression; +import dmd.expressionsem; import dmd.func; import dmd.funcsem; import dmd.globals : FeatureState; +import dmd.hdrgen : toErrMsg; import dmd.id; import dmd.identifier; import dmd.init; @@ -36,7 +38,7 @@ import dmd.printast; import dmd.rootobject; import dmd.safe; import dmd.tokens; -import dmd.typesem : hasPointers, parameterStorageClass; +import dmd.typesem; import dmd.visitor; import dmd.arraytypes; @@ -46,14 +48,14 @@ private: package(dmd) struct EscapeState { // Maps `sequenceNumber` of a `VarDeclaration` to an object that contains the - // reason it failed to infer `scope` + // reason it inferred or didn't infer `scope` for supplemental error messages // https://issues.dlang.org/show_bug.cgi?id=23295 - private __gshared RootObject[int] scopeInferFailure; + private __gshared RootObject[int] scopeInferReason; /// Called by `initDMD` / `deinitializeDMD` to reset global state static void reset() { - scopeInferFailure = null; + scopeInferReason = null; } } @@ -282,33 +284,38 @@ bool checkAssocArrayLiteralEscape(ref Scope sc, AssocArrayLiteralExp ae, bool ga } /** - * A `scope` variable was assigned to non-scope parameter `v`. - * If applicable, print why the parameter was not inferred `scope`. + * An error occured due to `v` either being or not being `scope`. + * If applicable, print why the `v` was inferred that way. * * Params: * printFunc = error/deprecation print function to use * v = parameter that was not inferred * recursionLimit = recursion limit for printing the reason + * positive = true for telling why v is scope, false for telling why v is not scope */ -private -void printScopeFailure(E)(E printFunc, VarDeclaration v, int recursionLimit) +public +void printScopeReason(E)(E printFunc, VarDeclaration v, int recursionLimit, bool positive) { recursionLimit--; if (recursionLimit < 0 || !v) return; - if (RootObject* o = v.sequenceNumber in EscapeState.scopeInferFailure) + if (RootObject* o = v.sequenceNumber in EscapeState.scopeInferReason) { switch ((*o).dyncast()) { case DYNCAST.expression: Expression e = cast(Expression) *o; - printFunc(e.loc, "which is not `scope` because of `%s`", e.toChars()); + if (positive) + printFunc(e.loc, "`%s` inferred `scope` because of `%s`", v.toErrMsg(), e.toErrMsg()); + else + printFunc(e.loc, "`%s` is not `scope` because of `%s`", v.toErrMsg(), e.toErrMsg()); break; case DYNCAST.dsymbol: VarDeclaration v1 = cast(VarDeclaration) *o; - printFunc(v1.loc, "which is assigned to non-scope parameter `%s`", v1.toChars()); - printScopeFailure(printFunc, v1, recursionLimit); + assert(!positive); + printFunc(v1.loc, "`%s` is assigned to non-scope parameter `%s`", v.toErrMsg(), v1.toErrMsg()); + printScopeReason(printFunc, v1, recursionLimit, positive); break; default: assert(0); @@ -368,11 +375,12 @@ bool checkParamArgumentEscape(ref Scope sc, FuncDeclaration fdc, Identifier parI (desc ~ " `%s` assigned to non-scope anonymous parameter"); if (isThis ? - sc.setUnsafeDIP1000(gag, arg.loc, msg, arg, fdc.toParent2(), fdc) : - sc.setUnsafeDIP1000(gag, arg.loc, msg, v, parId ? parId : fdc, fdc)) + sc.setUnsafeDIP1000(gag, arg.loc, vPar, msg, arg, fdc.toParent2(), fdc) : + sc.setUnsafeDIP1000(gag, arg.loc, vPar, msg, v, parId ? parId : fdc, fdc)) { result = true; - printScopeFailure(previewSupplementalFunc(sc.isDeprecated(), sc.useDIP1000), vPar, 10); + printScopeReason(previewSupplementalFunc(sc.isDeprecated(), sc.useDIP1000), vPar, 10, false); + printScopeReason(previewSupplementalFunc(sc.isDeprecated(), sc.useDIP1000), v, 10, true); } } @@ -714,7 +722,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) if (vaIsFirstRef && v.isParameter() && v.isReturn()) { // va=v, where v is `return scope` - if (inferScope(va)) + if (inferScope(va, e)) return; } @@ -748,7 +756,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) // v = scope, va should be scope as well const vaWasScope = va && va.isScope(); - if (inferScope(va)) + if (inferScope(va, e)) { // In case of `scope local = returnScopeParam`, do not infer return scope for `x` if (!vaWasScope && v.isReturn() && !va.isReturn()) @@ -822,7 +830,7 @@ bool checkAssignEscape(ref Scope sc, Expression e, bool gag, bool byRef) if (p != sc.func) return; - if (inferScope(va)) + if (inferScope(va, e)) { if (v.isReturn() && !va.isReturn()) va.storage_class |= STC.return_ | STC.returninferred; @@ -1210,8 +1218,12 @@ private bool checkReturnEscapeImpl(ref Scope sc, Expression e, bool refs, bool g else { // https://issues.dlang.org/show_bug.cgi?id=17029 - result |= sc.setUnsafeDIP1000(gag, e.loc, "returning scope variable `%s`", v); - return; + if (sc.setUnsafeDIP1000(gag, e.loc, "returning scope variable `%s`", v)) + { + printScopeReason(previewSupplementalFunc(sc.isDeprecated(), sc.useDIP1000), v, 10, true); + result = true; + return; + } } } } @@ -1385,16 +1397,19 @@ private bool checkReturnEscapeImpl(ref Scope sc, Expression e, bool refs, bool g * * Params: * va = variable to infer scope for + * reason = optional Expression that causes `va` to infer scope, used for supplemental error message * Returns: `true` if succesful or already `scope` */ private -bool inferScope(VarDeclaration va) +bool inferScope(VarDeclaration va, RootObject reason) { if (!va) return false; if (!va.isDataseg() && va.maybeScope && !va.isScope()) { //printf("inferring scope for %s\n", va.toChars()); + if (reason) + EscapeState.scopeInferReason[va.sequenceNumber] = reason; va.maybeScope = false; va.storage_class |= STC.scope_ | STC.scopeinferred; return true; @@ -2010,7 +2025,7 @@ private void doNotInferScope(VarDeclaration v, RootObject o) { v.maybeScope = false; if (o && v.isParameter()) - EscapeState.scopeInferFailure[v.sequenceNumber] = o; + EscapeState.scopeInferReason[v.sequenceNumber] = o; } } @@ -2048,7 +2063,7 @@ void finishScopeParamInference(FuncDeclaration funcdecl, ref TypeFunction f) foreach (u, p; f.parameterList) { auto v = (*funcdecl.parameters)[u]; - if (!v.isScope() && v.type.hasPointers() && inferScope(v)) + if (!v.isScope() && v.type.hasPointers() && inferScope(v, null)) { //printf("Inferring scope for %s\n", v.toChars()); p.storageClass |= STC.scope_ | STC.scopeinferred; @@ -2058,7 +2073,7 @@ void finishScopeParamInference(FuncDeclaration funcdecl, ref TypeFunction f) if (funcdecl.vthis) { - inferScope(funcdecl.vthis); + inferScope(funcdecl.vthis, null); f.isScopeQual = funcdecl.vthis.isScope(); f.isScopeInferred = !!(funcdecl.vthis.storage_class & STC.scopeinferred); } @@ -2199,6 +2214,14 @@ bool setUnsafeDIP1000(ref Scope sc, bool gag, Loc loc, const(char)* msg, return setUnsafePreview(&sc, sc.useDIP1000, gag, loc, msg, args); } +/// Overload for scope violations that also stores the variable whose scope status caused the issue +private +bool setUnsafeDIP1000(ref Scope sc, bool gag, Loc loc, VarDeclaration scopeVar, + const(char)* msg, RootObject[] args...) +{ + return setUnsafePreview(&sc, sc.useDIP1000, gag, loc, scopeVar, msg, args); +} + /*************************************** * Check that taking the address of `v` is `@safe` * diff --git a/dmd/expression.d b/dmd/expression.d index b2a84ac0aec..d6c65a720f3 100644 --- a/dmd/expression.d +++ b/dmd/expression.d @@ -3,7 +3,7 @@ * * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/expression.d, _expression.d) @@ -17,25 +17,18 @@ import core.stdc.stdarg; import core.stdc.stdio; import core.stdc.string; -import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; import dmd.ast_node; -import dmd.ctfeexpr : isCtfeReferenceValid; -import dmd.dcast : implicitConvTo; import dmd.dclass; import dmd.declaration; -import dmd.dimport; -import dmd.dmodule; import dmd.dstruct; import dmd.dsymbol; import dmd.dtemplate; import dmd.errors; -import dmd.errorsink; -import dmd.expressionsem : getDsymbol; import dmd.func; import dmd.globals; -import dmd.hdrgen; +import dmd.hdrgen : toChars; import dmd.id; import dmd.identifier; import dmd.init; @@ -43,15 +36,11 @@ import dmd.location; import dmd.mtype; import dmd.root.complex; import dmd.root.ctfloat; -import dmd.common.outbuffer; -import dmd.root.optional; import dmd.root.rmem; import dmd.rootobject; import dmd.root.string; import dmd.root.utf; -import dmd.target; import dmd.tokens; -import dmd.typesem : size, mutableOf, unSharedOf; import dmd.visitor; enum LOGSEMANTIC = false; @@ -73,103 +62,6 @@ inout(Expression) lastComma(inout Expression e) } -/**************************************** - * Expand tuples in-place. - * - * Example: - * When there's a call `f(10, pair: AliasSeq!(20, 30), single: 40)`, the input is: - * `exps = [10, (20, 30), 40]` - * `names = [null, "pair", "single"]` - * The arrays will be modified to: - * `exps = [10, 20, 30, 40]` - * `names = [null, "pair", null, "single"]` - * - * Params: - * exps = array of Expressions - * names = optional array of names corresponding to Expressions - */ -void expandTuples(Expressions* exps, ArgumentLabels* names = null) -{ - //printf("expandTuples()\n"); - if (exps is null) - return; - - if (names) - { - if (exps.length != names.length) - { - printf("exps.length = %d, names.length = %d\n", cast(int) exps.length, cast(int) names.length); - printf("exps = %s, names = %s\n", exps.toChars(), names.toChars()); - if (exps.length > 0) - printf("%s\n", (*exps)[0].loc.toChars()); - assert(0); - } - } - - // At `index`, a tuple of length `length` is expanded. Insert corresponding nulls in `names`. - void expandNames(size_t index, size_t length) - { - if (names) - { - if (length == 0) - { - names.remove(index); - return; - } - foreach (i; 1 .. length) - { - names.insert(index + i, ArgumentLabel(cast(Identifier) null, Loc.init)); - } - } - } - - for (size_t i = 0; i < exps.length; i++) - { - Expression arg = (*exps)[i]; - if (!arg) - continue; - - // Look for tuple with 0 members - if (auto e = arg.isTypeExp()) - { - if (auto tt = e.type.toBasetype().isTypeTuple()) - { - if (!tt.arguments || tt.arguments.length == 0) - { - exps.remove(i); - expandNames(i, 0); - if (i == exps.length) - return; - } - else // Expand a TypeTuple - { - exps.remove(i); - auto texps = new Expressions(tt.arguments.length); - foreach (j, a; *tt.arguments) - (*texps)[j] = new TypeExp(e.loc, a.type); - exps.insert(i, texps); - expandNames(i, texps.length); - } - i--; - continue; - } - } - - // Inline expand all the tuples - while (arg.op == EXP.tuple) - { - TupleExp te = cast(TupleExp)arg; - exps.remove(i); // remove arg - exps.insert(i, te.exps); // replace with tuple contents - expandNames(i, te.exps.length); - if (i == exps.length) - return; // empty tuple, no more arguments - (*exps)[i] = Expression.combine(te.e0, (*exps)[i]); - arg = (*exps)[i]; - } - } -} - /**************************************** * If `s` is a function template, i.e. the only member of a template * and that member is a function, return that template. @@ -210,76 +102,6 @@ DotIdExp typeDotIdExp(Loc loc, Type type, Identifier ident) @safe return new DotIdExp(loc, new TypeExp(loc, type), ident); } -/*************************************************** - * Given an Expression, find the variable it really is. - * - * For example, `a[index]` is really `a`, and `s.f` is really `s`. - * Params: - * e = Expression to look at - * deref = number of dereferences encountered - * Returns: - * variable if there is one, null if not - */ -VarDeclaration expToVariable(Expression e, out int deref) -{ - deref = 0; - while (1) - { - switch (e.op) - { - case EXP.variable: - return e.isVarExp().var.isVarDeclaration(); - - case EXP.dotVariable: - e = e.isDotVarExp().e1; - if (e.type.toBasetype().isTypeClass()) - deref++; - - continue; - - case EXP.index: - { - e = e.isIndexExp().e1; - if (!e.type.toBasetype().isTypeSArray()) - deref++; - - continue; - } - - case EXP.slice: - { - e = e.isSliceExp().e1; - if (!e.type.toBasetype().isTypeSArray()) - deref++; - - continue; - } - - case EXP.super_: - return e.isSuperExp().var.isVarDeclaration(); - case EXP.this_: - return e.isThisExp().var.isVarDeclaration(); - - // Temporaries for rvalues that need destruction - // are of form: (T s = rvalue, s). For these cases - // we can just return var declaration of `s`. However, - // this is intentionally not calling `Expression.extractLast` - // because at this point we cannot infer the var declaration - // of more complex generated comma expressions such as the - // one for the array append hook. - case EXP.comma: - { - if (auto ve = e.isCommaExp().e2.isVarExp()) - return ve.var.isVarDeclaration(); - - return null; - } - default: - return null; - } - } -} - enum OwnedBy : ubyte { code, // normal code expression in AST @@ -472,64 +294,6 @@ extern (C++) /* IN_LLVM abstract */ class Expression : ASTNode return a; } - dinteger_t toInteger() - { - //printf("Expression %s\n", EXPtoString(op).ptr); - if (!type || !type.isTypeError()) - error(loc, "integer constant expression expected instead of `%s`", toChars()); - return 0; - } - - uinteger_t toUInteger() - { - //printf("Expression %s\n", EXPtoString(op).ptr); - return cast(uinteger_t)toInteger(); - } - - real_t toReal() - { - error(loc, "floating point constant expression expected instead of `%s`", toChars()); - return CTFloat.zero; - } - - real_t toImaginary() - { - error(loc, "floating point constant expression expected instead of `%s`", toChars()); - return CTFloat.zero; - } - - complex_t toComplex() - { - error(loc, "floating point constant expression expected instead of `%s`", toChars()); - return complex_t(CTFloat.zero); - } - - StringExp toStringExp() - { - return null; - } - - /*************************************** - * Return !=0 if expression is an lvalue. - */ - bool isLvalue() - { - return false; - } - - /**************************************** - * Check that the expression has a valid type. - * If not, generates an error "... has no type". - * Returns: - * true if the expression is not valid. - * Note: - * When this function returns true, `checkValue()` should also return true. - */ - bool checkType() - { - return false; - } - /****************************** * If this is a reference, dereference it. */ @@ -578,13 +342,6 @@ version (IN_LLVM) assert(0); } - /// Statically evaluate this expression to a `bool` if possible - /// Returns: an optional thath either contains the value or is empty - Optional!bool toBool() - { - return typeof(return)(); - } - bool hasCode() { return true; @@ -743,6 +500,16 @@ version (IN_LLVM) } } +// Approximate Non-semantic version of the `Type.isScalar` function in `typesem` +bool _isRoughlyScalar(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.integral | TFlags.floating) != 0; + else if (_this.ty == Tenum || _this.ty == Tpointer) // the enum is possibly scalar + return true; + return false; +} + /*********************************************************** * A compile-time known integer value */ @@ -755,15 +522,15 @@ extern (C++) final class IntegerExp : Expression super(loc, EXP.int64); //printf("IntegerExp(value = %lld, type = '%s')\n", value, type ? type.toChars() : ""); assert(type); - if (!type.isScalar()) - { - //printf("%s, loc = %d\n", toChars(), loc.linnum); - if (type.ty != Terror) - error(loc, "integral constant must be scalar type, not `%s`", type.toChars()); - type = Type.terror; - } + + /* Verify no path to the following assert failure. + * Weirdly, the isScalar() includes floats - see enumsem.enumMemberSemantic() for the + * base type. This is possibly a bug. + */ + assert(_isRoughlyScalar(type) || type.ty == Terror); + this.type = type; - this.value = normalize(type.toBasetype().ty, value); + this.value = normalize(type.toBaseTypeNonSemantic().ty, value); } extern (D) this(dinteger_t value) @@ -778,39 +545,6 @@ extern (C++) final class IntegerExp : Expression return new IntegerExp(loc, value, type); } - override dinteger_t toInteger() - { - // normalize() is necessary until we fix all the paints of 'type' - return value = normalize(type.toBasetype().ty, value); - } - - override real_t toReal() - { - // normalize() is necessary until we fix all the paints of 'type' - const ty = type.toBasetype().ty; - const val = normalize(ty, value); - value = val; - return (ty == Tuns64) - ? real_t(cast(ulong)val) - : real_t(cast(long)val); - } - - override real_t toImaginary() - { - return CTFloat.zero; - } - - override complex_t toComplex() - { - return complex_t(toReal()); - } - - override Optional!bool toBool() - { - bool r = toInteger() != 0; - return typeof(return)(r); - } - override void accept(Visitor v) { v.visit(this); @@ -823,7 +557,7 @@ extern (C++) final class IntegerExp : Expression extern (D) void setInteger(dinteger_t value) { - this.value = normalize(type.toBasetype().ty, value); + this.value = normalize(type.toBaseTypeNonSemantic().ty, value); } extern (D) static dinteger_t normalize(TY ty, dinteger_t value) @@ -831,6 +565,8 @@ extern (C++) final class IntegerExp : Expression /* 'Normalize' the value of the integer to be in range of the type */ dinteger_t result; + if (ty == Tpointer) + ty = Type.tsize_t.ty; switch (ty) { case Tbool: @@ -872,15 +608,6 @@ extern (C++) final class IntegerExp : Expression result = cast(ulong)value; break; - case Tpointer: - if (target.ptrsize == 8) - goto case Tuns64; - if (target.ptrsize == 4) - goto case Tuns32; - if (target.ptrsize == 2) - goto case Tuns16; - assert(0); - default: break; } @@ -1013,36 +740,6 @@ extern (C++) final class RealExp : Expression return new RealExp(loc, value, type); } - override dinteger_t toInteger() - { - return cast(sinteger_t)toReal(); - } - - override uinteger_t toUInteger() - { - return cast(uinteger_t)toReal(); - } - - override real_t toReal() - { - return type.isReal() ? value : CTFloat.zero; - } - - override real_t toImaginary() - { - return type.isReal() ? CTFloat.zero : value; - } - - override complex_t toComplex() - { - return complex_t(toReal(), toImaginary()); - } - - override Optional!bool toBool() - { - return typeof(return)(!!value); - } - override void accept(Visitor v) { v.visit(this); @@ -1069,36 +766,6 @@ extern (C++) final class ComplexExp : Expression return new ComplexExp(loc, value, type); } - override dinteger_t toInteger() - { - return cast(sinteger_t)toReal(); - } - - override uinteger_t toUInteger() - { - return cast(uinteger_t)toReal(); - } - - override real_t toReal() - { - return creall(value); - } - - override real_t toImaginary() - { - return cimagl(value); - } - - override complex_t toComplex() - { - return value; - } - - override Optional!bool toBool() - { - return typeof(return)(!!value); - } - override void accept(Visitor v) { v.visit(this); @@ -1128,11 +795,6 @@ extern (C++) class IdentifierExp : Expression return new IdentifierExp(loc, ident); } - override final bool isLvalue() - { - return !this.rvalue; - } - override void accept(Visitor v) { v.visit(this); @@ -1172,11 +834,6 @@ extern (C++) final class DsymbolExp : Expression this.hasOverloads = hasOverloads; } - override bool isLvalue() - { - return !rvalue; - } - override void accept(Visitor v) { v.visit(this); @@ -1211,18 +868,6 @@ extern (C++) class ThisExp : Expression return r; } - override Optional!bool toBool() - { - // `this` is never null (what about structs?) - return typeof(return)(true); - } - - override final bool isLvalue() - { - // Class `this` should be an rvalue; struct `this` should be an lvalue. - return !rvalue && type.toBasetype().ty != Tclass; - } - override void accept(Visitor v) { v.visit(this); @@ -1258,24 +903,6 @@ extern (C++) final class NullExp : Expression this.type = type; } - override Optional!bool toBool() - { - // null in any type is false - return typeof(return)(false); - } - - override StringExp toStringExp() - { - if (this.type.implicitConvTo(Type.tstring)) - { - auto se = new StringExp(loc, (cast(char*)mem.xcalloc(1, 1))[0 .. 0]); - se.type = Type.tstring; - return se; - } - - return null; - } - override void accept(Visitor v) { v.visit(this); @@ -1349,10 +976,11 @@ extern (C++) final class StringExp : Expression * as tynto. * Params: * tynto = code unit type of the target encoding + * s = set to error message on invalid string * Returns: * number of code units */ - size_t numberOfCodeUnits(int tynto = 0) const + extern (D) size_t numberOfCodeUnits(int tynto, out .string s) const { int encSize; switch (tynto) @@ -1375,11 +1003,9 @@ extern (C++) final class StringExp : Expression case 1: for (size_t u = 0; u < len;) { - if (const s = utf_decodeChar(string[0 .. len], u, c)) - { - error(loc, "%.*s", cast(int)s.length, s.ptr); + s = utf_decodeChar(string[0 .. len], u, c); + if (s) return 0; - } result += utf_codeLength(encSize, c); } break; @@ -1387,11 +1013,9 @@ extern (C++) final class StringExp : Expression case 2: for (size_t u = 0; u < len;) { - if (const s = utf_decodeWchar(wstring[0 .. len], u, c)) - { - error(loc, "%.*s", cast(int)s.length, s.ptr); + s = utf_decodeWchar(wstring[0 .. len], u, c); + if (s) return 0; - } result += utf_codeLength(encSize, c); } break; @@ -1500,12 +1124,6 @@ extern (C++) final class StringExp : Expression } } - override StringExp toStringExp() - { - return this; - } - - /** * Compare two `StringExp` by length, then value * @@ -1570,21 +1188,6 @@ extern (C++) final class StringExp : Expression return 0; } - override Optional!bool toBool() - { - // Keep the old behaviour for this refactoring - // Should probably match language spec instead and check for length - return typeof(return)(true); - } - - override bool isLvalue() - { - /* string literal is rvalue in default, but - * conversion to reference of static array is only allowed. - */ - return !rvalue && (type && type.toBasetype().ty == Tsarray); - } - /******************************** * Convert string contents to a 0 terminated string, * allocated by mem.xmalloc(). @@ -1711,34 +1314,7 @@ extern (C++) final class TupleExp : Expression { super(loc, EXP.tuple); this.exps = new Expressions(); - - this.exps.reserve(tup.objects.length); - foreach (o; *tup.objects) - { - if (Dsymbol s = getDsymbol(o)) - { - /* If tuple element represents a symbol, translate to DsymbolExp - * to supply implicit 'this' if needed later. - */ - Expression e = new DsymbolExp(loc, s); - this.exps.push(e); - } - else if (auto eo = o.isExpression()) - { - auto e = eo.copy(); - e.loc = loc; // https://issues.dlang.org/show_bug.cgi?id=15669 - this.exps.push(e); - } - else if (auto t = o.isType()) - { - Expression e = new TypeExp(loc, t); - this.exps.push(e); - } - else - { - error(loc, "`%s` is not an expression", o.toChars()); - } - } + // the rest of the constructor is moved to expressionsem.d in fillTupleExpExps function } static TupleExp create(Loc loc, Expressions* exps) @safe @@ -1827,64 +1403,6 @@ extern (C++) final class ArrayLiteralExp : Expression return el ? el : basis; } - override Optional!bool toBool() - { - size_t dim = elements ? elements.length : 0; - return typeof(return)(dim != 0); - } - - override StringExp toStringExp() - { - TY telem = type.nextOf().toBasetype().ty; - if (!(telem.isSomeChar || (telem == Tvoid && (!elements || elements.length == 0)))) - return null; - - ubyte sz = 1; - if (telem == Twchar) - sz = 2; - else if (telem == Tdchar) - sz = 4; - - OutBuffer buf; - if (elements) - { - foreach (i; 0 .. elements.length) - { - auto ch = this[i]; - if (ch.op != EXP.int64) - return null; - if (sz == 1) - buf.writeByte(cast(ubyte)ch.toInteger()); - else if (sz == 2) - buf.writeword(cast(uint)ch.toInteger()); - else - buf.write4(cast(uint)ch.toInteger()); - } - } - char prefix; - if (sz == 1) - { - prefix = 'c'; - buf.writeByte(0); - } - else if (sz == 2) - { - prefix = 'w'; - buf.writeword(0); - } - else - { - prefix = 'd'; - buf.write4(0); - } - - const size_t len = buf.length / sz - 1; - auto se = new StringExp(loc, buf.extractSlice()[0 .. len * sz], len, sz, prefix); - se.sz = sz; - se.type = type; - return se; - } - override void accept(Visitor v) { v.visit(this); @@ -1919,12 +1437,6 @@ extern (C++) final class AssocArrayLiteralExp : Expression return new AssocArrayLiteralExp(loc, arraySyntaxCopy(keys), arraySyntaxCopy(values)); } - override Optional!bool toBool() - { - size_t dim = keys.length; - return typeof(return)(dim != 0); - } - override void accept(Visitor v) { v.visit(this); @@ -2018,38 +1530,6 @@ else return exp; } - /************************************ - * Get index of field. - * Returns -1 if not found. - */ - extern (D) int getFieldIndex(Type type, uint offset) - { - /* Find which field offset is by looking at the field offsets - */ - if (!elements.length) - return -1; - - const sz = type.size(); - if (sz == SIZE_INVALID) - return -1; - foreach (i, v; sd.fields) - { - if (offset != v.offset) - continue; - if (sz != v.type.size()) - continue; - /* context fields might not be filled. */ - if (i >= sd.nonHiddenFields()) - return cast(int)i; - if (auto e = (*elements)[i]) - { - return cast(int)i; - } - return -1; - } - assert(0); - } - override void accept(Visitor v) { v.visit(this); @@ -2095,12 +1575,6 @@ extern (C++) final class TypeExp : Expression return new TypeExp(loc, type.syntaxCopy()); } - override bool checkType() - { - error(loc, "type `%s` is not an expression", toChars()); - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2133,27 +1607,6 @@ extern (C++) final class ScopeExp : Expression return new ScopeExp(loc, sds.syntaxCopy(null)); } - override bool checkType() - { - if (sds.isPackage()) - { - error(loc, "%s `%s` has no type", sds.kind(), sds.toChars()); - return true; - } - auto ti = sds.isTemplateInstance(); - if (!ti) - return false; - //assert(ti.needsTypeInference(sc)); - if (ti.tempdecl && - ti.semantictiargsdone && - ti.semanticRun == PASS.initial) - { - error(loc, "partial %s `%s` has no type", sds.kind(), toChars()); - return true; - } - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -2176,17 +1629,6 @@ extern (C++) final class TemplateExp : Expression this.fd = fd; } - override bool isLvalue() - { - return fd !is null; - } - - override bool checkType() - { - error(loc, "%s `%s` has no type", td.kind(), toChars()); - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2312,34 +1754,13 @@ extern (C++) final class SymOffExp : SymbolExp { if (auto v = var.isVarDeclaration()) { - // FIXME: This error report will never be handled anyone. - // It should be done before the SymOffExp construction. - if (v.needThis()) - { - auto t = v.isThis(); - assert(t); - .error(loc, "taking the address of non-static variable `%s` requires an instance of `%s`", v.toChars(), t.toChars()); - } + assert(!v.needThis()); // make sure the error message is no longer necessary hasOverloads = false; } super(loc, EXP.symbolOffset, var, hasOverloads); this.offset = offset; } - override Optional!bool toBool() - { -version (IN_LLVM) -{ - import gen.dpragma : LDCPragma; - - // For a weak symbol, we only statically know that it is non-null if the - // offset is non-zero. - if (var.llvmInternal == LDCPragma.LLVMextern_weak && offset == 0) - return typeof(return)(); -} - return typeof(return)(true); - } - override void accept(Visitor v) { v.visit(this); @@ -2368,13 +1789,6 @@ extern (C++) final class VarExp : SymbolExp return new VarExp(loc, var, hasOverloads); } - override bool isLvalue() - { - if (rvalue || var.storage_class & (STC.lazy_ | STC.rvalue | STC.manifest)) - return false; - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2396,11 +1810,6 @@ extern (C++) final class OverExp : Expression type = Type.tvoid; } - override bool isLvalue() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2443,16 +1852,6 @@ extern (C++) final class FuncExp : Expression return new FuncExp(loc, fd); } - override bool checkType() - { - if (td) - { - error(loc, "template lambda has no type"); - return true; - } - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -2702,11 +2101,6 @@ extern (C++) class BinAssignExp : BinExp super(loc, op, e1, e2); } - override final bool isLvalue() - { - return !rvalue; - } - override void accept(Visitor v) { v.visit(this); @@ -2767,6 +2161,7 @@ extern (C++) final class ImportExp : UnaExp extern (C++) final class AssertExp : UnaExp { Expression msg; + Expression loweredFrom; extern (D) this(Loc loc, Expression e, Expression msg = null) @safe { @@ -2848,12 +2243,6 @@ extern (C++) final class DotTemplateExp : UnaExp this.td = td; } - override bool checkType() - { - error(loc, "%s `%s` has no type", td.kind(), toChars()); - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2878,16 +2267,6 @@ extern (C++) final class DotVarExp : UnaExp this.hasOverloads = hasOverloads; } - override bool isLvalue() - { - if (rvalue) - return false; - if (e1.op != EXP.structLiteral) - return true; - auto vd = var.isVarDeclaration(); - return !(vd && vd.isField()); - } - override void accept(Visitor v) { v.visit(this); @@ -2901,35 +2280,21 @@ extern (C++) final class DotTemplateInstanceExp : UnaExp { TemplateInstance ti; - extern (D) this(Loc loc, Expression e, Identifier name, Objects* tiargs) - { - super(loc, EXP.dotTemplateInstance, e); - //printf("DotTemplateInstanceExp()\n"); - this.ti = new TemplateInstance(loc, name, tiargs); - } - extern (D) this(Loc loc, Expression e, TemplateInstance ti) @safe { super(loc, EXP.dotTemplateInstance, e); this.ti = ti; } - override DotTemplateInstanceExp syntaxCopy() + extern (D) this(Loc loc, Expression e, Identifier name, Objects* tiargs) { - return new DotTemplateInstanceExp(loc, e1.syntaxCopy(), ti.name, TemplateInstance.arraySyntaxCopy(ti.tiargs)); + //printf("DotTemplateInstanceExp()\n"); + this(loc, e, new TemplateInstance(loc, name, tiargs)); } - override bool checkType() + override DotTemplateInstanceExp syntaxCopy() { - // Same logic as ScopeExp.checkType() - if (ti.tempdecl && - ti.semantictiargsdone && - ti.semanticRun == PASS.initial) - { - error(loc, "partial %s `%s` has no type", ti.kind(), toChars()); - return true; - } - return false; + return new DotTemplateInstanceExp(loc, e1.syntaxCopy(), ti.name, TemplateInstance.arraySyntaxCopy(ti.tiargs)); } override void accept(Visitor v) @@ -3022,6 +2387,7 @@ extern (C++) final class CallExp : UnaExp bool inDebugStatement; /// true if this was in a debug statement bool ignoreAttributes; /// don't enforce attributes (e.g. call @gc function in @nogc code) bool isUfcsRewrite; /// the first argument was pushed in here by a UFCS rewrite + bool fromOpAssignment; // set when operator overload method call from assignment (2024 edition) VarDeclaration vthis2; // container for multi-context Expression loweredFrom; // set if this is the result of a lowering @@ -3103,49 +2469,12 @@ extern (C++) final class CallExp : UnaExp return new CallExp(loc, e1.syntaxCopy(), arraySyntaxCopy(arguments), names ? names.copy() : null); } - override bool isLvalue() - { - if (rvalue) - return false; - Type tb = e1.type.toBasetype(); - if (tb.ty == Tdelegate || tb.ty == Tpointer) - tb = tb.nextOf(); - auto tf = tb.isTypeFunction(); - if (tf && tf.isRef) - { - if (auto dve = e1.isDotVarExp()) - if (dve.var.isCtorDeclaration()) - return false; - return true; // function returns a reference - } - return false; - } - override void accept(Visitor v) { v.visit(this); } } -/** - * Get the called function type from a call expression - * Params: - * ce = function call expression. Must have had semantic analysis done. - * Returns: called function type, or `null` if error / no semantic analysis done - */ -TypeFunction calledFunctionType(CallExp ce) -{ - Type t = ce.e1.type; - if (!t) - return null; - t = t.toBasetype(); - if (auto tf = t.isTypeFunction()) - return tf; - if (auto td = t.isTypeDelegate()) - return td.nextOf().isTypeFunction(); - return null; -} - FuncDeclaration isFuncAddress(Expression e, bool* hasOverloads = null) @safe { if (auto ae = e.isAddrExp()) @@ -3198,13 +2527,6 @@ extern (C++) final class AddrExp : UnaExp type = t; } - override Optional!bool toBool() - { - if (isCtfeReferenceValid(e1)) - return typeof(return)(true); - return UnaExp.toBool(); - } - override void accept(Visitor v) { v.visit(this); @@ -3229,11 +2551,6 @@ extern (C++) final class PtrExp : UnaExp type = t; } - override bool isLvalue() - { - return !rvalue; - } - override void accept(Visitor v) { v.visit(this); @@ -3360,16 +2677,6 @@ extern (C++) final class CastExp : UnaExp return to ? new CastExp(loc, e1.syntaxCopy(), to.syntaxCopy()) : new CastExp(loc, e1.syntaxCopy(), mod); } - override bool isLvalue() - { - //printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars()); - if (rvalue || !e1.isLvalue()) - return false; - return (to.ty == Tsarray && (e1.type.ty == Tvector || e1.type.ty == Tsarray)) || - (to.ty == Taarray && e1.type.ty == Taarray) || - e1.type.mutableOf.unSharedOf().equals(to.mutableOf().unSharedOf()); - } - override void accept(Visitor v) { v.visit(this); @@ -3419,11 +2726,6 @@ extern (C++) final class VectorArrayExp : UnaExp super(loc, EXP.vectorArray, e1); } - override bool isLvalue() - { - return !rvalue && e1.isLvalue(); - } - override void accept(Visitor v) { v.visit(this); @@ -3473,19 +2775,6 @@ extern (C++) final class SliceExp : UnaExp return se; } - override bool isLvalue() - { - /* slice expression is rvalue in default, but - * conversion to reference of static array is only allowed. - */ - return !rvalue && (type && type.toBasetype().ty == Tsarray); - } - - override Optional!bool toBool() - { - return e1.toBool(); - } - override void accept(Visitor v) { v.visit(this); @@ -3542,15 +2831,6 @@ extern (C++) final class ArrayExp : UnaExp return ae; } - override bool isLvalue() - { - if (rvalue) - return false; - if (type && type.toBasetype().ty == Tvoid) - return false; - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -3602,16 +2882,6 @@ extern (C++) final class CommaExp : BinExp originalExp = oe; } - override bool isLvalue() - { - return !rvalue && e2.isLvalue(); - } - - override Optional!bool toBool() - { - return e2.toBool(); - } - override void accept(Visitor v) { v.visit(this); @@ -3677,11 +2947,6 @@ extern (C++) final class DelegatePtrExp : UnaExp super(loc, EXP.delegatePointer, e1); } - override bool isLvalue() - { - return !rvalue && e1.isLvalue(); - } - override void accept(Visitor v) { v.visit(this); @@ -3700,11 +2965,6 @@ extern (C++) final class DelegateFuncptrExp : UnaExp super(loc, EXP.delegateFunctionPointer, e1); } - override bool isLvalue() - { - return !rvalue && e1.isLvalue(); - } - override void accept(Visitor v) { v.visit(this); @@ -3741,19 +3001,6 @@ extern (C++) final class IndexExp : BinExp return ie; } - override bool isLvalue() - { - if (rvalue) - return false; - auto t1b = e1.type.toBasetype(); - if (t1b.isTypeAArray() || t1b.isTypeSArray() || - (e1.isIndexExp() && t1b != t1b.isTypeDArray())) - { - return e1.isLvalue(); - } - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -3822,17 +3069,6 @@ extern (C++) class AssignExp : BinExp super(loc, tok, e1, e2); } - override final bool isLvalue() - { - // Array-op 'x[] = y[]' should make an rvalue. - // Setting array length 'x.length = v' should make an rvalue. - if (e1.op == EXP.slice || e1.op == EXP.arrayLength) - { - return false; - } - return !rvalue; - } - override void accept(Visitor v) { v.visit(this); @@ -3865,6 +3101,8 @@ extern (C++) final class LoweredAssignExp : AssignExp */ extern (C++) final class ConstructExp : AssignExp { + Expression lowering; + extern (D) this(Loc loc, Expression e1, Expression e2) @safe { super(loc, EXP.construct, e1, e2); @@ -4555,11 +3793,6 @@ extern (C++) final class CondExp : BinExp return new CondExp(loc, econd.syntaxCopy(), e1.syntaxCopy(), e2.syntaxCopy()); } - override bool isLvalue() - { - return !rvalue && e1.isLvalue() && e2.isLvalue(); - } - override void accept(Visitor v) { v.visit(this); @@ -4700,27 +3933,6 @@ extern (C++) final class ClassReferenceExp : Expression return value.sd.isClassDeclaration(); } - // Return index of the field, or -1 if not found - int getFieldIndex(Type fieldtype, uint fieldoffset) - { - ClassDeclaration cd = originalClass(); - uint fieldsSoFar = 0; - for (size_t j = 0; j < value.elements.length; j++) - { - while (j - fieldsSoFar >= cd.fields.length) - { - fieldsSoFar += cd.fields.length; - cd = cd.baseClass; - } - VarDeclaration v2 = cd.fields[j - fieldsSoFar]; - if (fieldoffset == v2.offset && fieldtype.size() == v2.type.size()) - { - return cast(int)(value.elements.length - fieldsSoFar - cd.fields.length + (j - fieldsSoFar)); - } - } - return -1; - } - // Return index of the field, or -1 if not found // Same as getFieldIndex, but checks for a direct match with the VarDeclaration int findFieldIndexByName(VarDeclaration v) diff --git a/dmd/expression.h b/dmd/expression.h index da569f5702f..c90e4f13477 100644 --- a/dmd/expression.h +++ b/dmd/expression.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -63,6 +63,17 @@ namespace dmd Expression *optimize(Expression *exp, int result, bool keepLvalue = false); bool isIdentical(const Expression *exp, const Expression *e); bool equals(const Expression *exp, const Expression *e); + bool isLvalue(Expression *exp); + bool canElideCopy(Expression *exp, Type *to, bool checkMod = false); + int32_t getFieldIndex(ClassReferenceExp *cre, Type *fieldtype, uint32_t fieldoffset); + void fillTupleExpExps(TupleExp *te, TupleDeclaration *tup); + Optional toBool(Expression *exp); + StringExp *toStringExp(Expression *exp); + dinteger_t toInteger(Expression *exp); + uinteger_t toUInteger(Expression *exp); + real_t toReal(Expression *exp); + real_t toImaginary(Expression *exp); + complex_t toComplex(Expression *exp); } typedef unsigned char OwnedBy; @@ -98,19 +109,10 @@ class Expression : public ASTNode const char* toChars() const final override; - virtual dinteger_t toInteger(); - virtual uinteger_t toUInteger(); - virtual real_t toReal(); - virtual real_t toImaginary(); - virtual complex_t toComplex(); - virtual StringExp *toStringExp(); - virtual bool isLvalue(); - virtual bool checkType(); Expression *addressOf(); Expression *deref(); int isConst(); - virtual Optional toBool(); virtual bool hasCode() { return true; @@ -238,11 +240,6 @@ class IntegerExp final : public Expression dinteger_t value; static IntegerExp *create(Loc loc, dinteger_t value, Type *type); - dinteger_t toInteger() override; - real_t toReal() override; - real_t toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } dinteger_t getInteger() { return value; } template @@ -263,12 +260,6 @@ class RealExp final : public Expression real_t value; static RealExp *create(Loc loc, real_t value, Type *type); - dinteger_t toInteger() override; - uinteger_t toUInteger() override; - real_t toReal() override; - real_t toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -278,12 +269,6 @@ class ComplexExp final : public Expression complex_t value; static ComplexExp *create(Loc loc, complex_t value, Type *type); - dinteger_t toInteger() override; - uinteger_t toUInteger() override; - real_t toReal() override; - real_t toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -293,7 +278,6 @@ class IdentifierExp : public Expression Identifier *ident; static IdentifierExp *create(Loc loc, Identifier *ident); - bool isLvalue() override final; void accept(Visitor *v) override { v->visit(this); } }; @@ -310,7 +294,6 @@ class DsymbolExp final : public Expression d_bool hasOverloads; DsymbolExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -320,8 +303,6 @@ class ThisExp : public Expression VarDeclaration *var; ThisExp *syntaxCopy() override; - Optional toBool() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -335,8 +316,6 @@ class SuperExp final : public ThisExp class NullExp final : public Expression { public: - Optional toBool() override; - StringExp *toStringExp() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -356,9 +335,6 @@ class StringExp final : public Expression static StringExp *create(Loc loc, const void *s, d_size_t len); char32_t getCodeUnit(d_size_t i) const; dinteger_t getIndex(d_size_t i) const; - StringExp *toStringExp() override; - Optional toBool() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } #if IN_LLVM // The D version returns a slice. @@ -421,8 +397,6 @@ class ArrayLiteralExp final : public Expression static ArrayLiteralExp *create(Loc loc, Expressions *elements); ArrayLiteralExp *syntaxCopy() override; Expression *getElement(d_size_t i); - Optional toBool() override; - StringExp *toStringExp() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -437,7 +411,6 @@ class AssocArrayLiteralExp final : public Expression Expression* loweringCtfe; AssocArrayLiteralExp *syntaxCopy() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -500,7 +473,6 @@ class TypeExp final : public Expression { public: TypeExp *syntaxCopy() override; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -510,7 +482,6 @@ class ScopeExp final : public Expression ScopeDsymbol *sds; ScopeExp *syntaxCopy() override; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -520,8 +491,6 @@ class TemplateExp final : public Expression TemplateDeclaration *td; FuncDeclaration *fd; - bool isLvalue() override; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -581,8 +550,6 @@ class SymOffExp final : public SymbolExp public: dinteger_t offset; - Optional toBool() override; - void accept(Visitor *v) override { v->visit(this); } }; @@ -593,7 +560,6 @@ class VarExp final : public SymbolExp public: d_bool delegateWasExtracted; static VarExp *create(Loc loc, Declaration *var, bool hasOverloads = true); - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -605,7 +571,6 @@ class OverExp final : public Expression public: OverloadSet *vars; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -619,7 +584,6 @@ class FuncExp final : public Expression TOK tok; FuncExp *syntaxCopy() override; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -709,7 +673,6 @@ class BinExp : public Expression class BinAssignExp : public BinExp { public: - bool isLvalue() override final; void accept(Visitor *v) override { v->visit(this); } }; @@ -731,6 +694,7 @@ class AssertExp final : public UnaExp { public: Expression *msg; + Expression* loweredFrom; AssertExp *syntaxCopy() override; @@ -762,7 +726,6 @@ class DotTemplateExp final : public UnaExp public: TemplateDeclaration *td; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -772,7 +735,6 @@ class DotVarExp final : public UnaExp Declaration *var; d_bool hasOverloads; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -782,7 +744,6 @@ class DotTemplateInstanceExp final : public UnaExp TemplateInstance *ti; DotTemplateInstanceExp *syntaxCopy() override; - bool checkType() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -854,7 +815,6 @@ class CallExp final : public UnaExp static CallExp *create(Loc loc, FuncDeclaration *fd, Expression *earg1); CallExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -862,15 +822,12 @@ class CallExp final : public UnaExp class AddrExp final : public UnaExp { public: - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } }; class PtrExp final : public UnaExp { public: - bool isLvalue() override; - void accept(Visitor *v) override { v->visit(this); } }; @@ -916,7 +873,6 @@ class CastExp final : public UnaExp Expression* lowering; CastExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -936,7 +892,6 @@ class VectorExp final : public UnaExp class VectorArrayExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -958,8 +913,6 @@ class SliceExp final : public UnaExp public: SliceExp *syntaxCopy() override; - bool isLvalue() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -984,14 +937,12 @@ class IntervalExp final : public Expression class DelegatePtrExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; class DelegateFuncptrExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -1006,7 +957,6 @@ class ArrayExp final : public UnaExp d_bool modifiable; ArrayExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -1025,8 +975,6 @@ class CommaExp final : public BinExp d_bool isGenerated; d_bool allowCommaExp; Expression* originalExp; - bool isLvalue() override; - Optional toBool() override; void accept(Visitor *v) override { v->visit(this); } #if IN_LLVM @@ -1059,7 +1007,6 @@ class IndexExp final : public BinExp d_bool indexIsInBounds; // true if 0 <= e2 && e2 <= e1.length - 1 IndexExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -1092,14 +1039,13 @@ class AssignExp : public BinExp public: MemorySet memset; - bool isLvalue() override final; - void accept(Visitor *v) override { v->visit(this); } }; class ConstructExp final : public AssignExp { public: + Expression *lowering; void accept(Visitor *v) override { v->visit(this); } }; @@ -1339,7 +1285,6 @@ class CondExp final : public BinExp Expression *econd; CondExp *syntaxCopy() override; - bool isLvalue() override; void accept(Visitor *v) override { v->visit(this); } }; diff --git a/dmd/expressionsem.d b/dmd/expressionsem.d index 262d3323511..709d13de43a 100644 --- a/dmd/expressionsem.d +++ b/dmd/expressionsem.d @@ -3,7 +3,7 @@ * * Specification: ($LINK2 https://dlang.org/spec/expression.html, Expressions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/expressionsem.d, _expressionsem.d) @@ -27,9 +27,11 @@ import dmd.canthrow; import dmd.chkformat; import dmd.cond; import dmd.ctorflow; +import dmd.ctfeexpr : isCtfeReferenceValid; import dmd.dscope; import dmd.dsymbol; import dmd.dsymbolsem; +import dmd.templatesem : computeOneMember; import dmd.declaration; import dmd.dclass; import dmd.dcast; @@ -74,10 +76,12 @@ import dmd.root.array; import dmd.root.complex; import dmd.root.ctfloat; import dmd.root.filename; +import dmd.root.optional; import dmd.common.outbuffer; import dmd.rootobject; import dmd.root.string; import dmd.root.utf; +import dmd.root.rmem; import dmd.semantic2; import dmd.semantic3; import dmd.sideeffect; @@ -96,6 +100,822 @@ import dmd.visitor.postorder; enum LOGSEMANTIC = false; +/******************************* + * Merge results of `ctorflow` into `_this`. + * Params: + * _this = scope to merge the results into + * loc = for error messages + * ctorflow = flow results to merge in + */ +void merge(Scope* _this, Loc loc, const ref CtorFlow ctorflow) +{ + if (!mergeCallSuper(_this.ctorflow.callSuper, ctorflow.callSuper)) + error(loc, "one path skips constructor"); + + const fies = ctorflow.fieldinit; + if (!_this.ctorflow.fieldinit.length || !fies.length) + return; + FuncDeclaration f = _this.func; + if (_this.fes) + f = _this.fes.func; + auto ad = f.isMemberDecl(); + assert(ad); + foreach (i, v; ad.fields) + { + bool mustInit = (v.storage_class & STC.nodefaultctor || v.type.needsNested()); + auto fieldInit = &_this.ctorflow.fieldinit[i]; + const fiesCurrent = fies[i]; + if (fieldInit.loc is Loc.init) + fieldInit.loc = fiesCurrent.loc; + if (!mergeFieldInit(_this.ctorflow.fieldinit[i].csx, fiesCurrent.csx) && mustInit) + { + error(loc, "one path skips field `%s`", v.toChars()); + } + } +} + +real_t toImaginary(Expression _this) +{ + if (auto ie = _this.isIntegerExp()) + return CTFloat.zero; + else if (auto re = _this.isRealExp) + return re.type.isReal() ? CTFloat.zero : re.value; + else if (auto ce = _this.isComplexExp()) + return cimagl(ce.value); + + error(_this.loc, "floating point constant expression expected instead of `%s`", _this.toChars()); + return CTFloat.zero; +} + +real_t toReal(Expression _this) +{ + if (auto iexp = _this.isIntegerExp()) + { + // normalize() is necessary until we fix all the paints of 'type' + const ty = iexp.type.toBasetype().ty; + const val = iexp.normalize(ty, iexp.value); + iexp.value = val; + return (ty == Tuns64) + ? real_t(cast(ulong)val) + : real_t(cast(long)val); + } + else if (auto rexp = _this.isRealExp()) + { + return rexp.type.isReal() ? rexp.value : CTFloat.zero; + } + else if (auto cexp = _this.isComplexExp()) + { + return creall(cexp.value); + } + error(_this.loc, "floating point constant expression expected instead of `%s`", _this.toChars()); + return CTFloat.zero; +} + +complex_t toComplex(Expression _this) +{ + if (auto iexp = _this.isIntegerExp()) + { + return complex_t(iexp.toReal()); + } + else if (auto rexp = _this.isRealExp()) + { + return complex_t(rexp.toReal(), rexp.toImaginary()); + } + else if (auto cexp = _this.isComplexExp()) + { + return cexp.value; + } + error(_this.loc, "floating point constant expression expected instead of `%s`", _this.toChars()); + return complex_t(CTFloat.zero); +} + +dinteger_t toInteger(Expression _this) +{ + if (auto iexp = _this.isIntegerExp()) + { + // normalize() is necessary until we fix all the paints of 'type' + return iexp.value = IntegerExp.normalize(iexp.type.toBasetype().ty, iexp.value); + } + else if (auto rexp = _this.isRealExp()) + { + return cast(sinteger_t)rexp.toReal(); + } + + else if (auto cexp = _this.isComplexExp()) + { + return cast(sinteger_t)cexp.toReal(); + } + + // import dmd.hdrgen : EXPtoString; + //printf("Expression %s\n", EXPtoString(op).ptr); + if (!_this.type || !_this.type.isTypeError()) + { + if (auto ide = _this.isIdentifierExp()) + { + if (ide.ident == Id.dollar) + return 0; + } + error(_this.loc, "integer constant expression expected instead of `%s`", _this.toChars()); + } + return 0; +} + +uinteger_t toUInteger(Expression _this) +{ + if (auto rexp = _this.isRealExp()) + { + return cast(uinteger_t)rexp.toReal(); + } + else if (auto cexp = _this.isComplexExp()) + { + return cast(uinteger_t)cexp.toReal(); + } + // import dmd.hdrgen : EXPtoString; + //printf("Expression %s\n", EXPtoString(op).ptr); + return cast(uinteger_t)_this.toInteger(); +} + + +/*************************************************** + * Given an Expression, find the variable it really is. + * + * For example, `a[index]` is really `a`, and `s.f` is really `s`. + * Params: + * e = Expression to look at + * deref = number of dereferences encountered + * Returns: + * variable if there is one, null if not + */ +VarDeclaration expToVariable(Expression e, out int deref) +{ + deref = 0; + while (1) + { + switch (e.op) + { + case EXP.variable: + return e.isVarExp().var.isVarDeclaration(); + + case EXP.dotVariable: + e = e.isDotVarExp().e1; + if (e.type.toBasetype().isTypeClass()) + deref++; + + continue; + + case EXP.index: + { + e = e.isIndexExp().e1; + if (!e.type.toBasetype().isTypeSArray()) + deref++; + + continue; + } + + case EXP.slice: + { + e = e.isSliceExp().e1; + if (!e.type.toBasetype().isTypeSArray()) + deref++; + + continue; + } + + case EXP.super_: + return e.isSuperExp().var.isVarDeclaration(); + case EXP.this_: + return e.isThisExp().var.isVarDeclaration(); + + // Temporaries for rvalues that need destruction + // are of form: (T s = rvalue, s). For these cases + // we can just return var declaration of `s`. However, + // this is intentionally not calling `Expression.extractLast` + // because at this point we cannot infer the var declaration + // of more complex generated comma expressions such as the + // one for the array append hook. + case EXP.comma: + { + if (auto ve = e.isCommaExp().e2.isVarExp()) + return ve.var.isVarDeclaration(); + + return null; + } + default: + return null; + } + } +} + +/** + * Get the called function type from a call expression + * Params: + * ce = function call expression. Must have had semantic analysis done. + * Returns: called function type, or `null` if error / no semantic analysis done + */ +TypeFunction calledFunctionType(CallExp ce) +{ + Type t = ce.e1.type; + if (!t) + return null; + t = t.toBasetype(); + if (auto tf = t.isTypeFunction()) + return tf; + if (auto td = t.isTypeDelegate()) + return td.nextOf().isTypeFunction(); + return null; +} + +/**************************************** + * Expand tuples in-place. + * + * Example: + * When there's a call `f(10, pair: AliasSeq!(20, 30), single: 40)`, the input is: + * `exps = [10, (20, 30), 40]` + * `names = [null, "pair", "single"]` + * The arrays will be modified to: + * `exps = [10, 20, 30, 40]` + * `names = [null, "pair", null, "single"]` + * + * Params: + * exps = array of Expressions + * names = optional array of names corresponding to Expressions + */ +void expandTuples(Expressions* exps, ArgumentLabels* names = null) +{ + //printf("expandTuples()\n"); + if (exps is null) + return; + + if (names) + { + if (exps.length != names.length) + { + printf("exps.length = %d, names.length = %d\n", cast(int) exps.length, cast(int) names.length); + printf("exps = %s, names = %s\n", exps.toChars(), names.toChars()); + if (exps.length > 0) + printf("%s\n", (*exps)[0].loc.toChars()); + assert(0); + } + } + + // At `index`, a tuple of length `length` is expanded. Insert corresponding nulls in `names`. + void expandNames(size_t index, size_t length) + { + if (names) + { + if (length == 0) + { + names.remove(index); + return; + } + foreach (i; 1 .. length) + { + names.insert(index + i, ArgumentLabel(cast(Identifier) null, Loc.init)); + } + } + } + + for (size_t i = 0; i < exps.length; i++) + { + Expression arg = (*exps)[i]; + if (!arg) + continue; + + // Look for tuple with 0 members + if (auto e = arg.isTypeExp()) + { + if (auto tt = e.type.toBasetype().isTypeTuple()) + { + if (!tt.arguments || tt.arguments.length == 0) + { + exps.remove(i); + expandNames(i, 0); + if (i == exps.length) + return; + } + else // Expand a TypeTuple + { + exps.remove(i); + auto texps = new Expressions(tt.arguments.length); + foreach (j, a; *tt.arguments) + (*texps)[j] = new TypeExp(e.loc, a.type); + exps.insert(i, texps); + expandNames(i, texps.length); + } + i--; + continue; + } + } + + // Inline expand all the tuples + while (arg.op == EXP.tuple) + { + TupleExp te = cast(TupleExp)arg; + exps.remove(i); // remove arg + exps.insert(i, te.exps); // replace with tuple contents + expandNames(i, te.exps.length); + if (i == exps.length) + return; // empty tuple, no more arguments + (*exps)[i] = Expression.combine(te.e0, (*exps)[i]); + arg = (*exps)[i]; + } + } +} + +StringExp toStringExp(Expression _this) +{ + static StringExp nullExpToStringExp(NullExp _this) + { + if (_this.type.implicitConvTo(Type.tstring)) + { + auto se = new StringExp(_this.loc, (cast(char*).mem.xcalloc(1, 1))[0 .. 0]); + se.type = Type.tstring; + return se; + } + return null; + } + + static StringExp arrayLiteralToStringExp(ArrayLiteralExp _this) + { + TY telem = _this.type.nextOf().toBasetype().ty; + if (!(telem.isSomeChar || (telem == Tvoid && (!_this.elements || _this.elements.length == 0)))) + return null; + + ubyte sz = 1; + if (telem == Twchar) + sz = 2; + else if (telem == Tdchar) + sz = 4; + + OutBuffer buf; + if (_this.elements) + { + foreach (i; 0 .. _this.elements.length) + { + auto ch = _this[i]; + if (ch.op != EXP.int64) + return null; + if (sz == 1) + buf.writeByte(cast(ubyte)ch.toInteger()); + else if (sz == 2) + buf.writeword(cast(uint)ch.toInteger()); + else + buf.write4(cast(uint)ch.toInteger()); + } + } + char prefix; + if (sz == 1) + { + prefix = 'c'; + buf.writeByte(0); + } + else if (sz == 2) + { + prefix = 'w'; + buf.writeword(0); + } + else + { + prefix = 'd'; + buf.write4(0); + } + + const size_t len = buf.length / sz - 1; + auto se = new StringExp(_this.loc, buf.extractSlice()[0 .. len * sz], len, sz, prefix); + se.sz = sz; + se.type = _this.type; + return se; + } + + switch(_this.op) + { + case EXP.null_: return nullExpToStringExp(_this.isNullExp()); + case EXP.string_: return _this.isStringExp(); + case EXP.arrayLiteral: return arrayLiteralToStringExp(_this.isArrayLiteralExp()); + default: return null; + } +} + +Optional!bool toBool(Expression _this) +{ + static Optional!bool integerToBool(IntegerExp _this) + { + bool r = _this.toInteger() != 0; + return typeof(return)(r); + } + + static Optional!bool arrayLiteralToBool(ArrayLiteralExp _this) + { + size_t dim = _this.elements ? _this.elements.length : 0; + return typeof(return)(dim != 0); + } + + static Optional!bool assocArrayLiteralToBool(AssocArrayLiteralExp _this) + { + size_t dim = _this.keys.length; + return typeof(return)(dim != 0); + } + + static Optional!bool addrToBool(AddrExp _this) + { + if (isCtfeReferenceValid(_this.e1)) + return typeof(return)(true); + return typeof(return)(); + } + + switch(_this.op) + { + case EXP.int64: return integerToBool(_this.isIntegerExp()); + case EXP.float64: return typeof(return)(!!_this.isRealExp().value); + case EXP.complex80: return typeof(return)(!!_this.isComplexExp().value); + // `this` is never null (what about structs?) + case EXP.this_, EXP.super_: return typeof(return)(true); + // null in any type is false + case EXP.null_: return typeof(return)(false); + // Keep the old behaviour for this refactoring + // Should probably match language spec instead and check for length + case EXP.string_: return typeof(return)(true); + case EXP.arrayLiteral: return arrayLiteralToBool(_this.isArrayLiteralExp()); + case EXP.assocArrayLiteral: return assocArrayLiteralToBool(_this.isAssocArrayLiteralExp()); + case EXP.symbolOffset: + { + version (IN_LLVM) + { + import gen.dpragma : LDCPragma; + + // For a weak symbol, we only statically know that it is non-null if the + // offset is non-zero. + auto soe = _this.isSymOffExp(); + if (soe.var.llvmInternal == LDCPragma.LLVMextern_weak && soe.offset == 0) + return typeof(return)(); + } + return typeof(return)(true); + } + case EXP.address: return addrToBool(_this.isAddrExp()); + case EXP.slice: return _this.isSliceExp().e1.toBool(); + case EXP.comma: return _this.isCommaExp().e2.toBool(); + // Statically evaluate this expression to a `bool` if possible + // Returns: an optional that either contains the value or is empty + default: return typeof(return)(); + } +} + +/**************************************** + * Check that the expression `e` has a valid type. + * If not, generates an error "... has no type". + * Params: + * e = Expression to check + * Returns: + * true if the expression has a valid type. + * Note: + * When this function returns false, `checkValue()` should also return true. + */ +bool hasValidType(Expression e) +{ + static bool visitTypeExp(TypeExp e) + { + error(e.loc, "type `%s` is not an expression", e.toChars()); + return false; + } + + static bool visitScopeExp(ScopeExp e) + { + if (e.sds.isPackage()) + { + error(e.loc, "%s `%s` has no type", e.sds.kind(), e.sds.toChars()); + return false; + } + auto ti = e.sds.isTemplateInstance(); + if (!ti) + return true; + //assert(ti.needsTypeInference(sc)); + if (ti.tempdecl && + ti.semantictiargsdone && + ti.semanticRun == PASS.initial) + { + error(e.loc, "partial %s `%s` has no type", e.sds.kind(), e.toChars()); + return false; + } + return true; + } + + static bool visitTemplateExp(TemplateExp e) + { + error(e.loc, "%s `%s` has no type", e.td.kind(), e.toChars()); + return false; + } + + static bool visitFuncExp(FuncExp e) + { + if (e.td) + { + error(e.loc, "template lambda has no type"); + return false; + } + return true; + } + + static bool visitDotTemplateExp(DotTemplateExp e) + { + error(e.loc, "%s `%s` has no type", e.td.kind(), e.toChars()); + return false; + } + + static bool visitDotTemplateInstanceExp(DotTemplateInstanceExp e) + { + // Same logic as ScopeExp.hasValidType() + if (e.ti.tempdecl && + e.ti.semantictiargsdone && + e.ti.semanticRun == PASS.initial) + { + error(e.loc, "partial %s `%s` has no type", e.ti.kind(), e.toChars()); + return false; + } + return true; + } + + switch (e.op) + { + case EXP.type: return visitTypeExp(e.isTypeExp()); + case EXP.scope_: return visitScopeExp(e.isScopeExp()); + case EXP.template_: return visitTemplateExp(e.isTemplateExp()); + case EXP.function_: return visitFuncExp(e.isFuncExp()); + case EXP.dotTemplateDeclaration: return visitDotTemplateExp(e.isDotTemplateExp()); + case EXP.dotTemplateInstance: return visitDotTemplateInstanceExp(e.isDotTemplateInstanceExp()); + + default: return true; + } +} + +void fillTupleExpExps(TupleExp _this, TupleDeclaration tup) +{ + _this.exps.reserve(tup.objects.length); + foreach (o; *tup.objects) + { + if (Dsymbol s = getDsymbol(o)) + { + /* If tuple element represents a symbol, translate to DsymbolExp + * to supply implicit 'this' if needed later. + */ + Expression e = new DsymbolExp(_this.loc, s); + _this.exps.push(e); + } + else if (auto eo = o.isExpression()) + { + auto e = eo.copy(); + e.loc = _this.loc; // https://issues.dlang.org/show_bug.cgi?id=15669 + _this.exps.push(e); + } + else if (auto t = o.isType()) + { + Expression e = new TypeExp(_this.loc, t); + _this.exps.push(e); + } + else + { + error(_this.loc, "`%s` is not an expression", o.toChars()); + } + } +} + +bool isLvalue(Expression _this) +{ + static bool dotVarExpIsLvalue(DotVarExp _this) + { + if (_this.rvalue) + return false; + if (_this.e1.op != EXP.structLiteral) + return true; + auto vd = _this.var.isVarDeclaration(); + return !(vd && vd.isField()); + } + + static bool callExpIsLvalue(CallExp _this) + { + if (_this.rvalue) + return false; + Type tb = _this.e1.type.toBasetype(); + if (tb.ty == Tdelegate || tb.ty == Tpointer) + tb = tb.nextOf(); + auto tf = tb.isTypeFunction(); + if (tf && tf.isRef) + { + if (auto dve = _this.e1.isDotVarExp()) + { + if (dve.var.isCtorDeclaration()) + { + // Allow taking the address of explicit constructor calls, + // but not (__stmp = S(), __stmp).__ctor(). + + auto ve = lastComma(dve.e1).isVarExp(); + if (ve && (ve.var.storage_class & STC.temp) != 0) + return false; + + return isLvalue(dve.e1); + } + } + return true; // function returns a reference + } + return false; + } + + static bool castExpIsLvalue(CastExp _this) + { + //printf("e1.type = %s, to.type = %s\n", e1.type.toChars(), to.toChars()); + if (_this.rvalue || !_this.e1.isLvalue()) + return false; + return (_this.to.ty == Tsarray && (_this.e1.type.ty == Tvector || _this.e1.type.ty == Tsarray)) || + (_this.to.ty == Taarray && _this.e1.type.ty == Taarray) || + _this.e1.type.mutableOf.unSharedOf().equals(_this.to.mutableOf().unSharedOf()); + } + + static bool indexExpIsLvalue(IndexExp _this) + { + if (_this.rvalue) + return false; + auto t1b = _this.e1.type.toBasetype(); + if (t1b.isTypeAArray() || t1b.isTypeSArray() || + (_this.e1.isIndexExp() && t1b != t1b.isTypeDArray())) + { + return _this.e1.isLvalue(); + } + return true; + } + + static bool assignExpIsLvalue(AssignExp _this) + { + // Array-op 'x[] = y[]' should make an rvalue. + // Setting array length 'x.length = v' should make an rvalue. + if (_this.e1.op == EXP.slice || _this.e1.op == EXP.arrayLength) + { + return false; + } + return !_this.rvalue; + } + + bool not_rvalue = _this.rvalue == false; + + if (_this.isBinAssignExp()) + return not_rvalue; + + switch(_this.op) + { + case EXP.overloadSet: return true; + case EXP.identifier, EXP.dollar, EXP.dSymbol, EXP.star: return not_rvalue; + // Class `this` should be an rvalue; struct `this` should be an lvalue. + case EXP.this_, EXP.super_: return not_rvalue && _this.type.toBasetype().ty != Tclass; + /* string literal/slice is rvalue in default, but + * conversion to reference of static array is only allowed. + */ + case EXP.string_, EXP.slice: return not_rvalue && (_this.type && _this.type.toBasetype().ty == Tsarray); + case EXP.question: return not_rvalue && _this.isCondExp().e1.isLvalue() && _this.isCondExp().e2.isLvalue(); + case EXP.array: return !( _this.rvalue || (_this.type && _this.type.toBasetype().ty == Tvoid)); + + case EXP.vectorArray: return not_rvalue && _this.isVectorArrayExp().e1.isLvalue(); + case EXP.delegatePointer: return not_rvalue && _this.isDelegatePtrExp().e1.isLvalue(); + case EXP.delegateFunctionPointer: return not_rvalue && _this.isDelegateFuncptrExp().e1.isLvalue(); + + case EXP.comma: return not_rvalue && _this.isCommaExp().e2.isLvalue(); + case EXP.variable: return !(_this.rvalue || (_this.isVarExp().var.storage_class & (STC.lazy_ | STC.rvalue | STC.manifest))); + case EXP.template_: return _this.isTemplateExp().fd !is null; + + case EXP.dotVariable: return dotVarExpIsLvalue(_this.isDotVarExp()); + case EXP.call: return callExpIsLvalue(_this.isCallExp()); + case EXP.cast_: return castExpIsLvalue(_this.isCastExp()); + case EXP.index: return indexExpIsLvalue(_this.isIndexExp()); + case EXP.assign, EXP.loweredAssignExp, EXP.construct, EXP.blit: return assignExpIsLvalue(cast(AssignExp) _this); + default: return false; + } +} + +/*********************************************************** + * Determine if copy elision is allowed when copying an expression to + * a typed storage. This basically elides a restricted subset of so-called + * "pure" rvalues, i.e. expressions with no reference semantics. + * + * Note: Please avoid using `checkMod` parameter because `canElideCopy()` + * essentially defines a value category and should eventually be merged with + * `isLvalue()` to return [isLvalue, allowEmplacement]. + * Checking type compatibility here is only a stopgap measure. + */ +bool canElideCopy(Expression e, Type to, bool checkMod = false) +{ + if (checkMod && !MODimplicitConv(e.type.mod, to.mod)) + return false; + + static bool visitCallExp(CallExp e) + { + if (auto dve = e.e1.isDotVarExp()) + { + if (dve.var.isCtorDeclaration()) + { + // Allow (__stmp = S(), __stmp).__ctor() to be elided, + // but force a copy for (s2 = s1.__ctor()). + + auto ve = lastComma(dve.e1).isVarExp(); + if (ve && (ve.var.storage_class & STC.temp) != 0) + return true; + + return canElideCopy(dve.e1, e.type); + } + } + + auto tb = e.e1.type.toBasetype(); + if (tb.ty == Tdelegate || tb.ty == Tpointer) + tb = tb.nextOf(); + auto tf = tb.isTypeFunction(); + return tf && !tf.isRef; + } + + static bool visitDotVarExp(DotVarExp e) + { + auto vd = e.var.isVarDeclaration(); + if (!vd || !vd.isField()) + return false; + + auto sd = vd.type.isTypeStruct(); + if (!sd || sd.needsCopyOrPostblit() || sd.sym.hasMoveCtor) + return false; + + // If an aggregate can be elided, so are its fields + return canElideCopy(e.e1, e.e1.type); + } + + switch (e.op) + { + case EXP.comma: + auto ce = e.isCommaExp(); + return canElideCopy(ce.e2, to, checkMod); + case EXP.question: + auto ce = e.isCondExp(); + return canElideCopy(ce.e1, to, checkMod) && canElideCopy(ce.e2, to, checkMod); + + case EXP.call: + return visitCallExp(e.isCallExp()); + case EXP.dotVariable: + return visitDotVarExp(e.isDotVarExp()); + case EXP.structLiteral: + return true; + case EXP.variable: + return (e.isVarExp().var.storage_class & STC.rvalue) != 0; + default: + return false; + } +} + +// Return index of the field, or -1 if not found +int getFieldIndex(ClassReferenceExp _this, Type fieldtype, uint fieldoffset) +{ + ClassDeclaration cd = _this.originalClass(); + uint fieldsSoFar = 0; + for (size_t j = 0; j < _this.value.elements.length; j++) + { + while (j - fieldsSoFar >= cd.fields.length) + { + fieldsSoFar += cd.fields.length; + cd = cd.baseClass; + } + VarDeclaration v2 = cd.fields[j - fieldsSoFar]; + if (fieldoffset == v2.offset && fieldtype.size() == v2.type.size()) + { + return cast(int)( _this.value.elements.length - fieldsSoFar - cd.fields.length + (j - fieldsSoFar)); + } + } + return -1; +} + +/************************************ + * Get index of field. + * Returns -1 if not found. + */ +int getFieldIndex(StructLiteralExp _this, Type type, uint offset) +{ + /* Find which field offset is by looking at the field offsets + */ + if (!_this.elements.length) + return -1; + + const sz = type.size(); + if (sz == SIZE_INVALID) + return -1; + foreach (i, v; _this.sd.fields) + { + if (offset != v.offset) + continue; + if (sz != v.type.size()) + continue; + /* context fields might not be filled. */ + if (i >= _this.sd.nonHiddenFields()) + return cast(int)i; + if (auto e = (*_this.elements)[i]) + { + return cast(int)i; + } + return -1; + } + assert(0); +} + bool equals(const Expression _this, const Expression e) { static bool intExpEquals(const IntegerExp _this, const IntegerExp e) @@ -423,6 +1243,7 @@ bool hasRegularCtor(StructDeclaration sd, bool ignoreDisabled) { if (auto td = s.isTemplateDeclaration()) { + td.computeOneMember(); if (ignoreDisabled && td.onemember) { if (auto ctorDecl = td.onemember.isCtorDeclaration()) @@ -447,6 +1268,42 @@ bool hasRegularCtor(StructDeclaration sd, bool ignoreDisabled) return result; } +/// Returns: whether `s` is a method which can possibly be called without a struct instance. +/// Used to check whether S() should try to call `S.opCall()` rather than construct a struct literal +bool hasStaticOverload(Dsymbol s) +{ + bool result = false; + overloadApply(s, (Dsymbol sym) { + if (auto fd = sym.isFuncDeclaration()) + { + if (fd.isStatic) + { + result = true; + return 1; + } + } + else if (auto td = sym.isTemplateDeclaration()) + { + // Consider both `template opCall { static opCall() {} }` and `static opCall()() {}` + if (td._scope.stc & STC.static_) + { + result = true; + return 1; + } + if (auto fd = td.onemember.isFuncDeclaration()) + { + if (fd.isStatic) + { + result = true; + return 1; + } + } + } + return 0; + }); + return result; +} + /***************************************** * Determine if `this` is available by walking up the enclosing * scopes until a function is found. @@ -652,6 +1509,10 @@ extern (D) Expression incompatibleTypes(BinExp e, Scope* sc = null) error(e.loc, "incompatible types for `(%s) %s (%s)`: `%s` and `%s`", e.e1.toErrMsg(), thisOp, e.e2.toErrMsg(), ts[0], ts[1]); } + + if (sc && sc.tinst) + sc.tinst.printInstantiationTrace(); + return ErrorExp.get(); } @@ -1106,7 +1967,7 @@ extern (D) Expression doCopyOrMove(Scope* sc, Expression e, Type t, bool nrvo, b { e = callCpCtor(sc, e, t, nrvo); } - else if (move && sd && sd.hasMoveCtor && !e.isCallExp() && !e.isStructLiteralExp()) + else if (move && sd && sd.hasMoveCtor && !canElideCopy(e, t ? t : e.type)) { // #move /* Rewrite as: @@ -1117,7 +1978,7 @@ extern (D) Expression doCopyOrMove(Scope* sc, Expression e, Type t, bool nrvo, b VarDeclaration vd = new VarDeclaration(e.loc, e.type, Identifier.generateId("__copyrvalue"), null); if (nrvo) vd.nrvo = true; - vd.storage_class |= STC.nodtor; + vd.storage_class |= STC.temp | STC.rvalue | STC.nodtor; vd.dsymbolSemantic(sc); Expression de = new DeclarationExp(e.loc, vd); Expression ve = new VarExp(e.loc, vd); @@ -1253,19 +2114,38 @@ Returns: Expression checkNoreturnVarAccess(Expression exp) { - assert(exp.type); + assert(exp); - Expression result = exp; - if (exp.type.isTypeNoreturn() && !exp.isAssertExp() && - !exp.isThrowExp() && !exp.isCallExp()) + switch (exp.op) { + case EXP.assert_: + case EXP.throw_: + case EXP.call: + return exp; + + case EXP.question: + CondExp ce = cast(CondExp)exp; + ce.e1 = checkNoreturnVarAccess(ce.e1); + ce.e2 = checkNoreturnVarAccess(ce.e2); + return ce; + + case EXP.comma: + CommaExp ce = cast(CommaExp)exp; + ce.e1 = checkNoreturnVarAccess(ce.e1); + ce.e2 = checkNoreturnVarAccess(ce.e2); + return ce; + + default: + if (!exp.type || !exp.type.isTypeNoreturn()) + return exp; + auto msg = new StringExp(exp.loc, "Accessed expression of type `noreturn`"); msg.type = Type.tstring; - result = new AssertExp(exp.loc, IntegerExp.literal!0, msg); - result.type = exp.type; + auto ae = new AssertExp(exp.loc, IntegerExp.literal!0, msg); + ae.loweredFrom = exp; + ae.type = exp.type; + return ae; } - - return result; } /****************************** @@ -1723,41 +2603,19 @@ Expression resolvePropertiesOnly(Scope* sc, Expression e1) { //printf("e1 = %s %s\n", Token.toChars(e1.op), e1.toChars()); - Expression handleOverloadSet(OverloadSet os) - { - assert(os); - foreach (s; os.a) - { - auto fd = s.isFuncDeclaration(); - auto td = s.isTemplateDeclaration(); - if (fd) - { - if (fd.type.isTypeFunction().isProperty) - return resolveProperties(sc, e1); - } - else if (td && td.onemember && (fd = td.onemember.isFuncDeclaration()) !is null) - { - if (fd.type.isTypeFunction().isProperty || - (fd.storage_class2 & STC.property) || - (td._scope.stc & STC.property)) - return resolveProperties(sc, e1); - } - } - return e1; - } - Expression handleTemplateDecl(TemplateDeclaration td) { assert(td); - if (td.onemember) + td.computeOneMember(); + if (!td.onemember) + return e1; + + if (auto fd = td.onemember.isFuncDeclaration()) { - if (auto fd = td.onemember.isFuncDeclaration()) - { - if (fd.type.isTypeFunction().isProperty || - (fd.storage_class2 & STC.property) || - (td._scope.stc & STC.property)) - return resolveProperties(sc, e1); - } + if (fd.type.isTypeFunction().isProperty || + (fd.storage_class2 & STC.property) || + (td._scope.stc & STC.property)) + return resolveProperties(sc, e1); } return e1; } @@ -1770,6 +2628,20 @@ Expression resolvePropertiesOnly(Scope* sc, Expression e1) return e1; } + Expression handleOverloadSet(OverloadSet os) + { + assert(os); + foreach (s; os.a) + { + if (auto fd = s.isFuncDeclaration()) + return handleFuncDecl(fd); + + if (auto td = s.isTemplateDeclaration()) + return handleTemplateDecl(td); + } + return e1; + } + if (auto de = e1.isDotExp()) { if (auto os = de.e2.isOverExp()) @@ -1997,7 +2869,10 @@ Lagain: if (tup.needThis() && hasThis(sc)) e = new DotVarExp(loc, new ThisExp(loc), tup); else + { e = new TupleExp(loc, tup); + fillTupleExpExps(e.isTupleExp(), tup); + } e = e.expressionSemantic(sc); return e; } @@ -2358,6 +3233,12 @@ public void errorSupplementalInferredAttr(FuncDeclaration fd, int maxDepth, bool if (s.action.length > 0) { errorFunc(s.loc, "and %.*s makes it fail to infer `%.*s`", s.action.fTuple.expand, attr.fTuple.expand); + // For scope violations, also print why the target parameter is not scope + if (s.scopeVar) + { + import dmd.escape : printScopeReason; + printScopeReason(errorFunc, s.scopeVar, 10, false); + } } else if (s.fd) { @@ -2503,12 +3384,18 @@ private bool checkImpure(Scope* sc, Loc loc, const(char)* fmt, RootObject arg0) /********************************************* * Calling function f. - * Check the safety, i.e. if we're in a @safe function + * Check the safety, i.e. if we are in a @safe function * we can only call @safe or @trusted functions. - * Returns true if error occurs. + * Params: + * f = function being called + * loc = location for error messages + * sc = context + * arguments = array of actual arguments to function call, null for none + * Returns: true if unsafe (and diagnostic is generated) */ -private bool checkSafety(FuncDeclaration f, ref Loc loc, Scope* sc) +private bool checkSafety(FuncDeclaration f, ref Loc loc, Scope* sc, Expressions* arguments) { + //printf("checkSafety() %s\n", f.toChars()); if (sc.func == f) return false; if (sc.intypeof == 1) @@ -2537,6 +3424,33 @@ private bool checkSafety(FuncDeclaration f, ref Loc loc, Scope* sc) return false; } + if (f.printf && (f.isSafe() || f.isTrusted())) + { + TypeFunction tf = f.type.isTypeFunction(); + assert(tf); + const isVa_list = tf.parameterList.varargs == VarArg.none; + const nparams = tf.parameterList.length; + const nargs = arguments ? arguments.length : 0; + assert(nparams && nargs); // should have been verified already + if (auto se = (*arguments)[nparams - 1 - isVa_list].isStringExp()) + { + if (!isFormatSafe(se.peekString())) + { + if (sc.setUnsafe(false, loc, + "calling `pragma(printf)` function `%s` with format string `%s`", f, se)) + .errorSupplemental(f.loc, "`%s` is declared here", f.toPrettyChars()); + return true; + } + } + else + { + if (sc.setUnsafe(false, loc, + "calling `pragma(printf)` function `%s` with non-literal format string", f)) + .errorSupplemental(f.loc, "`%s` is declared here", f.toPrettyChars()); + return true; + } + } + if (!f.isSafe() && !f.isTrusted()) { if (isRootTraitsCompilesScope(sc) ? sc.func.isSafeBypassingInference() : sc.func.setUnsafeCall(f)) @@ -2660,7 +3574,7 @@ private bool checkPostblit(Type t, ref Loc loc, Scope* sc) //checkAccess(sd, loc, sc, sd.postblit); // necessary? bool result = false; result |= sd.postblit.checkPurity(loc, sc); - result |= sd.postblit.checkSafety(loc, sc); + result |= sd.postblit.checkSafety(loc, sc, null); result |= sd.postblit.checkNogc(loc, sc); return result; } @@ -3235,7 +4149,7 @@ private bool checkDefCtor(Loc loc, Type t) */ private bool functionParameters(Loc loc, Scope* sc, TypeFunction tf, Expression ethis, Type tthis, ArgumentList argumentList, FuncDeclaration fd, - Type* prettype, Expression* peprefix) + out Type prettype, out Expression peprefix) { Expressions* arguments = argumentList.arguments; //printf("functionParameters() fd: %s tf: %s\n", fd ? fd.ident.toChars() : "", toChars(tf)); @@ -3245,7 +4159,6 @@ private bool functionParameters(Loc loc, Scope* sc, const olderrors = global.errors; bool err = false; Expression eprefix = null; - *peprefix = null; if (argumentList.names) { @@ -3308,7 +4221,7 @@ private bool functionParameters(Loc loc, Scope* sc, * Start with the `this` argument, later on merge into wildmatch the mod bits of the rest * of the arguments. */ - MOD wildmatch = (tthis && !isCtorCall) ? tthis.Type.deduceWild(tf, false) : 0; + MOD wildmatch = (tthis && !isCtorCall) ? tthis.typeDeduceWild(tf, false) : 0; bool done = false; foreach (const i; 0 .. n) @@ -3353,6 +4266,10 @@ private bool functionParameters(Loc loc, Scope* sc, arg = arg.resolveLoc(loc, sc); (*arguments)[i] = arg; } + else if (!(p.storageClass & (STC.ref_ | STC.out_))) + { + (*arguments)[i] = checkNoreturnVarAccess(arg); + } if (tf.parameterList.varargs == VarArg.typesafe && i + 1 == nparams) // https://dlang.org/spec/function.html#variadic { @@ -4036,8 +4953,8 @@ private bool functionParameters(Loc loc, Scope* sc, tret = tret.substWildTo(wildmatch); } - *prettype = tret; - *peprefix = eprefix; + prettype = tret; + peprefix = eprefix; return (err || olderrors != global.errors); } @@ -4095,7 +5012,7 @@ private void lowerCastExp(CastExp cex, Scope* sc) int offset; if ((cdto.isBaseOf(cdfrom, &offset) && offset != ClassDeclaration.OFFSET_RUNTIME) - || cdfrom.classKind == ClassKind.cpp) + || cdfrom.classKind == ClassKind.cpp || cdto.classKind == ClassKind.cpp) return; Identifier hook = Id._d_cast; @@ -4445,6 +5362,17 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor setError(); } + // `e` calls opAssign, opOpAssign, opUnary!++, opUnary!-- when lowered from an assignment + private void setOpOverloadAssign(Expression e) + { + result = e; + auto ce = e.isCallExp(); + // rvalue error in discardValue from 2024 edition + if (!ce || !sc.hasEdition(Edition.v2024)) + return; + ce.fromOpAssignment = true; + } + /************************** * Semantically analyze Expression. * Determine types, fold constants, etc. @@ -4477,37 +5405,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor { if (!e.type) e.type = Type.tfloat64; - else if (!e.type.isImaginary || !sc.inCfile) - { - e.type = e.type.typeSemantic(e.loc, sc); - result = e; - return; - } - - /* Convert to core.stdc.config.complex - */ - Type t = getComplexLibraryType(e.loc, sc, e.type.ty); - if (t.ty == Terror) - return setError(); - - Type tf; - switch (e.type.ty) - { - case Timaginary32: tf = Type.tfloat32; break; - case Timaginary64: tf = Type.tfloat64; break; - case Timaginary80: tf = Type.tfloat80; break; - default: - assert(0); - } - /* Construct ts{re : 0.0, im : e} - */ - TypeStruct ts = t.isTypeStruct; - Expressions* elements = new Expressions(2); - (*elements)[0] = new RealExp(e.loc, CTFloat.zero, tf); - (*elements)[1] = new RealExp(e.loc, e.toImaginary(), tf); - Expression sle = new StructLiteralExp(e.loc, ts.sym, elements); - result = sle.expressionSemantic(sc); + e.type = e.type.typeSemantic(e.loc, sc); + result = e; + return; } override void visit(ComplexExp e) @@ -4737,7 +5638,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor error(exp.loc, "`%s` is not defined, perhaps `import %.*s;` is needed?", exp.ident.toChars(), cast(int)n.length, n.ptr); else if (auto s2 = sc.search_correct(exp.ident)) error(exp.loc, "undefined identifier `%s`, did you mean %s `%s`?", exp.ident.toChars(), s2.kind(), s2.toChars()); - else if (const p = Scope.search_correct_C(exp.ident)) + else if (const p = search_correct_C(exp.ident)) error(exp.loc, "undefined identifier `%s`, did you mean `%s`?", exp.ident.toChars(), p); else if (exp.ident == Id.dollar) error(exp.loc, "undefined identifier `$`"); @@ -4969,8 +5870,10 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor { arguments.push(makeTemplateItem(Id.InterpolatedExpression, str)); Expressions* mix = new Expressions(new StringExp(e.loc, str)); - // FIXME: i'd rather not use MixinExp but idk how to do it lol - arguments.push(new MixinExp(e.loc, mix)); + auto mixinExp = new MixinExp(e.loc, mix); + auto res = mixinExp.expressionSemantic(sc); + res = resolveProperties(sc, res); + arguments.push(res); } } @@ -5616,13 +6519,18 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor error(p.loc, "PlacementExpression `%s` is an rvalue, but must be an lvalue", p.toChars()); return setError(); } - if (sc.setUnsafe(false, p.loc, "`@safe` function `%s` cannot use placement `new`", sc.func)) + if (sc.setUnsafe(false, p.loc, "placement `new`", sc.func)) + { + return setError(); + } + if (!p.type.isNaked) { + error(p.loc, "PlacementExpression `%s` of type `%s` must be unshared and mutable", p.toChars(), toChars(p.type)); return setError(); } - if (!exp.placement.type.isNaked) + if (p.type.ty == Tarray) { - error(p.loc, "PlacementExpression `%s` of type `%s` be unshared and mutable", p.toChars(), toChars(p.type)); + error(p.loc, "PlacementExpression cannot be a dynamic array"); return setError(); } checkModifiable(exp.placement, sc); @@ -5895,7 +6803,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor TypeFunction tf = f.type.isTypeFunction(); if (!exp.arguments) exp.arguments = new Expressions(); - if (functionParameters(exp.loc, sc, tf, null, exp.type, exp.argumentList, f, &exp.type, &exp.argprefix)) + if (functionParameters(exp.loc, sc, tf, null, exp.type, exp.argumentList, f, exp.type, exp.argprefix)) return setError(); exp.member = f.isCtorDeclaration(); @@ -6011,7 +6919,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor TypeFunction tf = f.type.isTypeFunction(); if (!exp.arguments) exp.arguments = new Expressions(); - if (functionParameters(exp.loc, sc, tf, null, exp.type, exp.argumentList, f, &exp.type, &exp.argprefix)) + if (functionParameters(exp.loc, sc, tf, null, exp.type, exp.argumentList, f, exp.type, exp.argprefix)) return setError(); exp.member = f.isCtorDeclaration(); @@ -6463,7 +7371,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor //printf("td = %p, treq = %p\n", td, fd.treq); if (exp.td) { - assert(exp.td.parameters && exp.td.parameters.length); + assert(exp.td.parameters); exp.td.dsymbolSemantic(sc); exp.type = Type.tvoid; // temporary type @@ -6981,8 +7889,13 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor return; } // No constructor, look for overload of opCall - if (search_function(sd, Id.opCall)) - goto L1; + if (auto sym = search_function(sd, Id.opCall)) + { + // Don't consider opCall on a type with no instance + // if there's no static overload for it + if (!exp.e1.isTypeExp() || hasStaticOverload(sym)) + goto L1; + } // overload of opCall, therefore it's a call if (exp.e1.op != EXP.type) { @@ -7443,7 +8356,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor return setError(); } - void errorHelper(const(char)* failMessage) scope + void errorHelper(const(char)* failMessage, Loc argloc) scope { OutBuffer buf; buf.writeByte('('); @@ -7456,7 +8369,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor .error(exp.loc, "%s `%s` is not callable using argument types `%s`", p, exp.e1.toErrMsg(), buf.peekChars()); if (failMessage) - errorSupplemental(exp.loc, "%s", failMessage); + errorSupplemental((argloc !is Loc.initial) ? argloc : exp.loc, "%s", failMessage); } if (callMatch(exp.f, tf, null, exp.argumentList, 0, &errorHelper, sc) == MATCH.nomatch) @@ -7466,7 +8379,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (exp.f) { exp.f.checkPurity(exp.loc, sc); - exp.f.checkSafety(exp.loc, sc); + exp.f.checkSafety(exp.loc, sc, exp.arguments); exp.f.checkNogc(exp.loc, sc); if (exp.f.checkNestedFuncReference(sc, exp.loc)) return setError(); @@ -7519,7 +8432,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor exp.f = exp.f.toAliasFunc(); TypeFunction tf = cast(TypeFunction)exp.f.type; - void errorHelper2(const(char)* failMessage) scope + void errorHelper2(const(char)* failMessage, Loc argloc) scope { OutBuffer buf; buf.writeByte('('); @@ -7537,7 +8450,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor .error(exp.loc, "%s `%s` is not callable using argument types `%s`", exp.f.kind(), exp.f.toErrMsg(), buf.peekChars()); if (failMessage) - errorSupplemental(exp.loc, "%s", failMessage); + errorSupplemental((argloc !is Loc.initial) ? argloc : exp.loc, "%s", failMessage); .errorSupplemental(exp.f.loc, "`%s%s` declared here", exp.f.toPrettyChars(), parametersTypeToChars(tf.parameterList)); exp.f = null; } @@ -7604,7 +8517,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor Expression argprefix; if (!exp.arguments) exp.arguments = new Expressions(); - if (functionParameters(exp.loc, sc, cast(TypeFunction)t1, ethis, tthis, exp.argumentList, exp.f, &exp.type, &argprefix)) + if (functionParameters(exp.loc, sc, cast(TypeFunction)t1, ethis, tthis, exp.argumentList, exp.f, exp.type, argprefix)) return setError(); if (!exp.type) @@ -7897,9 +8810,13 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor if (ea) { if (auto sym = getDsymbol(ea)) + { ea = symbolToExp(sym, exp.loc, sc, false); + ea = checkNoreturnVarAccess(ea); + } else ea = ea.expressionSemantic(sc); + ea = resolveProperties(sc, ea); ta = ea.type; if (ea.op == EXP.type) @@ -8332,10 +9249,7 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor { if (Expression e = exp.opOverloadBinaryAssign(sc, aliasThisStop)) - { - result = e; - return; - } + return setOpOverloadAssign(e); Expression e; if (exp.e1.op == EXP.arrayLength) @@ -9774,7 +10688,7 @@ version (IN_LLVM) { err |= !functionSemantic(cd.dtor); err |= cd.dtor.checkPurity(exp.loc, sc); - err |= cd.dtor.checkSafety(exp.loc, sc); + err |= cd.dtor.checkSafety(exp.loc, sc, null); err |= cd.dtor.checkNogc(exp.loc, sc); } if (err) @@ -9866,7 +10780,7 @@ version (IN_LLVM) result = e1x; return; } - if (e1x.checkType()) + if (!e1x.hasValidType()) return setError(); exp.e1 = e1x; @@ -10982,10 +11896,7 @@ version (IN_LLVM) // printf("PreExp::semantic('%s')\n", toChars()); if (Expression e = exp.opOverloadUnary(sc)) - { - result = e; - return; - } + return setOpOverloadAssign(e); // Rewrite as e1+=1 or e1-=1 Expression e; @@ -11274,10 +12185,13 @@ version (IN_LLVM) e2x.checkSharedAccess(sc)) return setError(); - auto etmp = checkNoreturnVarAccess(e2x); - if (etmp != e2x) - return setResult(etmp); - + // taking address of noreturn instance is OK + if (!(exp.e1.isVarExp() && exp.e1.isVarExp().var.storage_class & STC.ref_)) + { + auto etmp = checkNoreturnVarAccess(e2x); + if (etmp != e2x) + return setResult(etmp); + } exp.e2 = e2x; } @@ -11561,7 +12475,7 @@ version (IN_LLVM) } /* Rewrite as: - * (e1 = e2).postblit(); + * (e1 = e2).postblit(), e1; * * Blit assignment e1 = e2 returns a reference to the original e1, * then call the postblit on it. @@ -11573,6 +12487,7 @@ version (IN_LLVM) e = new BlitExp(exp.loc, e, e2x); e = new DotVarExp(exp.loc, e, sd.postblit, false); e = new CallExp(exp.loc, e); + e = new CommaExp(exp.loc, e, e1x); result = e.expressionSemantic(sc); return; } @@ -11722,10 +12637,7 @@ version (IN_LLVM) else if (exp.op == EXP.assign) { if (Expression e = exp.isAssignExp().opOverloadAssign(sc, aliasThisStop)) - { - result = e; - return; - } + return setOpOverloadAssign(e); } else assert(exp.op == EXP.blit); @@ -11742,10 +12654,7 @@ version (IN_LLVM) if (exp.op == EXP.assign && !exp.e2.implicitConvTo(exp.e1.type)) { if (Expression e = exp.isAssignExp().opOverloadAssign(sc, aliasThisStop)) - { - result = e; - return; - } + return setOpOverloadAssign(e); } if (exp.e2.checkValue()) return setError(); @@ -12279,16 +13188,16 @@ version (IN_LLVM) return setError(); // Lower to object._d_array{,set}ctor(e1, e2) - Expression id = new IdentifierExp(exp.loc, Id.empty); - id = new DotIdExp(exp.loc, id, Id.object); - id = new DotIdExp(exp.loc, id, func); + Expression lowering = new IdentifierExp(ae.loc, Id.empty); + lowering = new DotIdExp(ae.loc, lowering, Id.object); + lowering = new DotIdExp(ae.loc, lowering, func); auto arguments = new Expressions(new CastExp(ae.loc, ae.e1, t1e.arrayOf).expressionSemantic(sc)); if (lowerToArrayCtor) { arguments.push(new CastExp(ae.loc, rhs, t2b.nextOf.arrayOf).expressionSemantic(sc)); - Expression ce = new CallExp(exp.loc, id, arguments); - res = ce.expressionSemantic(sc); + lowering = new CallExp(ae.loc, lowering, arguments); + lowering = lowering.expressionSemantic(sc); } else { @@ -12303,12 +13212,14 @@ version (IN_LLVM) else arguments.push(ae.e2); - Expression ce = new CallExp(exp.loc, id, arguments); - res = Expression.combine(e0, ce).expressionSemantic(sc); + lowering = new CallExp(ae.loc, lowering, arguments); + lowering = Expression.combine(e0, lowering).expressionSemantic(sc); } + ae.lowering = lowering; + if (global.params.v.verbose) - message("lowered %s =>\n %s", exp.toChars(), res.toChars()); + message("lowered %s =>\n %s", exp.toChars(), lowering.toChars()); } } else if (auto ae = res.isAssignExp()) @@ -12408,10 +13319,7 @@ version (IN_LLVM) override void visit(PowAssignExp exp) { if (Expression e = exp.opOverloadBinaryAssign(sc, aliasThisStop)) - { - result = e; - return; - } + return setOpOverloadAssign(e); if (exp.suggestOpOpAssign(sc, parent) || exp.e1.checkReadModifyWrite(exp.op, exp.e2)) @@ -12485,13 +13393,9 @@ version (IN_LLVM) override void visit(CatAssignExp exp) { - //printf("CatAssignExp::semantic() %s\n", exp.toChars()); if (Expression e = exp.opOverloadBinaryAssign(sc, aliasThisStop)) - { - result = e; - return; - } + return setOpOverloadAssign(e); if (exp.suggestOpOpAssign(sc, parent)) return setError(); @@ -14412,15 +15316,23 @@ version (IN_LLVM) rewriteCNull(exp.e2, t2); } - if (t1.ty == Tnoreturn) + if (t1 == t2) + { + exp.type = t1; + } + // If only one of the operands is noreturn, cast it to the type of + // the other operand. + else if (t1.ty == Tnoreturn) { exp.type = t2; - exp.e1 = specialNoreturnCast(exp.e1, exp.type); + if (t2.ty != Tnoreturn) + exp.e1 = specialNoreturnCast(exp.e1, exp.type); } else if (t2.ty == Tnoreturn) { exp.type = t1; - exp.e2 = specialNoreturnCast(exp.e2, exp.type); + if (t1.ty != Tnoreturn) + exp.e2 = specialNoreturnCast(exp.e2, exp.type); } // If either operand is void the result is void, we have to cast both // the expression to void so that we explicitly discard the expression @@ -14432,8 +15344,6 @@ version (IN_LLVM) exp.e1 = exp.e1.castTo(sc, exp.type); exp.e2 = exp.e2.castTo(sc, exp.type); } - else if (t1 == t2) - exp.type = t1; else { if (Expression ex = typeCombine(exp, sc)) @@ -15111,6 +16021,7 @@ Expression dotIdSemanticProp(DotIdExp exp, Scope* sc, bool gag) return e; } Expression e = new TupleExp(exp.loc, tup); + fillTupleExpExps(e.isTupleExp(), tup); e = e.expressionSemantic(sc); return e; } @@ -15165,7 +16076,10 @@ Expression dotIdSemanticProp(DotIdExp exp, Scope* sc, bool gag) if (s.isPackage()) error(exp.loc, "undefined identifier `%s` in %s `%s`, perhaps add `static import %s;`", exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars(), s.toPrettyChars()); else + { error(exp.loc, "undefined identifier `%s` in %s `%s`, did you mean %s `%s`?", exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars(), s.kind(), s.toChars()); + errorSupplemental(s.loc, "`%s` located here", s.toPrettyChars(true)); + } } else error(exp.loc, "undefined identifier `%s` in %s `%s`", exp.ident.toChars(), ie.sds.kind(), ie.sds.toPrettyChars()); @@ -15426,6 +16340,8 @@ Expression dotTemplateSemanticProp(DotTemplateInstanceExp exp, Scope* sc, bool g MATCH matchType(FuncExp funcExp, Type to, Scope* sc, FuncExp* presult, ErrorSink eSink) { + import dmd.typesem : merge; + auto loc = funcExp.loc; auto tok = funcExp.tok; auto td = funcExp.td; @@ -15806,6 +16722,8 @@ bool checkValue(Expression e) */ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false) { + Expression root = e; + if (!sc || !sc.previews.noSharedAccess || sc.intypeof || @@ -15861,7 +16779,14 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false) if (e.placement) check(e.placement, false); if (e.thisexp) - check(e.thisexp, false); + { + // In a shared constructor, accessing the current + // `this` is safe for nested allocation. + // See test_nosharedaccess_ctor_nested_new.d + if (!(sc.func && sc.func.isCtorDeclaration() && sc.func.type.isShared() && + e.thisexp.isThisExp())) + check(e.thisexp, false); + } return false; } @@ -15976,6 +16901,12 @@ bool checkSharedAccess(Expression e, Scope* sc, bool returnRef = false) case EXP.star: return visitPtr(e.isPtrExp()); case EXP.dotVariable: return visitDotVar(e.isDotVarExp()); case EXP.index: return visitIndex(e.isIndexExp()); + case EXP.structLiteral: + // Allow constructing a shared struct literal as a value, + // but keep rejecting later accesses through that temporary. + if (e is root && e.type && e.type.isShared()) + return false; + return visit(e); } } @@ -16463,7 +17394,7 @@ Expression toLvalue(Expression _this, Scope* sc, const(char)* action, Expression } if (!_this.isLvalue()) return visit(_this); - if (e1.op == EXP.this_ && sc.ctorflow.fieldinit.length && !(sc.ctorflow.callSuper & CSX.any_ctor)) + if (e1.op == EXP.this_ && sc && sc.ctorflow.fieldinit.length && !(sc.ctorflow.callSuper & CSX.any_ctor)) { if (VarDeclaration vd = var.isVarDeclaration()) { @@ -16952,7 +17883,7 @@ private bool checkAddressVar(Scope* sc, Expression exp, VarDeclaration v) "taking the address of local variable `%s`" : "taking the address of stack-allocated local variable `%s`"; if (sc.useDIP1000 != FeatureState.enabled && - !(v.storage_class & STC.temp) && + (!(v.storage_class & STC.temp) || v.storage_class & STC.result) && sc.setUnsafe(false, exp.loc, msg.ptr, v)) { return false; @@ -17030,7 +17961,7 @@ bool checkAddressable(Expression e, Scope* sc, const(char)* action) * and usage of `deprecated` and `@disabled`-ed symbols are checked. * * Params: - * exp = expression to check attributes for + * exp = expression to check attributes for (CallExp or NewExp) * sc = scope of the function * f = function to be checked * Returns: `true` if error occur. @@ -17040,7 +17971,8 @@ private bool checkFunctionAttributes(Expression exp, Scope* sc, FuncDeclaration bool error = f.checkDisabled(exp.loc, sc); error |= f.checkDeprecated(exp.loc, sc); error |= f.checkPurity(exp.loc, sc); - error |= f.checkSafety(exp.loc, sc); + Expressions* arguments = exp.isCallExp() ? exp.isCallExp().arguments : null; + error |= f.checkSafety(exp.loc, sc, arguments); error |= f.checkNogc(exp.loc, sc); return error; } @@ -17156,7 +18088,7 @@ private VarDeclaration makeThis2Argument(Loc loc, Scope* sc, FuncDeclaration fd) bool verifyHookExist(Loc loc, ref Scope sc, Identifier id, string description, Identifier module_ = Id.object) { Dsymbol pscopesym; - auto rootSymbol = sc.search(loc, Id.empty, pscopesym); + auto rootSymbol = search(&sc, loc, Id.empty, pscopesym); if (auto moduleSymbol = rootSymbol.search(loc, module_)) if (moduleSymbol.search(loc, id)) return true; @@ -17259,11 +18191,17 @@ private bool fit(StructDeclaration sd, Loc loc, Scope* sc, Expressions* elements Type typeb = se.type.toBasetype(); TY tynto = tb.nextOf().ty; if (!se.committed && - typeb.isStaticOrDynamicArray() && tynto.isSomeChar && - se.numberOfCodeUnits(tynto) < (cast(TypeSArray)tb).dim.toInteger()) + typeb.isStaticOrDynamicArray() && tynto.isSomeChar) { - e = se.castTo(sc, t); - goto L1; + string s; + size_t len = se.numberOfCodeUnits(tynto, s); + if (s) + error(se.loc, "%.*s", cast(int)s.length, s.ptr); + if (len < (cast(TypeSArray)tb).dim.toInteger()) + { + e = se.castTo(sc, t); + goto L1; + } } } @@ -17423,6 +18361,7 @@ Expression toBoolean(Expression exp, Scope* sc) break; } + e = checkNoreturnVarAccess(e); if (!t.isBoolean()) { if (tb != Type.terror) @@ -18111,14 +19050,15 @@ private bool needsTypeInference(TemplateInstance ti, Scope* sc, int flag = 0) auto td = s.isTemplateDeclaration(); if (!td) return 0; - /* If any of the overloaded template declarations need inference, * then return true */ + td.computeOneMember(); if (!td.onemember) return 0; if (auto td2 = td.onemember.isTemplateDeclaration()) { + td2.computeOneMember(); if (!td2.onemember || !td2.onemember.isFuncDeclaration()) return 0; if (ti.tiargs.length >= td.parameters.length - (td.isVariadic() ? 1 : 0)) @@ -18539,8 +19479,9 @@ void lowerNonArrayAggregate(StaticForeach sfe, Scope* sc) */ extern(D) void prepare(StaticForeach sfe, Scope* sc) { - assert(sc); + import dmd.statementsem : ready; + assert(sc); if (sfe.aggrfe) { sc = sc.startCTFE(); diff --git a/dmd/file_manager.d b/dmd/file_manager.d index c63dbc66996..4650c2b6002 100644 --- a/dmd/file_manager.d +++ b/dmd/file_manager.d @@ -1,7 +1,7 @@ /** * Read a file from disk and store it in memory. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/file_manager.d, _file_manager.d) * Documentation: https://dlang.org/phobos/dmd_file_manager.html diff --git a/dmd/frontend.h b/dmd/frontend.h index 9a893eeb55c..e4b80ddc68d 100644 --- a/dmd/frontend.h +++ b/dmd/frontend.h @@ -50,8 +50,6 @@ class AggregateDeclaration; class LabelDsymbol; class ClassDeclaration; class Package; -template -struct Array; class UnitTestDeclaration; class EnumMember; class TemplateDeclaration; @@ -102,6 +100,8 @@ class MixinDeclaration; class StaticAssert; class StaticIfDeclaration; class CAsmDeclaration; +template +struct Array; class DsymbolTable; class Type; struct MangleOverride; @@ -123,14 +123,12 @@ struct IntRange; struct ModuleDeclaration; template struct FileMapping; -struct Escape; class LabelStatement; class SwitchStatement; class Statement; class TryFinallyStatement; class ScopeGuardStatement; class ErrorSink; -struct DocComment; class WithStatement; struct AA; class CaseStatement; @@ -172,7 +170,6 @@ class TypeMixin; class TypeTraits; class TypeNoreturn; class TypeTag; -class StringExp; class IntegerExp; class ErrorExp; class VoidInitExp; @@ -184,6 +181,7 @@ class DsymbolExp; class ThisExp; class SuperExp; class NullExp; +class StringExp; class InterpExp; class TupleExp; class ArrayLiteralExp; @@ -290,6 +288,7 @@ class BinAssignExp; struct InterpolatedSet; struct ContractInfo; struct Symbol; +struct ParametersDFAInfo; struct ObjcSelector; class ErrorInitializer; class VoidInitializer; @@ -428,8 +427,8 @@ enum class PASS : uint8_t semantic2done = 4u, semantic3 = 5u, semantic3done = 6u, - inline_ = 7u, - inlinedone = 8u, + inlinePragma = 7u, + inlineAll = 8u, obj = 9u, }; @@ -614,10 +613,8 @@ class Dsymbol : public ASTNode virtual bool needThis(); virtual Visibility visible(); virtual Dsymbol* syntaxCopy(Dsymbol* s); - virtual void addObjcSymbols(Array* classes, Array* categories); - virtual void addComment(const char* comment); const char* comment(); - void comment(const char* comment); + void addComment(const char* c); UnitTestDeclaration* ddocUnittest(); void ddocUnittest(UnitTestDeclaration* utd); bool inNonRoot(); @@ -1704,7 +1701,6 @@ class TemplateParameter : public ASTNode virtual TemplateThisParameter* isTemplateThisParameter(); virtual TemplateTupleParameter* isTemplateTupleParameter(); virtual TemplateParameter* syntaxCopy() = 0; - virtual bool declareParameter(Scope* sc) = 0; virtual void print(RootObject* oarg, RootObject* oded) = 0; virtual RootObject* specialization() = 0; virtual bool hasDefaultArg() = 0; @@ -1721,7 +1717,6 @@ class TemplateAliasParameter final : public TemplateParameter RootObject* defaultAlias; TemplateAliasParameter* isTemplateAliasParameter() override; TemplateAliasParameter* syntaxCopy() override; - bool declareParameter(Scope* sc) override; void print(RootObject* oarg, RootObject* oded) override; RootObject* specialization() override; bool hasDefaultArg() override; @@ -1746,6 +1741,7 @@ class TemplateDeclaration final : public ScopeDsymbol bool isTrivialAlias; bool deprecated_; bool isCmacro; + bool haveComputedOneMember; Visibility visibility; TemplatePrevious* previous; Expression* lastConstraint; @@ -1852,7 +1848,6 @@ class TemplateTypeParameter : public TemplateParameter Type* defaultType; TemplateTypeParameter* isTemplateTypeParameter() final override; TemplateTypeParameter* syntaxCopy() override; - bool declareParameter(Scope* sc) final override; void print(RootObject* oarg, RootObject* oded) final override; RootObject* specialization() final override; bool hasDefaultArg() final override; @@ -1872,7 +1867,6 @@ class TemplateTupleParameter final : public TemplateParameter public: TemplateTupleParameter* isTemplateTupleParameter() override; TemplateTupleParameter* syntaxCopy() override; - bool declareParameter(Scope* sc) override; void print(RootObject* oarg, RootObject* oded) override; RootObject* specialization() override; bool hasDefaultArg() override; @@ -1887,7 +1881,6 @@ class TemplateValueParameter final : public TemplateParameter Expression* defaultValue; TemplateValueParameter* isTemplateValueParameter() override; TemplateValueParameter* syntaxCopy() override; - bool declareParameter(Scope* sc) override; void print(RootObject* oarg, RootObject* oded) override; RootObject* specialization() override; bool hasDefaultArg() override; @@ -2070,21 +2063,10 @@ class Type : public ASTNode size_t getUniqueID() const; const char* toChars() const final override; char* toPrettyChars(bool QualifyTypes = false); - static void _init(); static void deinitialize(); - virtual uint32_t alignsize(); void modToBuffer(OutBuffer& buf) const; char* modToChars() const; - virtual bool isIntegral(); - virtual bool isFloating(); - virtual bool isReal(); - virtual bool isImaginary(); - virtual bool isComplex(); - virtual bool isScalar(); - virtual bool isUnsigned(); virtual bool isScopeClass(); - virtual bool isString(); - virtual bool isBoolean(); bool isConst() const; bool isImmutable() const; bool isMutable() const; @@ -2095,29 +2077,8 @@ class Type : public ASTNode bool isSharedWild() const; bool isNaked() const; Type* nullAttributes() const; - bool hasDeprecatedAliasThis(); - virtual Type* makeConst(); - virtual Type* makeImmutable(); - virtual Type* makeShared(); - virtual Type* makeSharedConst(); - virtual Type* makeWild(); - virtual Type* makeWildConst(); - virtual Type* makeSharedWild(); - virtual Type* makeSharedWildConst(); - virtual Type* makeMutable(); - Type* toBasetype(); - virtual uint8_t deduceWild(Type* t, bool isRef); virtual ClassDeclaration* isClassHandle(); - virtual structalign_t alignment(); virtual int32_t hasWild() const; - virtual bool hasVoidInitPointers(); - virtual bool hasUnsafeBitpatterns(); - virtual bool hasInvariant(); - virtual Type* nextOf(); - Type* baseElemOf(); - virtual bool needsDestruction(); - virtual bool needsCopyOrPostblit(); - virtual bool needsNested(); virtual TypeBasic* isTypeBasic(); TypeFunction* isPtrToFunction(); TypeFunction* isFunction_Delegate_PtrToFunction(); @@ -2307,36 +2268,6 @@ enum class EXP : uint8_t rvalue = 128u, }; -typedef uint64_t dinteger_t; - -typedef uint64_t uinteger_t; - -struct complex_t final -{ - _d_real re; - _d_real im; - complex_t() = delete; - complex_t(_d_real re); - complex_t(_d_real re, _d_real im); - int32_t opEquals(complex_t y) const; -}; - -template -struct Optional final -{ - T value; - bool present; - Optional(T value); - static Optional create(T val); - bool isPresent() const; - bool isEmpty() const; - T get(); - bool hasValue(T exp) const; - Optional() - { - } -}; - class Expression : public ASTNode { public: @@ -2376,17 +2307,8 @@ class Expression : public ASTNode virtual Expression* syntaxCopy(); DYNCAST dyncast() const final override; const char* toChars() const final override; - virtual dinteger_t toInteger(); - virtual uinteger_t toUInteger(); - virtual _d_real toReal(); - virtual _d_real toImaginary(); - virtual complex_t toComplex(); - virtual StringExp* toStringExp(); - virtual bool isLvalue(); - virtual bool checkType(); Expression* deref(); int32_t isConst(); - virtual Optional toBool(); virtual bool hasCode(); IntegerExp* isIntegerExp(); ErrorExp* isErrorExp(); @@ -2519,7 +2441,6 @@ class BinExp : public Expression class BinAssignExp : public BinExp { public: - bool isLvalue() final override; void accept(Visitor* v) override; }; @@ -2547,7 +2468,6 @@ class UnaExp : public Expression class AddrExp final : public UnaExp { public: - Optional toBool() override; void accept(Visitor* v) override; }; @@ -2586,7 +2506,6 @@ class ArrayExp final : public UnaExp VarDeclaration* lengthVar; bool modifiable; ArrayExp* syntaxCopy() override; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -2615,8 +2534,6 @@ class ArrayLiteralExp final : public Expression static ArrayLiteralExp* create(Loc loc, Array* elements); ArrayLiteralExp* syntaxCopy() override; Expression* getElement(size_t i); - Optional toBool() override; - StringExp* toStringExp() override; void accept(Visitor* v) override; }; @@ -2624,6 +2541,7 @@ class AssertExp final : public UnaExp { public: Expression* msg; + Expression* loweredFrom; AssertExp* syntaxCopy() override; void accept(Visitor* v) override; }; @@ -2640,7 +2558,6 @@ class AssignExp : public BinExp public: MemorySet memset; AssignExp(Loc loc, EXP tok, Expression* e1, Expression* e2); - bool isLvalue() final override; void accept(Visitor* v) override; }; @@ -2653,7 +2570,6 @@ class AssocArrayLiteralExp final : public Expression Expression* lowering; Expression* loweringCtfe; AssocArrayLiteralExp* syntaxCopy() override; - Optional toBool() override; void accept(Visitor* v) override; }; @@ -2677,6 +2593,7 @@ class CallExp final : public UnaExp bool inDebugStatement; bool ignoreAttributes; bool isUfcsRewrite; + bool fromOpAssignment; VarDeclaration* vthis2; Expression* loweredFrom; static CallExp* create(Loc loc, Expression* e, Array* exps); @@ -2684,7 +2601,6 @@ class CallExp final : public UnaExp static CallExp* create(Loc loc, Expression* e, Expression* earg1); static CallExp* create(Loc loc, FuncDeclaration* fd, Expression* earg1); CallExp* syntaxCopy() override; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -2696,7 +2612,6 @@ class CastExp final : public UnaExp bool trusted; Expression* lowering; CastExp* syntaxCopy() override; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -2731,7 +2646,6 @@ class ClassReferenceExp final : public Expression public: StructLiteralExp* value; ClassDeclaration* originalClass(); - int32_t getFieldIndex(Type* fieldtype, uint32_t fieldoffset); int32_t findFieldIndexByName(VarDeclaration* v); void accept(Visitor* v) override; }; @@ -2754,23 +2668,25 @@ class CommaExp final : public BinExp const bool isGenerated; bool allowCommaExp; Expression* originalExp; - bool isLvalue() override; - Optional toBool() override; void accept(Visitor* v) override; static void allow(Expression* exp); }; +struct complex_t final +{ + _d_real re; + _d_real im; + complex_t() = delete; + complex_t(_d_real re); + complex_t(_d_real re, _d_real im); + int32_t opEquals(complex_t y) const; +}; + class ComplexExp final : public Expression { public: complex_t value; static ComplexExp* create(Loc loc, complex_t value, Type* type); - dinteger_t toInteger() override; - uinteger_t toUInteger() override; - _d_real toReal() override; - _d_real toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor* v) override; }; @@ -2786,13 +2702,13 @@ class CondExp final : public BinExp public: Expression* econd; CondExp* syntaxCopy() override; - bool isLvalue() override; void accept(Visitor* v) override; }; class ConstructExp final : public AssignExp { public: + Expression* lowering; void accept(Visitor* v) override; }; @@ -2823,14 +2739,12 @@ class DelegateExp final : public UnaExp class DelegateFuncptrExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor* v) override; }; class DelegatePtrExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -2858,7 +2772,6 @@ class IdentifierExp : public Expression public: Identifier* ident; static IdentifierExp* create(Loc loc, Identifier* ident); - bool isLvalue() final override; void accept(Visitor* v) override; }; @@ -2889,7 +2802,6 @@ class DotTemplateExp final : public UnaExp { public: TemplateDeclaration* td; - bool checkType() override; void accept(Visitor* v) override; }; @@ -2898,7 +2810,6 @@ class DotTemplateInstanceExp final : public UnaExp public: TemplateInstance* ti; DotTemplateInstanceExp* syntaxCopy() override; - bool checkType() override; void accept(Visitor* v) override; }; @@ -2914,7 +2825,6 @@ class DotVarExp final : public UnaExp public: Declaration* var; bool hasOverloads; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -2923,7 +2833,6 @@ class DsymbolExp final : public Expression public: Dsymbol* s; bool hasOverloads; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -3186,7 +3095,6 @@ class FuncExp final : public Expression TemplateDeclaration* td; TOK tok; FuncExp* syntaxCopy() override; - bool checkType() override; void accept(Visitor* v) override; }; @@ -3238,20 +3146,16 @@ class IndexExp final : public BinExp bool modifiable; bool indexIsInBounds; IndexExp* syntaxCopy() override; - bool isLvalue() override; void accept(Visitor* v) override; }; +typedef uint64_t dinteger_t; + class IntegerExp final : public Expression { public: dinteger_t value; static IntegerExp* create(Loc loc, dinteger_t value, Type* type); - dinteger_t toInteger() override; - _d_real toReal() override; - _d_real toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor* v) override; dinteger_t getInteger(); IntegerExp* syntaxCopy() override; @@ -3407,8 +3311,6 @@ class NotExp final : public UnaExp class NullExp final : public Expression { public: - Optional toBool() override; - StringExp* toStringExp() override; void accept(Visitor* v) override; }; @@ -3435,7 +3337,6 @@ class OverExp final : public Expression { public: OverloadSet* vars; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -3472,7 +3373,6 @@ class PrettyFuncInitExp final : public DefaultInitExp class PtrExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -3481,12 +3381,6 @@ class RealExp final : public Expression public: _d_real value; static RealExp* create(Loc loc, _d_real value, Type* type); - dinteger_t toInteger() override; - uinteger_t toUInteger() override; - _d_real toReal() override; - _d_real toImaginary() override; - complex_t toComplex() override; - Optional toBool() override; void accept(Visitor* v) override; }; @@ -3501,7 +3395,6 @@ class ScopeExp final : public Expression public: ScopeDsymbol* sds; ScopeExp* syntaxCopy() override; - bool checkType() override; void accept(Visitor* v) override; }; @@ -3565,8 +3458,6 @@ class SliceExp final : public UnaExp uint8_t bitFields; public: SliceExp* syntaxCopy() override; - bool isLvalue() override; - Optional toBool() override; void accept(Visitor* v) override; }; @@ -3591,14 +3482,10 @@ class StringExp final : public Expression static StringExp* create(Loc loc, const char* s); static StringExp* create(Loc loc, const void* string, size_t len); - size_t numberOfCodeUnits(int32_t tynto = 0) const; void writeTo(void* dest, bool zero, int32_t tyto = 0) const; char32_t getCodeUnit(size_t i) const; dinteger_t getIndex(size_t i) const; - StringExp* toStringExp() override; int32_t compare(const StringExp* const se2) const; - Optional toBool() override; - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -3664,8 +3551,6 @@ class ThisExp : public Expression VarDeclaration* var; ThisExp(Loc loc, const EXP tok); ThisExp* syntaxCopy() override; - Optional toBool() override; - bool isLvalue() final override; void accept(Visitor* v) override; }; @@ -3688,7 +3573,6 @@ class SymOffExp final : public SymbolExp { public: dinteger_t offset; - Optional toBool() override; void accept(Visitor* v) override; }; @@ -3697,8 +3581,6 @@ class TemplateExp final : public Expression public: TemplateDeclaration* td; FuncDeclaration* fd; - bool isLvalue() override; - bool checkType() override; void accept(Visitor* v) override; }; @@ -3739,7 +3621,6 @@ class TypeExp final : public Expression { public: TypeExp* syntaxCopy() override; - bool checkType() override; void accept(Visitor* v) override; }; @@ -3774,14 +3655,12 @@ class VarExp final : public SymbolExp public: bool delegateWasExtracted; static VarExp* create(Loc loc, Declaration* var, bool hasOverloads = true); - bool isLvalue() override; void accept(Visitor* v) override; }; class VectorArrayExp final : public UnaExp { public: - bool isLvalue() override; void accept(Visitor* v) override; }; @@ -3824,10 +3703,12 @@ struct AttributeViolation final Loc loc; FuncDeclaration* fd; _d_dynamicArray< const char > action; + VarDeclaration* scopeVar; AttributeViolation() : loc(), fd(), - action() + action(), + scopeVar() { } }; @@ -3937,6 +3818,7 @@ class FuncDeclaration : public Declaration AttributeViolation* nogcViolation; AttributeViolation* pureViolation; AttributeViolation* nothrowViolation; + ParametersDFAInfo* parametersDFAInfo; bool purityInprocess() const; bool purityInprocess(bool v); bool safetyInprocess() const; @@ -4036,13 +3918,8 @@ class FuncDeclaration : public Declaration virtual bool isNested() const; AggregateDeclaration* isThis() override; bool needThis() final override; - bool isVirtualMethod(); - virtual bool isVirtual() const; bool isFinalFunc() const; - virtual bool addPreInvariant(); - virtual bool addPostInvariant(); const char* kind() const override; - bool hasNestedFrameRefs(); ParameterList getParameterList(); virtual FuncDeclaration* toAliasFunc(); void accept(Visitor* v) override; @@ -4055,9 +3932,6 @@ class CtorDeclaration final : public FuncDeclaration bool isMoveCtor; CtorDeclaration* syntaxCopy(Dsymbol* s) override; const char* kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; @@ -4066,9 +3940,6 @@ class DtorDeclaration final : public FuncDeclaration public: DtorDeclaration* syntaxCopy(Dsymbol* s) override; const char* kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; @@ -4091,9 +3962,6 @@ class FuncLiteralDeclaration final : public FuncDeclaration FuncLiteralDeclaration* syntaxCopy(Dsymbol* s) override; bool isNested() const override; AggregateDeclaration* isThis() override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; const char* kind() const override; const char* toPrettyChars(bool QualifyTypes = false) override; void accept(Visitor* v) override; @@ -4103,9 +3971,6 @@ class InvariantDeclaration final : public FuncDeclaration { public: InvariantDeclaration* syntaxCopy(Dsymbol* s) override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; @@ -4114,19 +3979,57 @@ class NewDeclaration final : public FuncDeclaration public: NewDeclaration* syntaxCopy(Dsymbol* s) override; const char* kind() const override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; +struct ParameterDFAInfo final +{ + int32_t parameterId; + Fact notNullIn; + Fact notNullOut; + bool specifiedByUser; + enum class Fact : uint8_t + { + Unspecified = 0u, + NotGuaranteed = 1u, + Guaranteed = 2u, + }; + + ParameterDFAInfo() : + parameterId(), + specifiedByUser() + { + } + ParameterDFAInfo(int32_t parameterId, Fact notNullIn = (Fact)0u, Fact notNullOut = (Fact)0u, bool specifiedByUser = false) : + parameterId(parameterId), + notNullIn(notNullIn), + notNullOut(notNullOut), + specifiedByUser(specifiedByUser) + {} +}; + +struct ParametersDFAInfo final +{ + ParameterDFAInfo thisPointer; + ParameterDFAInfo returnValue; + _d_dynamicArray< ParameterDFAInfo > parameters; + ParametersDFAInfo() : + thisPointer(), + returnValue(), + parameters() + { + } + ParametersDFAInfo(ParameterDFAInfo thisPointer, ParameterDFAInfo returnValue = ParameterDFAInfo(), _d_dynamicArray< ParameterDFAInfo > parameters = {}) : + thisPointer(thisPointer), + returnValue(returnValue), + parameters(parameters) + {} +}; + class PostBlitDeclaration final : public FuncDeclaration { public: PostBlitDeclaration* syntaxCopy(Dsymbol* s) override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; @@ -4135,9 +4038,6 @@ class StaticCtorDeclaration : public FuncDeclaration public: StaticCtorDeclaration* syntaxCopy(Dsymbol* s) override; AggregateDeclaration* isThis() final override; - bool isVirtual() const final override; - bool addPreInvariant() final override; - bool addPostInvariant() final override; void accept(Visitor* v) override; }; @@ -4155,9 +4055,6 @@ class StaticDtorDeclaration : public FuncDeclaration VarDeclaration* vgate; StaticDtorDeclaration* syntaxCopy(Dsymbol* s) override; AggregateDeclaration* isThis() final override; - bool isVirtual() const final override; - bool addPreInvariant() final override; - bool addPostInvariant() final override; void accept(Visitor* v) override; }; @@ -4175,9 +4072,6 @@ class UnitTestDeclaration final : public FuncDeclaration Array deferredNested; UnitTestDeclaration* syntaxCopy(Dsymbol* s) override; AggregateDeclaration* isThis() override; - bool isVirtual() const override; - bool addPreInvariant() override; - bool addPostInvariant() override; void accept(Visitor* v) override; }; @@ -4188,6 +4082,7 @@ struct HdrGenState final bool fullDump; bool importcHdr; bool inCAlias; + bool inFuncReturn; bool doFuncBodies; bool vcg_ast; bool skipConstraints; @@ -4207,6 +4102,7 @@ struct HdrGenState final fullDump(), importcHdr(), inCAlias(), + inFuncReturn(), doFuncBodies(), vcg_ast(), skipConstraints(), @@ -4222,12 +4118,13 @@ struct HdrGenState final inEnumDecl() { } - HdrGenState(bool hdrgen, bool ddoc = false, bool fullDump = false, bool importcHdr = false, bool inCAlias = false, bool doFuncBodies = false, bool vcg_ast = false, bool skipConstraints = false, bool showOneMember = true, bool errorMsg = false, bool fullQual = false, int32_t tpltMember = 0, int32_t autoMember = 0, int32_t forStmtInit = 0, int32_t insideFuncBody = 0, int32_t insideAggregate = 0, bool declstring = false, EnumDeclaration* inEnumDecl = nullptr) : + HdrGenState(bool hdrgen, bool ddoc = false, bool fullDump = false, bool importcHdr = false, bool inCAlias = false, bool inFuncReturn = false, bool doFuncBodies = false, bool vcg_ast = false, bool skipConstraints = false, bool showOneMember = true, bool errorMsg = false, bool fullQual = false, int32_t tpltMember = 0, int32_t autoMember = 0, int32_t forStmtInit = 0, int32_t insideFuncBody = 0, int32_t insideAggregate = 0, bool declstring = false, EnumDeclaration* inEnumDecl = nullptr) : hdrgen(hdrgen), ddoc(ddoc), fullDump(fullDump), importcHdr(importcHdr), inCAlias(inCAlias), + inFuncReturn(inFuncReturn), doFuncBodies(doFuncBodies), vcg_ast(vcg_ast), skipConstraints(skipConstraints), @@ -4365,7 +4262,6 @@ class Parameter final : public ASTNode UserAttributeDeclaration* userAttribDecl; static Parameter* create(Loc loc, StorageClass storageClass, Type* type, Identifier* ident, Expression* defaultArg, UserAttributeDeclaration* userAttribDecl); Parameter* syntaxCopy(); - Type* isLazyArray(); bool isLazy() const; bool isReference() const; DYNCAST dyncast() const override; @@ -4408,18 +4304,6 @@ class TypeNext : public Type public: Type* next; int32_t hasWild() const final override; - Type* nextOf() final override; - Type* makeConst() final override; - Type* makeImmutable() final override; - Type* makeShared() final override; - Type* makeSharedConst() final override; - Type* makeWild() final override; - Type* makeWildConst() final override; - Type* makeSharedWild() final override; - Type* makeSharedWildConst() final override; - Type* makeMutable() final override; - uint8_t deduceWild(Type* t, bool isRef) final override; - void transitive(); void accept(Visitor* v) override; }; @@ -4437,7 +4321,6 @@ class TypeAArray final : public TypeArray static TypeAArray* create(Type* t, Type* index); const char* kind() const override; TypeAArray* syntaxCopy() override; - bool isBoolean() override; void accept(Visitor* v) override; }; @@ -4448,15 +4331,6 @@ class TypeBasic final : public Type uint32_t flags; const char* kind() const override; TypeBasic* syntaxCopy() override; - uint32_t alignsize() override; - bool isIntegral() override; - bool isFloating() override; - bool isReal() override; - bool isImaginary() override; - bool isComplex() override; - bool isScalar() override; - bool isUnsigned() override; - bool hasUnsafeBitpatterns() override; TypeBasic* isTypeBasic() override; void accept(Visitor* v) override; }; @@ -4480,9 +4354,7 @@ class TypeClass final : public Type const char* kind() const override; TypeClass* syntaxCopy() override; ClassDeclaration* isClassHandle() override; - uint8_t deduceWild(Type* t, bool isRef) override; bool isScopeClass() override; - bool isBoolean() override; void accept(Visitor* v) override; }; @@ -4491,9 +4363,6 @@ class TypeDArray final : public TypeArray public: const char* kind() const override; TypeDArray* syntaxCopy() override; - uint32_t alignsize() override; - bool isString() override; - bool isBoolean() override; void accept(Visitor* v) override; }; @@ -4503,8 +4372,6 @@ class TypeDelegate final : public TypeNext static TypeDelegate* create(TypeFunction* t); const char* kind() const override; TypeDelegate* syntaxCopy() override; - uint32_t alignsize() override; - bool isBoolean() override; void accept(Visitor* v) override; }; @@ -4514,24 +4381,6 @@ class TypeEnum final : public Type EnumDeclaration* sym; const char* kind() const override; TypeEnum* syntaxCopy() override; - Type* memType(); - uint32_t alignsize() override; - bool isIntegral() override; - bool isFloating() override; - bool isReal() override; - bool isImaginary() override; - bool isComplex() override; - bool isScalar() override; - bool isUnsigned() override; - bool isBoolean() override; - bool isString() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; - bool hasVoidInitPointers() override; - bool hasUnsafeBitpatterns() override; - bool hasInvariant() override; - Type* nextOf() override; void accept(Visitor* v) override; }; @@ -4710,8 +4559,6 @@ class TypeNoreturn final : public Type public: const char* kind() const override; TypeNoreturn* syntaxCopy() override; - bool isBoolean() override; - uint32_t alignsize() override; void accept(Visitor* v) override; }; @@ -4720,7 +4567,6 @@ class TypeNull final : public Type public: const char* kind() const override; TypeNull* syntaxCopy() override; - bool isBoolean() override; void accept(Visitor* v) override; }; @@ -4730,7 +4576,6 @@ class TypePointer final : public TypeNext static TypePointer* create(Type* t); const char* kind() const override; TypePointer* syntaxCopy() override; - bool isScalar() override; void accept(Visitor* v) override; }; @@ -4757,15 +4602,6 @@ class TypeSArray final : public TypeArray const char* kind() const override; TypeSArray* syntaxCopy() override; bool isIncomplete(); - uint32_t alignsize() override; - bool isString() override; - structalign_t alignment() override; - bool hasUnsafeBitpatterns() override; - bool hasVoidInitPointers() override; - bool hasInvariant() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; void accept(Visitor* v) override; }; @@ -4787,17 +4623,7 @@ class TypeStruct final : public Type bool inuse; static TypeStruct* create(StructDeclaration* sym); const char* kind() const override; - uint32_t alignsize() override; TypeStruct* syntaxCopy() override; - structalign_t alignment() override; - bool isBoolean() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; - bool hasVoidInitPointers() override; - bool hasUnsafeBitpatterns() override; - bool hasInvariant() override; - uint8_t deduceWild(Type* t, bool isRef) override; void accept(Visitor* v) override; }; @@ -4860,12 +4686,6 @@ class TypeVector final : public Type static TypeVector* create(Type* basetype); const char* kind() const override; TypeVector* syntaxCopy() override; - uint32_t alignsize() override; - bool isIntegral() override; - bool isFloating() override; - bool isScalar() override; - bool isUnsigned() override; - bool isBoolean() override; TypeBasic* elementType(); void accept(Visitor* v) override; }; @@ -5362,6 +5182,7 @@ class ReturnStatement final : public Statement public: Expression* exp; size_t caseDim; + FuncDeclaration* fesFunc; ReturnStatement* syntaxCopy() override; ReturnStatement* endsWithReturnStatement() override; void accept(Visitor* v) override; @@ -5503,6 +5324,7 @@ class WhileStatement final : public Statement class WithStatement final : public Statement { public: + Parameter* prm; Expression* exp; Statement* _body; VarDeclaration* wthis; @@ -5521,41 +5343,6 @@ class StaticAssert final : public Dsymbol void accept(Visitor* v) override; }; -struct UnionExp final -{ - #pragma pack(push, 8) -private: - union _AnonStruct_u - { - char exp[22LLU]; - char integerexp[32LLU]; - char errorexp[22LLU]; - char realexp[48LLU]; - char complexexp[64LLU]; - char symoffexp[56LLU]; - char stringexp[44LLU]; - char arrayliteralexp[56LLU]; - char assocarrayliteralexp[56LLU]; - char structliteralexp[64LLU]; - char compoundliteralexp[32LLU]; - char nullexp[22LLU]; - char dotvarexp[41LLU]; - char addrexp[32LLU]; - char indexexp[58LLU]; - char sliceexp[57LLU]; - char vectorexp[45LLU]; - }; - #pragma pack(pop) - - // Ignoring var u alignment 8 - _AnonStruct_u u; -public: - UnionExp() : - u() - { - } -}; - enum class MODFlags { none = 0, @@ -5831,6 +5618,8 @@ struct ASTCodegen final using ILS = ::ILS; using InvariantDeclaration = ::InvariantDeclaration; using NewDeclaration = ::NewDeclaration; + using ParameterDFAInfo = ::ParameterDFAInfo; + using ParametersDFAInfo = ::ParametersDFAInfo; using PostBlitDeclaration = ::PostBlitDeclaration; using SharedStaticCtorDeclaration = ::SharedStaticCtorDeclaration; using SharedStaticDtorDeclaration = ::SharedStaticDtorDeclaration; @@ -5936,8 +5725,6 @@ struct ASTCodegen final using WhileStatement = ::WhileStatement; using WithStatement = ::WithStatement; using StaticAssert = ::StaticAssert; - using UnionExp = ::UnionExp; - using emplaceExp = ::emplaceExp; typedef UserAttributeDeclaration* UserAttributeDeclaration; typedef Ensure Ensure; typedef ErrorExp* ErrorExp; @@ -6341,7 +6128,6 @@ class AggregateDeclaration : public ScopeDsymbol bool noDefaultCtor; bool disableNew; Sizeok sizeok; - virtual Scope* newScope(Scope* sc); bool isDeprecated() const final override; bool isNested() const; bool isExport() const final override; @@ -6412,7 +6198,6 @@ class AttribDeclaration : public Dsymbol public: Array* decl; const char* kind() const override; - void addObjcSymbols(Array* classes, Array* categories) final override; void accept(Visitor* v) override; }; @@ -6684,7 +6469,6 @@ class ClassDeclaration : public AggregateDeclaration static ClassDeclaration* create(Loc loc, Identifier* id, Array* baseclasses, Array* members, bool inObject); const char* toPrettyChars(bool qualifyTypes = false) override; ClassDeclaration* syntaxCopy(Dsymbol* s) override; - Scope* newScope(Scope* sc) override; enum : int32_t { OFFSET_RUNTIME = 1985229328 }; enum : int32_t { OFFSET_FWDREF = 1985229329 }; @@ -6698,7 +6482,6 @@ class ClassDeclaration : public AggregateDeclaration virtual bool isCPPinterface() const; virtual int32_t vtblOffset() const; const char* kind() const override; - void addObjcSymbols(Array* classes, Array* categories) final override; Dsymbol* vtblsym; void accept(Visitor* v) override; }; @@ -6707,7 +6490,6 @@ class InterfaceDeclaration final : public ClassDeclaration { public: InterfaceDeclaration* syntaxCopy(Dsymbol* s) override; - Scope* newScope(Scope* sc) override; bool isBaseOf(ClassDeclaration* cd, int32_t* poffset) override; const char* kind() const override; int32_t vtblOffset() const override; @@ -6886,7 +6668,6 @@ class BitFieldDeclaration : public VarDeclaration uint32_t bitOffset; BitFieldDeclaration* syntaxCopy(Dsymbol* s) override; void accept(Visitor* v) override; - uint64_t getMinMax(Identifier* id); }; class SymbolDeclaration final : public Declaration @@ -6951,8 +6732,8 @@ class TypeInfoAssociativeArrayDeclaration final : public TypeInfoDeclaration { public: Type* entry; - Dsymbol* xopEqual; - Dsymbol* xtoHash; + Declaration* xopEqual; + Declaration* xtoHash; static TypeInfoAssociativeArrayDeclaration* create(Type* tinfo); void accept(Visitor* v) override; }; @@ -7151,7 +6932,7 @@ class Module final : public Package Array* versionids; Array* versionidsNot; MacroTable macrotable; - Escape* _escapetable; + void* _escapetable; size_t nameoffset; size_t namelen; static Module* create(const char* filename, Identifier* ident, int32_t doDocComment, int32_t doHdrGen); @@ -7249,6 +7030,8 @@ struct Scope final bool fullinst(bool v); bool ctfeBlock() const; bool ctfeBlock(bool v); + bool knownACompileTimeOnlyContext() const; + bool knownACompileTimeOnlyContext(bool v); private: uint16_t bitFields; uint16_t bitFields2; @@ -7265,12 +7048,11 @@ struct Scope final bool explicitVisibility(bool v); Previews previews; UserAttributeDeclaration* userAttribDecl; - DocComment* lastdc; + void* lastdc; void* anchorCounts; Identifier* prevAnchor; AliasDeclaration* aliasAsg; StructDeclaration* argStruct; - Dsymbol* search(Loc loc, Identifier* ident, Dsymbol*& pscopesym, uint32_t flags = 0u); Scope() : enclosing(), _module(), @@ -7310,7 +7092,7 @@ struct Scope final argStruct() { } - Scope(Scope* enclosing, Module* _module = nullptr, ScopeDsymbol* scopesym = nullptr, FuncDeclaration* func = nullptr, VarDeclaration* varDecl = nullptr, Dsymbol* parent = nullptr, LabelStatement* slabel = nullptr, SwitchStatement* switchStatement = nullptr, Statement* tryBody = nullptr, TryFinallyStatement* tryFinally = nullptr, ScopeGuardStatement* scopeGuard = nullptr, Statement* sbreak = nullptr, Statement* scontinue = nullptr, ForeachStatement* fes = nullptr, Scope* callsc = nullptr, Dsymbol* inunion = nullptr, VarDeclaration* lastVar = nullptr, ErrorSink* eSink = nullptr, Module* minst = nullptr, TemplateInstance* tinst = nullptr, CtorFlow ctorflow = CtorFlow(), AlignDeclaration* aligndecl = nullptr, CPPNamespaceDeclaration* namespace_ = nullptr, LINK linkage = (LINK)1u, CPPMANGLE cppmangle = (CPPMANGLE)0u, PragmaDeclaration* inlining = nullptr, Visibility visibility = Visibility((Visibility::Kind)5u, nullptr), STC stc = (STC)0LLU, DeprecatedDeclaration* depdecl = nullptr, uint16_t bitFields = 0u, uint16_t bitFields2 = 0u, Previews previews = Previews(), UserAttributeDeclaration* userAttribDecl = nullptr, DocComment* lastdc = nullptr, void* anchorCounts = nullptr, Identifier* prevAnchor = nullptr, AliasDeclaration* aliasAsg = nullptr, StructDeclaration* argStruct = nullptr) : + Scope(Scope* enclosing, Module* _module = nullptr, ScopeDsymbol* scopesym = nullptr, FuncDeclaration* func = nullptr, VarDeclaration* varDecl = nullptr, Dsymbol* parent = nullptr, LabelStatement* slabel = nullptr, SwitchStatement* switchStatement = nullptr, Statement* tryBody = nullptr, TryFinallyStatement* tryFinally = nullptr, ScopeGuardStatement* scopeGuard = nullptr, Statement* sbreak = nullptr, Statement* scontinue = nullptr, ForeachStatement* fes = nullptr, Scope* callsc = nullptr, Dsymbol* inunion = nullptr, VarDeclaration* lastVar = nullptr, ErrorSink* eSink = nullptr, Module* minst = nullptr, TemplateInstance* tinst = nullptr, CtorFlow ctorflow = CtorFlow(), AlignDeclaration* aligndecl = nullptr, CPPNamespaceDeclaration* namespace_ = nullptr, LINK linkage = (LINK)1u, CPPMANGLE cppmangle = (CPPMANGLE)0u, PragmaDeclaration* inlining = nullptr, Visibility visibility = Visibility((Visibility::Kind)5u, nullptr), STC stc = (STC)0LLU, DeprecatedDeclaration* depdecl = nullptr, uint16_t bitFields = 0u, uint16_t bitFields2 = 0u, Previews previews = Previews(), UserAttributeDeclaration* userAttribDecl = nullptr, void* lastdc = nullptr, void* anchorCounts = nullptr, Identifier* prevAnchor = nullptr, AliasDeclaration* aliasAsg = nullptr, StructDeclaration* argStruct = nullptr) : enclosing(enclosing), _module(_module), scopesym(scopesym), @@ -7507,18 +7289,6 @@ class ConditionIncludeVisitor : public Visitor void visit(StaticForeachDeclaration* sfd) override; }; -class AddCommentVisitor : public Visitor -{ -public: - using Visitor::visit; - const char* comment; - AddCommentVisitor(const char* comment); - void visit(Dsymbol* d) override; - void visit(AttribDeclaration* atd) override; - void visit(ConditionalDeclaration* cd) override; - void visit(StaticForeachDeclaration* sfd) override; -}; - class NrvoWalker final : public StatementRewriteWalker { public: @@ -8143,6 +7913,22 @@ extern _d_real cimagl(complex_t x); extern void browse(const char* url); +template +struct Optional final +{ + T value; + bool present; + Optional(T value); + static Optional create(T val); + bool isPresent() const; + bool isEmpty() const; + T get(); + bool hasValue(T exp) const; + Optional() + { + } +}; + enum class IdentifierTable { UAX31 = 0, @@ -8391,6 +8177,7 @@ struct Param final bool addMain; bool allInst; bool bitfields; + bool nothrowOptimizations; CppStdRevision cplusplus; Help help; Verbose v; @@ -8412,10 +8199,12 @@ struct Param final bool fix16997; FeatureState dtorFields; FeatureState systemVariables; + bool useFastDFA; CHECKENABLE useInvariants; CHECKENABLE useIn; CHECKENABLE useOut; CHECKENABLE useArrayBounds; + CHECKENABLE useNullCheck; CHECKENABLE useAssert; CHECKENABLE useSwitchError; CHECKENABLE boundscheck; @@ -8481,6 +8270,7 @@ struct Param final addMain(), allInst(), bitfields(true), + nothrowOptimizations(), cplusplus((CppStdRevision)201103u), help(), v(), @@ -8493,10 +8283,12 @@ struct Param final shortenedMethods(true), fixImmutableConv(), fix16997(true), + useFastDFA(), useInvariants((CHECKENABLE)0u), useIn((CHECKENABLE)0u), useOut((CHECKENABLE)0u), useArrayBounds((CHECKENABLE)0u), + useNullCheck((CHECKENABLE)0u), useAssert((CHECKENABLE)0u), useSwitchError((CHECKENABLE)0u), boundscheck((CHECKENABLE)0u), @@ -8537,7 +8329,7 @@ struct Param final timeTraceFile() { } - Param(bool obj, bool readStdin = false, bool multiobj = false, bool trace = false, bool tracegc = false, bool vcg_ast = false, DiagnosticReporting useDeprecated = (DiagnosticReporting)1u, bool useUnitTests = false, bool useInline = false, bool release = false, bool preservePaths = false, DiagnosticReporting useWarnings = (DiagnosticReporting)2u, bool cov = false, uint8_t covPercent = 0u, bool ctfe_cov = false, bool ignoreUnsupportedPragmas = true, bool useModuleInfo = true, bool useTypeInfo = true, bool useExceptions = true, bool useGC = true, bool betterC = false, bool addMain = false, bool allInst = false, bool bitfields = true, CppStdRevision cplusplus = (CppStdRevision)201103u, Help help = Help(), Verbose v = Verbose(), Edition edition = (Edition)2023u, void* editionFiles = nullptr, FeatureState useDIP25 = (FeatureState)2u, FeatureState useDIP1000 = (FeatureState)0u, bool ehnogc = false, bool useDIP1021 = false, FeatureState fieldwise = (FeatureState)0u, bool fixAliasThis = false, FeatureState rvalueRefParam = (FeatureState)0u, FeatureState safer = (FeatureState)0u, FeatureState noSharedAccess = (FeatureState)0u, bool previewIn = false, bool inclusiveInContracts = false, bool shortenedMethods = true, bool fixImmutableConv = false, bool fix16997 = true, FeatureState dtorFields = (FeatureState)0u, FeatureState systemVariables = (FeatureState)0u, CHECKENABLE useInvariants = (CHECKENABLE)0u, CHECKENABLE useIn = (CHECKENABLE)0u, CHECKENABLE useOut = (CHECKENABLE)0u, CHECKENABLE useArrayBounds = (CHECKENABLE)0u, CHECKENABLE useAssert = (CHECKENABLE)0u, CHECKENABLE useSwitchError = (CHECKENABLE)0u, CHECKENABLE boundscheck = (CHECKENABLE)0u, CHECKACTION checkAction = (CHECKACTION)0u, CLIIdentifierTable dIdentifierTable = (CLIIdentifierTable)0u, CLIIdentifierTable cIdentifierTable = (CLIIdentifierTable)0u, _d_dynamicArray< const char > argv0 = {}, Array modFileAliasStrings = Array(), Array imppath = Array(), Array fileImppath = Array(), _d_dynamicArray< const char > objdir = {}, _d_dynamicArray< const char > objname = {}, _d_dynamicArray< const char > libname = {}, Output ddoc = Output(), Output dihdr = Output(), Output cxxhdr = Output(), Output json = Output(), JsonFieldFlags jsonFieldFlags = (JsonFieldFlags)0u, Output makeDeps = Output(), Output mixinOut = Output(), Output moduleDeps = Output(), bool debugEnabled = false, bool run = false, Array runargs = Array(), Array cppswitches = Array(), const char* cpp = nullptr, Array objfiles = Array(), Array linkswitches = Array(), Array linkswitchIsForCC = Array(), Array libfiles = Array(), Array dllfiles = Array(), _d_dynamicArray< const char > deffile = {}, _d_dynamicArray< const char > resfile = {}, _d_dynamicArray< const char > exefile = {}, _d_dynamicArray< const char > mapfile = {}, bool fullyQualifiedObjectFiles = false, bool timeTrace = false, uint32_t timeTraceGranularityUs = 500u, const char* timeTraceFile = nullptr) : + Param(bool obj, bool readStdin = false, bool multiobj = false, bool trace = false, bool tracegc = false, bool vcg_ast = false, DiagnosticReporting useDeprecated = (DiagnosticReporting)1u, bool useUnitTests = false, bool useInline = false, bool release = false, bool preservePaths = false, DiagnosticReporting useWarnings = (DiagnosticReporting)2u, bool cov = false, uint8_t covPercent = 0u, bool ctfe_cov = false, bool ignoreUnsupportedPragmas = true, bool useModuleInfo = true, bool useTypeInfo = true, bool useExceptions = true, bool useGC = true, bool betterC = false, bool addMain = false, bool allInst = false, bool bitfields = true, bool nothrowOptimizations = false, CppStdRevision cplusplus = (CppStdRevision)201103u, Help help = Help(), Verbose v = Verbose(), Edition edition = (Edition)2023u, void* editionFiles = nullptr, FeatureState useDIP25 = (FeatureState)2u, FeatureState useDIP1000 = (FeatureState)0u, bool ehnogc = false, bool useDIP1021 = false, FeatureState fieldwise = (FeatureState)0u, bool fixAliasThis = false, FeatureState rvalueRefParam = (FeatureState)0u, FeatureState safer = (FeatureState)0u, FeatureState noSharedAccess = (FeatureState)0u, bool previewIn = false, bool inclusiveInContracts = false, bool shortenedMethods = true, bool fixImmutableConv = false, bool fix16997 = true, FeatureState dtorFields = (FeatureState)0u, FeatureState systemVariables = (FeatureState)0u, bool useFastDFA = false, CHECKENABLE useInvariants = (CHECKENABLE)0u, CHECKENABLE useIn = (CHECKENABLE)0u, CHECKENABLE useOut = (CHECKENABLE)0u, CHECKENABLE useArrayBounds = (CHECKENABLE)0u, CHECKENABLE useNullCheck = (CHECKENABLE)0u, CHECKENABLE useAssert = (CHECKENABLE)0u, CHECKENABLE useSwitchError = (CHECKENABLE)0u, CHECKENABLE boundscheck = (CHECKENABLE)0u, CHECKACTION checkAction = (CHECKACTION)0u, CLIIdentifierTable dIdentifierTable = (CLIIdentifierTable)0u, CLIIdentifierTable cIdentifierTable = (CLIIdentifierTable)0u, _d_dynamicArray< const char > argv0 = {}, Array modFileAliasStrings = Array(), Array imppath = Array(), Array fileImppath = Array(), _d_dynamicArray< const char > objdir = {}, _d_dynamicArray< const char > objname = {}, _d_dynamicArray< const char > libname = {}, Output ddoc = Output(), Output dihdr = Output(), Output cxxhdr = Output(), Output json = Output(), JsonFieldFlags jsonFieldFlags = (JsonFieldFlags)0u, Output makeDeps = Output(), Output mixinOut = Output(), Output moduleDeps = Output(), bool debugEnabled = false, bool run = false, Array runargs = Array(), Array cppswitches = Array(), const char* cpp = nullptr, Array objfiles = Array(), Array linkswitches = Array(), Array linkswitchIsForCC = Array(), Array libfiles = Array(), Array dllfiles = Array(), _d_dynamicArray< const char > deffile = {}, _d_dynamicArray< const char > resfile = {}, _d_dynamicArray< const char > exefile = {}, _d_dynamicArray< const char > mapfile = {}, bool fullyQualifiedObjectFiles = false, bool timeTrace = false, uint32_t timeTraceGranularityUs = 500u, const char* timeTraceFile = nullptr) : obj(obj), readStdin(readStdin), multiobj(multiobj), @@ -8562,6 +8354,7 @@ struct Param final addMain(addMain), allInst(allInst), bitfields(bitfields), + nothrowOptimizations(nothrowOptimizations), cplusplus(cplusplus), help(help), v(v), @@ -8583,10 +8376,12 @@ struct Param final fix16997(fix16997), dtorFields(dtorFields), systemVariables(systemVariables), + useFastDFA(useFastDFA), useInvariants(useInvariants), useIn(useIn), useOut(useOut), useArrayBounds(useArrayBounds), + useNullCheck(useNullCheck), useAssert(useAssert), useSwitchError(useSwitchError), boundscheck(boundscheck), @@ -8666,7 +8461,7 @@ struct Global final const char* const versionChars(); Global() : inifilename(), - copyright(73, "Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved"), + copyright(73, "Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved"), written(24, "written by Walter Bright"), path(), importPaths(), @@ -8690,7 +8485,7 @@ struct Global final preprocess() { } - Global(_d_dynamicArray< const char > inifilename, _d_dynamicArray< const char > copyright = { 73, "Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved" }, _d_dynamicArray< const char > written = { 24, "written by Walter Bright" }, Array path = Array(), Array importPaths = Array(), Array filePath = Array(), CompileEnv compileEnv = CompileEnv(), Param params = Param(), uint32_t errors = 0u, uint32_t deprecations = 0u, uint32_t warnings = 0u, uint32_t gag = 0u, uint32_t gaggedErrors = 0u, uint32_t gaggedDeprecations = 0u, void* console = nullptr, Array versionids = Array(), Array debugids = Array(), bool hasMainFunction = false, uint32_t varSequenceNumber = 1u, FileManager* fileManager = nullptr, ErrorSink* errorSink = nullptr, ErrorSink* errorSinkNull = nullptr, DArray(*preprocess)(FileName , Loc , OutBuffer& ) = nullptr) : + Global(_d_dynamicArray< const char > inifilename, _d_dynamicArray< const char > copyright = { 73, "Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved" }, _d_dynamicArray< const char > written = { 24, "written by Walter Bright" }, Array path = Array(), Array importPaths = Array(), Array filePath = Array(), CompileEnv compileEnv = CompileEnv(), Param params = Param(), uint32_t errors = 0u, uint32_t deprecations = 0u, uint32_t warnings = 0u, uint32_t gag = 0u, uint32_t gaggedErrors = 0u, uint32_t gaggedDeprecations = 0u, void* console = nullptr, Array versionids = Array(), Array debugids = Array(), bool hasMainFunction = false, uint32_t varSequenceNumber = 1u, FileManager* fileManager = nullptr, ErrorSink* errorSink = nullptr, ErrorSink* errorSinkNull = nullptr, DArray(*preprocess)(FileName , Loc , OutBuffer& ) = nullptr) : inifilename(inifilename), copyright(copyright), written(written), @@ -9010,6 +8805,7 @@ struct Id final static Identifier* isAbstractClass; static Identifier* isArithmetic; static Identifier* isAssociativeArray; + static Identifier* isOverlapped; static Identifier* isBitfield; static Identifier* isFinalClass; static Identifier* isTemplate; @@ -9075,6 +8871,7 @@ struct Id final static Identifier* isCopyable; static Identifier* toType; static Identifier* parameters; + static Identifier* needsDestruction; static Identifier* allocator; static Identifier* basic_string; static Identifier* basic_istream; @@ -9086,6 +8883,7 @@ struct Id final static Identifier* udaOptional; static Identifier* udaMustUse; static Identifier* udaStandalone; + static Identifier* udaSection; static Identifier* TRUE; static Identifier* FALSE; static Identifier* ImportC; @@ -9115,6 +8913,7 @@ struct Id final static Identifier* undef; static Identifier* ident; static Identifier* packed; + static Identifier* op; static void initialize(); Id() { diff --git a/dmd/func.d b/dmd/func.d index 6709e32ebb0..02c3c237871 100644 --- a/dmd/func.d +++ b/dmd/func.d @@ -8,7 +8,7 @@ * - `invariant` * - `unittest` * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/func.d, _func.d) @@ -23,30 +23,19 @@ import core.stdc.string; import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; -import dmd.blockexit; -import dmd.dcast; import dmd.dclass; import dmd.declaration; -import dmd.delegatize; -import dmd.dmodule; -import dmd.dscope; -import dmd.dstruct; import dmd.dsymbol; import dmd.dtemplate; -import dmd.escape; -import dmd.expression; import dmd.globals; import dmd.hdrgen; import dmd.id; import dmd.identifier; -import dmd.init; import dmd.location; import dmd.mtype; import dmd.objc; import dmd.common.outbuffer; import dmd.rootobject; -import dmd.root.string; -import dmd.root.stringtable; import dmd.statement; import dmd.targetcompiler; import dmd.tokens; @@ -215,6 +204,40 @@ private struct ContractInfo Expressions* fdensureParams; /// argument list for __ensure } +/// Information for data flow analysis regarding parameters +extern(D) struct ParametersDFAInfo +{ + ParameterDFAInfo thisPointer; + ParameterDFAInfo returnValue; + ParameterDFAInfo[] parameters; +} + +/// Information for data flow analysis per parameter +extern(D) struct ParameterDFAInfo +{ + /// Parameter id: -1 this, -2 return, otherwise it is FuncDeclaration.parameters index + int parameterId; + + /// Is the parameter non-null upon input, only applies to pointers. + Fact notNullIn; + /// Is the parameter non-null, applies only for by-ref parameters that are pointers. + Fact notNullOut; + + /// Was the attributes for this parameter specified by the user? + bool specifiedByUser; + + /// Given a property, has it been specificed and is it guaranteed? + enum Fact : ubyte + { + /// + Unspecified, + /// + NotGuaranteed, + /// + Guaranteed + } +} + /*********************************************************** */ extern (C++) class FuncDeclaration : Declaration @@ -325,6 +348,8 @@ version (IN_LLVM) {} else AttributeViolation* pureViolation; AttributeViolation* nothrowViolation; + ParametersDFAInfo* parametersDFAInfo; + /// See the `FUNCFLAG` struct import dmd.common.bitfields; mixin(generateBitFields!(FUNCFLAG, uint)); @@ -355,8 +380,13 @@ version (IN_LLVM) {} else /* The type given for "infer the return type" is a TypeFunction with * NULL for the return type. */ - if (type && type.nextOf() is null) - this.inferRetType = true; + if (type) + { + if (auto tf = type.isTypeFunction()) + this.inferRetType = tf.next is null; + else + assert(0); // unreachable + } } static FuncDeclaration create(Loc loc, Loc endloc, Identifier id, StorageClass storage_class, Type type, bool noreturn = false) @@ -653,46 +683,6 @@ version (IN_LLVM) return toAliasFunc().isThis() !is null; } - // Determine if a function is pedantically virtual - final bool isVirtualMethod() - { - if (toAliasFunc() != this) - return toAliasFunc().isVirtualMethod(); - - //printf("FuncDeclaration::isVirtualMethod() %s\n", toChars()); - if (!isVirtual()) - return false; - // If it's a final method, and does not override anything, then it is not virtual - if (isFinalFunc() && foverrides.length == 0) - { - return false; - } - return true; - } - - // Determine if function goes into virtual function pointer table - bool isVirtual() const - { - if (toAliasFunc() != this) - return toAliasFunc().isVirtual(); - - auto p = toParent(); - - if (!isMember || !p.isClassDeclaration) - return false; - - if (p.isClassDeclaration.classKind == ClassKind.objc) - return .objc.isVirtual(this); - - version (none) - { - printf("FuncDeclaration::isVirtual(%s)\n", toChars()); - printf("isMember:%p isStatic:%d private:%d ctor:%d !Dlinkage:%d\n", isMember(), isStatic(), visibility == Visibility.Kind.private_, isCtorDeclaration(), linkage != LINK.d); - printf("result is %d\n", isMember() && !(isStatic() || visibility == Visibility.Kind.private_ || visibility == Visibility.Kind.package_) && p.isClassDeclaration() && !(p.isInterfaceDeclaration() && isFinalFunc())); - } - return !(isStatic() || visibility.kind == Visibility.Kind.private_ || visibility.kind == Visibility.Kind.package_) && !(p.isInterfaceDeclaration() && isFinalFunc()); - } - final bool isFinalFunc() const { if (toAliasFunc() != this) @@ -715,55 +705,11 @@ version (IN_LLVM) return (cd !is null) && (cd.storage_class & STC.final_); } - bool addPreInvariant() - { - auto ad = isThis(); - return (ad && global.params.useInvariants == CHECKENABLE.on && (visibility.kind == Visibility.Kind.protected_ || visibility.kind == Visibility.Kind.public_ || visibility.kind == Visibility.Kind.export_) && !this.isNaked); - } - - bool addPostInvariant() - { - auto ad = isThis(); - return (ad && ad.inv && global.params.useInvariants == CHECKENABLE.on && (visibility.kind == Visibility.Kind.protected_ || visibility.kind == Visibility.Kind.public_ || visibility.kind == Visibility.Kind.export_) && !this.isNaked); - } - override const(char)* kind() const { return this.isGenerated ? "generated function" : "function"; } - /*********************************************** - * Determine if function's variables are referenced by a function - * nested within it. - */ - final bool hasNestedFrameRefs() - { - if (closureVars.length) - return true; - - /* If a virtual function has contracts, assume its variables are referenced - * by those contracts, even if they aren't. Because they might be referenced - * by the overridden or overriding function's contracts. - * This can happen because frequire and fensure are implemented as nested functions, - * and they can be called directly by an overriding function and the overriding function's - * context had better match, or - * https://issues.dlang.org/show_bug.cgi?id=7335 will bite. - */ - if (fdrequire || fdensure) - return true; - - if (foverrides.length && isVirtualMethod()) - { - for (size_t i = 0; i < foverrides.length; i++) - { - FuncDeclaration fdv = foverrides[i]; - if (fdv.hasNestedFrameRefs()) - return true; - } - } - return false; - } - /********************************************* * Returns: the function's parameter list, and whether * it is variadic or not. @@ -779,46 +725,6 @@ version (IN_LLVM) return ParameterList(null, VarArg.none); } - /********************************** - * Generate a FuncDeclaration for a runtime library function. - */ - extern(D) static FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, STC stc = STC.none) - { - return genCfunc(fparams, treturn, Identifier.idPool(name[0 .. strlen(name)]), stc); - } - - extern(D) static FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, STC stc = STC.none) - { - FuncDeclaration fd; - TypeFunction tf; - Dsymbol s; - __gshared DsymbolTable st = null; - - //printf("genCfunc(name = '%s')\n", id.toChars()); - //printf("treturn\n\t"); treturn.print(); - - // See if already in table - if (!st) - st = new DsymbolTable(); - s = st.lookup(id); - if (s) - { - fd = s.isFuncDeclaration(); - assert(fd); - assert(fd.type.nextOf().equals(treturn)); - } - else - { - tf = new TypeFunction(ParameterList(fparams), treturn, LINK.c, stc); - fd = new FuncDeclaration(Loc.initial, Loc.initial, id, STC.static_, tf); - fd.visibility = Visibility(Visibility.Kind.public_); - fd._linkage = LINK.c; - - st.insert(fd); - } - return fd; - } - inout(FuncDeclaration) toAliasFunc() inout @safe { return this; @@ -1001,21 +907,6 @@ extern (C++) final class FuncLiteralDeclaration : FuncDeclaration return tok == TOK.delegate_ ? super.isThis() : null; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return false; - } - override const(char)* kind() const { // GCC requires the (char*) casts @@ -1065,21 +956,6 @@ extern (C++) final class CtorDeclaration : FuncDeclaration isMoveCtor ? "move constructor" : "constructor"; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return (isThis() && vthis && global.params.useInvariants == CHECKENABLE.on); - } - override void accept(Visitor v) { v.visit(this); @@ -1104,21 +980,6 @@ extern (C++) final class PostBlitDeclaration : FuncDeclaration return dd; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return (isThis() && vthis && global.params.useInvariants == CHECKENABLE.on); - } - override void accept(Visitor v) { v.visit(this); @@ -1154,23 +1015,6 @@ extern (C++) final class DtorDeclaration : FuncDeclaration return "destructor"; } - override bool isVirtual() const - { - // D dtor's don't get put into the vtbl[] - // this is a hack so that extern(C++) destructors report as virtual, which are manually added to the vtable - return vtblIndex != -1; - } - - override bool addPreInvariant() - { - return (isThis() && vthis && global.params.useInvariants == CHECKENABLE.on); - } - - override bool addPostInvariant() - { - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -1206,21 +1050,6 @@ extern (C++) class StaticCtorDeclaration : FuncDeclaration return null; } - override final bool isVirtual() const @nogc nothrow pure @safe - { - return false; - } - - override final bool addPreInvariant() @nogc nothrow pure @safe - { - return false; - } - - override final bool addPostInvariant() @nogc nothrow pure @safe - { - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -1285,21 +1114,6 @@ extern (C++) class StaticDtorDeclaration : FuncDeclaration return null; } - override final bool isVirtual() const - { - return false; - } - - override final bool addPreInvariant() - { - return false; - } - - override final bool addPostInvariant() - { - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -1350,34 +1164,10 @@ extern (C++) final class InvariantDeclaration : FuncDeclaration return id; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return false; - } - override void accept(Visitor v) { v.visit(this); } - - extern (D) void fixupInvariantIdent(size_t offset) - { - OutBuffer idBuf; - idBuf.writestring("__invariant"); - idBuf.print(offset); - - ident = Identifier.idPool(idBuf[]); - } } @@ -1410,21 +1200,6 @@ extern (C++) final class UnitTestDeclaration : FuncDeclaration return null; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -1454,21 +1229,6 @@ extern (C++) final class NewDeclaration : FuncDeclaration return "allocator"; } - override bool isVirtual() const - { - return false; - } - - override bool addPreInvariant() - { - return false; - } - - override bool addPostInvariant() - { - return false; - } - override void accept(Visitor v) { v.visit(this); @@ -1492,6 +1252,8 @@ struct AttributeViolation string action; /// Action that made the attribute fail to get inferred + VarDeclaration scopeVar; /// For scope violations: the parameter whose scope status caused the issue + this(Loc loc, FuncDeclaration fd) { this.loc = loc; this.fd = fd; } this(Loc loc, const(char)* fmt, RootObject[] args) @@ -1507,4 +1269,10 @@ struct AttributeViolation ); this.action = buf.extractSlice(); } + + this(Loc loc, const(char)* fmt, VarDeclaration scopeVar, RootObject[] args) + { + this(loc, fmt, args); + this.scopeVar = scopeVar; + } } diff --git a/dmd/funcsem.d b/dmd/funcsem.d index 8045c9dee9e..1a906236953 100644 --- a/dmd/funcsem.d +++ b/dmd/funcsem.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/function.html, Functions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/funcsem.d, _funcsem.d) @@ -14,6 +14,7 @@ module dmd.funcsem; import core.stdc.stdio; +import core.stdc.string; import dmd.aggregate; import dmd.arraytypes; @@ -66,6 +67,235 @@ import dmd.typesem; import dmd.visitor; import dmd.visitor.statement_rewrite_walker; +bool addPostInvariant(FuncDeclaration _this) +{ + static bool visitFuncDeclaration(FuncDeclaration _this) + { + auto ad = _this.isThis(); + return ( + ad && + ad.inv && + global.params.useInvariants == CHECKENABLE.on && + (_this.visibility.kind == Visibility.Kind.protected_ || + _this.visibility.kind == Visibility.Kind.public_ || + _this.visibility.kind == Visibility.Kind.export_) && + !_this.isNaked + ); + } + + switch(_this.dsym) + { + case DSYM.funcLiteralDeclaration: + case DSYM.dtorDeclaration: + case DSYM.staticCtorDeclaration: + case DSYM.sharedStaticCtorDeclaration: + case DSYM.staticDtorDeclaration: + case DSYM.sharedStaticDtorDeclaration: + case DSYM.invariantDeclaration: + case DSYM.unitTestDeclaration: + case DSYM.newDeclaration: + return false; + case DSYM.ctorDeclaration: + { + auto cd = _this.isCtorDeclaration(); + return (cd.isThis() && cd.vthis && global.params.useInvariants == CHECKENABLE.on); + } + case DSYM.postBlitDeclaration: + { + auto dd = _this.isPostBlitDeclaration(); + return (dd.isThis() && dd.vthis && global.params.useInvariants == CHECKENABLE.on); + } + default: return visitFuncDeclaration(_this); + } +} + +bool addPreInvariant(FuncDeclaration _this) +{ + static bool visitFuncDeclaration(FuncDeclaration _this) + { + return ( + _this.isThis() && + global.params.useInvariants == CHECKENABLE.on && + (_this.visibility.kind == Visibility.Kind.protected_ || + _this.visibility.kind == Visibility.Kind.public_ || + _this.visibility.kind == Visibility.Kind.export_) && + !_this.isNaked + ); + } + + switch(_this.dsym) + { + case DSYM.funcLiteralDeclaration: + case DSYM.ctorDeclaration: + case DSYM.postBlitDeclaration: + case DSYM.staticCtorDeclaration: + case DSYM.sharedStaticCtorDeclaration: + case DSYM.staticDtorDeclaration: + case DSYM.sharedStaticDtorDeclaration: + case DSYM.invariantDeclaration: + case DSYM.unitTestDeclaration: + case DSYM.newDeclaration: + return false; + case DSYM.dtorDeclaration: + { + auto dd = _this.isDtorDeclaration(); + return (dd.isThis() && dd.vthis && global.params.useInvariants == CHECKENABLE.on); + } + default: return visitFuncDeclaration(_this); + } +} + +// Determine if function goes into virtual function pointer table +bool isVirtual(const FuncDeclaration _this) +{ + static bool visitFuncDeclaration(const FuncDeclaration _this) + { + if (_this.toAliasFunc() != _this) + return _this.toAliasFunc().isVirtual(); + + auto p = _this.toParent(); + + if (!_this.isMember || !p.isClassDeclaration) + return false; + + if (p.isClassDeclaration.classKind == ClassKind.objc) + return objc.isVirtual(_this); + + version (none) + { + printf("FuncDeclaration::isVirtual(%s)\n", _this.toChars()); + printf("isMember:%p isStatic:%d private:%d ctor:%d !Dlinkage:%d\n", + _this.isMember(), + _this.isStatic(), + _this.visibility.kind == Visibility.Kind.private_, + _this.isCtorDeclaration() !is null, + _this._linkage != LINK.d + ); + printf("result is %d\n", + _this.isMember() && + !(_this.isStatic() || _this.visibility.kind == Visibility.Kind.private_ || _this.visibility.kind == Visibility.Kind.package_) && + p.isClassDeclaration() && + !(p.isInterfaceDeclaration() && _this.isFinalFunc()) + ); + } + + return !(_this.isStatic() || + _this.visibility.kind == Visibility.Kind.private_ || + _this.visibility.kind == Visibility.Kind.package_) && + !(p.isInterfaceDeclaration() && _this.isFinalFunc()); + } + + switch(_this.dsym) + { + case DSYM.funcLiteralDeclaration: + case DSYM.ctorDeclaration: + case DSYM.postBlitDeclaration: + case DSYM.staticCtorDeclaration: + case DSYM.sharedStaticCtorDeclaration: + case DSYM.staticDtorDeclaration: + case DSYM.sharedStaticDtorDeclaration: + case DSYM.invariantDeclaration: + case DSYM.unitTestDeclaration: + case DSYM.newDeclaration: + return false; + // D dtor's don't get put into the vtbl[] + // this is a hack so that extern(C++) destructors report as virtual + // which are manually added to the vtable + case DSYM.dtorDeclaration: return _this.vtblIndex != -1; + default: return visitFuncDeclaration(_this); + } +} + +// Determine if a function is pedantically virtual +bool isVirtualMethod(FuncDeclaration _this) +{ + if (_this.toAliasFunc() != _this) + return _this.toAliasFunc().isVirtualMethod(); + + //printf("FuncDeclaration::isVirtualMethod() %s\n", toChars()); + if (!_this.isVirtual()) + return false; + + // If it's a final method, and does not override anything, then it is not virtual + if (_this.isFinalFunc() && _this.foverrides.length == 0) + { + return false; + } + return true; +} + +/*********************************************** + * Determine if function's variables are referenced by a function + * nested within it. + */ +bool hasNestedFrameRefs(FuncDeclaration _this) +{ + if (_this.closureVars.length) + return true; + + /* If a virtual function has contracts, assume its variables are referenced + * by those contracts, even if they aren't. Because they might be referenced + * by the overridden or overriding function's contracts. + * This can happen because frequire and fensure are implemented as nested functions, + * and they can be called directly by an overriding function and the overriding function's + * context had better match, or + * https://issues.dlang.org/show_bug.cgi?id=7335 will bite. + */ + if (_this.fdrequire || _this.fdensure) + return true; + + if (_this.foverrides.length && _this.isVirtualMethod()) + { + for (size_t i = 0; i < _this.foverrides.length; i++) + { + FuncDeclaration fdv = _this.foverrides[i]; + if (fdv.hasNestedFrameRefs()) + return true; + } + } + return false; +} + +/********************************** + * Generate a FuncDeclaration for a runtime library function. + */ +FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, STC stc = STC.none) +{ + return genCfunc(fparams, treturn, Identifier.idPool(name[0 .. strlen(name)]), stc); +} + +FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, STC stc = STC.none) +{ + FuncDeclaration fd; + TypeFunction tf; + Dsymbol s; + __gshared DsymbolTable st = null; + + //printf("genCfunc(name = '%s')\n", id.toChars()); + //printf("treturn\n\t"); treturn.print(); + + // See if already in table + if (!st) + st = new DsymbolTable(); + s = st.lookup(id); + if (s) + { + fd = s.isFuncDeclaration(); + assert(fd); + assert(fd.type.nextOf().equals(treturn)); + } + else + { + tf = new TypeFunction(ParameterList(fparams), treturn, LINK.c, stc); + fd = new FuncDeclaration(Loc.initial, Loc.initial, id, STC.static_, tf); + fd.visibility = Visibility(Visibility.Kind.public_); + fd._linkage = LINK.c; + + st.insert(fd); + } + return fd; +} + /* Tweak all return statements and dtor call for nrvo_var, for correct NRVO. */ extern (C++) final class NrvoWalker : StatementRewriteWalker @@ -526,7 +756,7 @@ version (IN_LLVM) auto fnext = funcdecl.overnext.isFuncDeclaration(); funcDeclarationSemantic(sc, fnext); auto fn = fnext.type.isTypeFunction(); - if (!fn || !cFuncEquivalence(f, fn)) + if (!fn || !cFuncEquivalence(f, fn) || !cTypeEquivalence(f.next, fn.next)) { .error(funcdecl.loc, "%s `%s` redeclaration with different type", funcdecl.kind, funcdecl.toPrettyChars); //printf("t1: %s\n", f.toChars()); @@ -1185,8 +1415,8 @@ Linterfaces: functionToBufferFull(cast(TypeFunction)(fd.type), buf1, new Identifier(fd.toPrettyChars()), hgs, null); - error(funcdecl.loc, "function `%s` does not override any function, did you mean to override `%s`?", - funcdeclToChars, buf1.peekChars()); + error(funcdecl.loc, "function `%s` does not override any function", funcdeclToChars); + errorSupplemental(fd.loc, "did you mean to override `%s`?", buf1.peekChars()); // Supplemental error for parameter scope differences auto tf1 = cast(TypeFunction)funcdecl.type; @@ -1199,8 +1429,6 @@ Linterfaces: if (params1.length == params2.length) { - bool hasScopeDifference = false; - for (size_t i = 0; i < params1.length; i++) { auto p1 = params1[i]; @@ -1212,14 +1440,7 @@ Linterfaces: if (!(p2.storageClass & STC.scope_)) continue; - if (!hasScopeDifference) - { - // Intended signature - errorSupplemental(funcdecl.loc, "Did you intend to override:"); - errorSupplemental(funcdecl.loc, "`%s`", buf1.peekChars()); - hasScopeDifference = true; - } - errorSupplemental(funcdecl.loc, "Parameter %d is missing `scope`", + errorSupplemental(funcdecl.loc, "parameter %d is missing `scope`", cast(int)(i + 1)); } } @@ -1882,12 +2103,12 @@ FuncDeclaration resolveFuncCall(Loc loc, Scope* sc, Dsymbol s, } bool calledHelper; - void errorHelper(const(char)* failMessage) scope + void errorHelper(const(char)* failMessage, Loc argloc = Loc.initial) scope { .error(loc, "%s `%s%s%s` is not callable using argument types `%s`", fd.kind(), fd.toPrettyChars(), parametersTypeToChars(tf.parameterList), tf.modToChars(), fargsBuf.peekChars()); - errorSupplemental(loc, failMessage); + errorSupplemental((argloc !is Loc.initial) ? argloc : loc, failMessage); calledHelper = true; } @@ -1955,9 +2176,9 @@ FuncDeclaration resolveFuncCall(Loc loc, Scope* sc, Dsymbol s, } } - void errorHelper2(const(char)* failMessage) scope + void errorHelper2(const(char)* failMessage, Loc argloc = Loc.initial) scope { - errorSupplemental(loc, failMessage); + errorSupplemental((argloc !is Loc.initial) ? argloc : loc, failMessage); } functionResolve(m, orig_s, loc, sc, tiargs, tthis, argumentList, &errorHelper2); @@ -1976,7 +2197,7 @@ private void checkNamedArgErrorAndReport(TemplateDeclaration td, ArgumentList ar { if (!argumentList.hasArgNames()) return; - + td.computeOneMember(); auto tf = td.onemember ? td.onemember.isFuncDeclaration() : null; if (tf && tf.type && tf.type.ty == Tfunction) { @@ -2006,8 +2227,11 @@ private void checkNamedArgErrorAndReportOverload(Dsymbol od, ArgumentList argume if (auto fd = s.isFuncDeclaration()) tf = fd; else if (auto td = s.isTemplateDeclaration()) + { + td.computeOneMember(); if (td.onemember) tf = td.onemember.isFuncDeclaration(); + } } return 0; }); @@ -2087,6 +2311,7 @@ private void printCandidates(Decl)(Loc loc, Decl declaration, bool showDeprecate // td.onemember may not have overloads set // (see fail_compilation/onemember_overloads.d) // assume if more than one member it is overloaded internally + td.computeOneMember(); bool recurse = td.onemember && (!td.onemember.isFuncDeclaration || td.members.length > 1); OutBuffer buf; @@ -2551,6 +2776,7 @@ void buildResultVar(FuncDeclaration fd, Scope* sc, Type tret) * fbody.dsymbolSemantic() running, vresult.type might be modified. */ fd.vresult = new VarDeclaration(loc, tret, Id.result, null); + fd.vresult._init = new VoidInitializer(loc); // hdrgen requires _init fd.vresult.storage_class |= STC.nodtor | STC.temp; if (!fd.isVirtual()) fd.vresult.storage_class |= STC.const_; @@ -2561,8 +2787,10 @@ void buildResultVar(FuncDeclaration fd, Scope* sc, Type tret) if (sc && fd.vresult.semanticRun == PASS.initial) { TypeFunction tf = fd.type.toTypeFunction(); - if (tf.isRef) + if (fd.isNRVO || tf.isRef) fd.vresult.storage_class |= STC.ref_; + else if (target.isReturnOnStack(tf, fd.needThis())) + fd.vresult.nrvo = true; fd.vresult.type = tret; fd.vresult.dsymbolSemantic(sc); if (!sc.insert(fd.vresult)) @@ -3850,14 +4078,14 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco int overloadApplyRecurse(Dsymbol fstart, scope int delegate(Dsymbol) dg, Scope* sc) { - // Detect cyclic calls. - if (visited.contains(fstart)) - return 0; - visited.push(fstart); - Dsymbol next; for (auto d = fstart; d; d = next) { + // Detect cyclic calls. + if (visited.contains(d)) + return 0; + visited.push(d); + import dmd.access : checkSymbolAccess; if (auto od = d.isOverDeclaration()) { @@ -3914,6 +4142,13 @@ extern (D) int overloadApply(Dsymbol fstart, scope int delegate(Dsymbol) dg, Sco } else if (auto td = d.isTemplateDeclaration()) { + // Sometimes funcroot is not in the .overnext chain + // in such case we have to recurse into it + if(td.funcroot) + { + if (int r = overloadApplyRecurse(td.funcroot, dg, sc)) + return r; + } if (int r = dg(td)) return r; next = td.overnext; @@ -4055,16 +4290,43 @@ bool arrayBoundsCheck(FuncDeclaration fd) case CHECKENABLE.on: return true; case CHECKENABLE.safeonly: + if (fd) { + Type t = fd.type; + if (t.isTypeFunction() && t.isTypeFunction().trust == TRUST.safe) + return true; + } + return false; + case CHECKENABLE._default: + assert(0); + } +} + +/********************** + * Check to see if null dereference checking code has to be generated + * + * Params: + * fd = function for which code is to be generated + * Returns: + * true if do null dereference checking for the given function + */ +bool nullDerefCheck(FuncDeclaration fd) +{ + final switch (global.params.useNullCheck) + { + case CHECKENABLE.off: + return false; + case CHECKENABLE.on: + return true; + case CHECKENABLE.safeonly: if (fd) { Type t = fd.type; - if (t.ty == Tfunction && (cast(TypeFunction)t).trust == TRUST.safe) + if (t.isTypeFunction() && t.isTypeFunction().trust == TRUST.safe) return true; } return false; - } - case CHECKENABLE._default: - assert(0); + case CHECKENABLE._default: + assert(0); } } diff --git a/dmd/globals.d b/dmd/globals.d index 3150dc1cb28..11c71ffd2ee 100644 --- a/dmd/globals.d +++ b/dmd/globals.d @@ -1,7 +1,7 @@ /** * Stores command line options and contains other miscellaneous declarations. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/globals.d, _globals.d) @@ -216,6 +216,8 @@ extern (C++) struct Param bool addMain; // add a default main() function bool allInst; // generate code for all template instantiations bool bitfields = true; // support C style bit fields + bool nothrowOptimizations; // Allow finally statements that do not throw an Exception + // in try body to rewrite to a sequence. CppStdRevision cplusplus = CppStdRevision.cpp11; // version of C++ standard to support @@ -251,11 +253,13 @@ extern (C++) struct Param FeatureState dtorFields; // destruct fields of partially constructed objects // https://issues.dlang.org/show_bug.cgi?id=14246 FeatureState systemVariables; // limit access to variables marked @system from @safe code + bool useFastDFA; // Use fast data flow analysis engine CHECKENABLE useInvariants = CHECKENABLE._default; // generate class invariant checks CHECKENABLE useIn = CHECKENABLE._default; // generate precondition checks CHECKENABLE useOut = CHECKENABLE._default; // generate postcondition checks CHECKENABLE useArrayBounds = CHECKENABLE._default; // when to generate code for array bounds checks + CHECKENABLE useNullCheck = CHECKENABLE._default; // when to generate code for null dereference checks CHECKENABLE useAssert = CHECKENABLE._default; // when to generate code for assert()'s CHECKENABLE useSwitchError = CHECKENABLE._default; // check for switches without a default CHECKENABLE boundscheck = CHECKENABLE._default; // state of -boundscheck switch @@ -388,14 +392,18 @@ extern (C++) struct Global { const(char)[] inifilename; /// filename of configuration file as given by `-conf=`, or default value - string copyright = "Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved"; + string copyright = "Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved"; string written = "written by Walter Bright"; Array!(ImportPathInfo) path; /// Array of path informations which form the import lookup path Array!(const(char)*) importPaths; /// Array of char*'s which form the import lookup path without metadata Array!(const(char)*) filePath; /// Array of char*'s which form the file import lookup path - char[26] datetime; /// string returned by ctime() +version (IN_LLVM) {} else +{ + private enum string _version = import("VERSION"); +} + char[26] datetime; /// string returned by asctime() CompileEnv compileEnv; Param params; /// command line parameters @@ -513,15 +521,19 @@ else import core.stdc.stdlib : getenv; time_t ct; + const(char)* p; // https://issues.dlang.org/show_bug.cgi?id=20444 - if (auto p = getenv("SOURCE_DATE_EPOCH")) + if (auto epoch = getenv("SOURCE_DATE_EPOCH")) { - if (!ct.parseDigits(p[0 .. strlen(p)])) - errorSink.error(Loc.initial, "value of environment variable `SOURCE_DATE_EPOCH` should be a valid UNIX timestamp, not: `%s`", p); + if (!ct.parseDigits(epoch[0 .. strlen(epoch)])) + errorSink.error(Loc.initial, "value of environment variable `SOURCE_DATE_EPOCH` should be a valid UNIX timestamp, not: `%s`", epoch); + p = asctime(gmtime(&ct)); } else + { core.stdc.time.time(&ct); - const p = ctime(&ct); + p = ctime(&ct); // asctime(localtime(&ct)) + } assert(p); datetime[] = p[0 .. 26]; diff --git a/dmd/globals.h b/dmd/globals.h index bad8e9c4100..2f85ea88343 100644 --- a/dmd/globals.h +++ b/dmd/globals.h @@ -1,5 +1,5 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -77,6 +77,13 @@ enum JsonFieldFlags semantics = (1 << 3) }; +enum class Edition : uint16_t +{ + v2023 = 2023, + v2024, + v2025, +}; + enum CppStdRevision { CppStdRevisionCpp98 = 199711, @@ -226,12 +233,13 @@ struct Param d_bool addMain; // add a default main() function d_bool allInst; // generate code for all template instantiations d_bool bitfields; // support C style bit fields + d_bool nothrowOptimizations; CppStdRevision cplusplus; // version of C++ name mangling to support Help help; Verbose v; - unsigned short edition; // edition year + Edition edition; // edition year void* editionFiles; // Edition corresponding to a filespec // Options for `-preview=/-revert=` @@ -259,11 +267,13 @@ struct Param FeatureState dtorFields; // destruct fields of partially constructed objects // https://issues.dlang.org/show_bug.cgi?id=14246 FeatureState systemVariables; // limit access to variables marked @system from @safe code + d_bool useFastDFA; // Use fast data flow analysis engine CHECKENABLE useInvariants; // generate class invariant checks CHECKENABLE useIn; // generate precondition checks CHECKENABLE useOut; // generate postcondition checks CHECKENABLE useArrayBounds; // when to generate code for array bounds checks + CHECKENABLE useNullCheck; // when to generate code for null dereference checks CHECKENABLE useAssert; // when to generate code for assert()'s CHECKENABLE useSwitchError; // check for switches without a default CHECKENABLE boundscheck; // state of -boundscheck switch diff --git a/dmd/hdrgen.d b/dmd/hdrgen.d index 150b74cbf87..efd2aa4f8b5 100644 --- a/dmd/hdrgen.d +++ b/dmd/hdrgen.d @@ -3,7 +3,7 @@ * * Also used to convert AST nodes to D code in general, e.g. for error messages or `printf` debugging. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/hdrgen.d, _hdrgen.d) @@ -22,7 +22,6 @@ import dmd.arraytypes; import dmd.astenums; import dmd.attrib; import dmd.cond; -import dmd.ctfeexpr; import dmd.dclass; import dmd.declaration; import dmd.denum; @@ -50,7 +49,6 @@ import dmd.root.string; import dmd.statement; import dmd.staticassert; import dmd.tokens; -import dmd.typesem : castMod; import dmd.visitor; struct HdrGenState @@ -60,6 +58,7 @@ struct HdrGenState bool fullDump; /// true if generating a full AST dump file bool importcHdr; /// true if generating a .di file from an ImportC file bool inCAlias; /// Set to prevent ImportC translating typedefs as `alias X = X` + bool inFuncReturn; /// Set when printing function return type to avoid typedef name bool doFuncBodies; /// include function bodies in output bool vcg_ast; /// write out codegen-ast bool skipConstraints; // skip constraints when doing templates @@ -2215,7 +2214,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenSt void visitInteger(IntegerExp e) { - const ulong v = e.toInteger(); + const ulong v = e.value; if (e.type) { Type t = e.type; @@ -2230,7 +2229,7 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenSt { foreach (em; *sym.members) { - if ((cast(EnumMember)em).value.toInteger == v) + if ((cast(EnumMember)em).value.isIntegerExp().value == v) { const id = em.ident.toString(); buf.printf("%s.%.*s", sym.toChars(), cast(int)id.length, id.ptr); @@ -2807,6 +2806,9 @@ private void expressionPrettyPrint(Expression e, ref OutBuffer buf, ref HdrGenSt void visitAssert(AssertExp e) { + if (e.loweredFrom) + return e.loweredFrom.expressionPrettyPrint(buf, hgs); + buf.put("assert("); expToBuffer(e.e1, PREC.assign, buf, hgs); if (e.msg) @@ -3192,7 +3194,8 @@ void floatToBuffer(Type type, const real_t value, ref OutBuffer buf, const bool if (type) { - Type t = type.toBasetype(); + Type t = type.toBaseTypeNonSemantic(); + switch (t.ty) { case Tfloat32: @@ -3208,7 +3211,7 @@ void floatToBuffer(Type type, const real_t value, ref OutBuffer buf, const bool default: break; } - if (t.isImaginary()) + if (t.isImaginaryNonSemantic()) buf.put('i'); } } @@ -3821,7 +3824,7 @@ private void sizeToBuffer(Expression e, ref OutBuffer buf, ref HdrGenState hgs) { Expression ex = (e.op == EXP.cast_ ? (cast(CastExp)e).e1 : e); ex = ex.optimize(WANTvalue); - const ulong uval = ex.op == EXP.int64 ? ex.toInteger() : cast(ulong)-1; + const ulong uval = ex.op == EXP.int64 ? ex.isIntegerExp().value : cast(ulong)-1; if (cast(long)uval >= 0) { if (uval <= 0xFFFFU) @@ -4100,7 +4103,9 @@ private void visitFuncIdentWithPostfix(TypeFunction t, const char[] ident, ref O buf.write("static "); if (t.next) { + hgs.inFuncReturn = true; typeToBuffer(t.next, null, buf, hgs); + hgs.inFuncReturn = false; if (ident) buf.put(' '); } @@ -4169,7 +4174,9 @@ private void visitFuncIdentWithPrefix(TypeFunction t, const Identifier ident, Te } else if (t.next) { + hgs.inFuncReturn = true; typeToBuffer(t.next, null, buf, hgs); + hgs.inFuncReturn = false; if (ident) buf.put(' '); } @@ -4348,14 +4355,14 @@ private void typeToBufferx(Type t, ref OutBuffer buf, ref HdrGenState hgs) void visitDArray(TypeDArray t) { - Type ut = t.castMod(0); + auto basetype = t.next; if (hgs.declstring) goto L1; - if (ut.equals(Type.tstring)) + if (basetype.ty == Tchar && basetype.isImmutable()) buf.put("string"); - else if (ut.equals(Type.twstring)) + else if (basetype.ty == Twchar && basetype.isImmutable()) buf.put("wstring"); - else if (ut.equals(Type.tdstring)) + else if (basetype.ty == Tdchar && basetype.isImmutable()) buf.put("dstring"); else { @@ -4551,7 +4558,7 @@ private void typeToBufferx(Type t, ref OutBuffer buf, ref HdrGenState hgs) buf.put("noreturn"); } - if (hgs.importcHdr && !hgs.inCAlias && t.mcache && t.mcache.typedefIdent) + if (hgs.importcHdr && !hgs.inCAlias && !hgs.inFuncReturn && t.mcache && t.mcache.typedefIdent) { buf.put(t.mcache.typedefIdent.toString()); return; diff --git a/dmd/hdrgen.h b/dmd/hdrgen.h index 2bc355908d0..7c7fb764ec0 100644 --- a/dmd/hdrgen.h +++ b/dmd/hdrgen.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Dave Fladebo * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/iasm/gcc.d b/dmd/iasm/gcc.d index 4be94d76ad4..2f5d7aaf9f2 100644 --- a/dmd/iasm/gcc.d +++ b/dmd/iasm/gcc.d @@ -1,7 +1,7 @@ /** * Inline assembler for the GCC D compiler. * - * Copyright (C) 2018-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2018-2026 by The D Language Foundation, All Rights Reserved * Authors: Iain Buclaw * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasmgcc.d, _iasmgcc.d) @@ -30,6 +30,7 @@ import dmd.target; import dmd.tokens; import dmd.statement; import dmd.statementsem; +import dmd.typesem; /*********************************** * Parse and run semantic analysis on a GccAsmStatement. @@ -188,7 +189,8 @@ Expression semanticAsmString(Scope* sc, Expression exp, const char *s) { import dmd.dcast : implicitCastTo; import dmd.dsymbolsem : resolveAliasThis; - import dmd.mtype : isAggregate, Type; + import dmd.mtype : Type; + import dmd.typesem : isAggregate; exp = expressionSemantic(exp, sc); @@ -553,6 +555,7 @@ GccAsmStatement parseGccAsm(Parser)(Parser p, GccAsmStatement s) unittest { import dmd.mtype : TypeBasic; + import dmd.typesem : merge; if (!global.errorSink) global.errorSink = new ErrorSinkCompiler; @@ -560,7 +563,7 @@ unittest const errors = global.startGagging(); scope(exit) global.endGagging(errors); - // If this check fails, then Type._init() was called before reaching here, + // If this check fails, then Type_init() was called before reaching here, // and the entire chunk of code that follows can be removed. assert(ASTCodegen.Type.tint32 is null); // Minimally initialize the cached types in ASTCodegen.Type, as they are @@ -573,8 +576,10 @@ unittest ASTCodegen.Type.tchar = null; } scope tint32 = new TypeBasic(ASTCodegen.Tint32); + tint32.merge(); ASTCodegen.Type.tint32 = tint32; scope tchar = new TypeBasic(ASTCodegen.Tchar); + tchar.merge(); ASTCodegen.Type.tchar = tchar; // Imitates asmSemantic if version = IN_GCC. diff --git a/dmd/id.d b/dmd/id.d index 09191221939..d10499ccf93 100644 --- a/dmd/id.d +++ b/dmd/id.d @@ -1,7 +1,7 @@ /** * Contains the `Id` struct with a list of predefined symbols the compiler knows about. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/id.d, _id.d) @@ -418,6 +418,7 @@ immutable Msgtable[] msgtable = { "isAbstractClass" }, { "isArithmetic" }, { "isAssociativeArray" }, + { "isOverlapped" }, { "isBitfield" }, { "isFinalClass" }, { "isTemplate" }, @@ -483,6 +484,7 @@ immutable Msgtable[] msgtable = { "isCopyable" }, { "toType" }, { "parameters" }, + { "needsDestruction" }, // For C++ mangling { "allocator" }, @@ -498,6 +500,7 @@ immutable Msgtable[] msgtable = { "udaOptional", "optional"}, { "udaMustUse", "mustuse" }, { "udaStandalone", "standalone" }, + { "udaSection", "section" }, // Editions { "__edition_latest_do_not_use", }, @@ -541,6 +544,9 @@ immutable Msgtable[] msgtable = { "ident" }, { "packed" }, + // for inline assembler + { "op" }, + // IN_LLVM: LDC-specific pragmas { "LDC_intrinsic" }, { "LDC_no_typeinfo" }, @@ -577,7 +583,6 @@ immutable Msgtable[] msgtable = { "udaOptStrategy", "optStrategy" }, { "udaLLVMAttr", "llvmAttr" }, { "udaLLVMFastMathFlag", "llvmFastMathFlag" }, - { "udaSection", "section" }, { "udaTarget", "target" }, { "udaAssumeUsed", "_assumeUsed" }, { "udaCallingConvention", "callingConvention" }, diff --git a/dmd/id.h b/dmd/id.h index d465b6acb88..8db1bb7f0fc 100644 --- a/dmd/id.h +++ b/dmd/id.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2017-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2017-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/identifier.d b/dmd/identifier.d index 5f2deb9233d..64ffeb91529 100644 --- a/dmd/identifier.d +++ b/dmd/identifier.d @@ -1,7 +1,7 @@ /** * Defines an identifier, which is the name of a `Dsymbol`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/identifier.d, _identifier.d) diff --git a/dmd/identifier.h b/dmd/identifier.h index 02b55b6502d..9e88efc3a7a 100644 --- a/dmd/identifier.h +++ b/dmd/identifier.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/impcnvtab.d b/dmd/impcnvtab.d index b2ab919f1b2..767b7b23958 100644 --- a/dmd/impcnvtab.d +++ b/dmd/impcnvtab.d @@ -6,7 +6,7 @@ * Specification: $(LINK2 https://dlang.org/spec/type.html#integer-promotions, Integer Promotions), * $(LINK2 https://dlang.org/spec/type.html#usual-arithmetic-conversions, Usual Arithmetic Conversions). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/impcnvtab.d, _impcnvtab.d) diff --git a/dmd/imphint.d b/dmd/imphint.d index 1b2d51d7943..524d269cc1f 100644 --- a/dmd/imphint.d +++ b/dmd/imphint.d @@ -3,7 +3,7 @@ * * For example, prompt to `import std.stdio` when using `writeln`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/imphint.d, _imphint.d) diff --git a/dmd/import.h b/dmd/import.h index 06b212f0546..d0e81e23570 100644 --- a/dmd/import.h +++ b/dmd/import.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/importc.d b/dmd/importc.d index 9e2b108b753..6fc3a51731f 100644 --- a/dmd/importc.d +++ b/dmd/importc.d @@ -3,7 +3,7 @@ * * Specification: C11 * - * Copyright: Copyright (C) 2021-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 2021-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/importc.d, _importc.d) @@ -520,6 +520,10 @@ Dsymbol handleSymbolRedeclarations(ref Scope sc, Dsymbol s, Dsymbol s2, ScopeDsy sds.symtab.update(vd); // replace vd2 with the definition return vd; } + else if (!i1 && !(vd2.storage_class & STC.extern_)) /* incoming has void void definition */ + { + vd.storage_class |= STC.extern_; + } /* BUG: the types should match, which needs semantic() to be run on it * extern int x; @@ -528,7 +532,14 @@ Dsymbol handleSymbolRedeclarations(ref Scope sc, Dsymbol s, Dsymbol s2, ScopeDsy * INT x; // match * long x; // collision * We incorrectly ignore these collisions + * when their types are not matching, err on type differences */ + + if (!cTypeEquivalence(vd.type, vd2.type)) + { + .error(vd.loc, "redefinition of `%s` with different type: `%s` vs `%s`", + vd2.ident.toChars(), vd2.type.toChars(), vd.type.toChars()); + } return vd2; } @@ -564,7 +575,7 @@ Dsymbol handleSymbolRedeclarations(ref Scope sc, Dsymbol s, Dsymbol s2, ScopeDsy if (fd.fbody) // fd is the definition { if (log) printf(" replace existing with new\n"); - sds.symtab.update(fd); // replace fd2 in symbol table with fd + sds.symtab.update(fd); // replace fd2 in symbol table with fd fd.overnext = fd2; /* If fd2 is covering a tag symbol, then fd has to cover the same one @@ -581,6 +592,15 @@ Dsymbol handleSymbolRedeclarations(ref Scope sc, Dsymbol s, Dsymbol s2, ScopeDsy */ fd2.overloadInsert(fd); + //for the sake of functions declared in function scope. + // check for return type equivalence also + auto tf1 = fd.type.isTypeFunction(); + auto tf2 = fd2.type.isTypeFunction(); + if (sc.func && !cTypeEquivalence(tf1.next, tf2.next) ) + { + .error(fd.loc, "%s `%s` redeclaration with different type", fd.kind, fd.toPrettyChars); + } + return fd2; } @@ -611,7 +631,7 @@ void cEnumSemantic(Scope* sc, EnumDeclaration ed) // C11 6.7.2.2-2 value must be representable as an int. // The sizemask represents all values that int will fit into, // from 0..uint.max. We want to cover int.min..uint.max. - IntRange ir = IntRange.fromType(commonType); + IntRange ir = intRangeFromType(commonType); void emSemantic(EnumMember em, ref ulong nextValue) { diff --git a/dmd/init.d b/dmd/init.d index 55fb6f34856..9a118bb3d65 100644 --- a/dmd/init.d +++ b/dmd/init.d @@ -1,7 +1,7 @@ /** * Defines initializers of variables, e.g. the array literal in `int[3] x = [0, 1, 2]`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/init.d, _init.d) diff --git a/dmd/init.h b/dmd/init.h index a832b9ed4de..142af9c7361 100644 --- a/dmd/init.h +++ b/dmd/init.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/initsem.d b/dmd/initsem.d index 9e23f3719c2..644577f72af 100644 --- a/dmd/initsem.d +++ b/dmd/initsem.d @@ -1,7 +1,7 @@ /** * Semantic analysis of initializers. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/initsem.d, _initsem.d) @@ -14,8 +14,6 @@ module dmd.initsem; import core.stdc.stdio; import core.checkedint; -import dmd.aggregate; -import dmd.aliasthis; import dmd.arraytypes; import dmd.astenums; import dmd.dcast; @@ -424,6 +422,26 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn if (i.exp.op == EXP.type) { error(i.exp.loc, "initializer must be an expression, not `%s`", i.exp.toChars()); + // If the error location differs from the initializer location, show where it was used + if (i.exp.loc != i.loc) + errorSupplemental(i.loc, "used in initialization here"); + // If the type is a struct or class, suggest adding () to construct an instance + if (auto ts = i.exp.type.isTypeStruct()) + { + // Check if the struct can be default-constructed (no required args) + if (!ts.sym.hasCopyCtor && (!ts.sym.ctor || ts.sym.defaultCtor)) + errorSupplemental(i.exp.loc, "perhaps use `%s()` to construct a value of the type", i.exp.toChars()); + else if (ts.sym.ctor && !ts.sym.hasCopyCtor) + errorSupplemental(i.exp.loc, "perhaps use `%s(...)` to construct a value of the type", i.exp.toChars()); + } + else if (auto tc = i.exp.type.isTypeClass()) + { + // Check if the class can be default-constructed + if (!tc.sym.noDefaultCtor && (!tc.sym.ctor || tc.sym.defaultCtor)) + errorSupplemental(i.exp.loc, "perhaps use `new %s()` to construct a value of the type", i.exp.toChars()); + else if (tc.sym.ctor) + errorSupplemental(i.exp.loc, "perhaps use `new %s(...)` to construct a value of the type", i.exp.toChars()); + } return err(); } // Make sure all pointers are constants @@ -449,11 +467,17 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn Type typeb = se.type.toBasetype(); TY tynto = tb.nextOf().ty; if (!se.committed && - typeb.isStaticOrDynamicArray() && tynto.isSomeChar && - se.numberOfCodeUnits(tynto) < tb.isTypeSArray().dim.toInteger()) + typeb.isStaticOrDynamicArray() && tynto.isSomeChar) { - i.exp = se.castTo(sc, t); - goto L1; + string s; + size_t len = se.numberOfCodeUnits(tynto, s); + if (s) + error(se.loc, "%.*s", cast(int)s.length, s.ptr); + if (len < tb.isTypeSArray().dim.toInteger()) + { + i.exp = se.castTo(sc, t); + goto L1; + } } /* Lop off terminating 0 of initializer for: @@ -617,7 +641,6 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn static if (0) if (auto ts = tx.isTypeStruct()) { - import dmd.common.outbuffer; OutBuffer buf; HdrGenState hgs; toCBuffer(ts.sym, buf, hgs); @@ -628,6 +651,19 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn */ t = t.toBasetype(); + bool isComplexInitilaizer() + { + switch (t.ty) + { + case Tcomplex32: + case Tcomplex64: + case Tcomplex80: + return true; + default: + return false; + } + } + if (auto tv = t.isTypeVector()) t = tv.basetype; @@ -1143,6 +1179,24 @@ Initializer initializerSemantic(Initializer init, Scope* sc, ref Type tx, NeedIn { return visitExp(ei); } + else if (isComplexInitilaizer()) + { + /* just convert _Complex = { a, b} to _Complex =. a + b*i */ + if (ci.initializerList[].length != 2) + { + error(ci.loc, "only two initializers required for complex type `%s`", t.toChars()); + return err(); + } + auto rexp = ci.initializerList[0].initializer.initializerToExpression(); + auto imexp = ci.initializerList[1].initializer.initializerToExpression(); + + import dmd.root.ctfloat; + auto newExpr = new AddExp(ci.loc, rexp, + new MulExp(ci.loc, imexp, new RealExp(ci.loc, CTFloat.one, Type.timaginary64))); + + auto ce = new ExpInitializer(ci.loc, newExpr); + return ce.initializerSemantic(sc, t, needInterpret); + } else { error(ci.loc, "unrecognized C initializer `%s` for type `%s`", toChars(ci), t.toChars()); diff --git a/dmd/inline.d b/dmd/inline.d index dcb55014c6d..37ab7f4aca8 100644 --- a/dmd/inline.d +++ b/dmd/inline.d @@ -4,7 +4,7 @@ * The AST is traversed, and every function call is considered for inlining using `inlinecost.d`. * The function call is then inlined if this cost is below a threshold. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/inline.d, _inline.d) @@ -26,10 +26,10 @@ import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; -import dmd.dsymbolsem : include, toAlias, toParentP, followInstantiationContext, runDeferredSemantic3; +import dmd.dsymbolsem; import dmd.dtemplate; import dmd.expression; -import dmd.expressionsem : semanticTypeInfo; +import dmd.expressionsem : canElideCopy, semanticTypeInfo; import dmd.errors : message; import dmd.errorsink; import dmd.func; @@ -46,45 +46,40 @@ import dmd.opover; import dmd.printast; import dmd.statement; import dmd.tokens; -import dmd.typesem : pointerTo, sarrayOf; +import dmd.typesem; import dmd.visitor; import dmd.visitor.postorder; import dmd.inlinecost; /*********************************************************** - * Scan function implementations in Module m looking for functions that can be inlined, + * Scan for always-inline functions in Module m to be inlined, * and inline them in situ. * * Params: * m = module to scan * eSink = where to report errors */ -public void inlineScanModule(Module m, ErrorSink eSink) +public void inlineScanPragmaInline(Module m, ErrorSink eSink) { if (m.semanticRun != PASS.semantic3done) return; - m.semanticRun = PASS.inline; - - // Note that modules get their own scope, from scratch. - // This is so regardless of where in the syntax a module - // gets imported, it is unaffected by context. - //printf("Module = %p\n", m.sc.scopesym); - - foreach (i; 0 .. m.members.length) - { - Dsymbol s = (*m.members)[i]; - //if (global.params.v.verbose) - // message("inline scan symbol %s", s.toChars()); - inlineScanDsymbol(s, eSink); - } - m.semanticRun = PASS.inlinedone; + inlineScanModule(m, PASS.inlinePragma, eSink); } -private void inlineScanDsymbol(Dsymbol s, ErrorSink eSink) +/*********************************************************** + * Scan all functions in Module m and try to inline them in situ. + * + * Params: + * m = module to scan + * eSink = where to report errors + */ +public void inlineScanAllFunctions(Module m, ErrorSink eSink) { - scope InlineScanVisitorDsymbol v = new InlineScanVisitorDsymbol(eSink); - s.accept(v); + if (m.semanticRun != PASS.semantic3done && m.semanticRun != PASS.inlinePragma) + return; + + inlineScanModule(m, PASS.inlineAll, eSink); } /*********************************************************** @@ -146,6 +141,7 @@ enum EXPANDINLINE_LOG = false; private final class InlineDoState { // inline context + Expression eret; // expression returned to in case of NRVO VarDeclaration vthis; Dsymbols from; // old Dsymbols Dsymbols to; // parallel array of new Dsymbols @@ -153,6 +149,7 @@ private final class InlineDoState FuncDeclaration fd; // function being inlined (old parent) // inline result bool foundReturn; + bool propagateNRVO; this(Dsymbol parent, FuncDeclaration fd) scope { @@ -384,7 +381,68 @@ public: result = new ExpStatement(s.loc, exp); } else + { + if (!ids.fd || ids.fd.isNRVO) + { + result = exp; + return; + } + + if (ids.eret) + { + /* Perform RVO emplacement into eret. + * Generate: + * ( eret ) = ( exp ), ( eret ) + */ + auto ce = new ConstructExp(s.loc, ids.eret.copy(), exp); + ce.type = exp.type; + result = Expression.combine(ce, ids.eret.copy()); + return; + } + + auto tf = ids.fd.type.isTypeFunction(); + + if (exp.type.ty == Tstruct && !tf.isRef && + !ids.fd.isCtorDeclaration() && !canElideCopy(s.exp, tf.nextOf(), true)) + { + /* If the inlined function returns a copy of a struct, + * and then the return value is used subsequently as an + * lvalue, as in a struct return that is then used as a 'this'. + * Taking the address of the return value will be taking the address + * of the original, not the copy. Fix this by assigning the return value to + * a temporary, then returning the temporary. If the temporary is used as an + * lvalue, it will work. + * This only happens with struct returns. + * See https://issues.dlang.org/show_bug.cgi?id=2127 for an example. + * + * On constructor call making __inlineretval is merely redundant, because + * the returned reference is exactly same as vthis, and the 'this' variable + * already exists at the caller side. + * + * Generate a new variable to hold the result and initialize it with the + * inlined body of the function: + * tret __inlineretval = e; + */ + auto ei = new ExpInitializer(s.loc, exp); + auto tmp = Identifier.generateId("__inlineretval"); + auto vd = new VarDeclaration(s.loc, tf.next, tmp, ei); + vd.storage_class = STC.temp | (tf.isRef ? STC.ref_ : STC.rvalue); + vd._linkage = tf.linkage; + vd.parent = ids.parent; + + ei.exp = new ConstructExp(s.loc, vd, exp); + ei.exp.type = vd.type; + + auto de = new DeclarationExp(s.loc, vd); + de.type = Type.tvoid; + + // Chain the two together: + // ( typeof(return) __inlineretval = ( inlined body )) , __inlineretval + exp = Expression.combine(de, new VarExp(s.loc, vd)); + } + result = exp; + } } override void visit(ImportStatement s) @@ -413,7 +471,10 @@ public: static if (asStatements) result = new ThrowStatement(s.loc, doInlineAs!Expression(s.exp, ids)); else - result = null; // cannot be inlined as an Expression + { + result = new ThrowExp(s.loc, doInlineAs!Expression(s.exp, ids)); + result.type = Type.tnoreturn; + } } // Expression -> (Statement | Expression) @@ -453,6 +514,23 @@ public: override void visit(SymOffExp e) { //printf("SymOffExp.doInlineAs!%s(%s)\n", Result.stringof.ptr, e.toChars()); + if (ids.eret && ids.fd && + (ids.fd.isNRVO && e.var == ids.fd.nrvo_var || e.var.nrvo)) + { + // Deoptimize here and turn SymOffExp back into (&( eret ) + offset), + // because eret might have no symbol. + result = new AddrExp(e.loc, ids.eret.copy()); + result.type = e.type; + + if (e.offset) + { + auto ie = new IntegerExp(e.loc, e.offset, Type.tsize_t); + result = new AddExp(e.loc, result, ie); + result.type = e.type; + } + + return; + } foreach (i; 0 .. ids.from.length) { if (e.var != ids.from[i]) @@ -468,6 +546,12 @@ public: override void visit(VarExp e) { //printf("VarExp.doInlineAs!%s(%s)\n", Result.stringof.ptr, e.toChars()); + if (ids.eret && ids.fd && + (ids.fd.isNRVO && e.var == ids.fd.nrvo_var || e.var.nrvo)) + { + result = ids.eret.copy(); + return; + } foreach (i; 0 .. ids.from.length) { if (e.var != ids.from[i]) @@ -623,7 +707,11 @@ public: override void visit(SuperExp e) { - assert(ids.vthis); + if (!ids.vthis) + { + result = e; + return; + } result = new VarExp(e.loc, ids.vthis); if (ids.fd.hasDualContext) { @@ -651,25 +739,23 @@ public: return; } } - if (vd.isStatic()) + + if (vd.isStatic() || (vd.storage_class & STC.manifest)) return; - if (ids.fd && vd == ids.fd.nrvo_var) + bool varIsNRVO = ids.fd && (ids.fd.isNRVO && vd == ids.fd.nrvo_var || vd.nrvo); + + if (ids.eret && varIsNRVO) { - foreach (i; 0 .. ids.from.length) + if (vd._init && !vd._init.isVoidInitializer()) { - if (vd != ids.from[i]) - continue; - if (vd._init && !vd._init.isVoidInitializer()) - { - result = vd._init.initializerToExpression(); - assert(result); - result = doInlineAs!Expression(result, ids); - } - else - result = IntegerExp.literal!0; - return; + result = vd._init.initializerToExpression(); + assert(result); + result = doInlineAs!Expression(result, ids); } + else + result = IntegerExp.literal!0; + return; } auto vto = new VarDeclaration(vd.loc, vd.type, vd.ident, vd._init); @@ -679,6 +765,7 @@ version (IN_LLVM) {} else { vto.csym = null; } + vto.nrvo = ids.propagateNRVO && varIsNRVO; ids.from.push(vd); ids.to.push(vto); @@ -836,6 +923,18 @@ version (IN_LLVM) {} else visit(cast(BinExp)e); } + override void visit(ConstructExp e) + { + if (e.lowering) + { + auto ce = cast(ConstructExp)e.copy(); + ce.lowering = doInlineAs!Expression(ce.lowering, ids); + result = ce; + } + else + visit(cast(AssignExp) e); + } + override void visit(LoweredAssignExp e) { result = doInlineAs!Expression(e.lowering, ids); @@ -1023,20 +1122,32 @@ private Result doInlineAs(Result)(Expression e, InlineDoState ids) private extern (C++) final class InlineScanVisitor : Visitor { alias visit = Visitor.visit; + public: FuncDeclaration parent; // function being scanned + PASS pass; + ErrorSink eSink; + // As the visit method cannot return a value, these variables // are used to pass the result from 'visit' back to 'inlineScan' Statement sresult; Expression eresult; - ErrorSink eSink; bool again; - extern (D) this(ErrorSink eSink) scope @safe + extern (D) this(FuncDeclaration parent, PASS pass, ErrorSink eSink) scope @safe { + this.parent = parent; + this.pass = pass; this.eSink = eSink; } + void reset() + { + sresult = null; + eresult = null; + again = false; + } + override void visit(Statement s) { } @@ -1057,7 +1168,7 @@ public: */ if (auto ce = exp.isCallExp()) { - visitCallExp(ce, null, true); + visitCallExp(ce, null, true, false); if (eresult) exp = eresult; auto s = sresult; @@ -1203,7 +1314,30 @@ public: override void visit(ReturnStatement s) { //printf("ReturnStatement.inlineScan()\n"); - inlineScan(s.exp); + + if (!s.exp) + return; + + Expression e0; + Expression elast = Expression.extractLast(s.exp, e0); + inlineScan(e0); + + if (auto ce = elast.isCallExp()) + { + visitCallExp(ce, null, false, true); + + if (eresult) + { + elast = eresult; + eresult = null; + } + } + else + { + inlineScan(elast); + } + + s.exp = Expression.combine(e0, elast); } override void visit(SynchronizedStatement s) @@ -1214,7 +1348,13 @@ public: override void visit(WithStatement s) { - inlineScan(s.exp); + if (s.wthis && s.wthis._init) + { + if (auto ie = s.wthis._init.isExpInitializer()) + { + inlineScan(ie.exp); + } + } inlineScan(s._body); } @@ -1281,17 +1421,19 @@ public: { } - void scanVar(Dsymbol s) + override void visit(DeclarationExp e) { - //printf("scanVar(%s %s)\n", s.kind(), s.toPrettyChars()); - if (VarDeclaration vd = s.isVarDeclaration()) + if (VarDeclaration vd = e.declaration.isVarDeclaration()) { if (TupleDeclaration td = vd.toAlias().isTupleDeclaration()) { - td.foreachVar((s) + foreach (o; *td.objects) { - scanVar(s); // TODO - }); + if (auto te = o.isExpression()) + { + inlineScan(te); + } + } } else if (vd._init) { @@ -1301,16 +1443,6 @@ public: } } } - else - { - inlineScanDsymbol(s, eSink); - } - } - - override void visit(DeclarationExp e) - { - //printf("DeclarationExp.inlineScan() %s\n", e.toChars()); - scanVar(e.declaration); } override void visit(UnaExp e) @@ -1376,40 +1508,62 @@ public: override void visit(AssignExp e) { - // Look for NRVO, as inlining NRVO function returns require special handling - if (e.op == EXP.construct && e.e2.op == EXP.call) + void inlineConstruction(AssignExp e) { - auto ce = e.e2.isCallExp(); - if (ce.f && ce.f.isNRVO && ce.f.nrvo_var) // NRVO + Expression e0; + Expression elast = Expression.extractLast(e.e2, e0); + inlineScan(e0); // Side effects + + auto ce = elast.isCallExp(); + if (ce && ce.f) { - if (auto ve = e.e1.isVarExp()) - { - /* Inlining: - * S s = foo(); // initializing by rvalue - * S s = S(1); // constructor call - */ - Declaration d = ve.var; - if (d.storage_class & (STC.out_ | STC.ref_)) // refinit - goto L1; - } - else - { - /* Inlining: - * this.field = foo(); // inside constructor - */ - inlineScan(e.e1); - } + visitCallExp(ce, e.e1, false, false); - visitCallExp(ce, e.e1, false); if (eresult) { + eresult = Expression.combine(e0, eresult); //printf("call with nrvo: %s ==> %s\n", e.toChars(), eresult.toChars()); return; } } + + inlineScan(elast); + e.e2 = Expression.combine(e0, elast); + } + + inlineScan(e.e1); // LHS + + // Look for NRVO and emplace the return value into LHS directly + // when expanding the function call on RHS. + if (e.op == EXP.construct && + (e.e2.type.ty == Tstruct || e.e2.type.ty == Tsarray)) + { + bool refInit = false; + + /* Inlining: + * S s = ...; // initializing by rvalue + * No NRVO on: + * ref S s = ...; + */ + if (auto ve = e.e1.isVarExp()) + refInit = (ve.var.storage_class & (STC.out_ | STC.ref_)) != 0; + + if (!refInit) + { + inlineConstruction(e); + return; + } } - L1: - visit(cast(BinExp)e); + + inlineScan(e.e2); // RHS if not construction + } + + override void visit(ConstructExp e) + { + if (auto lowering = e.lowering) + inlineScan(lowering); + else + visit(cast(AssignExp) e); } override void visit(LoweredAssignExp e) @@ -1420,7 +1574,7 @@ public: override void visit(CallExp e) { //printf("CallExp.inlineScan() %s\n", e.toChars()); - visitCallExp(e, null, false); + visitCallExp(e, null, false, false); } /************************************** @@ -1430,23 +1584,19 @@ public: * e = the function call * eret = if !null, then this is the lvalue of the nrvo function result * asStatements = if inline as statements rather than as an Expression + * propagateNRVO = if the parent function returns the result immediately, + * so NRVO variables have to be preserved in the parent * Returns: * this.eresult if asStatements == false * this.sresult if asStatements == true */ - void visitCallExp(CallExp e, Expression eret, bool asStatements) + void visitCallExp(CallExp e, Expression eret, bool asStatements, bool propagateNRVO) { inlineScan(e.e1); arrayInlineScan(e.arguments); - //printf("visitCallExp() %s\n", e.toChars()); - FuncDeclaration fd; - - void inlineFd() + void inlineFd(FuncDeclaration fd, Expression explicitThis) { - if (!fd || fd == parent) - return; - /* If the arguments generate temporaries that need destruction, the destruction * must be done after the function body is executed. * The easiest way to accomplish that is to do the inlining as an Expression. @@ -1455,16 +1605,35 @@ public: bool asStates = asStatements; if (asStates) { - if (fd.inlineStatusExp == ILS.yes) + if (fd.semanticRun == pass && fd.inlineStatusExp == ILS.yes) asStates = false; // inline as expressions // so no need to recompute argumentsNeedDtors() else if (argumentsNeedDtors(e.arguments)) asStates = false; } - if (canInline(fd, false, false, asStates, eSink)) + bool hasThis; + if (explicitThis) { - expandInline(e.loc, fd, parent, eret, null, e.arguments, asStates, e.vthis2, eresult, sresult, again); + /* If ethis is explicitly given by a DotVarExp, fd can be inlined + * as long as it does not require another `this` pointer. + * Inlining the case where one pointer can be accessed from another + * is not implemented yet. + */ + hasThis = !fd.isNested(); + } + else + { + /* Otherwise, `this` pointer is captured from parent. Only allow + * immediate nested functions to reference `this` pointer. + */ + hasThis = parent == fd.toParent2(); + } + + if (canInline(fd, hasThis, asStates, pass, eSink)) + { + expandInline(e, fd, parent, eret, explicitThis, asStates, propagateNRVO, + eresult, sresult, again); if (asStatements && eresult) { sresult = new ExpStatement(eresult.loc, eresult); @@ -1473,51 +1642,59 @@ public: } } - /* Pattern match various ASTs looking for indirect function calls, delegate calls, - * function literal calls, delegate literal calls, and dot member calls. - * If so, and that is only assigned its _init. - * If so, do 'copy propagation' of the _init value and try to inline it. - */ - if (auto ve = e.e1.isVarExp()) + FuncDeclaration resolveCallTarget(Expression e, out Expression explicitThis) { - fd = ve.var.isFuncDeclaration(); - if (fd) - // delegate call - inlineFd(); - else + /* Peel exactly one layer of (*fptr)() or (*&f)(). + */ + if (auto pe = e.isPtrExp()) { - // delegate literal call + if (pe.e1.isVarExp()) + e = pe.e1; + else if (auto se = pe.e1.isSymOffExp()) + return se.var.isFuncDeclaration(); + else + return null; + } + + /* Pattern match various ASTs looking for indirect function calls, delegate calls, + * function literal calls, delegate literal calls, and dot member calls. + * If so, and that is only assigned its _init. + * If so, do 'copy propagation' of the _init value and try to inline it. + */ + if (auto ve = e.isVarExp()) + { + if (FuncDeclaration fd = ve.var.isFuncDeclaration()) + return fd; + auto v = ve.var.isVarDeclaration(); - if (v && v._init && v.type.ty == Tdelegate && onlyOneAssign(v, parent)) + if (!v || !v._init || !onlyOneAssign(v, parent)) + return null; + + //printf("init: %s\n", v._init.toChars()); + auto ei = v._init.isExpInitializer(); + if (!ei || (ei.exp.op != EXP.blit && ei.exp.op != EXP.construct)) + return null; + + Expression e2 = (cast(AssignExp)ei.exp).e2; + if (auto se = e2.isSymOffExp()) + { + // function pointer call + return se.var.isFuncDeclaration(); + } + else if (auto fe = e2.isFuncExp()) { - //printf("init: %s\n", v._init.toChars()); - auto ei = v._init.isExpInitializer(); - if (ei && ei.exp.op == EXP.blit) + // function/delegate literal call + return fe.fd; + } + else if (auto de = e2.isDelegateExp()) + { + if (auto ve2 = de.e1.isVarExp()) { - Expression e2 = (cast(AssignExp)ei.exp).e2; - if (auto fe = e2.isFuncExp()) - { - auto fld = fe.fd; - assert(fld.tok == TOK.delegate_); - fd = fld; - inlineFd(); - } - else if (auto de = e2.isDelegateExp()) - { - if (auto ve2 = de.e1.isVarExp()) - { - fd = ve2.var.isFuncDeclaration(); - inlineFd(); - } - } + return ve2.var.isFuncDeclaration(); } } } - } - else if (auto dve = e.e1.isDotVarExp()) - { - fd = dve.var.isFuncDeclaration(); - if (fd && fd != parent && canInline(fd, true, false, asStatements, eSink)) + else if (auto dve = e.isDotVarExp()) { if (dve.e1.op == EXP.call && dve.e1.type.toBasetype().ty == Tstruct) { @@ -1525,56 +1702,28 @@ public: * of dve.e1, but this won't work if dve.e1 is * a function call. */ + return null; } - else - { - expandInline(e.loc, fd, parent, eret, dve.e1, e.arguments, asStatements, e.vthis2, eresult, sresult, again); - } - } - } - else if (e.e1.op == EXP.star && - (cast(PtrExp)e.e1).e1.op == EXP.variable) - { - auto ve = e.e1.isPtrExp().e1.isVarExp(); - VarDeclaration v = ve.var.isVarDeclaration(); - if (v && v._init && onlyOneAssign(v, parent)) - { - //printf("init: %s\n", v._init.toChars()); - auto ei = v._init.isExpInitializer(); - if (ei && ei.exp.op == EXP.blit) - { - Expression e2 = (cast(AssignExp)ei.exp).e2; - // function pointer call - if (auto se = e2.isSymOffExp()) - { - fd = se.var.isFuncDeclaration(); - inlineFd(); - } - // function literal call - else if (auto fe = e2.isFuncExp()) - { - auto fld = fe.fd; - assert(fld.tok == TOK.function_); - fd = fld; - inlineFd(); - } - } + + explicitThis = dve.e1; + return dve.var.isFuncDeclaration(); } - } - else if (auto fe = e.e1.isFuncExp()) - { - if (fe.fd) + else if (auto fe = e.isFuncExp()) { - fd = fe.fd; - inlineFd(); + return fe.fd; } - else - return; + + return null; } - else - { + + //printf("visitCallExp() %s\n", e.toChars()); + Expression explicitThis; + FuncDeclaration fd = resolveCallTarget(e.e1, explicitThis); + + if (!fd || fd == parent) return; - } + + inlineFd(fd, explicitThis); if (global.params.v.verbose && (eresult || sresult)) message("inlined %s =>\n %s", fd.toPrettyChars(), parent.toPrettyChars()); @@ -1671,11 +1820,14 @@ public: private extern (C++) final class InlineScanVisitorDsymbol : Visitor { alias visit = Visitor.visit; + public: + PASS pass; ErrorSink eSink; - extern (D) this(ErrorSink eSink) scope @safe + extern (D) this(PASS pass, ErrorSink eSink) scope @safe { + this.pass = pass; this.eSink = eSink; } @@ -1693,33 +1845,53 @@ public: { printf("FuncDeclaration.inlineScan('%s')\n", fd.toPrettyChars()); } - if (!(global.params.useInline || fd.hasAlwaysInlines)) + + if (!fd.fbody || fd.isNaked || fd.skipCodegen) return; - if (fd.isUnitTestDeclaration() && !global.params.useUnitTests || fd.inlineScanned) + + if (fd.semanticRun < PASS.semantic3done) + return; + + if (fd.semanticRun == pass && fd.inlineScanned) return; - if (fd.fbody && !fd.isNaked) + + if (fd.isUnitTestDeclaration() && !global.params.useUnitTests) + return; + + if (!fd.hasAlwaysInlines && pass == PASS.inlinePragma) + return; + + if (fd.semanticRun != pass) { - while (1) - { - fd.inlineNest++; - fd.inlineScanned = true; + fd.inlineStatusExp = ILS.uninitialized; + fd.inlineStatusStmt = ILS.uninitialized; + } + + fd.inlineScanned = true; + fd.semanticRun = pass; - scope InlineScanVisitor v = new InlineScanVisitor(eSink); - v.parent = fd; - v.inlineScan(fd.fbody); - bool again = v.again; + scope InlineScanVisitor v = new InlineScanVisitor(fd, pass, eSink); - fd.inlineNest--; - if (!again) - break; + do + { + fd.inlineNest++; + v.reset(); + v.inlineScan(fd.fbody); + fd.inlineNest--; + } while (v.again); + + if (fd.localsymtab) + { + foreach (keyValue; fd.localsymtab.tab.asRange) + { + keyValue.value.accept(this); } } } override void visit(AttribDeclaration d) { - Dsymbols* decls = d.include(null); - if (decls) + if (Dsymbols* decls = d.include(null)) { foreach (i; 0 .. decls.length) { @@ -1761,12 +1933,41 @@ public: } } +/*********************************************************** + * Scan function implementations in Module m looking for functions that can be inlined, + * and inline them in situ. + * + * Params: + * m = module to scan + * pass = the current pass (inline1 or inline2) + * eSink = where to report errors + */ +private void inlineScanModule(Module m, PASS pass, ErrorSink eSink) +{ + assert(pass == PASS.inlinePragma || pass == PASS.inlineAll); + + // Note that modules get their own scope, from scratch. + // This is so regardless of where in the syntax a module + // gets imported, it is unaffected by context. + + //printf("Module = %p\n", m.sc.scopesym); + + scope v = new InlineScanVisitorDsymbol(pass, eSink); + + foreach (i; 0 .. m.members.length) + { + Dsymbol s = (*m.members)[i]; + s.accept(v); + } + + m.semanticRun = pass; +} + /*********************************************************** * Test that `fd` can be inlined. * * Params: - * hasthis = `true` if the function call has explicit 'this' expression. - * hdrscan = `true` if the inline scan is for 'D header' content. + * hasThis = `true` if the caller can access the callee's this pointer. * statementsToo = `true` if the function call is placed on ExpStatement. * It means more code-block dependent statements in fd body - ForStatement, * ThrowStatement, etc. can be inlined. @@ -1774,23 +1975,18 @@ public: * * Returns: * true if the function body can be expanded. - * - * Todo: - * - Would be able to eliminate `hasthis` parameter, because semantic analysis - * no longer accepts calls of contextful function without valid 'this'. - * - Would be able to eliminate `hdrscan` parameter, because it's always false. */ -private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool statementsToo, ErrorSink eSink) +private bool canInline(FuncDeclaration fd, bool hasThis, bool statementsToo, PASS pass, ErrorSink eSink) { int cost; static if (CANINLINE_LOG) { - printf("FuncDeclaration.canInline(hasthis = %d, statementsToo = %d, '%s')\n", - hasthis, statementsToo, fd.toPrettyChars()); + printf("FuncDeclaration.canInline(hasThis = %d, statementsToo = %d, '%s')\n", + hasThis, statementsToo, fd.toPrettyChars()); } - if (fd.needThis() && !hasthis) + if (fd.needThis() && !hasThis) return false; if (fd.inlineNest) @@ -1802,7 +1998,7 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat return false; } - if (fd.semanticRun < PASS.semantic3 && !hdrscan) + if (fd.semanticRun < PASS.semantic3) { if (!fd.fbody) return false; @@ -1817,6 +2013,15 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat if (fd.skipCodegen) return false; + // Reset ILS if the decision was made in another pass + if (fd.semanticRun != pass) + { + fd.inlineScanned = false; + fd.inlineStatusExp = ILS.uninitialized; + fd.inlineStatusStmt = ILS.uninitialized; + fd.semanticRun = pass; + } + final switch (statementsToo ? fd.inlineStatusStmt : fd.inlineStatusExp) { case ILS.yes: @@ -1838,7 +2043,7 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat final switch (fd.inlining) { case PINLINE.default_: - if (!global.params.useInline) + if (pass != PASS.inlineAll) return false; break; case PINLINE.always: @@ -1888,10 +2093,9 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat { /* for the isTypeSArray() case see https://github.com/dlang/dmd/pull/16145#issuecomment-1932776873 */ - if (tfnext.ty != Tvoid && + if (tfnext.ty != Tvoid && tfnext.ty != Tnoreturn && (!fd.hasReturnExp || - hasDtor(tfnext) && (statementsToo || tfnext.isTypeSArray())) && - !hdrscan) + hasDtor(tfnext) && (statementsToo || tfnext.isTypeSArray()))) { static if (CANINLINE_LOG) { @@ -1921,10 +2125,10 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat (fd.ident == Id.require && fd.toParent().isFuncDeclaration() && fd.toParent().isFuncDeclaration().needThis()) || - !hdrscan && (fd.isSynchronized() || - fd.isImportedSymbol() || - fd.hasNestedFrameRefs() || - (fd.isVirtual() && !fd.isFinalFunc()))) + (fd.isSynchronized() || + fd.isImportedSymbol() || + fd.hasNestedFrameRefs() || + (fd.isVirtual() && !fd.isFinalFunc()))) { static if (CANINLINE_LOG) { @@ -1945,7 +2149,7 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat } { - cost = inlineCostFunction(fd, hasthis, hdrscan); + cost = inlineCostFunction(fd, hasThis); } static if (CANINLINE_LOG) { @@ -1957,36 +2161,36 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat if (!statementsToo && cost > COST_MAX) goto Lno; - if (!hdrscan) - { - // Don't modify inlineStatus for header content scan - if (statementsToo) - fd.inlineStatusStmt = ILS.yes; - else - fd.inlineStatusExp = ILS.yes; + if (statementsToo) + fd.inlineStatusStmt = ILS.yes; + else + fd.inlineStatusExp = ILS.yes; - inlineScanDsymbol(fd, eSink); // Don't scan recursively for header content scan + { + scope v = new InlineScanVisitorDsymbol(pass, eSink); + fd.accept(v); + } - if (fd.inlineStatusExp == ILS.uninitialized) + if (fd.inlineStatusExp == ILS.uninitialized) + { + // Need to redo cost computation, as some statements or expressions have been inlined + cost = inlineCostFunction(fd, hasThis); + static if (CANINLINE_LOG) { - // Need to redo cost computation, as some statements or expressions have been inlined - cost = inlineCostFunction(fd, hasthis, hdrscan); - static if (CANINLINE_LOG) - { - printf("recomputed cost = %d for %s\n", cost, fd.toChars()); - } + printf("recomputed cost = %d for %s\n", cost, fd.toChars()); + } - if (tooCostly(cost)) - goto Lno; - if (!statementsToo && cost > COST_MAX) - goto Lno; + if (tooCostly(cost)) + goto Lno; + if (!statementsToo && cost > COST_MAX) + goto Lno; - if (statementsToo) - fd.inlineStatusStmt = ILS.yes; - else - fd.inlineStatusExp = ILS.yes; - } + if (statementsToo) + fd.inlineStatusStmt = ILS.yes; + else + fd.inlineStatusExp = ILS.yes; } + static if (CANINLINE_LOG) { printf("\t2: yes %s\n", fd.toChars()); @@ -1994,16 +2198,17 @@ private bool canInline(FuncDeclaration fd, bool hasthis, bool hdrscan, bool stat return true; Lno: - if (fd.inlining == PINLINE.always && global.params.useWarnings == DiagnosticReporting.inform) - eSink.warning(fd.loc, "cannot inline function `%s`", fd.toPrettyChars()); - - if (!hdrscan) // Don't modify inlineStatus for header content scan + if (fd.inlining == PINLINE.always && pass == PASS.inlinePragma && + global.params.useWarnings == DiagnosticReporting.inform) { - if (statementsToo) - fd.inlineStatusStmt = ILS.no; - else - fd.inlineStatusExp = ILS.no; + eSink.warning(fd.loc, "cannot inline function `%s`", fd.toPrettyChars()); } + + if (statementsToo) + fd.inlineStatusStmt = ILS.no; + else + fd.inlineStatusExp = ILS.no; + static if (CANINLINE_LOG) { printf("\t2: no %s\n", fd.toChars()); @@ -2016,22 +2221,22 @@ Lno: * ethis.fd(arguments) * * Params: - * callLoc = location of CallExp + * e = original CallExp * fd = function to expand * parent = function that the call to fd is being expanded into * eret = if !null then the lvalue of where the nrvo return value goes - * ethis = 'this' reference - * arguments = arguments passed to fd * asStatements = expand to Statements rather than Expressions + * propagateNRVO = preserve NRVO status of variables * eresult = if expanding to an expression, this is where the expression is written to * sresult = if expanding to a statement, this is where the statement is written to * again = if true, then fd can be inline scanned again because there may be * more opportunities for inlining */ -private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration parent, Expression eret, - Expression ethis, Expressions* arguments, bool asStatements, VarDeclaration vthis2, +private void expandInline(CallExp ecall, FuncDeclaration fd, FuncDeclaration parent, + Expression eret, Expression ethis, bool asStatements, bool propagateNRVO, out Expression eresult, out Statement sresult, out bool again) { + Loc callLoc = ecall.loc; auto tf = fd.type.isTypeFunction(); static if (LOG || CANINLINE_LOG || EXPANDINLINE_LOG) printf("FuncDeclaration.expandInline('%s', %d)\n", fd.toChars(), asStatements); @@ -2041,6 +2246,7 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren if (ethis) printf("\tethis = %s\n", ethis.toChars()); } scope ids = new InlineDoState(parent, fd); + ids.propagateNRVO = propagateNRVO; if (fd.isNested()) { @@ -2049,58 +2255,34 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren parent.inlinedNestedCallees.push(fd); } - VarDeclaration vret; // will be set the function call result + // Set up eret if (eret) { - if (auto ve = eret.isVarExp()) + if (eret.isVarExp()) { - vret = ve.var.isVarDeclaration(); - assert(!(vret.storage_class & (STC.out_ | STC.ref_))); + ids.eret = eret; eret = null; } else { - /* Inlining: - * this.field = foo(); // inside constructor - */ + // Use a pointer to the expression (field or static array) to be initialized. + auto ei = new ExpInitializer(callLoc, null); - auto tmp = Identifier.generateId("__retvar"); - vret = new VarDeclaration(fd.loc, eret.type, tmp, ei); - vret.storage_class |= STC.temp | STC.ref_; - vret._linkage = LINK.d; - vret.parent = parent; + auto tmp = Identifier.generateId("__retptr"); + auto vd = new VarDeclaration(fd.loc, eret.type.pointerTo(), tmp, ei); + vd.storage_class |= STC.temp; + vd._linkage = LINK.d; + vd.parent = parent; - ei.exp = new ConstructExp(fd.loc, vret, eret); - ei.exp.type = vret.type; + ei.exp = new ConstructExp(fd.loc, vd, new AddrExp(fd.loc, eret, vd.type)); + ei.exp.type = vd.type; - auto de = new DeclarationExp(fd.loc, vret); + auto de = new DeclarationExp(fd.loc, vd); de.type = Type.tvoid; - eret = de; - } - if (!asStatements && fd.nrvo_var) - { - ids.from.push(fd.nrvo_var); - ids.to.push(vret); - } - } - else - { - if (!asStatements && fd.nrvo_var) - { - auto tmp = Identifier.generateId("__retvar"); - vret = new VarDeclaration(fd.loc, fd.nrvo_var.type, tmp, new VoidInitializer(fd.loc)); - assert(!tf.isRef); - vret.storage_class = STC.temp | STC.rvalue; - vret._linkage = tf.linkage; - vret.parent = parent; - - auto de = new DeclarationExp(fd.loc, vret); - de.type = Type.tvoid; + ids.eret = new PtrExp(fd.loc, new VarExp(fd.loc, vd)); + ids.eret.type = eret.type; eret = de; - - ids.from.push(fd.nrvo_var); - ids.to.push(vret); } } @@ -2110,8 +2292,8 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren { Expression e0; ethis = Expression.extractLast(ethis, e0); - assert(vthis2 || !fd.hasDualContext); - if (vthis2) + + if (VarDeclaration vthis2 = ecall.vthis2) { // void*[2] __this = [ethis, this] if (ethis.type.ty == Tstruct) @@ -2136,7 +2318,6 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren } else { - //assert(ethis.type.ty != Tpointer); if (ethis.type.ty == Tpointer) { Type t = ethis.type.nextOf(); @@ -2144,15 +2325,23 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren ethis.type = t; } - auto ei = new ExpInitializer(fd.loc, ethis); + auto ei = new ExpInitializer(fd.loc, null); vthis = new VarDeclaration(fd.loc, ethis.type, Id.This, ei); - if (ethis.type.ty != Tclass) - vthis.storage_class = STC.ref_; - else - vthis.storage_class = STC.in_; vthis._linkage = LINK.d; vthis.parent = parent; + if (ethis.isStructLiteralExp()) + { + vthis.storage_class = STC.rvalue; + + if (fd.isCtorDeclaration() && propagateNRVO) + vthis.nrvo = true; + } + else if (ethis.type.ty != Tclass) + { + vthis.storage_class = STC.ref_; + } + ei.exp = new ConstructExp(fd.loc, vthis, ethis); ei.exp.type = vthis.type; @@ -2167,13 +2356,13 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren // Set up parameters Expression eparams; - if (arguments && arguments.length) + if (ecall.arguments && ecall.arguments.length) { - assert(fd.parameters.length == arguments.length); - foreach (i; 0 .. arguments.length) + assert(fd.parameters.length == ecall.arguments.length); + foreach (i; 0 .. ecall.arguments.length) { auto vfrom = (*fd.parameters)[i]; - auto arg = (*arguments)[i]; + auto arg = (*ecall.arguments)[i]; auto ei = new ExpInitializer(vfrom.loc, arg); auto vto = new VarDeclaration(vfrom.loc, vfrom.type, vfrom.ident, ei); @@ -2194,6 +2383,9 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren } } + if (arg.rvalue) + vto.storage_class |= STC.ref_; + // Even if vto is STC.lazy_, `vto = arg` is handled correctly in glue layer. ei.exp = new BlitExp(vto.loc, vto, arg); ei.exp.type = vto.type; @@ -2289,47 +2481,8 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren if (tf.isRef) e = e.toLvalue(null, "`ref` return"); - /* If the inlined function returns a copy of a struct, - * and then the return value is used subsequently as an - * lvalue, as in a struct return that is then used as a 'this'. - * Taking the address of the return value will be taking the address - * of the original, not the copy. Fix this by assigning the return value to - * a temporary, then returning the temporary. If the temporary is used as an - * lvalue, it will work. - * This only happens with struct returns. - * See https://issues.dlang.org/show_bug.cgi?id=2127 for an example. - * - * On constructor call making __inlineretval is merely redundant, because - * the returned reference is exactly same as vthis, and the 'this' variable - * already exists at the caller side. - */ - if (tf.next.ty == Tstruct && !fd.nrvo_var && !fd.isCtorDeclaration() && - !isConstruction(e)) - { - /* Generate a new variable to hold the result and initialize it with the - * inlined body of the function: - * tret __inlineretval = e; - */ - auto ei = new ExpInitializer(callLoc, e); - auto tmp = Identifier.generateId("__inlineretval"); - auto vd = new VarDeclaration(callLoc, tf.next, tmp, ei); - vd.storage_class = STC.temp | (tf.isRef ? STC.ref_ : STC.rvalue); - vd._linkage = tf.linkage; - vd.parent = parent; - - ei.exp = new ConstructExp(callLoc, vd, e); - ei.exp.type = vd.type; - - auto de = new DeclarationExp(callLoc, vd); - de.type = Type.tvoid; - - // Chain the two together: - // ( typeof(return) __inlineretval = ( inlined body )) , __inlineretval - e = Expression.combine(de, new VarExp(callLoc, vd)); - } - // https://issues.dlang.org/show_bug.cgi?id=15210 - if (tf.next.ty == Tvoid && e && e.type.ty != Tvoid) + if (tf.next.ty == Tvoid && e && e.type.ty != Tvoid && e.type.ty != Tnoreturn) { e = new CastExp(callLoc, e, Type.tvoid); e.type = Type.tvoid; @@ -2338,6 +2491,9 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren eresult = Expression.combine(eresult, eret, ethis, eparams); eresult = Expression.combine(eresult, e); + if (ecall.rvalue || tf.isRvalue) + eresult.rvalue = true; + static if (EXPANDINLINE_LOG) printf("\n[%s] %s expandInline eresult = %s\n", callLoc.toChars(), fd.toPrettyChars(), eresult.toChars()); @@ -2348,45 +2504,6 @@ private void expandInline(Loc callLoc, FuncDeclaration fd, FuncDeclaration paren parent.inlineStatusExp = ILS.uninitialized; } -/**************************************************** - * Determine if the value of `e` is the result of construction. - * - * Params: - * e = expression to check - * Returns: - * true for value generated by a constructor or struct literal - */ -private bool isConstruction(Expression e) -{ - e = lastComma(e); - - if (e.op == EXP.structLiteral) - { - return true; - } - /* Detect: - * structliteral.ctor(args) - */ - else if (e.op == EXP.call) - { - auto ce = cast(CallExp)e; - if (ce.e1.op == EXP.dotVariable) - { - auto dve = cast(DotVarExp)ce.e1; - auto fd = dve.var.isFuncDeclaration(); - if (fd && fd.isCtorDeclaration()) - { - if (dve.e1.op == EXP.structLiteral) - { - return true; - } - } - } - } - return false; -} - - /*********************************************************** * Determine if v is 'head const', meaning * that once it is initialized it is not changed diff --git a/dmd/inlinecost.d b/dmd/inlinecost.d index 62d034ab2a0..16a106327d0 100644 --- a/dmd/inlinecost.d +++ b/dmd/inlinecost.d @@ -1,7 +1,7 @@ /** * Compute the cost of inlining a function call by counting expressions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/inlinecost.d, _inlinecost.d) @@ -31,6 +31,7 @@ import dmd.id; import dmd.identifier; import dmd.init; import dmd.mtype; +import dmd.typesem; import dmd.opover; import dmd.statement; import dmd.tokens; @@ -67,7 +68,7 @@ bool tooCostly(int cost) pure nothrow @safe */ int inlineCostExpression(Expression e) { - scope InlineCostVisitor icv = new InlineCostVisitor(false, true, true, null); + scope InlineCostVisitor icv = new InlineCostVisitor(true, false); icv.expressionInlineCost(e); return icv.cost; } @@ -77,14 +78,13 @@ int inlineCostExpression(Expression e) * Determine cost of inlining function * Params: * fd = function to determine cost of - * hasthis = if the function call has explicit 'this' expression - * hdrscan = if generating a header file + * hasThis = if the caller can access the callee's this pointer * Returns: * cost of inlining fd */ -int inlineCostFunction(FuncDeclaration fd, bool hasthis, bool hdrscan) +int inlineCostFunction(FuncDeclaration fd, bool hasThis) { - scope InlineCostVisitor icv = new InlineCostVisitor(hasthis, hdrscan, false, fd); + scope InlineCostVisitor icv = new InlineCostVisitor(false, hasThis); fd.fbody.accept(icv); return icv.cost; } @@ -149,32 +149,28 @@ extern (C++) final class InlineCostVisitor : Visitor { alias visit = Visitor.visit; public: + // if the expression being visited is a default argument, which is + // specified to be copied at call site and can contain more types of + // expression (like alloca) than regular inlining + immutable bool callerCopy; + + // if the caller can access the callee's this pointer + immutable bool hasThis; + int nested; - bool hasthis; - bool hdrscan; // if inline scan for 'header' content - bool allowAlloca; - FuncDeclaration fd; int cost; // zero start for subsequent AST - extern (D) this() scope @safe - { - } - - extern (D) this(bool hasthis, bool hdrscan, bool allowAlloca, FuncDeclaration fd) scope @safe + extern (D) this(bool callerCopy, bool hasThis) scope @safe { - this.hasthis = hasthis; - this.hdrscan = hdrscan; - this.allowAlloca = allowAlloca; - this.fd = fd; + this.callerCopy = callerCopy; + this.hasThis = hasThis; } extern (D) this(InlineCostVisitor icv) scope @safe { nested = icv.nested; - hasthis = icv.hasthis; - hdrscan = icv.hdrscan; - allowAlloca = icv.allowAlloca; - fd = icv.fd; + callerCopy = icv.callerCopy; + hasThis = icv.hasThis; } override void visit(Statement s) @@ -265,12 +261,6 @@ public: } expressionInlineCost(s.condition); - if (s.isIfCtfeBlock()) - { - cost = COST_MAX; - return; - } - /* Specifically allow: * if (condition) * return exp1; @@ -323,14 +313,18 @@ public: if (s.increment) s.increment.accept(this); if (s._body) + { + nested += 1; s._body.accept(this); + nested -= 1; + } //printf("ForStatement: inlineCost = %d\n", cost); } override void visit(ThrowStatement s) { - cost += STATEMENT_COST; - s.exp.accept(this); + cost++; + expressionInlineCost(s.exp); } /* -------------------------- */ @@ -401,19 +395,11 @@ public: override void visit(ThisExp e) { //printf("ThisExp.inlineCost3() %s\n", toChars()); - if (!fd) + if (!hasThis) { cost = COST_MAX; return; } - if (!hdrscan) - { - if (fd.isNested() || !hasthis) - { - cost = COST_MAX; - return; - } - } cost++; } @@ -459,7 +445,7 @@ public: cost = COST_MAX; // finish DeclarationExp.doInlineAs return; } - if (!hdrscan && vd.isDataseg()) + if (!callerCopy && vd.isDataseg()) { cost = COST_MAX; return; @@ -513,7 +499,7 @@ public: // can't handle that at present. else if (e.e1.op == EXP.dotVariable && (cast(DotVarExp)e.e1).e1.op == EXP.super_) cost = COST_MAX; - else if (e.f && e.f.ident == Id.__alloca && e.f._linkage == LINK.c && !allowAlloca) + else if (e.f && e.f.ident == Id.__alloca && e.f._linkage == LINK.c && !callerCopy) cost = COST_MAX; // inlining alloca may cause stack overflows else cost++; diff --git a/dmd/intrange.d b/dmd/intrange.d index f68e302f741..cc69373d121 100644 --- a/dmd/intrange.d +++ b/dmd/intrange.d @@ -1,7 +1,7 @@ /** * Implement $(LINK2 https://digitalmars.com/articles/b62.html, Value Range Propagation). * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/intrange.d, _intrange.d) @@ -314,30 +314,6 @@ struct IntRange imax = upper; } - static IntRange fromType(Type type) - { - return fromType(type, type.isUnsigned()); - } - - static IntRange fromType(Type type, bool isUnsigned) - { - if (!type.isIntegral() || type.toBasetype().isTypeVector()) - return widest(); - - uinteger_t mask = type.sizemask(); - auto lower = SignExtendedNumber(0); - auto upper = SignExtendedNumber(mask); - if (type.toBasetype().ty == Tdchar) - upper.value = 0x10FFFFUL; - else if (!isUnsigned) - { - lower.value = ~(mask >> 1); - lower.negative = true; - upper.value = (mask >> 1); - } - return IntRange(lower, upper); - } - static IntRange fromNumbers2(SignExtendedNumber* numbers) { if (numbers[0] < numbers[1]) @@ -441,26 +417,6 @@ struct IntRange return this; } - IntRange _cast(Type type) - { - if (!type.isIntegral() || type.toBasetype().isTypeVector()) - return this; - if (!type.isUnsigned()) - return castSigned(type.sizemask()); - if (type.toBasetype().ty == Tdchar) - return castDchar(); - return castUnsigned(type.sizemask()); - } - - IntRange castUnsigned(Type type) - { - if (!type.isIntegral() || type.toBasetype().isTypeVector()) - return castUnsigned(ulong.max); - if (type.toBasetype().ty == Tdchar) - return castDchar(); - return castUnsigned(type.sizemask()); - } - bool contains(IntRange a) @safe { return imin <= a.imin && imax >= a.imax; diff --git a/dmd/json.d b/dmd/json.d index 080870aa470..512b4dc7570 100644 --- a/dmd/json.d +++ b/dmd/json.d @@ -1,7 +1,7 @@ /** * Code for generating .json descriptions of the module when passing the `-X` flag to dmd. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/json.d, _json.d) @@ -25,6 +25,7 @@ import dmd.dimport; import dmd.dmodule; import dmd.dsymbol; import dmd.dsymbolsem : include; +import dmd.templatesem : computeOneMember; import dmd.dtemplate; import dmd.errors; import dmd.expression; @@ -474,6 +475,7 @@ public: void jsonProperties(TemplateDeclaration td) { jsonProperties(cast(Dsymbol)td); + td.computeOneMember(); if (td.onemember && td.onemember.isCtorDeclaration()) property("name", "this"); // __ctor -> this else diff --git a/dmd/json.h b/dmd/json.h index 821150935aa..734f20f394a 100644 --- a/dmd/json.h +++ b/dmd/json.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/lambdacomp.d b/dmd/lambdacomp.d index 2b8a8ed4987..12b1d6582b6 100644 --- a/dmd/lambdacomp.d +++ b/dmd/lambdacomp.d @@ -5,7 +5,7 @@ * The serialization is a string which contains the type of the parameters and the string * represantation of the lambda expression. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/lambdacomp.d, _lambdacomp.d) @@ -25,7 +25,7 @@ import dmd.dsymbol; import dmd.dsymbolsem; import dmd.dtemplate; import dmd.expression; -import dmd.expressionsem : getConstInitializer; +import dmd.expressionsem : getConstInitializer, toInteger; import dmd.func; import dmd.hdrgen; import dmd.mangle; diff --git a/dmd/lexer.d b/dmd/lexer.d index 042f2d43020..0bd7131b090 100644 --- a/dmd/lexer.d +++ b/dmd/lexer.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/lex.html, Lexical) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/lexer.d, _lexer.d) @@ -2239,7 +2239,13 @@ class Lexer if (*p == '\'') { - error("character constant has multiple characters"); + const(char)* s = p - 1; + while(*s != '\'') + { + s--; + } + s++; + error("character constant has multiple characters - did you mean \"%.*s\"?", cast(int) (p - s), s); p++; } else diff --git a/dmd/location.d b/dmd/location.d index daff06f3d2c..102d4436025 100644 --- a/dmd/location.d +++ b/dmd/location.d @@ -1,7 +1,7 @@ /** * Encapsulates file/line/column locations. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/location.d, _location.d) diff --git a/dmd/main.d b/dmd/main.d index 9afc17605ff..089d957ee03 100644 --- a/dmd/main.d +++ b/dmd/main.d @@ -6,7 +6,7 @@ * utilities needed for arguments parsing, path manipulation, etc... * This file is not shared with other compilers which use the DMD front-end. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/main.d, _main.d) @@ -35,6 +35,7 @@ import dmd.deps; import dmd.dinterpret; // IN_LLVM import dmd.dmdparams; import dmd.dsymbolsem; +import dmd.typesem : Type_init; import dmd.dtemplate; import dmd.dtoh; // IN_LLVM import dmd.glue : generateCodeAndWrite, ObjcGlue_initialize; @@ -129,7 +130,7 @@ extern (C) int main(int argc, char** argv) * Returns: * Return code of the application */ -extern (C) int _Dmain(char[][]) +extern (C) int _Dmain(const(char)[][] dargs) { // possibly install memory error handler version (DigitalMars) @@ -162,8 +163,7 @@ extern (C) int _Dmain(char[][]) fputs(buf.peekChars(), stderr); } - auto args = Runtime.cArgs(); - return tryMain(args.argc, cast(const(char)**)args.argv, global.params); + return tryMain(dargs, global.params); } } // !IN_LLVM @@ -179,14 +179,13 @@ private: * provided source file and do semantic analysis on them. * * Params: - * argc = Number of arguments passed via command line * argv = Array of string arguments passed via command line * params = set based on argc, argv * * Returns: * Application return code */ -// LDC: changed from `private int tryMain(size_t argc, const(char)** argv, out Param params)` +// LDC: changed from `private int tryMain(const(char)[][] argv, out Param params)` extern (C++) int mars_tryMain(ref Param params, ref Strings files) { import dmd.common.charactertables; @@ -220,7 +219,7 @@ version (IN_LLVM) {} else { target.setTargetBuildDefaults(); - if (parseCommandlineAndConfig(argc, argv, params, files)) + if (parseCommandlineAndConfig(argv, params, files)) return EXIT_FAILURE; } @@ -439,7 +438,7 @@ else // Initialization target._init(params); - Type._init(); + Type_init(); Id.initialize(); Module._init(); Expression._init(); @@ -526,11 +525,11 @@ else import dmd.timetrace; version (IN_LLVM) { - initializeTimeTrace(params.timeTraceGranularityUs, params.argv0.toCString.ptr); + initializeTimeTrace(params.timeTraceGranularityUs, toCString(params.argv0).ptr); } else { - initializeTimeTrace(params.timeTraceGranularityUs, argv[0]); + initializeTimeTrace(params.timeTraceGranularityUs, toCString(argv[0]).ptr); } } @@ -683,7 +682,11 @@ version (IN_LLVM) buf.reset(); // reuse the buffer genhdrfile(m, params.dihdr.fullOutput, buf); - if (!writeFile(m.loc, m.hdrfile.toString(), buf[])) + if (params.dihdr.name == "-") { + size_t n = fwrite(buf[].ptr, 1, buf.length, stdout); + assert(n == buf.length); + } + else if (!writeFile(m.loc, m.hdrfile.toString(), buf[])) fatal(); } } @@ -771,14 +774,25 @@ version (IN_LLVM) } else { - // Scan for functions to inline + // Scan for modules with always inline functions foreach (m; modules) { - if (params.useInline || m.hasAlwaysInlines) + if (m.hasAlwaysInlines) { if (params.v.verbose) - message("inline scan %s", m.toChars()); - inlineScanModule(m, global.errorSink); + message("scan pragma(inline) in %s", m.toChars()); + inlineScanPragmaInline(m, global.errorSink); + } + } + + if (params.useInline) + { + // Scan for functions to inline + foreach (m; modules) + { + if (params.v.verbose) + message("scan all inlines in %s", m.toChars()); + inlineScanAllFunctions(m, global.errorSink); } } } @@ -1044,14 +1058,13 @@ else * Parses the command line arguments and configuration files * * Params: - * argc = Number of arguments passed via command line * argv = Array of string arguments passed via command line * params = parameters from argv * files = files from argv * Returns: true on failure */ version (IN_LLVM) {} else -bool parseCommandlineAndConfig(size_t argc, const(char)** argv, out Param params, ref Strings files) +bool parseCommandlineAndConfig(const(char)[][] argv, out Param params, ref Strings files) { // Detect malformed input static bool badArgs() @@ -1060,15 +1073,16 @@ bool parseCommandlineAndConfig(size_t argc, const(char)** argv, out Param params return true; } - if (argc < 1 || !argv) + const size_t argc = argv.length; + if (argc < 1) return badArgs(); // Convert argc/argv into arguments[] for easier handling - Strings arguments = Strings(argc); - for (size_t i = 0; i < argc; i++) + Strings arguments = Strings(argv.length); + for (size_t i = 0; i < argv.length; i++) { if (!argv[i]) return badArgs(); - arguments[i] = argv[i]; + arguments[i] = toCString(argv[i]).ptr; } if (const(char)* missingFile = responseExpand(arguments)) // expand response files error(Loc.initial, "cannot open response file '%s'", missingFile); @@ -1126,9 +1140,6 @@ bool parseCommandlineAndConfig(size_t argc, const(char)** argv, out Param params bool isX86_64 = arch[0] == '6'; - version(Windows) // delete LIB entry in [Environment] (necessary for optlink) to allow inheriting environment for MS-COFF - environment.update("LIB", 3).value = null; - // read from DFLAGS in [Environment{arch}] section char[80] envsection = void; snprintf(envsection.ptr, envsection.length, "Environment%.*s", cast(int) arch.length, arch.ptr); @@ -1161,7 +1172,7 @@ bool parseCommandlineAndConfig(size_t argc, const(char)** argv, out Param params // in druntime: -alias MainFunc = extern(C) int function(char[][] args); +alias MainFunc = extern(C) int function(const(char)[][] args); extern (C) int _d_run_main(int argc, char** argv, MainFunc dMain); @@ -1271,6 +1282,9 @@ else if (params.useSwitchError == CHECKENABLE._default) params.useSwitchError = CHECKENABLE.off; + + if (params.useNullCheck == CHECKENABLE._default) + params.useNullCheck = CHECKENABLE.off; } else { @@ -1291,6 +1305,9 @@ else if (params.useSwitchError == CHECKENABLE._default) params.useSwitchError = CHECKENABLE.on; + + if (params.useNullCheck == CHECKENABLE._default) + params.useNullCheck = CHECKENABLE.off; } if (params.betterC) diff --git a/dmd/mangle.h b/dmd/mangle.h index 97875c5dddf..488755e5ab1 100644 --- a/dmd/mangle.h +++ b/dmd/mangle.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/mangle/basic.d b/dmd/mangle/basic.d index 263dd5ed469..f50faaa9b5a 100644 --- a/dmd/mangle/basic.d +++ b/dmd/mangle/basic.d @@ -1,7 +1,7 @@ /** * Defines the building blocks for creating the mangled names for basic types. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mangle/basic.d, _basicmangle.d) * Documentation: https://dlang.org/phobos/dmd_basicmangle.html diff --git a/dmd/mangle/cpp.d b/dmd/mangle/cpp.d index d9704718fb8..bf7c46e19c7 100644 --- a/dmd/mangle/cpp.d +++ b/dmd/mangle/cpp.d @@ -4,7 +4,7 @@ * This is the POSIX side of the implementation. * It exports two functions to C++, `toCppMangleItanium` and `cppTypeInfoMangleItanium`. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mangle/cpp.d, _cppmangle.d) @@ -27,6 +27,8 @@ import dmd.attrib; import dmd.declaration; import dmd.dsymbol; import dmd.dsymbolsem : isGNUABITag, toAlias, equals; +import dmd.expressionsem : toStringExp, toInteger, toUInteger; +import dmd.templatesem : computeOneMember; import dmd.dtemplate; import dmd.errors; import dmd.expression; @@ -509,6 +511,10 @@ private final class CppMangleVisitor : Visitor // `&function` Dsymbol d = isDsymbol(o); Expression e = isExpression(o); + + if (d && d.isTemplateDeclaration()) + d.isTemplateDeclaration().computeOneMember(); + if (d && d.isFuncDeclaration()) { // X .. E => template parameter is an expression diff --git a/dmd/mangle/cppwin.d b/dmd/mangle/cppwin.d index 1e6a2848fd4..a89b4af78ee 100644 --- a/dmd/mangle/cppwin.d +++ b/dmd/mangle/cppwin.d @@ -1,7 +1,7 @@ /** * Do mangling for C++ linkage for Digital Mars C++ and Microsoft Visual C++. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mangle/cppwin.d, _cppmanglewin.d) @@ -21,6 +21,8 @@ import dmd.denum : isSpecialEnumIdent; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem : toAlias; +import dmd.expressionsem : toStringExp, toInteger, toUInteger; +import dmd.templatesem : computeOneMember; import dmd.dtemplate; import dmd.errors; import dmd.errorsink; @@ -608,6 +610,9 @@ extern(D): Dsymbol d = isDsymbol(o); Expression e = isExpression(o); + if (d && d.isTemplateDeclaration()) + d.isTemplateDeclaration().computeOneMember(); + if (d && d.isFuncDeclaration()) { buf.writeByte('$'); diff --git a/dmd/mangle/package.d b/dmd/mangle/package.d index a6a80b7be7b..8a3f59cae9d 100644 --- a/dmd/mangle/package.d +++ b/dmd/mangle/package.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/abi.html#name_mangling, Name Mangling) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mangle/package.d, _dmangle.d) @@ -146,6 +146,7 @@ import dmd.dinterpret; import dmd.dmodule; import dmd.dsymbol; import dmd.dsymbolsem : toAlias; +import dmd.expressionsem : toInteger, toReal, toImaginary; import dmd.dtemplate; import dmd.errors; import dmd.expression; diff --git a/dmd/mars.d b/dmd/mars.d index 0946553f5f6..71759806a13 100644 --- a/dmd/mars.d +++ b/dmd/mars.d @@ -4,7 +4,7 @@ * utilities needed for arguments parsing, path manipulation, etc... * This file is not shared with other compilers which use the DMD front-end. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mars.d, _mars.d) @@ -592,7 +592,7 @@ else // !IN_LLVM * * Params: * arguments = command line arguments - * argc = argument count + * argc = original argument count before adding from DFLAGS * params = set to result of parsing `arguments` * files = set to files pulled from `arguments` * target = more things set to result of parsing `arguments` @@ -836,7 +836,7 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param mixin(checkOptionsMixin("check", "`-check=` requires an action")); /* Parse: - * -check=[assert|bounds|in|invariant|out|switch][=[on|off]] + * -check=[assert|bounds|in|invariant|out|switch|nullderef][=[on|off]] */ // Check for legal option string; return true if so @@ -871,6 +871,7 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param params.useInvariants = CHECKENABLE.on; params.useOut = CHECKENABLE.on; params.useSwitchError = CHECKENABLE.on; + params.useNullCheck = CHECKENABLE.on; } else if (checkarg == "off") { @@ -880,13 +881,15 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param params.useInvariants = CHECKENABLE.off; params.useOut = CHECKENABLE.off; params.useSwitchError = CHECKENABLE.off; + params.useNullCheck = CHECKENABLE.off; } else if (!(check(checkarg, "assert", params.useAssert) || check(checkarg, "bounds", params.useArrayBounds) || check(checkarg, "in", params.useIn ) || check(checkarg, "invariant", params.useInvariants ) || check(checkarg, "out", params.useOut ) || - check(checkarg, "switch", params.useSwitchError))) + check(checkarg, "switch", params.useSwitchError) || + check(checkarg, "nullderef", params.useNullCheck))) { errorInvalidSwitch(p); params.help.check = true; @@ -1005,6 +1008,8 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param auto filename = p + 1+7+1+4; files.push(filename); params.editionFiles[filename] = params.edition; + // FIXME: params.edition should not be set when there's a filename + error("`-edition` is not supported with a filename yet"); } } else if (arg == "-fIBT") @@ -1741,6 +1746,10 @@ bool parseCommandLine(const ref Strings arguments, const size_t argc, out Param { params.useExceptions = false; } + else if (arg == "-nothrow-optimizations") // https://dlang.org/dmd.html#switch-nothrow-optimizations + { + params.nothrowOptimizations = true; + } else if (arg == "-unittest") params.useUnitTests = true; else if (p[1] == 'I') // https://dlang.org/dmd.html#switch-I diff --git a/dmd/module.h b/dmd/module.h index 72babd4a231..8896f414142 100644 --- a/dmd/module.h +++ b/dmd/module.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -38,13 +38,6 @@ enum PKG PKGpackage // already determined that's an actual package }; -enum class Edition : uint16_t -{ - v2023 = 2023, - v2024, - v2025, -}; - class Package : public ScopeDsymbol { public: @@ -123,7 +116,7 @@ class Module final : public Package Identifiers *versionidsNot; // forward referenced version identifiers MacroTable macrotable; // document comment macros - Escape *escapetable; // document comment escapes + void *escapetable; // document comment escapes (Escape*) size_t nameoffset; // offset of module name from start of ModuleInfo size_t namelen; // length of module name in characters diff --git a/dmd/mtype.d b/dmd/mtype.d index 53be31c796a..60e8ec682a9 100644 --- a/dmd/mtype.d +++ b/dmd/mtype.d @@ -1,7 +1,7 @@ /** * Defines a D type. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mtype.d, _mtype.d) @@ -17,7 +17,6 @@ import core.stdc.stdio; import core.stdc.stdlib; import core.stdc.string; -import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; import dmd.ast_node; @@ -26,23 +25,17 @@ import dmd.declaration; import dmd.denum; import dmd.dstruct; import dmd.dsymbol; -import dmd.dsymbolsem: size; import dmd.dtemplate; -import dmd.enumsem; -import dmd.errors; import dmd.expression; import dmd.hdrgen; import dmd.id; import dmd.identifier; import dmd.location; -import dmd.root.ctfloat; import dmd.common.outbuffer; import dmd.root.rmem; import dmd.rootobject; import dmd.root.stringtable; -import dmd.target; import dmd.tokens; -import dmd.typesem; import dmd.visitor; enum LOGDOTEXP = 0; // log ::dotExp() @@ -56,11 +49,133 @@ static if (__VERSION__ < 2095) private alias StringValueType = StringValue!Type; } -private auto X(T, U)(T m, U n) +private auto X(T, U)(T m, U n) nothrow { return (m << 4) | n; } +bool isImaginaryNonSemantic(Type _this) +{ + assert(_this.isTypeEnum() is null); + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.imaginary) != 0; + return false; +} + +Type toBaseTypeNonSemantic(Type _this) +{ + if (auto te = _this.isTypeEnum()) + { + if (!te.sym.members && !te.sym.memtype) + return te; + return te.sym.memtype.toBaseTypeNonSemantic(); + } + return _this; +} + +/* Helper function for `typeToExpression`. Contains common code + * for TypeQualified derived classes. + */ +Expression typeToExpressionHelper(TypeQualified t, Expression e, size_t i = 0) +{ + //printf("toExpressionHelper(e = %s %s)\n", EXPtoString(e.op).ptr, e.toChars()); + foreach (id; t.idents[i .. t.idents.length]) + { + //printf("\t[%d] e: '%s', id: '%s'\n", i, e.toChars(), id.toChars()); + + final switch (id.dyncast()) + { + // ... '. ident' + case DYNCAST.identifier: + e = new DotIdExp(e.loc, e, cast(Identifier)id); + break; + + // ... '. name!(tiargs)' + case DYNCAST.dsymbol: + auto ti = (cast(Dsymbol)id).isTemplateInstance(); + assert(ti); + e = new DotTemplateInstanceExp(e.loc, e, ti.name, ti.tiargs); + break; + + // ... '[type]' + case DYNCAST.type: // https://issues.dlang.org/show_bug.cgi?id=1215 + e = new ArrayExp(t.loc, e, new TypeExp(t.loc, cast(Type)id)); + break; + + // ... '[expr]' + case DYNCAST.expression: // https://issues.dlang.org/show_bug.cgi?id=1215 + e = new ArrayExp(t.loc, e, cast(Expression)id); + break; + + case DYNCAST.object: + case DYNCAST.tuple: + case DYNCAST.parameter: + case DYNCAST.statement: + case DYNCAST.condition: + case DYNCAST.templateparameter: + case DYNCAST.initializer: + assert(0); + } + } + return e; +} + +/****************************************** + * We've mistakenly parsed `t` as a type. + * Redo `t` as an Expression only if there are no type modifiers. + * Params: + * t = mistaken type + * Returns: + * t redone as Expression, null if cannot + */ +Expression typeToExpression(Type t) +{ + static Expression visitSArray(TypeSArray t) + { + if (auto e = t.next.typeToExpression()) + return new ArrayExp(t.dim.loc, e, t.dim); + return null; + } + + static Expression visitAArray(TypeAArray t) + { + if (auto e = t.next.typeToExpression()) + { + if (auto ei = t.index.typeToExpression()) + return new ArrayExp(t.loc, e, ei); + } + return null; + } + + static Expression visitIdentifier(TypeIdentifier t) + { + return typeToExpressionHelper(t, new IdentifierExp(t.loc, t.ident)); + } + + static Expression visitInstance(TypeInstance t) + { + return typeToExpressionHelper(t, new ScopeExp(t.loc, t.tempinst)); + } + + // easy way to enable 'auto v = new int[mixin("exp")];' in 2.088+ + static Expression visitMixin(TypeMixin t) + { + return new TypeExp(t.loc, t); + } + + if (t.mod) + return null; + switch (t.ty) + { + case Tsarray: return visitSArray(t.isTypeSArray()); + case Taarray: return visitAArray(t.isTypeAArray()); + case Tident: return visitIdentifier(t.isTypeIdentifier()); + case Tinstance: return visitInstance(t.isTypeInstance()); + case Tmixin: return visitMixin(t.isTypeMixin()); + default: return null; + } +} + /*************************** * Return !=0 if modfrom can be implicitly converted to modto */ @@ -289,6 +404,10 @@ extern (C++) abstract class Type : ASTNode * we bank on the idea that usually only one of variants exist. * It will also speed up code because these are rarely referenced and * so need not be in the cache. + * + * NOTE: The cache stores the naked type at the "identity" position. + * For example, a "shared const T" type will have its naked "T" type + * in the field "scto". See also: dmd.typesem.nakedOf(Type). */ Type cto; // MODFlags.const_ Type ito; // MODFlags.immutable_ @@ -407,7 +526,7 @@ version (IN_LLVM) return sizeTy; }(); - final extern (D) this(TY ty) scope @safe + final extern (D) this(TY ty) scope @safe nothrow { this.ty = ty; } @@ -430,7 +549,7 @@ version (IN_LLVM) assert(0); } - final bool equals(const Type t) const + final bool equals(const Type t) const nothrow { //printf("Type::equals(%s, %s)\n", toChars(), t.toChars()); if (this == t) @@ -464,20 +583,20 @@ version (IN_LLVM) } // kludge for template.isType() - override final DYNCAST dyncast() const + override final DYNCAST dyncast() const nothrow { return DYNCAST.type; } /// Returns a non-zero unique ID for this Type, or returns 0 if the Type does not (yet) have a unique ID. /// If `semantic()` has not been run, 0 is returned. - final size_t getUniqueID() const + final size_t getUniqueID() const nothrow { return cast(size_t) deco; } extern (D) - final Mcache* getMcache() + final Mcache* getMcache() nothrow { if (!mcache) mcache = cast(Mcache*) mem.xcalloc(Mcache.sizeof, 1); @@ -504,143 +623,17 @@ version (IN_LLVM) return buf.extractChars(); } - static void _init() - { - stringtable._init(14_000); - - // Set basic types - __gshared TY* basetab = - [ - Tvoid, - Tint8, - Tuns8, - Tint16, - Tuns16, - Tint32, - Tuns32, - Tint64, - Tuns64, - Tint128, - Tuns128, - Tfloat32, - Tfloat64, - Tfloat80, - Timaginary32, - Timaginary64, - Timaginary80, - Tcomplex32, - Tcomplex64, - Tcomplex80, - Tbool, - Tchar, - Twchar, - Tdchar, - Terror - ]; - - static Type merge(Type t) - { - import dmd.mangle.basic : tyToDecoBuffer; - - OutBuffer buf; - buf.reserve(3); - - if (t.ty == Tnoreturn) - buf.writestring("Nn"); - else - tyToDecoBuffer(buf, t.ty); - - auto sv = t.stringtable.update(buf[]); - if (sv.value) - return sv.value; - t.deco = cast(char*)sv.toDchars(); - sv.value = t; - return t; - } - - for (size_t i = 0; basetab[i] != Terror; i++) - { - Type t = new TypeBasic(basetab[i]); - t = merge(t); - basic[basetab[i]] = t; - } - basic[Terror] = new TypeError(); - - tnoreturn = new TypeNoreturn(); - tnoreturn.deco = merge(tnoreturn).deco; - basic[Tnoreturn] = tnoreturn; - - tvoid = basic[Tvoid]; - tint8 = basic[Tint8]; - tuns8 = basic[Tuns8]; - tint16 = basic[Tint16]; - tuns16 = basic[Tuns16]; - tint32 = basic[Tint32]; - tuns32 = basic[Tuns32]; - tint64 = basic[Tint64]; - tuns64 = basic[Tuns64]; - tint128 = basic[Tint128]; - tuns128 = basic[Tuns128]; - tfloat32 = basic[Tfloat32]; - tfloat64 = basic[Tfloat64]; - tfloat80 = basic[Tfloat80]; - - timaginary32 = basic[Timaginary32]; - timaginary64 = basic[Timaginary64]; - timaginary80 = basic[Timaginary80]; - - tcomplex32 = basic[Tcomplex32]; - tcomplex64 = basic[Tcomplex64]; - tcomplex80 = basic[Tcomplex80]; - - tbool = basic[Tbool]; - tchar = basic[Tchar]; - twchar = basic[Twchar]; - tdchar = basic[Tdchar]; - - tshiftcnt = tint32; - terror = basic[Terror]; - tnoreturn = basic[Tnoreturn]; - tnull = new TypeNull(); - tnull.deco = merge(tnull).deco; - - tvoidptr = tvoid.pointerTo(); - tstring = tchar.immutableOf().arrayOf(); - twstring = twchar.immutableOf().arrayOf(); - tdstring = tdchar.immutableOf().arrayOf(); - - const isLP64 = target.isLP64; - - tsize_t = basic[isLP64 ? Tuns64 : Tuns32]; - tptrdiff_t = basic[isLP64 ? Tint64 : Tint32]; - thash_t = tsize_t; - - static if (__VERSION__ == 2081) - { - // Related issue: https://issues.dlang.org/show_bug.cgi?id=19134 - // D 2.081.x regressed initializing class objects at compile time. - // As a workaround initialize this global at run-time instead. - TypeTuple.empty = new TypeTuple(); - } - } - /** * Deinitializes the global state of the compiler. * * This can be used to restore the state set by `_init` to its original * state. */ - static void deinitialize() + static void deinitialize() nothrow { stringtable = stringtable.init; } - uint alignsize() - { - import dmd.typesem: size; - return cast(uint)size(this, Loc.initial); - } - /********************************* * Store this type's modifier name into buf. */ @@ -664,60 +657,11 @@ version (IN_LLVM) return buf.extractChars(); } - bool isIntegral() - { - return false; - } - - // real, imaginary, or complex - bool isFloating() + bool isScopeClass() nothrow { return false; } - bool isReal() - { - return false; - } - - bool isImaginary() - { - return false; - } - - bool isComplex() - { - return false; - } - - bool isScalar() - { - return false; - } - - bool isUnsigned() - { - return false; - } - - bool isScopeClass() - { - return false; - } - - bool isString() - { - return false; - } - - /************************** - * Returns true if T can be converted to boolean value. - */ - bool isBoolean() - { - return isScalar(); - } - final bool isConst() const nothrow pure @nogc @safe { return (mod & MODFlags.const_) != 0; @@ -784,554 +728,11 @@ version (IN_LLVM) return t; } - /********************************** - * For our new type 'this', which is type-constructed from t, - * fill in the cto, ito, sto, scto, wto shortcuts. - */ - extern (D) final void fixTo(Type t) - { - // If fixing this: immutable(T*) by t: immutable(T)*, - // cache t to this.xto won't break transitivity. - Type mto = null; - Type tn = nextOf(); - if (!tn || ty != Tsarray && tn.mod == t.nextOf().mod) - { - switch (t.mod) - { - case 0: - mto = t; - break; - - case MODFlags.const_: - getMcache(); - mcache.cto = t; - break; - - case MODFlags.wild: - getMcache(); - mcache.wto = t; - break; - - case MODFlags.wildconst: - getMcache(); - mcache.wcto = t; - break; - - case MODFlags.shared_: - getMcache(); - mcache.sto = t; - break; - - case MODFlags.shared_ | MODFlags.const_: - getMcache(); - mcache.scto = t; - break; - - case MODFlags.shared_ | MODFlags.wild: - getMcache(); - mcache.swto = t; - break; - - case MODFlags.shared_ | MODFlags.wildconst: - getMcache(); - mcache.swcto = t; - break; - - case MODFlags.immutable_: - getMcache(); - mcache.ito = t; - break; - - default: - break; - } - } - assert(mod != t.mod); - - if (mod) - { - getMcache(); - t.getMcache(); - } - switch (mod) - { - case 0: - break; - - case MODFlags.const_: - mcache.cto = mto; - t.mcache.cto = this; - break; - - case MODFlags.wild: - mcache.wto = mto; - t.mcache.wto = this; - break; - - case MODFlags.wildconst: - mcache.wcto = mto; - t.mcache.wcto = this; - break; - - case MODFlags.shared_: - mcache.sto = mto; - t.mcache.sto = this; - break; - - case MODFlags.shared_ | MODFlags.const_: - mcache.scto = mto; - t.mcache.scto = this; - break; - - case MODFlags.shared_ | MODFlags.wild: - mcache.swto = mto; - t.mcache.swto = this; - break; - - case MODFlags.shared_ | MODFlags.wildconst: - mcache.swcto = mto; - t.mcache.swcto = this; - break; - - case MODFlags.immutable_: - t.mcache.ito = this; - if (t.mcache.cto) - t.mcache.cto.getMcache().ito = this; - if (t.mcache.sto) - t.mcache.sto.getMcache().ito = this; - if (t.mcache.scto) - t.mcache.scto.getMcache().ito = this; - if (t.mcache.wto) - t.mcache.wto.getMcache().ito = this; - if (t.mcache.wcto) - t.mcache.wcto.getMcache().ito = this; - if (t.mcache.swto) - t.mcache.swto.getMcache().ito = this; - if (t.mcache.swcto) - t.mcache.swcto.getMcache().ito = this; - break; - - default: - assert(0); - } - - check(); - t.check(); - //printf("fixTo: %s, %s\n", toChars(), t.toChars()); - } - - /*************************** - * Look for bugs in constructing types. - */ - extern (D) final void check() - { - if (mcache) - with (mcache) - switch (mod) - { - case 0: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.const_: - if (cto) - assert(cto.mod == 0); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.wild: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == 0); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.wildconst: - assert(!cto || cto.mod == MODFlags.const_); - assert(!ito || ito.mod == MODFlags.immutable_); - assert(!sto || sto.mod == MODFlags.shared_); - assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_)); - assert(!wto || wto.mod == MODFlags.wild); - assert(!wcto || wcto.mod == 0); - assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild)); - assert(!swcto || swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.shared_: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == 0); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.shared_ | MODFlags.const_: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == 0); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.shared_ | MODFlags.wild: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == MODFlags.immutable_); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == 0); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - case MODFlags.shared_ | MODFlags.wildconst: - assert(!cto || cto.mod == MODFlags.const_); - assert(!ito || ito.mod == MODFlags.immutable_); - assert(!sto || sto.mod == MODFlags.shared_); - assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_)); - assert(!wto || wto.mod == MODFlags.wild); - assert(!wcto || wcto.mod == MODFlags.wildconst); - assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild)); - assert(!swcto || swcto.mod == 0); - break; - - case MODFlags.immutable_: - if (cto) - assert(cto.mod == MODFlags.const_); - if (ito) - assert(ito.mod == 0); - if (sto) - assert(sto.mod == MODFlags.shared_); - if (scto) - assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); - if (wto) - assert(wto.mod == MODFlags.wild); - if (wcto) - assert(wcto.mod == MODFlags.wildconst); - if (swto) - assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); - if (swcto) - assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - break; - - default: - assert(0); - } - - Type tn = nextOf(); - if (tn && ty != Tfunction && tn.ty != Tfunction && ty != Tenum) - { - // Verify transitivity - switch (mod) - { - case 0: - case MODFlags.const_: - case MODFlags.wild: - case MODFlags.wildconst: - case MODFlags.shared_: - case MODFlags.shared_ | MODFlags.const_: - case MODFlags.shared_ | MODFlags.wild: - case MODFlags.shared_ | MODFlags.wildconst: - case MODFlags.immutable_: - assert(tn.mod == MODFlags.immutable_ || (tn.mod & mod) == mod); - break; - - default: - assert(0); - } - tn.check(); - } - } - - /************************************* - * Apply STCxxxx bits to existing type. - * Use *before* semantic analysis is run. - */ - extern (D) final Type addSTC(STC stc) - { - Type t = this; - if (t.isImmutable()) - { - return t; - } - else if (stc & STC.immutable_) - { - t = t.makeImmutable(); - return t; - } - - if ((stc & STC.shared_) && !t.isShared()) - { - if (t.isWild()) - { - if (t.isConst()) - t = t.makeSharedWildConst(); - else - t = t.makeSharedWild(); - } - else - { - if (t.isConst()) - t = t.makeSharedConst(); - else - t = t.makeShared(); - } - } - if ((stc & STC.const_) && !t.isConst()) - { - if (t.isShared()) - { - if (t.isWild()) - t = t.makeSharedWildConst(); - else - t = t.makeSharedConst(); - } - else - { - if (t.isWild()) - t = t.makeWildConst(); - else - t = t.makeConst(); - } - } - if ((stc & STC.wild) && !t.isWild()) - { - if (t.isShared()) - { - if (t.isConst()) - t = t.makeSharedWildConst(); - else - t = t.makeSharedWild(); - } - else - { - if (t.isConst()) - t = t.makeWildConst(); - else - t = t.makeWild(); - } - } - - return t; - } - - final bool hasDeprecatedAliasThis() - { - auto ad = isAggregate(this); - return ad && ad.aliasthis && (ad.aliasthis.isDeprecated || ad.aliasthis.sym.isDeprecated); - } - - Type makeConst() - { - //printf("Type::makeConst() %p, %s\n", this, toChars()); - if (mcache && mcache.cto) - return mcache.cto; - Type t = this.nullAttributes(); - t.mod = MODFlags.const_; - //printf("-Type::makeConst() %p, %s\n", t, toChars()); - return t; - } - - Type makeImmutable() - { - if (mcache && mcache.ito) - return mcache.ito; - Type t = this.nullAttributes(); - t.mod = MODFlags.immutable_; - return t; - } - - Type makeShared() - { - if (mcache && mcache.sto) - return mcache.sto; - Type t = this.nullAttributes(); - t.mod = MODFlags.shared_; - return t; - } - - Type makeSharedConst() - { - if (mcache && mcache.scto) - return mcache.scto; - Type t = this.nullAttributes(); - t.mod = MODFlags.shared_ | MODFlags.const_; - return t; - } - - Type makeWild() - { - if (mcache && mcache.wto) - return mcache.wto; - Type t = this.nullAttributes(); - t.mod = MODFlags.wild; - return t; - } - - Type makeWildConst() - { - if (mcache && mcache.wcto) - return mcache.wcto; - Type t = this.nullAttributes(); - t.mod = MODFlags.wildconst; - return t; - } - - Type makeSharedWild() - { - if (mcache && mcache.swto) - return mcache.swto; - Type t = this.nullAttributes(); - t.mod = MODFlags.shared_ | MODFlags.wild; - return t; - } - - Type makeSharedWildConst() - { - if (mcache && mcache.swcto) - return mcache.swcto; - Type t = this.nullAttributes(); - t.mod = MODFlags.shared_ | MODFlags.wildconst; - return t; - } - - Type makeMutable() - { - Type t = this.nullAttributes(); - t.mod = mod & MODFlags.shared_; - return t; - } - - /******************************* - * If this is a shell around another type, - * get that other type. - */ - final Type toBasetype() - { - /* This function is used heavily. - * De-virtualize it so it can be easily inlined. - */ - TypeEnum te; - return ((te = isTypeEnum()) !is null) ? te.toBasetype2() : this; - } - - /*************************************** - * Compute MOD bits matching `this` argument type to wild parameter type. - * Params: - * t = corresponding parameter type - * isRef = parameter is `ref` or `out` - * Returns: - * MOD bits - */ - MOD deduceWild(Type t, bool isRef) - { - //printf("Type::deduceWild this = '%s', tprm = '%s'\n", toChars(), tprm.toChars()); - if (t.isWild()) - { - if (isImmutable()) - return MODFlags.immutable_; - if (isWildConst()) - { - if (t.isWildConst()) - return MODFlags.wild; - return MODFlags.wildconst; - } - if (isWild()) - return MODFlags.wild; - if (isConst()) - return MODFlags.const_; - if (isMutable()) - return MODFlags.mutable; - assert(0); - } - return 0; - } - inout(ClassDeclaration) isClassHandle() inout { return null; } - /************************************ - * Return alignment to use for this type. - */ - structalign_t alignment() - { - structalign_t s; - s.setDefault(); - return s; - } - /*************************************** * Return !=0 if the type or any of its subtypes is wild. */ @@ -1340,122 +741,8 @@ version (IN_LLVM) return mod & MODFlags.wild; } - /************************************* - * Detect if type has pointer fields that are initialized to void. - * Local stack variables with such void fields can remain uninitialized, - * leading to pointer bugs. - * Returns: - * true if so - */ - bool hasVoidInitPointers() - { - return false; - } - - /************************************* - * Detect if this is an unsafe type because of the presence of `@system` members - * Returns: - * true if so - */ - bool hasUnsafeBitpatterns() - { - return false; - } - - /*************************************** - * Returns: true if type has any invariants - */ - bool hasInvariant() - { - //printf("Type::hasInvariant() %s, %d\n", toChars(), ty); - return false; - } - - /************************************* - * If this is a type of something, return that something. - */ - Type nextOf() - { - return null; - } - - /************************************* - * If this is a type of static array, return its base element type. - */ - final Type baseElemOf() - { - Type t = toBasetype(); - TypeSArray tsa; - while ((tsa = t.isTypeSArray()) !is null) - t = tsa.next.toBasetype(); - return t; - } - - /**************************************** - * Return the mask that an integral type will - * fit into. - */ - extern (D) final ulong sizemask() - { - ulong m; - switch (toBasetype().ty) - { - case Tbool: - m = 1; - break; - case Tchar: - case Tint8: - case Tuns8: - m = 0xFF; - break; - case Twchar: - case Tint16: - case Tuns16: - m = 0xFFFFU; - break; - case Tdchar: - case Tint32: - case Tuns32: - m = 0xFFFFFFFFU; - break; - case Tint64: - case Tuns64: - m = 0xFFFFFFFFFFFFFFFFUL; - break; - default: - assert(0); - } - return m; - } - - /******************************** - * true if when type goes out of scope, it needs a destructor applied. - * Only applies to value types, not ref types. - */ - bool needsDestruction() - { - return false; - } - - /******************************** - * true if when type is copied, it needs a copy constructor or postblit - * applied. Only applies to value types, not ref types. - */ - bool needsCopyOrPostblit() - { - return false; - } - - /********************************* - * - */ - bool needsNested() - { - return false; - } - // For eliminating dynamic_cast - TypeBasic isTypeBasic() + TypeBasic isTypeBasic() nothrow { return null; } @@ -1526,7 +813,7 @@ version (IN_LLVM) v.visit(this); } - final TypeFunction toTypeFunction() + final TypeFunction toTypeFunction() nothrow { if (ty != Tfunction) assert(0); @@ -1557,12 +844,12 @@ extern (C++) final class TypeError : Type super(Terror); } - override const(char)* kind() const + override const(char)* kind() const nothrow { return "error"; } - override TypeError syntaxCopy() + override TypeError syntaxCopy() nothrow { // No semantic analysis done, no need to copy return this; @@ -1590,245 +877,9 @@ extern (C++) abstract class TypeNext : Type { if (ty == Tfunction) return 0; - if (ty == Tdelegate) - return Type.hasWild(); - return mod & MODFlags.wild || (next && next.hasWild()); - } - - /******************************* - * For TypeFunction, nextOf() can return NULL if the function return - * type is meant to be inferred, and semantic() hasn't yet been run - * on the function. After semantic(), it must no longer be NULL. - */ - override final Type nextOf() @safe - { - return next; - } - - override final Type makeConst() - { - //printf("TypeNext::makeConst() %p, %s\n", this, toChars()); - if (mcache && mcache.cto) - { - assert(mcache.cto.mod == MODFlags.const_); - return mcache.cto; - } - TypeNext t = cast(TypeNext)Type.makeConst(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isShared()) - { - if (next.isWild()) - t.next = next.sharedWildConstOf(); - else - t.next = next.sharedConstOf(); - } - else - { - if (next.isWild()) - t.next = next.wildConstOf(); - else - t.next = next.constOf(); - } - } - //printf("TypeNext::makeConst() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeImmutable() - { - //printf("TypeNext::makeImmutable() %s\n", toChars()); - if (mcache && mcache.ito) - { - assert(mcache.ito.isImmutable()); - return mcache.ito; - } - TypeNext t = cast(TypeNext)Type.makeImmutable(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - t.next = next.immutableOf(); - } - return t; - } - - override final Type makeShared() - { - //printf("TypeNext::makeShared() %s\n", toChars()); - if (mcache && mcache.sto) - { - assert(mcache.sto.mod == MODFlags.shared_); - return mcache.sto; - } - TypeNext t = cast(TypeNext)Type.makeShared(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isWild()) - { - if (next.isConst()) - t.next = next.sharedWildConstOf(); - else - t.next = next.sharedWildOf(); - } - else - { - if (next.isConst()) - t.next = next.sharedConstOf(); - else - t.next = next.sharedOf(); - } - } - //printf("TypeNext::makeShared() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeSharedConst() - { - //printf("TypeNext::makeSharedConst() %s\n", toChars()); - if (mcache && mcache.scto) - { - assert(mcache.scto.mod == (MODFlags.shared_ | MODFlags.const_)); - return mcache.scto; - } - TypeNext t = cast(TypeNext)Type.makeSharedConst(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isWild()) - t.next = next.sharedWildConstOf(); - else - t.next = next.sharedConstOf(); - } - //printf("TypeNext::makeSharedConst() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeWild() - { - //printf("TypeNext::makeWild() %s\n", toChars()); - if (mcache && mcache.wto) - { - assert(mcache.wto.mod == MODFlags.wild); - return mcache.wto; - } - TypeNext t = cast(TypeNext)Type.makeWild(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isShared()) - { - if (next.isConst()) - t.next = next.sharedWildConstOf(); - else - t.next = next.sharedWildOf(); - } - else - { - if (next.isConst()) - t.next = next.wildConstOf(); - else - t.next = next.wildOf(); - } - } - //printf("TypeNext::makeWild() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeWildConst() - { - //printf("TypeNext::makeWildConst() %s\n", toChars()); - if (mcache && mcache.wcto) - { - assert(mcache.wcto.mod == MODFlags.wildconst); - return mcache.wcto; - } - TypeNext t = cast(TypeNext)Type.makeWildConst(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isShared()) - t.next = next.sharedWildConstOf(); - else - t.next = next.wildConstOf(); - } - //printf("TypeNext::makeWildConst() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeSharedWild() - { - //printf("TypeNext::makeSharedWild() %s\n", toChars()); - if (mcache && mcache.swto) - { - assert(mcache.swto.isSharedWild()); - return mcache.swto; - } - TypeNext t = cast(TypeNext)Type.makeSharedWild(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - if (next.isConst()) - t.next = next.sharedWildConstOf(); - else - t.next = next.sharedWildOf(); - } - //printf("TypeNext::makeSharedWild() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeSharedWildConst() - { - //printf("TypeNext::makeSharedWildConst() %s\n", toChars()); - if (mcache && mcache.swcto) - { - assert(mcache.swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); - return mcache.swcto; - } - TypeNext t = cast(TypeNext)Type.makeSharedWildConst(); - if (ty != Tfunction && next.ty != Tfunction && !next.isImmutable()) - { - t.next = next.sharedWildConstOf(); - } - //printf("TypeNext::makeSharedWildConst() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final Type makeMutable() - { - //printf("TypeNext::makeMutable() %p, %s\n", this, toChars()); - TypeNext t = cast(TypeNext)Type.makeMutable(); - if (ty == Tsarray) - { - t.next = next.mutableOf(); - } - //printf("TypeNext::makeMutable() returns %p, %s\n", t, t.toChars()); - return t; - } - - override final MOD deduceWild(Type t, bool isRef) - { - if (ty == Tfunction) - return 0; - - ubyte wm; - - Type tn = t.nextOf(); - if (!isRef && (ty == Tarray || ty == Tpointer) && tn) - { - wm = next.deduceWild(tn, true); - if (!wm) - wm = Type.deduceWild(t, true); - } - else - { - wm = Type.deduceWild(t, isRef); - if (!wm && tn) - wm = next.deduceWild(tn, true); - } - - return wm; - } - - final void transitive() - { - /* Invoke transitivity of type attributes - */ - next = next.addMod(mod); + if (ty == Tdelegate) + return Type.hasWild(); + return mod & MODFlags.wild || (next && next.hasWild()); } override void accept(Visitor v) @@ -1975,7 +1026,6 @@ extern (C++) final class TypeBasic : Type } this.dstring = d; this.flags = flags; - merge(this); } override const(char)* kind() const @@ -1989,52 +1039,6 @@ extern (C++) final class TypeBasic : Type return this; } - override uint alignsize() - { - return target.alignsize(this); - } - - override bool isIntegral() - { - //printf("TypeBasic::isIntegral('%s') x%x\n", toChars(), flags); - return (flags & TFlags.integral) != 0; - } - - override bool isFloating() - { - return (flags & TFlags.floating) != 0; - } - - override bool isReal() - { - return (flags & TFlags.real_) != 0; - } - - override bool isImaginary() - { - return (flags & TFlags.imaginary) != 0; - } - - override bool isComplex() - { - return (flags & TFlags.complex) != 0; - } - - override bool isScalar() - { - return (flags & (TFlags.integral | TFlags.floating)) != 0; - } - - override bool isUnsigned() - { - return (flags & TFlags.unsigned) != 0; - } - - override bool hasUnsafeBitpatterns() - { - return ty == Tbool; - } - // For eliminating dynamic_cast override TypeBasic isTypeBasic() { @@ -2078,43 +1082,11 @@ extern (C++) final class TypeVector : Type return new TypeVector(basetype.syntaxCopy()); } - override uint alignsize() - { - import dmd.typesem: size; - return cast(uint)basetype.size(); - } - - override bool isIntegral() - { - //printf("TypeVector::isIntegral('%s') x%x\n", toChars(), flags); - return basetype.nextOf().isIntegral(); - } - - override bool isFloating() - { - return basetype.nextOf().isFloating(); - } - - override bool isScalar() - { - return basetype.nextOf().isScalar(); - } - - override bool isUnsigned() - { - return basetype.nextOf().isUnsigned(); - } - - override bool isBoolean() - { - return false; - } - TypeBasic elementType() { assert(basetype.ty == Tsarray); TypeSArray t = cast(TypeSArray)basetype; - TypeBasic tb = t.nextOf().isTypeBasic(); + TypeBasic tb = t.next.isTypeBasic(); assert(tb); return tb; } @@ -2184,55 +1156,6 @@ extern (C++) final class TypeSArray : TypeArray return dim.isIntegerExp() && dim.isIntegerExp().getInteger() == 0; } - override uint alignsize() - { - return next.alignsize(); - } - - override bool isString() - { - TY nty = next.toBasetype().ty; - return nty.isSomeChar; - } - - override structalign_t alignment() - { - return next.alignment(); - } - - override bool hasUnsafeBitpatterns() - { - return next.hasUnsafeBitpatterns(); - } - - override bool hasVoidInitPointers() - { - return next.hasVoidInitPointers(); - } - - override bool hasInvariant() - { - return next.hasInvariant(); - } - - override bool needsDestruction() - { - return next.needsDestruction(); - } - - override bool needsCopyOrPostblit() - { - return next.needsCopyOrPostblit(); - } - - /********************************* - * - */ - override bool needsNested() - { - return next.needsNested(); - } - override void accept(Visitor v) { v.visit(this); @@ -2266,24 +1189,6 @@ extern (C++) final class TypeDArray : TypeArray return result; } - override uint alignsize() - { - // A DArray consists of two ptr-sized values, so align it on pointer size - // boundary - return target.ptrsize; - } - - override bool isString() - { - TY nty = next.toBasetype().ty; - return nty.isSomeChar; - } - - override bool isBoolean() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2325,11 +1230,6 @@ extern (C++) final class TypeAArray : TypeArray return result; } - override bool isBoolean() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2366,11 +1266,6 @@ extern (C++) final class TypePointer : TypeNext return result; } - override bool isScalar() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2629,16 +1524,6 @@ extern (C++) final class TypeDelegate : TypeNext return result; } - override uint alignsize() - { - return target.ptrsize; - } - - override bool isBoolean() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -2952,99 +1837,11 @@ extern (C++) final class TypeStruct : Type return "struct"; } - override uint alignsize() - { - sym.size(Loc.initial); // give error for forward references - return sym.alignsize; - } - override TypeStruct syntaxCopy() { return this; } - override structalign_t alignment() - { - if (sym.alignment.isUnknown()) - sym.size(sym.loc); - return sym.alignment; - } - - override bool isBoolean() - { - return false; - } - - override bool needsDestruction() - { - return sym.dtor !is null; - } - - override bool needsCopyOrPostblit() - { - return sym.hasCopyCtor || sym.postblit; - } - - override bool needsNested() - { - if (inuse) return false; // circular type, error instead of crashing - - inuse = true; - scope(exit) inuse = false; - - if (sym.isNested()) - return true; - - for (size_t i = 0; i < sym.fields.length; i++) - { - VarDeclaration v = sym.fields[i]; - if (!v.isDataseg() && v.type.needsNested()) - return true; - } - return false; - } - - override bool hasVoidInitPointers() - { - sym.size(Loc.initial); // give error for forward references - sym.determineTypeProperties(); - return sym.hasVoidInitPointers; - } - - override bool hasUnsafeBitpatterns() - { - sym.size(Loc.initial); // give error for forward references - sym.determineTypeProperties(); - return sym.hasUnsafeBitpatterns; - } - - override bool hasInvariant() - { - sym.size(Loc.initial); // give error for forward references - sym.determineTypeProperties(); - return sym.hasInvariant() || sym.hasFieldWithInvariant; - } - - override MOD deduceWild(Type t, bool isRef) - { - if (ty == t.ty && sym == (cast(TypeStruct)t).sym) - return Type.deduceWild(t, isRef); - - ubyte wm = 0; - - if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing)) - { - if (auto ato = aliasthisOf(this)) - { - att = cast(AliasThisRec)(att | AliasThisRec.tracing); - wm = ato.deduceWild(t, isRef); - att = cast(AliasThisRec)(att & ~AliasThisRec.tracing); - } - } - - return wm; - } - override void accept(Visitor v) { v.visit(this); @@ -3073,107 +1870,6 @@ extern (C++) final class TypeEnum : Type return this; } - Type memType() - { - return sym.getMemtype(Loc.initial); - } - - override uint alignsize() - { - Type t = memType(); - if (t.ty == Terror) - return 4; - return t.alignsize(); - } - - override bool isIntegral() - { - return memType().isIntegral(); - } - - override bool isFloating() - { - return memType().isFloating(); - } - - override bool isReal() - { - return memType().isReal(); - } - - override bool isImaginary() - { - return memType().isImaginary(); - } - - override bool isComplex() - { - return memType().isComplex(); - } - - override bool isScalar() - { - return memType().isScalar(); - } - - override bool isUnsigned() - { - return memType().isUnsigned(); - } - - override bool isBoolean() - { - return memType().isBoolean(); - } - - override bool isString() - { - return memType().isString(); - } - - override bool needsDestruction() - { - return memType().needsDestruction(); - } - - override bool needsCopyOrPostblit() - { - return memType().needsCopyOrPostblit(); - } - - override bool needsNested() - { - return memType().needsNested(); - } - - extern (D) Type toBasetype2() - { - if (!sym.members && !sym.memtype) - return this; - auto tb = sym.getMemtype(Loc.initial).toBasetype(); - return tb.castMod(mod); // retain modifier bits from 'this' - } - - override bool hasVoidInitPointers() - { - return memType().hasVoidInitPointers(); - } - - override bool hasUnsafeBitpatterns() - { - return memType().hasUnsafeBitpatterns(); - } - - override bool hasInvariant() - { - return memType().hasInvariant(); - } - - override Type nextOf() - { - return memType().nextOf(); - } - override void accept(Visitor v) { v.visit(this); @@ -3209,37 +1905,11 @@ extern (C++) final class TypeClass : Type return sym; } - override MOD deduceWild(Type t, bool isRef) - { - ClassDeclaration cd = t.isClassHandle(); - if (cd && (sym == cd || cd.isBaseOf(sym, null))) - return Type.deduceWild(t, isRef); - - ubyte wm = 0; - - if (t.hasWild() && sym.aliasthis && !(att & AliasThisRec.tracing)) - { - if (auto ato = aliasthisOf(this)) - { - att = cast(AliasThisRec)(att | AliasThisRec.tracing); - wm = ato.deduceWild(t, isRef); - att = cast(AliasThisRec)(att & ~AliasThisRec.tracing); - } - } - - return wm; - } - override bool isScopeClass() { return sym.stack; } - override bool isBoolean() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -3418,11 +2088,6 @@ extern (C++) final class TypeNull : Type return this; } - override bool isBoolean() - { - return true; - } - override void accept(Visitor v) { v.visit(this); @@ -3450,16 +2115,6 @@ extern (C++) final class TypeNoreturn : Type return this; } - override bool isBoolean() - { - return true; // bottom type can be implicitly converted to any other type - } - - override uint alignsize() - { - return 0; - } - override void accept(Visitor v) { v.visit(this); @@ -3659,33 +2314,6 @@ extern (C++) final class Parameter : ASTNode return new Parameter(loc, storageClass, type ? type.syntaxCopy() : null, ident, defaultArg ? defaultArg.syntaxCopy() : null, userAttribDecl ? userAttribDecl.syntaxCopy(null) : null); } - /**************************************************** - * Determine if parameter is a lazy array of delegates. - * If so, return the return type of those delegates. - * If not, return NULL. - * - * Returns T if the type is one of the following forms: - * T delegate()[] - * T delegate()[dim] - */ - Type isLazyArray() - { - Type tb = type.toBasetype(); - if (tb.isStaticOrDynamicArray()) - { - Type tel = (cast(TypeArray)tb).next.toBasetype(); - if (auto td = tel.isTypeDelegate()) - { - TypeFunction tf = td.next.toTypeFunction(); - if (tf.parameterList.varargs == VarArg.none && tf.parameterList.length == 0) - { - return tf.next; // return type of delegate - } - } - } - return null; - } - /// Returns: Whether the function parameter is lazy bool isLazy() const @safe pure nothrow @nogc { @@ -3818,8 +2446,7 @@ extern (C++) final class Parameter : ASTNode if (eparam is null) return 0; - Type t = eparam.type.toBasetype(); - if (auto tu = t.isTypeTuple()) + if (auto tu = eparam.type.isTypeTuple()) { // Check for empty tuples if (tu.arguments is null) @@ -4053,35 +2680,6 @@ void attributesApply(const TypeFunction tf, void delegate(string) dg, TRUSTforma dg(trustToString(trustAttrib)); } -/** - * If the type is a class or struct, returns the symbol for it, - * else null. - */ -AggregateDeclaration isAggregate(Type t) -{ - t = t.toBasetype(); - if (auto tc = t.isTypeClass()) - return tc.sym; - if (auto ts = t.isTypeStruct()) - return ts.sym; - return null; -} - -/*************************************************** - * Determine if type t can be indexed or sliced given that it is not an - * aggregate with operator overloads. - * Params: - * t = type to check - * Returns: - * true if an expression of type t can be e1 in an array expression - */ -bool isIndexableNonAggregate(Type t) -{ - t = t.toBasetype(); - return (t.ty == Tpointer || t.isStaticOrDynamicArray() || t.ty == Taarray || - t.ty == Ttuple || t.ty == Tvector); -} - /*************************************** * Computes how a parameter may be returned. * Shrinking the representation is necessary because STC is so wide diff --git a/dmd/mtype.h b/dmd/mtype.h index 4839d1be337..6860039ceee 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -44,9 +44,13 @@ typedef struct TYPE type; namespace dmd { + void Type_init(); Type *typeSemantic(Type *t, Loc loc, Scope *sc); Type *merge(Type *type); Expression *defaultInitLiteral(Type *t, Loc loc); + Type *toBasetype(Type *type); + Type *nextOf(Type* type); + Type *baseElemOf(Type* type); } enum class TY : uint8_t @@ -220,6 +224,8 @@ class Type : public ASTNode static Type *basic[(int)TY::TMAX]; + static void _init() { return dmd::Type_init(); } + virtual const char *kind(); Type *copy() const; virtual Type *syntaxCopy(); @@ -229,22 +235,12 @@ class Type : public ASTNode size_t getUniqueID() const; const char *toChars() const override; char *toPrettyChars(bool QualifyTypes = false); - static void _init(); - virtual unsigned alignsize(); void modToBuffer(OutBuffer& buf) const; char *modToChars() const; - virtual bool isIntegral(); - virtual bool isFloating(); // real, imaginary, or complex - virtual bool isReal(); - virtual bool isImaginary(); - virtual bool isComplex(); - virtual bool isScalar(); - virtual bool isUnsigned(); virtual bool isScopeClass(); - virtual bool isString(); - virtual bool isBoolean(); + bool isConst() const { return (mod & MODconst) != 0; } bool isImmutable() const { return (mod & MODimmutable) != 0; } bool isMutable() const { return (mod & (MODconst | MODimmutable | MODwild)) == 0; } @@ -255,30 +251,13 @@ class Type : public ASTNode bool isSharedWild() const { return (mod & (MODshared | MODwild)) == (MODshared | MODwild); } bool isNaked() const { return mod == 0; } Type *nullAttributes() const; - bool hasDeprecatedAliasThis(); - virtual Type *makeConst(); - virtual Type *makeImmutable(); - virtual Type *makeShared(); - virtual Type *makeSharedConst(); - virtual Type *makeWild(); - virtual Type *makeWildConst(); - virtual Type *makeSharedWild(); - virtual Type *makeSharedWildConst(); - virtual Type *makeMutable(); - Type *toBasetype(); - virtual unsigned char deduceWild(Type *t, bool isRef); + + Type *toBasetype() { return dmd::toBasetype(this); } + Type *nextOf() { return dmd::nextOf(this); } + Type *baseElemOf() { return dmd::baseElemOf(this); } virtual ClassDeclaration *isClassHandle(); - virtual structalign_t alignment(); virtual int hasWild() const; - virtual bool hasVoidInitPointers(); - virtual bool hasUnsafeBitpatterns(); - virtual bool hasInvariant(); - virtual Type *nextOf(); - Type *baseElemOf(); - virtual bool needsDestruction(); - virtual bool needsCopyOrPostblit(); - virtual bool needsNested(); TypeFunction *toTypeFunction(); @@ -328,18 +307,6 @@ class TypeNext : public Type Type *next; int hasWild() const override final; - Type *nextOf() override final; - Type *makeConst() override final; - Type *makeImmutable() override final; - Type *makeShared() override final; - Type *makeSharedConst() override final; - Type *makeWild() override final; - Type *makeWildConst() override final; - Type *makeSharedWild() override final; - Type *makeSharedWildConst() override final; - Type *makeMutable() override final; - unsigned char deduceWild(Type *t, bool isRef) override final; - void transitive(); void accept(Visitor *v) override { v->visit(this); } }; @@ -351,14 +318,6 @@ class TypeBasic final : public Type const char *kind() override; TypeBasic *syntaxCopy() override; - unsigned alignsize() override; - bool isIntegral() override; - bool isFloating() override; - bool isReal() override; - bool isImaginary() override; - bool isComplex() override; - bool isScalar() override; - bool isUnsigned() override; // For eliminating dynamic_cast TypeBasic *isTypeBasic() override; @@ -373,12 +332,6 @@ class TypeVector final : public Type static TypeVector *create(Type *basetype); const char *kind() override; TypeVector *syntaxCopy() override; - unsigned alignsize() override; - bool isIntegral() override; - bool isFloating() override; - bool isScalar() override; - bool isUnsigned() override; - bool isBoolean() override; TypeBasic *elementType(); void accept(Visitor *v) override { v->visit(this); } @@ -399,15 +352,6 @@ class TypeSArray final : public TypeArray const char *kind() override; TypeSArray *syntaxCopy() override; bool isIncomplete(); - unsigned alignsize() override; - bool isString() override; - structalign_t alignment() override; - bool hasUnsafeBitpatterns() override; - bool hasVoidInitPointers() override; - bool hasInvariant() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -418,9 +362,6 @@ class TypeDArray final : public TypeArray public: const char *kind() override; TypeDArray *syntaxCopy() override; - unsigned alignsize() override; - bool isString() override; - bool isBoolean() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -434,7 +375,6 @@ class TypeAArray final : public TypeArray static TypeAArray *create(Type *t, Type *index); const char *kind() override; TypeAArray *syntaxCopy() override; - bool isBoolean() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -445,7 +385,6 @@ class TypePointer final : public TypeNext static TypePointer *create(Type *t); const char *kind() override; TypePointer *syntaxCopy() override; - bool isScalar() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -499,7 +438,6 @@ class Parameter final : public ASTNode static Parameter *create(Loc loc, StorageClass storageClass, Type *type, Identifier *ident, Expression *defaultArg, UserAttributeDeclaration *userAttribDecl); Parameter *syntaxCopy(); - Type *isLazyArray(); bool isLazy() const; bool isReference() const; // kludge for template.isType() @@ -584,8 +522,6 @@ class TypeDelegate final : public TypeNext static TypeDelegate *create(TypeFunction *t); const char *kind() override; TypeDelegate *syntaxCopy() override; - unsigned alignsize() override; - bool isBoolean() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -689,17 +625,7 @@ class TypeStruct final : public Type static TypeStruct *create(StructDeclaration *sym); const char *kind() override; - unsigned alignsize() override; TypeStruct *syntaxCopy() override; - structalign_t alignment() override; - bool isBoolean() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; - bool hasVoidInitPointers() override; - bool hasUnsafeBitpatterns() override; - bool hasInvariant() override; - unsigned char deduceWild(Type *t, bool isRef) override; void accept(Visitor *v) override { v->visit(this); } }; @@ -711,24 +637,6 @@ class TypeEnum final : public Type const char *kind() override; TypeEnum *syntaxCopy() override; - unsigned alignsize() override; - Type *memType(Loc loc); - bool isIntegral() override; - bool isFloating() override; - bool isReal() override; - bool isImaginary() override; - bool isComplex() override; - bool isScalar() override; - bool isUnsigned() override; - bool isBoolean() override; - bool isString() override; - bool needsDestruction() override; - bool needsCopyOrPostblit() override; - bool needsNested() override; - bool hasVoidInitPointers() override; - bool hasUnsafeBitpatterns() override; - bool hasInvariant() override; - Type *nextOf() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -743,9 +651,7 @@ class TypeClass final : public Type const char *kind() override; TypeClass *syntaxCopy() override; ClassDeclaration *isClassHandle() override; - unsigned char deduceWild(Type *t, bool isRef) override; bool isScopeClass() override; - bool isBoolean() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -784,7 +690,6 @@ class TypeNull final : public Type const char *kind() override; TypeNull *syntaxCopy() override; - bool isBoolean() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -794,8 +699,6 @@ class TypeNoreturn final : public Type public: const char *kind() override; TypeNoreturn *syntaxCopy() override; - bool isBoolean() override; - unsigned alignsize() override; void accept(Visitor *v) override { v->visit(this); } }; @@ -848,4 +751,35 @@ namespace dmd uinteger_t size(Type *type, Loc loc); MATCH implicitConvTo(Type* from, Type* to); MATCH constConv(Type* from, Type* to); + bool hasUnsafeBitpatterns(Type* type); + bool hasInvariant(Type* type); + bool hasVoidInitPointers(Type* type); + void transitive(TypeNext* type); + structalign_t alignment(Type* type); + Type* memType(TypeEnum* type); + unsigned alignsize(Type* type); + Type *makeConst(Type* type); + Type* makeMutable(Type* type); + Type* makeImmutable(Type* type); + Type* makeShared(Type* type); + Type* makeSharedConst(Type* type); + Type *makeWild(Type* type); + Type *makeWildConst(Type* type); + Type *makeSharedWild(Type* type); + Type *makeSharedWildConst(Type* type); + Type *isLazyArray(Parameter* param); + unsigned char deduceWild(Type* type, Type* t, bool isRef); + bool isIntegral(Type* type); + bool isFloating(Type* type); + bool isScalar(Type* type); + bool isReal(Type* type); + bool isImaginary(Type* type); + bool isComplex(Type* type); + bool isString(Type* type); + bool isBoolean(Type* type); + bool isUnsigned(Type* type); + bool needsNested(Type* type); + bool needsDestruction(Type* type); + bool needsCopyOrPostblit(Type* type); + bool hasDeprecatedAliasThis(Type* type); } diff --git a/dmd/mustuse.d b/dmd/mustuse.d index 84a991e6932..2125206322e 100644 --- a/dmd/mustuse.d +++ b/dmd/mustuse.d @@ -1,7 +1,7 @@ /** * Compile-time checks associated with the @mustuse attribute. * - * Copyright: Copyright (C) 2022-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 2022-2026 by The D Language Foundation, All Rights Reserved * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mustuse.d, _mustuse.d) * Documentation: https://dlang.org/phobos/dmd_mustuse.html diff --git a/dmd/nogc.d b/dmd/nogc.d index 5ac90e2f890..e8dde1414be 100644 --- a/dmd/nogc.d +++ b/dmd/nogc.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/function.html#nogc-functions, No-GC Functions) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/nogc.d, _nogc.d) @@ -18,11 +18,12 @@ import core.stdc.stdio; import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; +import dmd.attrib; import dmd.common.outbuffer; import dmd.declaration; import dmd.dmodule; import dmd.dscope; -import dmd.dsymbol : PASS; +import dmd.dsymbol : PASS, Dsymbol; import dmd.dtemplate : isDsymbol; import dmd.errors; import dmd.escape; @@ -40,7 +41,7 @@ import dmd.rootobject : RootObject, DYNCAST; import dmd.semantic2; import dmd.semantic3; import dmd.tokens; -import dmd.typesem : unqualify; +import dmd.typesem : unqualify, toBasetype; import dmd.visitor; import dmd.visitor.postorder; @@ -76,14 +77,32 @@ public: override void visit(DeclarationExp e) { // Note that, walkPostorder does not support DeclarationExp today. - VarDeclaration v = e.declaration.isVarDeclaration(); - if (v && !(v.storage_class & STC.manifest) && !v.isDataseg() && v._init) + void visitDecl(Dsymbol d) { - if (ExpInitializer ei = v._init.isExpInitializer()) + if (VarDeclaration v = d.isVarDeclaration()) { - doCond(ei.exp); + if (!(v.storage_class & STC.manifest) && !v.isDataseg() && v._init && !v.isCsymbol()) + { + if (ExpInitializer ei = v._init.isExpInitializer()) + { + doCond(ei.exp); + } + } + } + else if (AttribDeclaration ad = d.isAttribDeclaration()) + { + // Don't recurse into anonymous declarations (unions/structs) + // as their members aren't meant to be processed here + if (ad.isAnonDeclaration()) + return; + if (ad.decl) + { + foreach (s; *ad.decl) + visitDecl(s); + } } } + visitDecl(e.declaration); } /** @@ -275,16 +294,20 @@ Expression checkGC(Expression e, Scope* sc) return e; } -extern (D) void printGCUsage(FuncDeclaration fd, Loc loc, const(char)* warn) +/// Returns: whether GC usage inside `fd` should be printed for the -vgc flag +extern (D) bool vgcEnabled(FuncDeclaration fd) { if (!global.params.v.gc) - return; + return false; Module m = fd.getModule(); - if (m && m.isRoot() && !fd.inUnittest()) - { + return (m && m.isRoot() && !fd.inUnittest()); +} + +extern (D) void printGCUsage(FuncDeclaration fd, Loc loc, const(char)* warn) +{ + if (vgcEnabled(fd)) message(loc, "vgc: %s", warn); - } } /** diff --git a/dmd/nspace.d b/dmd/nspace.d index b8116343d6f..aa09097a7bc 100644 --- a/dmd/nspace.d +++ b/dmd/nspace.d @@ -36,7 +36,7 @@ * are valid D identifier. * * See_Also: https://github.com/dlang/dmd/pull/10031 - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/nspace.d, _nspace.d) diff --git a/dmd/nspace.h b/dmd/nspace.h index 782688b9de1..7575a1387c0 100644 --- a/dmd/nspace.h +++ b/dmd/nspace.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/ob.d b/dmd/ob.d index 7e48b28150f..43279187e80 100644 --- a/dmd/ob.d +++ b/dmd/ob.d @@ -1,7 +1,7 @@ /** * Flow analysis for Ownership/Borrowing * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/ob.d, _ob.d) diff --git a/dmd/objc.d b/dmd/objc.d index f416a76ce41..ac32196db11 100644 --- a/dmd/objc.d +++ b/dmd/objc.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/objc_interface.html, Interfacing to Objective-C) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/objc.d, _objc.d) @@ -17,12 +17,11 @@ import dmd.aggregate; import dmd.arraytypes; import dmd.astenums; import dmd.attrib; -import dmd.attribsem; +import dmd.attribsem : foreachUda; import dmd.cond; import dmd.dclass; import dmd.declaration; import dmd.denum; -import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; diff --git a/dmd/objc.h b/dmd/objc.h index c0bff98e6ab..c012158db6e 100644 --- a/dmd/objc.h +++ b/dmd/objc.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2015-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2015-2026 by The D Language Foundation, All Rights Reserved * written by Michel Fortin * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/opover.d b/dmd/opover.d index 0fd85726a38..d086927db98 100644 --- a/dmd/opover.d +++ b/dmd/opover.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/operatoroverloading.html, Operator Overloading) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/opover.d, _opover.d) @@ -612,7 +612,7 @@ bool suggestBinaryOverloads(BinExp e, Scope* sc) return true; } error(e.loc, "operator `%s` is not defined for type `%s`", EXPtoString(e.op).ptr, e.e2.type.toChars); - errorSupplemental(ad2.loc, "perhaps overload the operator with `auto opBinaryRight(string op : \"%s\")(%s rhs) {}`", EXPtoString(e.op).ptr, e.e1.type.toChars); + errorSupplemental(ad2.loc, "perhaps overload the operator with `auto opBinaryRight(string op : \"%s\")(%s lhs) {}`", EXPtoString(e.op).ptr, e.e1.type.toChars); return true; } return false; diff --git a/dmd/optimize.d b/dmd/optimize.d index 88a947f6b02..05a3aae5198 100644 --- a/dmd/optimize.d +++ b/dmd/optimize.d @@ -1,7 +1,7 @@ /** * Perform constant folding. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/optimize.d, _optimize.d) @@ -459,7 +459,20 @@ Expression optimize(Expression e, int result, bool keepLvalue = false) { if (!ve.var.isReference() && !ve.var.isImportedSymbol()) { - ret = new SymOffExp(e.loc, ve.var, 0, ve.hasOverloads); + bool hasOverloads = ve.hasOverloads; + if (auto v = ve.var.isVarDeclaration()) + { + if (v.needThis()) + { + auto t = v.isThis(); + assert(t); + .error(e.loc, "taking the address of non-static variable `%s` requires an instance of `%s`", v.toChars(), t.toChars()); + ret = ErrorExp.get(); + return; + } + hasOverloads = false; + } + ret = new SymOffExp(e.loc, ve.var, 0, hasOverloads); ret.type = e.type; return; } diff --git a/dmd/parse.d b/dmd/parse.d index dea85409038..1bdcf44c338 100644 --- a/dmd/parse.d +++ b/dmd/parse.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/grammar.html, D Grammar) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/parse.d, _parse.d) @@ -79,6 +79,21 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer this.doUnittests = doUnittests; } + /** Instead of parsing text to get tokens, provide a list of tokens ending with null. + * Note that the token list will be consumed (added to the tokenFreelist) by the lexer4. + * Params: + * pToken = pointer to first token in list, take ownership of list + * linnum = line number to use for the tokens + */ + extern (D) + void setTokenList(ref Token* pToken, int linnum) + { + this.token = *pToken; + pToken = null; // take ownership + this.baseLoc.startLine = linnum; + this.linnum = linnum; + } + /++ + Parse a module, i.e. the optional `module x.y.z` declaration and all declarations + found in the current file. @@ -2552,7 +2567,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer AST.Expression constraint = tpl ? parseConstraint() : null; AST.Type tf = new AST.TypeFunction(parameterList, null, linkage, stc); // ReturnType -> auto - tf = tf.addSTC(stc); + tf = AST.addSTC(tf, stc); auto f = new AST.CtorDeclaration(loc, Loc.initial, stc, tf); AST.Dsymbol s = parseContracts(f, !!tpl); @@ -2872,6 +2887,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer auto parameters = new AST.Parameters(); VarArg varargs = VarArg.none; STC varargsStc; + bool hasAutoRefParam = false; // Attributes allowed for ... enum VarArgsStc = STC.const_ | STC.immutable_ | STC.shared_ | STC.scope_ | STC.return_ | STC.returnScope | STC.returnRef; @@ -3007,6 +3023,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } L2: storageClass = appendStorageClass(storageClass, stc); + hasAutoRefParam |= (storageClass & (STC.auto_ | STC.ref_)) == (STC.auto_ | STC.ref_); continue; default: @@ -3038,7 +3055,9 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } else { - at = parseType(&ai, null, &loc); + if (tpl && !*tpl && hasAutoRefParam) + *tpl = new AST.TemplateParameters(); + at = parseType(&ai, &loc); } ae = null; if (token.value == TOK.assign) // = defaultArg @@ -3211,7 +3230,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer { Ltype: // Type identifier - type = parseType(&ident, null); + type = parseType(&ident); if (type == AST.Type.terror) { type = null; @@ -3577,11 +3596,18 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer /* Parse a type and optional identifier * Params: - * pident = set to Identifier if there is one, null if not - * ptpl = if !null, then set to TemplateParameterList - * pdeclLoc = if !null, then set to location of the declarator + * pident = set to Identifier if there is one, null if not + * pdeclLoc = if !null, then set to location of the declarator + * stc = Storage Class */ - AST.Type parseType(Identifier* pident = null, AST.TemplateParameters** ptpl = null, Loc* pdeclLoc = null) + AST.Type parseType(STC stc) + { + return parseType(null, null, stc); + } + + ///Ditto + AST.Type parseType(Identifier* pident = null, Loc* pdeclLoc = null, + STC stc = STC.none) { /* Take care of the storage class prefixes that * serve as type attributes: @@ -3594,7 +3620,6 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer * shared inout type * shared inout const type */ - STC stc = STC.none; while (1) { switch (token.value) @@ -3641,10 +3666,10 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer if (pdeclLoc) *pdeclLoc = token.loc; int alt = 0; - t = parseDeclarator(t, alt, pident, ptpl); + t = parseDeclarator(t, alt, pident, null); checkCstyleTypeSyntax(typeLoc, t, alt, pident ? *pident : null); - t = t.addSTC(stc); + t = AST.addSTC(t, stc); return t; } @@ -3823,7 +3848,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // const(type) nextToken(); check(TOK.leftParenthesis); - t = parseType().addSTC(STC.const_); + t = parseType(STC.const_); check(TOK.rightParenthesis); break; @@ -3831,7 +3856,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // immutable(type) nextToken(); check(TOK.leftParenthesis); - t = parseType().addSTC(STC.immutable_); + t = parseType(STC.immutable_); check(TOK.rightParenthesis); break; @@ -3839,7 +3864,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // shared(type) nextToken(); check(TOK.leftParenthesis); - t = parseType().addSTC(STC.shared_); + t = parseType(STC.shared_); check(TOK.rightParenthesis); break; @@ -3847,7 +3872,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer // wild(type) nextToken(); check(TOK.leftParenthesis); - t = parseType().addSTC(STC.wild); + t = parseType(STC.wild); check(TOK.rightParenthesis); break; @@ -4085,7 +4110,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer if (save == TOK.function_) error("`const`/`immutable`/`shared`/`inout`/`return` attributes are only valid for non-static member functions"); else - tf = cast(AST.TypeFunction)tf.addSTC(stc); + tf = cast(AST.TypeFunction)AST.addSTC(tf, stc); } t = save == TOK.delegate_ ? new AST.TypeDelegate(tf) : new AST.TypePointer(tf); // pointer to function continue; @@ -4259,7 +4284,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer STC stc = parsePostfix(storageClass, pudas); AST.Type tf = new AST.TypeFunction(parameterList, t, linkage, stc); - tf = tf.addSTC(stc); + tf = AST.addSTC(tf, stc); if (pdisable) *pdisable = stc & STC.disable ? true : false; @@ -4495,6 +4520,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer isAliasDeclaration = true; } + const typeLoc = token.loc; AST.Type ts; if (!autodecl) @@ -4631,9 +4657,11 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer if (isAliasDeclaration) { - AST.Declaration v; - AST.Initializer _init = null; - + if (ident && mod.edition >= Edition.v2024) + { + eSink.error(token.loc, "use `alias %s = ...;` syntax instead of `alias ... %s;`", + ident.toChars(), ident.toChars()); + } /* Aliases can no longer have multiple declarators, storage classes, * linkages, or auto declarations. * These never made any sense, anyway. @@ -4644,6 +4672,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer if (udas) error("user-defined attributes not allowed for `alias` declarations"); + AST.Initializer _init = null; if (token.value == TOK.assign) { nextToken(); @@ -4653,7 +4682,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer { error("alias cannot have initializer"); } - v = new AST.AliasDeclaration(aliasLoc, ident, t); + AST.Declaration v = new AST.AliasDeclaration(aliasLoc, ident, t); v.storage_class = storage_class; if (pAttrs) @@ -4782,11 +4811,9 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer AST.Dsymbol s; if (width) { - if (_init) - error("initializer not allowed for bitfield declaration"); if (storage_class) error("storage class not allowed for bitfield declaration"); - s = new AST.BitFieldDeclaration(width.loc, t, ident, width); + s = new AST.BitFieldDeclaration(ident.isAnonymous() ? typeLoc : loc, t, ident, width, _init); } else { @@ -5270,7 +5297,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } auto tf = new AST.TypeFunction(parameterList, tret, linkage, stc); - tf = cast(AST.TypeFunction)tf.addSTC(stc); + tf = cast(AST.TypeFunction)AST.addSTC(tf, stc); auto fd = new AST.FuncLiteralDeclaration(loc, Loc.initial, tf, save, null, null, stc & STC.auto_); if (token.value == TOK.goesTo) @@ -5748,14 +5775,13 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer } /*** - * Parse an assignment condition for `if`, `switch` or `while` statements. + * Parse an assignment condition for `if`, `switch`, `while` or `with` statements. * * Returns: * The variable that is declared inside the condition */ - AST.Parameter parseAssignCondition() + AST.Parameter parseAssignCondition(bool _with = false) { - AST.Parameter param = null; STC storageClass = STC.none; STC stc = STC.none; Lwhile: @@ -5824,7 +5850,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer const aloc = token.loc; nextToken(); check(TOK.assign); - param = new AST.Parameter(aloc, storageClass, at, ai, null, null); + return new AST.Parameter(aloc, storageClass, at, ai, null, null); } else if (isDeclaration(&token, NeedDeclaratorId.must, TOK.assign, null)) { @@ -5832,12 +5858,13 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer const aloc = token.loc; AST.Type at = parseType(&ai); check(TOK.assign); - param = new AST.Parameter(aloc, storageClass, at, ai, null, null); + return new AST.Parameter(aloc, storageClass, at, ai, null, null); } - else if (storageClass != 0) + else if (storageClass != 0 && !_with) + { error("found `%s` while expecting `=` or identifier", n.toChars()); - - return param; + } + return null; } /***************************************** @@ -6649,10 +6676,11 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer nextToken(); check(TOK.leftParenthesis); + auto param = parseAssignCondition(true); exp = parseExpression(); - closeCondition("with", null, exp); + closeCondition("with", param, exp); _body = parseStatement(ParseStatementFlags.scope_, null, &endloc); - s = new AST.WithStatement(loc, exp, _body, endloc); + s = new AST.WithStatement(loc, param, exp, _body, endloc); break; } case TOK.try_: @@ -8721,7 +8749,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer error("expression expected, not `%s`", token.toChars()); Lerr: // Anything for e, as long as it's not NULL - e = AST.ErrorExp.get(); + e = new AST.ErrorExp(); nextToken(); break; } @@ -8839,7 +8867,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer else { AST.Type t = parseType(); // cast( type ) - t = t.addSTC(AST.ModToStc(m)); // cast( const type ) + t = AST.addSTC(t, AST.ModToStc(m)); // cast( const type ) check(TOK.rightParenthesis); e = parseUnaryExp(); e = new AST.CastExp(loc, e, t); @@ -8854,7 +8882,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer STC stc = parseTypeCtor(); AST.Type t = parseBasicType(); - t = t.addSTC(stc); + t = AST.addSTC(t, stc); if (stc == 0 && token.value == TOK.dot) { @@ -8863,7 +8891,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer { error("identifier expected following `%s.`, not `%s`", t.toChars(), token.toChars()); - return AST.ErrorExp.get(); + return new AST.ErrorExp(); } e = new AST.DotIdExp(loc, new AST.TypeExp(loc, t), token.ident); nextToken(); @@ -8977,7 +9005,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer { error("identifier or new keyword expected following `(...)`."); nextToken(); - return AST.ErrorExp.get(); + return new AST.ErrorExp(); } e = new AST.TypeExp(loc, t); e.parens = true; @@ -9626,7 +9654,7 @@ class Parser(AST, Lexer = dmd.lexer.Lexer) : Lexer const stc = parseTypeCtor(); auto t = parseBasicType(true); t = parseTypeSuffixes(t); - t = t.addSTC(stc); + t = AST.addSTC(t, stc); if (t.ty == Taarray) { AST.TypeAArray taa = cast(AST.TypeAArray)t; diff --git a/dmd/pragmasem.d b/dmd/pragmasem.d index a6c22fc5474..10715f2b11e 100644 --- a/dmd/pragmasem.d +++ b/dmd/pragmasem.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/pragma.html, Pragmas) * - * Copyright: Copyright (C) 1999-2023 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/pragmasem.d, _pragmasem.d) @@ -756,7 +756,7 @@ private bool pragmaMangleSemantic(Loc loc, Scope* sc, Expressions* args, Dsymbol } if (args.length > 2) { - error(loc, "pragma(mangle)` expects 1 or 2 arguments"); + error(loc, "`pragma(mangle)` expects 1 or 2 arguments"); return false; } diff --git a/dmd/printast.d b/dmd/printast.d index 5e4c9f787f3..ef97306c5a7 100644 --- a/dmd/printast.d +++ b/dmd/printast.d @@ -1,7 +1,7 @@ /** * Provides an AST printer for debugging. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/printast.d, _printast.d) @@ -14,6 +14,7 @@ module dmd.printast; import core.stdc.stdio; import dmd.expression; +import dmd.expressionsem : toInteger; import dmd.ctfeexpr; import dmd.tokens; import dmd.visitor; diff --git a/dmd/root/aav.d b/dmd/root/aav.d index 014d4a579c7..381a97988b9 100644 --- a/dmd/root/aav.d +++ b/dmd/root/aav.d @@ -1,7 +1,7 @@ /** * Associative array implementation. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/aav.d, root/_aav.d) diff --git a/dmd/root/array.d b/dmd/root/array.d index ee35e805d66..91abfab69df 100644 --- a/dmd/root/array.d +++ b/dmd/root/array.d @@ -2,7 +2,7 @@ /** * Dynamic array implementation. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/array.d, root/_array.d) @@ -16,7 +16,7 @@ import core.stdc.stdlib : _compare_fp_t; import core.stdc.string; import dmd.root.rmem; -import dmd.root.string; +import dmd.root.string : toDString; // `qsort` is only `nothrow` since 2.081.0 private extern(C) void qsort(scope void* base, size_t nmemb, size_t size, _compare_fp_t compar) nothrow @nogc; @@ -51,7 +51,11 @@ public: ~this() pure nothrow { - debug (stomp) memset(data.ptr, 0xFF, data.length); + debug (stomp) + { + if (data.ptr) + memset(data.ptr, 0xFF, data.length * T.sizeof); + } if (data.ptr && data.ptr != &smallarray[0]) mem.xfree(data.ptr); } @@ -201,22 +205,33 @@ public: memcpy(p, data.ptr, length * T.sizeof); memset(data.ptr, 0xFF, data.length * T.sizeof); mem.xfree(data.ptr); + data = p[0 .. allocdim]; } else + { auto p = cast(T*)mem.xrealloc(data.ptr, allocdim * T.sizeof); - data = p[0 .. allocdim]; + data = p[0 .. allocdim]; + } } debug (stomp) { - if (length < data.length) - memset(data.ptr + length, 0xFF, (data.length - length) * T.sizeof); + if (data.ptr) + { + if (length < data.length) + memset(data.ptr + length, 0xFF, (data.length - length) * T.sizeof); + } } else { if (mem.isGCEnabled) - if (length < data.length) - memset(data.ptr + length, 0xFF, (data.length - length) * T.sizeof); + { + if (data.ptr) + { + if (length < data.length) + memset(data.ptr + length, 0xFF, (data.length - length) * T.sizeof); + } + } } } @@ -908,7 +923,7 @@ bool equal(Range1, Range2)(Range1 range1, Range2 range2) else { - static if (hasLength!Range1 && hasLength!Range2 && is(typeof(r1.length == r2.length))) + static if (hasLength!Range1 && hasLength!Range2 && is(typeof(range1.length == range2.length))) { if (range1.length != range2.length) return false; diff --git a/dmd/root/array.h b/dmd/root/array.h index e7c68389697..b6cdcbe9251 100644 --- a/dmd/root/array.h +++ b/dmd/root/array.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 2011-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/bitarray.d b/dmd/root/bitarray.d index b5adaa89034..e5ffb4df132 100644 --- a/dmd/root/bitarray.d +++ b/dmd/root/bitarray.d @@ -1,7 +1,7 @@ /** * Implementation of a bit array. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/bitarray.d, root/_bitarray.d) @@ -16,6 +16,8 @@ import core.stdc.string; import dmd.root.rmem; +nothrow: + struct BitArray { diff --git a/dmd/root/bitarray.h b/dmd/root/bitarray.h index c50247f35fb..5a449e4b74c 100644 --- a/dmd/root/bitarray.h +++ b/dmd/root/bitarray.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 2011-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/complex.d b/dmd/root/complex.d index 777c103ae9c..35b45bf34b4 100644 --- a/dmd/root/complex.d +++ b/dmd/root/complex.d @@ -1,7 +1,7 @@ /** * Implements a complex number type. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/complex.d, _complex.d) diff --git a/dmd/root/complex_t.h b/dmd/root/complex_t.h index 58a07053986..e13336d109d 100644 --- a/dmd/root/complex_t.h +++ b/dmd/root/complex_t.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/ctfloat.d b/dmd/root/ctfloat.d index 2ca9e205279..466b73b1172 100644 --- a/dmd/root/ctfloat.d +++ b/dmd/root/ctfloat.d @@ -1,7 +1,7 @@ /** * Collects functions for compile-time floating-point calculations. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/ctfloat.d, root/_ctfloat.d) @@ -22,17 +22,16 @@ nothrow: // Type used by the front-end for compile-time reals public import dmd.root.longdouble : real_t = longdouble; +import dmd.root.port; private { - version(CRuntime_DigitalMars) __gshared extern (C) extern const(char)* __locale_decpoint; - - version(CRuntime_Microsoft) extern (C++) + version(CRuntime_Microsoft) { - public import dmd.root.longdouble : longdouble_soft, ld_sprint; + import dmd.root.longdouble : longdouble_soft, ld_sprint; version (IN_LLVM) {} else { - import dmd.root.strtold; + import dmd.root.strtold : strtold = strtold_ms; } } } @@ -46,9 +45,12 @@ extern (C++) struct CTFloat version (GNU) enum yl2x_supported = false; + else version (AArch64) + enum yl2x_supported = false; // no x87 FPU else enum yl2x_supported = is(real_t == real) && __traits(compiles, core.math.yl2x(1.0L, 2.0L)); + enum yl2xp1_supported = yl2x_supported; static void yl2x(const real_t* x, const real_t* y, real_t* res) // IN_LLVM: impure because of log2 @@ -207,6 +209,7 @@ extern (C++) struct CTFloat return isIdentical(fabs(r), real_t.infinity); } + version (IN_LLVM) { // implemented in gen/ctfloat.cpp @@ -221,18 +224,7 @@ extern (C++) struct CTFloat static real_t parse(const(char)* literal, out bool isOutOfRange) { errno = 0; - version(CRuntime_DigitalMars) - { - auto save = __locale_decpoint; - __locale_decpoint = "."; - } - version(CRuntime_Microsoft) - { - auto r = cast(real_t) strtold_dm(literal, null); - } - else - auto r = strtold(literal, null); - version(CRuntime_DigitalMars) __locale_decpoint = save; + auto r = strtold(literal, null); isOutOfRange = (errno == ERANGE); return r; } diff --git a/dmd/root/ctfloat.h b/dmd/root/ctfloat.h index fc4271c8fce..c6d7ec3487c 100644 --- a/dmd/root/ctfloat.h +++ b/dmd/root/ctfloat.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/dcompat.h b/dmd/root/dcompat.h index 306333e41ff..9504c456a0c 100644 --- a/dmd/root/dcompat.h +++ b/dmd/root/dcompat.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/dsystem.h b/dmd/root/dsystem.h index aee288a4199..2649435ed57 100644 --- a/dmd/root/dsystem.h +++ b/dmd/root/dsystem.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/file.d b/dmd/root/file.d index 3d4b93bc22f..b35a3151cce 100644 --- a/dmd/root/file.d +++ b/dmd/root/file.d @@ -1,7 +1,7 @@ /** * Read a file from disk and store it in memory. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/file.d, root/_file.d) diff --git a/dmd/root/filename.d b/dmd/root/filename.d index 2b0e0465b45..1363dd7299e 100644 --- a/dmd/root/filename.d +++ b/dmd/root/filename.d @@ -1,7 +1,7 @@ /** * Encapsulate path and file names. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/filename.d, root/_filename.d) @@ -51,8 +51,9 @@ version (CRuntime_Glibc) extern (C) char* canonicalize_file_name(const char*) nothrow; } -alias Strings = Array!(const(char)*); +nothrow: +alias Strings = Array!(const(char)*); // Check whether character is a directory separator bool isDirSeparator(char c) pure nothrow @nogc @safe diff --git a/dmd/root/filename.h b/dmd/root/filename.h index c9894fac7f7..d474774d9f8 100644 --- a/dmd/root/filename.h +++ b/dmd/root/filename.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/hash.d b/dmd/root/hash.d index 40dc2eb1979..48b50121976 100644 --- a/dmd/root/hash.d +++ b/dmd/root/hash.d @@ -1,7 +1,7 @@ /** * Hash functions for arbitrary binary data. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Martin Nowak, Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/hash.d, root/_hash.d) @@ -11,6 +11,9 @@ module dmd.root.hash; +nothrow: +@safe: + // MurmurHash2 was written by Austin Appleby, and is placed in the public // domain. The author hereby disclaims copyright to this source code. // https://github.com/aappleby/smhasher/ diff --git a/dmd/root/longdouble.d b/dmd/root/longdouble.d index 9da7f09e06d..9c1fdd6bc69 100644 --- a/dmd/root/longdouble.d +++ b/dmd/root/longdouble.d @@ -1,7 +1,7 @@ /** * 80-bit floating point value implementation if the C/D compiler does not support them natively. * - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * All Rights Reserved, written by Rainer Schuetze * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -22,6 +22,8 @@ else version (CRuntime_Microsoft) static if (real.sizeof > 8) alias longdouble = real; else + // Need to fix longdouble_soft so it works for compiler built with AArch64 but + // generating X86_64 code alias longdouble = longdouble_soft; } else @@ -39,6 +41,7 @@ version(D_InlineAsm_X86_64) else version(D_InlineAsm_X86) version = AsmX86; else + // yes, AArch64 host needs to emulate 80 bit real to cross compile for X86_64 static assert(false, "longdouble_soft not supported on this platform"); bool initFPU() @@ -577,6 +580,7 @@ int ld_cmp(longdouble_soft x, longdouble_soft y) mov res, EAX; } } + return res; } diff --git a/dmd/root/longdouble.h b/dmd/root/longdouble.h index 251be1d0f3c..cfefecb2645 100644 --- a/dmd/root/longdouble.h +++ b/dmd/root/longdouble.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Rainer Schuetze * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/man.d b/dmd/root/man.d index 2ec7de76151..ad5225a1d1b 100644 --- a/dmd/root/man.d +++ b/dmd/root/man.d @@ -1,7 +1,7 @@ /** * Open an online manual page. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/man.d, root/_man.d) diff --git a/dmd/root/optional.d b/dmd/root/optional.d index 2b518eb8b13..7ba38d4e27b 100644 --- a/dmd/root/optional.d +++ b/dmd/root/optional.d @@ -1,7 +1,7 @@ /** * Implementation of an 'Optional' type * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/optional.d, root/_optional.d) diff --git a/dmd/root/optional.h b/dmd/root/optional.h index 12891f879b3..2f7ccf35858 100644 --- a/dmd/root/optional.h +++ b/dmd/root/optional.h @@ -3,7 +3,7 @@ /** * Optional implementation. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/optional.h, root/_optional.h) diff --git a/dmd/root/port.d b/dmd/root/port.d index b94476e5c06..d12b9e72a09 100644 --- a/dmd/root/port.d +++ b/dmd/root/port.d @@ -1,7 +1,7 @@ /** * Portable routines for functions that have different implementations on different platforms. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/port.d, root/_port.d) diff --git a/dmd/root/port.h b/dmd/root/port.h index dfb56b0fefd..2f7b3dc3960 100644 --- a/dmd/root/port.h +++ b/dmd/root/port.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/region.d b/dmd/root/region.d index a8efbca1e62..357663ff163 100644 --- a/dmd/root/region.d +++ b/dmd/root/region.d @@ -1,7 +1,7 @@ /** * Region storage allocator implementation. * - * Copyright: Copyright (C) 2019-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 2019-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/region.d, root/_region.d) @@ -18,6 +18,8 @@ import core.stdc.stdlib; import dmd.root.rmem; import dmd.root.array; +nothrow: + /***** * Simple region storage allocator. */ diff --git a/dmd/root/rmem.d b/dmd/root/rmem.d index ca10b0d9cff..0fd2c47f79b 100644 --- a/dmd/root/rmem.d +++ b/dmd/root/rmem.d @@ -1,7 +1,7 @@ /** * Allocate memory using `malloc` or the GC depending on the configuration. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/rmem.d, root/_rmem.d) @@ -18,6 +18,8 @@ import core.stdc.string; import core.memory : GC; +nothrow: + version (IN_LLVM) extern extern(C) __gshared string[] rt_options; diff --git a/dmd/root/rmem.h b/dmd/root/rmem.h index b6645ec1294..3bbb96a199b 100644 --- a/dmd/root/rmem.h +++ b/dmd/root/rmem.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/root/speller.d b/dmd/root/speller.d index a2151106d03..55dfbad2aee 100644 --- a/dmd/root/speller.d +++ b/dmd/root/speller.d @@ -3,7 +3,7 @@ * * Does not have any dependencies on the rest of DMD. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/speller.d, root/_speller.d) diff --git a/dmd/root/string.d b/dmd/root/string.d index 369a79be662..5c7b69cf5fa 100644 --- a/dmd/root/string.d +++ b/dmd/root/string.d @@ -1,7 +1,7 @@ /** * Contains various string related functions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/string.d, root/_string.d) @@ -13,6 +13,8 @@ module dmd.root.string; import core.stdc.string; import dmd.root.rmem; +nothrow: + /// Slices a `\0`-terminated C-string, excluding the terminator inout(char)[] toDString (inout(char)* s) pure nothrow @nogc { diff --git a/dmd/root/stringtable.d b/dmd/root/stringtable.d index c7a2c8c56db..00c6d24acf4 100644 --- a/dmd/root/stringtable.d +++ b/dmd/root/stringtable.d @@ -1,7 +1,7 @@ /** * A specialized associative array with string keys stored in a variable length structure. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/stringtable.d, root/_stringtable.d) @@ -14,6 +14,8 @@ module dmd.root.stringtable; import core.stdc.string; import dmd.root.rmem, dmd.root.hash; +nothrow: + private enum POOL_BITS = 12; private enum POOL_SIZE = (1U << POOL_BITS); diff --git a/dmd/root/utf.d b/dmd/root/utf.d index 5b2c42f4eef..229f3991c6b 100644 --- a/dmd/root/utf.d +++ b/dmd/root/utf.d @@ -1,7 +1,7 @@ /** * Functions related to UTF encoding. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/root/utf.d, _utf.d) diff --git a/dmd/rootobject.d b/dmd/rootobject.d index 7101374e25e..3596d73737a 100644 --- a/dmd/rootobject.d +++ b/dmd/rootobject.d @@ -1,7 +1,7 @@ /** * Provide the root object that AST classes in dmd inherit from. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: Walter Bright, https://www.digitalmars.com * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/rootobject.d, _rootobject.d) diff --git a/dmd/rootobject.h b/dmd/rootobject.h index 297f852e374..3238ea30a22 100644 --- a/dmd/rootobject.h +++ b/dmd/rootobject.h @@ -1,5 +1,5 @@ -/* Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved +/* Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/safe.d b/dmd/safe.d index a1207f7a184..464d0120ded 100644 --- a/dmd/safe.d +++ b/dmd/safe.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/function.html#function-safety, Function Safety) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/safe.d, _safe.d) @@ -25,10 +25,11 @@ import dmd.dscope; import dmd.dsymbol; import dmd.dsymbolsem : determineSize; import dmd.errors; +import dmd.errorsink; import dmd.expression; import dmd.func; import dmd.funcsem : isRootTraitsCompilesScope; -import dmd.globals : FeatureState; +import dmd.globals : FeatureState, global; import dmd.id; import dmd.identifier; import dmd.location; @@ -38,7 +39,7 @@ import dmd.root.string : fTuple; import dmd.target; import dmd.targetcompiler; import dmd.tokens; -import dmd.typesem : hasPointers, arrayOf, size; +import dmd.typesem; /************************************************************* * Check for unsafe access in @safe code: @@ -175,10 +176,17 @@ bool isSafeCast(Expression e, Type tfrom, Type tto, ref string msg) // Implicit conversions are always safe if (tfrom.implicitConvTo(tto)) return true; - if (!tto.hasPointers()) + { + // casting to bool is safe as it's a special op + // casting to struct with non-pointer @system field is not @safe + if (tto.ty != Tbool && tto.hasUnsafeBitpatterns()) + { + msg = "Target element type has unsafe bit patterns"; + return false; + } return true; - + } auto tfromb = tfrom.toBasetype(); auto ttob = tto.toBasetype(); @@ -358,17 +366,23 @@ bool isTrusted(FuncDeclaration fd) * fd = function we are gonna rat on * gag = suppress error message (used in escape.d) * loc = location of error + * scopeVar = if not null, is the variable whose scope status caused the violation * format = printf-style format string * args = arguments for %s format specifier */ -extern (D) void reportSafeError(FuncDeclaration fd, bool gag, Loc loc, - const(char)* format, RootObject[] args...) +private +void reportSafeError(FuncDeclaration fd, bool gag, Loc loc, + VarDeclaration scopeVar, const(char)* format, RootObject[] args...) { + ErrorSink eSink = global.errorSink; if (fd.type.toTypeFunction().trust == TRUST.system) // function was just inferred to be @system { if (format) { - fd.safetyViolation = new AttributeViolation(loc, format, args); + if (scopeVar) + fd.safetyViolation = new AttributeViolation(loc, format, scopeVar, args); + else + fd.safetyViolation = new AttributeViolation(loc, format, args); } else if (args.length > 0) { @@ -390,7 +404,7 @@ extern (D) void reportSafeError(FuncDeclaration fd, bool gag, Loc loc, { buf.printf(" is not allowed in a function with default safety with `-%spreview=safer`", SwitchPrefix.ptr); } - .error(loc, "%s", buf.extractChars()); + eSink.error(loc, "%s", buf.extractChars()); } } } @@ -434,7 +448,7 @@ extern (D) bool setUnsafeCall(FuncDeclaration fd, FuncDeclaration f) { if (setFunctionToUnsafe(fd)) { - reportSafeError(fd, false, f.loc, null, f, null); + reportSafeError(fd, false, f.loc, null, null, f, null); return fd.isSafe(); } return false; @@ -453,6 +467,13 @@ extern (D) bool setUnsafeCall(FuncDeclaration fd, FuncDeclaration f) * Returns: whether there is a safe error */ bool setUnsafe(Scope* sc, bool gag, Loc loc, const(char)* format, RootObject[] args...) +{ + return sc.setUnsafe(gag, loc, null, format, args); +} + +/// Overload that also stores the variable whose scope status caused the violation +bool setUnsafe(Scope* sc, bool gag, Loc loc, VarDeclaration scopeVar, + const(char)* format, RootObject[] args...) { if (sc.intypeof) return false; // typeof(cast(int*)0) is safe @@ -497,7 +518,7 @@ bool setUnsafe(Scope* sc, bool gag, Loc loc, const(char)* format, RootObject[] a { if (format || args.length > 0) { - reportSafeError(sc.func, gag, loc, format, args); + reportSafeError(sc.func, gag, loc, scopeVar, format, args); } return sc.func.isSafe(); // it is only an error if in an @safe function } @@ -524,6 +545,13 @@ bool setUnsafe(Scope* sc, bool gag, Loc loc, const(char)* format, RootObject[] a * Returns: whether an actual safe error (not deprecation) occured */ bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char)* format, RootObject[] args...) +{ + return setUnsafePreview(sc, fs, gag, loc, null, format, args); +} + +/// Overload for scope violations that also stores the variable whose scope status caused the issue +bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, VarDeclaration scopeVar, + const(char)* format, RootObject[] args...) { //printf("setUnsafePreview() fs:%d %s\n", fs, fmt); assert(format); @@ -533,7 +561,7 @@ bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char) return false; case enabled: - return sc.setUnsafe(gag, loc, format, args); + return sc.setUnsafe(gag, loc, scopeVar, format, args); case default_: if (!sc.func) @@ -549,7 +577,10 @@ bool setUnsafePreview(Scope* sc, FeatureState fs, bool gag, Loc loc, const(char) else if (!sc.func.safetyViolation) { import dmd.func : AttributeViolation; - sc.func.safetyViolation = new AttributeViolation(loc, format, args); + if (scopeVar) + sc.func.safetyViolation = new AttributeViolation(loc, format, scopeVar, args); + else + sc.func.safetyViolation = new AttributeViolation(loc, format, args); } return false; } diff --git a/dmd/sarif.d b/dmd/sarif.d index f596b788b35..e7f48bda3c4 100644 --- a/dmd/sarif.d +++ b/dmd/sarif.d @@ -1,7 +1,7 @@ /** * Provides SARIF (Static Analysis Results Interchange Format) reporting functionality. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/sarif.d, sarif.d) diff --git a/dmd/scope.h b/dmd/scope.h index cceca7e1747..8c9ce691d7a 100644 --- a/dmd/scope.h +++ b/dmd/scope.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -129,16 +129,16 @@ struct Scope final bool fullinst(bool v); bool ctfeBlock() const; bool ctfeBlock(bool v); + bool knownACompileTimeOnlyContext() const; + bool knownACompileTimeOnlyContext(bool v); UserAttributeDeclaration *userAttribDecl; // user defined attributes - DocComment *lastdc; // documentation comment for last symbol at this scope + void *lastdc; // documentation comment for last symbol at this scope (DocComment*) AA *anchorCounts; // lookup duplicate anchor name count Identifier *prevAnchor; // qualified symbol name of last doc anchor AliasDeclaration *aliasAsg; // if set, then aliasAsg is being assigned a new value, // do not set wasRead for it StructDeclaration *argStruct; // elimiate recursion when looking for rvalue construction - - Dsymbol *search(Loc loc, Identifier *ident, Dsymbol *&pscopesym, SearchOptFlags flags = (SearchOptFlags)SearchOpt::all); }; diff --git a/dmd/semantic2.d b/dmd/semantic2.d index 838321bf8c3..46d4a92ebc3 100644 --- a/dmd/semantic2.d +++ b/dmd/semantic2.d @@ -1,7 +1,7 @@ /** * Performs the semantic2 stage, which deals with initializer expressions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/semantic2.d, _semantic2.d) @@ -320,6 +320,48 @@ private extern(C++) final class Semantic2Visitor : Visitor vd.semanticRun = PASS.semantic2done; } + override void visit(BitFieldDeclaration bfd) + { + visit(cast(VarDeclaration)bfd); + if (bfd.semanticRun != PASS.semantic2done) + return; + + if (bfd.fieldWidth == 0) + return; + + if (!bfd._init) + return; + + auto ei = bfd._init.isExpInitializer(); + if (!ei) + return; + + if (!ei.exp.isIntegerExp()) + return; + + import dmd.intrange; + auto value = getIntRange(ei.exp); + + const bool isUnsigned = bfd.type.isUnsigned(); + auto bounds = IntRange( + SignExtendedNumber(bfd.getMinMax(Id.min), !isUnsigned), + SignExtendedNumber(bfd.getMinMax(Id.max), false) + ); + + if (!bounds.contains(value)) + { + const uwidth = bfd.fieldWidth; + error(ei.loc, "default initializer `%s` is not representable as bitfield type `%s:%lld`", + ei.exp.toChars(), bfd.type.toBasetype().toChars(), cast(long)uwidth); + if (isUnsigned) + errorSupplemental(bfd.loc, "bitfield `%s` default initializer must be a value between `%llu..%llu`", + bfd.toChars(), bounds.imin.value, bounds.imax.value); + else + errorSupplemental(bfd.loc, "bitfield `%s` default initializer must be a value between `%lld..%lld`", + bfd.toChars(), bounds.imin.value, bounds.imax.value); + } + } + override void visit(Module mod) { //printf("Module::semantic2('%s'): parent = %p\n", toChars(), parent); @@ -329,7 +371,7 @@ private extern(C++) final class Semantic2Visitor : Visitor // Note that modules get their own scope, from scratch. // This is so regardless of where in the syntax a module // gets imported, it is unaffected by context. - Scope* sc = Scope.createGlobal(mod, global.errorSink); // create root scope + Scope* sc = scopeCreateGlobal(mod, global.errorSink); // create root scope //printf("Module = %p\n", sc.scopesym); if (mod.members) { @@ -799,7 +841,9 @@ private void doGNUABITagSemantic(ref Expression e, ref Expression* lastTag) // `const` (and nor is `StringExp`, by extension). static int predicate(const scope Expression* e1, const scope Expression* e2) { - return (cast(Expression*)e1).toStringExp().compare((cast(Expression*)e2).toStringExp()); + Expression e11 = cast(Expression) *e1; + Expression e22 = cast(Expression) *e2; + return e11.toStringExp().compare(e22.toStringExp()); } ale.elements.sort!predicate; } diff --git a/dmd/semantic3.d b/dmd/semantic3.d index f6ac5f35b16..2b9e820327a 100644 --- a/dmd/semantic3.d +++ b/dmd/semantic3.d @@ -3,7 +3,7 @@ * function bodies and late semantic checks for templates, mixins, * aggregates, and special members. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/semantic3.d, _semantic3.d) @@ -60,6 +60,7 @@ import dmd.opover; import dmd.optimize; import dmd.parse; import dmd.root.filename; +import dmd.root.array; import dmd.common.outbuffer; import dmd.root.rmem; import dmd.rootobject; @@ -76,6 +77,12 @@ import dmd.templateparamsem; import dmd.typesem; import dmd.visitor; +version (IN_GCC) { /* Not using Fast DFA */ } +else version = FastDFA; + +version (FastDFA) + import dmd.dfa.entry; + enum LOG = false; @@ -196,7 +203,7 @@ private extern(C++) final class Semantic3Visitor : Visitor // Note that modules get their own scope, from scratch. // This is so regardless of where in the syntax a module // gets imported, it is unaffected by context. - Scope* sc = Scope.createGlobal(mod, global.errorSink); // create root scope + Scope* sc = scopeCreateGlobal(mod, global.errorSink); // create root scope //printf("Module = %p\n", sc.scopesym); if (mod.members) { @@ -227,20 +234,6 @@ private extern(C++) final class Semantic3Visitor : Visitor timeTraceBeginEvent(TimeTraceEventType.sema3); scope (exit) timeTraceEndEvent(TimeTraceEventType.sema3, funcdecl); - /* Determine if function should add `return 0;` - */ - bool addReturn0() - { - //printf("addReturn0()\n"); - auto f = funcdecl.type.isTypeFunction(); - - // C11 5.1.2.2.3 - if (sc.inCfile && funcdecl.isCMain() && f.next.ty == Tint32) - return true; - - return f.next.ty == Tvoid && (funcdecl.isMain() || funcdecl.isCMain()); - } - VarDeclaration _arguments = null; if (!funcdecl.parent) @@ -301,7 +294,7 @@ private extern(C++) final class Semantic3Visitor : Visitor return; funcdecl.semanticRun = PASS.semantic3; funcdecl.hasSemantic3Errors = false; - funcdecl.saferD = sc.previews.safer; + funcdecl.saferD = sc.previews.safer && !sc.inCfile; if (!funcdecl.type || funcdecl.type.ty != Tfunction) return; @@ -643,7 +636,7 @@ private extern(C++) final class Semantic3Visitor : Visitor Expression exp = (*funcdecl.returns)[i].exp; if (exp.op == EXP.variable && (cast(VarExp)exp).var == funcdecl.vresult) { - if (addReturn0()) + if (fds.addReturn0()) exp.type = Type.tint32; else exp.type = f.next; @@ -835,7 +828,7 @@ private extern(C++) final class Semantic3Visitor : Visitor if (funcdecl.returns) { - bool implicit0 = addReturn0(); + bool implicit0 = fds.addReturn0(); Type tret = implicit0 ? Type.tint32 : f.next; assert(tret.ty != Tvoid); if (funcdecl.vresult || funcdecl.returnLabel) @@ -968,8 +961,10 @@ private extern(C++) final class Semantic3Visitor : Visitor /* https://issues.dlang.org/show_bug.cgi?id=10789 * If NRVO is not possible, all returned lvalues should call their postblits. + * For functions with a __result variable, postblits will be called later + * during initialization of __result. */ - if (!funcdecl.isNRVO) + if (!funcdecl.isNRVO && !funcdecl.vresult) exp = doCopyOrMove(sc2, exp, f.next, true, true); if (tret.hasPointers()) @@ -980,9 +975,25 @@ private extern(C++) final class Semantic3Visitor : Visitor if (funcdecl.vresult) { - // Create: return vresult = exp; - exp = new BlitExp(rs.loc, funcdecl.vresult, exp); - exp.type = funcdecl.vresult.type; + Scope* scret = sc2; + + if (rs.fesFunc) + { + // Create a scope with foreach body being `.parent` + // and `funcdecl` as `.func`. So the return value + // is aware of closure access, but picks up + // attributes and instantiates templated copy/move + // ctors in the context of `funcdecl`. + // BUG: remove this fragile hack + scret = rs.fesFunc._scope.push(); + scret.parent = rs.fesFunc; + scret.func = funcdecl; + } + + // Create: return (vresult = exp, vresult); + exp = new ConstructExp(rs.loc, funcdecl.vresult, exp); + exp = exp.expressionSemantic(scret); + exp = Expression.combine(exp, new VarExp(rs.loc, funcdecl.vresult)); if (rs.caseDim) exp = Expression.combine(exp, new IntegerExp(rs.caseDim)); @@ -1105,6 +1116,10 @@ private extern(C++) final class Semantic3Visitor : Visitor else { auto a = new Statements(); + + size_t expectedSize = (funcdecl.parameters ? funcdecl.parameters.length : 0) + 7; + a.reserve(expectedSize); + // Merge in initialization of 'out' parameters if (funcdecl.parameters) { @@ -1208,7 +1223,7 @@ else a.push(s); } } - if (addReturn0()) + if (fds.addReturn0()) { // Add a return 0; statement Statement s = new ReturnStatement(Loc.initial, IntegerExp.literal!0); @@ -1424,7 +1439,7 @@ else return false; } - if (isCppNonMappableType(f.next.toBasetype())) + if (isCppNonMappableType(f.next.toBasetype()) && !funcdecl.skipCodegen) { .error(funcdecl.loc, "%s `%s` cannot return type `%s` because its linkage is `extern(C++)`", funcdecl.kind, funcdecl.toErrMsg(), f.next.toChars()); if (f.next.isTypeDArray()) @@ -1451,6 +1466,16 @@ else oblive(funcdecl); } + version (FastDFA) + { + if (global.params.useFastDFA && global.errors == oldErrors && funcdecl.fbody && funcdecl.type.ty != Terror) + { + // Don't run DFA if there are errors, + // this is a costly enough operation that it warrents the explicit check. + dfaEntry(funcdecl, sc); + } + } + /* If this function had instantiated with gagging, error reproduction will be * done by TemplateInstance::semantic. * Otherwise, error gagging should be temporarily ungagged by functionSemantic3. @@ -1629,6 +1654,10 @@ else override void visit(TypeInfoAssociativeArrayDeclaration ti) { + if (ti.semanticRun >= PASS.semantic3) + return; + ti.semanticRun = PASS.semantic3; + auto t = ti.tinfo.isTypeAArray(); Loc loc = t.loc; auto sc2 = sc ? sc : ti._scope; @@ -1644,6 +1673,11 @@ else return new DotTemplateInstanceExp(loc, id, hook, tiargs); } + void notTemplateFunction(Loc loc, Identifier id) + { + error(loc, "`%s` isn't a template function", id.toChars()); + } + // generate ti.entry auto tempinst = makeDotExp(Id.Entry); auto e = expressionSemantic(tempinst, sc2); @@ -1661,21 +1695,36 @@ version (IN_LLVM) {} else semanticTypeInfo(sc2, ti.entry); // might get deferred // generate ti.xtoHash - auto hashinst = makeDotExp(Identifier.idPool("aaGetHash")); + auto aaGetHash = Identifier.idPool("aaGetHash"); + auto hashinst = makeDotExp(aaGetHash); e = expressionSemantic(hashinst, sc2); - assert(e.isVarExp() && e.type.isTypeFunction()); - ti.xtoHash = e.isVarExp().var; - if (auto tmpl = ti.xtoHash.parent.isTemplateInstance()) - tmpl.minst = sc2._module.importedFrom; // ensure it gets emitted + if (!e.isErrorExp()) + { + if (!e.isVarExp() || !e.type.isTypeFunction()) + notTemplateFunction(e.loc, aaGetHash); + else + { + ti.xtoHash = e.isVarExp().var; + if (auto tmpl = ti.xtoHash.parent.isTemplateInstance()) + tmpl.minst = sc2._module.importedFrom; // ensure it gets emitted + } + } // generate ti.xopEqual - auto equalinst = makeDotExp(Identifier.idPool("aaOpEqual")); + auto aaOpEqual = Identifier.idPool("aaOpEqual"); + auto equalinst = makeDotExp(aaOpEqual); e = expressionSemantic(equalinst, sc2); - assert(e.isVarExp() && e.type.isTypeFunction()); - ti.xopEqual = e.isVarExp().var; - if (auto tmpl = ti.xopEqual.parent.isTemplateInstance()) - tmpl.minst = sc2._module.importedFrom; // ensure it gets emitted - + if (!e.isErrorExp()) + { + if (!e.isVarExp() || !e.type.isTypeFunction()) + notTemplateFunction(e.loc, aaOpEqual); + else + { + ti.xopEqual = e.isVarExp().var; + if (auto tmpl = ti.xopEqual.parent.isTemplateInstance()) + tmpl.minst = sc2._module.importedFrom; // ensure it gets emitted + } + } visit(cast(ASTCodegen.TypeInfoDeclaration)ti); } } @@ -1713,6 +1762,21 @@ private struct FuncDeclSem3 } } } + + /* Determine if function should add `return 0;` + */ + bool addReturn0() + { + //printf("addReturn0()\n"); + auto f = funcdecl.type.isTypeFunction(); + if (!f) return false; + + // C11 5.1.2.2.3 + if (sc.inCfile && funcdecl.isCMain() && f.next.ty == Tint32) + return true; + + return f.next.ty == Tvoid && (funcdecl.isMain() || funcdecl.isCMain()); + } } /*************************************** @@ -1748,25 +1812,20 @@ FuncDeclaration search_toString(StructDeclaration sd) */ void semanticTypeInfoMembers(StructDeclaration sd) { - if (sd.xeq && - sd.xeq._scope && - sd.xeq.semanticRun < PASS.semantic3done) + void runSemantic(ref FuncDeclaration fd, ref FuncDeclaration errFd) { - const errors = global.startGagging(); - sd.xeq.semantic3(sd.xeq._scope); - if (global.endGagging(errors)) - sd.xeq = sd.xerreq; + if (fd && fd._scope && fd.semanticRun < PASS.semantic3done) + { + const errors = global.startGagging(); + fd.semantic3(fd._scope); + if (global.endGagging(errors)) + fd = errFd; + } } - if (sd.xcmp && - sd.xcmp._scope && - sd.xcmp.semanticRun < PASS.semantic3done) - { - const errors = global.startGagging(); - sd.xcmp.semantic3(sd.xcmp._scope); - if (global.endGagging(errors)) - sd.xcmp = sd.xerrcmp; - } + runSemantic(sd.xeq, sd.xerreq); + runSemantic(sd.xcmp, sd.xerrcmp); + FuncDeclaration ftostr = search_toString(sd); if (ftostr && @@ -1868,10 +1927,37 @@ extern (D) bool checkClosure(FuncDeclaration fd) else { fd.printGCUsage(fd.loc, "using closure causes GC allocation"); + + findClosureVars(fd, (FuncDeclaration f, VarDeclaration v) { + if (!fd.vgcEnabled) + return; + + .message(f.loc, "vgc: %s `%s` closes over variable `%s`", + f.kind, f.toErrMsg(), v.toErrMsg()); + if (v.ident != Id.This) + .message(v.loc, "vgc: `%s` declared here", v.toErrMsg()); + }); return false; } + findClosureVars(fd, (FuncDeclaration f, VarDeclaration v) { + .errorSupplemental(f.loc, "%s `%s` closes over variable `%s`", + f.kind, f.toErrMsg(), v.toErrMsg()); + if (v.ident != Id.This) + .errorSupplemental(v.loc, "`%s` declared here", v.toErrMsg()); + }); + return true; +} + +/// For an outer function `fd`, find inner functions that cause a closure to be generated for it. +/// Pass to `sink` each nested function along with the local variable that closes over `fd`'s stackframe +private void findClosureVars(FuncDeclaration fd, scope void delegate(FuncDeclaration, VarDeclaration) sink) +{ FuncDeclarations a; + + if (fd.closureVars.length > 0) + a.reserve(fd.closureVars.length); + foreach (v; fd.closureVars) { foreach (f; v.nestedrefs) @@ -1884,26 +1970,16 @@ extern (D) bool checkClosure(FuncDeclaration fd) auto fx = s.isFuncDeclaration(); if (!fx) continue; - if (fx.isThis() || - fx.tookAddressOf || - checkEscapingSiblings(fx, fd)) + if (fx.isThis() || fx.tookAddressOf || checkEscapingSiblings(fx, fd)) { - foreach (f2; a) + if (!a.contains(f)) { - if (f2 == f) - break LcheckAncestorsOfANestedRef; + a.push(f); + sink(f, v); } - a.push(f); - .errorSupplemental(f.loc, "%s `%s` closes over variable `%s`", - f.kind, f.toErrMsg(), v.toChars()); - if (v.ident != Id.This) - .errorSupplemental(v.loc, "`%s` declared here", v.toChars()); - break LcheckAncestorsOfANestedRef; } } } } - - return true; } diff --git a/dmd/sideeffect.d b/dmd/sideeffect.d index 402a74c0f9b..2e579972d35 100644 --- a/dmd/sideeffect.d +++ b/dmd/sideeffect.d @@ -1,7 +1,7 @@ /** * Find side-effects of expressions. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/sideeffect.d, _sideeffect.d) @@ -242,7 +242,41 @@ private bool lambdaHasSideEffect(Expression e, bool assumeImpureCalls = false) bool discardValue(Expression e) { if (lambdaHasSideEffect(e)) // check side-effect shallowly + { + // check for e.g. `arrayLiteral[index] = expr;` + if (e.isAssignExp() || e.isBinAssignExp() || e.isPostExp()) + { + Expression e1; + if (auto be = e.isBinExp()) // includes PostExp + e1 = be.e1; + else if (auto ce = e.isPreExp()) + e1 = ce.e1; + + if (auto ie = e1 ? e1.isIndexExp() : null) + { + if (ie.e1.isArrayLiteralExp()) + error(e.loc, "discarded assignment to indexed array literal"); + } + } + // check assignment to struct rvalue + auto ce = e.isCallExp(); + if (ce && ce.fromOpAssignment) + { + if (auto dve = ce.e1.isDotVarExp()) + { + auto lhs = dve.e1; + auto ts = lhs.type.isTypeStruct(); + if (ts && !lhs.isLvalue() && !ts.sym.hasPointerField) // Don't disallow writing to data through a pointer field + { + error(lhs.loc, "assignment to struct rvalue `%s` is discarded", + lhs.toChars()); + errorSupplemental(e.loc, "if the assignment is needed to modify a global, call `%s` directly or use an lvalue", + dve.var.toChars()); + } + } + } return false; + } switch (e.op) { case EXP.cast_: diff --git a/dmd/statement.d b/dmd/statement.d index e5c8258e763..33f7e287ccb 100644 --- a/dmd/statement.d +++ b/dmd/statement.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/statement.html, Statements) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/statement.d, _statement.d) @@ -389,6 +389,10 @@ extern (C++) class ExpStatement : Statement this.exp = exp; } + /******************************* + * Creates a DeclarationExp inside a statement. + * Use in place of *DeclarationStatement* from D grammar. + */ final extern (D) this(Loc loc, Dsymbol declaration) @safe { super(loc, STMT.Exp); @@ -1344,6 +1348,7 @@ extern (C++) final class ReturnStatement : Statement { Expression exp; size_t caseDim; + FuncDeclaration fesFunc; // nested function for foreach it is in extern (D) this(Loc loc, Expression exp) @safe { @@ -1468,14 +1473,16 @@ extern (C++) final class SynchronizedStatement : Statement */ extern (C++) final class WithStatement : Statement { + Parameter prm; Expression exp; Statement _body; VarDeclaration wthis; Loc endloc; - extern (D) this(Loc loc, Expression exp, Statement _body, Loc endloc) @safe + extern (D) this(Loc loc, Parameter prm, Expression exp, Statement _body, Loc endloc) @safe { super(loc, STMT.With); + this.prm = prm; this.exp = exp; this._body = _body; this.endloc = endloc; @@ -1483,7 +1490,11 @@ extern (C++) final class WithStatement : Statement override WithStatement syntaxCopy() { - return new WithStatement(loc, exp.syntaxCopy(), _body ? _body.syntaxCopy() : null, endloc); + return new WithStatement(loc, + prm ? prm.syntaxCopy() : null, + exp.syntaxCopy(), + _body ? _body.syntaxCopy() : null, + endloc); } override void accept(Visitor v) diff --git a/dmd/statement.h b/dmd/statement.h index 14f7024d5a2..f23a5b7412d 100644 --- a/dmd/statement.h +++ b/dmd/statement.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -551,6 +551,7 @@ class ReturnStatement final : public Statement public: Expression *exp; size_t caseDim; + FuncDeclaration *fesFunc; // nested function for foreach it is in ReturnStatement *syntaxCopy() override; @@ -604,6 +605,7 @@ class SynchronizedStatement final : public Statement class WithStatement final : public Statement { public: + Parameter *prm; Expression *exp; Statement *_body; VarDeclaration *wthis; diff --git a/dmd/statementsem.d b/dmd/statementsem.d index 987979bb883..6ffa8784071 100644 --- a/dmd/statementsem.d +++ b/dmd/statementsem.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/statement.html, Statements) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/statementsem.d, _statementsem.d) @@ -78,6 +78,15 @@ version (DMDLIB) version = CallbackAPI; } +/***************************************** + * Returns: + * `true` iff ready to call `dmd.statementsem.makeTupleForeach`. + */ +bool ready(StaticForeach _this) +{ + return _this.aggrfe && _this.aggrfe.aggr && _this.aggrfe.aggr.type && _this.aggrfe.aggr.type.toBasetype().ty == Ttuple; +} + /***************************************** * CTFE requires FuncDeclaration::labtab for the interpretation. * So fixing the label name inside in/out contracts is necessary @@ -1016,7 +1025,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) if (tab.isTypeDArray()) { // check if overflow is possible - const maxLen = IntRange.fromType(tindex).imax.value + 1; + const maxLen = intRangeFromType(tindex).imax.value + 1; if (auto ale = fs.aggr.isArrayLiteralExp()) err = ale.elements.length > maxLen; else if (auto se = fs.aggr.isSliceExp()) @@ -1079,7 +1088,7 @@ Statement statementSemanticVisit(Statement s, Scope* sc) IntRange dimrange = getIntRange(ta.dim); // https://issues.dlang.org/show_bug.cgi?id=12504 dimrange.imax = SignExtendedNumber(dimrange.imax.value-1); - if (!IntRange.fromType(fs.key.type).contains(dimrange)) + if (!intRangeFromType(fs.key.type).contains(dimrange)) { error(fs.loc, "index type `%s` cannot cover index range 0..%llu", p.type.toChars(), ta.dim.toInteger()); @@ -1654,7 +1663,8 @@ Statement statementSemanticVisit(Statement s, Scope* sc) /* Declare param, which we will set to be the * result of condition. */ - auto ei = new ExpInitializer(ifs.loc, ifs.condition); + // Make sure the location of the initializer reflects the condition, not the if statement. + auto ei = new ExpInitializer(ifs.condition.loc, ifs.condition); ifs.match = new VarDeclaration(ifs.loc, ifs.param.type, ifs.param.ident, ei); ifs.match.parent = scd.func; ifs.match.storage_class |= ifs.param.storageClass; @@ -2504,8 +2514,12 @@ version (IN_LLVM) //printf("ReturnStatement.dsymbolSemantic() %s\n", toChars(rs)); FuncDeclaration fd = sc.parent.isFuncDeclaration(); + if (fd.fes) + { + rs.fesFunc = fd; fd = fd.fes.func; // fd is now function enclosing foreach + } auto tf = fd.type.isTypeFunction(); @@ -2630,7 +2644,7 @@ version (IN_LLVM) rs.exp = resolveAliasThis(sc, rs.exp); rs.exp = resolveProperties(sc, rs.exp); - if (rs.exp.checkType()) + if (!rs.exp.hasValidType()) rs.exp = ErrorExp.get(); if (auto f = isFuncAddress(rs.exp)) { @@ -3170,12 +3184,12 @@ version (IN_LLVM) auto args = new Parameters(new Parameter(Loc.initial, STC.none, ClassDeclaration.object.type, null, null, null)); - FuncDeclaration fdenter = FuncDeclaration.genCfunc(args, Type.tvoid, Id.monitorenter); + FuncDeclaration fdenter = genCfunc(args, Type.tvoid, Id.monitorenter); Expression e = new CallExp(ss.loc, fdenter, new VarExp(ss.loc, tmp)); e.type = Type.tvoid; // do not run semantic on e cs.push(new ExpStatement(ss.loc, e)); - FuncDeclaration fdexit = FuncDeclaration.genCfunc(args, Type.tvoid, Id.monitorexit); + FuncDeclaration fdexit = genCfunc(args, Type.tvoid, Id.monitorexit); e = new CallExp(ss.loc, fdexit, new VarExp(ss.loc, tmp)); e.type = Type.tvoid; // do not run semantic on e Statement s = new ExpStatement(ss.loc, e); @@ -3210,7 +3224,7 @@ version (IN_LLVM) auto enterArgs = new Parameters(new Parameter(Loc.initial, STC.none, t.pointerTo(), null, null, null)); - FuncDeclaration fdenter = FuncDeclaration.genCfunc(enterArgs, Type.tvoid, Id.criticalenter, STC.nothrow_); + FuncDeclaration fdenter = genCfunc(enterArgs, Type.tvoid, Id.criticalenter, STC.nothrow_); Expression e = new AddrExp(ss.loc, tmpExp); e = e.expressionSemantic(sc); e = new CallExp(ss.loc, fdenter, e); @@ -3219,7 +3233,7 @@ version (IN_LLVM) auto exitArgs = new Parameters(new Parameter(Loc.initial, STC.none, t, null, null, null)); - FuncDeclaration fdexit = FuncDeclaration.genCfunc(exitArgs, Type.tvoid, Id.criticalexit, STC.nothrow_); + FuncDeclaration fdexit = genCfunc(exitArgs, Type.tvoid, Id.criticalexit, STC.nothrow_); e = new CallExp(ss.loc, fdexit, tmpExp); e.type = Type.tvoid; // do not run semantic on e Statement s = new ExpStatement(ss.loc, e); @@ -3264,6 +3278,32 @@ version (IN_LLVM) sym.parent = sc.scopesym; sym.endlinnum = ws.endloc.linnum; } + else if (ws.prm) + { + /* Re-write to + * { + * auto prm = exp + * with(prm) + * { + * ... + * } + * } + */ + auto tmp_init = new ExpInitializer(ws.loc, ws.exp); + auto tmp = new VarDeclaration(ws.loc, ws.prm.type, ws.prm.ident, tmp_init); + // tmp.storage_class |= STC.temp; //NOTE(mojo): idk + tmp.dsymbolSemantic(sc); + + auto es = new ExpStatement(ws.loc, tmp); + ws.exp = new VarExp(ws.loc, tmp); + + ws.prm = null; + auto cs = new CompoundStatement(ws.loc, es, ws); + Statement ss = new ScopeStatement(ws.loc, cs, ws.endloc); + result = ss.statementSemantic(sc); + + return; + } else { Type texp = ws.exp.type; @@ -3490,11 +3530,14 @@ version (IN_LLVM) blockexit &= ~BE.throw_; // don't worry about paths that otherwise may throw // Don't care about paths that halt, either - if ((blockexit & ~BE.halt) == BE.fallthru) + // Only rewrite if it was requested. + // This has side effects where Error will not run destructors, unsafe. + if (global.params.nothrowOptimizations && (blockexit & ~BE.halt) == BE.fallthru) { result = new CompoundStatement(tfs.loc, tfs._body, tfs.finalbody); return; } + tfs.bodyFallsThru = (blockexit & BE.fallthru) != 0; result = tfs; } @@ -3930,7 +3973,7 @@ private extern(D) Expression applyArray(ForeachStatement fs, Expression flde, dgparams.push(new Parameter(Loc.initial, STC.none, Type.tvoidptr, null, null, null)); dgty = new TypeDelegate(new TypeFunction(ParameterList(dgparams), Type.tint32, LINK.d)); params.push(new Parameter(Loc.initial, STC.none, dgty, null, null, null)); - fdapply = FuncDeclaration.genCfunc(params, Type.tint32, fdname.ptr); + fdapply = genCfunc(params, Type.tint32, fdname.ptr); if (tab.isTypeSArray()) fs.aggr = fs.aggr.castTo(sc2, tn.arrayOf()); @@ -4492,7 +4535,7 @@ public auto makeTupleForeach(Scope* sc, bool isStatic, bool isDecl, ForeachState IntRange dimrange = IntRange(SignExtendedNumber(length))._cast(Type.tsize_t); // https://issues.dlang.org/show_bug.cgi?id=12504 dimrange.imax = SignExtendedNumber(dimrange.imax.value-1); - if (!IntRange.fromType(p.type).contains(dimrange)) + if (!intRangeFromType(p.type).contains(dimrange)) { error(fs.loc, "index type `%s` cannot cover index range 0..%llu", p.type.toChars(), cast(ulong)length); diff --git a/dmd/staticassert.d b/dmd/staticassert.d index 52ded559e52..97bd8e52027 100644 --- a/dmd/staticassert.d +++ b/dmd/staticassert.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/version.html#static-assert, Static Assert) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/staticassert.d, _staticassert.d) @@ -18,7 +18,6 @@ import dmd.dsymbol; import dmd.expression; import dmd.location; import dmd.id; -import dmd.identifier; import dmd.visitor; /*********************************************************** diff --git a/dmd/staticassert.h b/dmd/staticassert.h index 1ef72850a7d..471ff00fab4 100644 --- a/dmd/staticassert.h +++ b/dmd/staticassert.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/staticcond.d b/dmd/staticcond.d index c2e87c7bf3d..75a059640d1 100644 --- a/dmd/staticcond.d +++ b/dmd/staticcond.d @@ -1,7 +1,7 @@ /** * Lazily evaluate static conditions for `static if`, `static assert` and template constraints. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/staticcond.d, _staticcond.d) diff --git a/dmd/stmtstate.d b/dmd/stmtstate.d index 1c1fd080eec..d75538e53e9 100644 --- a/dmd/stmtstate.d +++ b/dmd/stmtstate.d @@ -1,7 +1,7 @@ /** * Used to help transform statement AST into flow graph. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/stmtstate.d, _stmtstate.d) diff --git a/dmd/target.d b/dmd/target.d index 3f8481c5e79..00af115d2f1 100644 --- a/dmd/target.d +++ b/dmd/target.d @@ -15,7 +15,7 @@ * - $(LINK2 https://github.com/ldc-developers/ldc, LDC repository) * - $(LINK2 https://github.com/D-Programming-GDC/gcc, GDC repository) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/target.d, _target.d) @@ -89,6 +89,8 @@ ubyte defaultTargetOSMajor() @safe return 13; else version (TARGET_FREEBSD14) return 14; + else version (TARGET_FREEBSD15) + return 15; else return 0; } @@ -159,6 +161,9 @@ void addDefaultVersionIdentifiers(const ref Param params, const ref Target tgt) VersionCondition.addPredefinedGlobalIdent("D_HardFloat"); + if (params.trace) + VersionCondition.addPredefinedGlobalIdent("D_Profile"); + if (params.tracegc) VersionCondition.addPredefinedGlobalIdent("D_ProfileGC"); @@ -175,7 +180,7 @@ void addPredefinedGlobalIdentifiers(const ref Target tgt) import dmd.cond : VersionCondition; alias predef = VersionCondition.addPredefinedGlobalIdent; - if (tgt.cpu >= CPU.sse2) + if ((tgt.isX86_64 || tgt.isX86) && tgt.cpu >= CPU.sse2) { predef("D_SIMD"); if (tgt.cpu >= CPU.avx) @@ -322,7 +327,7 @@ extern (C++) struct Target import dmd.location; import dmd.astenums : LINK, TY; import dmd.mtype : Type, TypeFunction, TypeTuple; - import dmd.typesem : pointerTo, size; + import dmd.typesem; import dmd.root.ctfloat : real_t; import dmd.statement : Statement; import dmd.tokens : EXP; @@ -491,6 +496,8 @@ else // !IN_LLVM if (isLP64 || isAArch64) { ptrsize = 8; + /* This is affected by version WithArgTypes in object.d + */ classinfosize = 0x98+16; // 168 } @@ -525,6 +532,13 @@ else // !IN_LLVM } } + if (isAArch64 && os & Target.OS.OSX) // OSX for AArch64 has 8 byte reals + { + realsize = 8; + realpad = 0; + realalignsize = 8; + } + c.initialize(params, this); cpp.initialize(params, this); objc.initialize(params, this); @@ -656,6 +670,7 @@ else // !IN_LLVM */ extern (C++) uint fieldalign(Type type) { + import dmd.typesem : alignsize; const size = type.alignsize(); if ((isX86_64 || isAArch64 || os == Target.OS.OSX) && (size == 16 || size == 32)) @@ -1083,14 +1098,35 @@ else // !IN_LLVM */ extern (C++) TypeTuple toArgTypes(Type t) { - import dmd.argtypes_x86 : toArgTypes_x86; import dmd.argtypes_sysv_x64 : toArgTypes_sysv_x64; - if (isX86_64 || isAArch64) + if (isX86_64) { // no argTypes for Win64 yet return isPOSIX ? toArgTypes_sysv_x64(t) : null; } - return toArgTypes_x86(t); + else if (isX86) + { + import dmd.argtypes_x86 : toArgTypes_x86; + return toArgTypes_x86(t); + } + else if (isAArch64) + { + import dmd.argtypes_aarch64 : toArgTypes_aarch64; + static if (0) + { + auto tt = toArgTypes_aarch64(t); + if (tt) + foreach (i; 0 .. tt.arguments.length) + { + Parameter p = (*tt.arguments)[i]; + printf("i: %d t: %s\n", cast(int)i, p.type.toChars()); + } + return tt; + } + return toArgTypes_aarch64(t); + } + else + assert(0); } /** @@ -1168,7 +1204,7 @@ else // !IN_LLVM return true; } } - else if ((isX86_64 || isAArch64) && isPOSIX) + else if (isX86_64 && isPOSIX) { TypeTuple tt = toArgTypes_sysv_x64(tn); if (!tt) @@ -1176,6 +1212,16 @@ else // !IN_LLVM return !tt.arguments.length; } + else if (isAArch64 && isPOSIX) + { + import dmd.argtypes_aarch64 : toArgTypes_aarch64; + + TypeTuple tt = toArgTypes_aarch64(tn); + if (!tt) + return false; // void + + return !tt.arguments.length; + } Lagain: if (tns.ty == TY.Tsarray) @@ -1453,7 +1499,7 @@ else // !IN_LLVM */ extern (D) bool isXmmSupported() @safe { - return (isX86_64 || isAArch64) || (isX86 && os == Target.OS.OSX); + return (isX86_64 /*|| isAArch64*/) || (isX86 && os == Target.OS.OSX); } /** @@ -1605,7 +1651,7 @@ else if (bitFieldStyle == BitFieldStyle.Gcc_Clang) { // sufficient for DMD's currently supported architectures - return !bfd.isAnonymous(); + return !bfd.isAnonymous() || target.isAArch64; } assert(0); } diff --git a/dmd/target.h b/dmd/target.h index f5c9aed0ad4..a85c2e7ecb7 100644 --- a/dmd/target.h +++ b/dmd/target.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2013-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2013-2026 by The D Language Foundation, All Rights Reserved * written by Iain Buclaw * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/targetcompiler.d b/dmd/targetcompiler.d index 5a88e207be5..23b43738e1c 100644 --- a/dmd/targetcompiler.d +++ b/dmd/targetcompiler.d @@ -1,7 +1,7 @@ /** * Encapsulates the vagaries of which of the three D compilers (gdc, ldc or dmd) is being built * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/mars.d, _targetcompiler.d) @@ -84,7 +84,7 @@ else version (MARS) mixin template FuncDeclarationExtra() { VarDeclarations* alignSectionVars; /// local variables with alignment needs larger than stackAlign - import dmd.backend.cc : Symbol; + import dmd.backend.cc : Symbol; Symbol* salignSection; /// pointer to aligned section, if any } } diff --git a/dmd/template.h b/dmd/template.h index aaa1f81f63f..55f620e8c98 100644 --- a/dmd/template.h +++ b/dmd/template.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. @@ -78,6 +78,7 @@ class TemplateDeclaration final : public ScopeDsymbol d_bool isTrivialAlias; // matches pattern `template Alias(T) { alias Alias = qualifiers(T); }` d_bool deprecated_; // this template declaration is deprecated d_bool isCmacro; // Whether this template is a translation of a C macro + d_bool haveComputedOneMember; // Whether computeOneMeber has been called Visibility visibility; TemplatePrevious *previous; // threaded list of previous instantiation attempts on stack @@ -132,7 +133,6 @@ class TemplateParameter : public ASTNode virtual TemplateTupleParameter *isTemplateTupleParameter(); virtual TemplateParameter *syntaxCopy() = 0; - virtual bool declareParameter(Scope *sc) = 0; virtual void print(RootObject *oarg, RootObject *oded) = 0; virtual RootObject *specialization() = 0; virtual bool hasDefaultArg() = 0; @@ -153,7 +153,6 @@ class TemplateTypeParameter : public TemplateParameter TemplateTypeParameter *isTemplateTypeParameter() override final; TemplateTypeParameter *syntaxCopy() override; - bool declareParameter(Scope *sc) override final; void print(RootObject *oarg, RootObject *oded) override final; RootObject *specialization() override final; bool hasDefaultArg() override final; @@ -183,7 +182,6 @@ class TemplateValueParameter final : public TemplateParameter TemplateValueParameter *isTemplateValueParameter() override; TemplateValueParameter *syntaxCopy() override; - bool declareParameter(Scope *sc) override; void print(RootObject *oarg, RootObject *oded) override; RootObject *specialization() override; bool hasDefaultArg() override; @@ -202,7 +200,6 @@ class TemplateAliasParameter final : public TemplateParameter TemplateAliasParameter *isTemplateAliasParameter() override; TemplateAliasParameter *syntaxCopy() override; - bool declareParameter(Scope *sc) override; void print(RootObject *oarg, RootObject *oded) override; RootObject *specialization() override; bool hasDefaultArg() override; @@ -217,7 +214,6 @@ class TemplateTupleParameter final : public TemplateParameter public: TemplateTupleParameter *isTemplateTupleParameter() override; TemplateTupleParameter *syntaxCopy() override; - bool declareParameter(Scope *sc) override; void print(RootObject *oarg, RootObject *oded) override; RootObject *specialization() override; bool hasDefaultArg() override; @@ -301,4 +297,6 @@ namespace dmd TemplateParameter *isTemplateParameter(RootObject *o); bool isError(const RootObject *const o); void printTemplateStats(bool listInstances, ErrorSink* eSink); + void printInstantiationTrace(TemplateInstance *ti); + bool declareParameter(TemplateParameter *tp, Scope *sc); } diff --git a/dmd/templateparamsem.d b/dmd/templateparamsem.d index 561181a2cc1..6779ca982a8 100644 --- a/dmd/templateparamsem.d +++ b/dmd/templateparamsem.d @@ -1,7 +1,7 @@ /** * Semantic analysis of template parameters. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/templateparamsem.d, _templateparamsem.d) @@ -20,6 +20,7 @@ import dmd.globals; import dmd.location; import dmd.expression; import dmd.expressionsem; +import dmd.templatesem; import dmd.rootobject; import dmd.mtype; import dmd.typesem; diff --git a/dmd/templatesem.d b/dmd/templatesem.d index 18059e9531d..c557f21524b 100644 --- a/dmd/templatesem.d +++ b/dmd/templatesem.d @@ -1,7 +1,7 @@ /** * Template semantics. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/templatesem.d, _templatesem.d) @@ -47,6 +47,7 @@ import dmd.mtype; import dmd.opover; import dmd.optimize; import dmd.root.array; +import dmd.root.string : toDString; import dmd.common.outbuffer; import dmd.rootobject; import dmd.semantic2; @@ -61,6 +62,495 @@ alias funcLeastAsSpecialized = dmd.funcsem.leastAsSpecialized; enum LOG = false; +/*********************************************************** + * Check whether the type t representation relies on one or more the template parameters. + * Params: + * t = Tested type, if null, returns false. + * tparams = Template parameters. + * iStart = Start index of tparams to limit the tested parameters. If it's + * nonzero, tparams[0..iStart] will be excluded from the test target. + */ +bool reliesOnTident(Type t, TemplateParameters* tparams, size_t iStart = 0) +{ + return reliesOnTemplateParameters(t, (*tparams)[0 .. tparams.length]); +} + +/*********************************************************** + * Check whether the type t representation relies on one or more the template parameters. + * Params: + * t = Tested type, if null, returns false. + * tparams = Template parameters. + */ +bool reliesOnTemplateParameters(Type t, TemplateParameter[] tparams) +{ + bool visitVector(TypeVector t) + { + return t.basetype.reliesOnTemplateParameters(tparams); + } + + bool visitAArray(TypeAArray t) + { + return t.next.reliesOnTemplateParameters(tparams) || + t.index.reliesOnTemplateParameters(tparams); + } + + bool visitFunction(TypeFunction t) + { + foreach (i, fparam; t.parameterList) + { + if (fparam.type.reliesOnTemplateParameters(tparams)) + return true; + } + return t.next.reliesOnTemplateParameters(tparams); + } + + bool visitIdentifier(TypeIdentifier t) + { + foreach (tp; tparams) + { + if (tp.ident.equals(t.ident)) + return true; + } + return false; + } + + bool visitInstance(TypeInstance t) + { + foreach (tp; tparams) + { + if (t.tempinst.name == tp.ident) + return true; + } + + if (t.tempinst.tiargs) + foreach (arg; *t.tempinst.tiargs) + { + if (Type ta = isType(arg)) + { + if (ta.reliesOnTemplateParameters(tparams)) + return true; + } + } + + return false; + } + + bool visitTypeof(TypeTypeof t) + { + //printf("TypeTypeof.reliesOnTemplateParameters('%s')\n", t.toChars()); + return t.exp.reliesOnTemplateParameters(tparams); + } + + bool visitTuple(TypeTuple t) + { + if (t.arguments) + foreach (arg; *t.arguments) + { + if (arg.type.reliesOnTemplateParameters(tparams)) + return true; + } + + return false; + } + + if (!t) + return false; + + Type tb = t.toBasetype(); + switch (tb.ty) + { + case Tvector: return visitVector(tb.isTypeVector()); + case Taarray: return visitAArray(tb.isTypeAArray()); + case Tfunction: return visitFunction(tb.isTypeFunction()); + case Tident: return visitIdentifier(tb.isTypeIdentifier()); + case Tinstance: return visitInstance(tb.isTypeInstance()); + case Ttypeof: return visitTypeof(tb.isTypeTypeof()); + case Ttuple: return visitTuple(tb.isTypeTuple()); + case Tenum: return false; + default: return tb.nextOf().reliesOnTemplateParameters(tparams); + } +} + +/*********************************************************** + * Check whether the expression representation relies on one or more the template parameters. + * Params: + * e = expression to test + * tparams = Template parameters. + * Returns: + * true if it does + */ +private bool reliesOnTemplateParameters(Expression e, TemplateParameter[] tparams) +{ + extern (C++) final class ReliesOnTemplateParameters : Visitor + { + alias visit = Visitor.visit; + public: + TemplateParameter[] tparams; + bool result; + + extern (D) this(TemplateParameter[] tparams) @safe + { + this.tparams = tparams; + } + + override void visit(Expression e) + { + //printf("Expression.reliesOnTemplateParameters('%s')\n", e.toChars()); + } + + override void visit(IdentifierExp e) + { + //printf("IdentifierExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + foreach (tp; tparams) + { + if (e.ident == tp.ident) + { + result = true; + return; + } + } + } + + override void visit(TupleExp e) + { + //printf("TupleExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (e.exps) + { + foreach (ea; *e.exps) + { + ea.accept(this); + if (result) + return; + } + } + } + + override void visit(ArrayLiteralExp e) + { + //printf("ArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (e.elements) + { + foreach (el; *e.elements) + { + el.accept(this); + if (result) + return; + } + } + } + + override void visit(AssocArrayLiteralExp e) + { + //printf("AssocArrayLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + foreach (ek; *e.keys) + { + ek.accept(this); + if (result) + return; + } + foreach (ev; *e.values) + { + ev.accept(this); + if (result) + return; + } + } + + override void visit(StructLiteralExp e) + { + //printf("StructLiteralExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (e.elements) + { + foreach (ea; *e.elements) + { + ea.accept(this); + if (result) + return; + } + } + } + + override void visit(TypeExp e) + { + //printf("TypeExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + result = e.type.reliesOnTemplateParameters(tparams); + } + + override void visit(NewExp e) + { + //printf("NewExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (e.placement) + e.placement.accept(this); + if (e.thisexp) + e.thisexp.accept(this); + result = e.newtype.reliesOnTemplateParameters(tparams); + if (!result && e.arguments) + { + foreach (ea; *e.arguments) + { + ea.accept(this); + if (result) + return; + } + } + } + + override void visit(NewAnonClassExp e) + { + //printf("NewAnonClassExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + result = true; + } + + override void visit(FuncExp e) + { + //printf("FuncExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + result = true; + } + + override void visit(TypeidExp e) + { + //printf("TypeidExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (auto ea = isExpression(e.obj)) + ea.accept(this); + else if (auto ta = isType(e.obj)) + result = ta.reliesOnTemplateParameters(tparams); + } + + override void visit(TraitsExp e) + { + //printf("TraitsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + if (e.args) + { + foreach (oa; *e.args) + { + if (auto ea = isExpression(oa)) + ea.accept(this); + else if (auto ta = isType(oa)) + result = ta.reliesOnTemplateParameters(tparams); + if (result) + return; + } + } + } + + override void visit(IsExp e) + { + //printf("IsExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + result = e.targ.reliesOnTemplateParameters(tparams); + } + + override void visit(UnaExp e) + { + //printf("UnaExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + e.e1.accept(this); + } + + override void visit(DotTemplateInstanceExp e) + { + //printf("DotTemplateInstanceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + visit(e.isUnaExp()); + if (!result && e.ti.tiargs) + { + foreach (oa; *e.ti.tiargs) + { + if (auto ea = isExpression(oa)) + ea.accept(this); + else if (auto ta = isType(oa)) + result = ta.reliesOnTemplateParameters(tparams); + if (result) + return; + } + } + } + + override void visit(CallExp e) + { + //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + visit(e.isUnaExp()); + if (!result && e.arguments) + { + foreach (ea; *e.arguments) + { + ea.accept(this); + if (result) + return; + } + } + } + + override void visit(CastExp e) + { + //printf("CallExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + visit(e.isUnaExp()); + // e.to can be null for cast() with no type + if (!result && e.to) + result = e.to.reliesOnTemplateParameters(tparams); + } + + override void visit(SliceExp e) + { + //printf("SliceExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + visit(e.isUnaExp()); + if (!result && e.lwr) + e.lwr.accept(this); + if (!result && e.upr) + e.upr.accept(this); + } + + override void visit(IntervalExp e) + { + //printf("IntervalExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + e.lwr.accept(this); + if (!result) + e.upr.accept(this); + } + + override void visit(ArrayExp e) + { + //printf("ArrayExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + visit(e.isUnaExp()); + if (!result && e.arguments) + { + foreach (ea; *e.arguments) + ea.accept(this); + } + } + + override void visit(BinExp e) + { + //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + e.e1.accept(this); + if (!result) + e.e2.accept(this); + } + + override void visit(CondExp e) + { + //printf("BinExp.reliesOnTemplateParameters('%s')\n", e.toChars()); + e.econd.accept(this); + if (!result) + visit(e.isBinExp()); + } + } + + scope ReliesOnTemplateParameters v = new ReliesOnTemplateParameters(tparams); + e.accept(v); + return v.result; +} + +void computeOneMember(TemplateDeclaration td) +{ + if (td is null || td.haveComputedOneMember) + return; + + if (td && td.members && td.ident) + { + Dsymbol s; + if (oneMembers(td.members, s, td.ident) && s) + { + td.onemember = s; + s.parent = td; + td.computeIsTrivialAlias(s); + } + td.haveComputedOneMember = true; + } +} + +private void computeIsTrivialAlias(TemplateDeclaration td, Dsymbol s) +{ + /* Set isTrivialAliasSeq if this fits the pattern: + * template AliasSeq(T...) { alias AliasSeq = T; } + * or set isTrivialAlias if this fits the pattern: + * template Alias(T) { alias Alias = qualifiers(T); } + */ + if (!(td.parameters && td.parameters.length == 1)) + return; + + auto ad = s.isAliasDeclaration(); + if (!ad || !ad.type) + return; + + auto ti = ad.type.isTypeIdentifier(); + + if (!ti || ti.idents.length != 0) + return; + + if (auto ttp = (*td.parameters)[0].isTemplateTupleParameter()) + { + if (ti.ident is ttp.ident && + ti.mod == 0) + { + //printf("found isTrivialAliasSeq %s %s\n", s.toChars(), ad.type.toChars()); + td.isTrivialAliasSeq = true; + } + } + else if (auto ttp = (*td.parameters)[0].isTemplateTypeParameter()) + { + if (ti.ident is ttp.ident) + { + //printf("found isTrivialAlias %s %s\n", s.toChars(), ad.type.toChars()); + td.isTrivialAlias = true; + } + } +} + +bool declareParameter(TemplateParameter _this, Scope* sc) +{ + static bool typeDeclareParameter(TemplateTypeParameter _this, Scope* sc) + { + //printf("TemplateTypeParameter.declareParameter('%s')\n", ident.toChars()); + auto ti = new TypeIdentifier(_this.loc, _this.ident); + Declaration ad = new AliasDeclaration(_this.loc, _this.ident, ti); + return sc.insert(ad) !is null; + } + + static bool valueDeclareParameter(TemplateValueParameter _this, Scope* sc) + { + /* + Do type semantic earlier. + + This means for certain erroneous value parameters + their "type" can be known earlier and thus a better + error message given. + + For example: + `template test(x* x) {}` + now yields "undefined identifier" rather than the opaque + "variable `x` is used as a type". + */ + if (_this.valType) + _this.valType = _this.valType.typeSemantic(_this.loc, sc); + auto v = new VarDeclaration(_this.loc, _this.valType, _this.ident, null); + v.storage_class = STC.templateparameter; + return sc.insert(v) !is null; + } + + static bool aliasDeclareParameter(TemplateAliasParameter _this, Scope* sc) + { + auto ti = new TypeIdentifier(_this.loc, _this.ident); + Declaration ad = new AliasDeclaration(_this.loc, _this.ident, ti); + return sc.insert(ad) !is null; + } + + static bool tupleDeclareParameter(TemplateTupleParameter _this, Scope* sc) + { + auto ti = new TypeIdentifier(_this.loc, _this.ident); + Declaration ad = new AliasDeclaration(_this.loc, _this.ident, ti); + return sc.insert(ad) !is null; + } + + if (auto tp = _this.isTemplateTypeParameter()) + return typeDeclareParameter(tp, sc); + else if (auto vp = _this.isTemplateValueParameter()) + return valueDeclareParameter(vp, sc); + else if (auto ap = _this.isTemplateAliasParameter()) + return aliasDeclareParameter(ap, sc); + else if (auto tup = _this.isTemplateTupleParameter()) + return tupleDeclareParameter(tup, sc); + + assert(0); // unreachable +} + /************************************ * Return hash of Objects. */ @@ -311,7 +801,6 @@ void templateDeclarationSemantic(Scope* sc, TemplateDeclaration tempdecl) (*tempdecl.origParameters)[i] = tp.syntaxCopy(); } } - for (size_t i = 0; i < tempdecl.parameters.length; i++) { TemplateParameter tp = (*tempdecl.parameters)[i]; @@ -326,6 +815,7 @@ void templateDeclarationSemantic(Scope* sc, TemplateDeclaration tempdecl) } if (i + 1 != tempdecl.parameters.length && tp.isTemplateTupleParameter()) { + tempdecl.computeOneMember(); // for .kind .error(tempdecl.loc, "%s `%s` template sequence parameter must be the last one", tempdecl.kind, tempdecl.toPrettyChars); tempdecl.errors = true; } @@ -365,16 +855,7 @@ void templateDeclarationSemantic(Scope* sc, TemplateDeclaration tempdecl) // Compute again tempdecl.onemember = null; - if (tempdecl.members) - { - Dsymbol s; - if (oneMembers(tempdecl.members, s, tempdecl.ident) && s) - { - tempdecl.onemember = s; - s.parent = tempdecl; - } - } - + tempdecl.computeOneMember(); /* BUG: should check: * 1. template functions must not introduce virtual functions, as they * cannot be accomodated in the vtbl[] @@ -433,11 +914,10 @@ void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList } timeTraceBeginEvent(TimeTraceEventType.sema1TemplateInstance); - scope (exit) timeTraceEndEvent(TimeTraceEventType.sema1TemplateInstance, tempinst); - + scope (exit) timeTraceEndEvent(TimeTraceEventType.sema1TemplateInstance, tempinst, + () => tempinst.toPrettyChars().toDString()); // Get the enclosing template instance from the scope tinst tempinst.tinst = sc.tinst; - // Get the instantiating module from the scope minst tempinst.minst = sc.minst; // https://issues.dlang.org/show_bug.cgi?id=10920 @@ -742,6 +1222,9 @@ void templateInstanceSemantic(TemplateInstance tempinst, Scope* sc, ArgumentList _scope.minst = tempinst.minst; //scope.stc = STC.none; + if (sc.isKnownToHaveACompileTimeContext) + _scope.knownACompileTimeOnlyContext = true; + // Declare each template parameter as an alias for the argument type Scope* paramscope = _scope.push(); paramscope.stc = STC.none; @@ -1066,10 +1549,10 @@ Laftersemantic: //printf("replaceInstance()\n"); assert(errinst.errors); auto ti1 = TemplateInstanceBox(errinst); - tempdecl.instances.remove(ti1); + (cast(TemplateInstance[TemplateInstanceBox])tempdecl.instances).remove(ti1); auto ti2 = TemplateInstanceBox(tempinst); - tempdecl.instances[ti2] = tempinst; + (*(cast(TemplateInstance[TemplateInstanceBox]*) &tempdecl.instances))[ti2] = tempinst; } static if (LOG) @@ -1454,6 +1937,7 @@ void aliasInstanceSemantic(TemplateInstance tempinst, Scope* sc, TemplateDeclara TemplateTypeParameter ttp = (*tempdecl.parameters)[0].isTemplateTypeParameter(); Type ta = tempinst.tdtypes[0].isType(); + tempdecl.computeOneMember(); auto ad = tempdecl.onemember.isAliasDeclaration(); // Note: qualifiers can be in both 'ad.type.mod' and 'ad.storage_class' @@ -1488,7 +1972,7 @@ private TemplateInstance findExistingInstance(TemplateDeclaration td, TemplateIn tithis.fargs = argumentList.arguments; tithis.fnames = argumentList.names; auto tibox = TemplateInstanceBox(tithis); - auto p = tibox in td.instances; + auto p = tibox in cast(TemplateInstance[TemplateInstanceBox]) td.instances; debug (FindExistingInstance) ++(p ? nFound : nNotFound); //if (p) printf("\tfound %p\n", *p); else printf("\tnot found\n"); return p ? *p : null; @@ -1502,7 +1986,7 @@ private TemplateInstance addInstance(TemplateDeclaration td, TemplateInstance ti { //printf("addInstance() %p %s\n", instances, ti.toChars()); auto tibox = TemplateInstanceBox(ti); - td.instances[tibox] = ti; + (*(cast(TemplateInstance[TemplateInstanceBox]*) &td.instances))[tibox] = ti; debug (FindExistingInstance) ++nAdded; return ti; } @@ -1517,7 +2001,7 @@ private void removeInstance(TemplateDeclaration td, TemplateInstance ti) //printf("removeInstance() %s\n", ti.toChars()); auto tibox = TemplateInstanceBox(ti); debug (FindExistingInstance) ++nRemoved; - td.instances.remove(tibox); + (cast(TemplateInstance[TemplateInstanceBox])td.instances).remove(tibox); } /****************************************************** @@ -2375,7 +2859,9 @@ private MATCH matchArg(TemplateParameter tp, Scope* sc, RootObject oarg, size_t if (!sa || si != sa) return matchArgNoMatch(); } - dedtypes[i] = sa; + // Note: Dsymbol can't have type qualifiers, so use type if it has them + // https://github.com/dlang/dmd/issues/17959 + dedtypes[i] = ta && ta.mod ? ta : sa; if (psparam) { @@ -2682,6 +3168,7 @@ MATCH matchWithInstance(Scope* sc, TemplateDeclaration td, TemplateInstance ti, ti.parent = td.parent; // Similar to doHeaderInstantiation + td.computeOneMember(); FuncDeclaration fd = td.onemember ? td.onemember.isFuncDeclaration() : null; if (fd) { @@ -3115,7 +3602,6 @@ private bool evaluateConstraint(TemplateDeclaration td, TemplateInstance ti, Sco const(char)* getConstraintEvalError(TemplateDeclaration td, ref const(char)* tip) { import dmd.staticcond; - // there will be a full tree view in verbose mode, and more compact list in the usual const full = global.params.v.verbose; uint count; @@ -3338,6 +3824,7 @@ bool findBestMatch(TemplateInstance ti, Scope* sc, ArgumentList argumentList) else { auto tdecl = ti.tempdecl.isTemplateDeclaration(); + tdecl.computeOneMember(); if (errs != global.errors) errorSupplemental(ti.loc, "while looking for match for `%s`", ti.toChars()); @@ -5170,7 +5657,7 @@ bool TemplateInstance_semanticTiargs(Loc loc, Scope* sc, Objects* tiargs, int fl * errorHelper = delegate to send error message to if not null */ void functionResolve(ref MatchAccumulator m, Dsymbol dstart, Loc loc, Scope* sc, Objects* tiargs, - Type tthis, ArgumentList argumentList, void delegate(const(char)*) scope errorHelper = null) + Type tthis, ArgumentList argumentList, void delegate(const(char)*, Loc argloc = Loc.initial) scope errorHelper = null) { version (none) { @@ -5403,7 +5890,7 @@ void functionResolve(ref MatchAccumulator m, Dsymbol dstart, Loc loc, Scope* sc, return 1; } //printf("td = %s\n", td.toChars()); - + td.computeOneMember(); auto f = td.onemember ? td.onemember.isFuncDeclaration() : null; if (!f) { @@ -5650,6 +6137,7 @@ void functionResolve(ref MatchAccumulator m, Dsymbol dstart, Loc loc, Scope* sc, if (td_best && ti_best && m.count == 1) { // Matches to template function + td_best.computeOneMember(); assert(td_best.onemember && td_best.onemember.isFuncDeclaration()); /* The best match is td_best with arguments tdargs. * Now instantiate the template. @@ -7110,12 +7598,7 @@ MATCH deduceType(scope RootObject o, scope Scope* sc, scope Type tparam, override void visit(ArrayLiteralExp e) { // https://issues.dlang.org/show_bug.cgi?id=20092 - if (e.elements && e.elements.length && e.type.toBasetype().nextOf().ty == Tvoid) - { - result = deduceEmptyArrayElement(); - return; - } - if ((!e.elements || !e.elements.length) && e.type.toBasetype().nextOf().ty == Tvoid && tparam.ty == Tarray) + if (e.type.toBasetype().nextOf().ty == Tvoid && tparam.ty == Tarray) { // tparam:T[] <- e:[] (void[]) result = deduceEmptyArrayElement(); @@ -7198,7 +7681,39 @@ MATCH deduceType(scope RootObject o, scope Scope* sc, scope Type tparam, //printf("\ttf = %s\n", tf.toChars()); const dim = tf.parameterList.length; - if (tof.parameterList.length != dim || tof.parameterList.varargs != tf.parameterList.varargs) + if (tof.parameterList.varargs != tf.parameterList.varargs) + return; + + // https://github.com/dlang/dmd/issues/19905 + // Resolve and expand TypeTuples (e.g. from AliasSeq) in tof's parameters + // before comparing counts. We can't call TypeFunction.typeSemantic because + // the return type may contain unresolved template parameters. + Types* expandedTypes; + foreach (pto; *tof.parameterList.parameters) + { + Type pt = pto.type; + if (!reliesOnTemplateParameters(pt, parameters[inferStart .. parameters.length])) + { + pt = pt.syntaxCopy().typeSemantic(e.loc, sc); + if (pt.ty == Terror) + return; + } + if (auto tt = pt.isTypeTuple()) + { + if (!expandedTypes) + expandedTypes = new Types(); + foreach (arg; *tt.arguments) + expandedTypes.push(arg.type); + } + else + { + if (!expandedTypes) + expandedTypes = new Types(); + expandedTypes.push(pt); + } + } + + if (!expandedTypes || expandedTypes.length != dim) return; auto tiargs = new Objects(); @@ -7214,15 +7729,19 @@ MATCH deduceType(scope RootObject o, scope Scope* sc, scope Type tparam, ++u; } assert(u < dim); - Parameter pto = tof.parameterList[u]; - if (!pto) + Type t = (*expandedTypes)[u]; + if (!t) break; - Type t = pto.type.syntaxCopy(); // https://issues.dlang.org/show_bug.cgi?id=11774 if (reliesOnTemplateParameters(t, parameters[inferStart .. parameters.length])) return; - t = t.typeSemantic(e.loc, sc); - if (t.ty == Terror) - return; + // https://issues.dlang.org/show_bug.cgi?id=11774 + t = t.syntaxCopy(); + if (!t.deco) + { + t = t.typeSemantic(e.loc, sc); + if (t.ty == Terror) + return; + } tiargs.push(t); } diff --git a/dmd/timetrace.d b/dmd/timetrace.d index 59c18595fc7..da7988f4bed 100644 --- a/dmd/timetrace.d +++ b/dmd/timetrace.d @@ -6,7 +6,7 @@ here: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKch This file is originally from LDC (the LLVM D compiler). -Copyright: Copyright (C) 1999-2022 by The D Language Foundation, All Rights Reserved +Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved Authors: Johan Engelen, Max Haughton, Dennis Korpel License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/timetrace.d, common/_timetrace.d) @@ -192,6 +192,7 @@ enum TimeTraceEventType sema1Function, sema2, sema3, + dfa, ctfe, ctfeCall, codegenGlobal, @@ -213,6 +214,7 @@ private immutable string[] eventPrefixes = [ "Sema1: Function ", "Sema2: ", "Sema3: ", + "DFA: ", "Ctfe: ", "Ctfe: call ", "Code generation", diff --git a/dmd/timetrace.h b/dmd/timetrace.h index 4ef991be142..decc591a9c2 100644 --- a/dmd/timetrace.h +++ b/dmd/timetrace.h @@ -29,6 +29,7 @@ enum class TimeTraceEventType sema1Function, sema2, sema3, + dfa, ctfe, ctfeCall, codegenGlobal, diff --git a/dmd/tokens.d b/dmd/tokens.d index 05f413b51c7..c1f7b059874 100644 --- a/dmd/tokens.d +++ b/dmd/tokens.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/lex.html#tokens, Tokens) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/tokens.d, _tokens.d) diff --git a/dmd/tokens.h b/dmd/tokens.h index baa3317b026..1ce4b24fbff 100644 --- a/dmd/tokens.h +++ b/dmd/tokens.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/traits.d b/dmd/traits.d index b22a0732bbf..b874b6dfae5 100644 --- a/dmd/traits.d +++ b/dmd/traits.d @@ -3,7 +3,7 @@ * * Specification: $(LINK2 https://dlang.org/spec/traits.html, Traits) * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/traits.d, _traits.d) @@ -17,14 +17,12 @@ import core.stdc.stdio; import dmd.aggregate; import dmd.arraytypes; -import dmd.astcodegen; import dmd.astenums; import dmd.attrib; import dmd.attribsem; import dmd.canthrow; import dmd.dclass; import dmd.declaration; -import dmd.dimport; import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; @@ -46,7 +44,6 @@ import dmd.mangle : decoToType; import dmd.mtype; import dmd.nogc; import dmd.optimize; -import dmd.parse; import dmd.root.array; import dmd.root.speller; import dmd.root.stringtable; @@ -54,9 +51,7 @@ import dmd.target; import dmd.templatesem : TemplateInstance_semanticTiargs, TemplateInstanceBox; import dmd.tokens; import dmd.typesem; -import dmd.visitor; import dmd.rootobject; -import dmd.common.outbuffer; import dmd.root.string; enum LOGSEMANTIC = false; @@ -170,11 +165,14 @@ ulong getTypePointerBitmap(Loc loc, Type t, ref Array!(ulong) data, ErrorSink eS ulong nextsize = t.next.size(); if (nextsize == SIZE_INVALID) error = true; - ulong dim = t.dim.toInteger(); - for (ulong i = 0; i < dim; i++) + if (t.hasPointers) { - offset = arrayoff + i * nextsize; - visit(t.next); + ulong dim = t.dim.toInteger(); + for (ulong i = 0; i < dim; i++) + { + offset = arrayoff + i * nextsize; + visit(t.next); + } } offset = arrayoff; } @@ -445,6 +443,27 @@ Expression semanticTraits(TraitsExp e, Scope* sc) }); } + if (e.ident == Id.isOverlapped) + { + if (dim != 1) + return dimError(1); + + return isDeclX((d) + { + auto v = d.isVarDeclaration(); + if (!v || !v.isField()) + return false; + + // Ensure semantic analysis is complete + if (auto agg = v.toParent().isAggregateDeclaration()) + { + if (agg.semanticRun < PASS.semanticdone) + agg.dsymbolSemantic(null); + } + + return v.overlapped; + }); + } if (e.ident == Id.isArithmetic) { return isTypeX(t => t.isIntegral() || t.isFloating()); @@ -590,7 +609,8 @@ Expression semanticTraits(TraitsExp e, Scope* sc) return ErrorExp.get(); } - t = t.toBasetype(); // get the base in case `t` is an `enum` + // get enum base or static array element type + t = t.baseElemOf(); if (auto ts = t.isTypeStruct()) { @@ -599,6 +619,36 @@ Expression semanticTraits(TraitsExp e, Scope* sc) return isCopyable(t) ? True() : False(); } + if (e.ident == Id.needsDestruction) + { + if (dim != 1) + return dimError(1); + + auto o = (*e.args)[0]; + auto t = isType(o); + if (!t) + { + error(e.loc, "type expected as second argument of __traits `%s` instead of `%s`", + e.ident.toChars(), o.toChars()); + return ErrorExp.get(); + } + // FIXME should just check t.needsDestruction() but that doesn't run dsymbolSemantic + + // T[0] + if (!t.size()) + return False(); + + // get the base in case `t` is an `enum` + // handle static arrays + t = t.baseElemOf(); + if (auto ts = t.isTypeStruct()) + { + ts.sym.dsymbolSemantic(sc); + if (ts.sym.dtor) + return True(); + } + return False(); + } if (e.ident == Id.isNested) { @@ -1097,6 +1147,18 @@ Expression semanticTraits(TraitsExp e, Scope* sc) // Prevent semantic() from replacing Symbol with its initializer die.wantsym = true; ex = ex.expressionSemantic(scx); + if (ex) + { + import dmd.access : symbolIsVisible; + import dmd.safe : setUnsafe; + auto msym = getDsymbolWithoutExpCtx(ex); + // https://github.com/dlang/dmd/issues/19721 + if (msym && !symbolIsVisible(sc, msym)) + { + if (sc.setUnsafe(false, e.loc, "accessing member `%s`", id)) + return ErrorExp.get(); + } + } return ex; } else if (e.ident == Id.getVirtualFunctions || @@ -1198,8 +1260,8 @@ Expression semanticTraits(TraitsExp e, Scope* sc) // create an empty AA just to copy it scope ti = new TemplateInstance(Loc.initial, Id.empty, null); auto tib = TemplateInstanceBox(ti); - td.instances[tib] = null; - td.instances.clear(); + (*(cast(TemplateInstance[TemplateInstanceBox]*) &td.instances))[tib] = null; + (cast(TemplateInstance[TemplateInstanceBox])td.instances).clear(); } td = td.syntaxCopy(null); import core.stdc.string : memcpy; @@ -1686,6 +1748,11 @@ Expression semanticTraits(TraitsExp e, Scope* sc) errorSupplemental(e.loc, "`%s` must evaluate to either a module, a struct, an union, a class, an interface or a template instantiation", s.toChars()); return ErrorExp.get(); } + // https://issues.dlang.org/show_bug.cgi?id=13668 + // https://github.com/dlang/dmd/issues/22524 + // resolve forward references + if (sds.semanticRun < PASS.semanticdone) + sds.dsymbolSemantic(sc); auto idents = new Identifiers(); @@ -1764,10 +1831,6 @@ Expression semanticTraits(TraitsExp e, Scope* sc) auto cd = sds.isClassDeclaration(); if (cd && e.ident == Id.allMembers) { - if (cd.semanticRun < PASS.semanticdone) - cd.dsymbolSemantic(null); // https://issues.dlang.org/show_bug.cgi?id=13668 - // Try to resolve forward reference - void pushBaseMembersDg(ClassDeclaration cd) { for (size_t i = 0; i < cd.baseclasses.length; i++) @@ -2252,8 +2315,8 @@ private bool isSame(RootObject o1, RootObject o2, Scope* sc) // https://issues.dlang.org/show_bug.cgi?id=12001, allow isSame, , Type t1 = isType(o1); Type t2 = isType(o2); - if (t1 && t2 && t1.equals(t2)) - return true; + if (t1 && t2) + return t1.equals(t2); auto s1 = getDsymbol(o1); auto s2 = getDsymbol(o2); @@ -2354,7 +2417,7 @@ private void traitNotFound(TraitsExp e) initialized = true; // lazy initialization // All possible traits - __gshared Identifier*[59] idents = + __gshared Identifier*[60] idents = [ &Id.allMembers, &Id.child, @@ -2386,6 +2449,7 @@ private void traitNotFound(TraitsExp e) &Id.identifier, &Id.isAbstractClass, &Id.isAbstractFunction, + &Id.isOverlapped, &Id.isArithmetic, &Id.isAssociativeArray, &Id.isCopyable, diff --git a/dmd/typesem.d b/dmd/typesem.d index 3cd45e70845..67873afdbb4 100644 --- a/dmd/typesem.d +++ b/dmd/typesem.d @@ -1,7 +1,7 @@ /** * Semantic analysis for D types. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/typesem.d, _typesem.d) @@ -17,7 +17,6 @@ import core.stdc.stdio; import dmd.access; import dmd.aggregate; -import dmd.aliasthis; import dmd.arrayop; import dmd.arraytypes; import dmd.astcodegen; @@ -26,17 +25,16 @@ import dmd.dcast; import dmd.dclass; import dmd.declaration; import dmd.denum; -import dmd.dimport; import dmd.dinterpret; import dmd.dmodule; import dmd.dscope; import dmd.dstruct; import dmd.dsymbol; import dmd.dsymbolsem; +import dmd.templatesem : computeOneMember; import dmd.dtemplate; import dmd.enumsem; import dmd.errors; -import dmd.errorsink; import dmd.expression; import dmd.expressionsem; import dmd.func; @@ -50,7 +48,6 @@ import dmd.importc; import dmd.init; import dmd.initsem; import dmd.location; -import dmd.visitor; import dmd.mtype; import dmd.mangle; import dmd.nogc; @@ -64,13 +61,1358 @@ import dmd.root.rmem; import dmd.common.outbuffer; import dmd.rootobject; import dmd.root.string; -import dmd.root.stringtable; import dmd.safe; import dmd.semantic3; import dmd.sideeffect; import dmd.target; import dmd.tokens; +bool hasDeprecatedAliasThis(Type _this) +{ + auto ad = isAggregate(_this); + return ad && ad.aliasthis && (ad.aliasthis.isDeprecated || ad.aliasthis.sym.isDeprecated); +} + +/************************************* + * Apply STCxxxx bits to existing type. + * Use *before* semantic analysis is run. + */ +Type addSTC(Type _this, STC stc) +{ + Type t = _this; + if (t.isImmutable()) + { + return t; + } + else if (stc & STC.immutable_) + { + t = t.makeImmutable(); + return t; + } + + if ((stc & STC.shared_) && !t.isShared()) + { + if (t.isWild()) + { + if (t.isConst()) + t = t.makeSharedWildConst(); + else + t = t.makeSharedWild(); + } + else + { + if (t.isConst()) + t = t.makeSharedConst(); + else + t = t.makeShared(); + } + } + if ((stc & STC.const_) && !t.isConst()) + { + if (t.isShared()) + { + if (t.isWild()) + t = t.makeSharedWildConst(); + else + t = t.makeSharedConst(); + } + else + { + if (t.isWild()) + t = t.makeWildConst(); + else + t = t.makeConst(); + } + } + if ((stc & STC.wild) && !t.isWild()) + { + if (t.isShared()) + { + if (t.isConst()) + t = t.makeSharedWildConst(); + else + t = t.makeSharedWild(); + } + else + { + if (t.isConst()) + t = t.makeWildConst(); + else + t = t.makeWild(); + } + } + + return t; +} + +/*************************************************** + * Determine if type t can be indexed or sliced given that it is not an + * aggregate with operator overloads. + * Params: + * t = type to check + * Returns: + * true if an expression of type t can be e1 in an array expression + */ +bool isIndexableNonAggregate(Type t) +{ + t = t.toBasetype(); + return (t.ty == Tpointer || t.isStaticOrDynamicArray() || t.ty == Taarray || + t.ty == Ttuple || t.ty == Tvector); +} + +/** + * If the type is a class or struct, returns the symbol for it, + * else null. + */ +AggregateDeclaration isAggregate(Type t) +{ + t = t.toBasetype(); + if (auto tc = t.isTypeClass()) + return tc.sym; + if (auto ts = t.isTypeStruct()) + return ts.sym; + return null; +} + +/**************************************************** + * Determine if parameter is a lazy array of delegates. + * If so, return the return type of those delegates. + * If not, return NULL. + * + * Returns T if the type is one of the following forms: + * T delegate()[] + * T delegate()[dim] + */ +Type isLazyArray(Parameter _this) +{ + Type tb = _this.type.toBasetype(); + if (tb.isStaticOrDynamicArray()) + { + Type tel = (cast(TypeArray)tb).next.toBasetype(); + if (auto td = tel.isTypeDelegate()) + { + TypeFunction tf = td.next.toTypeFunction(); + if (tf.parameterList.varargs == VarArg.none && tf.parameterList.length == 0) + { + return tf.next; // return type of delegate + } + } + } + return null; +} + +/**************************************** + * Return the mask that an integral type will + * fit into. + */ +ulong sizemask(Type _this) +{ + ulong m; + switch (_this.toBasetype().ty) + { + case Tbool: + m = 1; + break; + case Tchar: + case Tint8: + case Tuns8: + m = 0xFF; + break; + case Twchar: + case Tint16: + case Tuns16: + m = 0xFFFFU; + break; + case Tdchar: + case Tint32: + case Tuns32: + m = 0xFFFFFFFFU; + break; + case Tint64: + case Tuns64: + m = 0xFFFFFFFFFFFFFFFFUL; + break; + default: + assert(0); + } + return m; +} + +/************************************* + * If _this is a type of static array, return its base element type. + */ +Type baseElemOf(Type _this) +{ + Type t = _this.toBasetype(); + TypeSArray tsa; + while ((tsa = t.isTypeSArray()) !is null) + t = tsa.next.toBasetype(); + return t; +} + +/************************************* + * If this is a type of something, return that something. + */ +Type nextOf(Type _this) +{ + /******************************* + * For TypeFunction, nextOf() can return NULL if the function return + * type is meant to be inferred, and semantic() hasn't yet been run + * on the function. After semantic(), it must no longer be NULL. + */ + if (auto tn = _this.isTypeNext()) + return tn.next; + else if (auto te = _this.isTypeEnum()) + return te.memType().nextOf(); + return null; +} + +/*************************** + * Look for bugs in constructing types. + */ +void check(Type _this) +{ + if (_this.mcache) + with (_this.mcache) + switch (_this.mod) + { + case 0: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.const_: + if (cto) + assert(cto.mod == 0); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.wild: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == 0); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.wildconst: + assert(!cto || cto.mod == MODFlags.const_); + assert(!ito || ito.mod == MODFlags.immutable_); + assert(!sto || sto.mod == MODFlags.shared_); + assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_)); + assert(!wto || wto.mod == MODFlags.wild); + assert(!wcto || wcto.mod == 0); + assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild)); + assert(!swcto || swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.shared_: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == 0); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.shared_ | MODFlags.const_: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == 0); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.shared_ | MODFlags.wild: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == MODFlags.immutable_); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == 0); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + case MODFlags.shared_ | MODFlags.wildconst: + assert(!cto || cto.mod == MODFlags.const_); + assert(!ito || ito.mod == MODFlags.immutable_); + assert(!sto || sto.mod == MODFlags.shared_); + assert(!scto || scto.mod == (MODFlags.shared_ | MODFlags.const_)); + assert(!wto || wto.mod == MODFlags.wild); + assert(!wcto || wcto.mod == MODFlags.wildconst); + assert(!swto || swto.mod == (MODFlags.shared_ | MODFlags.wild)); + assert(!swcto || swcto.mod == 0); + break; + + case MODFlags.immutable_: + if (cto) + assert(cto.mod == MODFlags.const_); + if (ito) + assert(ito.mod == 0); + if (sto) + assert(sto.mod == MODFlags.shared_); + if (scto) + assert(scto.mod == (MODFlags.shared_ | MODFlags.const_)); + if (wto) + assert(wto.mod == MODFlags.wild); + if (wcto) + assert(wcto.mod == MODFlags.wildconst); + if (swto) + assert(swto.mod == (MODFlags.shared_ | MODFlags.wild)); + if (swcto) + assert(swcto.mod == (MODFlags.shared_ | MODFlags.wildconst)); + break; + + default: + assert(0); + } + + Type tn = _this.nextOf(); + if (tn && _this.ty != Tfunction && tn.ty != Tfunction && _this.ty != Tenum) + { + // Verify transitivity + switch (_this.mod) + { + case 0: + case MODFlags.const_: + case MODFlags.wild: + case MODFlags.wildconst: + case MODFlags.shared_: + case MODFlags.shared_ | MODFlags.const_: + case MODFlags.shared_ | MODFlags.wild: + case MODFlags.shared_ | MODFlags.wildconst: + case MODFlags.immutable_: + assert(tn.mod == MODFlags.immutable_ || (tn.mod & _this.mod) == _this.mod); + break; + + default: + assert(0); + } + tn.check(); + } +} + +/********************************** + * For our new type '_this', which is type-constructed from t, + * fill in the cto, ito, sto, scto, wto shortcuts. + */ +private void fixTo(Type _this, Type t) +{ + Type mto = null; // the naked type of `t` + if (_this.mod || t.mod) + { + _this.getMcache(); + t.getMcache(); + } + // If fixing this: immutable(T*) by t: immutable(T)*, + // cache t to this.xto won't break transitivity. + Type tn = _this.nextOf(); + if (!tn || _this.ty != Tsarray && tn.mod == t.nextOf().mod) + { + switch (t.mod) + { + case 0: + mto = t; // t is naked + break; + + case MODFlags.const_: + mto = t.mcache.cto; // cto is naked + _this.mcache.cto = t; + break; + + case MODFlags.wild: + mto = t.mcache.wto; // wto is naked + _this.mcache.wto = t; + break; + + case MODFlags.wildconst: + mto = t.mcache.wcto; // wcto is naked + _this.mcache.wcto = t; + break; + + case MODFlags.shared_: + mto = t.mcache.sto; // sto is naked + _this.mcache.sto = t; + break; + + case MODFlags.shared_ | MODFlags.const_: + mto = t.mcache.scto; // scto is naked + _this.mcache.scto = t; + break; + + case MODFlags.shared_ | MODFlags.wild: + mto = t.mcache.swto; // swto is naked + _this.mcache.swto = t; + break; + + case MODFlags.shared_ | MODFlags.wildconst: + mto = t.mcache.swcto; // swcto is naked + _this.mcache.swcto = t; + break; + + case MODFlags.immutable_: + mto = t.mcache.ito; // ito is naked + _this.mcache.ito = t; + break; + + default: + break; + } + } + assert(_this.mod != t.mod); + + switch (_this.mod) + { + case 0: + break; + + case MODFlags.const_: + _this.mcache.cto = mto; + t.mcache.cto = _this; + break; + + case MODFlags.wild: + _this.mcache.wto = mto; + t.mcache.wto = _this; + break; + + case MODFlags.wildconst: + _this.mcache.wcto = mto; + t.mcache.wcto = _this; + break; + + case MODFlags.shared_: + _this.mcache.sto = mto; + t.mcache.sto = _this; + break; + + case MODFlags.shared_ | MODFlags.const_: + _this.mcache.scto = mto; + t.mcache.scto = _this; + break; + + case MODFlags.shared_ | MODFlags.wild: + _this.mcache.swto = mto; + t.mcache.swto = _this; + break; + + case MODFlags.shared_ | MODFlags.wildconst: + _this.mcache.swcto = mto; + t.mcache.swcto = _this; + break; + + case MODFlags.immutable_: + t.mcache.ito = _this; + if (t.mcache.cto) + t.mcache.cto.getMcache().ito = _this; + if (t.mcache.sto) + t.mcache.sto.getMcache().ito = _this; + if (t.mcache.scto) + t.mcache.scto.getMcache().ito = _this; + if (t.mcache.wto) + t.mcache.wto.getMcache().ito = _this; + if (t.mcache.wcto) + t.mcache.wcto.getMcache().ito = _this; + if (t.mcache.swto) + t.mcache.swto.getMcache().ito = _this; + if (t.mcache.swcto) + t.mcache.swcto.getMcache().ito = _this; + break; + + default: + assert(0); + } + _this.check(); + t.check(); + //printf("fixTo: %s, %s\n", toChars(), t.toChars()); +} + +void transitive(TypeNext _this) +{ + // Invoke transitivity of type attributes + _this.next = _this.next.addMod(_this.mod); +} + +private inout(TypeNext) isTypeNext(inout Type _this) +{ + switch(_this.ty) + { + case Tpointer, Treference, Tfunction, Tdelegate, Tslice, Tarray, Taarray, Tsarray: + return cast(typeof(return)) _this; + default: return null; + } +} + +/******************************** + * true if when type is copied, it needs a copy constructor or postblit + * applied. Only applies to value types, not ref types. + */ +bool needsCopyOrPostblit(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + return tsa.next.needsCopyOrPostblit(); + else if (auto ts = _this.isTypeStruct()) + return ts.sym.hasCopyCtor || ts.sym.postblit; + else if (auto te = _this.isTypeEnum()) + return te.memType().needsCopyOrPostblit(); + return false; +} + +/******************************** + * true if when type goes out of scope, it needs a destructor applied. + * Only applies to value types, not ref types. + */ +bool needsDestruction(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + return tsa.next.needsDestruction(); + else if (auto ts = _this.isTypeStruct()) + return ts.sym.dtor !is null; + else if (auto te = _this.isTypeEnum()) + return te.memType().needsDestruction(); + return false; +} + +bool needsNested(Type _this) +{ + static bool typeStructNeedsNested(TypeStruct _this) + { + if (_this.inuse) return false; // circular type, error instead of crashing + + _this.inuse = true; + scope(exit) _this.inuse = false; + + if (_this.sym.isNested()) + return true; + + for (size_t i = 0; i < _this.sym.fields.length; i++) + { + VarDeclaration v = _this.sym.fields[i]; + if (!v.isDataseg() && v.type.needsNested()) + return true; + } + return false; + } + + if (auto tsa = _this.isTypeSArray()) + return tsa.next.needsNested(); + else if (auto ts = _this.isTypeStruct()) + return typeStructNeedsNested(ts); + else if (auto te = _this.isTypeEnum()) + return te.memType().needsNested(); + return false; +} + +bool isScalar(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & (TFlags.integral | TFlags.floating)) != 0; + else if (auto tv = _this.isTypeVector()) + return tv.basetype.nextOf().isScalar(); + else if (auto te = _this.isTypeEnum()) + return te.memType().isScalar(); + else if (_this.isTypePointer()) + return true; + return false; +} + +bool isUnsigned(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.unsigned) != 0; + else if (auto tv = _this.isTypeVector()) + return tv.basetype.nextOf().isUnsigned(); + else if (auto te = _this.isTypeEnum()) + return te.memType().isUnsigned(); + return false; +} + +bool isImaginary(Type _this) +{ + if (auto te = _this.isTypeEnum()) + return te.memType().isImaginary(); + return _this.isImaginaryNonSemantic(); +} + +bool isComplex(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.complex) != 0; + else if (auto te = _this.isTypeEnum()) + return te.memType().isComplex(); + return false; +} + +// Exposed as it is used in `expressionsem` +MOD typeDeduceWild(Type _this, Type t, bool isRef) +{ + //printf("Type::deduceWild this = '%s', tprm = '%s'\n", toChars(), tprm.toChars()); + if (t.isWild()) + { + if (_this.isImmutable()) + return MODFlags.immutable_; + if (_this.isWildConst()) + { + if (t.isWildConst()) + return MODFlags.wild; + return MODFlags.wildconst; + } + if (_this.isWild()) + return MODFlags.wild; + if (_this.isConst()) + return MODFlags.const_; + if (_this.isMutable()) + return MODFlags.mutable; + assert(0); + } + return 0; +} + +/*************************************** + * Compute MOD bits matching `this` argument type to wild parameter type. + * Params: + * _this = base parameter type + * t = corresponding parameter type + * isRef = parameter is `ref` or `out` + * Returns: + * MOD bits + */ +MOD deduceWild(Type _this, Type t, bool isRef) +{ + static MOD typeNextDeduceWild(TypeNext _this, Type t, bool isRef) + { + if (_this.ty == Tfunction) + return 0; + + ubyte wm; + + Type tn = t.nextOf(); + if (!isRef && (_this.ty == Tarray || _this.ty == Tpointer) && tn) + { + wm = _this.next.deduceWild(tn, true); + if (!wm) + wm = typeDeduceWild(cast(Type)_this, t, true); + } + else + { + wm = typeDeduceWild(cast(Type)_this, t, isRef); + if (!wm && tn) + wm = _this.next.deduceWild(tn, true); + } + return wm; + } + + static MOD typeStructDeduceWild(TypeStruct _this, Type t, bool isRef) + { + if (_this.ty == t.ty && _this.sym == (cast(TypeStruct)t).sym) + return typeDeduceWild(cast(Type)_this, t, isRef); + + ubyte wm = 0; + + if (t.hasWild() && _this.sym.aliasthis && !(_this.att & AliasThisRec.tracing)) + { + if (auto ato = aliasthisOf(_this)) + { + _this.att = cast(AliasThisRec)(_this.att | AliasThisRec.tracing); + wm = ato.deduceWild(t, isRef); + _this.att = cast(AliasThisRec)(_this.att & ~AliasThisRec.tracing); + } + } + + return wm; + } + + static MOD typeClassDeduceWild(TypeClass _this, Type t, bool isRef) + { + ClassDeclaration cd = t.isClassHandle(); + if (cd && (_this.sym == cd || cd.isBaseOf(_this.sym, null))) + return typeDeduceWild(cast(Type)_this, t, isRef); + + ubyte wm = 0; + + if (t.hasWild() && _this.sym.aliasthis && !(_this.att & AliasThisRec.tracing)) + { + if (auto ato = aliasthisOf(_this)) + { + _this.att = cast(AliasThisRec)(_this.att | AliasThisRec.tracing); + wm = ato.deduceWild(t, isRef); + _this.att = cast(AliasThisRec)(_this.att & ~AliasThisRec.tracing); + } + } + + return wm; + } + + if (auto tn = _this.isTypeNext()) + return typeNextDeduceWild(tn, t, isRef); + else if (auto ts = _this.isTypeStruct()) + return typeStructDeduceWild(ts, t, isRef); + else if (auto tc = _this.isTypeClass()) + return typeClassDeduceWild(tc, t, isRef); + return typeDeduceWild(_this, t, isRef); +} + +bool isString(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + { + TY nty = tsa.next.toBasetype().ty; + return nty.isSomeChar(); + } + else if (auto tda = _this.isTypeDArray()) + { + TY nty = tda.next.toBasetype().ty; + return nty.isSomeChar(); + } + else if (auto te = _this.isTypeEnum()) + return te.memType().isString(); + return false; +} + +/************************** + * Returns true if T can be converted to boolean value. + */ +bool isBoolean(Type _this) +{ + switch(_this.ty) + { + case Tvector, Tstruct: return false; + case Tarray, Taarray, Tdelegate, Tclass, Tnull: return true; + case Tenum: return _this.isTypeEnum().memType().isBoolean(); + // bottom type can be implicitly converted to any other type + case Tnoreturn: return true; + default: return _this.isScalar(); + } +} + +bool isReal(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.real_) != 0; + else if (auto te = _this.isTypeEnum()) + return te.memType().isReal(); + return false; +} + +// real, imaginary, or complex +bool isFloating(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.floating) != 0; + else if (auto tv = _this.isTypeVector()) + return tv.basetype.nextOf().isFloating(); + else if (auto te = _this.isTypeEnum()) + return te.memType().isFloating(); + return false; +} + +bool isIntegral(Type _this) +{ + if (auto tb = _this.isTypeBasic()) + return (tb.flags & TFlags.integral) != 0; + else if (auto tv = _this.isTypeVector()) + return tv.basetype.nextOf().isIntegral(); + else if (auto te = _this.isTypeEnum()) + return te.memType().isIntegral(); + return false; +} + +Type makeSharedWildConst(Type _this) +{ + if (_this.mcache && _this.mcache.swcto) + return _this.mcache.swcto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.shared_ | MODFlags.wildconst; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeSharedWildConst() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + _t.next = tn.next.sharedWildConstOf(); + } + //printf("TypeNext::makeSharedWildConst() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeSharedWild(Type _this) +{ + if (_this.mcache && _this.mcache.swto) + return _this.mcache.swto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.shared_ | MODFlags.wild; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeSharedWild() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + if (tn.next.isConst()) + _t.next = tn.next.sharedWildConstOf(); + else + _t.next = tn.next.sharedWildOf(); + } + //printf("TypeNext::makeSharedWild() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeWildConst(Type _this) +{ + if (_this.mcache && _this.mcache.wcto) + return _this.mcache.wcto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.wildconst; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeWildConst() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + if (tn.next.isShared()) + _t.next = tn.next.sharedWildConstOf(); + else + _t.next = tn.next.wildConstOf(); + } + //printf("TypeNext::makeWildConst() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeWild(Type _this) +{ + if (_this.mcache && _this.mcache.wto) + return _this.mcache.wto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.wild; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeWild() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + if (tn.next.isShared()) + { + if (tn.next.isConst()) + _t.next = tn.next.sharedWildConstOf(); + else + _t.next = tn.next.sharedWildOf(); + } + else + { + if (tn.next.isConst()) + _t.next = tn.next.wildConstOf(); + else + _t.next = tn.next.wildOf(); + } + } + //printf("TypeNext::makeWild() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeSharedConst(Type _this) +{ + if (_this.mcache && _this.mcache.scto) + return _this.mcache.scto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.shared_ | MODFlags.const_; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeSharedConst() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + if (tn.next.isWild()) + _t.next = tn.next.sharedWildConstOf(); + else + _t.next = tn.next.sharedConstOf(); + } + //printf("TypeNext::makeSharedConst() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeShared(Type _this) +{ + if (_this.mcache && _this.mcache.sto) + return _this.mcache.sto; + Type t = _this.nullAttributes(); + t.mod = MODFlags.shared_; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeShared() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + if (tn.next.isWild()) + { + if (tn.next.isConst()) + _t.next = tn.next.sharedWildConstOf(); + else + _t.next = tn.next.sharedWildOf(); + } + else + { + if (tn.next.isConst()) + _t.next = tn.next.sharedConstOf(); + else + _t.next = tn.next.sharedOf(); + } + } + //printf("TypeNext::makeShared() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeImmutable(Type _this) +{ + if (_this.mcache && _this.mcache.ito) + return _this.mcache.ito; + Type t = _this.nullAttributes(); + t.mod = MODFlags.immutable_; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeImmutable() %s\n", toChars()); + TypeNext _t = cast(TypeNext) t; + if (tn.ty != Tfunction && tn.next.ty != Tfunction && !tn.next.isImmutable()) + { + _t.next = tn.next.immutableOf(); + } + return _t; + } + return t; +} + +Type makeMutable(Type _this) +{ + Type t = _this.nullAttributes(); + t.mod = _this.mod & MODFlags.shared_; + + if (auto tn = _this.isTypeNext()) + { + //printf("TypeNext::makeMutable() %p, %s\n", this, toChars()); + TypeNext _t = cast(TypeNext)t; + if (tn.ty == Tsarray) + { + _t.next = tn.next.mutableOf(); + } + //printf("TypeNext::makeMutable() returns %p, %s\n", t, t.toChars()); + return _t; + } + return t; +} + +Type makeConst(Type _this) +{ + if (_this.mcache && _this.mcache.cto) + { + assert(_this.mcache.cto.mod == MODFlags.const_); + return _this.mcache.cto; + } + + static Type defaultMakeConst(Type _this) + { + //printf("Type::makeConst() %p, %s\n", this, toChars()); + Type t = _this.nullAttributes(); + t.mod = MODFlags.const_; + //printf("-Type::makeConst() %p, %s\n", t, toChars()); + return t; + } + + static Type typeNextMakeConst(TypeNext _this) + { + //printf("TypeNext::makeConst() %p, %s\n", this, toChars()); + TypeNext t = cast(TypeNext)defaultMakeConst(cast(Type)_this); + if (_this.ty != Tfunction && _this.next.ty != Tfunction && !_this.next.isImmutable()) + { + if (_this.next.isShared()) + { + if (_this.next.isWild()) + t.next = _this.next.sharedWildConstOf(); + else + t.next = _this.next.sharedConstOf(); + } + else + { + if (_this.next.isWild()) + t.next = _this.next.wildConstOf(); + else + t.next = _this.next.constOf(); + } + } + //printf("TypeNext::makeConst() returns %p, %s\n", t, t.toChars()); + return t; + } + + if (auto tn = _this.isTypeNext()) + return typeNextMakeConst(tn); + + return defaultMakeConst(_this); +} + +/******************************* + * If _this is a shell around another type, + * get that other type. + */ +Type toBasetype(Type _this) +{ + /* This function is used heavily. + * De-virtualize it so it can be easily inlined. + */ + if (auto te = _this.isTypeEnum()) + return te.toBasetype2(); + return _this; +} + +Type toBasetype2(TypeEnum _this) +{ + if (!_this.sym.members && !_this.sym.memtype) + return _this; + auto tb = _this.sym.getMemtype(Loc.initial).toBasetype(); + return tb.castMod(_this.mod); // retain modifier bits from '_this' +} + +Type memType(TypeEnum _this) +{ + return _this.sym.getMemtype(Loc.initial); +} + +uint alignsize(Type _this) +{ + static uint structAlignsize(TypeStruct _this) + { + import dmd.dsymbolsem : size; + _this.sym.size(Loc.initial); // give error for forward references + return _this.sym.alignsize; + } + + static uint enumAlignsize(TypeEnum _this) + { + Type t = _this.memType(); + if (t.ty == Terror) + return 4; + return t.alignsize(); + } + + if (auto tb = _this.isTypeBasic()) + return target.alignsize(tb); + + switch(_this.ty) + { + case Tvector: return cast(uint)_this.isTypeVector().basetype.size(); + case Tsarray: return _this.isTypeSArray().next.alignsize(); + // A DArray consists of two ptr-sized values, so align it on pointer size boundary + case Tarray, Tdelegate: return target.ptrsize; + case Tstruct: return structAlignsize(_this.isTypeStruct()); + case Tenum: return enumAlignsize(_this.isTypeEnum()); + case Tnoreturn: return 0; + default: return cast(uint)size(_this, Loc.initial); + } +} + +/************************************* + * Detect if type has pointer fields that are initialized to void. + * Local stack variables with such void fields can remain uninitialized, + * leading to pointer bugs. + * Returns: + * true if so + */ + +bool hasVoidInitPointers(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + { + return tsa.next.hasVoidInitPointers(); + } + else if (auto ts = _this.isTypeStruct()) + { + import dmd.dsymbolsem : size; + ts.sym.size(Loc.initial); // give error for forward references + ts.sym.determineTypeProperties(); + return ts.sym.hasVoidInitPointers; + } + else if (auto te = _this.isTypeEnum()) + { + return te.memType().hasVoidInitPointers(); + } + return false; +} + +void Type_init() +{ + Type.stringtable._init(14_000); + + // Set basic types + __gshared TY* basetab = + [ + Tvoid, + Tint8, + Tuns8, + Tint16, + Tuns16, + Tint32, + Tuns32, + Tint64, + Tuns64, + Tint128, + Tuns128, + Tfloat32, + Tfloat64, + Tfloat80, + Timaginary32, + Timaginary64, + Timaginary80, + Tcomplex32, + Tcomplex64, + Tcomplex80, + Tbool, + Tchar, + Twchar, + Tdchar, + Terror + ]; + + static Type merge(Type t) + { + import dmd.mangle.basic : tyToDecoBuffer; + + OutBuffer buf; + buf.reserve(3); + + if (t.ty == Tnoreturn) + buf.writestring("Nn"); + else + tyToDecoBuffer(buf, t.ty); + + auto sv = t.stringtable.update(buf[]); + if (sv.value) + return sv.value; + t.deco = cast(char*)sv.toDchars(); + sv.value = t; + return t; + } + + for (size_t i = 0; basetab[i] != Terror; i++) + { + Type t = new TypeBasic(basetab[i]); + .merge(t); + t = merge(t); + Type.basic[basetab[i]] = t; + } + Type.basic[Terror] = new TypeError(); + + Type.tnoreturn = new TypeNoreturn(); + Type.tnoreturn.deco = merge(Type.tnoreturn).deco; + Type.basic[Tnoreturn] = Type.tnoreturn; + + Type.tvoid = Type.basic[Tvoid]; + Type.tint8 = Type.basic[Tint8]; + Type.tuns8 = Type.basic[Tuns8]; + Type.tint16 = Type.basic[Tint16]; + Type.tuns16 = Type.basic[Tuns16]; + Type.tint32 = Type.basic[Tint32]; + Type.tuns32 = Type.basic[Tuns32]; + Type.tint64 = Type.basic[Tint64]; + Type.tuns64 = Type.basic[Tuns64]; + Type.tint128 = Type.basic[Tint128]; + Type.tuns128 = Type.basic[Tuns128]; + Type.tfloat32 = Type.basic[Tfloat32]; + Type.tfloat64 = Type.basic[Tfloat64]; + Type.tfloat80 = Type.basic[Tfloat80]; + + Type.timaginary32 = Type.basic[Timaginary32]; + Type.timaginary64 = Type.basic[Timaginary64]; + Type.timaginary80 = Type.basic[Timaginary80]; + + Type.tcomplex32 = Type.basic[Tcomplex32]; + Type.tcomplex64 = Type.basic[Tcomplex64]; + Type.tcomplex80 = Type.basic[Tcomplex80]; + + Type.tbool = Type.basic[Tbool]; + Type.tchar = Type.basic[Tchar]; + Type.twchar = Type.basic[Twchar]; + Type.tdchar = Type.basic[Tdchar]; + + Type.tshiftcnt = Type.tint32; + Type.terror = Type.basic[Terror]; + Type.tnoreturn = Type.basic[Tnoreturn]; + Type.tnull = new TypeNull(); + Type.tnull.deco = merge(Type.tnull).deco; + + Type.tvoidptr = Type.tvoid.pointerTo(); + Type.tstring = Type.tchar.immutableOf().arrayOf(); + Type.twstring = Type.twchar.immutableOf().arrayOf(); + Type.tdstring = Type.tdchar.immutableOf().arrayOf(); + + const isLP64 = target.isLP64; + + Type.tsize_t = Type.basic[isLP64 ? Tuns64 : Tuns32]; + Type.tptrdiff_t = Type.basic[isLP64 ? Tint64 : Tint32]; + Type.thash_t = Type.tsize_t; + + static if (__VERSION__ == 2081) + { + // Related issue: https://issues.dlang.org/show_bug.cgi?id=19134 + // D 2.081.x regressed initializing class objects at compile time. + // As a workaround initialize this global at run-time instead. + TypeTuple.empty = new TypeTuple(); + } +} + +/************************************ + * Return alignment to use for this type. + */ +structalign_t alignment(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + { + return tsa.next.alignment(); + } + else if (auto ts = _this.isTypeStruct()) + { + import dmd.dsymbolsem : size; + if (ts.sym.alignment.isUnknown()) + ts.sym.size(ts.sym.loc); + return ts.sym.alignment; + } + structalign_t s; + s.setDefault(); + return s; +} + +/*************************************** + * Returns: true if type has any invariants + */ +bool hasInvariant(Type _this) +{ + if (auto tsa = _this.isTypeSArray()) + { + return tsa.next.hasInvariant(); + } + else if (auto ts = _this.isTypeStruct()) + { + import dmd.dsymbolsem : size; + ts.sym.size(Loc.initial); // give error for forward references + ts.sym.determineTypeProperties(); + return ts.sym.hasInvariant() || ts.sym.hasFieldWithInvariant; + } + else if (auto te = _this.isTypeEnum()) + { + return te.memType().hasInvariant(); + } + return false; +} + +/************************************* + * Detect if this is an unsafe type because of the presence of `@system` members + * Returns: + * true if so + */ +bool hasUnsafeBitpatterns(Type _this) +{ + static bool tstructImpl(TypeStruct _this) + { + import dmd.dsymbolsem : size; + _this.sym.size(Loc.initial); // give error for forward references + _this.sym.determineTypeProperties(); + return _this.sym.hasUnsafeBitpatterns; + } + + if(auto tb = _this.isTypeBasic()) + return tb.ty == Tbool; + + switch(_this.ty) + { + case Tenum: return _this.isTypeEnum().memType().hasUnsafeBitpatterns(); + case Tstruct: return tstructImpl(_this.isTypeStruct()); + case Tsarray: return _this.isTypeSArray().next.hasUnsafeBitpatterns(); + default: return false; + } +} + /************************************* * Resolve a tuple index, `s[oindex]`, by figuring out what `s[oindex]` represents. * Setting one of pe/pt/ps. @@ -174,12 +1516,12 @@ private void resolveHelper(TypeQualified mt, Loc loc, Scope* sc, Dsymbol s, Dsym if (const n = importHint(id.toString())) error(loc, "`%s` is not defined, perhaps `import %.*s;` ?", p, cast(int)n.length, n.ptr); else if (auto s2 = sc.search_correct(id)) - error(loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); - else if (const q = Scope.search_correct_C(id)) - error(loc, "undefined identifier `%s`, did you mean `%s`?", p, q); + error(mt.loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); + else if (const q = search_correct_C(id)) + error(mt.loc, "undefined identifier `%s`, did you mean `%s`?", p, q); else if ((id == Id.This && sc.getStructClassScope()) || (id == Id._super && sc.getClassScope())) - error(loc, "undefined identifier `%s`, did you mean `typeof(%s)`?", p, p); + error(mt.loc, "undefined identifier `%s`, did you mean `typeof(%s)`?", p, p); else error(mt.loc, "undefined identifier `%s`", p); } @@ -187,9 +1529,9 @@ private void resolveHelper(TypeQualified mt, Loc loc, Scope* sc, Dsymbol s, Dsym if (const n = cIncludeHint(id.toString())) error(loc, "`%s` is not defined, perhaps `#include %.*s` ?", p, cast(int)n.length, n.ptr); else if (auto s2 = sc.search_correct(id)) - error(loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); + error(mt.loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars()); else - error(loc, "undefined identifier `%s`", p); + error(mt.loc, "undefined identifier `%s`", p); } pt = Type.terror; @@ -614,62 +1956,6 @@ void purityLevel(TypeFunction typeFunction) tf.purity = typeFunction.purity; } -/****************************************** - * We've mistakenly parsed `t` as a type. - * Redo `t` as an Expression only if there are no type modifiers. - * Params: - * t = mistaken type - * Returns: - * t redone as Expression, null if cannot - */ -Expression typeToExpression(Type t) -{ - static Expression visitSArray(TypeSArray t) - { - if (auto e = t.next.typeToExpression()) - return new ArrayExp(t.dim.loc, e, t.dim); - return null; - } - - static Expression visitAArray(TypeAArray t) - { - if (auto e = t.next.typeToExpression()) - { - if (auto ei = t.index.typeToExpression()) - return new ArrayExp(t.loc, e, ei); - } - return null; - } - - static Expression visitIdentifier(TypeIdentifier t) - { - return typeToExpressionHelper(t, new IdentifierExp(t.loc, t.ident)); - } - - static Expression visitInstance(TypeInstance t) - { - return typeToExpressionHelper(t, new ScopeExp(t.loc, t.tempinst)); - } - - // easy way to enable 'auto v = new int[mixin("exp")];' in 2.088+ - static Expression visitMixin(TypeMixin t) - { - return new TypeExp(t.loc, t); - } - - if (t.mod) - return null; - switch (t.ty) - { - case Tsarray: return visitSArray(t.isTypeSArray()); - case Taarray: return visitAArray(t.isTypeAArray()); - case Tident: return visitIdentifier(t.isTypeIdentifier()); - case Tinstance: return visitInstance(t.isTypeInstance()); - case Tmixin: return visitMixin(t.isTypeMixin()); - default: return null; - } -} - /************************************* * https://issues.dlang.org/show_bug.cgi?id=14488 * Check if the inner most base type is complex or imaginary. @@ -879,7 +2165,7 @@ extern(D) Expressions* resolveNamedArgs(TypeFunction tf, ArgumentList argumentLi * MATCHxxxx */ extern (D) MATCH callMatch(FuncDeclaration fd, TypeFunction tf, Type tthis, ArgumentList argumentList, - int flag = 0, void delegate(const(char)*) scope errorHelper = null, Scope* sc = null) + int flag = 0, void delegate(const(char)*, Loc argloc = Loc.initial) scope errorHelper = null, Scope* sc = null) { //printf("callMatch() fd: %s, tf: %s\n", fd ? fd.ident.toChars() : "null", toChars(tf)); MATCH match = MATCH.exact; // assume exact match @@ -1044,12 +2330,20 @@ extern (D) MATCH callMatch(FuncDeclaration fd, TypeFunction tf, Type tthis, Argu if (errorHelper) { if (u >= args.length) + { getMatchError(buf, "missing argument for parameter #%d: `%s`", u + 1, parameterToChars(p, tf, false)); + } // If an error happened previously, `pMessage` was already filled else if (buf.length == 0) + { buf.writestring(tf.getParamError(args[u], p)); - + if(args[u].loc !is Loc.initial) + { + errorHelper(buf.peekChars(),args[u].loc); + return MATCH.nomatch; + } + } errorHelper(buf.peekChars()); } return MATCH.nomatch; @@ -1940,13 +3234,7 @@ Type typeSemantic(Type type, Loc loc, Scope* sc) Type visitComplex(TypeBasic t) { - if (!sc.inCfile) - return visitType(t); - - auto tc = getComplexLibraryType(loc, sc, t.ty); - if (tc.ty == Terror) - return tc; - return tc.addMod(t.mod).merge(); + return visitType(t); } Type visitVector(TypeVector mtype) @@ -2026,6 +3314,15 @@ Type typeSemantic(Type type, Loc loc, Scope* sc) Type tbn = tn.toBasetype(); if (mtype.dim) { + if (auto ide = mtype.dim.isIdentifierExp()) + { + if (ide.ident == Id.dollar) + { + mtype.next = tn; + mtype.transitive(); + return mtype.addMod(tn.mod).merge(); + } + } auto errors = global.errors; mtype.dim = semanticLength(sc, tbn, mtype.dim); mtype.dim = mtype.dim.implicitCastTo(sc, Type.tsize_t); @@ -3006,6 +4303,7 @@ Type typeSemantic(Type type, Loc loc, Scope* sc) if (s) { auto td = s.isTemplateDeclaration; + td.computeOneMember(); if (td && td.onemember && td.onemember.isAggregateDeclaration) .error(loc, "template %s `%s` is used as a type without instantiation" ~ "; to instantiate it use `%s!(arguments)`", @@ -3638,7 +4936,7 @@ Expression defaultInitLiteral(Type t, Loc loc) return ErrorExp.get(); auto structelems = new Expressions(ts.sym.nonHiddenFields()); - uint offset = 0; + ulong bitoffset = 0; foreach (j; 0 .. structelems.length) { VarDeclaration vd = ts.sym.fields[j]; @@ -3648,7 +4946,11 @@ Expression defaultInitLiteral(Type t, Loc loc) error(loc, "circular reference to `%s`", vd.toPrettyChars()); return ErrorExp.get(); } - if (vd.offset < offset || vd.type.size() == 0) + ulong vbitoffset = vd.offset * 8; + auto vbf = vd.isBitFieldDeclaration(); + if (vbf) + vbitoffset += vbf.bitOffset; + if (vbitoffset < bitoffset || vd.type.size() == 0) e = null; else if (vd._init) { @@ -3662,7 +4964,12 @@ Expression defaultInitLiteral(Type t, Loc loc) if (e && e.op == EXP.error) return e; if (e) - offset = vd.offset + cast(uint)vd.type.size(); + { + if (vbf) + bitoffset = vbitoffset + vbf.fieldWidth; + else + bitoffset = vbitoffset + vd.type.size() * 8; + } (*structelems)[j] = e; } auto structinit = new StructLiteralExp(loc, ts.sym, structelems); @@ -4527,7 +5834,7 @@ void resolve(Type mt, Loc loc, Scope* sc, out Expression pe, out Type pt, out Ds !mt.exp.type.isTypeTuple()) { if (!sc.inCfile && // in (extended) C typeof may be used on types as with sizeof - mt.exp.checkType()) + !mt.exp.hasValidType()) goto Lerr; /* Today, 'typeof(func)' returns void if func is a @@ -5625,6 +6932,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag if (TupleDeclaration tup = d.isTupleDeclaration()) { e = new TupleExp(e.loc, tup); + fillTupleExpExps(e.isTupleExp(), tup); return e.expressionSemantic(sc); } if (d.needThis() && sc.intypeof != 1) @@ -6061,6 +7369,7 @@ Expression dotExp(Type mt, Scope* sc, Expression e, Identifier ident, DotExpFlag if (TupleDeclaration tup = d.isTupleDeclaration()) { e = new TupleExp(e.loc, tup); + fillTupleExpExps(e.isTupleExp(), tup); e = e.expressionSemantic(sc); return e; } @@ -7220,6 +8529,15 @@ Type immutableOf(Type type) /******************************** * Make type mutable. + * 0 => 0 + * const => 0 + * immutable => 0 + * shared => shared + * shared const => shared + * wild => 0 + * wild const => 0 + * shared wild => shared + * shared wild const => shared */ Type mutableOf(Type type) { @@ -7236,15 +8554,12 @@ Type mutableOf(Type type) type.getMcache(); if (type.isShared()) { - if (type.isWild()) - t = type.mcache.swcto; // shared wild const -> shared - else - t = type.mcache.sto; // shared const => shared + t = type.mcache.sto; // shared (wild) const => shared } else { if (type.isWild()) - t = type.mcache.wcto; // wild const -> naked + t = type.mcache.wcto; // wild const => naked else t = type.mcache.cto; // const => naked } @@ -7346,7 +8661,6 @@ Type unSharedOf(Type type) { t = type.nullAttributes(); t.mod = type.mod & ~MODFlags.shared_; - t.ctype = type.ctype; t = t.merge(); t.fixTo(type); } @@ -7924,6 +9238,9 @@ MATCH implicitConvToWithoutAliasThis(TypeStruct from, Type to) /* Check all the fields. If they can all be converted, * allow the conversion. */ + import dmd.dsymbolsem : size; + if (from.sym.size(Loc.initial) == SIZE_INVALID) + return MATCH.nomatch; MATCH m = MATCH.constant; uint offset = ~0; // must never match a field offset foreach (v; from.sym.fields[]) @@ -8073,53 +9390,6 @@ bool isOpaqueType(Type t) private: -/* Helper function for `typeToExpression`. Contains common code - * for TypeQualified derived classes. - */ -Expression typeToExpressionHelper(TypeQualified t, Expression e, size_t i = 0) -{ - //printf("toExpressionHelper(e = %s %s)\n", EXPtoString(e.op).ptr, e.toChars()); - foreach (id; t.idents[i .. t.idents.length]) - { - //printf("\t[%d] e: '%s', id: '%s'\n", i, e.toChars(), id.toChars()); - - final switch (id.dyncast()) - { - // ... '. ident' - case DYNCAST.identifier: - e = new DotIdExp(e.loc, e, cast(Identifier)id); - break; - - // ... '. name!(tiargs)' - case DYNCAST.dsymbol: - auto ti = (cast(Dsymbol)id).isTemplateInstance(); - assert(ti); - e = new DotTemplateInstanceExp(e.loc, e, ti.name, ti.tiargs); - break; - - // ... '[type]' - case DYNCAST.type: // https://issues.dlang.org/show_bug.cgi?id=1215 - e = new ArrayExp(t.loc, e, new TypeExp(t.loc, cast(Type)id)); - break; - - // ... '[expr]' - case DYNCAST.expression: // https://issues.dlang.org/show_bug.cgi?id=1215 - e = new ArrayExp(t.loc, e, cast(Expression)id); - break; - - case DYNCAST.object: - case DYNCAST.tuple: - case DYNCAST.parameter: - case DYNCAST.statement: - case DYNCAST.condition: - case DYNCAST.templateparameter: - case DYNCAST.initializer: - assert(0); - } - } - return e; -} - /************************** * This evaluates exp while setting length to be the number * of elements in the tuple t. diff --git a/dmd/typinf.d b/dmd/typinf.d index 9a97d7be8fa..fee8190ae06 100644 --- a/dmd/typinf.d +++ b/dmd/typinf.d @@ -1,7 +1,7 @@ /** * Generate `TypeInfo` objects, which are needed for run-time introspection of types. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/typinf.d, _typinf.d) diff --git a/dmd/typinf.h b/dmd/typinf.h index c34494da2f1..f13dcc8675d 100644 --- a/dmd/typinf.h +++ b/dmd/typinf.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/utils.d b/dmd/utils.d index bfa197aca37..96347712e01 100644 --- a/dmd/utils.d +++ b/dmd/utils.d @@ -1,7 +1,7 @@ /** * This module defines some utility functions for DMD. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/utils.d, _utils.d) diff --git a/dmd/version.h b/dmd/version.h index 1200b2e5ee1..ce554a350b9 100644 --- a/dmd/version.h +++ b/dmd/version.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/dmd/visitor.h b/dmd/visitor.h index 94fd29402ff..d359d517466 100644 --- a/dmd/visitor.h +++ b/dmd/visitor.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2013-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2013-2026 by The D Language Foundation, All Rights Reserved * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. * https://www.boost.org/LICENSE_1_0.txt diff --git a/dmd/visitor/foreachvar.d b/dmd/visitor/foreachvar.d index 73d7c3ef9d6..4cedf04906a 100644 --- a/dmd/visitor/foreachvar.d +++ b/dmd/visitor/foreachvar.d @@ -1,7 +1,7 @@ /** * Utility to visit every variable in an expression. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/visitor/foreachvar.d, _foreachvar.d) diff --git a/dmd/visitor/package.d b/dmd/visitor/package.d index 50b5a54520a..2f2e31beec7 100644 --- a/dmd/visitor/package.d +++ b/dmd/visitor/package.d @@ -1,7 +1,7 @@ /** * Provides a visitor class visiting all AST nodes present in the compiler. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/visitor/package.d, _visitor.d) diff --git a/dmd/visitor/postorder.d b/dmd/visitor/postorder.d index f7c1f8dccf0..1a45e61d565 100644 --- a/dmd/visitor/postorder.d +++ b/dmd/visitor/postorder.d @@ -1,7 +1,7 @@ /** * A depth-first visitor for expressions and statements. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/visitor/postorder.d, _apply.d) diff --git a/dmd/visitor/statement_rewrite_walker.d b/dmd/visitor/statement_rewrite_walker.d index 25e4c736bbf..31fd7ff0ae6 100644 --- a/dmd/visitor/statement_rewrite_walker.d +++ b/dmd/visitor/statement_rewrite_walker.d @@ -1,7 +1,7 @@ /** * Provides a visitor for statements that allows rewriting the currently visited node. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/visitor/statement_rewrite_walker.d, _statement_rewrite_walker.d) diff --git a/dmd/vsoptions.d b/dmd/vsoptions.d index 6051cd9861a..fe85c8dec3a 100644 --- a/dmd/vsoptions.d +++ b/dmd/vsoptions.d @@ -1,7 +1,7 @@ /** * When compiling on Windows with the Microsoft toolchain, try to detect the Visual Studio setup. * - * Copyright: Copyright (C) 1999-2025 by The D Language Foundation, All Rights Reserved + * Copyright: Copyright (C) 1999-2026 by The D Language Foundation, All Rights Reserved * Authors: $(LINK2 https://www.digitalmars.com, Walter Bright) * License: $(LINK2 https://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/compiler/src/dmd/vsoptions.d, _vsoptions.d) diff --git a/dmd/vsoptions.h b/dmd/vsoptions.h index f087e50e60e..eda49619099 100644 --- a/dmd/vsoptions.h +++ b/dmd/vsoptions.h @@ -1,6 +1,6 @@ /* Compiler implementation of the D programming language - * Copyright (C) 2009-2025 by The D Language Foundation, All Rights Reserved + * Copyright (C) 2009-2026 by The D Language Foundation, All Rights Reserved * written by Walter Bright * https://www.digitalmars.com * Distributed under the Boost Software License, Version 1.0. diff --git a/driver/ldmd.cpp b/driver/ldmd.cpp index a5642be4c08..44594e09e54 100644 --- a/driver/ldmd.cpp +++ b/driver/ldmd.cpp @@ -434,7 +434,7 @@ void translateArgs(const llvm::SmallVectorImpl &ldmdArgs, */ else if (startsWith(p + 1, "check=")) { // Parse: - // -check=[assert|bounds|in|invariant|out|switch][=[on|off]] + // -check=[assert|bounds|in|invariant|out|switch|nullderef][=[on|off]] const char *arg = p + 7; if (strcmp(arg, "on") == 0) { ldcArgs.push_back("-boundscheck=on"); @@ -478,6 +478,10 @@ void translateArgs(const llvm::SmallVectorImpl &ldmdArgs, if (kindLength == 6 && memcmp(arg, "bounds", 6) == 0) { ldcArgs.push_back(enabled ? "-boundscheck=on" : "-boundscheck=off"); + } else if (kindLength == 9 && memcmp(arg, "nullderef", 9) == 0) { + // TODO: implement? + if (enabled) + goto Lnot_in_ldc; } else if (!(check(6, "assert", "asserts") || check(2, "in", "preconditions") || check(9, "invariant", "invariants") || diff --git a/gen/abi/abi.cpp b/gen/abi/abi.cpp index 5e5a1baa203..63a3b5d8fd3 100644 --- a/gen/abi/abi.cpp +++ b/gen/abi/abi.cpp @@ -113,7 +113,7 @@ bool TargetABI::isAggregate(Type *t) { // by runtime functions, for which we don't apply the rewrites yet // when calling them return ty == TY::Tstruct || ty == TY::Tsarray || - /*ty == TY::Tarray ||*/ ty == TY::Tdelegate || t->isComplex(); + /*ty == TY::Tarray ||*/ ty == TY::Tdelegate || isComplex(t); } bool TargetABI::isPOD(Type *t, bool excludeStructsWithCtor) { diff --git a/gen/abi/loongarch64.cpp b/gen/abi/loongarch64.cpp index a5f446fca11..d78b41fb4ad 100644 --- a/gen/abi/loongarch64.cpp +++ b/gen/abi/loongarch64.cpp @@ -86,7 +86,7 @@ struct HardfloatRewrite : BaseBitcastABIRewrite { LLType *t[2]; for (unsigned i = 0; i < 2; ++i) { t[i] = - flat.fields[i]->isFloating() + isFloating(flat.fields[i]) ? DtoType(flat.fields[i]) : LLIntegerType::get(gIR->context(), size(flat.fields[i]) * 8); } @@ -111,8 +111,8 @@ struct LoongArch64TargetABI : TargetABI { if (result.length <= 0) return false; if (result.length == 1) - return result.fields[0]->isFloating(); - return result.fields[0]->isFloating() || result.fields[1]->isFloating(); + return isFloating(result.fields[0]); + return isFloating(result.fields[0]) || isFloating(result.fields[1]); } public: @@ -143,8 +143,8 @@ struct LoongArch64TargetABI : TargetABI { } Type *ty = arg.type->toBasetype(); - if (ty->isIntegral() && (ty->ty == TY::Tint32 || ty->ty == TY::Tuns32 || - ty->ty == TY::Tdchar)) { + if (isIntegral(ty) && (ty->ty == TY::Tint32 || ty->ty == TY::Tuns32 || + ty->ty == TY::Tdchar)) { // In the LP64D ABI, both int32 and unsigned int32 are stored in // general-purpose registers as proper sign extensions of their // 32-bit values. So, the native ABI function's int32 arguments and diff --git a/gen/abi/ppc.cpp b/gen/abi/ppc.cpp index c8d8482ce02..b8f4dec1cbc 100644 --- a/gen/abi/ppc.cpp +++ b/gen/abi/ppc.cpp @@ -74,9 +74,9 @@ struct PPCTargetABI : TargetABI { compositeToArray32.applyTo(arg); } } - } else if (ty->isIntegral()) { - arg.attrs.addAttribute(ty->isUnsigned() ? LLAttribute::ZExt - : LLAttribute::SExt); + } else if (isIntegral(ty)) { + arg.attrs.addAttribute(isUnsigned(ty) ? LLAttribute::ZExt + : LLAttribute::SExt); } } }; diff --git a/gen/abi/ppc64le.cpp b/gen/abi/ppc64le.cpp index 940edafcd69..a29e8479f8b 100644 --- a/gen/abi/ppc64le.cpp +++ b/gen/abi/ppc64le.cpp @@ -55,9 +55,9 @@ struct PPC64LETargetABI : TargetABI { } else { compositeToArray64.applyTo(arg); } - } else if (ty->isIntegral() && !ty->isTypeVector()) { - arg.attrs.addAttribute(ty->isUnsigned() ? LLAttribute::ZExt - : LLAttribute::SExt); + } else if (isIntegral(ty) && !ty->isTypeVector()) { + arg.attrs.addAttribute(isUnsigned(ty) ? LLAttribute::ZExt + : LLAttribute::SExt); } } }; diff --git a/gen/abi/riscv64.cpp b/gen/abi/riscv64.cpp index d49ebaa2e12..2c548b4ae1f 100644 --- a/gen/abi/riscv64.cpp +++ b/gen/abi/riscv64.cpp @@ -93,8 +93,8 @@ bool requireHardfloatRewrite(Type *ty) { if (result.length <= 0) return false; if (result.length == 1) - return result.fields[0].ty->isFloating(); - return result.fields[0].ty->isFloating() || result.fields[1].ty->isFloating(); + return isFloating(result.fields[0].ty); + return isFloating(result.fields[0].ty) || isFloating(result.fields[1].ty); } struct HardfloatRewrite : ABIRewrite { @@ -139,7 +139,7 @@ struct HardfloatRewrite : ABIRewrite { assert(flat.length == 2); LLType *t[2]; for (unsigned i = 0; i < 2; ++i) { - t[i] = flat.fields[i].ty->isFloating() + t[i] = isFloating(flat.fields[i].ty) ? DtoType(flat.fields[i].ty) : LLIntegerType::get(gIR->context(), size(flat.fields[i].ty) * 8); diff --git a/gen/abi/wasm.cpp b/gen/abi/wasm.cpp index 496753daef8..2f4f034045d 100644 --- a/gen/abi/wasm.cpp +++ b/gen/abi/wasm.cpp @@ -26,12 +26,12 @@ Type *getSingleWrappedScalarType(Type *t) { } if (auto tsa = t->isTypeSArray()) { - if (tsa->dim->toInteger() != 1) + if (toInteger(tsa->dim) != 1) return nullptr; return getSingleWrappedScalarType(tsa->nextOf()); } - return t->isScalar() + return isScalar(t) // some more pointers: || t->ty == TY::Tclass || t->ty == TY::Taarray ? t diff --git a/gen/abi/x86-64.cpp b/gen/abi/x86-64.cpp index a6ebefd2f97..4e3ca085ea1 100644 --- a/gen/abi/x86-64.cpp +++ b/gen/abi/x86-64.cpp @@ -387,7 +387,7 @@ const char *X86_64TargetABI::objcMsgSendFunc(Type *ret, IrFuncTy &fty, bool dire return directcall ? "objc_msgSendSuper_stret" : "objc_msgSend_stret"; } // float, double, long double return - if (ret && ret->isFloating()) { + if (ret && isFloating(ret)) { return ret->ty == TY::Tcomplex80 ? "objc_msgSend_fp2ret" : "objc_msgSend_fpret"; } return directcall ? "objc_msgSendSuper" : "objc_msgSend"; diff --git a/gen/abi/x86.cpp b/gen/abi/x86.cpp index 048aaeaf1a0..daa21f1db2e 100644 --- a/gen/abi/x86.cpp +++ b/gen/abi/x86.cpp @@ -113,7 +113,7 @@ struct X86TargetABI : TargetABI { return false; // complex numbers - if (rt->isComplex()) { + if (isComplex(rt)) { // extern(D): let LLVM return them directly as LL aggregates if (externD) return false; @@ -210,7 +210,7 @@ struct X86TargetABI : TargetABI { } else { Type *firstTy = first.type->toBasetype(); auto sz = size(firstTy); - if (!firstTy->isFloating() && (sz == 1 || sz == 2 || sz == 4)) { + if (!isFloating(firstTy) && (sz == 1 || sz == 2 || sz == 4)) { // rewrite aggregates as integers to make inreg work if (firstTy->ty == TY::Tstruct || firstTy->ty == TY::Tsarray) { integerRewrite.applyTo(first); diff --git a/gen/arrays.cpp b/gen/arrays.cpp index a27c4338e67..5c825664de5 100644 --- a/gen/arrays.cpp +++ b/gen/arrays.cpp @@ -42,7 +42,7 @@ LLArrayType *DtoStaticArrayType(Type *t) { TypeSArray *tsa = static_cast(t); Type *tnext = tsa->nextOf(); - return LLArrayType::get(DtoMemType(tnext), tsa->dim->toUInteger()); + return LLArrayType::get(DtoMemType(tnext), toUInteger(tsa->dim)); } //////////////////////////////////////////////////////////////////////////////// @@ -200,7 +200,7 @@ void DtoArrayAssign(Loc loc, DValue *lhs, DValue *rhs, EXP op, Type *const elemType = t->nextOf()->toBasetype(); const bool needsDestruction = - (!isConstructing && elemType->needsDestruction()); + (!isConstructing && dmd::needsDestruction(elemType)); LLValue *lhsPtr = DtoArrayPtr(lhs); LLValue *lhsLength = DtoArrayLen(lhs); @@ -322,7 +322,7 @@ LLConstant *DtoConstArrayInitializer(ArrayInitializer *arrinit, // initialized elements in the value/index lists if (arrty->ty == TY::Tsarray) { TypeSArray *tsa = static_cast(arrty); - arrlen = static_cast(tsa->dim->toInteger()); + arrlen = static_cast(toInteger(tsa->dim)); } // make sure the number of initializers is sane @@ -356,7 +356,7 @@ LLConstant *DtoConstArrayInitializer(ArrayInitializer *arrinit, // idx can be null, then it's just the next element if (idx) { - j = idx->toInteger(); + j = toInteger(idx); } assert(j < arrlen); @@ -801,7 +801,7 @@ LLValue *DtoArrayLen(DValue *v) { assert(!v->isSlice()); assert(!v->isNull()); TypeSArray *sarray = static_cast(t); - return DtoConstSize_t(sarray->dim->toUInteger()); + return DtoConstSize_t(toUInteger(sarray->dim)); } llvm_unreachable("unsupported array for len"); } @@ -862,7 +862,7 @@ DValue *DtoCastArray(Loc loc, DValue *u, Type *to) { LLValue *ptr = nullptr; if (fromtype->ty == TY::Tsarray) { length = DtoConstSize_t( - static_cast(fromtype)->dim->toUInteger()); + toUInteger(static_cast(fromtype)->dim)); ptr = DtoLVal(u); } else { length = DtoArrayLen(u); @@ -901,7 +901,7 @@ DValue *DtoCastArray(Loc loc, DValue *u, Type *to) { if (fromtype->ty == TY::Tsarray) { ptr = DtoLVal(u); } else { - size_t tosize = static_cast(totype)->dim->toInteger(); + size_t tosize = toInteger(static_cast(totype)->dim); size_t i = (tosize * size(totype->nextOf()) - 1) / size(fromtype->nextOf()); DConstValue index(Type::tsize_t, DtoConstSize_t(i)); diff --git a/gen/asm-gcc.cpp b/gen/asm-gcc.cpp index 60026c6f988..eeb4bdb31ce 100644 --- a/gen/asm-gcc.cpp +++ b/gen/asm-gcc.cpp @@ -213,7 +213,7 @@ void GccAsmStatement_toIR(GccAsmStatement *stmt, IRState *irs) { const bool isIndirect = constraintsBuilder.isIndirectOperand(i); if (isOutput) { - assert(e->isLvalue() && "should have been caught by front-end"); + assert(dmd::isLvalue(e) && "should have been caught by front-end"); LLValue *lval = DtoLVal(e); if (isIndirect) { operands.push_back(lval); @@ -223,7 +223,7 @@ void GccAsmStatement_toIR(GccAsmStatement *stmt, IRState *irs) { outputTypes.push_back(DtoType(e->type)); } } else { - if (isIndirect && !e->isLvalue()) { + if (isIndirect && !dmd::isLvalue(e)) { error(e->loc, "indirect `\"m\"` input operands require an lvalue, but `%s` " "is an rvalue", diff --git a/gen/asm-x86.h b/gen/asm-x86.h index eecd1a8b654..8b4428160c3 100644 --- a/gen/asm-x86.h +++ b/gen/asm-x86.h @@ -2343,13 +2343,13 @@ struct AsmProcessor { if (sc->func->isNaked()) { switch (type) { case Arg_Integer: - if (e->type->isUnsigned()) { - insnTemplate << "$" << e->toUInteger(); + if (dmd::isUnsigned(e->type)) { + insnTemplate << "$" << dmd::toUInteger(e); } else { #ifndef ASM_X86_64 - insnTemplate << "$" << static_cast(e->toInteger()); + insnTemplate << "$" << static_cast(dmd::toInteger(e)); #else - insnTemplate << "$" << e->toInteger(); + insnTemplate << "$" << dmd::toInteger(e); #endif } break; @@ -3174,6 +3174,11 @@ struct AsmProcessor { } #endif + Reg regFromRegExp(Expression *exp) { + assert(isRegExp(exp)); + return static_cast(static_cast(exp)->value); + } + void slotExp(Expression *exp) { /* if offset, make a note @@ -3199,7 +3204,7 @@ struct AsmProcessor { if (is_offset) { invalidExpression(); } - operand->constDisplacement += exp->toInteger(); + operand->constDisplacement += dmd::toInteger(exp); if (!operand->inBracket) { operand->hasNumber = 1; } @@ -3209,15 +3214,15 @@ struct AsmProcessor { } if (!operand->inBracket) { if (operand->reg == Reg_Invalid) { - operand->reg = static_cast(exp->toInteger()); + operand->reg = regFromRegExp(exp); } else { error(stmt->loc, "too many registers in operand (use brackets)"); } } else { if (operand->baseReg == Reg_Invalid) { - operand->baseReg = static_cast(exp->toInteger()); + operand->baseReg = regFromRegExp(exp); } else if (operand->indexReg == Reg_Invalid) { - operand->indexReg = static_cast(exp->toInteger()); + operand->indexReg = regFromRegExp(exp); operand->scale = 1; } else { error(stmt->loc, "too many registers memory operand"); @@ -3232,7 +3237,7 @@ struct AsmProcessor { operand->hasNumber = 1; } } else { - if (v && v->type->isScalar()) { + if (v && dmd::isScalar(v->type)) { // DMD doesn't check Tcomplex*, and counts Tcomplex32 as // Tfloat64 TY ty = v->type->toBasetype()->ty; @@ -3289,7 +3294,7 @@ struct AsmProcessor { Expression *exp = parseAsmExp(); slotExp(exp); if (isRegExp(exp)) { - operand->dataSize = static_cast(regInfo[exp->toInteger()].size); + operand->dataSize = static_cast(regInfo[regFromRegExp(exp)].size); } } @@ -3305,7 +3310,7 @@ struct AsmProcessor { } nextToken(); Expression *exp3 = parseCondExp(); - exp = exp->toUInteger() ? exp2 : exp3; + exp = dmd::toUInteger(exp) ? exp2 : exp3; } return exp; } @@ -3496,8 +3501,8 @@ struct AsmProcessor { return true; } - operand->indexReg = static_cast(e1->toInteger()); - operand->scale = e2->toInteger(); + operand->indexReg = regFromRegExp(e1); + operand->scale = dmd::toInteger(e2); switch (operand->scale) { case 1: case 2: @@ -3795,7 +3800,7 @@ struct AsmProcessor { // DMD uses labels secondarily to other symbols, so check // if IdentifierExp::semantic won't find anything. Dsymbol *scopesym; - if (!sc->search(stmt->loc, ident, scopesym)) { + if (!dmd::search(sc, stmt->loc, ident, scopesym)) { if (LabelDsymbol *labelsym = sc->func->searchLabel(ident, stmt->loc)) { e = createDsymbolExp(stmt->loc, labelsym); if (opTakesLabel()) { @@ -3812,7 +3817,7 @@ struct AsmProcessor { // Special case for floating point constant declarations. if (e->op == EXP::float64) { Dsymbol *scopesym; - Dsymbol *sym = sc->search(stmt->loc, ident, scopesym); + Dsymbol *sym = dmd::search(sc, stmt->loc, ident, scopesym); if (sym) { VarDeclaration *v = sym->isVarDeclaration(); if (v) { @@ -3849,7 +3854,7 @@ struct AsmProcessor { // parse primary: DMD allows 'MyAlign' (const int) but not '2+2' // GAS is padding with NOPs last time I checked. Expression *e = ctfeInterpret(parseAsmExp()); - uinteger_t align = e->toUInteger(); + uinteger_t align = dmd::toUInteger(e); if ((align & (align - 1)) == 0) { // FIXME: This printf is not portable. The use of `align` varies from diff --git a/gen/binops.cpp b/gen/binops.cpp index f0012f1a390..2e363f7281d 100644 --- a/gen/binops.cpp +++ b/gen/binops.cpp @@ -64,7 +64,7 @@ Expression *extractNoStrideInc(Expression *e, dinteger_t baseSize, bool &negate) if (!mul->e2->isConst()) { return nullptr; } - dinteger_t stride = mul->e2->toInteger(); + dinteger_t stride = toInteger(mul->e2); if (stride != baseSize) { return nullptr; @@ -89,7 +89,7 @@ DValue *emitPointerOffset(Loc loc, DValue *base, Expression *offset, if (offset->isConst()) { llBase = DtoRVal(base); - const dinteger_t byteOffset = offset->toInteger(); + const dinteger_t byteOffset = toInteger(offset); if (byteOffset == 0) { llResult = llBase; } else { @@ -153,7 +153,7 @@ DValue *binAdd(Loc loc, Type *type, DValue *lhs, Expression *rhs, Type *rhsType = rhs->type->toBasetype(); if (lhsType != rhsType && lhsType->ty == TY::Tpointer && - rhsType->isIntegral()) { + isIntegral(rhsType)) { Logger::println("Adding integer to pointer"); return emitPointerOffset(loc, lhs, rhs, false, type, loadLhsAfterRhs); } @@ -162,7 +162,7 @@ DValue *binAdd(Loc loc, Type *type, DValue *lhs, Expression *rhs, if (type->ty == TY::Tnull) return DtoNullValue(type, loc); - if (type->isComplex()) + if (isComplex(type)) return DtoComplexAdd(loc, type, rvals.lhs, rvals.rhs); LLValue *l = DtoRVal(DtoCast(loc, rvals.lhs, type)); @@ -171,8 +171,8 @@ DValue *binAdd(Loc loc, Type *type, DValue *lhs, Expression *rhs, if (auto aa = isAssociativeArrayAndNull(type, l, r)) return aa; - LLValue *res = (type->isFloating() ? gIR->ir->CreateFAdd(l, r) - : gIR->ir->CreateAdd(l, r)); + LLValue *res = + isFloating(type) ? gIR->ir->CreateFAdd(l, r) : gIR->ir->CreateAdd(l, r); return new DImValue(type, res); } @@ -185,7 +185,7 @@ DValue *binMin(Loc loc, Type *type, DValue *lhs, Expression *rhs, Type *rhsType = rhs->type->toBasetype(); if (lhsType != rhsType && lhsType->ty == TY::Tpointer && - rhsType->isIntegral()) { + isIntegral(rhsType)) { Logger::println("Subtracting integer from pointer"); return emitPointerOffset(loc, lhs, rhs, true, type, loadLhsAfterRhs); } @@ -207,7 +207,7 @@ DValue *binMin(Loc loc, Type *type, DValue *lhs, Expression *rhs, if (type->ty == TY::Tnull) return DtoNullValue(type, loc); - if (type->isComplex()) + if (isComplex(type)) return DtoComplexMin(loc, type, rvals.lhs, rvals.rhs); LLValue *l = DtoRVal(DtoCast(loc, rvals.lhs, type)); @@ -216,8 +216,8 @@ DValue *binMin(Loc loc, Type *type, DValue *lhs, Expression *rhs, if (auto aa = isAssociativeArrayAndNull(type, l, r)) return aa; - LLValue *res = (type->isFloating() ? gIR->ir->CreateFSub(l, r) - : gIR->ir->CreateSub(l, r)); + LLValue *res = + isFloating(type) ? gIR->ir->CreateFSub(l, r) : gIR->ir->CreateSub(l, r); return new DImValue(type, res); } @@ -228,13 +228,13 @@ DValue *binMul(Loc loc, Type *type, DValue *lhs, Expression *rhs, bool loadLhsAfterRhs) { auto rvals = evalSides(lhs, rhs, loadLhsAfterRhs); - if (type->isComplex()) + if (isComplex(type)) return DtoComplexMul(loc, type, rvals.lhs, rvals.rhs); LLValue *l = DtoRVal(DtoCast(loc, rvals.lhs, type)); LLValue *r = DtoRVal(DtoCast(loc, rvals.rhs, type)); - LLValue *res = (type->isFloating() ? gIR->ir->CreateFMul(l, r) - : gIR->ir->CreateMul(l, r)); + LLValue *res = + isFloating(type) ? gIR->ir->CreateFMul(l, r) : gIR->ir->CreateMul(l, r); return new DImValue(type, res); } @@ -245,13 +245,13 @@ DValue *binDiv(Loc loc, Type *type, DValue *lhs, Expression *rhs, bool loadLhsAfterRhs) { auto rvals = evalSides(lhs, rhs, loadLhsAfterRhs); - if (type->isComplex()) + if (isComplex(type)) return DtoComplexDiv(loc, type, rvals.lhs, rvals.rhs); LLValue *l = DtoRVal(DtoCast(loc, rvals.lhs, type)); LLValue *r = DtoRVal(DtoCast(loc, rvals.rhs, type)); LLValue *res; - if (type->isFloating()) { + if (isFloating(type)) { res = gIR->ir->CreateFDiv(l, r); } else if (!isLLVMUnsigned(type)) { res = gIR->ir->CreateSDiv(l, r); @@ -268,13 +268,13 @@ DValue *binMod(Loc loc, Type *type, DValue *lhs, Expression *rhs, bool loadLhsAfterRhs) { auto rvals = evalSides(lhs, rhs, loadLhsAfterRhs); - if (type->isComplex()) + if (isComplex(type)) return DtoComplexMod(loc, type, rvals.lhs, rvals.rhs); LLValue *l = DtoRVal(DtoCast(loc, rvals.lhs, type)); LLValue *r = DtoRVal(DtoCast(loc, rvals.rhs, type)); LLValue *res; - if (type->isFloating()) { + if (isFloating(type)) { res = gIR->ir->CreateFRem(l, r); } else if (!isLLVMUnsigned(type)) { res = gIR->ir->CreateSRem(l, r); @@ -344,14 +344,14 @@ LLValue *DtoBinNumericEquals(Loc loc, DValue *lhs, DValue *rhs, EXP op) { assert(op == EXP::equal || op == EXP::notEqual || op == EXP::identity || op == EXP::notIdentity); Type *t = lhs->type->toBasetype(); - assert(t->isFloating()); + assert(isFloating(t)); Logger::println("numeric equality"); LLValue *res = nullptr; - if (t->isComplex()) { + if (isComplex(t)) { Logger::println("complex"); res = DtoComplexEquals(loc, op, lhs, rhs); - } else if (t->isFloating()) { + } else { Logger::println("floating"); res = DtoBinFloatsEquals(loc, lhs, rhs, op); } diff --git a/gen/classes.cpp b/gen/classes.cpp index 9938e3f40b6..b9cc9407d4b 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -252,7 +252,7 @@ DValue *DtoCastClass(Loc loc, DValue *val, Type *_to) { return new DImValue(_to, gIR->ir->CreateICmpNE(llval, zero)); } // class -> integer - if (to->isIntegral()) { + if (dmd::isIntegral(to)) { IF_LOG Logger::println("to %s", to->toChars()); // get class ptr diff --git a/gen/complex.cpp b/gen/complex.cpp index 867da9e5979..3e09004946e 100644 --- a/gen/complex.cpp +++ b/gen/complex.cpp @@ -139,9 +139,9 @@ void DtoGetComplexParts(Loc loc, Type *to, DValue *val, DValue *&re, Type *t = val->type->toBasetype(); - if (t->isComplex()) { + if (isComplex(t)) { DValue *v = DtoCastComplex(loc, val, to); - if (to->isComplex()) { + if (isComplex(to)) { if (v->isLVal()) { LLValue *reVal = DtoGEP(DtoType(v->type), DtoLVal(v), 0u, 0, ".re_part"); LLValue *imVal = DtoGEP(DtoType(v->type), DtoLVal(v), 0, 1, ".im_part"); @@ -158,13 +158,13 @@ void DtoGetComplexParts(Loc loc, Type *to, DValue *val, DValue *&re, } else { DtoGetComplexParts(loc, to, v, re, im); } - } else if (t->isImaginary()) { + } else if (isImaginary(t)) { re = nullptr; im = DtoCastFloat(loc, val, baseimty); - } else if (t->isFloating()) { + } else if (isFloating(t)) { re = DtoCastFloat(loc, val, baserety); im = nullptr; - } else if (t->isIntegral()) { + } else if (isIntegral(t)) { re = DtoCastInt(loc, val, baserety); im = nullptr; } else { @@ -431,7 +431,7 @@ LLValue *DtoComplexEquals(Loc loc, EXP op, DValue *lhs, DValue *rhs) { DValue *DtoCastComplex(Loc loc, DValue *val, Type *_to) { Type *to = _to->toBasetype(); Type *vty = val->type->toBasetype(); - if (to->isComplex()) { + if (isComplex(to)) { if (size(vty) == size(to)) { return val; } @@ -451,7 +451,7 @@ DValue *DtoCastComplex(Loc loc, DValue *val, Type *_to) { LLValue *pair = DtoAggrPair(DtoType(_to), re, im); return new DImValue(_to, pair); } - if (to->isImaginary()) { + if (isImaginary(to)) { // FIXME: this loads both values, even when we only need one LLValue *v = DtoRVal(val); LLValue *impart = gIR->ir->CreateExtractValue(v, 1, ".im_part"); @@ -476,7 +476,7 @@ DValue *DtoCastComplex(Loc loc, DValue *val, Type *_to) { return new DImValue( _to, DtoComplexEquals(loc, EXP::notEqual, val, DtoNullValue(vty))); } - if (to->isFloating() || to->isIntegral()) { + if (isFloating(to) || isIntegral(to)) { // FIXME: this loads both values, even when we only need one LLValue *v = DtoRVal(val); LLValue *repart = gIR->ir->CreateExtractValue(v, 0, ".re_part"); diff --git a/gen/dcompute/druntime.cpp b/gen/dcompute/druntime.cpp index 829185481c9..402bb5aa6bc 100644 --- a/gen/dcompute/druntime.cpp +++ b/gen/dcompute/druntime.cpp @@ -49,7 +49,7 @@ std::optional toDcomputePointer(StructDeclaration *sd) { } TemplateInstance *ti = sd->isInstantiated(); - int addrspace = isExpression((*ti->tiargs)[0])->toInteger(); + int addrspace = toInteger(isExpression((*ti->tiargs)[0])); Type *type = isType((*ti->tiargs)[1]); return std::optional(DcomputePointer(addrspace, type)); } diff --git a/gen/dibuilder.cpp b/gen/dibuilder.cpp index df1328ecdbe..7539a74f3ef 100644 --- a/gen/dibuilder.cpp +++ b/gen/dibuilder.cpp @@ -391,7 +391,7 @@ DIType DIBuilder::CreateEnumType(TypeEnum *type) { // just emit a typedef for non-integral base types auto tb = type->toBasetype(); - if (!tb->isIntegral()) { + if (!isIntegral(tb)) { auto tbase = CreateTypeDescription(tb); return DBuilder.createTypedef(tbase, name, file, lineNumber, scope); } @@ -402,7 +402,7 @@ DIType DIBuilder::CreateEnumType(TypeEnum *type) { EnumMember *em = m->isEnumMember(); if (auto ie = em->value()->isIntegerExp()) { subscripts.push_back( - DBuilder.createEnumerator(em->toChars(), ie->toInteger())); + DBuilder.createEnumerator(em->toChars(), toInteger(ie))); } } } @@ -431,7 +431,7 @@ DIType DIBuilder::CreatePointerType(TypePointer *type) { DIType DIBuilder::CreateVectorType(TypeVector *type) { LLType *T = DtoType(type); - const auto dim = type->basetype->isTypeSArray()->dim->toInteger(); + const auto dim = toInteger(type->basetype->isTypeSArray()->dim); const auto Dim = llvm::ConstantAsMetadata::get(DtoConstSize_t(dim)); auto subscript = DBuilder.getOrCreateSubrange(Dim, nullptr, nullptr, nullptr); @@ -711,7 +711,7 @@ DIType DIBuilder::CreateSArrayType(TypeSArray *type) { llvm::SmallVector subscripts; for (; te->ty == TY::Tsarray; te = te->nextOf()) { TypeSArray *tsa = static_cast(te); - const auto count = tsa->dim->toInteger(); + const auto count = toInteger(tsa->dim); const auto Count = llvm::ConstantAsMetadata::get(DtoConstSize_t(count)); const auto subscript = DBuilder.getOrCreateSubrange(Count, nullptr, nullptr, nullptr); @@ -861,7 +861,7 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) { return CreateEnumType(te); if (auto tv = t->isTypeVector()) return CreateVectorType(tv); - if (t->isIntegral() || t->isFloating()) + if (isIntegral(t) || isFloating(t)) return CreateBasicType(t); if (auto tp = t->isTypePointer()) return CreatePointerType(tp); diff --git a/gen/dvalue.cpp b/gen/dvalue.cpp index a3eb510a086..2d0e2ad2ea6 100644 --- a/gen/dvalue.cpp +++ b/gen/dvalue.cpp @@ -182,7 +182,7 @@ DRValue *DBitFieldLValue::getRVal() { LLValue *v = gIR->ir->CreateAlignedLoad(intType, ptr, llvm::MaybeAlign(1)); // TODO: byte-swap v for big-endian targets? - if (bf->type->isUnsigned()) { + if (dmd::isUnsigned(bf->type)) { if (auto n = bf->bitOffset) v = gIR->ir->CreateLShr(v, n); const auto mask = llvm::APInt::getLowBitsSet(sizeInBits, bf->fieldWidth); diff --git a/gen/inlineir.cpp b/gen/inlineir.cpp index 11db6e52d65..7740bb87262 100644 --- a/gen/inlineir.cpp +++ b/gen/inlineir.cpp @@ -133,20 +133,20 @@ DValue *DtoInlineIRExpr(Loc loc, FuncDeclaration *fdecl, if (isExtended) { Expression *a0 = isExpression(objs[0]); assert(a0); - StringExp *prefexp = a0->toStringExp(); + StringExp *prefexp = toStringExp(a0); Expression *a1 = isExpression(objs[1]); assert(a1); - StringExp *strexp = a1->toStringExp(); + StringExp *strexp = toStringExp(a1); Expression *a2 = isExpression(objs[2]); assert(a2); - StringExp *suffexp = a2->toStringExp(); + StringExp *suffexp = toStringExp(a2); prefix = exprToString(prefexp); code = exprToString(strexp); suffix = exprToString(suffexp); } else { Expression *a0 = isExpression(objs[0]); assert(a0); - StringExp *strexp = a0->toStringExp(); + StringExp *strexp = toStringExp(a0); code = exprToString(strexp); } diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 83d72dcc552..191d3b04797 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -123,7 +123,7 @@ void DtoDeleteArray(Loc loc, DValue *arr) { // the TypeInfo argument must be null if the type has no dtor Type *elementType = arr->type->nextOf(); bool hasDtor = (elementType->toBasetype()->ty == TY::Tstruct && - elementType->needsDestruction()); + needsDestruction(elementType)); LLValue *typeInfo = !hasDtor ? getNullPtr() : DtoTypeInfoOf(loc, elementType); @@ -136,13 +136,13 @@ void DtoDeleteArray(Loc loc, DValue *arr) { ******************************************************************************/ unsigned DtoAlignment(Type *type) { - const auto alignment = type->alignment(); + const auto alignment = dmd::alignment(type); if (!alignment.isDefault() && !alignment.isPack()) return alignment.get(); auto ts = type->toBasetype()->isTypeStruct(); return ts && !ts->sym->members ? 0 // opaque struct - : type->alignsize(); + : dmd::alignsize(type); } unsigned DtoAlignment(VarDeclaration *vd) { @@ -418,7 +418,7 @@ void DtoAssign(Loc loc, DValue *lhs, DValue *rhs, EXP op, Logger::cout() << "r : " << *r << '\n'; } DtoStore(r, l); - } else if (t->isComplex()) { + } else if (isComplex(t)) { LLValue *dst = DtoLVal(lhs); LLValue *src = DtoRVal(DtoCast(loc, rhs, lhs->type)); DtoStore(src, dst); @@ -461,7 +461,7 @@ DValue *DtoNullValue(Type *type, Loc loc) { LLType *lltype = DtoType(basetype); // complex, needs to be first since complex are also floating - if (basetype->isComplex()) { + if (isComplex(basetype)) { LLType *basefp = DtoComplexBaseType(basetype); LLValue *res = DtoAggrPair(DtoType(type), LLConstant::getNullValue(basefp), LLConstant::getNullValue(basefp)); @@ -469,7 +469,7 @@ DValue *DtoNullValue(Type *type, Loc loc) { } // integer, floating, pointer, assoc array, delegate and class have no special // representation - if (basetype->isIntegral() || basetype->isFloating() || + if (isIntegral(basetype) || isFloating(basetype) || basety == TY::Tpointer || basety == TY::Tnull || basety == TY::Tclass || basety == TY::Tdelegate || basety == TY::Taarray) { return new DNullValue(type, LLConstant::getNullValue(lltype)); @@ -493,7 +493,7 @@ DValue *DtoCastInt(Loc loc, DValue *val, Type *_to) { Type *to = _to->toBasetype(); Type *from = val->type->toBasetype(); - assert(from->isIntegral()); + assert(isIntegral(from)); LLValue *rval = DtoRVal(val); if (rval->getType() == tolltype) { @@ -506,7 +506,7 @@ DValue *DtoCastInt(Loc loc, DValue *val, Type *_to) { if (to->ty == TY::Tbool) { LLValue *zero = LLConstantInt::get(rval->getType(), 0, false); rval = gIR->ir->CreateICmpNE(rval, zero); - } else if (to->isIntegral()) { + } else if (isIntegral(to)) { if (fromsz < tosz || from->ty == TY::Tbool) { IF_LOG Logger::cout() << "cast to: " << *tolltype << '\n'; if (isLLVMUnsigned(from) || from->ty == TY::Tbool) { @@ -519,10 +519,10 @@ DValue *DtoCastInt(Loc loc, DValue *val, Type *_to) { } else { rval = DtoBitCast(rval, tolltype); } - } else if (to->isComplex()) { + } else if (isComplex(to)) { return DtoComplex(loc, to, val); - } else if (to->isFloating()) { - if (from->isUnsigned()) { + } else if (isFloating(to)) { + if (isUnsigned(from)) { rval = new llvm::UIToFPInst(rval, tolltype, "", gIR->scopebb()); } else { rval = new llvm::SIToFPInst(rval, tolltype, "", gIR->scopebb()); @@ -561,7 +561,7 @@ DValue *DtoCastPtr(Loc loc, DValue *val, Type *to) { LLValue *src = DtoRVal(val); LLValue *zero = LLConstant::getNullValue(src->getType()); rval = gIR->ir->CreateICmpNE(src, zero); - } else if (totype->isIntegral()) { + } else if (isIntegral(totype)) { rval = new llvm::PtrToIntInst(DtoRVal(val), tolltype, "", gIR->scopebb()); } else { error(loc, "invalid cast from `%s` to `%s`", val->type->toChars(), @@ -581,7 +581,7 @@ DValue *DtoCastFloat(Loc loc, DValue *val, Type *to) { Type *totype = to->toBasetype(); Type *fromtype = val->type->toBasetype(); - assert(fromtype->isFloating()); + assert(isFloating(fromtype)); size_t fromsz = size(fromtype); size_t tosz = size(totype); @@ -592,9 +592,9 @@ DValue *DtoCastFloat(Loc loc, DValue *val, Type *to) { rval = DtoRVal(val); LLValue *zero = LLConstant::getNullValue(rval->getType()); rval = gIR->ir->CreateFCmpUNE(rval, zero); - } else if (totype->isComplex()) { + } else if (isComplex(totype)) { return DtoComplex(loc, to, val); - } else if (totype->isFloating()) { + } else if (isFloating(totype)) { if (fromsz == tosz) { rval = DtoRVal(val); assert(rval->getType() == tolltype); @@ -607,8 +607,8 @@ DValue *DtoCastFloat(Loc loc, DValue *val, Type *to) { to->toChars()); fatal(); } - } else if (totype->isIntegral()) { - if (totype->isUnsigned()) { + } else if (isIntegral(totype)) { + if (isUnsigned(totype)) { rval = new llvm::FPToUIInst(DtoRVal(val), tolltype, "", gIR->scopebb()); } else { rval = new llvm::FPToSIInst(DtoRVal(val), tolltype, "", gIR->scopebb()); @@ -724,13 +724,13 @@ DValue *DtoCast(Loc loc, DValue *val, Type *to) { // First, handle vector types (which can also be isIntegral()). return DtoCastVector(loc, val, to); } - if (fromtype->isIntegral()) { + if (isIntegral(fromtype)) { return DtoCastInt(loc, val, to); } - if (fromtype->isComplex()) { + if (isComplex(fromtype)) { return DtoCastComplex(loc, val, to); } - if (fromtype->isFloating()) { + if (isFloating(fromtype)) { return DtoCastFloat(loc, val, to); } @@ -1149,7 +1149,7 @@ LLConstant *DtoConstExpInit(Loc loc, Type *targetType, Expression *exp) { baseValType = stripModifiers(baseValType); LLSmallVector dims; // { 3, 2 } for (auto t = baseTargetType; t->ty == TY::Tsarray;) { - dims.push_back(static_cast(t)->dim->toUInteger()); + dims.push_back(toUInteger(static_cast(t)->dim)); auto elementType = stripModifiers(t->nextOf()->toBasetype()); if (elementType->equals(baseValType)) break; @@ -1175,7 +1175,7 @@ LLConstant *DtoConstExpInit(Loc loc, Type *targetType, Expression *exp) { TypeVector *tv = static_cast(baseTargetType); assert(tv->basetype->ty == TY::Tsarray); dinteger_t elemCount = - static_cast(tv->basetype)->dim->toInteger(); + toInteger(static_cast(tv->basetype)->dim); const auto elementCount = llvm::ElementCount::getFixed(elemCount); return llvm::ConstantVector::getSplat(elementCount, val); } @@ -1230,9 +1230,9 @@ static char *DtoOverloadedIntrinsicName(TemplateInstance *ti, Type *T = static_cast(ti->tdtypes[0]); char prefix; - if (T->isFloating() && !T->isComplex()) { + if (isFloating(T) && !isComplex(T)) { prefix = 'f'; - } else if (T->isIntegral()) { + } else if (isIntegral(T)) { prefix = 'i'; } else { error(ti->loc, "%s `%s` has invalid template parameter for intrinsic: `%s`", @@ -1355,7 +1355,7 @@ bool isSpecialRefVar(VarDeclaration *vd) { //////////////////////////////////////////////////////////////////////////////// bool isLLVMUnsigned(Type *t) { - return t->isUnsigned() || t->ty == TY::Tpointer; + return isUnsigned(t) || t->ty == TY::Tpointer; } //////////////////////////////////////////////////////////////////////////////// diff --git a/gen/naked.cpp b/gen/naked.cpp index 5e5b3ea653d..36e6dac0cc6 100644 --- a/gen/naked.cpp +++ b/gen/naked.cpp @@ -270,15 +270,15 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc loc, // x86 if (triple.getArch() == llvm::Triple::x86) { - if (rt->isIntegral() || rt->ty == TY::Tpointer || rt->ty == TY::Tclass || + if (isIntegral(rt) || rt->ty == TY::Tpointer || rt->ty == TY::Tclass || rt->ty == TY::Taarray) { if (size(rt) == 8) { as->out.c = "=A,"; } else { as->out.c = "={ax},"; } - } else if (rt->isFloating()) { - if (rt->isComplex()) { + } else if (isFloating(rt)) { + if (isComplex(rt)) { if (fdecl->_linkage() == LINK::d) { // extern(D) always returns on the FPU stack as->out.c = "={st},={st(1)},"; @@ -334,10 +334,10 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc loc, // x86_64 else if (triple.getArch() == llvm::Triple::x86_64) { - if (rt->isIntegral() || rt->ty == TY::Tpointer || rt->ty == TY::Tclass || + if (isIntegral(rt) || rt->ty == TY::Tpointer || rt->ty == TY::Tclass || rt->ty == TY::Taarray) { as->out.c = "={ax},"; - } else if (rt->isFloating()) { + } else if (isFloating(rt)) { const bool isWin64 = triple.isOSWindows(); if (rt == Type::tcomplex80 && !isWin64) { @@ -358,7 +358,7 @@ void emitABIReturnAsmStmt(IRAsmBlock *asmblock, Loc loc, as->out.c = "={xmm0},"; asmblock->retty = LLType::getDoubleTy(gIR->context()); } - } else if (rt->isComplex()) { + } else if (isComplex(rt)) { if (isWin64) { // Win64: cdouble and creal are returned via sret // don't add anything! diff --git a/gen/objcgen.cpp b/gen/objcgen.cpp index d1602daf933..243c1bc127d 100644 --- a/gen/objcgen.cpp +++ b/gen/objcgen.cpp @@ -69,7 +69,7 @@ std::string objcGetTypeEncoding(Type *t) { // Static arrays are encoded in the form of: // [] auto typ = t->isTypeSArray(); - uinteger_t count = typ->dim->toUInteger(); + uinteger_t count = dmd::toUInteger(typ->dim); tmp.append("["); tmp.append(std::to_string(count)); tmp.append(objcGetTypeEncoding(typ->next)); diff --git a/gen/pragma.cpp b/gen/pragma.cpp index 8134bb5d97a..0a296ceae13 100644 --- a/gen/pragma.cpp +++ b/gen/pragma.cpp @@ -51,7 +51,7 @@ bool parseBoolExp(Expression *e, bool &res) { e = optimize(e, WANTvalue); if (auto i = e->isIntegerExp()) { if (e->type->equals(Type::tbool)) { - res = (i->toInteger() != 0); + res = (toInteger(i) != 0); return true; } } diff --git a/gen/semantic-dcompute.cpp b/gen/semantic-dcompute.cpp index 1cf3fb48439..8a1f790039f 100644 --- a/gen/semantic-dcompute.cpp +++ b/gen/semantic-dcompute.cpp @@ -205,7 +205,7 @@ struct DComputeSemanticAnalyser : public StoppableVisitor { // @compute semantics and the recursive visitor should stop here. if (auto ce = stmt->condition->isCallExp()) { if (ce->f && ce->f->ident == Id::dcReflect) { - auto arg1 = (DComputeTarget::ID)(*ce->arguments)[0]->toInteger(); + auto arg1 = (DComputeTarget::ID)dmd::toInteger((*ce->arguments)[0]); if (arg1 == DComputeTarget::ID::Host) stop = true; } diff --git a/gen/statements.cpp b/gen/statements.cpp index 6ee89057ff4..2591cf21db3 100644 --- a/gen/statements.cpp +++ b/gen/statements.cpp @@ -360,8 +360,8 @@ class ToIRVisitor : public Visitor { ////////////////////////////////////////////////////////////////////////// bool dcomputeReflectMatches(CallExp *ce) { - auto arg1 = (DComputeTarget::ID)(*ce->arguments)[0]->toInteger(); - auto arg2 = (*ce->arguments)[1]->toInteger(); + auto arg1 = (DComputeTarget::ID)toInteger((*ce->arguments)[0]); + auto arg2 = toInteger((*ce->arguments)[1]); auto dct = irs->dcomputetarget; if (!dct) { return arg1 == DComputeTarget::ID::Host; @@ -1447,13 +1447,13 @@ class ToIRVisitor : public Visitor { irs->DBuilder.EmitBlockStart(stmt->loc); // evaluate lwr/upr - assert(stmt->lwr->type->isIntegral()); + assert(isIntegral(stmt->lwr->type)); LLValue *lower = DtoRVal(toElemDtor(stmt->lwr)); - assert(stmt->upr->type->isIntegral()); + assert(isIntegral(stmt->upr->type)); LLValue *upper = DtoRVal(toElemDtor(stmt->upr)); // handle key - assert(stmt->key->type->isIntegral()); + assert(isIntegral(stmt->key->type)); LLValue *keyval = DtoRawVarDeclaration(stmt->key); LLType *keytype = DtoType(stmt->key->type); // store initial value in key diff --git a/gen/tocall.cpp b/gen/tocall.cpp index c1b0bc1b3c1..c04d235688e 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -148,7 +148,7 @@ static void addExplicitArguments(std::vector &args, AttrSet &attrs, DValue *const dval = DtoArgument(formalParam, argexp); // load from lvalue/let TargetABI rewrite it/... - bool isLValueExp = argexp->isLvalue(); + bool isLValueExp = isLvalue(argexp); // regard temporaries as rvalues here if (isLValueExp) { auto ae = argexp; @@ -350,10 +350,10 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, fatal(); } auto atomicOrdering = - static_cast((*e->arguments)[0]->toInteger()); + static_cast(toInteger((*e->arguments)[0])); llvm::SyncScope::ID scope = llvm::SyncScope::System; if (e->arguments->length == 2) { - scope = static_cast((*e->arguments)[1]->toInteger()); + scope = static_cast(toInteger((*e->arguments)[1])); } // orderings below acquire are invalid; like clang, don't emit any // instruction in those cases @@ -372,7 +372,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, } Expression *exp1 = (*e->arguments)[0]; Expression *exp2 = (*e->arguments)[1]; - int atomicOrdering = (*e->arguments)[2]->toInteger(); + int atomicOrdering = toInteger((*e->arguments)[2]); DValue *dval = toElem(exp1); LLValue *ptr = DtoRVal(exp2); @@ -407,7 +407,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, } Expression *exp = (*e->arguments)[0]; - int atomicOrdering = (*e->arguments)[1]->toInteger(); + int atomicOrdering = toInteger((*e->arguments)[1]); LLValue *ptr = DtoRVal(exp); LLType *pointeeType = DtoType(e->type); @@ -455,10 +455,10 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, Expression *exp2 = (*e->arguments)[1]; Expression *exp3 = (*e->arguments)[2]; const auto successOrdering = - llvm::AtomicOrdering((*e->arguments)[3]->toInteger()); + llvm::AtomicOrdering(toInteger((*e->arguments)[3])); const auto failureOrdering = - llvm::AtomicOrdering((*e->arguments)[4]->toInteger()); - const bool isWeak = (*e->arguments)[5]->toInteger() != 0; + llvm::AtomicOrdering(toInteger((*e->arguments)[4])); + const bool isWeak = toInteger((*e->arguments)[5]) != 0; LLValue *ptr = DtoRVal(exp1); LLType *pointeeType = DtoType(exp1->type->isTypePointer()->nextOf()); @@ -528,7 +528,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e, Expression *exp1 = (*e->arguments)[0]; Expression *exp2 = (*e->arguments)[1]; - int atomicOrdering = (*e->arguments)[2]->toInteger(); + int atomicOrdering = toInteger((*e->arguments)[2]); LLValue *ptr = DtoRVal(exp1); LLValue *val = DtoRVal(exp2); LLValue *ret = diff --git a/gen/toconstelem.cpp b/gen/toconstelem.cpp index 9ded6dddc0c..7cd811c00e9 100644 --- a/gen/toconstelem.cpp +++ b/gen/toconstelem.cpp @@ -118,7 +118,7 @@ class ToConstElemVisitor : public Visitor { } else { assert(llvm::isa(t)); result = LLConstantInt::get(t, static_cast(e->getInteger()), - !e->type->isUnsigned()); + !isUnsigned(e->type)); assert(result); IF_LOG Logger::cout() << "value = " << *result << '\n'; } @@ -168,7 +168,7 @@ class ToConstElemVisitor : public Visitor { Type *const t = e->type->toBasetype(); if (auto ts = t->isTypeSArray()) { - const auto arrayLength = ts->dim->toInteger(); + const auto arrayLength = toInteger(ts->dim); assert(arrayLength >= e->len); result = buildStringLiteralConstant(e, arrayLength); return; @@ -190,13 +190,13 @@ class ToConstElemVisitor : public Visitor { // very similar to emitPointerOffset() in binops.cpp LLConstant *tryEmitPointerOffset(BinExp *e, bool negateOffset) { Type *t1b = e->e1->type->toBasetype(); - if (t1b->ty != TY::Tpointer || !e->e2->type->isIntegral()) + if (t1b->ty != TY::Tpointer || !isIntegral(e->e2->type)) return nullptr; Type *const pointeeType = t1b->nextOf(); LLConstant *llBase = toConstElem(e->e1, p); - const dinteger_t byteOffset = e->e2->toInteger(); + const dinteger_t byteOffset = toInteger(e->e2); LLConstant *llResult = nullptr; const auto pointeeSize = size(pointeeType, e->loc); @@ -260,7 +260,7 @@ class ToConstElemVisitor : public Visitor { if (auto se = e->e1->isStringExp()) if (auto lwr = e->lwr->isIntegerExp()) if (auto upr = e->upr->isIntegerExp()) - if (lwr->toInteger() == 0 && upr->toInteger() == se->len) { + if (toInteger(lwr) == 0 && toInteger(upr) == se->len) { result = toConstElem(se, p); return; } @@ -625,7 +625,7 @@ class ToConstElemVisitor : public Visitor { assert(tv->ty == TY::Tvector); const auto elemCount = - static_cast(tv->basetype)->dim->toInteger(); + toInteger(static_cast(tv->basetype)->dim); // Array literals are assigned element-for-element; other expressions splat // across the whole vector. diff --git a/gen/toir.cpp b/gen/toir.cpp index e746c6bbcdc..5658791a326 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -182,7 +182,7 @@ static void write_struct_literal(Loc loc, LLValue *mem, StructDeclaration *sd, // try to construct it in-place if (!toInPlaceConstruction(field, expr)) { DtoAssign(loc, field, toElem(expr), EXP::blit); - if (expr->isLvalue()) + if (isLvalue(expr)) callPostblit(loc, expr, DtoLVal(field)); } } else { @@ -435,7 +435,7 @@ class ToElemVisitor : public Visitor { const auto stringLength = e->len; if (auto tsa = dtype->isTypeSArray()) { - const auto arrayLength = tsa->dim->toInteger(); + const auto arrayLength = toInteger(tsa->dim); assert(arrayLength >= stringLength); // ImportC: static array length may exceed string length incl. null // terminator - bypass string-literal cache and create a separate constant @@ -479,6 +479,13 @@ class ToElemVisitor : public Visitor { e->e2->type ? e->e2->type->toChars() : nullptr); LOG_SCOPE; + if (auto ce = e->isConstructExp()) { + if (ce->lowering) { + result = toElem(ce->lowering); + return; + } + } + // Initialization of ref variable? // Can't just override ConstructExp::toElem because not all EXP::construct // operations are actually instances of ConstructExp... Long live the DMD @@ -567,7 +574,7 @@ class ToElemVisitor : public Visitor { if (e->e1->type->toBasetype()->ty == TY::Tstruct && e->e2->op == EXP::int64) { Logger::println("performing aggregate zero initialization"); - assert(e->e2->toInteger() == 0); + assert(toInteger(e->e2) == 0); LLValue *lval = DtoLVal(lhs); DtoMemSetZero(DtoType(lhs->type), lval); TypeStruct *ts = static_cast(e->e1->type); @@ -581,10 +588,10 @@ class ToElemVisitor : public Visitor { // getting out of sync? bool lvalueElem = false; if ((e->e2->op == EXP::slice && - static_cast(e->e2)->e1->isLvalue()) || + isLvalue(static_cast(e->e2)->e1)) || (e->e2->op == EXP::cast_ && - static_cast(e->e2)->e1->isLvalue()) || - (e->e2->op != EXP::slice && e->e2->isLvalue())) { + isLvalue(static_cast(e->e2)->e1)) || + (e->e2->op != EXP::slice && isLvalue(e->e2))) { lvalueElem = true; } @@ -929,9 +936,9 @@ class ToElemVisitor : public Visitor { } // Casts are also "optimized into" SymOffExp by the frontend. - LLValue *llVal = (e->type->toBasetype()->isIntegral() - ? p->ir->CreatePtrToInt(offsetValue, DtoType(e->type)) - : DtoBitCast(offsetValue, DtoType(e->type))); + LLValue *llVal = isIntegral(e->type->toBasetype()) + ? p->ir->CreatePtrToInt(offsetValue, DtoType(e->type)) + : DtoBitCast(offsetValue, DtoType(e->type)); result = new DImValue(e->type, llVal); } @@ -1286,7 +1293,7 @@ class ToElemVisitor : public Visitor { // (namely default initialization, int[16][16] arr; -> int[256] arr = 0;) if (etype->ty == TY::Tsarray) { TypeSArray *tsa = static_cast(etype); - elen = DtoConstSize_t(tsa->dim->toUInteger()); + elen = DtoConstSize_t(toUInteger(tsa->dim)); } } @@ -1322,7 +1329,7 @@ class ToElemVisitor : public Visitor { LLValue *eval = nullptr; - if (t->isIntegral() || t->ty == TY::Tpointer || t->ty == TY::Tnull) { + if (isIntegral(t) || t->ty == TY::Tpointer || t->ty == TY::Tnull) { llvm::ICmpInst::Predicate icmpPred; tokToICmpPred(e->op, isLLVMUnsigned(t), &icmpPred, &eval); @@ -1338,7 +1345,7 @@ class ToElemVisitor : public Visitor { } eval = p->ir->CreateICmp(icmpPred, a, b); } - } else if (t->isFloating()) { + } else if (isFloating(t)) { llvm::FCmpInst::Predicate cmpop; switch (e->op) { case EXP::lessThan: @@ -1430,7 +1437,7 @@ class ToElemVisitor : public Visitor { // the Tclass catches interface comparisons, regular // class equality should be rewritten as a.opEquals(b) by this time - if (t->isIntegral() || t->ty == TY::Tpointer || t->ty == TY::Tclass || + if (isIntegral(t) || t->ty == TY::Tpointer || t->ty == TY::Tclass || t->ty == TY::Tnull) { Logger::println("integral or pointer or interface"); llvm::ICmpInst::Predicate cmpop; @@ -1454,7 +1461,7 @@ class ToElemVisitor : public Visitor { Logger::cout() << "rv: " << *rv << '\n'; } eval = p->ir->CreateICmp(cmpop, lv, rv); - } else if (t->isFloating()) { // includes iscomplex + } else if (isFloating(t)) { // includes iscomplex eval = DtoBinNumericEquals(e->loc, l, r, e->op); } else if (t->ty == TY::Tsarray || t->ty == TY::Tarray) { Logger::println("static or dynamic array"); @@ -1495,10 +1502,10 @@ class ToElemVisitor : public Visitor { Type *e1type = e->e1->type->toBasetype(); Type *e2type = e->e2->type->toBasetype(); - if (e1type->isIntegral()) { - assert(e2type->isIntegral()); + if (isIntegral(e1type)) { + assert(isIntegral(e2type)); LLValue *one = - LLConstantInt::get(val->getType(), 1, !e2type->isUnsigned()); + LLConstantInt::get(val->getType(), 1, !isUnsigned(e2type)); if (e->op == EXP::plusPlus) { post = llvm::BinaryOperator::CreateAdd(val, one, "", p->scopebb()); } else if (e->op == EXP::minusMinus) { @@ -1509,8 +1516,8 @@ class ToElemVisitor : public Visitor { LLConstant *offset = e->op == EXP::plusPlus ? DtoConstUint(1) : DtoConstInt(-1); post = DtoGEP1(DtoMemType(dv->type->nextOf()), val, offset, "", p->scopebb()); - } else if (e1type->isComplex()) { - assert(e2type->isComplex()); + } else if (isComplex(e1type)) { + assert(isComplex(e2type)); LLValue *one = LLConstantFP::get(DtoComplexBaseType(e1type), 1.0); LLValue *re, *im; DtoGetComplexParts(e->loc, e1type, dv, re, im); @@ -1520,8 +1527,8 @@ class ToElemVisitor : public Visitor { re = llvm::BinaryOperator::CreateFSub(re, one, "", p->scopebb()); } DtoComplexSet(DtoType(dv->type), lval, re, im); - } else if (e1type->isFloating()) { - assert(e2type->isFloating()); + } else if (isFloating(e1type)) { + assert(isFloating(e2type)); LLValue *one = DtoConstFP(e1type, ldouble(1.0)); if (e->op == EXP::plusPlus) { post = llvm::BinaryOperator::CreateFAdd(val, one, "", p->scopebb()); @@ -1534,7 +1541,7 @@ class ToElemVisitor : public Visitor { // The real part of the complex number has already been updated, skip the // store - if (!e1type->isComplex()) { + if (!isComplex(e1type)) { DtoStore(post, lval); } result = new DImValue(e->type, val); @@ -1686,7 +1693,7 @@ class ToElemVisitor : public Visitor { // pointer if (et->ty == TY::Tpointer) { Type *elementType = et->nextOf()->toBasetype(); - if (elementType->ty == TY::Tstruct && elementType->needsDestruction()) { + if (elementType->ty == TY::Tstruct && needsDestruction(elementType)) { DtoDeleteStruct(e->loc, dval); } else { DtoDeleteMemory(e->loc, dval); @@ -2054,7 +2061,7 @@ class ToElemVisitor : public Visitor { assert(lv->getType() == rv->getType()); } eval = DtoDelegateEquals(e->op, lv, rv); - } else if (t1->isFloating()) { // includes iscomplex + } else if (isFloating(t1)) { // includes iscomplex eval = DtoBinNumericEquals(e->loc, l, r, e->op); } else if (t1->ty == TY::Tpointer || t1->ty == TY::Tclass) { LLValue *lv = DtoRVal(l); @@ -2178,14 +2185,14 @@ class ToElemVisitor : public Visitor { DRValue *dval = toElem(e->e1)->getRVal(); - if (e->type->isComplex()) { + if (isComplex(e->type)) { result = DtoComplexNeg(e->loc, e->type, dval); return; } LLValue *val = DtoRVal(dval); - if (e->type->isIntegral()) { + if (isIntegral(e->type)) { val = p->ir->CreateNeg(val, "negval"); } else { val = p->ir->CreateFNeg(val, "negval"); @@ -2602,7 +2609,7 @@ class ToElemVisitor : public Visitor { if (auto ts = tsrc->isTypeSArray()) { Logger::println("static array expression"); (void)ts; - assert(ts->dim->toInteger() == N && + assert(toInteger(ts->dim) == N && "Static array vector initializer length mismatch, should have " "been handled in frontend."); } else { diff --git a/gen/tollvm.cpp b/gen/tollvm.cpp index d4d4066d349..4555f1bd6cf 100644 --- a/gen/tollvm.cpp +++ b/gen/tollvm.cpp @@ -49,9 +49,9 @@ bool DtoIsInMemoryOnly(Type *type) { void DtoAddExtendAttr(Type *type, llvm::AttrBuilder &attrs) { type = type->toBasetype(); - if (type->isIntegral() && type->ty != TY::Tvector && size(type) <= 2) { - attrs.addAttribute(type->isUnsigned() ? LLAttribute::ZExt - : LLAttribute::SExt); + if (isIntegral(type) && type->ty != TY::Tvector && size(type) <= 2) { + attrs.addAttribute(isUnsigned(type) ? LLAttribute::ZExt + : LLAttribute::SExt); } } diff --git a/gen/typinf.cpp b/gen/typinf.cpp index d622267ee8e..be4a3261ba3 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -206,7 +206,7 @@ class DefineVisitor : public Visitor { b.push_typeinfo(tc->nextOf()); // length - b.push(DtoConstSize_t(static_cast(tc->dim->toUInteger()))); + b.push(DtoConstSize_t(static_cast(toUInteger(tc->dim)))); // finish b.finalize(gvar); diff --git a/gen/uda.cpp b/gen/uda.cpp index 63f84e5699a..d5d03c49637 100644 --- a/gen/uda.cpp +++ b/gen/uda.cpp @@ -145,7 +145,7 @@ void callForEachMagicAttribute(Dsymbol &sym, const Identifier *id, sinteger_t getIntElem(StructLiteralExp *sle, size_t idx) { auto arg = (*sle->elements)[idx]; - return arg->toInteger(); + return toInteger(arg); } llvm::StringRef getStringElem(StructLiteralExp *sle, size_t idx) { @@ -630,7 +630,7 @@ extern "C" DComputeCompileFor hasComputeAttr(Dsymbol *sym) { checkStructElems(sle, {Type::tint32}); - return static_cast(1 + (*sle->elements)[0]->toInteger()); + return static_cast(1 + toInteger((*sle->elements)[0])); } /// Returns whether `sym` has the `@ldc.dcompute._kernel()` UDA applied. diff --git a/ir/iraggr.cpp b/ir/iraggr.cpp index 94275dafcef..bfe7439d23d 100644 --- a/ir/iraggr.cpp +++ b/ir/iraggr.cpp @@ -171,7 +171,7 @@ static llvm::Constant *FillSArrayDims(Type *arrTypeD, llvm::Constant *init) { if (arrTypeD->ty == TY::Tsarray) { init = FillSArrayDims(arrTypeD->nextOf(), init); - size_t dim = static_cast(arrTypeD)->dim->toUInteger(); + size_t dim = toUInteger(static_cast(arrTypeD)->dim); llvm::ArrayType *arrty = llvm::ArrayType::get(init->getType(), dim); return llvm::ConstantArray::get(arrty, std::vector(dim, init)); diff --git a/ir/irtype.cpp b/ir/irtype.cpp index edf8aa65990..4cff3ed7bd8 100644 --- a/ir/irtype.cpp +++ b/ir/irtype.cpp @@ -143,7 +143,7 @@ IrTypeSArray *IrTypeSArray::get(Type *dt) { // forward reference in a struct. if (!ctype) { TypeSArray *tsa = static_cast(dt); - uint64_t dim = static_cast(tsa->dim->toUInteger()); + uint64_t dim = static_cast(dmd::toUInteger(tsa->dim)); ctype = new IrTypeSArray(dt, llvm::ArrayType::get(elemType, dim)); } @@ -185,7 +185,7 @@ IrTypeVector *IrTypeVector::get(Type *dt) { // Could have already built the type as part of a struct forward reference, // just as for pointers and arrays. if (!ctype) { - LLType *lt = llvm::VectorType::get(elemType, tsa->dim->toUInteger(), + LLType *lt = llvm::VectorType::get(elemType, dmd::toUInteger(tsa->dim), /*Scalable=*/false); ctype = new IrTypeVector(dt, lt); } diff --git a/runtime/druntime/Makefile b/runtime/druntime/Makefile index 89f5297fac8..1b5f4165ce8 100644 --- a/runtime/druntime/Makefile +++ b/runtime/druntime/Makefile @@ -221,51 +221,53 @@ $(DOC_OUTPUT_DIR)/core_sync.html : import/core/sync/package.d $(DMD) $(DOC_OUTPUT_DIR)/core_sync_%.html : import/core/sync/%.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< +# FIXME enable CRuntime_Bionic $(DOC_OUTPUT_DIR)/core_sys_bionic_%.html : import/core/sys/bionic/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_darwin_%.html : import/core/sys/darwin/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=osx -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_darwin_mach_%.html : import/core/sys/darwin/mach/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=osx -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_darwin_netinet_%.html : import/core/sys/darwin/netinet/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=osx -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_darwin_sys_%.html : import/core/sys/darwin/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=osx -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_dragonflybsd_%.html : import/core/sys/dragonflybsd/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=dragonflybsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_dragonflybsd_netinet_%.html : import/core/sys/dragonflybsd/netinet/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=dragonflybsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_dragonflybsd_sys_%.html : import/core/sys/dragonflybsd/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=dragonflybsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_elf_%.html : import/core/sys/elf/%.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_freebsd_%.html : import/core/sys/freebsd/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=freebsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_freebsd_netinet_%.html : import/core/sys/freebsd/netinet/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=freebsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_freebsd_sys_%.html : import/core/sys/freebsd/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=freebsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_linux_%.html : import/core/sys/linux/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_linux_netinet_%.html : import/core/sys/linux/netinet/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_linux_sys_%.html : import/core/sys/linux/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< +# Note: no `-os=netbsd` option $(DOC_OUTPUT_DIR)/core_sys_netbsd_%.html : import/core/sys/netbsd/%.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< @@ -273,40 +275,41 @@ $(DOC_OUTPUT_DIR)/core_sys_netbsd_sys_%.html : import/core/sys/netbsd/sys/%.d $( $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_openbsd_%.html : import/core/sys/openbsd/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=openbsd -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_openbsd_sys_%.html : import/core/sys/openbsd/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=openbsd -Df$@ project.ddoc $(DOCFMT) $< +# Use -os=linux to define Posix version $(DOC_OUTPUT_DIR)/core_sys_posix_%.html : import/core/sys/posix/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_posix_arpa_%.html : import/core/sys/posix/arpa/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_posix_net_%.html : import/core/sys/posix/net/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_posix_netinet_%.html : import/core/sys/posix/netinet/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_posix_stdc_%.html : import/core/sys/posix/stdc/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_posix_sys_%.html : import/core/sys/posix/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=linux -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_solaris_%.html : import/core/sys/solaris/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=solaris -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_solaris_sys_%.html : import/core/sys/solaris/sys/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=solaris -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_windows_%.html : import/core/sys/windows/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=windows -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_sys_windows_stdc_%.html : import/core/sys/windows/stdc/%.d $(DMD) - $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DMD) $(DDOCFLAGS) -os=windows -Df$@ project.ddoc $(DOCFMT) $< $(DOC_OUTPUT_DIR)/core_thread.html : import/core/thread/package.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< @@ -326,6 +329,9 @@ $(DOC_OUTPUT_DIR)/core_builtins.html : import/core/builtins.d $(DMD) $(DOC_OUTPUT_DIR)/etc_linux_%.html : import/etc/linux/%.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< +$(DOC_OUTPUT_DIR)/etc_valgrind_%.html : import/etc/valgrind/%.d $(DMD) + $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< + $(DOC_OUTPUT_DIR)/gc_%.html : import/gc/%.d $(DMD) $(DMD) $(DDOCFLAGS) -Df$@ project.ddoc $(DOCFMT) $< diff --git a/runtime/druntime/src/__importc_builtins.di b/runtime/druntime/src/__importc_builtins.di index 3c870c1842c..9f3a3933bb4 100644 --- a/runtime/druntime/src/__importc_builtins.di +++ b/runtime/druntime/src/__importc_builtins.di @@ -15,7 +15,6 @@ module __builtins; import core.stdc.config : c_long, c_ulong; import core.checkedint : adds, subs, muls; - /* gcc relies on internal __builtin_xxxx functions and templates to * accomplish . D does the same thing with templates in core.stdc.stdarg. * Here, we redirect the gcc builtin declarations to the equivalent @@ -54,7 +53,7 @@ version (LDC) version (ARM) public import core.stdc.stdarg : __va_list; else version (AArch64) - public import core.internal.vararg.aarch64 : __va_list; + public import core.internal.vararg.aapcs64 : __va_list; } } else version (Posix) diff --git a/runtime/druntime/src/core/atomic.d b/runtime/druntime/src/core/atomic.d index 38f897d4d1c..bd93c256149 100644 --- a/runtime/druntime/src/core/atomic.d +++ b/runtime/druntime/src/core/atomic.d @@ -35,6 +35,13 @@ import core.internal.traits : hasUnsharedIndirections; pragma(inline, true): // LDC +// Low-level atomic helpers still need to hand shared reference payloads to the +// backend intrinsics under `-preview=nosharedaccess`. +private T unsharedLoadRef(T)(scope ref shared T value) pure nothrow @nogc @trusted +{ + return *cast(T*)&value; +} + /** * Specifies the memory ordering semantics of an atomic operation. * @@ -278,7 +285,7 @@ in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned") { static assert (is (V : T), "Can't assign `exchangeWith` of type `" ~ shared(V).stringof ~ "` to `" ~ shared(T).stringof ~ "`."); - return cast(shared)core.internal.atomic.atomicExchange!ms(cast(T*)here, cast(V)exchangeWith); + return cast(shared)core.internal.atomic.atomicExchange!ms(cast(T*)here, unsharedLoadRef(exchangeWith)); } /** @@ -345,7 +352,7 @@ template cas(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder. in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned") { return atomicCompareExchangeStrongNoResult!(succ, fail)( - cast(T*)here, cast(V1)ifThis, cast(V2)writeThis); + cast(T*)here, unsharedLoadRef(ifThis), unsharedLoadRef(writeThis)); } /// Compare-and-exchange for non-`shared` types @@ -397,7 +404,7 @@ template cas(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder. in (atomicPtrIsProperlyAligned(here), "Argument `here` is not properly aligned") { return atomicCompareExchangeStrong!(succ, fail)( - cast(T*)here, cast(T*)ifThis, cast(V)writeThis); + cast(T*)here, cast(T*)ifThis, unsharedLoadRef(writeThis)); } } @@ -905,11 +912,11 @@ version (CoreUnittest) T base = cast(T)null; shared(T) atom = cast(shared(T))null; - assert(base !is val, T.stringof); - assert(atom is base, T.stringof); + assert(atomicLoad(base) !is atomicLoad(val), T.stringof); + assert(atomicLoad(atom) is atomicLoad(base), T.stringof); - assert(atomicExchange(&atom, val) is base, T.stringof); - assert(atom is val, T.stringof); + assert(atomicExchange(&atom, atomicLoad(val)) is atomicLoad(base), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val), T.stringof); } void testCAS(T)(T val) pure nothrow @nogc @trusted @@ -922,25 +929,26 @@ version (CoreUnittest) T base = cast(T)null; shared(T) atom = cast(shared(T))null; - assert(base !is val, T.stringof); - assert(atom is base, T.stringof); + assert(atomicLoad(base) !is atomicLoad(val), T.stringof); + assert(atomicLoad(atom) is atomicLoad(base), T.stringof); - assert(cas(&atom, base, val), T.stringof); - assert(atom is val, T.stringof); - assert(!cas(&atom, base, base), T.stringof); - assert(atom is val, T.stringof); + assert(cas(&atom, atomicLoad(base), atomicLoad(val)), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val), T.stringof); + assert(!cas(&atom, atomicLoad(base), atomicLoad(base)), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val), T.stringof); - atom = cast(shared(T))null; + atomicStore(atom, cast(shared(T))null); - shared(T) arg = base; - assert(cas(&atom, &arg, val), T.stringof); - assert(arg is base, T.stringof); - assert(atom is val, T.stringof); + shared(T) arg = cast(shared(T))null; + atomicStore(arg, atomicLoad(base)); + assert(cas(&atom, &arg, atomicLoad(val)), T.stringof); + assert(atomicLoad(arg) is atomicLoad(base), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val), T.stringof); - arg = base; - assert(!cas(&atom, &arg, base), T.stringof); - assert(arg is val, T.stringof); - assert(atom is val, T.stringof); + atomicStore(arg, atomicLoad(base)); + assert(!cas(&atom, &arg, atomicLoad(base)), T.stringof); + assert(atomicLoad(arg) is atomicLoad(val), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val), T.stringof); } void testLoadStore(MemoryOrder ms = MemoryOrder.seq, T)(T val = T.init + 1) pure nothrow @nogc @trusted @@ -948,23 +956,34 @@ version (CoreUnittest) T base = cast(T) 0; shared(T) atom = cast(T) 0; - assert(base !is val); - assert(atom is base); - atomicStore!(ms)(atom, val); - base = atomicLoad!(ms)(atom); + assert(atomicLoad(base) !is atomicLoad(val)); + assert(atomicLoad(atom) is atomicLoad(base)); + atomicStore!(ms)(atom, atomicLoad(val)); + auto loaded = atomicLoad!(ms)(atom); - assert(base is val, T.stringof); - assert(atom is val); + assert(loaded is atomicLoad(val), T.stringof); + assert(atomicLoad(atom) is atomicLoad(val)); } - void testType(T)(T val = T.init + 1) pure nothrow @nogc @safe + // This test-only helper synthesizes distinct sentinel values for low-level + // atomic operations, including shared pointers that cannot be formed in + // @safe code. + private T testValue(T)() pure nothrow @nogc @trusted + { + static if (is(T == U*, U)) + return cast(T)1; + else + return T.init + 1; + } + + void testType(T)(T val = testValue!T()) pure nothrow @nogc @safe { static if (T.sizeof < 8 || has64BitXCHG) - testXCHG!(T)(val); - testCAS!(T)(val); - testLoadStore!(MemoryOrder.seq, T)(val); - testLoadStore!(MemoryOrder.raw, T)(val); + testXCHG!(T)(atomicLoad(val)); + testCAS!(T)(atomicLoad(val)); + testLoadStore!(MemoryOrder.seq, T)(atomicLoad(val)); + testLoadStore!(MemoryOrder.raw, T)(atomicLoad(val)); } @betterC @safe pure nothrow unittest @@ -1016,30 +1035,30 @@ version (CoreUnittest) shared(Big) arg; shared(Big) val = Big(1, 2); - assert(cas(&atom, arg, val), Big.stringof); - assert(atom is val, Big.stringof); - assert(!cas(&atom, arg, val), Big.stringof); - assert(atom is val, Big.stringof); + assert(cas(&atom, atomicLoad(arg), atomicLoad(val)), Big.stringof); + assert(atomicLoad(atom) is atomicLoad(val), Big.stringof); + assert(!cas(&atom, atomicLoad(arg), atomicLoad(val)), Big.stringof); + assert(atomicLoad(atom) is atomicLoad(val), Big.stringof); - atom = Big(); - assert(cas(&atom, &arg, val), Big.stringof); - assert(arg is base, Big.stringof); - assert(atom is val, Big.stringof); + atomicStore(atom, Big()); + assert(cas(&atom, &arg, atomicLoad(val)), Big.stringof); + assert(atomicLoad(arg) is atomicLoad(base), Big.stringof); + assert(atomicLoad(atom) is atomicLoad(val), Big.stringof); - arg = Big(); - assert(!cas(&atom, &arg, base), Big.stringof); - assert(arg is val, Big.stringof); - assert(atom is val, Big.stringof); + atomicStore(arg, Big()); + assert(!cas(&atom, &arg, atomicLoad(base)), Big.stringof); + assert(atomicLoad(arg) is atomicLoad(val), Big.stringof); + assert(atomicLoad(atom) is atomicLoad(val), Big.stringof); }(); } shared(size_t) i; atomicOp!"+="(i, cast(size_t) 1); - assert(i == 1); + assert(atomicLoad(i) == 1); atomicOp!"-="(i, cast(size_t) 1); - assert(i == 0); + assert(atomicLoad(i) == 0); shared float f = 0.1f; atomicOp!"+="(f, 0.1f); @@ -1065,10 +1084,12 @@ version (CoreUnittest) align(16) shared DoubleValue a; atomicStore(a, DoubleValue(1,2)); - assert(a.value1 == 1 && a.value2 ==2); + auto initial = atomicLoad(a); + assert(initial.value1 == 1 && initial.value2 == 2); while (!cas(&a, DoubleValue(1,2), DoubleValue(3,4))){} - assert(a.value1 == 3 && a.value2 ==4); + auto updated = atomicLoad(a); + assert(updated.value1 == 3 && updated.value2 == 4); align(16) DoubleValue b = atomicLoad(a); assert(b.value1 == 3 && b.value2 ==4); @@ -1153,7 +1174,8 @@ version (CoreUnittest) @betterC pure nothrow unittest { static struct S { int val; } - auto s = shared(S)(1); + shared S s; + atomicStore(s, S(1)); shared(S*) ptr; @@ -1167,7 +1189,7 @@ version (CoreUnittest) // head shared shared(S*) ifThis2 = writeThis; shared(S*) writeThis2 = null; - assert(cas(&ptr, ifThis2, writeThis2)); + assert(cas(&ptr, atomicLoad(ifThis2), atomicLoad(writeThis2))); assert(ptr is null); } @@ -1271,12 +1293,12 @@ version (CoreUnittest) shared ulong a = 2; uint b = 1; atomicOp!"-="(a, b); - assert(a == 1); + assert(atomicLoad(a) == 1); shared uint c = 2; ubyte d = 1; atomicOp!"-="(c, d); - assert(c == 1); + assert(atomicLoad(c) == 1); } pure nothrow @safe unittest // https://issues.dlang.org/show_bug.cgi?id=16230 @@ -1329,6 +1351,6 @@ version (CoreUnittest) shared uint si2 = 38; shared uint* psi = &si1; - assert((&psi).cas(cast(const) psi, &si2)); + assert((&psi).cas(cast(const) atomicLoad(psi), &si2)); } } diff --git a/runtime/druntime/src/core/attribute.d b/runtime/druntime/src/core/attribute.d index 8ec5b403b7c..9e3ec3cb12d 100644 --- a/runtime/druntime/src/core/attribute.d +++ b/runtime/druntime/src/core/attribute.d @@ -85,6 +85,32 @@ else // GDC and LDC declare this attribute in their own modules. } +/** +* When applied to a global variable, causes it to be emitted to a +* non-standard object file/executable section. +* +* The target platform might impose certain restrictions on the format for +* section names. +* +* Examples: +* --- +* import core.attributes; +* +* @section("mySection") int myGlobal; +* --- +*/ +version (DigitalMars) +{ + struct section + { + string name; + } +} +else +{ + // GDC and LDC declare this attribute in their own modules. +} + /** * Use this attribute to attach an Objective-C selector to a method. * diff --git a/runtime/druntime/src/core/bitop.d b/runtime/druntime/src/core/bitop.d index 20f29d8754d..1ca08dfb7bb 100644 --- a/runtime/druntime/src/core/bitop.d +++ b/runtime/druntime/src/core/bitop.d @@ -373,14 +373,23 @@ int btc(size_t* p, size_t bitnum) pure @system if (!__ctfe) return __btc(p, bitnum); } - else + + static if (size_t.sizeof == 8) { - pragma(inline, false); // such that DMD intrinsic detection will work + int result = ((p[bitnum >> 6] & (1L << (bitnum & 63)))) != 0; + p[bitnum >> 6] ^= (1L << (bitnum & 63)); + return result; } - return softBtx!"^"(p, bitnum); + else static if (size_t.sizeof == 4) + { + int result = ((p[bitnum >> 5] & (1L << (bitnum & 31)))) != 0; + p[bitnum >> 5] ^= (1L << (bitnum & 31)); + return result; + } + else + static assert(0); } - /** * Tests and resets (sets to 0) the bit. */ @@ -392,11 +401,21 @@ int btr(size_t* p, size_t bitnum) pure @system if (!__ctfe) return __btr(p, bitnum); } - else + + static if (size_t.sizeof == 8) { - pragma(inline, false); // such that DMD intrinsic detection will work + int result = ((p[bitnum >> 6] & (1L << (bitnum & 63)))) != 0; + p[bitnum >> 6] &= ~(1L << (bitnum & 63)); + return result; } - return softBtx!"& ~"(p, bitnum); + else static if (size_t.sizeof == 4) + { + int result = ((p[bitnum >> 5] & (1L << (bitnum & 31)))) != 0; + p[bitnum >> 5] &= ~(1L << (bitnum & 31)); + return result; + } + else + static assert(0); } @@ -421,11 +440,21 @@ int bts(size_t* p, size_t bitnum) pure @system if (!__ctfe) return __bts(p, bitnum); } - else + + static if (size_t.sizeof == 8) + { + int result = ((p[bitnum >> 6] & (1L << (bitnum & 63)))) != 0; + p[bitnum >> 6] |= (1L << (bitnum & 63)); + return result; + } + else static if (size_t.sizeof == 4) { - pragma(inline, false); // such that DMD intrinsic detection will work + int result = ((p[bitnum >> 5] & (1L << (bitnum & 31)))) != 0; + p[bitnum >> 5] |= (1L << (bitnum & 31)); + return result; } - return softBtx!"|"(p, bitnum); + else + static assert(0); } /// diff --git a/runtime/druntime/src/core/checkedint.d b/runtime/druntime/src/core/checkedint.d index c9a82d7f734..bfef61b6946 100644 --- a/runtime/druntime/src/core/checkedint.d +++ b/runtime/druntime/src/core/checkedint.d @@ -970,20 +970,18 @@ ulong mulu()(ulong x, uint y, ref bool overflow) { version (LDC_HasNativeI64Mul) { - if (!__ctfe) - return mulu(x, ulong(y), overflow); + return __ctfe ? mulu_generic(x, y, overflow) + : mulu(x, ulong(y), overflow); } else version (D_InlineAsm_X86_64) { - if (!__ctfe) - return mulu(x, ulong(y), overflow); + return __ctfe ? mulu_generic(x, y, overflow) + : mulu(x, ulong(y), overflow); + } + else + { + return mulu_generic(x, y, overflow); } - - ulong r = x * y; - if (x >> 32 && - r / x != y) - overflow = true; - return r; } /// ditto @@ -1025,6 +1023,16 @@ ulong mulu()(ulong x, ulong y, ref bool overflow) return r; } +private ulong mulu_generic()(ulong x, uint y, ref bool overflow) +{ + pragma(inline, true) + ulong r = x * y; + if (x >> 32 && + r / x != y) + overflow = true; + return r; +} + @betterC unittest { diff --git a/runtime/druntime/src/core/exception.d b/runtime/druntime/src/core/exception.d index 9150de86359..188522ac90c 100644 --- a/runtime/druntime/src/core/exception.d +++ b/runtime/druntime/src/core/exception.d @@ -275,6 +275,49 @@ unittest } } +/** + * When an unmapped pointer is accessed this may be thrown via a signal handler. + */ +class InvalidPointerError : Error +{ + @safe pure nothrow @nogc this(string file, size_t line) + { + this(file, line, cast(Throwable)null); + } + + @safe pure nothrow @nogc this(string file = __FILE__, size_t line = __LINE__, Throwable next = null) + { + this("Invalid pointer access", file, line, next); + } + + @safe pure nothrow @nogc this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) + { + super(msg, file, line, next); + } +} + +/** + * Thrown when a null dereference may occur. + * + * Depends upon null dereference check, or a signal handler to throw. + */ +class NullPointerError : InvalidPointerError +{ + @safe pure nothrow @nogc this(string file, size_t line) + { + this(file, line, cast(Throwable)null); + } + + @safe pure nothrow @nogc this(string file = __FILE__, size_t line = __LINE__, Throwable next = null) + { + this("Null pointer dereference", file, line, next); + } + + @safe pure nothrow @nogc this(string msg, string file = __FILE__, size_t line = __LINE__, Throwable next = null) + { + super(msg, file, line, next); + } +} /** * Thrown on finalize error. @@ -528,7 +571,12 @@ unittest // behavior should occur within the handler itself. This delegate // is __gshared for now based on the assumption that it will only // set by the main thread during program initialization. -private __gshared AssertHandler _assertHandler = null; +private __gshared +{ + AssertHandler _assertHandler = null; + FilterThreadThrowableHandler _filterThreadThrowableHandler = null; + NullDerefHandler _nullDerefHandler = null; +} /** @@ -548,6 +596,39 @@ alias AssertHandler = void function(string file, size_t line, string msg) nothro _assertHandler = handler; } +/** +Gets/sets the Throwable filter function for threads. null means no handler is called. +*/ +alias FilterThreadThrowableHandler = void function(ref Throwable) @system nothrow; + +/// ditto +@property FilterThreadThrowableHandler filterThreadThrowableHandler() @trusted nothrow @nogc +{ + return _filterThreadThrowableHandler; +} + +/// ditto +@property void filterThreadThrowableHandler(FilterThreadThrowableHandler handler) @trusted nothrow @nogc +{ + _filterThreadThrowableHandler = handler; +} + +/** +Gets/sets null dereference handler. null means the default handler is used. +*/ +alias NullDerefHandler = void function(string file, size_t line) nothrow; + +/// ditto +@property NullDerefHandler nullDerefHandler() @trusted nothrow @nogc +{ + return _nullDerefHandler; +} + +/// ditto +@property void nullDerefHandler(NullDerefHandler handler) @trusted nothrow @nogc +{ + _nullDerefHandler = handler; +} /////////////////////////////////////////////////////////////////////////////// // Overridable Callbacks @@ -588,6 +669,21 @@ extern (C) void onAssertErrorMsg( string file, size_t line, string msg ) nothrow _assertHandler( file, line, msg ); } +/** + * A callback for null dereference errors in D. + * The user-supplied dereference handler will be called if one has been supplied, + * otherwise an $(LREF NullPointerError) will be thrown. + * + * Params: + * file = The name of the file that signaled this error. + * line = The line number on which this error occured. + */ +extern(C) void onNullPointerError(string file = __FILE__, size_t line = __LINE__) nothrow +{ + if (_nullDerefHandler is null) + throw staticError!NullPointerError(file, line); + _nullDerefHandler(file, line); +} /** * A callback for unittest errors in D. The user-supplied unittest handler @@ -864,6 +960,12 @@ extern (C) { onArrayIndexError(index, length, file, line); } + + void _d_nullpointerp(immutable(char*) file, uint line) + { + import core.stdc.string : strlen; + onNullPointerError(file[0 .. strlen(file)], line); + } } // TLS storage shared for all errors, chaining might create circular reference diff --git a/runtime/druntime/src/core/gc/config.d b/runtime/druntime/src/core/gc/config.d index 32de5ab1409..c3b79e0926b 100644 --- a/runtime/druntime/src/core/gc/config.d +++ b/runtime/druntime/src/core/gc/config.d @@ -25,6 +25,12 @@ struct Config @MemVal size_t minPoolSize = 1 << 20; // initial and minimum pool size (bytes) @MemVal size_t maxPoolSize = 64 << 20; // maximum pool size (bytes) @MemVal size_t incPoolSize = 3 << 20; // pool size increment (bytes) + + // Limit under which the GC will try to keep its heap (bytes) + // The GC does this on a best effort basis, and exceeding this size + // might lead to a performance cliff. + @MemVal size_t heapSizeLimit = size_t.max; + uint parallel = 99; // number of additional threads for marking (limited by cpuid.threadsPerCPU-1) float heapSizeFactor = 2.0; // heap size to used memory ratio string cleanup = "collect"; // select gc cleanup method none|collect|finalize diff --git a/runtime/druntime/src/core/int128.d b/runtime/druntime/src/core/int128.d index d05199ae0d6..038b2fa6fe1 100644 --- a/runtime/druntime/src/core/int128.d +++ b/runtime/druntime/src/core/int128.d @@ -139,6 +139,20 @@ Cent neg(Cent c) return c; } +/***************************** + * Absolute value + * Note: This is a signed operation. + * Params: + * c = Cent to get absolute value of + * Returns: + * absolute value of c + */ +pure +Cent abs(Cent c) +{ + return (cast(I)c.hi < 0) ? neg(c) : c; +} + /***************************** * Increment * Params: @@ -275,6 +289,9 @@ in (n < Ubits * 2) /***************************** * Arithmetic shift right n bits + * + * Note: This is a signed shift (preserves the sign bit). + * * Params: * c = Cent to shift * n = number of bits to shift @@ -491,6 +508,7 @@ Cent sub(Cent c1, Cent c2) /**************************** * Multiply c1 * c2. + * Note: The algorithm is identical for both signed and unsigned multiplication. * Params: * c1 = operand 1 * c2 = operand 2 @@ -817,6 +835,7 @@ U udivmod(Cent c1, U c2, out U modulus) /**************************** * Signed divide c1 / c2. + * Note: Performs signed division. Use udiv() for unsigned division. * Params: * c1 = dividend * c2 = divisor @@ -880,6 +899,38 @@ Cent divmod(Cent c1, Cent c2, out Cent modulus) return udivmod(c1, c2, modulus); } +/***************************** + * Unsigned remainder c1 % c2. + * Params: + * c1 = dividend + * c2 = divisor + * Returns: + * remainder c1 % c2 + */ +pure +Cent urem(Cent c1, Cent c2) +{ + Cent modulus; + udivmod(c1, c2, modulus); + return modulus; +} + +/***************************** + * Signed remainder c1 % c2. + * Params: + * c1 = dividend + * c2 = divisor + * Returns: + * remainder c1 % c2 + */ +pure +Cent rem(Cent c1, Cent c2) +{ + Cent modulus; + divmod(c1, c2, modulus); + return modulus; +} + /**************************** * If c1 > c2 unsigned * Params: @@ -1164,4 +1215,16 @@ unittest assert(ror(C7_9, 1) == ror1(C7_9)); assert(rol(C7_9, 0) == C7_9); assert(ror(C7_9, 0) == C7_9); + + // Test abs() + assert(abs(Cm10) == C10); + assert(abs(C10) == C10); + assert(abs(C0) == C0); + + // Test rem/urem + assert(rem(C10, C3) == C1); // 10 % 3 = 1 + assert(urem(C10, C3) == C1); + assert(rem(Cm10, C3) == Cm1); // -10 % 3 = -1 + + assert(urem(Cm10, C3) == C0); } diff --git a/runtime/druntime/src/core/internal/array/capacity.d b/runtime/druntime/src/core/internal/array/capacity.d index 8ab8958e777..cbcc3d3b6d2 100644 --- a/runtime/druntime/src/core/internal/array/capacity.d +++ b/runtime/druntime/src/core/internal/array/capacity.d @@ -225,7 +225,16 @@ size_t _d_arraysetlengthT(Tarr : T[], T)(return ref scope Tarr arr, size_t newle // Call the implementation with the unqualified array and sharedness flag size_t result = _d_arraysetlengthT_(unqual_arr, newlength, isShared); - arr = cast(Tarr) unqual_arr; + static if (isShared) + { + // This low-level primitive mutates the caller's shared slice header, so + // the caller must already provide whatever synchronization makes that + // header update valid; the cast only preserves that existing contract + // under `-preview=nosharedaccess`. + *cast(UnqT[]*) &arr = unqual_arr; + } + else + arr = cast(Tarr) unqual_arr; // Return the result return result; } @@ -395,6 +404,8 @@ version (D_ProfileGC) shared S[] arr2; _d_arraysetlengthT!(typeof(arr2))(arr2, 16); assert(arr2.length == 16); - foreach (s; arr2) + // The resized slice has not been published yet, so the test may inspect + // the backing storage directly to verify initialization. + foreach (s; (() @trusted => *cast(S[]*) &arr2)()) assert(s == S.init); } diff --git a/runtime/druntime/src/core/internal/array/duplication.d b/runtime/druntime/src/core/internal/array/duplication.d index a9b599cfc35..ff9e1edb4da 100644 --- a/runtime/druntime/src/core/internal/array/duplication.d +++ b/runtime/druntime/src/core/internal/array/duplication.d @@ -29,13 +29,32 @@ U[] _dup(T, U)(scope T[] a) pure nothrow @trusted if (__traits(isPOD, T)) U[] _dupCtfe(T, U)(scope T[] a) { + import core.internal.traits : Unqual; + static if (is(T : void)) assert(0, "Cannot dup a void[] array at compile time."); else { U[] res; - foreach (ref e; a) - res ~= e; + static if (is(T == shared SharedPayload, SharedPayload)) + { + // CTFE still needs a low-level element copy path for shared POD + // arrays because `.dup` models the runtime bitcopy before any + // synchronization policy is applied to the duplicated slice. + Unqual!U[] tmp; + foreach (i; 0 .. a.length) + // This cast is only to make the CTFE path express the same raw + // element copy that the runtime POD implementation performs + // with memcpy; it is not meant as a synchronized access pattern + // for published shared data. + tmp ~= (cast(Unqual!T[]) a)[i]; + res = cast(typeof(res)) tmp; + } + else + { + foreach (ref e; a) + res ~= e; + } return res; } } @@ -327,9 +346,9 @@ U[] _dup(T, U)(T[] a) if (!__traits(isPOD, T)) { if (l != 0xDEADBEEF) { - import core.stdc.stdio : fflush, printf, stdout; + import core.stdc.stdio : fflush, printf; printf("Unexpected value: %lld\n", l); - fflush(stdout); + fflush(null); assert(false); } } diff --git a/runtime/druntime/src/core/internal/array/equality.d b/runtime/druntime/src/core/internal/array/equality.d index 7a7dc5ceb26..a94c6b6a887 100644 --- a/runtime/druntime/src/core/internal/array/equality.d +++ b/runtime/druntime/src/core/internal/array/equality.d @@ -49,25 +49,39 @@ bool __equals(T1, T2, size_t N, size_t M)(scope ref T1[N] lhs, scope ref T2[M] r private bool isEqual(T1, T2)(scope T1[] lhs, scope T2[] rhs, size_t length) { - // Returns a reference to an array element, eliding bounds check and - // casting void to ubyte. - pragma(inline, true) - static ref at(T)(scope T[] r, size_t i) @trusted - // exclude opaque structs due to https://issues.dlang.org/show_bug.cgi?id=20959 - if (!(is(T == struct) && !is(typeof(T.sizeof)))) + static if (is(T1 == T2) && + (__traits(isIntegral, T1) || is(T1 == char) || is(T1 == wchar) || + is(T1 == dchar) || is(T1 == bool) || is(T1 == class))) { - static if (is(T == void)) - return (cast(ubyte[]) r)[i]; - else - return r[i]; + foreach (i; 0 .. length) + { + if (lhs.ptr[i] != rhs.ptr[i]) + return false; + } + return true; } - - foreach (const i; 0 .. length) + else { - if (at(lhs, i) != at(rhs, i)) - return false; + // Returns a reference to an array element, eliding bounds check and + // casting void to ubyte. + pragma(inline, true) + static ref at(T)(scope T[] r, size_t i) @trusted + // exclude opaque structs due to https://issues.dlang.org/show_bug.cgi?id=20959 + if (!(is(T == struct) && !is(typeof(T.sizeof)))) + { + static if (is(T == void)) + return (cast(ubyte[]) r)[i]; + else + return r[i]; + } + + foreach (const i; 0 .. length) + { + if (at(lhs, i) != at(rhs, i)) + return false; + } + return true; } - return true; } @safe unittest diff --git a/runtime/druntime/src/core/internal/array/utils.d b/runtime/druntime/src/core/internal/array/utils.d index 25147a222cf..40caa39c89e 100644 --- a/runtime/druntime/src/core/internal/array/utils.d +++ b/runtime/druntime/src/core/internal/array/utils.d @@ -160,6 +160,13 @@ void[] __arrayAlloc(T)(size_t arrSize) @trusted return null; } +// https://github.com/dlang/dmd/issues/22517 +@system unittest +{ + auto arr = new void[10]; + assert((GC.getAttr(&arr[0]) & BlkAttr.NO_SCAN) == 0); +} + /** Given an array of length `size` that needs to be expanded to `newlength`, compute a new capacity. diff --git a/runtime/druntime/src/core/internal/atomic.d b/runtime/druntime/src/core/internal/atomic.d index b872f548552..fc98a5b0551 100644 --- a/runtime/druntime/src/core/internal/atomic.d +++ b/runtime/druntime/src/core/internal/atomic.d @@ -191,6 +191,84 @@ version (LDC) else: // !LDC version (DigitalMars) +version (AArch64) +{ + /* These functions are all stubbed out. They await someone who knows what + they are doing with AArch64 atomics. + TODO AArch64 + */ + enum IsAtomicLockFree(T) = T.sizeof <= size_t.sizeof * 2; + + inout(T) atomicLoad(MemoryOrder order = MemoryOrder.seq, T)(inout(T)* src) pure nothrow @nogc @trusted + if (CanCAS!T) + { + return *src; + } + + void atomicStore(MemoryOrder order = MemoryOrder.seq, T)(T* dest, T value) pure nothrow @nogc @trusted + if (CanCAS!T) + { + *dest = value; + } + + T atomicFetchAdd(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted + if (is(T : ulong)) + { + return *dest + value; + } + + T atomicFetchSub(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted + if (is(T : ulong)) + { + return atomicFetchAdd(dest, cast(T)-cast(IntOrLong!T)value); + } + + T atomicExchange(MemoryOrder order = MemoryOrder.seq, bool result = true, T)(T* dest, T value) pure nothrow @nogc @trusted + if (CanCAS!T) + { + size_t storage = void; + return *cast(T*)&storage; + } + + alias atomicCompareExchangeWeak = atomicCompareExchangeStrong; + + bool atomicCompareExchangeStrong(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T)(T* dest, T* compare, T value) pure nothrow @nogc @trusted + if (CanCAS!T) + { + if (*dest != *compare) + { + *compare = *dest; + return false; + } + *dest = value; + return true; + } + + alias atomicCompareExchangeWeakNoResult = atomicCompareExchangeStrongNoResult; + + bool atomicCompareExchangeStrongNoResult(MemoryOrder succ = MemoryOrder.seq, MemoryOrder fail = MemoryOrder.seq, T)(T* dest, const T compare, T value) pure nothrow @nogc @trusted + if (CanCAS!T) + { + if (*dest != compare) + return false; + *dest = value; + return true; + } + + void atomicFence(MemoryOrder order = MemoryOrder.seq)() pure nothrow @nogc @trusted + { + } + + void atomicSignalFence(MemoryOrder order = MemoryOrder.seq)() pure nothrow @nogc @trusted + { + // no-op, dmd doesn't reorder instructions + } + + void pause() pure nothrow @nogc @trusted + { + } +} +else // X86 and X86_64 { private { diff --git a/runtime/druntime/src/core/internal/backtrace/unwind.d b/runtime/druntime/src/core/internal/backtrace/unwind.d index ea299a22231..de8485f5f85 100644 --- a/runtime/druntime/src/core/internal/backtrace/unwind.d +++ b/runtime/druntime/src/core/internal/backtrace/unwind.d @@ -21,17 +21,17 @@ version (X86_64) version = X86_Any; extern (C): -alias uintptr_t _Unwind_Word; -alias intptr_t _Unwind_Sword; -alias uintptr_t _Unwind_Ptr; -alias uintptr_t _Unwind_Internal_Ptr; +alias _Unwind_Word = uintptr_t; +alias _Unwind_Sword = intptr_t; +alias _Unwind_Ptr = uintptr_t; +alias _Unwind_Internal_Ptr = uintptr_t; -alias ulong _Unwind_Exception_Class; +alias _Unwind_Exception_Class = ulong; -alias uintptr_t _uleb128_t; -alias intptr_t _sleb128_t; +alias _uleb128_t = uintptr_t; +alias _sleb128_t = intptr_t; -alias int _Unwind_Reason_Code; +alias _Unwind_Reason_Code = int; enum { _URC_NO_REASON = 0, @@ -47,7 +47,7 @@ enum version (ARM_EABI_UNWINDER) enum _URC_FAILURE = 9; -alias int _Unwind_Action; +alias _Unwind_Action = int; enum _Unwind_Action _UA_SEARCH_PHASE = 1; enum _Unwind_Action _UA_CLEANUP_PHASE = 2; enum _Unwind_Action _UA_HANDLER_FRAME = 4; diff --git a/runtime/druntime/src/core/internal/container/array.d b/runtime/druntime/src/core/internal/container/array.d index b583341d06b..c36ba28d728 100644 --- a/runtime/druntime/src/core/internal/container/array.d +++ b/runtime/druntime/src/core/internal/container/array.d @@ -89,7 +89,7 @@ nothrow: return _ptr[a .. b]; } - alias length opDollar; + alias opDollar = length; void insertBack()(auto ref T val) { @@ -215,6 +215,13 @@ unittest { // Overflow ary.length. auto ary = Array!size_t(cast(size_t*)0xdeadbeef, -1); + scope(failure) + { + // prevent destructor from cleaning up invalid memory. + ary._length = 0; + ary._ptr = null; + } + ary.insertBack(0); } catch (OutOfMemoryError) @@ -224,6 +231,12 @@ unittest { // Overflow requested memory size for common.xrealloc(). auto ary = Array!size_t(cast(size_t*)0xdeadbeef, -2); + scope(failure) + { + // prevent destructor from cleaning up invalid memory. + ary._length = 0; + ary._ptr = null; + } ary.insertBack(0); } catch (OutOfMemoryError) diff --git a/runtime/druntime/src/core/internal/gc/bits.d b/runtime/druntime/src/core/internal/gc/bits.d index f38e5cbe55a..8aabf9e393d 100644 --- a/runtime/druntime/src/core/internal/gc/bits.d +++ b/runtime/druntime/src/core/internal/gc/bits.d @@ -21,7 +21,7 @@ import core.stdc.string : memcpy, memset; struct GCBits { @nogc: - alias size_t wordtype; + alias wordtype = size_t; enum BITS_PER_WORD = (wordtype.sizeof * 8); enum BITS_SHIFT = (wordtype.sizeof == 8 ? 6 : 5); diff --git a/runtime/druntime/src/core/internal/gc/impl/conservative/gc.d b/runtime/druntime/src/core/internal/gc/impl/conservative/gc.d index 245a4413a57..d8456aa029f 100644 --- a/runtime/druntime/src/core/internal/gc/impl/conservative/gc.d +++ b/runtime/druntime/src/core/internal/gc/impl/conservative/gc.d @@ -106,7 +106,7 @@ private } } -alias GC gc_t; +alias gc_t = GC; /* ============================ GC =============================== */ @@ -2114,10 +2114,25 @@ struct Gcx */ void updateCollectThresholds() nothrow { - static float max(float a, float b) nothrow - { - return a >= b ? a : b; - } + import core.internal.util.math : min, max; + + // Reserve half of the remaining heap budget to small and large heaps. + immutable maxPageUsed = config.heapSizeLimit / PAGESIZE; + immutable usedPages = usedSmallPages + usedLargePages; + immutable heapBudget = maxPageUsed > usedPages + ? maxPageUsed - usedPages + : 0; + + immutable smTargetHeap = usedSmallPages + heapBudget / 2; + immutable lgTargetHeap = usedLargePages + heapBudget / 2; + + // Compute the target sizes based on the growth factor. + immutable smTargetGrowth = usedSmallPages * config.heapSizeFactor; + immutable lgTargetGrowth = usedLargePages * config.heapSizeFactor; + + // Collect when either is reached. + immutable smTarget = min(smTargetHeap, smTargetGrowth); + immutable lgTarget = min(lgTargetHeap, lgTargetGrowth); // instantly increases, slowly decreases static float smoothDecay(float oldVal, float newVal) nothrow @@ -2129,9 +2144,7 @@ struct Gcx return max(newVal, decay); } - immutable smTarget = usedSmallPages * config.heapSizeFactor; smallCollectThreshold = smoothDecay(smallCollectThreshold, smTarget); - immutable lgTarget = usedLargePages * config.heapSizeFactor; largeCollectThreshold = smoothDecay(largeCollectThreshold, lgTarget); } @@ -3529,8 +3542,8 @@ Lmark: cstdlib.free(Gcx.instance.scanThreadData); Gcx.instance.numScanThreads = 0; Gcx.instance.scanThreadData = null; - Gcx.instance.busyThreads = 0; - Gcx.instance.stackLock = shared(AlignedSpinLock)(SpinLock.Contention.brief); + atomicStore(Gcx.instance.busyThreads, 0); + (cast() Gcx.instance.stackLock) = AlignedSpinLock(SpinLock.Contention.brief); memset(&Gcx.instance.evStackFilled, 0, Gcx.instance.evStackFilled.sizeof); memset(&Gcx.instance.evDone, 0, Gcx.instance.evDone.sizeof); diff --git a/runtime/druntime/src/core/internal/gc/os.d b/runtime/druntime/src/core/internal/gc/os.d index e9a253369e4..914b7b903c7 100644 --- a/runtime/druntime/src/core/internal/gc/os.d +++ b/runtime/druntime/src/core/internal/gc/os.d @@ -13,7 +13,7 @@ version (Windows) import core.sys.windows.winbase : GetCurrentThreadId, VirtualAlloc, VirtualFree; import core.sys.windows.winnt : MEM_COMMIT, MEM_RELEASE, MEM_RESERVE, PAGE_READWRITE; - alias int pthread_t; + alias pthread_t = int; pthread_t pthread_self() nothrow { diff --git a/runtime/druntime/src/core/internal/hash.d b/runtime/druntime/src/core/internal/hash.d index e5c6ab1f0f3..f9355220df7 100644 --- a/runtime/druntime/src/core/internal/hash.d +++ b/runtime/druntime/src/core/internal/hash.d @@ -300,12 +300,9 @@ size_t hashOf(T)(scope const T val, size_t seed) if (__traits(isScalar, T) && !i static if (is(T V : V*)) { pragma(inline, true); - if (__ctfe) - { - if (val is null) return hashOf(size_t(0), seed); - assert(0, "Unable to calculate hash of non-null pointer at compile time"); - } - return hashOf(cast(size_t) val, seed); + return __ctfe ? (val is null ? hashOf(size_t(0), seed) : + assert(0, "Unable to calculate hash of non-null pointer at compile time")) + : hashOf(cast(size_t) val, seed); } else static if (is(T EType == enum) && is(typeof(val[0]))) { @@ -584,12 +581,9 @@ if (!is(T == enum) && (is(T == struct) || is(T == union)) size_t hashOf(T)(scope const T val, size_t seed = 0) if (!is(T == enum) && is(T == delegate)) { pragma(inline, true); - if (__ctfe) - { - if (val is null) return hashOf(size_t(0), hashOf(size_t(0), seed)); - assert(0, "unable to compute hash of "~T.stringof~" at compile time"); - } - return hashOf(val.ptr, hashOf(cast(void*) val.funcptr, seed)); + return __ctfe ? (val is null ? hashOf(size_t(0), hashOf(size_t(0), seed)) : + assert(0, "unable to compute hash of "~T.stringof~" at compile time")) + : hashOf(val.ptr, hashOf(cast(void*) val.funcptr, seed)); } //address-based class hash. CTFE only if null. @@ -599,8 +593,8 @@ if (!is(T == enum) && (is(T == interface) || is(T == class)) && canBitwiseHash!T) { pragma(inline, true); - if (__ctfe) if (val is null) return 0; - return hashOf(cast(const void*) val); + return __ctfe && (val is null) ? 0 + : hashOf(cast(const void*) val); } //address-based class hash. CTFE only if null. @@ -610,8 +604,8 @@ if (!is(T == enum) && (is(T == interface) || is(T == class)) && canBitwiseHash!T) { pragma(inline, true); - if (__ctfe) if (val is null) return hashOf(size_t(0), seed); - return hashOf(cast(const void*) val, seed); + return __ctfe && (val is null) ? hashOf(size_t(0), seed) + : hashOf(cast(const void*) val, seed); } //class or interface hash. CTFE depends on toHash diff --git a/runtime/druntime/src/core/internal/lifetime.d b/runtime/druntime/src/core/internal/lifetime.d index 053b3edc69d..fb28b11f084 100644 --- a/runtime/druntime/src/core/internal/lifetime.d +++ b/runtime/druntime/src/core/internal/lifetime.d @@ -94,7 +94,14 @@ if (!is(T == const) && !is(T == immutable) && !is(T == inout)) { import core.internal.traits : hasElaborateAssign; - static if (__traits(isZeroInit, T)) + static if (is(T == shared U, U)) + { + // Initialization happens before the shared object is published, so the + // helper has to operate on the backing storage instead of performing an + // ordinary shared write that `-preview=nosharedaccess` rejects. + emplaceInitializer(*cast(U*) &chunk); + } + else static if (__traits(isZeroInit, T)) { import core.stdc.string : memset; memset(cast(void*) &chunk, 0, T.sizeof); @@ -135,7 +142,9 @@ if (!is(T == const) && !is(T == immutable) && !is(T == inout)) { shared T dst = void; emplaceInitializer(dst); - assert(dst is shared(T).init); + // The initializer has not been published yet, so the test may read + // the backing storage directly to verify that emplace wrote T.init. + assert((() @trusted => (*cast(T*) &dst) is T.init)()); } // const T diff --git a/runtime/druntime/src/core/internal/newaa.d b/runtime/druntime/src/core/internal/newaa.d index 88f8d044ebf..bd95fb1ea6b 100644 --- a/runtime/druntime/src/core/internal/newaa.d +++ b/runtime/druntime/src/core/internal/newaa.d @@ -113,7 +113,8 @@ static struct Entry(K, V) // backward compatibility conversions private ref compat_key(K, K2)(ref K2 key) { - pragma(inline, true); + static if(!(is(K2 == struct) && __traits(isNested, K2))) + pragma(inline, true); static if (is(K2 == const(char)[]) && is(K == string)) return (ref (ref return K2 k2) @trusted => *cast(string*)&k2)(key); else @@ -180,7 +181,8 @@ Entry!(K, V)* _newEntry(K, V, K2)(ref K2 key) template pure_hashOf(K) { - static if (__traits(compiles, function hash_t(scope const ref K key) pure nothrow @nogc @trusted { return hashOf(cast()key); })) + static if (!(is(K == struct) && __traits(isNested, K)) && + __traits(compiles, function hash_t(scope const ref K key) pure nothrow @nogc @trusted { return hashOf(cast()key); })) { // avoid wrapper call in debug builds if pure nothrow @nogc is inferred pragma(inline, true) @@ -198,7 +200,9 @@ template pure_hashOf(K) // this also breaks cyclic inference on recursive data types template pure_keyEqual(K1, K2 = K1) { - static if (__traits(compiles, function bool(ref const K1 k1, ref const K2 k2) pure nothrow @nogc @trusted { return cast()k1 == cast()k2; })) + static if (!(is(K1 == struct) && __traits(isNested, K1)) && + !(is(K2 == struct) && __traits(isNested, K2)) && + __traits(compiles, function bool(ref const K1 k1, ref const K2 k2) pure nothrow @nogc @trusted { return cast()k1 == cast()k2; })) { // avoid wrapper call in debug builds if pure nothrow @nogc is inferred pragma(inline, true) diff --git a/runtime/druntime/src/core/internal/qsort.d b/runtime/druntime/src/core/internal/qsort.d index 8e789e70510..e9982262aef 100644 --- a/runtime/druntime/src/core/internal/qsort.d +++ b/runtime/druntime/src/core/internal/qsort.d @@ -41,7 +41,7 @@ else static if (Glibc_Qsort_R) { - alias extern (C) int function(scope const void *, scope const void *, scope void *) Cmp; + alias Cmp = extern (C) int function(scope const void *, scope const void *, scope void *); extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, Cmp cmp, scope void *arg); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) @@ -61,7 +61,7 @@ else version (FreeBSD) static if (__FreeBSD_version >= 1400000) { // FreeBSD changed qsort_r function signature to POSIX in FreeBSD 14.0 - alias extern (C) int function(scope const void*, scope const void*, scope void*) Cmp; + alias Cmp = extern (C) int function(scope const void*, scope const void*, scope void*); extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, Cmp cmp, scope void* thunk); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) @@ -76,7 +76,7 @@ else version (FreeBSD) } else { - alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp; + alias Cmp = extern (C) int function(scope void *, scope const void *, scope const void *); extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, scope void* thunk, Cmp cmp); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) @@ -92,7 +92,7 @@ else version (FreeBSD) } else version (DragonFlyBSD) { - alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp; + alias Cmp = extern (C) int function(scope void *, scope const void *, scope const void *); extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, scope void *thunk, Cmp cmp); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) @@ -107,7 +107,7 @@ else version (DragonFlyBSD) } else version (Darwin) { - alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp; + alias Cmp = extern (C) int function(scope void *, scope const void *, scope const void *); extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, scope void *thunk, Cmp cmp); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) @@ -122,7 +122,7 @@ else version (Darwin) } else version (CRuntime_UClibc) { - alias extern (C) int function(scope const void *, scope const void *, scope void *) __compar_d_fn_t; + alias __compar_d_fn_t = extern (C) int function(scope const void *, scope const void *, scope void *); extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, __compar_d_fn_t cmp, scope void *arg); extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) diff --git a/runtime/druntime/src/core/internal/traits.d b/runtime/druntime/src/core/internal/traits.d index 52e3307256b..df9f4200e54 100644 --- a/runtime/druntime/src/core/internal/traits.d +++ b/runtime/druntime/src/core/internal/traits.d @@ -285,38 +285,9 @@ template hasElaborateMove(S) } } -// std.traits.hasElaborateDestructor -template hasElaborateDestructor(S) -{ - static if (__traits(isStaticArray, S)) - { - enum bool hasElaborateDestructor = S.sizeof && hasElaborateDestructor!(BaseElemOf!S); - } - else static if (is(S == struct)) - { - // Once https://issues.dlang.org/show_bug.cgi?id=24865 is fixed, then - // this should be the implementation, but until that's fixed, we need the - // uncommented code. - // enum hasElaborateDestructor = __traits(hasMember, S, "__xdtor"); - - enum hasElaborateDestructor = hasDtor([__traits(allMembers, S)]); - } - else - { - enum bool hasElaborateDestructor = false; - } -} - -private bool hasDtor(string[] members) -{ - foreach (name; members) - { - if (name == "__xdtor") - return true; - } - - return false; -} +// Used by std.traits.hasElaborateDestructor +// TODO inline this in druntime +enum hasElaborateDestructor(S) = __traits(needsDestruction, S); @safe unittest { @@ -331,6 +302,7 @@ private bool hasDtor(string[] members) static assert( hasElaborateDestructor!(HasDestructor[42])); static assert(!hasElaborateDestructor!(HasDestructor[0])); static assert(!hasElaborateDestructor!(HasDestructor[])); + static assert( hasElaborateDestructor!(immutable HasDestructor)); static struct HasDestructor2 { HasDestructor s; } static assert( hasElaborateDestructor!HasDestructor2); @@ -365,6 +337,25 @@ private bool hasDtor(string[] members) static assert(!hasElaborateDestructor!S6); } +// https://github.com/dlang/dmd/issues/21967 +version (CoreUnittest) +private struct Test21967 +{ + // Note: Foward referencing was failing due to: + // https://github.com/dlang/dmd/issues/22524 + static assert(hasElaborateDestructor!C); + enum before = hasElaborateDestructor!C; + static assert(before); + + struct C + { + ~this() {} + } + static assert(hasElaborateDestructor!C); + enum after = hasElaborateDestructor!C; + static assert(after); +} + // std.traits.hasElaborateCopyDestructor template hasElaborateCopyConstructor(S) { @@ -572,9 +563,11 @@ template hasIndirections(T) else static if (__traits(isAssociativeArray, T) || is(T == class) || is(T == interface)) enum hasIndirections = true; else static if (is(T == E[N], E, size_t N)) - enum hasIndirections = T.sizeof && (is(immutable E == immutable void) || hasIndirections!(BaseElemOf!E)); + enum hasIndirections = T.sizeof && hasIndirections!(BaseElemOf!E); else static if (isFunctionPointer!T) enum hasIndirections = false; + else static if (is(immutable(T) == immutable(void))) + enum hasIndirections = true; else enum hasIndirections = isPointer!T || isDelegate!T || isDynamicArray!T; } @@ -735,11 +728,11 @@ template hasIndirections(T) // https://github.com/dlang/dmd/issues/20812 @safe unittest { - static assert(!hasIndirections!void); - static assert(!hasIndirections!(const void)); - static assert(!hasIndirections!(inout void)); - static assert(!hasIndirections!(immutable void)); - static assert(!hasIndirections!(shared void)); + static assert( hasIndirections!void); + static assert( hasIndirections!(const void)); + static assert( hasIndirections!(inout void)); + static assert( hasIndirections!(immutable void)); + static assert( hasIndirections!(shared void)); static assert( hasIndirections!(void*)); static assert( hasIndirections!(const void*)); @@ -1041,8 +1034,8 @@ if (func.length == 1 /*&& isCallable!func*/) static assert(is( typeof(test) == FunctionTypeOf!test )); static assert(is( typeof(test) == FunctionTypeOf!test_fp )); static assert(is( typeof(test) == FunctionTypeOf!test_dg )); - alias int GetterType() @property; - alias int SetterType(int) @property; + alias GetterType = int() @property; + alias SetterType = int(int) @property; static assert(is( FunctionTypeOf!propGet == GetterType )); static assert(is( FunctionTypeOf!propSet == SetterType )); diff --git a/runtime/druntime/src/core/internal/utf.d b/runtime/druntime/src/core/internal/utf.d index 71c32119473..88c985a763d 100644 --- a/runtime/druntime/src/core/internal/utf.d +++ b/runtime/druntime/src/core/internal/utf.d @@ -755,7 +755,7 @@ wstring toUTF16(const scope char[] s) return cast(wstring)r; } -alias const(wchar)* wptr; +alias wptr = const(wchar)*; /** ditto */ @safe pure wptr toUTF16z(const scope char[] s) diff --git a/runtime/druntime/src/core/internal/vararg/aarch64.d b/runtime/druntime/src/core/internal/vararg/aapcs64.d similarity index 90% rename from runtime/druntime/src/core/internal/vararg/aarch64.d rename to runtime/druntime/src/core/internal/vararg/aapcs64.d index 40fc7405de6..ee8f4ec1e84 100644 --- a/runtime/druntime/src/core/internal/vararg/aarch64.d +++ b/runtime/druntime/src/core/internal/vararg/aapcs64.d @@ -1,25 +1,26 @@ /** - * Varargs implementation for the AArch64 Procedure Call Standard (not followed by Apple). + * Varargs implementation for the AArch64 Procedure Call Standard AAPCS64 (not followed by Apple). * Used by core.stdc.stdarg and core.vararg. + * Can only be imported with version (AArch64). * * Reference: https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#appendix-variable-argument-lists * - * Copyright: Copyright Digital Mars 2020 - 2020. + * Copyright: Copyright Digital Mars 2020 - 2025. * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Martin Kinkelin - * Source: $(DRUNTIMESRC core/internal/vararg/aarch64.d) + * Source: $(DRUNTIMESRC core/internal/vararg/aapcs64.d) */ -module core.internal.vararg.aarch64; +module core.internal.vararg.aapcs64; -version (AArch64): +version (AArch64): // core.internal.vararg.aapcs64 is only for version (AArch64) -// Darwin and Windows use a simpler varargs implementation -version (OSX) {} -else version (iOS) {} -else version (TVOS) {} -else version (WatchOS) {} -else version (CRuntime_Microsoft) {} +// Darwin and Windows use a simpler varargs implementation than AAPCS64, so should not import this module +version (OSX) { } +else version (iOS) { } +else version (TVOS) { } +else version (WatchOS) { } +else version (CRuntime_Microsoft) { } else: import core.stdc.stdarg : alignUp; diff --git a/runtime/druntime/src/core/internal/vararg/gnu.d b/runtime/druntime/src/core/internal/vararg/gnu.d new file mode 100644 index 00000000000..be3d6991e39 --- /dev/null +++ b/runtime/druntime/src/core/internal/vararg/gnu.d @@ -0,0 +1,52 @@ +/** + * Varargs implementation for the GNU compilers (Gnu D Compiler) + * Used by core.stdc.stdarg and core.vararg. + * + * Reference: https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#appendix-variable-argument-lists + * + * Copyright: Copyright D Language Foundation 2025 + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + * Authors: Various + * Source: $(DRUNTIMESRC core/internal/vararg/gnu.d) + */ + +module core.internal.vararg.gnu; + +version (GNU): + +import gcc.builtins; + +@nogc: +nothrow: + +/** + * The argument pointer type. + */ +alias va_list = __gnuc_va_list; +alias __gnuc_va_list = __builtin_va_list; + +/** + * Initialize ap. + * parmn should be the last named parameter. + */ +void va_start(T)(out va_list ap, ref T parmn); + +/** + * Retrieve and return the next value that is of type T. + */ +T va_arg(T)(ref va_list ap); // intrinsic + +/** + * Retrieve and store in parmn the next value that is of type T. + */ +void va_arg(T)(ref va_list ap, ref T parmn); // intrinsic + +/** + * End use of ap. + */ +alias va_end = __builtin_va_end; + +/** + * Make a copy of ap. + */ +alias va_copy = __builtin_va_copy; diff --git a/runtime/druntime/src/core/internal/vararg/sysv_x64.d b/runtime/druntime/src/core/internal/vararg/sysv_x64.d index d753fb019cf..b9459265ad8 100644 --- a/runtime/druntime/src/core/internal/vararg/sysv_x64.d +++ b/runtime/druntime/src/core/internal/vararg/sysv_x64.d @@ -41,6 +41,16 @@ alias __va_list = __va_list_tag; */ alias va_list = __va_list*; +version (DigitalMars) +{ + align(16) struct __va_argsave_t + { + size_t[6] regs; // RDI,RSI,RDX,RCX,R8,R9 + real[8] fpregs; // XMM0..XMM7 + __va_list va; + } +} + /// T va_arg(T)(va_list ap) { @@ -55,7 +65,7 @@ T va_arg(T)(va_list ap) } else static if (U.length == 1) { // Arg is passed in one register - alias U[0] T1; + alias T1 = U[0]; static if (is(T1 == double) || is(T1 == float) || is(T1 == __vector)) { // Passed in XMM register if (ap.offset_fpregs < (6 * 8 + 16 * 8)) @@ -89,8 +99,8 @@ T va_arg(T)(va_list ap) } else static if (U.length == 2) { // Arg is passed in two registers - alias U[0] T1; - alias U[1] T2; + alias T1 = U[0]; + alias T2 = U[1]; T result = void; auto p1 = cast(T1*) &result; diff --git a/runtime/druntime/src/core/lifetime.d b/runtime/druntime/src/core/lifetime.d index 85d9bfbcd67..cd38648bc22 100644 --- a/runtime/druntime/src/core/lifetime.d +++ b/runtime/druntime/src/core/lifetime.d @@ -77,9 +77,11 @@ T* emplace(T, Args...)(T* chunk, auto ref Args args) @betterC @system unittest { + import core.atomic : atomicLoad; + shared int i; emplace(&i, 42); - assert(i == 42); + assert(atomicLoad(i) == 42); } /** @@ -1246,9 +1248,21 @@ void copyEmplace(S, T)(ref S source, ref T target) @system if (is(immutable S == immutable T)) { import core.internal.traits : BaseElemOf, hasElaborateCopyConstructor, Unconst, Unqual; + enum isSharedReference = is(S == shared U, U) && is(T == shared V, V) && + (is(U == class) || is(U == interface)) && + (is(V == class) || is(V == interface)); // cannot have the following as simple template constraint due to nested-struct special case... - static if (!__traits(compiles, (ref S src) { T tgt = src; })) + static if (isSharedReference) + { + static assert(__traits(compiles, (ref S src, ref T tgt) + { + import core.atomic : atomicLoad, atomicStore; + atomicStore(tgt, atomicLoad(src)); + }), "cannot copy shared reference " ~ T.stringof ~ " from " ~ S.stringof ~ + " via atomic load/store"); + } + else static if (!__traits(compiles, (ref S src) { T tgt = src; })) { alias B = BaseElemOf!T; enum isNestedStruct = is(B == struct) && __traits(isNested, B); @@ -1308,6 +1322,11 @@ void copyEmplace(S, T)(ref S source, ref T target) @system blit(); // all elements at once } } + else static if (isSharedReference) + { + import core.atomic : atomicLoad, atomicStore; + atomicStore(target, atomicLoad(source)); + } else { *cast(Unconst!(T)*) &target = *cast(Unconst!(T)*) &source; @@ -2396,7 +2415,7 @@ template _d_delstructImpl(T) private enum errorMessage = "Cannot delete struct if compiling without support for runtime type information!"; /** - * TraceGC wrapper around $(REF _d_delstruct, core,lifetime,_d_delstructImpl). + * TraceGC wrapper around $(REF _d_delstruct, core,lifetime). * * Bugs: * This function template was ported from a much older runtime hook that @@ -2600,11 +2619,13 @@ pure nothrow @system unittest } // wipes source after moving -pragma(inline, true) private void wipe(T, Init...)(return scope ref T source, ref const scope Init initializer) @trusted if (!Init.length || ((Init.length == 1) && (is(immutable T == immutable Init[0])))) { + static if (!is(T == struct) || !__traits(isNested, T)) + pragma(inline, true); + static if (__traits(isStaticArray, T) && hasContextPointers!T) { for (auto i = 0; i < T.length; i++) diff --git a/runtime/druntime/src/core/memory.d b/runtime/druntime/src/core/memory.d index e3a46a088ca..8cc63c85c91 100644 --- a/runtime/druntime/src/core/memory.d +++ b/runtime/druntime/src/core/memory.d @@ -141,7 +141,7 @@ private extern (C) GC.ProfileStats gc_profileStats ( ) nothrow @nogc @safe; } -version (CoreDoc) +version (CoreDdoc) { /** * The minimum size of a system page in bytes. diff --git a/runtime/druntime/src/core/simd.d b/runtime/druntime/src/core/simd.d index 25593a248b6..9c4527abbc9 100644 --- a/runtime/druntime/src/core/simd.d +++ b/runtime/druntime/src/core/simd.d @@ -34,66 +34,66 @@ template Vector(T) /* __vector is compiler magic, hide it behind a template. * The compiler will reject T's that don't work. */ - alias __vector(T) Vector; + alias Vector = __vector(T); } /* Handy aliases */ version (LDC) { -static if (is(Vector!(void[4]))) alias Vector!(void[4]) void4; /// -static if (is(Vector!(byte[4]))) alias Vector!(byte[4]) byte4; /// -static if (is(Vector!(ubyte[4]))) alias Vector!(ubyte[4]) ubyte4; /// -static if (is(Vector!(short[2]))) alias Vector!(short[2]) short2; /// -static if (is(Vector!(ushort[2]))) alias Vector!(ushort[2]) ushort2; /// +static if (is(Vector!(void[4]))) alias void4 = Vector!(void[4]); /// +static if (is(Vector!(byte[4]))) alias byte4 = Vector!(byte[4]); /// +static if (is(Vector!(ubyte[4]))) alias ubyte4 = Vector!(ubyte[4]); /// +static if (is(Vector!(short[2]))) alias short2 = Vector!(short[2]); /// +static if (is(Vector!(ushort[2]))) alias ushort2 = Vector!(ushort[2]); /// } -static if (is(Vector!(void[8]))) alias Vector!(void[8]) void8; /// -static if (is(Vector!(double[1]))) alias Vector!(double[1]) double1; /// -static if (is(Vector!(float[2]))) alias Vector!(float[2]) float2; /// -static if (is(Vector!(byte[8]))) alias Vector!(byte[8]) byte8; /// -static if (is(Vector!(ubyte[8]))) alias Vector!(ubyte[8]) ubyte8; /// -static if (is(Vector!(short[4]))) alias Vector!(short[4]) short4; /// -static if (is(Vector!(ushort[4]))) alias Vector!(ushort[4]) ushort4; /// -static if (is(Vector!(int[2]))) alias Vector!(int[2]) int2; /// -static if (is(Vector!(uint[2]))) alias Vector!(uint[2]) uint2; /// -static if (is(Vector!(long[1]))) alias Vector!(long[1]) long1; /// -static if (is(Vector!(ulong[1]))) alias Vector!(ulong[1]) ulong1; /// - -static if (is(Vector!(void[16]))) alias Vector!(void[16]) void16; /// -static if (is(Vector!(double[2]))) alias Vector!(double[2]) double2; /// -static if (is(Vector!(float[4]))) alias Vector!(float[4]) float4; /// -static if (is(Vector!(byte[16]))) alias Vector!(byte[16]) byte16; /// -static if (is(Vector!(ubyte[16]))) alias Vector!(ubyte[16]) ubyte16; /// -static if (is(Vector!(short[8]))) alias Vector!(short[8]) short8; /// -static if (is(Vector!(ushort[8]))) alias Vector!(ushort[8]) ushort8; /// -static if (is(Vector!(int[4]))) alias Vector!(int[4]) int4; /// -static if (is(Vector!(uint[4]))) alias Vector!(uint[4]) uint4; /// -static if (is(Vector!(long[2]))) alias Vector!(long[2]) long2; /// -static if (is(Vector!(ulong[2]))) alias Vector!(ulong[2]) ulong2; /// - -static if (is(Vector!(void[32]))) alias Vector!(void[32]) void32; /// -static if (is(Vector!(double[4]))) alias Vector!(double[4]) double4; /// -static if (is(Vector!(float[8]))) alias Vector!(float[8]) float8; /// -static if (is(Vector!(byte[32]))) alias Vector!(byte[32]) byte32; /// -static if (is(Vector!(ubyte[32]))) alias Vector!(ubyte[32]) ubyte32; /// -static if (is(Vector!(short[16]))) alias Vector!(short[16]) short16; /// -static if (is(Vector!(ushort[16]))) alias Vector!(ushort[16]) ushort16; /// -static if (is(Vector!(int[8]))) alias Vector!(int[8]) int8; /// -static if (is(Vector!(uint[8]))) alias Vector!(uint[8]) uint8; /// -static if (is(Vector!(long[4]))) alias Vector!(long[4]) long4; /// -static if (is(Vector!(ulong[4]))) alias Vector!(ulong[4]) ulong4; /// - -static if (is(Vector!(void[64]))) alias Vector!(void[64]) void64; /// -static if (is(Vector!(double[8]))) alias Vector!(double[8]) double8; /// -static if (is(Vector!(float[16]))) alias Vector!(float[16]) float16; /// -static if (is(Vector!(byte[64]))) alias Vector!(byte[64]) byte64; /// -static if (is(Vector!(ubyte[64]))) alias Vector!(ubyte[64]) ubyte64; /// -static if (is(Vector!(short[32]))) alias Vector!(short[32]) short32; /// -static if (is(Vector!(ushort[32]))) alias Vector!(ushort[32]) ushort32; /// -static if (is(Vector!(int[16]))) alias Vector!(int[16]) int16; /// -static if (is(Vector!(uint[16]))) alias Vector!(uint[16]) uint16; /// -static if (is(Vector!(long[8]))) alias Vector!(long[8]) long8; /// -static if (is(Vector!(ulong[8]))) alias Vector!(ulong[8]) ulong8; /// +static if (is(Vector!(void[8]))) alias void8 = Vector!(void[8]); /// +static if (is(Vector!(double[1]))) alias double1 = Vector!(double[1]); /// +static if (is(Vector!(float[2]))) alias float2 = Vector!(float[2]); /// +static if (is(Vector!(byte[8]))) alias byte8 = Vector!(byte[8]); /// +static if (is(Vector!(ubyte[8]))) alias ubyte8 = Vector!(ubyte[8]); /// +static if (is(Vector!(short[4]))) alias short4 = Vector!(short[4]); /// +static if (is(Vector!(ushort[4]))) alias ushort4 = Vector!(ushort[4]); /// +static if (is(Vector!(int[2]))) alias int2 = Vector!(int[2]); /// +static if (is(Vector!(uint[2]))) alias uint2 = Vector!(uint[2]); /// +static if (is(Vector!(long[1]))) alias long1 = Vector!(long[1]); /// +static if (is(Vector!(ulong[1]))) alias ulong1 = Vector!(ulong[1]); /// + +static if (is(Vector!(void[16]))) alias void16 = Vector!(void[16]); /// +static if (is(Vector!(double[2]))) alias double2 = Vector!(double[2]); /// +static if (is(Vector!(float[4]))) alias float4 = Vector!(float[4]); /// +static if (is(Vector!(byte[16]))) alias byte16 = Vector!(byte[16]); /// +static if (is(Vector!(ubyte[16]))) alias ubyte16 = Vector!(ubyte[16]); /// +static if (is(Vector!(short[8]))) alias short8 = Vector!(short[8]); /// +static if (is(Vector!(ushort[8]))) alias ushort8 = Vector!(ushort[8]); /// +static if (is(Vector!(int[4]))) alias int4 = Vector!(int[4]); /// +static if (is(Vector!(uint[4]))) alias uint4 = Vector!(uint[4]); /// +static if (is(Vector!(long[2]))) alias long2 = Vector!(long[2]); /// +static if (is(Vector!(ulong[2]))) alias ulong2 = Vector!(ulong[2]); /// + +static if (is(Vector!(void[32]))) alias void32 = Vector!(void[32]); /// +static if (is(Vector!(double[4]))) alias double4 = Vector!(double[4]); /// +static if (is(Vector!(float[8]))) alias float8 = Vector!(float[8]); /// +static if (is(Vector!(byte[32]))) alias byte32 = Vector!(byte[32]); /// +static if (is(Vector!(ubyte[32]))) alias ubyte32 = Vector!(ubyte[32]); /// +static if (is(Vector!(short[16]))) alias short16 = Vector!(short[16]); /// +static if (is(Vector!(ushort[16]))) alias ushort16 = Vector!(ushort[16]); /// +static if (is(Vector!(int[8]))) alias int8 = Vector!(int[8]); /// +static if (is(Vector!(uint[8]))) alias uint8 = Vector!(uint[8]); /// +static if (is(Vector!(long[4]))) alias long4 = Vector!(long[4]); /// +static if (is(Vector!(ulong[4]))) alias ulong4 = Vector!(ulong[4]); /// + +static if (is(Vector!(void[64]))) alias void64 = Vector!(void[64]); /// +static if (is(Vector!(double[8]))) alias double8 = Vector!(double[8]); /// +static if (is(Vector!(float[16]))) alias float16 = Vector!(float[16]); /// +static if (is(Vector!(byte[64]))) alias byte64 = Vector!(byte[64]); /// +static if (is(Vector!(ubyte[64]))) alias ubyte64 = Vector!(ubyte[64]); /// +static if (is(Vector!(short[32]))) alias short32 = Vector!(short[32]); /// +static if (is(Vector!(ushort[32]))) alias ushort32 = Vector!(ushort[32]); /// +static if (is(Vector!(int[16]))) alias int16 = Vector!(int[16]); /// +static if (is(Vector!(uint[16]))) alias uint16 = Vector!(uint[16]); /// +static if (is(Vector!(long[8]))) alias long8 = Vector!(long[8]); /// +static if (is(Vector!(ulong[8]))) alias ulong8 = Vector!(ulong[8]); /// version (LDC) { diff --git a/runtime/druntime/src/core/stdc/complex.d b/runtime/druntime/src/core/stdc/complex.d index b84651f3f15..4009c212306 100644 --- a/runtime/druntime/src/core/stdc/complex.d +++ b/runtime/druntime/src/core/stdc/complex.d @@ -21,8 +21,8 @@ nothrow: // @@@DEPRECATED_2.105@@@ deprecated: -alias creal complex; -alias ireal imaginary; +alias complex = creal; +alias imaginary = ireal; cdouble cacos(cdouble z); cfloat cacosf(cfloat z); creal cacosl(creal z); diff --git a/runtime/druntime/src/core/stdc/config.d b/runtime/druntime/src/core/stdc/config.d index 952ceacb217..7c5b53df1ff 100644 --- a/runtime/druntime/src/core/stdc/config.d +++ b/runtime/druntime/src/core/stdc/config.d @@ -122,34 +122,34 @@ version (GNU) { import gcc.builtins; - alias __builtin_clong c_long; - alias __builtin_culong c_ulong; + alias c_long = __builtin_clong; + alias c_ulong = __builtin_culong; enum __c_long : __builtin_clong; enum __c_ulong : __builtin_culong; - alias __c_long cpp_long; - alias __c_ulong cpp_ulong; + alias cpp_long = __c_long; + alias cpp_ulong = __c_ulong; enum __c_longlong : __builtin_clonglong; enum __c_ulonglong : __builtin_culonglong; - alias __c_longlong cpp_longlong; - alias __c_ulonglong cpp_ulonglong; + alias cpp_longlong = __c_longlong; + alias cpp_ulonglong = __c_ulonglong; } else version (Windows) { enum __c_long : int; enum __c_ulong : uint; - alias int c_long; - alias uint c_ulong; + alias c_long = int; + alias c_ulong = uint; - alias __c_long cpp_long; - alias __c_ulong cpp_ulong; + alias cpp_long = __c_long; + alias cpp_ulong = __c_ulong; - alias long cpp_longlong; - alias ulong cpp_ulonglong; + alias cpp_longlong = long; + alias cpp_ulonglong = ulong; } else version (Posix) { @@ -158,28 +158,28 @@ else version (Posix) enum __c_longlong : long; enum __c_ulonglong : ulong; - alias long c_long; - alias ulong c_ulong; + alias c_long = long; + alias c_ulong = ulong; - alias long cpp_long; - alias ulong cpp_ulong; + alias cpp_long = long; + alias cpp_ulong = ulong; - alias __c_longlong cpp_longlong; - alias __c_ulonglong cpp_ulonglong; + alias cpp_longlong = __c_longlong; + alias cpp_ulonglong = __c_ulonglong; } else { enum __c_long : int; enum __c_ulong : uint; - alias int c_long; - alias uint c_ulong; + alias c_long = int; + alias c_ulong = uint; - alias __c_long cpp_long; - alias __c_ulong cpp_ulong; + alias cpp_long = __c_long; + alias cpp_ulong = __c_ulong; - alias long cpp_longlong; - alias ulong cpp_ulonglong; + alias cpp_longlong = long; + alias cpp_ulonglong = ulong; } } else version (WASI) @@ -189,28 +189,28 @@ else version (WASI) enum __c_longlong : long; enum __c_ulonglong : ulong; - alias long c_long; - alias ulong c_ulong; + alias c_long = long; + alias c_ulong = ulong; - alias long cpp_long; - alias ulong cpp_ulong; + alias cpp_long = long; + alias cpp_ulong = ulong; - alias __c_longlong cpp_longlong; - alias __c_ulonglong cpp_ulonglong; + alias cpp_longlong = __c_longlong; + alias cpp_ulonglong = __c_ulonglong; } else { enum __c_long : int; enum __c_ulong : uint; - alias int c_long; - alias uint c_ulong; + alias c_long = int; + alias c_ulong = uint; - alias __c_long cpp_long; - alias __c_ulong cpp_ulong; + alias cpp_long = __c_long; + alias cpp_ulong = __c_ulong; - alias long cpp_longlong; - alias ulong cpp_ulonglong; + alias cpp_longlong = long; + alias cpp_ulonglong = ulong; } } @@ -235,47 +235,47 @@ else version (CRuntime_Microsoft) */ enum __c_long_double : double; - alias __c_long_double c_long_double; + alias c_long_double = __c_long_double; } else version (DigitalMars) { version (X86) { - alias real c_long_double; + alias c_long_double = real; } else version (X86_64) { version (linux) - alias real c_long_double; + alias c_long_double = real; else version (FreeBSD) - alias real c_long_double; + alias c_long_double = real; else version (OpenBSD) - alias real c_long_double; + alias c_long_double = real; else version (NetBSD) - alias real c_long_double; + alias c_long_double = real; else version (DragonFlyBSD) - alias real c_long_double; + alias c_long_double = real; else version (Solaris) - alias real c_long_double; + alias c_long_double = real; else version (Darwin) - alias real c_long_double; + alias c_long_double = real; } else version (AArch64) { version (linux) - alias real c_long_double; + alias c_long_double = real; else version (FreeBSD) - alias real c_long_double; + alias c_long_double = real; else version (OpenBSD) - alias real c_long_double; + alias c_long_double = real; else version (NetBSD) - alias real c_long_double; + alias c_long_double = real; else version (DragonFlyBSD) - alias real c_long_double; + alias c_long_double = real; else version (Solaris) - alias real c_long_double; + alias c_long_double = real; else version (Darwin) - alias real c_long_double; + alias c_long_double = real; } } diff --git a/runtime/druntime/src/core/stdc/fenv.d b/runtime/druntime/src/core/stdc/fenv.d index 7d42d5c8c02..1c49d84906e 100644 --- a/runtime/druntime/src/core/stdc/fenv.d +++ b/runtime/druntime/src/core/stdc/fenv.d @@ -194,8 +194,8 @@ else version (Darwin) { version (BigEndian) { - alias uint fenv_t; - alias uint fexcept_t; + alias fenv_t = uint; + alias fexcept_t = uint; } version (LittleEndian) { @@ -207,7 +207,7 @@ else version (Darwin) byte[8] __reserved; } - alias ushort fexcept_t; + alias fexcept_t = ushort; } } else version (FreeBSD) @@ -222,7 +222,7 @@ else version (FreeBSD) byte[16] __other; } - alias ushort fexcept_t; + alias fexcept_t = ushort; } else version (NetBSD) { @@ -262,7 +262,7 @@ else version (NetBSD) } - alias uint fexcept_t; + alias fexcept_t = uint; } else version (OpenBSD) { @@ -296,7 +296,7 @@ else version (DragonFlyBSD) uint mxcsr; } - alias uint fexcept_t; + alias fexcept_t = uint; } else version (CRuntime_Bionic) { @@ -312,12 +312,12 @@ else version (CRuntime_Bionic) byte[16] __other; } - alias ushort fexcept_t; + alias fexcept_t = ushort; } else version (ARM) { - alias uint fenv_t; - alias uint fexcept_t; + alias fenv_t = uint; + alias fexcept_t = uint; } else version (AArch64) { @@ -327,7 +327,7 @@ else version (CRuntime_Bionic) uint __status; } - alias uint fexcept_t; + alias fexcept_t = uint; } else version (X86_64) { @@ -345,7 +345,7 @@ else version (CRuntime_Bionic) uint __mxcsr; } - alias uint fexcept_t; + alias fexcept_t = uint; } else { @@ -370,7 +370,7 @@ else version (Solaris) c_ulong __fsr; } - alias int fexcept_t; + alias fexcept_t = int; } else version (CRuntime_Musl) { @@ -381,7 +381,7 @@ else version (CRuntime_Musl) uint __fpcr; uint __fpsr; } - alias uint fexcept_t; + alias fexcept_t = uint; } else version (ARM) { @@ -391,12 +391,12 @@ else version (CRuntime_Musl) { c_ulong __cw; } - alias c_ulong fexcept_t; + alias fexcept_t = c_ulong; } else version (IBMZ_Any) { - alias uint fenv_t; - alias uint fexcept_t; + alias fenv_t = uint; + alias fexcept_t = uint; } else version (MIPS_Any) { @@ -404,12 +404,12 @@ else version (CRuntime_Musl) { uint __cw; } - alias ushort fexcept_t; + alias fexcept_t = ushort; } else version (PPC_Any) { - alias double fenv_t; - alias uint fexcept_t; + alias fenv_t = double; + alias fexcept_t = uint; } else version (X86_Any) { @@ -430,7 +430,7 @@ else version (CRuntime_Musl) version (X86_64) uint __mxcsr; } - alias ushort fexcept_t; + alias fexcept_t = ushort; } else version (LoongArch64) { @@ -438,12 +438,12 @@ else version (CRuntime_Musl) { uint __cw; } - alias uint fexcept_t; + alias fexcept_t = uint; } else version (RICV64) { - alias uint fenv_t; - alias uint fexcept_t; + alias fenv_t = uint; + alias fexcept_t = uint; } else { diff --git a/runtime/druntime/src/core/stdc/inttypes.d b/runtime/druntime/src/core/stdc/inttypes.d index 7f30e38ab92..042716d308a 100644 --- a/runtime/druntime/src/core/stdc/inttypes.d +++ b/runtime/druntime/src/core/stdc/inttypes.d @@ -29,7 +29,7 @@ struct imaxdiv_t rem; } -private alias immutable(char)* _cstr; +private alias _cstr = immutable(char)*; /// enum _cstr PRId8 = "hhd"; diff --git a/runtime/druntime/src/core/stdc/locale.d b/runtime/druntime/src/core/stdc/locale.d index 357d75e9589..50b45980dc3 100644 --- a/runtime/druntime/src/core/stdc/locale.d +++ b/runtime/druntime/src/core/stdc/locale.d @@ -29,32 +29,70 @@ nothrow: @nogc: /// -struct lconv +version (Windows) { - char* decimal_point; - char* thousands_sep; - char* grouping; - char* int_curr_symbol; - char* currency_symbol; - char* mon_decimal_point; - char* mon_thousands_sep; - char* mon_grouping; - char* positive_sign; - char* negative_sign; - byte int_frac_digits; - byte frac_digits; - byte p_cs_precedes; - byte p_sep_by_space; - byte n_cs_precedes; - byte n_sep_by_space; - byte p_sign_posn; - byte n_sign_posn; - byte int_p_cs_precedes; - byte int_p_sep_by_space; - byte int_n_cs_precedes; - byte int_n_sep_by_space; - byte int_p_sign_posn; - byte int_n_sign_posn; + import core.stdc.wchar_ : wchar_t; + + // ...Windows Kits\10\Include\10.0.14393.0\ucrt\locale.h + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + char int_frac_digits = 0; // " = 0" For zero init + char frac_digits = 0; + char p_cs_precedes = 0; + char p_sep_by_space = 0; + char n_cs_precedes = 0; + char n_sep_by_space = 0; + char p_sign_posn = 0; + char n_sign_posn = 0; + wchar_t* _W_decimal_point; + wchar_t* _W_thousands_sep; + wchar_t* _W_int_curr_symbol; + wchar_t* _W_currency_symbol; + wchar_t* _W_mon_decimal_point; + wchar_t* _W_mon_thousands_sep; + wchar_t* _W_positive_sign; + wchar_t* _W_negative_sign; + } +} +else +{ + struct lconv + { + char* decimal_point; + char* thousands_sep; + char* grouping; + char* int_curr_symbol; + char* currency_symbol; + char* mon_decimal_point; + char* mon_thousands_sep; + char* mon_grouping; + char* positive_sign; + char* negative_sign; + byte int_frac_digits; + byte frac_digits; + byte p_cs_precedes; + byte p_sep_by_space; + byte n_cs_precedes; + byte n_sep_by_space; + byte p_sign_posn; + byte n_sign_posn; + byte int_p_cs_precedes; + byte int_p_sep_by_space; + byte int_n_cs_precedes; + byte int_n_sep_by_space; + byte int_p_sign_posn; + byte int_n_sign_posn; + } } version (CRuntime_Glibc) diff --git a/runtime/druntime/src/core/stdc/math.d b/runtime/druntime/src/core/stdc/math.d index c35aed8545d..665037f1af3 100644 --- a/runtime/druntime/src/core/stdc/math.d +++ b/runtime/druntime/src/core/stdc/math.d @@ -46,9 +46,9 @@ nothrow: @nogc: /// -alias float float_t; +alias float_t = float; /// -alias double double_t; +alias double_t = double; /// enum double HUGE_VAL = double.infinity; diff --git a/runtime/druntime/src/core/stdc/signal.d b/runtime/druntime/src/core/stdc/signal.d index 13c6f9efbe8..acd5ff9cbbe 100644 --- a/runtime/druntime/src/core/stdc/signal.d +++ b/runtime/druntime/src/core/stdc/signal.d @@ -20,9 +20,9 @@ nothrow: // this should be volatile /// -alias int sig_atomic_t; +alias sig_atomic_t = int; -private alias void function(int) sigfn_t; +private alias sigfn_t = void function(int); version (Posix) { diff --git a/runtime/druntime/src/core/stdc/stdarg.d b/runtime/druntime/src/core/stdc/stdarg.d index 147b4a29f74..112766c8384 100644 --- a/runtime/druntime/src/core/stdc/stdarg.d +++ b/runtime/druntime/src/core/stdc/stdarg.d @@ -15,29 +15,19 @@ module core.stdc.stdarg; @nogc: nothrow: +version (GNU) + public import core.internal.vararg.gnu; +else: + version (X86_64) { version (Windows) { /* different ABI */ } else version = SysV_x64; } -version (GNU) -{ - import gcc.builtins; -} -else version (SysV_x64) +version (SysV_x64) { static import core.internal.vararg.sysv_x64; - - version (DigitalMars) - { - align(16) struct __va_argsave_t - { - size_t[6] regs; // RDI,RSI,RDX,RCX,R8,R9 - real[8] fpregs; // XMM0..XMM7 - __va_list va; - } - } } version (ARM) version = ARM_Any; @@ -49,11 +39,7 @@ version (PPC64) version = PPC_Any; version (RISCV32) version = RISCV_Any; version (RISCV64) version = RISCV_Any; -version (GNU) -{ - // Uses gcc.builtins -} -else version (ARM_Any) +version (ARM_Any) { // Darwin and Windows use a simpler varargs implementation version (OSX) {} @@ -70,7 +56,7 @@ else version (ARM_Any) else version (AArch64) { version = AAPCS64; - static import core.internal.vararg.aarch64; + static import core.internal.vararg.aapcs64; } } @@ -108,15 +94,9 @@ version (BigEndian) /** * The argument pointer type. */ -version (GNU) +version (SysV_x64) { - alias va_list = __gnuc_va_list; - alias __gnuc_va_list = __builtin_va_list; -} -else version (SysV_x64) -{ - alias va_list = core.internal.vararg.sysv_x64.va_list; - public import core.internal.vararg.sysv_x64 : __va_list, __va_list_tag; + public import core.internal.vararg.sysv_x64 : va_list, __va_list, __va_list_tag; } else version (AAPCS32) { @@ -130,9 +110,9 @@ else version (AAPCS32) } else version (AAPCS64) { - alias va_list = core.internal.vararg.aarch64.va_list; + alias va_list = core.internal.vararg.aapcs64.va_list; version (DigitalMars) - public import core.internal.vararg.aarch64 : __va_list, __va_list_tag; + public import core.internal.vararg.aapcs64 : __va_list, __va_list_tag; } else version (RISCV_Any) { @@ -150,11 +130,7 @@ else * Initialize ap. * parmn should be the last named parameter. */ -version (GNU) -{ - void va_start(T)(out va_list ap, ref T parmn); -} -else version (LDC) +version (LDC) { pragma(LDC_va_start) void va_start(T)(out va_list ap, ref T parmn) @nogc; @@ -178,9 +154,6 @@ else version (DigitalMars) /** * Retrieve and return the next value that is of type T. */ -version (GNU) - T va_arg(T)(ref va_list ap); // intrinsic -else T va_arg(T)(ref va_list ap) { version (X86) @@ -230,7 +203,7 @@ T va_arg(T)(ref va_list ap) } else version (AAPCS64) { - return core.internal.vararg.aarch64.va_arg!T(ap); + return core.internal.vararg.aapcs64.va_arg!T(ap); } else version (ARM_Any) { @@ -296,9 +269,6 @@ T va_arg(T)(ref va_list ap) /** * Retrieve and store in parmn the next value that is of type T. */ -version (GNU) - void va_arg(T)(ref va_list ap, ref T parmn); // intrinsic -else void va_arg(T)(ref va_list ap, ref T parmn) { parmn = va_arg!T(ap); @@ -308,11 +278,7 @@ void va_arg(T)(ref va_list ap, ref T parmn) /** * End use of ap. */ -version (GNU) -{ - alias va_end = __builtin_va_end; -} -else version (LDC) +version (LDC) { pragma(LDC_va_end) void va_end(va_list ap); @@ -326,11 +292,7 @@ else version (DigitalMars) /** * Make a copy of ap. */ -version (GNU) -{ - alias va_copy = __builtin_va_copy; -} -else version (LDC) +version (LDC) { pragma(LDC_va_copy) void va_copy(out va_list dest, va_list src); diff --git a/runtime/druntime/src/core/stdc/stdatomic.d b/runtime/druntime/src/core/stdc/stdatomic.d index 51968af8c5f..8f4bc6e2e1f 100644 --- a/runtime/druntime/src/core/stdc/stdatomic.d +++ b/runtime/druntime/src/core/stdc/stdatomic.d @@ -165,27 +165,23 @@ void atomic_flag_clear_explicit_impl()(atomic_flag* obj, memory_order order) { assert(obj !is null); - final switch (order) - { - case memory_order.memory_order_relaxed: - atomicStore!(memory_order.memory_order_relaxed)(&obj.b, false); - break; + // use series of ternary expressions instead of switch to help the dmd inliner + order == memory_order.memory_order_relaxed ? + atomicStore!(memory_order.memory_order_relaxed)(&obj.b, false) : - case memory_order.memory_order_acquire: - case memory_order.memory_order_acq_rel: - // Ideally this would error at compile time but alas it is not an intrinsic. - // Note: this is not a valid memory order for this operation. - atomicStore!(memory_order.memory_order_seq_cst)(&obj.b, false); - break; + order == memory_order.memory_order_acquire || + order == memory_order.memory_order_acq_rel ? + // Ideally this would error at compile time but alas it is not an intrinsic. + // Note: this is not a valid memory order for this operation. + atomicStore!(memory_order.memory_order_seq_cst)(&obj.b, false) : - case memory_order.memory_order_release: - atomicStore!(memory_order.memory_order_release)(&obj.b, false); - break; + order == memory_order.memory_order_release ? + atomicStore!(memory_order.memory_order_release)(&obj.b, false) : - case memory_order.memory_order_seq_cst: - atomicStore(&obj.b, false); - break; - } + order == memory_order.memory_order_seq_cst ? + atomicStore(&obj.b, false) : + + cast(void) assert(0); } /// @@ -210,25 +206,26 @@ bool atomic_flag_test_and_set_explicit_impl()(atomic_flag* obj, memory_order ord { assert(obj !is null); - final switch (order) - { - case memory_order.memory_order_relaxed: - return atomicExchange!(memory_order.memory_order_relaxed)(&obj.b, true); + // use series of ternary expressions instead of switch to help the dmd inliner + return + order == memory_order.memory_order_relaxed ? + atomicExchange!(memory_order.memory_order_relaxed)(&obj.b, true) : - case memory_order.memory_order_acquire: + order == memory_order.memory_order_acquire ? // Ideally this would error at compile time but alas it is not an intrinsic. // Note: this is not a valid memory order for this operation. - return atomicExchange!(memory_order.memory_order_seq_cst)(&obj.b, true); + atomicExchange!(memory_order.memory_order_seq_cst)(&obj.b, true) : - case memory_order.memory_order_release: - return atomicExchange!(memory_order.memory_order_release)(&obj.b, true); + order == memory_order.memory_order_release ? + atomicExchange!(memory_order.memory_order_release)(&obj.b, true) : - case memory_order.memory_order_acq_rel: - return atomicExchange!(memory_order.memory_order_acq_rel)(&obj.b, true); + order == memory_order.memory_order_acq_rel ? + atomicExchange!(memory_order.memory_order_acq_rel)(&obj.b, true) : - case memory_order.memory_order_seq_cst: - return atomicExchange(&obj.b, true); - } + order == memory_order.memory_order_seq_cst ? + atomicExchange(&obj.b, true) : + + assert(0); } /// @@ -247,7 +244,10 @@ bool atomic_flag_test_and_set_explicit_impl()(atomic_flag* obj, memory_order ord pragma(inline, true) void atomic_init(A, C)(out shared(A) obj, C desired) @trusted { - obj = cast(shared) desired; + // C11 atomic_init is a low-level initialization primitive for atomic storage + // before it is published for concurrent access, so it must be able to write + // the backing object without demonstrating ordinary shared access. + *cast(A*) &obj = cast(A) desired; } /// @@ -271,28 +271,24 @@ A kill_dependency(A)(A y) @trusted pragma(inline, true) void atomic_signal_fence_impl()(memory_order order) { - final switch (order) - { - case memory_order.memory_order_relaxed: - // This is a no-op operation for relaxed memory orders. - break; + // use series of ternary expressions instead of switch to help the dmd inliner + order == memory_order.memory_order_relaxed ? + // This is a no-op operation for relaxed memory orders. + cast(void)0 : - case memory_order.memory_order_acquire: - atomicSignalFence!(memory_order.memory_order_acquire); - break; + order == memory_order.memory_order_acquire ? + atomicSignalFence!(memory_order.memory_order_acquire) : - case memory_order.memory_order_release: - atomicSignalFence!(memory_order.memory_order_release); - break; + order == memory_order.memory_order_release ? + atomicSignalFence!(memory_order.memory_order_release) : - case memory_order.memory_order_acq_rel: - atomicSignalFence!(memory_order.memory_order_acq_rel); - break; + order == memory_order.memory_order_acq_rel ? + atomicSignalFence!(memory_order.memory_order_acq_rel) : - case memory_order.memory_order_seq_cst: - atomicSignalFence!(memory_order.memory_order_seq_cst); - break; - } + order == memory_order.memory_order_seq_cst ? + atomicSignalFence!(memory_order.memory_order_seq_cst) : + + cast(void) assert(0); } /// @@ -305,28 +301,24 @@ unittest pragma(inline, true) void atomic_thread_fence_impl()(memory_order order) { - final switch (order) - { - case memory_order.memory_order_relaxed: - // This is a no-op operation for relaxed memory orders. - break; + // use series of ternary expressions instead of switch to help the dmd inliner + order == memory_order.memory_order_relaxed ? + // This is a no-op operation for relaxed memory orders. + cast(void)0 : - case memory_order.memory_order_acquire: - atomicFence!(memory_order.memory_order_acquire); - break; + order == memory_order.memory_order_acquire ? + atomicFence!(memory_order.memory_order_acquire) : - case memory_order.memory_order_release: - atomicFence!(memory_order.memory_order_release); - break; + order == memory_order.memory_order_release ? + atomicFence!(memory_order.memory_order_release) : - case memory_order.memory_order_acq_rel: - atomicFence!(memory_order.memory_order_acq_rel); - break; + order == memory_order.memory_order_acq_rel ? + atomicFence!(memory_order.memory_order_acq_rel) : - case memory_order.memory_order_seq_cst: - atomicFence!(memory_order.memory_order_seq_cst); - break; - } + order == memory_order.memory_order_seq_cst ? + atomicFence!(memory_order.memory_order_seq_cst) : + + cast(void) assert(0); } /// @@ -437,27 +429,23 @@ void atomic_store_explicit_impl(A, C)(shared(A)* obj, C desired, memory_order or { assert(obj !is null); - final switch (order) - { - case memory_order.memory_order_relaxed: - atomicStore!(memory_order.memory_order_relaxed)(cast(A*)obj, cast(A)desired); - break; + // use series of ternary expressions instead of switch to help the dmd inliner + order == memory_order.memory_order_relaxed ? + atomicStore!(memory_order.memory_order_relaxed)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_acquire: - case memory_order.memory_order_acq_rel: - // Ideally this would error at compile time but alas it is not an intrinsic. - // Note: this is not a valid memory order for this operation. - atomicStore!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired); - break; + order == memory_order.memory_order_acquire || + order == memory_order.memory_order_acq_rel ? + // Ideally this would error at compile time but alas it is not an intrinsic. + // Note: this is not a valid memory order for this operation. + atomicStore!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_release: - atomicStore!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired); - break; + order == memory_order.memory_order_release ? + atomicStore!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_seq_cst: - atomicStore!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired); - break; - } + order == memory_order.memory_order_seq_cst ? + atomicStore!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired) : + + cast(void) assert(0); } /// @@ -501,23 +489,24 @@ A atomic_load_explicit_impl(A)(const shared(A)* obj, memory_order order) @truste { assert(obj !is null); - final switch (order) - { - case memory_order.memory_order_relaxed: - return atomicLoad!(memory_order.memory_order_relaxed)(cast(A*)obj); + // use series of ternary expressions instead of switch to help the dmd inliner + return + order == memory_order.memory_order_relaxed ? + atomicLoad!(memory_order.memory_order_relaxed)(cast(A*)obj) : - case memory_order.memory_order_acquire: - return atomicLoad!(memory_order.memory_order_acquire)(cast(A*)obj); + order == memory_order.memory_order_acquire ? + atomicLoad!(memory_order.memory_order_acquire)(cast(A*)obj) : - case memory_order.memory_order_release: - case memory_order.memory_order_acq_rel: + order == memory_order.memory_order_release || + order == memory_order.memory_order_acq_rel ? // Ideally this would error at compile time but alas it is not an intrinsic. // Note: this is not a valid memory order for this operation. - return atomicLoad!(memory_order.memory_order_acquire)(cast(A*)obj); + atomicLoad!(memory_order.memory_order_acquire)(cast(A*)obj) : - case memory_order.memory_order_seq_cst: - return atomicLoad!(memory_order.memory_order_seq_cst)(cast(A*)obj); - } + order == memory_order.memory_order_seq_cst ? + atomicLoad!(memory_order.memory_order_seq_cst)(cast(A*)obj) : + + assert(0); } /// @@ -554,25 +543,26 @@ A atomic_exchange_explicit_impl(A, C)(shared(A)* obj, C desired, memory_order or { assert(obj !is null); - final switch (order) - { - case memory_order.memory_order_relaxed: - return atomicExchange!(memory_order.memory_order_relaxed)(cast(A*)obj, cast(A)desired); + // use series of ternary expressions instead of switch to help the dmd inliner + return + order == memory_order.memory_order_relaxed ? + atomicExchange!(memory_order.memory_order_relaxed)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_acquire: + order == memory_order.memory_order_acquire ? // Ideally this would error at compile time but alas it is not an intrinsic. // Note: this is not a valid memory order for this operation. - return atomicExchange!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired); + atomicExchange!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_release: - return atomicExchange!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired); + order == memory_order.memory_order_release ? + atomicExchange!(memory_order.memory_order_release)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_acq_rel: - return atomicExchange!(memory_order.memory_order_acq_rel)(cast(A*)obj, cast(A)desired); + order == memory_order.memory_order_acq_rel ? + atomicExchange!(memory_order.memory_order_acq_rel)(cast(A*)obj, cast(A)desired) : - case memory_order.memory_order_seq_cst: - return atomicExchange!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired); - } + order == memory_order.memory_order_seq_cst ? + atomicExchange!(memory_order.memory_order_seq_cst)(cast(A*)obj, cast(A)desired) : + + assert(0); } /// @@ -641,19 +631,19 @@ bool atomic_compare_exchange_strong_explicit_impl(A, B, C)(shared(A)* obj, B* ex assert(obj !is null); // NOTE: To not have to deal with all invalid cases, the failure model is ignored for now. - final switch(succ) - { - case memory_order.memory_order_relaxed: - return atomicCompareExchangeStrong!(memory_order.memory_order_relaxed, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_acquire: - return atomicCompareExchangeStrong!(memory_order.memory_order_acquire, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_release: - return atomicCompareExchangeStrong!(memory_order.memory_order_release, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_acq_rel: - return atomicCompareExchangeStrong!(memory_order.memory_order_acq_rel, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_seq_cst: - return atomicCompareExchangeStrong!(memory_order.memory_order_seq_cst, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - } + // use series of ternary expressions instead of switch to help the dmd inliner + return + succ == memory_order.memory_order_relaxed ? + atomicCompareExchangeStrong!(memory_order.memory_order_relaxed, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_acquire ? + atomicCompareExchangeStrong!(memory_order.memory_order_acquire, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_release ? + atomicCompareExchangeStrong!(memory_order.memory_order_release, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_acq_rel ? + atomicCompareExchangeStrong!(memory_order.memory_order_acq_rel, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_seq_cst ? + atomicCompareExchangeStrong!(memory_order.memory_order_seq_cst, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + assert(0); } /// @@ -689,19 +679,19 @@ bool atomic_compare_exchange_weak_explicit_impl(A, B, C)(shared(A)* obj, B* expe assert(obj !is null); // NOTE: To not have to deal with all invalid cases, the failure model is ignored for now. - final switch(succ) - { - case memory_order.memory_order_relaxed: - return atomicCompareExchangeWeak!(memory_order.memory_order_relaxed, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_acquire: - return atomicCompareExchangeWeak!(memory_order.memory_order_acquire, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_release: - return atomicCompareExchangeWeak!(memory_order.memory_order_release, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_acq_rel: - return atomicCompareExchangeWeak!(memory_order.memory_order_acq_rel, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - case memory_order.memory_order_seq_cst: - return atomicCompareExchangeWeak!(memory_order.memory_order_seq_cst, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired); - } + // use series of ternary expressions instead of switch to help the dmd inliner + return + succ == memory_order.memory_order_relaxed ? + atomicCompareExchangeWeak!(memory_order.memory_order_relaxed, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_acquire ? + atomicCompareExchangeWeak!(memory_order.memory_order_acquire, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_release ? + atomicCompareExchangeWeak!(memory_order.memory_order_release, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_acq_rel ? + atomicCompareExchangeWeak!(memory_order.memory_order_acq_rel, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + succ == memory_order.memory_order_seq_cst ? + atomicCompareExchangeWeak!(memory_order.memory_order_seq_cst, memory_order.memory_order_relaxed)(cast(B*)obj, expected, cast(B)desired) : + assert(0); } /// @@ -774,19 +764,19 @@ A atomic_fetch_add_explicit_impl(A, M)(shared(A)* obj, M arg, memory_order order { assert(obj !is null); - final switch(order) - { - case memory_order.memory_order_relaxed: - return atomic_fetch_op!(memory_order.memory_order_relaxed, "+=")(cast(A*)obj, arg); - case memory_order.memory_order_acquire: - return atomic_fetch_op!(memory_order.memory_order_acquire, "+=")(cast(A*)obj, arg); - case memory_order.memory_order_release: - return atomic_fetch_op!(memory_order.memory_order_release, "+=")(cast(A*)obj, arg); - case memory_order.memory_order_acq_rel: - return atomic_fetch_op!(memory_order.memory_order_acq_rel, "+=")(cast(A*)obj, arg); - case memory_order.memory_order_seq_cst: - return atomic_fetch_op!(memory_order.memory_order_seq_cst, "+=")(cast(A*)obj, arg); - } + // use series of ternary expressions instead of switch to help the dmd inliner + return + order == memory_order.memory_order_relaxed ? + atomic_fetch_op!(memory_order.memory_order_relaxed, "+=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acquire ? + atomic_fetch_op!(memory_order.memory_order_acquire, "+=")(cast(A*)obj, arg) : + order == memory_order.memory_order_release ? + atomic_fetch_op!(memory_order.memory_order_release, "+=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acq_rel ? + atomic_fetch_op!(memory_order.memory_order_acq_rel, "+=")(cast(A*)obj, arg) : + order == memory_order.memory_order_seq_cst ? + atomic_fetch_op!(memory_order.memory_order_seq_cst, "+=")(cast(A*)obj, arg) : + assert(0); } /// @@ -807,19 +797,18 @@ A atomic_fetch_sub_explicit_impl(A, M)(shared(A)* obj, M arg, memory_order order { assert(obj !is null); - final switch(order) - { - case memory_order.memory_order_relaxed: - return atomic_fetch_op!(memory_order.memory_order_relaxed, "-=")(cast(A*)obj, arg); - case memory_order.memory_order_acquire: - return atomic_fetch_op!(memory_order.memory_order_acquire, "-=")(cast(A*)obj, arg); - case memory_order.memory_order_release: - return atomic_fetch_op!(memory_order.memory_order_release, "-=")(cast(A*)obj, arg); - case memory_order.memory_order_acq_rel: - return atomic_fetch_op!(memory_order.memory_order_acq_rel, "-=")(cast(A*)obj, arg); - case memory_order.memory_order_seq_cst: - return atomic_fetch_op!(memory_order.memory_order_seq_cst, "-=")(cast(A*)obj, arg); - } + return + order == memory_order.memory_order_relaxed ? + atomic_fetch_op!(memory_order.memory_order_relaxed, "-=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acquire ? + atomic_fetch_op!(memory_order.memory_order_acquire, "-=")(cast(A*)obj, arg) : + order == memory_order.memory_order_release ? + atomic_fetch_op!(memory_order.memory_order_release, "-=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acq_rel ? + atomic_fetch_op!(memory_order.memory_order_acq_rel, "-=")(cast(A*)obj, arg) : + order == memory_order.memory_order_seq_cst ? + atomic_fetch_op!(memory_order.memory_order_seq_cst, "-=")(cast(A*)obj, arg) : + assert(0); } /// @@ -856,19 +845,18 @@ A atomic_fetch_or_explicit_impl(A, M)(shared(A)* obj, M arg, memory_order order) { assert(obj !is null); - final switch(order) - { - case memory_order.memory_order_relaxed: - return atomic_fetch_op!(memory_order.memory_order_relaxed, "|=")(cast(A*)obj, arg); - case memory_order.memory_order_acquire: - return atomic_fetch_op!(memory_order.memory_order_acquire, "|=")(cast(A*)obj, arg); - case memory_order.memory_order_release: - return atomic_fetch_op!(memory_order.memory_order_release, "|=")(cast(A*)obj, arg); - case memory_order.memory_order_acq_rel: - return atomic_fetch_op!(memory_order.memory_order_acq_rel, "|=")(cast(A*)obj, arg); - case memory_order.memory_order_seq_cst: - return atomic_fetch_op!(memory_order.memory_order_seq_cst, "|=")(cast(A*)obj, arg); - } + return + order == memory_order.memory_order_relaxed ? + atomic_fetch_op!(memory_order.memory_order_relaxed, "|=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acquire ? + atomic_fetch_op!(memory_order.memory_order_acquire, "|=")(cast(A*)obj, arg) : + order == memory_order.memory_order_release ? + atomic_fetch_op!(memory_order.memory_order_release, "|=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acq_rel ? + atomic_fetch_op!(memory_order.memory_order_acq_rel, "|=")(cast(A*)obj, arg) : + order == memory_order.memory_order_seq_cst ? + atomic_fetch_op!(memory_order.memory_order_seq_cst, "|=")(cast(A*)obj, arg) : + assert(0); } /// @@ -901,19 +889,18 @@ A atomic_fetch_xor_explicit_impl(A, M)(shared(A)* obj, M arg, memory_order order { assert(obj !is null); - final switch(order) - { - case memory_order.memory_order_relaxed: - return atomic_fetch_op!(memory_order.memory_order_relaxed, "^=")(cast(A*)obj, arg); - case memory_order.memory_order_acquire: - return atomic_fetch_op!(memory_order.memory_order_acquire, "^=")(cast(A*)obj, arg); - case memory_order.memory_order_release: - return atomic_fetch_op!(memory_order.memory_order_release, "^=")(cast(A*)obj, arg); - case memory_order.memory_order_acq_rel: - return atomic_fetch_op!(memory_order.memory_order_acq_rel, "^=")(cast(A*)obj, arg); - case memory_order.memory_order_seq_cst: - return atomic_fetch_op!(memory_order.memory_order_seq_cst, "^=")(cast(A*)obj, arg); - } + return + order == memory_order.memory_order_relaxed ? + atomic_fetch_op!(memory_order.memory_order_relaxed, "^=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acquire ? + atomic_fetch_op!(memory_order.memory_order_acquire, "^=")(cast(A*)obj, arg) : + order == memory_order.memory_order_release ? + atomic_fetch_op!(memory_order.memory_order_release, "^=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acq_rel ? + atomic_fetch_op!(memory_order.memory_order_acq_rel, "^=")(cast(A*)obj, arg) : + order == memory_order.memory_order_seq_cst ? + atomic_fetch_op!(memory_order.memory_order_seq_cst, "^=")(cast(A*)obj, arg) : + assert(0); } /// @@ -946,19 +933,18 @@ A atomic_fetch_and_explicit_impl(A, M)(shared(A)* obj, M arg, memory_order order { assert(obj !is null); - final switch(order) - { - case memory_order.memory_order_relaxed: - return atomic_fetch_op!(memory_order.memory_order_relaxed, "&=")(cast(A*)obj, arg); - case memory_order.memory_order_acquire: - return atomic_fetch_op!(memory_order.memory_order_acquire, "&=")(cast(A*)obj, arg); - case memory_order.memory_order_release: - return atomic_fetch_op!(memory_order.memory_order_release, "&=")(cast(A*)obj, arg); - case memory_order.memory_order_acq_rel: - return atomic_fetch_op!(memory_order.memory_order_acq_rel, "&=")(cast(A*)obj, arg); - case memory_order.memory_order_seq_cst: - return atomic_fetch_op!(memory_order.memory_order_seq_cst, "&=")(cast(A*)obj, arg); - } + return + order == memory_order.memory_order_relaxed ? + atomic_fetch_op!(memory_order.memory_order_relaxed, "&=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acquire ? + atomic_fetch_op!(memory_order.memory_order_acquire, "&=")(cast(A*)obj, arg) : + order == memory_order.memory_order_release ? + atomic_fetch_op!(memory_order.memory_order_release, "&=")(cast(A*)obj, arg) : + order == memory_order.memory_order_acq_rel ? + atomic_fetch_op!(memory_order.memory_order_acq_rel, "&=")(cast(A*)obj, arg) : + order == memory_order.memory_order_seq_cst ? + atomic_fetch_op!(memory_order.memory_order_seq_cst, "&=")(cast(A*)obj, arg) : + assert(0); } /// @@ -971,11 +957,11 @@ unittest private: -pragma(inline, true) A atomic_fetch_op(memory_order order, string op, A, M)(A* obj, M arg) @trusted { static if (is(A : ulong) && (op == "+=" || op == "-=")) { + pragma(inline, true) // these cannot handle floats static if (op == "+=") { diff --git a/runtime/druntime/src/core/stdc/stddef.d b/runtime/druntime/src/core/stdc/stddef.d index 56b3c9b3f90..828ccb42a85 100644 --- a/runtime/druntime/src/core/stdc/stddef.d +++ b/runtime/druntime/src/core/stdc/stddef.d @@ -27,15 +27,15 @@ alias nullptr_t = typeof(null); version (Windows) { /// - alias wchar wchar_t; + alias wchar_t = wchar; } else version (Posix) { /// - alias dchar wchar_t; + alias wchar_t = dchar; } else version (WASI) { /// - alias dchar wchar_t; + alias wchar_t = dchar; } diff --git a/runtime/druntime/src/core/stdc/stdint.d b/runtime/druntime/src/core/stdc/stdint.d index 4f9b98cd8ce..385f4ca5dde 100644 --- a/runtime/druntime/src/core/stdc/stdint.d +++ b/runtime/druntime/src/core/stdc/stdint.d @@ -337,7 +337,10 @@ else version (OpenBSD) } else version (Solaris) { - alias int8_t = char; /// + version (GNU) + alias int8_t = byte; /// + else + alias int8_t = char; /// alias int16_t = short; /// alias uint8_t = ubyte; /// alias uint16_t = ushort; /// @@ -346,7 +349,10 @@ else version (Solaris) alias int64_t = long; /// alias uint64_t = ulong; /// - alias int_least8_t = char; /// + version (GNU) + alias int_least8_t = byte; /// + else + alias int_least8_t = char; /// alias uint_least8_t = ubyte; /// alias int_least16_t = short; /// alias uint_least16_t = ushort; /// @@ -355,7 +361,10 @@ else version (Solaris) alias int_least64_t = long; /// alias uint_least64_t = ulong; /// - alias int_fast8_t = char; /// + version (GNU) + alias int_fast8_t = byte; /// + else + alias int_fast8_t = char; /// alias uint_fast8_t = ubyte; /// alias int_fast16_t = int; /// alias uint_fast16_t = uint; /// diff --git a/runtime/druntime/src/core/stdc/stdio.d b/runtime/druntime/src/core/stdc/stdio.d index b493a7fa856..adb9f9d9a00 100644 --- a/runtime/druntime/src/core/stdc/stdio.d +++ b/runtime/druntime/src/core/stdc/stdio.d @@ -373,7 +373,7 @@ enum version (CRuntime_Microsoft) { /// - alias long fpos_t; + alias fpos_t = long; /// struct _iobuf @@ -382,7 +382,7 @@ version (CRuntime_Microsoft) } /// - alias shared(_iobuf) FILE; + alias FILE = shared(_iobuf); } else version (CRuntime_Glibc) { @@ -432,9 +432,9 @@ else version (CRuntime_Glibc) } /// - alias _IO_FILE _iobuf; + alias _iobuf = _IO_FILE; /// - alias shared(_IO_FILE) FILE; + alias FILE = shared(_IO_FILE); } else version (WASI) { @@ -446,9 +446,9 @@ else version (WASI) struct _IO_FILE; /// - alias _IO_FILE _iobuf; // needed for phobos + alias _iobuf = _IO_FILE; // needed for phobos /// - alias shared(_IO_FILE) FILE; + alias FILE = shared(_IO_FILE); } else version (CRuntime_Musl) { @@ -460,14 +460,14 @@ else version (CRuntime_Musl) struct _IO_FILE; /// - alias _IO_FILE _iobuf; // needed for phobos + alias _iobuf = _IO_FILE; // needed for phobos /// - alias shared(_IO_FILE) FILE; + alias FILE = shared(_IO_FILE); } else version (Darwin) { /// - alias long fpos_t; + alias fpos_t = long; /// struct __sFILE @@ -500,9 +500,9 @@ else version (Darwin) } /// - alias __sFILE _iobuf; + alias _iobuf = __sFILE; /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (FreeBSD) { @@ -510,7 +510,7 @@ else version (FreeBSD) import core.stdc.wchar_ : mbstate_t; /// - alias off_t fpos_t; + alias fpos_t = off_t; /// struct __sFILE @@ -549,14 +549,14 @@ else version (FreeBSD) } /// - alias __sFILE _iobuf; + alias _iobuf = __sFILE; /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (NetBSD) { /// - alias off_t fpos_t; + alias fpos_t = off_t; /// struct __sFILE @@ -593,9 +593,9 @@ else version (NetBSD) } /// - alias __sFILE _iobuf; + alias _iobuf = __sFILE; /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (OpenBSD) { @@ -609,13 +609,13 @@ else version (OpenBSD) } /// - alias __sFILE _iobuf; + alias _iobuf = __sFILE; /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (DragonFlyBSD) { - alias off_t fpos_t; + alias fpos_t = off_t; /// See /usr/include/stdio.h struct __FILE_public @@ -628,15 +628,15 @@ else version (DragonFlyBSD) ssize_t _lbfsize; /* 0 or -_bf._size, for inline putc */ } - alias __FILE_public _iobuf; - alias shared(__FILE_public) FILE; + alias _iobuf = __FILE_public; + alias FILE = shared(__FILE_public); } else version (Solaris) { import core.stdc.wchar_ : mbstate_t; /// - alias c_long fpos_t; + alias fpos_t = c_long; version (D_LP64) { @@ -673,12 +673,12 @@ else version (Solaris) } } /// - alias shared(_iobuf) FILE; + alias FILE = shared(_iobuf); } else version (CRuntime_Bionic) { /// - alias c_long fpos_t; // couldn't use off_t because of static if issue + alias fpos_t = c_long; // couldn't use off_t because of static if issue /// struct __sFILE @@ -711,9 +711,9 @@ else version (CRuntime_Bionic) } /// - alias __sFILE _iobuf; + alias _iobuf = __sFILE; /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (CRuntime_Newlib) { @@ -762,9 +762,9 @@ else version (CRuntime_Newlib) } /// - alias __sFILE _iobuf; // needed for phobos + alias _iobuf = __sFILE; // needed for phobos /// - alias shared(__sFILE) FILE; + alias FILE = shared(__sFILE); } else version (CRuntime_UClibc) { @@ -788,7 +788,7 @@ else version (CRuntime_UClibc) int function(void* __cookie) close; } - alias _IO_cookie_io_functions_t cookie_io_functions_t; + alias cookie_io_functions_t = _IO_cookie_io_functions_t; /// struct __STDIO_FILE_STRUCT @@ -813,9 +813,9 @@ else version (CRuntime_UClibc) } /// - alias __STDIO_FILE_STRUCT _iobuf; + alias _iobuf = __STDIO_FILE_STRUCT; /// - alias shared(__STDIO_FILE_STRUCT) FILE; + alias FILE = shared(__STDIO_FILE_STRUCT); } else { @@ -925,11 +925,11 @@ else version (Darwin) private extern shared FILE* __stderrp; /// - alias __stdinp stdin; + alias stdin = __stdinp; /// - alias __stdoutp stdout; + alias stdout = __stdoutp; /// - alias __stderrp stderr; + alias stderr = __stderrp; } else version (FreeBSD) { @@ -948,11 +948,11 @@ else version (FreeBSD) private extern shared FILE* __stderrp; /// - alias __stdinp stdin; + alias stdin = __stdinp; /// - alias __stdoutp stdout; + alias stdout = __stdoutp; /// - alias __stderrp stderr; + alias stderr = __stderrp; } else version (NetBSD) { @@ -971,11 +971,11 @@ else version (NetBSD) @property auto __stdout()() { return &__sF[1]; } @property auto __stderr()() { return &__sF[2]; } /// - alias __stdin stdin; + alias stdin = __stdin; /// - alias __stdout stdout; + alias stdout = __stdout; /// - alias __stderr stderr; + alias stderr = __stderr; } else version (OpenBSD) { @@ -1000,11 +1000,11 @@ else version (OpenBSD) @property auto __stderr1()() { return cast(FILE*)__stderr; } /// - alias __stdin1 stdin; + alias stdin = __stdin1; /// - alias __stdout1 stdout; + alias stdout = __stdout1; /// - alias __stderr1 stderr; + alias stderr = __stderr1; } else version (DragonFlyBSD) { @@ -1019,9 +1019,9 @@ else version (DragonFlyBSD) private extern shared FILE* __stdoutp; private extern shared FILE* __stderrp; - alias __stdinp stdin; - alias __stdoutp stdout; - alias __stderrp stderr; + alias stdin = __stdinp; + alias stdout = __stdoutp; + alias stderr = __stderrp; } else version (Solaris) { @@ -1209,73 +1209,73 @@ version (MinGW) pragma(printf) int __mingw_fprintf(FILE* stream, scope const char* format, scope const ...); /// - alias __mingw_fprintf fprintf; + alias fprintf = __mingw_fprintf; /// pragma(scanf) int __mingw_fscanf(FILE* stream, scope const char* format, scope ...); /// - alias __mingw_fscanf fscanf; + alias fscanf = __mingw_fscanf; /// pragma(printf) int __mingw_sprintf(scope char* s, scope const char* format, scope const ...); /// - alias __mingw_sprintf sprintf; + alias sprintf = __mingw_sprintf; /// pragma(scanf) int __mingw_sscanf(scope const char* s, scope const char* format, scope ...); /// - alias __mingw_sscanf sscanf; + alias sscanf = __mingw_sscanf; /// pragma(printf) int __mingw_vfprintf(FILE* stream, scope const char* format, va_list arg); /// - alias __mingw_vfprintf vfprintf; + alias vfprintf = __mingw_vfprintf; /// pragma(scanf) int __mingw_vfscanf(FILE* stream, scope const char* format, va_list arg); /// - alias __mingw_vfscanf vfscanf; + alias vfscanf = __mingw_vfscanf; /// pragma(printf) int __mingw_vsprintf(scope char* s, scope const char* format, va_list arg); /// - alias __mingw_vsprintf vsprintf; + alias vsprintf = __mingw_vsprintf; /// pragma(scanf) int __mingw_vsscanf(scope const char* s, scope const char* format, va_list arg); /// - alias __mingw_vsscanf vsscanf; + alias vsscanf = __mingw_vsscanf; /// pragma(printf) int __mingw_vprintf(scope const char* format, va_list arg); /// - alias __mingw_vprintf vprintf; + alias vprintf = __mingw_vprintf; /// pragma(scanf) int __mingw_vscanf(scope const char* format, va_list arg); /// - alias __mingw_vscanf vscanf; + alias vscanf = __mingw_vscanf; /// pragma(printf) int __mingw_printf(scope const char* format, scope const ...); /// - alias __mingw_printf printf; + alias printf = __mingw_printf; /// pragma(scanf) int __mingw_scanf(scope const char* format, scope ...); /// - alias __mingw_scanf scanf; + alias scanf = __mingw_scanf; } else version (CRuntime_Glibc) { @@ -1475,10 +1475,22 @@ size_t fwrite(scope const void* ptr, size_t size, size_t nmemb, FILE* stream); // No unsafe pointer manipulation. @trusted { - /// - int fgetpos(FILE* stream, scope fpos_t * pos); - /// - int fsetpos(FILE* stream, scope const fpos_t* pos); + version (NetBSD) + { + /// + pragma(mangle, "__fgetpos50") + int fgetpos(FILE* stream, scope fpos_t * pos); + /// + pragma(mangle, "__fsetpos50") + int fsetpos(FILE* stream, scope const fpos_t* pos); + } + else + { + /// + int fgetpos(FILE* stream, scope fpos_t * pos); + /// + int fsetpos(FILE* stream, scope const fpos_t* pos); + } /// int fseek(FILE* stream, c_long offset, int whence); @@ -1508,17 +1520,17 @@ version (CRuntime_Microsoft) pragma(printf) int __mingw_snprintf(scope char* s, size_t n, scope const char* fmt, scope const ...); /// - alias __mingw_snprintf _snprintf; + alias _snprintf = __mingw_snprintf; /// - alias __mingw_snprintf snprintf; + alias snprintf = __mingw_snprintf; /// pragma(printf) int __mingw_vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg); /// - alias __mingw_vsnprintf _vsnprintf; + alias _vsnprintf = __mingw_vsnprintf; /// - alias __mingw_vsnprintf vsnprintf; + alias vsnprintf = __mingw_vsnprintf; } else { @@ -1703,14 +1715,14 @@ else version (OpenBSD) { /// void rewind(FILE*); - /// - pure void clearerr(FILE*); - /// - pure int feof(FILE*); - /// - pure int ferror(FILE*); - /// - int fileno(FILE*); + /// + pure void clearerr(FILE*); + /// + pure int feof(FILE*); + /// + pure int ferror(FILE*); + /// + int fileno(FILE*); } /// diff --git a/runtime/druntime/src/core/stdc/stdlib.d b/runtime/druntime/src/core/stdc/stdlib.d index 52fa1d0f70c..fba91609f1e 100644 --- a/runtime/druntime/src/core/stdc/stdlib.d +++ b/runtime/druntime/src/core/stdc/stdlib.d @@ -133,7 +133,7 @@ version (CRuntime_Microsoft) /// real __mingw_strtold(scope inout(char)* nptr, scope inout(char)** endptr); /// - alias __mingw_strtold strtold; + alias strtold = __mingw_strtold; } else { diff --git a/runtime/druntime/src/core/stdc/tgmath.d b/runtime/druntime/src/core/stdc/tgmath.d index 2d1a198543f..692912f576c 100644 --- a/runtime/druntime/src/core/stdc/tgmath.d +++ b/runtime/druntime/src/core/stdc/tgmath.d @@ -26,498 +26,498 @@ nothrow: version (NetBSD) { /// - alias core.stdc.math.acos acos; + alias acos = core.stdc.math.acos; /// - alias core.stdc.math.acosf acos; + alias acos = core.stdc.math.acosf; /// - alias core.stdc.math.acosl acos; + alias acos = core.stdc.math.acosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacos acos; - deprecated alias core.stdc.complex.cacosf acos; - deprecated alias core.stdc.complex.cacosl acos; + deprecated alias acos = core.stdc.complex.cacos; + deprecated alias acos = core.stdc.complex.cacosf; + deprecated alias acos = core.stdc.complex.cacosl; /// - alias core.stdc.math.asin asin; + alias asin = core.stdc.math.asin; /// - alias core.stdc.math.asinf asin; + alias asin = core.stdc.math.asinf; /// - alias core.stdc.math.asinl asin; + alias asin = core.stdc.math.asinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casin asin; - deprecated alias core.stdc.complex.casinf asin; - deprecated alias core.stdc.complex.casinl asin; + deprecated alias asin = core.stdc.complex.casin; + deprecated alias asin = core.stdc.complex.casinf; + deprecated alias asin = core.stdc.complex.casinl; /// - alias core.stdc.math.atan atan; + alias atan = core.stdc.math.atan; /// - alias core.stdc.math.atanf atan; + alias atan = core.stdc.math.atanf; /// - alias core.stdc.math.atanl atan; + alias atan = core.stdc.math.atanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catan atan; - deprecated alias core.stdc.complex.catanf atan; - deprecated alias core.stdc.complex.catanl atan; + deprecated alias atan = core.stdc.complex.catan; + deprecated alias atan = core.stdc.complex.catanf; + deprecated alias atan = core.stdc.complex.catanl; /// - alias core.stdc.math.atan2 atan2; + alias atan2 = core.stdc.math.atan2; /// - alias core.stdc.math.atan2f atan2; + alias atan2 = core.stdc.math.atan2f; /// - alias core.stdc.math.atan2l atan2; + alias atan2 = core.stdc.math.atan2l; /// - alias core.stdc.math.cos cos; + alias cos = core.stdc.math.cos; /// - alias core.stdc.math.cosf cos; + alias cos = core.stdc.math.cosf; /// - alias core.stdc.math.cosl cos; + alias cos = core.stdc.math.cosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccos cos; - deprecated alias core.stdc.complex.ccosf cos; - deprecated alias core.stdc.complex.ccosl cos; + deprecated alias cos = core.stdc.complex.ccos; + deprecated alias cos = core.stdc.complex.ccosf; + deprecated alias cos = core.stdc.complex.ccosl; /// - alias core.stdc.math.sin sin; + alias sin = core.stdc.math.sin; /// - alias core.stdc.math.sinf sin; + alias sin = core.stdc.math.sinf; /// - alias core.stdc.math.sinl sin; + alias sin = core.stdc.math.sinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csin csin; - deprecated alias core.stdc.complex.csinf csin; - deprecated alias core.stdc.complex.csinl csin; + deprecated alias csin = core.stdc.complex.csin; + deprecated alias csin = core.stdc.complex.csinf; + deprecated alias csin = core.stdc.complex.csinl; /// - alias core.stdc.math.tan tan; + alias tan = core.stdc.math.tan; /// - alias core.stdc.math.tanf tan; + alias tan = core.stdc.math.tanf; /// - alias core.stdc.math.tanl tan; + alias tan = core.stdc.math.tanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctan tan; - deprecated alias core.stdc.complex.ctanf tan; - deprecated alias core.stdc.complex.ctanl tan; + deprecated alias tan = core.stdc.complex.ctan; + deprecated alias tan = core.stdc.complex.ctanf; + deprecated alias tan = core.stdc.complex.ctanl; /// - alias core.stdc.math.acosh acosh; + alias acosh = core.stdc.math.acosh; /// - alias core.stdc.math.acoshf acosh; + alias acosh = core.stdc.math.acoshf; /// - alias core.stdc.math.acoshl acosh; + alias acosh = core.stdc.math.acoshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacosh acosh; - deprecated alias core.stdc.complex.cacoshf acosh; - deprecated alias core.stdc.complex.cacoshl acosh; + deprecated alias acosh = core.stdc.complex.cacosh; + deprecated alias acosh = core.stdc.complex.cacoshf; + deprecated alias acosh = core.stdc.complex.cacoshl; /// - alias core.stdc.math.asinh asinh; + alias asinh = core.stdc.math.asinh; /// - alias core.stdc.math.asinhf asinh; + alias asinh = core.stdc.math.asinhf; /// - alias core.stdc.math.asinhl asinh; + alias asinh = core.stdc.math.asinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casinh asinh; - deprecated alias core.stdc.complex.casinhf asinh; - deprecated alias core.stdc.complex.casinhl asinh; + deprecated alias asinh = core.stdc.complex.casinh; + deprecated alias asinh = core.stdc.complex.casinhf; + deprecated alias asinh = core.stdc.complex.casinhl; /// - alias core.stdc.math.atanh atanh; + alias atanh = core.stdc.math.atanh; /// - alias core.stdc.math.atanhf atanh; + alias atanh = core.stdc.math.atanhf; /// - alias core.stdc.math.atanhl atanh; + alias atanh = core.stdc.math.atanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catanh atanh; - deprecated alias core.stdc.complex.catanhf atanh; - deprecated alias core.stdc.complex.catanhl atanh; + deprecated alias atanh = core.stdc.complex.catanh; + deprecated alias atanh = core.stdc.complex.catanhf; + deprecated alias atanh = core.stdc.complex.catanhl; /// - alias core.stdc.math.cosh cosh; + alias cosh = core.stdc.math.cosh; /// - alias core.stdc.math.coshf cosh; + alias cosh = core.stdc.math.coshf; /// - alias core.stdc.math.coshl cosh; + alias cosh = core.stdc.math.coshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccosh cosh; - deprecated alias core.stdc.complex.ccoshf cosh; - deprecated alias core.stdc.complex.ccoshl cosh; + deprecated alias cosh = core.stdc.complex.ccosh; + deprecated alias cosh = core.stdc.complex.ccoshf; + deprecated alias cosh = core.stdc.complex.ccoshl; /// - alias core.stdc.math.sinh sinh; + alias sinh = core.stdc.math.sinh; /// - alias core.stdc.math.sinhf sinh; + alias sinh = core.stdc.math.sinhf; /// - alias core.stdc.math.sinhl sinh; + alias sinh = core.stdc.math.sinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csinh sinh; - deprecated alias core.stdc.complex.csinhf sinh; - deprecated alias core.stdc.complex.csinhl sinh; + deprecated alias sinh = core.stdc.complex.csinh; + deprecated alias sinh = core.stdc.complex.csinhf; + deprecated alias sinh = core.stdc.complex.csinhl; /// - alias core.stdc.math.tanh tanh; + alias tanh = core.stdc.math.tanh; /// - alias core.stdc.math.tanhf tanh; + alias tanh = core.stdc.math.tanhf; /// - alias core.stdc.math.tanhl tanh; + alias tanh = core.stdc.math.tanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctanh tanh; - deprecated alias core.stdc.complex.ctanhf tanh; - deprecated alias core.stdc.complex.ctanhl tanh; + deprecated alias tanh = core.stdc.complex.ctanh; + deprecated alias tanh = core.stdc.complex.ctanhf; + deprecated alias tanh = core.stdc.complex.ctanhl; /// - alias core.stdc.math.exp exp; + alias exp = core.stdc.math.exp; /// - alias core.stdc.math.expf exp; + alias exp = core.stdc.math.expf; /// - alias core.stdc.math.expl exp; + alias exp = core.stdc.math.expl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cexp exp; - deprecated alias core.stdc.complex.cexpf exp; - deprecated alias core.stdc.complex.cexpl exp; + deprecated alias exp = core.stdc.complex.cexp; + deprecated alias exp = core.stdc.complex.cexpf; + deprecated alias exp = core.stdc.complex.cexpl; /// - alias core.stdc.math.exp2 exp2; + alias exp2 = core.stdc.math.exp2; /// - alias core.stdc.math.exp2f exp2; + alias exp2 = core.stdc.math.exp2f; /// - alias core.stdc.math.exp2l exp2; + alias exp2 = core.stdc.math.exp2l; /// - alias core.stdc.math.expm1 expm1; + alias expm1 = core.stdc.math.expm1; /// - alias core.stdc.math.expm1f expm1; + alias expm1 = core.stdc.math.expm1f; /// - alias core.stdc.math.expm1l expm1; + alias expm1 = core.stdc.math.expm1l; /// - alias core.stdc.math.frexp frexp; + alias frexp = core.stdc.math.frexp; /// - alias core.stdc.math.frexpf frexp; + alias frexp = core.stdc.math.frexpf; /// - alias core.stdc.math.frexpl frexp; + alias frexp = core.stdc.math.frexpl; /// - alias core.stdc.math.ilogb ilogb; + alias ilogb = core.stdc.math.ilogb; /// - alias core.stdc.math.ilogbf ilogb; + alias ilogb = core.stdc.math.ilogbf; /// - alias core.stdc.math.ilogbl ilogb; + alias ilogb = core.stdc.math.ilogbl; /// - alias core.stdc.math.ldexp ldexp; + alias ldexp = core.stdc.math.ldexp; /// - alias core.stdc.math.ldexpf ldexp; + alias ldexp = core.stdc.math.ldexpf; /// - alias core.stdc.math.ldexpl ldexp; + alias ldexp = core.stdc.math.ldexpl; /// - alias core.stdc.math.log log; + alias log = core.stdc.math.log; /// - alias core.stdc.math.logf log; + alias log = core.stdc.math.logf; /// - alias core.stdc.math.logl log; + alias log = core.stdc.math.logl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.clog log; - deprecated alias core.stdc.complex.clogf log; - deprecated alias core.stdc.complex.clogl log; + deprecated alias log = core.stdc.complex.clog; + deprecated alias log = core.stdc.complex.clogf; + deprecated alias log = core.stdc.complex.clogl; /// - alias core.stdc.math.log10 log10; + alias log10 = core.stdc.math.log10; /// - alias core.stdc.math.log10f log10; + alias log10 = core.stdc.math.log10f; /// - alias core.stdc.math.log10l log10; + alias log10 = core.stdc.math.log10l; /// - alias core.stdc.math.log1p log1p; + alias log1p = core.stdc.math.log1p; /// - alias core.stdc.math.log1pf log1p; + alias log1p = core.stdc.math.log1pf; /// - alias core.stdc.math.log1pl log1p; + alias log1p = core.stdc.math.log1pl; /// - alias core.stdc.math.log2 log2; + alias log2 = core.stdc.math.log2; /// - alias core.stdc.math.log2f log2; + alias log2 = core.stdc.math.log2f; /// - alias core.stdc.math.log2l log2; + alias log2 = core.stdc.math.log2l; /// - alias core.stdc.math.logb logb; + alias logb = core.stdc.math.logb; /// - alias core.stdc.math.logbf logb; + alias logb = core.stdc.math.logbf; /// - alias core.stdc.math.logbl logb; + alias logb = core.stdc.math.logbl; /// - alias core.stdc.math.modf modf; + alias modf = core.stdc.math.modf; /// - alias core.stdc.math.modff modf; + alias modf = core.stdc.math.modff; // alias core.stdc.math.modfl modf; /// - alias core.stdc.math.scalbn scalbn; + alias scalbn = core.stdc.math.scalbn; /// - alias core.stdc.math.scalbnf scalbn; + alias scalbn = core.stdc.math.scalbnf; /// - alias core.stdc.math.scalbnl scalbn; + alias scalbn = core.stdc.math.scalbnl; /// - alias core.stdc.math.scalbln scalbln; + alias scalbln = core.stdc.math.scalbln; /// - alias core.stdc.math.scalblnf scalbln; + alias scalbln = core.stdc.math.scalblnf; /// - alias core.stdc.math.scalblnl scalbln; + alias scalbln = core.stdc.math.scalblnl; /// - alias core.stdc.math.cbrt cbrt; + alias cbrt = core.stdc.math.cbrt; /// - alias core.stdc.math.cbrtf cbrt; + alias cbrt = core.stdc.math.cbrtf; /// - alias core.stdc.math.cbrtl cbrt; + alias cbrt = core.stdc.math.cbrtl; /// - alias core.stdc.math.fabs fabs; + alias fabs = core.stdc.math.fabs; /// - alias core.stdc.math.fabsf fabs; + alias fabs = core.stdc.math.fabsf; /// - alias core.stdc.math.fabsl fabs; + alias fabs = core.stdc.math.fabsl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cabs fabs; - deprecated alias core.stdc.complex.cabsf fabs; - deprecated alias core.stdc.complex.cabsl fabs; + deprecated alias fabs = core.stdc.complex.cabs; + deprecated alias fabs = core.stdc.complex.cabsf; + deprecated alias fabs = core.stdc.complex.cabsl; /// - alias core.stdc.math.hypot hypot; + alias hypot = core.stdc.math.hypot; /// - alias core.stdc.math.hypotf hypot; + alias hypot = core.stdc.math.hypotf; /// - alias core.stdc.math.hypotl hypot; + alias hypot = core.stdc.math.hypotl; /// - alias core.stdc.math.pow pow; + alias pow = core.stdc.math.pow; /// - alias core.stdc.math.powf pow; + alias pow = core.stdc.math.powf; /// - alias core.stdc.math.powl pow; + alias pow = core.stdc.math.powl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cpow pow; - deprecated alias core.stdc.complex.cpowf pow; - deprecated alias core.stdc.complex.cpowl pow; + deprecated alias pow = core.stdc.complex.cpow; + deprecated alias pow = core.stdc.complex.cpowf; + deprecated alias pow = core.stdc.complex.cpowl; /// - alias core.stdc.math.sqrt sqrt; + alias sqrt = core.stdc.math.sqrt; /// - alias core.stdc.math.sqrtf sqrt; + alias sqrt = core.stdc.math.sqrtf; /// - alias core.stdc.math.sqrtl sqrt; + alias sqrt = core.stdc.math.sqrtl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csqrt sqrt; - deprecated alias core.stdc.complex.csqrtf sqrt; - deprecated alias core.stdc.complex.csqrtl sqrt; + deprecated alias sqrt = core.stdc.complex.csqrt; + deprecated alias sqrt = core.stdc.complex.csqrtf; + deprecated alias sqrt = core.stdc.complex.csqrtl; /// - alias core.stdc.math.erf erf; + alias erf = core.stdc.math.erf; /// - alias core.stdc.math.erff erf; + alias erf = core.stdc.math.erff; /// - alias core.stdc.math.erfl erf; + alias erf = core.stdc.math.erfl; /// - alias core.stdc.math.erfc erfc; + alias erfc = core.stdc.math.erfc; /// - alias core.stdc.math.erfcf erfc; + alias erfc = core.stdc.math.erfcf; /// - alias core.stdc.math.erfcl erfc; + alias erfc = core.stdc.math.erfcl; /// - alias core.stdc.math.lgamma lgamma; + alias lgamma = core.stdc.math.lgamma; /// - alias core.stdc.math.lgammaf lgamma; + alias lgamma = core.stdc.math.lgammaf; /// - alias core.stdc.math.lgammal lgamma; + alias lgamma = core.stdc.math.lgammal; /// - alias core.stdc.math.tgamma tgamma; + alias tgamma = core.stdc.math.tgamma; /// - alias core.stdc.math.tgammaf tgamma; + alias tgamma = core.stdc.math.tgammaf; /// - alias core.stdc.math.tgammal tgamma; + alias tgamma = core.stdc.math.tgammal; /// - alias core.stdc.math.ceil ceil; + alias ceil = core.stdc.math.ceil; /// - alias core.stdc.math.ceilf ceil; + alias ceil = core.stdc.math.ceilf; /// - alias core.stdc.math.ceill ceil; + alias ceil = core.stdc.math.ceill; /// - alias core.stdc.math.floor floor; + alias floor = core.stdc.math.floor; /// - alias core.stdc.math.floorf floor; + alias floor = core.stdc.math.floorf; /// - alias core.stdc.math.floorl floor; + alias floor = core.stdc.math.floorl; /// - alias core.stdc.math.nearbyint nearbyint; + alias nearbyint = core.stdc.math.nearbyint; /// - alias core.stdc.math.nearbyintf nearbyint; + alias nearbyint = core.stdc.math.nearbyintf; /// - alias core.stdc.math.nearbyintl nearbyint; + alias nearbyint = core.stdc.math.nearbyintl; /// - alias core.stdc.math.rint rint; + alias rint = core.stdc.math.rint; /// - alias core.stdc.math.rintf rint; + alias rint = core.stdc.math.rintf; /// - alias core.stdc.math.rintl rint; + alias rint = core.stdc.math.rintl; /// - alias core.stdc.math.lrint lrint; + alias lrint = core.stdc.math.lrint; /// - alias core.stdc.math.lrintf lrint; + alias lrint = core.stdc.math.lrintf; /// - alias core.stdc.math.lrintl lrint; + alias lrint = core.stdc.math.lrintl; /// - alias core.stdc.math.llrint llrint; + alias llrint = core.stdc.math.llrint; /// - alias core.stdc.math.llrintf llrint; + alias llrint = core.stdc.math.llrintf; /// - alias core.stdc.math.llrintl llrint; + alias llrint = core.stdc.math.llrintl; /// - alias core.stdc.math.round round; + alias round = core.stdc.math.round; /// - alias core.stdc.math.roundf round; + alias round = core.stdc.math.roundf; /// - alias core.stdc.math.roundl round; + alias round = core.stdc.math.roundl; /// - alias core.stdc.math.lround lround; + alias lround = core.stdc.math.lround; /// - alias core.stdc.math.lroundf lround; + alias lround = core.stdc.math.lroundf; /// - alias core.stdc.math.lroundl lround; + alias lround = core.stdc.math.lroundl; /// - alias core.stdc.math.llround llroundl; + alias llroundl = core.stdc.math.llround; /// - alias core.stdc.math.llroundf llroundl; + alias llroundl = core.stdc.math.llroundf; /// - alias core.stdc.math.llroundl llroundl; + alias llroundl = core.stdc.math.llroundl; /// - alias core.stdc.math.trunc trunc; + alias trunc = core.stdc.math.trunc; /// - alias core.stdc.math.truncf trunc; + alias trunc = core.stdc.math.truncf; /// - alias core.stdc.math.truncl trunc; + alias trunc = core.stdc.math.truncl; /// - alias core.stdc.math.fmod fmod; + alias fmod = core.stdc.math.fmod; /// - alias core.stdc.math.fmodf fmod; + alias fmod = core.stdc.math.fmodf; /// - alias core.stdc.math.fmodl fmod; + alias fmod = core.stdc.math.fmodl; /// - alias core.stdc.math.remainder remainder; + alias remainder = core.stdc.math.remainder; /// - alias core.stdc.math.remainderf remainder; + alias remainder = core.stdc.math.remainderf; /// - alias core.stdc.math.remainderl remainder; + alias remainder = core.stdc.math.remainderl; /// - alias core.stdc.math.remquo remquo; + alias remquo = core.stdc.math.remquo; /// - alias core.stdc.math.remquof remquo; + alias remquo = core.stdc.math.remquof; /// - alias core.stdc.math.remquol remquo; + alias remquo = core.stdc.math.remquol; /// - alias core.stdc.math.copysign copysign; + alias copysign = core.stdc.math.copysign; /// - alias core.stdc.math.copysignf copysign; + alias copysign = core.stdc.math.copysignf; /// - alias core.stdc.math.copysignl copysign; + alias copysign = core.stdc.math.copysignl; // alias core.stdc.math.nan nan; // alias core.stdc.math.nanf nan; // alias core.stdc.math.nanl nan; /// - alias core.stdc.math.nextafter nextafter; + alias nextafter = core.stdc.math.nextafter; /// - alias core.stdc.math.nextafterf nextafter; + alias nextafter = core.stdc.math.nextafterf; /// - alias core.stdc.math.nextafterl nextafter; + alias nextafter = core.stdc.math.nextafterl; /// - alias core.stdc.math.nexttoward nexttoward; + alias nexttoward = core.stdc.math.nexttoward; /// - alias core.stdc.math.nexttowardf nexttoward; + alias nexttoward = core.stdc.math.nexttowardf; /// - alias core.stdc.math.nexttowardl nexttoward; + alias nexttoward = core.stdc.math.nexttowardl; /// - alias core.stdc.math.fdim fdim; + alias fdim = core.stdc.math.fdim; /// - alias core.stdc.math.fdimf fdim; + alias fdim = core.stdc.math.fdimf; /// - alias core.stdc.math.fdiml fdim; + alias fdim = core.stdc.math.fdiml; /// - alias core.stdc.math.fmax fmax; + alias fmax = core.stdc.math.fmax; /// - alias core.stdc.math.fmaxf fmax; + alias fmax = core.stdc.math.fmaxf; /// - alias core.stdc.math.fmaxl fmax; + alias fmax = core.stdc.math.fmaxl; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fminl fmin; + alias fmin = core.stdc.math.fminl; /// - alias core.stdc.math.fma fma; + alias fma = core.stdc.math.fma; /// - alias core.stdc.math.fmaf fma; + alias fma = core.stdc.math.fmaf; /// - alias core.stdc.math.fmal fma; + alias fma = core.stdc.math.fmal; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.carg carg; - deprecated alias core.stdc.complex.cargf carg; - deprecated alias core.stdc.complex.cargl carg; - deprecated alias core.stdc.complex.cimag cimag; - deprecated alias core.stdc.complex.cimagf cimag; - deprecated alias core.stdc.complex.cimagl cimag; - deprecated alias core.stdc.complex.conj conj; - deprecated alias core.stdc.complex.conjf conj; - deprecated alias core.stdc.complex.conjl conj; - deprecated alias core.stdc.complex.cproj cproj; - deprecated alias core.stdc.complex.cprojf cproj; - deprecated alias core.stdc.complex.cprojl cproj; + deprecated alias carg = core.stdc.complex.carg; + deprecated alias carg = core.stdc.complex.cargf; + deprecated alias carg = core.stdc.complex.cargl; + deprecated alias cimag = core.stdc.complex.cimag; + deprecated alias cimag = core.stdc.complex.cimagf; + deprecated alias cimag = core.stdc.complex.cimagl; + deprecated alias conj = core.stdc.complex.conj; + deprecated alias conj = core.stdc.complex.conjf; + deprecated alias conj = core.stdc.complex.conjl; + deprecated alias cproj = core.stdc.complex.cproj; + deprecated alias cproj = core.stdc.complex.cprojf; + deprecated alias cproj = core.stdc.complex.cprojl; // deprecated alias core.stdc.complex.creal creal; // deprecated alias core.stdc.complex.crealf creal; @@ -526,488 +526,488 @@ version (NetBSD) else version (OpenBSD) { /// - alias core.stdc.math.acos acos; + alias acos = core.stdc.math.acos; /// - alias core.stdc.math.acosf acos; + alias acos = core.stdc.math.acosf; /// - alias core.stdc.math.acosl acos; + alias acos = core.stdc.math.acosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacos acos; - deprecated alias core.stdc.complex.cacosf acos; - deprecated alias core.stdc.complex.cacosl acos; + deprecated alias acos = core.stdc.complex.cacos; + deprecated alias acos = core.stdc.complex.cacosf; + deprecated alias acos = core.stdc.complex.cacosl; /// - alias core.stdc.math.asin asin; + alias asin = core.stdc.math.asin; /// - alias core.stdc.math.asinf asin; + alias asin = core.stdc.math.asinf; /// - alias core.stdc.math.asinl asin; + alias asin = core.stdc.math.asinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casin asin; - deprecated alias core.stdc.complex.casinf asin; - deprecated alias core.stdc.complex.casinl asin; + deprecated alias asin = core.stdc.complex.casin; + deprecated alias asin = core.stdc.complex.casinf; + deprecated alias asin = core.stdc.complex.casinl; /// - alias core.stdc.math.atan atan; + alias atan = core.stdc.math.atan; /// - alias core.stdc.math.atanf atan; + alias atan = core.stdc.math.atanf; /// - alias core.stdc.math.atanl atan; + alias atan = core.stdc.math.atanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catan atan; - deprecated alias core.stdc.complex.catanf atan; - deprecated alias core.stdc.complex.catanl atan; + deprecated alias atan = core.stdc.complex.catan; + deprecated alias atan = core.stdc.complex.catanf; + deprecated alias atan = core.stdc.complex.catanl; /// - alias core.stdc.math.atan2 atan2; + alias atan2 = core.stdc.math.atan2; /// - alias core.stdc.math.atan2f atan2; + alias atan2 = core.stdc.math.atan2f; /// - alias core.stdc.math.atan2l atan2; + alias atan2 = core.stdc.math.atan2l; /// - alias core.stdc.math.cos cos; + alias cos = core.stdc.math.cos; /// - alias core.stdc.math.cosf cos; + alias cos = core.stdc.math.cosf; /// - alias core.stdc.math.cosl cos; + alias cos = core.stdc.math.cosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccos cos; - deprecated alias core.stdc.complex.ccosf cos; - deprecated alias core.stdc.complex.ccosl cos; + deprecated alias cos = core.stdc.complex.ccos; + deprecated alias cos = core.stdc.complex.ccosf; + deprecated alias cos = core.stdc.complex.ccosl; /// - alias core.stdc.math.sin sin; + alias sin = core.stdc.math.sin; /// - alias core.stdc.math.sinf sin; + alias sin = core.stdc.math.sinf; /// - alias core.stdc.math.sinl sin; + alias sin = core.stdc.math.sinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csin csin; - deprecated alias core.stdc.complex.csinf csin; - deprecated alias core.stdc.complex.csinl csin; + deprecated alias csin = core.stdc.complex.csin; + deprecated alias csin = core.stdc.complex.csinf; + deprecated alias csin = core.stdc.complex.csinl; /// - alias core.stdc.math.tan tan; + alias tan = core.stdc.math.tan; /// - alias core.stdc.math.tanf tan; + alias tan = core.stdc.math.tanf; /// - alias core.stdc.math.tanl tan; + alias tan = core.stdc.math.tanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctan tan; - deprecated alias core.stdc.complex.ctanf tan; - deprecated alias core.stdc.complex.ctanl tan; + deprecated alias tan = core.stdc.complex.ctan; + deprecated alias tan = core.stdc.complex.ctanf; + deprecated alias tan = core.stdc.complex.ctanl; /// - alias core.stdc.math.acosh acosh; + alias acosh = core.stdc.math.acosh; /// - alias core.stdc.math.acoshf acosh; + alias acosh = core.stdc.math.acoshf; /// - alias core.stdc.math.acoshl acosh; + alias acosh = core.stdc.math.acoshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacosh acosh; - deprecated alias core.stdc.complex.cacoshf acosh; - deprecated alias core.stdc.complex.cacoshl acosh; + deprecated alias acosh = core.stdc.complex.cacosh; + deprecated alias acosh = core.stdc.complex.cacoshf; + deprecated alias acosh = core.stdc.complex.cacoshl; /// - alias core.stdc.math.asinh asinh; + alias asinh = core.stdc.math.asinh; /// - alias core.stdc.math.asinhf asinh; + alias asinh = core.stdc.math.asinhf; /// - alias core.stdc.math.asinhl asinh; + alias asinh = core.stdc.math.asinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casinh asinh; - deprecated alias core.stdc.complex.casinhf asinh; - deprecated alias core.stdc.complex.casinhl asinh; + deprecated alias asinh = core.stdc.complex.casinh; + deprecated alias asinh = core.stdc.complex.casinhf; + deprecated alias asinh = core.stdc.complex.casinhl; /// - alias core.stdc.math.atanh atanh; + alias atanh = core.stdc.math.atanh; /// - alias core.stdc.math.atanhf atanh; + alias atanh = core.stdc.math.atanhf; /// - alias core.stdc.math.atanhl atanh; + alias atanh = core.stdc.math.atanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catanh atanh; - deprecated alias core.stdc.complex.catanhf atanh; - deprecated alias core.stdc.complex.catanhl atanh; + deprecated alias atanh = core.stdc.complex.catanh; + deprecated alias atanh = core.stdc.complex.catanhf; + deprecated alias atanh = core.stdc.complex.catanhl; /// - alias core.stdc.math.cosh cosh; + alias cosh = core.stdc.math.cosh; /// - alias core.stdc.math.coshf cosh; + alias cosh = core.stdc.math.coshf; /// - alias core.stdc.math.coshl cosh; + alias cosh = core.stdc.math.coshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccosh cosh; - deprecated alias core.stdc.complex.ccoshf cosh; - deprecated alias core.stdc.complex.ccoshl cosh; + deprecated alias cosh = core.stdc.complex.ccosh; + deprecated alias cosh = core.stdc.complex.ccoshf; + deprecated alias cosh = core.stdc.complex.ccoshl; /// - alias core.stdc.math.sinh sinh; + alias sinh = core.stdc.math.sinh; /// - alias core.stdc.math.sinhf sinh; + alias sinh = core.stdc.math.sinhf; /// - alias core.stdc.math.sinhl sinh; + alias sinh = core.stdc.math.sinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csinh sinh; - deprecated alias core.stdc.complex.csinhf sinh; - deprecated alias core.stdc.complex.csinhl sinh; + deprecated alias sinh = core.stdc.complex.csinh; + deprecated alias sinh = core.stdc.complex.csinhf; + deprecated alias sinh = core.stdc.complex.csinhl; /// - alias core.stdc.math.tanh tanh; + alias tanh = core.stdc.math.tanh; /// - alias core.stdc.math.tanhf tanh; + alias tanh = core.stdc.math.tanhf; /// - alias core.stdc.math.tanhl tanh; + alias tanh = core.stdc.math.tanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctanh tanh; - deprecated alias core.stdc.complex.ctanhf tanh; - deprecated alias core.stdc.complex.ctanhl tanh; + deprecated alias tanh = core.stdc.complex.ctanh; + deprecated alias tanh = core.stdc.complex.ctanhf; + deprecated alias tanh = core.stdc.complex.ctanhl; /// - alias core.stdc.math.exp exp; + alias exp = core.stdc.math.exp; /// - alias core.stdc.math.expf exp; + alias exp = core.stdc.math.expf; /// - alias core.stdc.math.expl exp; + alias exp = core.stdc.math.expl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cexp exp; - deprecated alias core.stdc.complex.cexpf exp; - deprecated alias core.stdc.complex.cexpl exp; + deprecated alias exp = core.stdc.complex.cexp; + deprecated alias exp = core.stdc.complex.cexpf; + deprecated alias exp = core.stdc.complex.cexpl; /// - alias core.stdc.math.exp2 exp2; + alias exp2 = core.stdc.math.exp2; /// - alias core.stdc.math.exp2f exp2; + alias exp2 = core.stdc.math.exp2f; /// - alias core.stdc.math.exp2l exp2; + alias exp2 = core.stdc.math.exp2l; /// - alias core.stdc.math.expm1 expm1; + alias expm1 = core.stdc.math.expm1; /// - alias core.stdc.math.expm1f expm1; + alias expm1 = core.stdc.math.expm1f; /// - alias core.stdc.math.expm1l expm1; + alias expm1 = core.stdc.math.expm1l; /// - alias core.stdc.math.frexp frexp; + alias frexp = core.stdc.math.frexp; /// - alias core.stdc.math.frexpf frexp; + alias frexp = core.stdc.math.frexpf; /// - alias core.stdc.math.frexpl frexp; + alias frexp = core.stdc.math.frexpl; /// - alias core.stdc.math.ilogb ilogb; + alias ilogb = core.stdc.math.ilogb; /// - alias core.stdc.math.ilogbf ilogb; + alias ilogb = core.stdc.math.ilogbf; /// - alias core.stdc.math.ilogbl ilogb; + alias ilogb = core.stdc.math.ilogbl; /// - alias core.stdc.math.ldexp ldexp; + alias ldexp = core.stdc.math.ldexp; /// - alias core.stdc.math.ldexpf ldexp; + alias ldexp = core.stdc.math.ldexpf; /// - alias core.stdc.math.ldexpl ldexp; + alias ldexp = core.stdc.math.ldexpl; /// - alias core.stdc.math.log log; + alias log = core.stdc.math.log; /// - alias core.stdc.math.logf log; + alias log = core.stdc.math.logf; /// - alias core.stdc.math.logl log; + alias log = core.stdc.math.logl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.clog log; - deprecated alias core.stdc.complex.clogf log; - deprecated alias core.stdc.complex.clogl log; + deprecated alias log = core.stdc.complex.clog; + deprecated alias log = core.stdc.complex.clogf; + deprecated alias log = core.stdc.complex.clogl; /// - alias core.stdc.math.log10 log10; + alias log10 = core.stdc.math.log10; /// - alias core.stdc.math.log10f log10; + alias log10 = core.stdc.math.log10f; /// - alias core.stdc.math.log10l log10; + alias log10 = core.stdc.math.log10l; /// - alias core.stdc.math.log1p log1p; + alias log1p = core.stdc.math.log1p; /// - alias core.stdc.math.log1pf log1p; + alias log1p = core.stdc.math.log1pf; /// - alias core.stdc.math.log1pl log1p; + alias log1p = core.stdc.math.log1pl; /// - alias core.stdc.math.log2 log2; + alias log2 = core.stdc.math.log2; /// - alias core.stdc.math.log2f log2; + alias log2 = core.stdc.math.log2f; /// - alias core.stdc.math.log2l log2; + alias log2 = core.stdc.math.log2l; /// - alias core.stdc.math.logb logb; + alias logb = core.stdc.math.logb; /// - alias core.stdc.math.logbf logb; + alias logb = core.stdc.math.logbf; /// - alias core.stdc.math.logbl logb; + alias logb = core.stdc.math.logbl; /// - alias core.stdc.math.fmod fmod; + alias fmod = core.stdc.math.fmod; /// - alias core.stdc.math.fmodf fmod; + alias fmod = core.stdc.math.fmodf; /// - alias core.stdc.math.fmodl fmod; + alias fmod = core.stdc.math.fmodl; /// - alias core.stdc.math.scalbn scalbn; + alias scalbn = core.stdc.math.scalbn; /// - alias core.stdc.math.scalbnf scalbn; + alias scalbn = core.stdc.math.scalbnf; /// - alias core.stdc.math.scalbnl scalbn; + alias scalbn = core.stdc.math.scalbnl; /// - alias core.stdc.math.scalbln scalbln; + alias scalbln = core.stdc.math.scalbln; /// - alias core.stdc.math.scalblnf scalbln; + alias scalbln = core.stdc.math.scalblnf; /// - alias core.stdc.math.scalblnl scalbln; + alias scalbln = core.stdc.math.scalblnl; /// - alias core.stdc.math.cbrt cbrt; + alias cbrt = core.stdc.math.cbrt; /// - alias core.stdc.math.cbrtf cbrt; + alias cbrt = core.stdc.math.cbrtf; /// - alias core.stdc.math.cbrtl cbrt; + alias cbrt = core.stdc.math.cbrtl; /// - alias core.stdc.math.fabs fabs; + alias fabs = core.stdc.math.fabs; /// - alias core.stdc.math.fabsf fabs; + alias fabs = core.stdc.math.fabsf; /// - alias core.stdc.math.fabsl fabs; + alias fabs = core.stdc.math.fabsl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cabs fabs; - deprecated alias core.stdc.complex.cabsf fabs; - deprecated alias core.stdc.complex.cabsl fabs; + deprecated alias fabs = core.stdc.complex.cabs; + deprecated alias fabs = core.stdc.complex.cabsf; + deprecated alias fabs = core.stdc.complex.cabsl; /// - alias core.stdc.math.hypot hypot; + alias hypot = core.stdc.math.hypot; /// - alias core.stdc.math.hypotf hypot; + alias hypot = core.stdc.math.hypotf; /// - alias core.stdc.math.hypotl hypot; + alias hypot = core.stdc.math.hypotl; /// - alias core.stdc.math.pow pow; + alias pow = core.stdc.math.pow; /// - alias core.stdc.math.powf pow; + alias pow = core.stdc.math.powf; /// - alias core.stdc.math.powl pow; + alias pow = core.stdc.math.powl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cpow pow; - deprecated alias core.stdc.complex.cpowf pow; - deprecated alias core.stdc.complex.cpowl pow; + deprecated alias pow = core.stdc.complex.cpow; + deprecated alias pow = core.stdc.complex.cpowf; + deprecated alias pow = core.stdc.complex.cpowl; /// - alias core.stdc.math.sqrt sqrt; + alias sqrt = core.stdc.math.sqrt; /// - alias core.stdc.math.sqrtf sqrt; + alias sqrt = core.stdc.math.sqrtf; /// - alias core.stdc.math.sqrtl sqrt; + alias sqrt = core.stdc.math.sqrtl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csqrt sqrt; - deprecated alias core.stdc.complex.csqrtf sqrt; - deprecated alias core.stdc.complex.csqrtl sqrt; + deprecated alias sqrt = core.stdc.complex.csqrt; + deprecated alias sqrt = core.stdc.complex.csqrtf; + deprecated alias sqrt = core.stdc.complex.csqrtl; /// - alias core.stdc.math.erf erf; + alias erf = core.stdc.math.erf; /// - alias core.stdc.math.erff erf; + alias erf = core.stdc.math.erff; /// - alias core.stdc.math.erfl erf; + alias erf = core.stdc.math.erfl; /// - alias core.stdc.math.erfc erfc; + alias erfc = core.stdc.math.erfc; /// - alias core.stdc.math.erfcf erfc; + alias erfc = core.stdc.math.erfcf; /// - alias core.stdc.math.erfcl erfc; + alias erfc = core.stdc.math.erfcl; /// - alias core.stdc.math.lgamma lgamma; + alias lgamma = core.stdc.math.lgamma; /// - alias core.stdc.math.lgammaf lgamma; + alias lgamma = core.stdc.math.lgammaf; /// - alias core.stdc.math.lgammal lgamma; + alias lgamma = core.stdc.math.lgammal; /// - alias core.stdc.math.tgamma tgamma; + alias tgamma = core.stdc.math.tgamma; /// - alias core.stdc.math.tgammaf tgamma; + alias tgamma = core.stdc.math.tgammaf; /// - alias core.stdc.math.tgammal tgamma; + alias tgamma = core.stdc.math.tgammal; /// - alias core.stdc.math.ceil ceil; + alias ceil = core.stdc.math.ceil; /// - alias core.stdc.math.ceilf ceil; + alias ceil = core.stdc.math.ceilf; /// - alias core.stdc.math.ceill ceil; + alias ceil = core.stdc.math.ceill; /// - alias core.stdc.math.floor floor; + alias floor = core.stdc.math.floor; /// - alias core.stdc.math.floorf floor; + alias floor = core.stdc.math.floorf; /// - alias core.stdc.math.floorl floor; + alias floor = core.stdc.math.floorl; /// - alias core.stdc.math.nearbyint nearbyint; + alias nearbyint = core.stdc.math.nearbyint; /// - alias core.stdc.math.nearbyintf nearbyint; + alias nearbyint = core.stdc.math.nearbyintf; /// - alias core.stdc.math.nearbyintl nearbyint; + alias nearbyint = core.stdc.math.nearbyintl; /// - alias core.stdc.math.rint rint; + alias rint = core.stdc.math.rint; /// - alias core.stdc.math.rintf rint; + alias rint = core.stdc.math.rintf; /// - alias core.stdc.math.rintl rint; + alias rint = core.stdc.math.rintl; /// - alias core.stdc.math.lrint lrint; + alias lrint = core.stdc.math.lrint; /// - alias core.stdc.math.lrintf lrint; + alias lrint = core.stdc.math.lrintf; /// - alias core.stdc.math.lrintl lrint; + alias lrint = core.stdc.math.lrintl; /// - alias core.stdc.math.llrint llrint; + alias llrint = core.stdc.math.llrint; /// - alias core.stdc.math.llrintf llrint; + alias llrint = core.stdc.math.llrintf; /// - alias core.stdc.math.llrintl llrint; + alias llrint = core.stdc.math.llrintl; /// - alias core.stdc.math.round round; + alias round = core.stdc.math.round; /// - alias core.stdc.math.roundf round; + alias round = core.stdc.math.roundf; /// - alias core.stdc.math.roundl round; + alias round = core.stdc.math.roundl; /// - alias core.stdc.math.lround lround; + alias lround = core.stdc.math.lround; /// - alias core.stdc.math.lroundf lround; + alias lround = core.stdc.math.lroundf; /// - alias core.stdc.math.lroundl lround; + alias lround = core.stdc.math.lroundl; /// - alias core.stdc.math.llround llround; + alias llround = core.stdc.math.llround; /// - alias core.stdc.math.llroundf llround; + alias llround = core.stdc.math.llroundf; /// - alias core.stdc.math.llroundl llround; + alias llround = core.stdc.math.llroundl; /// - alias core.stdc.math.trunc trunc; + alias trunc = core.stdc.math.trunc; /// - alias core.stdc.math.truncf trunc; + alias trunc = core.stdc.math.truncf; /// - alias core.stdc.math.truncl trunc; + alias trunc = core.stdc.math.truncl; /// - alias core.stdc.math.remainder remainder; + alias remainder = core.stdc.math.remainder; /// - alias core.stdc.math.remainderf remainder; + alias remainder = core.stdc.math.remainderf; /// - alias core.stdc.math.remainderl remainder; + alias remainder = core.stdc.math.remainderl; /// - alias core.stdc.math.remquo remquo; + alias remquo = core.stdc.math.remquo; /// - alias core.stdc.math.remquof remquo; + alias remquo = core.stdc.math.remquof; /// - alias core.stdc.math.remquol remquo; + alias remquo = core.stdc.math.remquol; /// - alias core.stdc.math.copysign copysign; + alias copysign = core.stdc.math.copysign; /// - alias core.stdc.math.copysignf copysign; + alias copysign = core.stdc.math.copysignf; /// - alias core.stdc.math.copysignl copysign; + alias copysign = core.stdc.math.copysignl; /// - alias core.stdc.math.nextafter nextafter; + alias nextafter = core.stdc.math.nextafter; /// - alias core.stdc.math.nextafterf nextafter; + alias nextafter = core.stdc.math.nextafterf; /// - alias core.stdc.math.nextafterl nextafter; + alias nextafter = core.stdc.math.nextafterl; /// - alias core.stdc.math.nexttoward nexttoward; + alias nexttoward = core.stdc.math.nexttoward; /// - alias core.stdc.math.nexttowardf nexttoward; + alias nexttoward = core.stdc.math.nexttowardf; /// - alias core.stdc.math.nexttowardl nexttoward; + alias nexttoward = core.stdc.math.nexttowardl; /// - alias core.stdc.math.fdim fdim; + alias fdim = core.stdc.math.fdim; /// - alias core.stdc.math.fdimf fdim; + alias fdim = core.stdc.math.fdimf; /// - alias core.stdc.math.fdiml fdim; + alias fdim = core.stdc.math.fdiml; /// - alias core.stdc.math.fmax fmax; + alias fmax = core.stdc.math.fmax; /// - alias core.stdc.math.fmaxf fmax; + alias fmax = core.stdc.math.fmaxf; /// - alias core.stdc.math.fmaxl fmax; + alias fmax = core.stdc.math.fmaxl; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fminl fmin; + alias fmin = core.stdc.math.fminl; /// - alias core.stdc.math.fma fma; + alias fma = core.stdc.math.fma; /// - alias core.stdc.math.fmaf fma; + alias fma = core.stdc.math.fmaf; /// - alias core.stdc.math.fmal fma; + alias fma = core.stdc.math.fmal; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.carg carg; - deprecated alias core.stdc.complex.cargf carg; - deprecated alias core.stdc.complex.cargl carg; - deprecated alias core.stdc.complex.cimag cimag; - deprecated alias core.stdc.complex.cimagf cimag; - deprecated alias core.stdc.complex.cimagl cimag; - deprecated alias core.stdc.complex.conj conj; - deprecated alias core.stdc.complex.conjf conj; - deprecated alias core.stdc.complex.conjl conj; - deprecated alias core.stdc.complex.cproj cproj; - deprecated alias core.stdc.complex.cprojf cproj; - deprecated alias core.stdc.complex.cprojl cproj; + deprecated alias carg = core.stdc.complex.carg; + deprecated alias carg = core.stdc.complex.cargf; + deprecated alias carg = core.stdc.complex.cargl; + deprecated alias cimag = core.stdc.complex.cimag; + deprecated alias cimag = core.stdc.complex.cimagf; + deprecated alias cimag = core.stdc.complex.cimagl; + deprecated alias conj = core.stdc.complex.conj; + deprecated alias conj = core.stdc.complex.conjf; + deprecated alias conj = core.stdc.complex.conjl; + deprecated alias cproj = core.stdc.complex.cproj; + deprecated alias cproj = core.stdc.complex.cprojf; + deprecated alias cproj = core.stdc.complex.cprojl; // deprecated alias core.stdc.complex.creal creal; // deprecated alias core.stdc.complex.crealf creal; @@ -1016,515 +1016,515 @@ else version (OpenBSD) else { /// - alias core.stdc.math.acos acos; + alias acos = core.stdc.math.acos; /// - alias core.stdc.math.acosf acos; + alias acos = core.stdc.math.acosf; /// - alias core.stdc.math.acosl acos; + alias acos = core.stdc.math.acosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacos acos; - deprecated alias core.stdc.complex.cacosf acos; - deprecated alias core.stdc.complex.cacosl acos; + deprecated alias acos = core.stdc.complex.cacos; + deprecated alias acos = core.stdc.complex.cacosf; + deprecated alias acos = core.stdc.complex.cacosl; /// - alias core.stdc.math.asin asin; + alias asin = core.stdc.math.asin; /// - alias core.stdc.math.asinf asin; + alias asin = core.stdc.math.asinf; /// - alias core.stdc.math.asinl asin; + alias asin = core.stdc.math.asinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casin asin; - deprecated alias core.stdc.complex.casinf asin; - deprecated alias core.stdc.complex.casinl asin; + deprecated alias asin = core.stdc.complex.casin; + deprecated alias asin = core.stdc.complex.casinf; + deprecated alias asin = core.stdc.complex.casinl; /// - alias core.stdc.math.atan atan; + alias atan = core.stdc.math.atan; /// - alias core.stdc.math.atanf atan; + alias atan = core.stdc.math.atanf; /// - alias core.stdc.math.atanl atan; + alias atan = core.stdc.math.atanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catan atan; - deprecated alias core.stdc.complex.catanf atan; - deprecated alias core.stdc.complex.catanl atan; + deprecated alias atan = core.stdc.complex.catan; + deprecated alias atan = core.stdc.complex.catanf; + deprecated alias atan = core.stdc.complex.catanl; /// - alias core.stdc.math.atan2 atan2; + alias atan2 = core.stdc.math.atan2; /// - alias core.stdc.math.atan2f atan2; + alias atan2 = core.stdc.math.atan2f; /// - alias core.stdc.math.atan2l atan2; + alias atan2 = core.stdc.math.atan2l; /// - alias core.stdc.math.cos cos; + alias cos = core.stdc.math.cos; /// - alias core.stdc.math.cosf cos; + alias cos = core.stdc.math.cosf; /// - alias core.stdc.math.cosl cos; + alias cos = core.stdc.math.cosl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccos cos; - deprecated alias core.stdc.complex.ccosf cos; - deprecated alias core.stdc.complex.ccosl cos; + deprecated alias cos = core.stdc.complex.ccos; + deprecated alias cos = core.stdc.complex.ccosf; + deprecated alias cos = core.stdc.complex.ccosl; /// - alias core.stdc.math.sin sin; + alias sin = core.stdc.math.sin; /// - alias core.stdc.math.sinf sin; + alias sin = core.stdc.math.sinf; /// - alias core.stdc.math.sinl sin; + alias sin = core.stdc.math.sinl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csin csin; - deprecated alias core.stdc.complex.csinf csin; - deprecated alias core.stdc.complex.csinl csin; + deprecated alias csin = core.stdc.complex.csin; + deprecated alias csin = core.stdc.complex.csinf; + deprecated alias csin = core.stdc.complex.csinl; /// - alias core.stdc.math.tan tan; + alias tan = core.stdc.math.tan; /// - alias core.stdc.math.tanf tan; + alias tan = core.stdc.math.tanf; /// - alias core.stdc.math.tanl tan; + alias tan = core.stdc.math.tanl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctan tan; - deprecated alias core.stdc.complex.ctanf tan; - deprecated alias core.stdc.complex.ctanl tan; + deprecated alias tan = core.stdc.complex.ctan; + deprecated alias tan = core.stdc.complex.ctanf; + deprecated alias tan = core.stdc.complex.ctanl; /// - alias core.stdc.math.acosh acosh; + alias acosh = core.stdc.math.acosh; /// - alias core.stdc.math.acoshf acosh; + alias acosh = core.stdc.math.acoshf; /// - alias core.stdc.math.acoshl acosh; + alias acosh = core.stdc.math.acoshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cacosh acosh; - deprecated alias core.stdc.complex.cacoshf acosh; - deprecated alias core.stdc.complex.cacoshl acosh; + deprecated alias acosh = core.stdc.complex.cacosh; + deprecated alias acosh = core.stdc.complex.cacoshf; + deprecated alias acosh = core.stdc.complex.cacoshl; /// - alias core.stdc.math.asinh asinh; + alias asinh = core.stdc.math.asinh; /// - alias core.stdc.math.asinhf asinh; + alias asinh = core.stdc.math.asinhf; /// - alias core.stdc.math.asinhl asinh; + alias asinh = core.stdc.math.asinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.casinh asinh; - deprecated alias core.stdc.complex.casinhf asinh; - deprecated alias core.stdc.complex.casinhl asinh; + deprecated alias asinh = core.stdc.complex.casinh; + deprecated alias asinh = core.stdc.complex.casinhf; + deprecated alias asinh = core.stdc.complex.casinhl; /// - alias core.stdc.math.atanh atanh; + alias atanh = core.stdc.math.atanh; /// - alias core.stdc.math.atanhf atanh; + alias atanh = core.stdc.math.atanhf; /// - alias core.stdc.math.atanhl atanh; + alias atanh = core.stdc.math.atanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.catanh atanh; - deprecated alias core.stdc.complex.catanhf atanh; - deprecated alias core.stdc.complex.catanhl atanh; + deprecated alias atanh = core.stdc.complex.catanh; + deprecated alias atanh = core.stdc.complex.catanhf; + deprecated alias atanh = core.stdc.complex.catanhl; /// - alias core.stdc.math.cosh cosh; + alias cosh = core.stdc.math.cosh; /// - alias core.stdc.math.coshf cosh; + alias cosh = core.stdc.math.coshf; /// - alias core.stdc.math.coshl cosh; + alias cosh = core.stdc.math.coshl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ccosh cosh; - deprecated alias core.stdc.complex.ccoshf cosh; - deprecated alias core.stdc.complex.ccoshl cosh; + deprecated alias cosh = core.stdc.complex.ccosh; + deprecated alias cosh = core.stdc.complex.ccoshf; + deprecated alias cosh = core.stdc.complex.ccoshl; /// - alias core.stdc.math.sinh sinh; + alias sinh = core.stdc.math.sinh; /// - alias core.stdc.math.sinhf sinh; + alias sinh = core.stdc.math.sinhf; /// - alias core.stdc.math.sinhl sinh; + alias sinh = core.stdc.math.sinhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csinh sinh; - deprecated alias core.stdc.complex.csinhf sinh; - deprecated alias core.stdc.complex.csinhl sinh; + deprecated alias sinh = core.stdc.complex.csinh; + deprecated alias sinh = core.stdc.complex.csinhf; + deprecated alias sinh = core.stdc.complex.csinhl; /// - alias core.stdc.math.tanh tanh; + alias tanh = core.stdc.math.tanh; /// - alias core.stdc.math.tanhf tanh; + alias tanh = core.stdc.math.tanhf; /// - alias core.stdc.math.tanhl tanh; + alias tanh = core.stdc.math.tanhl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.ctanh tanh; - deprecated alias core.stdc.complex.ctanhf tanh; - deprecated alias core.stdc.complex.ctanhl tanh; + deprecated alias tanh = core.stdc.complex.ctanh; + deprecated alias tanh = core.stdc.complex.ctanhf; + deprecated alias tanh = core.stdc.complex.ctanhl; /// - alias core.stdc.math.exp exp; + alias exp = core.stdc.math.exp; /// - alias core.stdc.math.expf exp; + alias exp = core.stdc.math.expf; /// - alias core.stdc.math.expl exp; + alias exp = core.stdc.math.expl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cexp exp; - deprecated alias core.stdc.complex.cexpf exp; - deprecated alias core.stdc.complex.cexpl exp; + deprecated alias exp = core.stdc.complex.cexp; + deprecated alias exp = core.stdc.complex.cexpf; + deprecated alias exp = core.stdc.complex.cexpl; /// - alias core.stdc.math.exp2 exp2; + alias exp2 = core.stdc.math.exp2; /// - alias core.stdc.math.exp2f exp2; + alias exp2 = core.stdc.math.exp2f; /// - alias core.stdc.math.exp2l exp2; + alias exp2 = core.stdc.math.exp2l; /// - alias core.stdc.math.expm1 expm1; + alias expm1 = core.stdc.math.expm1; /// - alias core.stdc.math.expm1f expm1; + alias expm1 = core.stdc.math.expm1f; /// - alias core.stdc.math.expm1l expm1; + alias expm1 = core.stdc.math.expm1l; /// - alias core.stdc.math.frexp frexp; + alias frexp = core.stdc.math.frexp; /// - alias core.stdc.math.frexpf frexp; + alias frexp = core.stdc.math.frexpf; /// - alias core.stdc.math.frexpl frexp; + alias frexp = core.stdc.math.frexpl; /// - alias core.stdc.math.ilogb ilogb; + alias ilogb = core.stdc.math.ilogb; /// - alias core.stdc.math.ilogbf ilogb; + alias ilogb = core.stdc.math.ilogbf; /// - alias core.stdc.math.ilogbl ilogb; + alias ilogb = core.stdc.math.ilogbl; /// - alias core.stdc.math.ldexp ldexp; + alias ldexp = core.stdc.math.ldexp; /// - alias core.stdc.math.ldexpf ldexp; + alias ldexp = core.stdc.math.ldexpf; /// - alias core.stdc.math.ldexpl ldexp; + alias ldexp = core.stdc.math.ldexpl; /// - alias core.stdc.math.log log; + alias log = core.stdc.math.log; /// - alias core.stdc.math.logf log; + alias log = core.stdc.math.logf; /// - alias core.stdc.math.logl log; + alias log = core.stdc.math.logl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.clog log; - deprecated alias core.stdc.complex.clogf log; - deprecated alias core.stdc.complex.clogl log; + deprecated alias log = core.stdc.complex.clog; + deprecated alias log = core.stdc.complex.clogf; + deprecated alias log = core.stdc.complex.clogl; /// - alias core.stdc.math.log10 log10; + alias log10 = core.stdc.math.log10; /// - alias core.stdc.math.log10f log10; + alias log10 = core.stdc.math.log10f; /// - alias core.stdc.math.log10l log10; + alias log10 = core.stdc.math.log10l; /// - alias core.stdc.math.log1p log1p; + alias log1p = core.stdc.math.log1p; /// - alias core.stdc.math.log1pf log1p; + alias log1p = core.stdc.math.log1pf; /// - alias core.stdc.math.log1pl log1p; + alias log1p = core.stdc.math.log1pl; /// - alias core.stdc.math.log2 log2; + alias log2 = core.stdc.math.log2; /// - alias core.stdc.math.log2f log2; + alias log2 = core.stdc.math.log2f; /// - alias core.stdc.math.log2l log2; + alias log2 = core.stdc.math.log2l; /// - alias core.stdc.math.logb logb; + alias logb = core.stdc.math.logb; /// - alias core.stdc.math.logbf logb; + alias logb = core.stdc.math.logbf; /// - alias core.stdc.math.logbl logb; + alias logb = core.stdc.math.logbl; /// - alias core.stdc.math.modf modf; + alias modf = core.stdc.math.modf; /// - alias core.stdc.math.modff modf; + alias modf = core.stdc.math.modff; /// - alias core.stdc.math.modfl modf; + alias modf = core.stdc.math.modfl; /// - alias core.stdc.math.scalbn scalbn; + alias scalbn = core.stdc.math.scalbn; /// - alias core.stdc.math.scalbnf scalbn; + alias scalbn = core.stdc.math.scalbnf; /// - alias core.stdc.math.scalbnl scalbn; + alias scalbn = core.stdc.math.scalbnl; /// - alias core.stdc.math.scalbln scalbln; + alias scalbln = core.stdc.math.scalbln; /// - alias core.stdc.math.scalblnf scalbln; + alias scalbln = core.stdc.math.scalblnf; /// - alias core.stdc.math.scalblnl scalbln; + alias scalbln = core.stdc.math.scalblnl; /// - alias core.stdc.math.cbrt cbrt; + alias cbrt = core.stdc.math.cbrt; /// - alias core.stdc.math.cbrtf cbrt; + alias cbrt = core.stdc.math.cbrtf; /// - alias core.stdc.math.cbrtl cbrt; + alias cbrt = core.stdc.math.cbrtl; /// - alias core.stdc.math.fabs fabs; + alias fabs = core.stdc.math.fabs; version (CRuntime_Microsoft) { version (MinGW) { /// - alias core.stdc.math.fabsf fabs; + alias fabs = core.stdc.math.fabsf; /// - alias core.stdc.math.fabsl fabs; + alias fabs = core.stdc.math.fabsl; } } else { /// - alias core.stdc.math.fabsf fabs; + alias fabs = core.stdc.math.fabsf; /// - alias core.stdc.math.fabsl fabs; + alias fabs = core.stdc.math.fabsl; } // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cabs fabs; - deprecated alias core.stdc.complex.cabsf fabs; - deprecated alias core.stdc.complex.cabsl fabs; + deprecated alias fabs = core.stdc.complex.cabs; + deprecated alias fabs = core.stdc.complex.cabsf; + deprecated alias fabs = core.stdc.complex.cabsl; /// - alias core.stdc.math.hypot hypot; + alias hypot = core.stdc.math.hypot; /// - alias core.stdc.math.hypotf hypot; + alias hypot = core.stdc.math.hypotf; /// - alias core.stdc.math.hypotl hypot; + alias hypot = core.stdc.math.hypotl; /// - alias core.stdc.math.pow pow; + alias pow = core.stdc.math.pow; /// - alias core.stdc.math.powf pow; + alias pow = core.stdc.math.powf; /// - alias core.stdc.math.powl pow; + alias pow = core.stdc.math.powl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.cpow pow; - deprecated alias core.stdc.complex.cpowf pow; - deprecated alias core.stdc.complex.cpowl pow; + deprecated alias pow = core.stdc.complex.cpow; + deprecated alias pow = core.stdc.complex.cpowf; + deprecated alias pow = core.stdc.complex.cpowl; /// - alias core.stdc.math.sqrt sqrt; + alias sqrt = core.stdc.math.sqrt; /// - alias core.stdc.math.sqrtf sqrt; + alias sqrt = core.stdc.math.sqrtf; /// - alias core.stdc.math.sqrtl sqrt; + alias sqrt = core.stdc.math.sqrtl; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.csqrt sqrt; - deprecated alias core.stdc.complex.csqrtf sqrt; - deprecated alias core.stdc.complex.csqrtl sqrt; + deprecated alias sqrt = core.stdc.complex.csqrt; + deprecated alias sqrt = core.stdc.complex.csqrtf; + deprecated alias sqrt = core.stdc.complex.csqrtl; /// - alias core.stdc.math.erf erf; + alias erf = core.stdc.math.erf; /// - alias core.stdc.math.erff erf; + alias erf = core.stdc.math.erff; /// - alias core.stdc.math.erfl erf; + alias erf = core.stdc.math.erfl; /// - alias core.stdc.math.erfc erfc; + alias erfc = core.stdc.math.erfc; /// - alias core.stdc.math.erfcf erfc; + alias erfc = core.stdc.math.erfcf; /// - alias core.stdc.math.erfcl erfc; + alias erfc = core.stdc.math.erfcl; /// - alias core.stdc.math.lgamma lgamma; + alias lgamma = core.stdc.math.lgamma; /// - alias core.stdc.math.lgammaf lgamma; + alias lgamma = core.stdc.math.lgammaf; /// - alias core.stdc.math.lgammal lgamma; + alias lgamma = core.stdc.math.lgammal; /// - alias core.stdc.math.tgamma tgamma; + alias tgamma = core.stdc.math.tgamma; /// - alias core.stdc.math.tgammaf tgamma; + alias tgamma = core.stdc.math.tgammaf; /// - alias core.stdc.math.tgammal tgamma; + alias tgamma = core.stdc.math.tgammal; /// - alias core.stdc.math.ceil ceil; + alias ceil = core.stdc.math.ceil; /// - alias core.stdc.math.ceilf ceil; + alias ceil = core.stdc.math.ceilf; /// - alias core.stdc.math.ceill ceil; + alias ceil = core.stdc.math.ceill; /// - alias core.stdc.math.floor floor; + alias floor = core.stdc.math.floor; /// - alias core.stdc.math.floorf floor; + alias floor = core.stdc.math.floorf; /// - alias core.stdc.math.floorl floor; + alias floor = core.stdc.math.floorl; /// - alias core.stdc.math.nearbyint nearbyint; + alias nearbyint = core.stdc.math.nearbyint; /// - alias core.stdc.math.nearbyintf nearbyint; + alias nearbyint = core.stdc.math.nearbyintf; /// - alias core.stdc.math.nearbyintl nearbyint; + alias nearbyint = core.stdc.math.nearbyintl; /// - alias core.stdc.math.rint rint; + alias rint = core.stdc.math.rint; /// - alias core.stdc.math.rintf rint; + alias rint = core.stdc.math.rintf; /// - alias core.stdc.math.rintl rint; + alias rint = core.stdc.math.rintl; /// - alias core.stdc.math.lrint lrint; + alias lrint = core.stdc.math.lrint; /// - alias core.stdc.math.lrintf lrint; + alias lrint = core.stdc.math.lrintf; /// - alias core.stdc.math.lrintl lrint; + alias lrint = core.stdc.math.lrintl; /// - alias core.stdc.math.llrint llrint; + alias llrint = core.stdc.math.llrint; /// - alias core.stdc.math.llrintf llrint; + alias llrint = core.stdc.math.llrintf; /// - alias core.stdc.math.llrintl llrint; + alias llrint = core.stdc.math.llrintl; /// - alias core.stdc.math.round round; + alias round = core.stdc.math.round; /// - alias core.stdc.math.roundf round; + alias round = core.stdc.math.roundf; /// - alias core.stdc.math.roundl round; + alias round = core.stdc.math.roundl; /// - alias core.stdc.math.lround lround; + alias lround = core.stdc.math.lround; /// - alias core.stdc.math.lroundf lround; + alias lround = core.stdc.math.lroundf; /// - alias core.stdc.math.lroundl lround; + alias lround = core.stdc.math.lroundl; /// - alias core.stdc.math.llround llround; + alias llround = core.stdc.math.llround; /// - alias core.stdc.math.llroundf llround; + alias llround = core.stdc.math.llroundf; /// - alias core.stdc.math.llroundl llround; + alias llround = core.stdc.math.llroundl; /// - alias core.stdc.math.trunc trunc; + alias trunc = core.stdc.math.trunc; /// - alias core.stdc.math.truncf trunc; + alias trunc = core.stdc.math.truncf; /// - alias core.stdc.math.truncl trunc; + alias trunc = core.stdc.math.truncl; /// - alias core.stdc.math.fmod fmod; + alias fmod = core.stdc.math.fmod; /// - alias core.stdc.math.fmodf fmod; + alias fmod = core.stdc.math.fmodf; /// - alias core.stdc.math.fmodl fmod; + alias fmod = core.stdc.math.fmodl; /// - alias core.stdc.math.remainder remainder; + alias remainder = core.stdc.math.remainder; /// - alias core.stdc.math.remainderf remainder; + alias remainder = core.stdc.math.remainderf; /// - alias core.stdc.math.remainderl remainder; + alias remainder = core.stdc.math.remainderl; /// - alias core.stdc.math.remquo remquo; + alias remquo = core.stdc.math.remquo; /// - alias core.stdc.math.remquof remquo; + alias remquo = core.stdc.math.remquof; /// - alias core.stdc.math.remquol remquo; + alias remquo = core.stdc.math.remquol; /// - alias core.stdc.math.copysign copysign; + alias copysign = core.stdc.math.copysign; /// - alias core.stdc.math.copysignf copysign; + alias copysign = core.stdc.math.copysignf; /// - alias core.stdc.math.copysignl copysign; + alias copysign = core.stdc.math.copysignl; /// - alias core.stdc.math.nan nan; + alias nan = core.stdc.math.nan; /// - alias core.stdc.math.nanf nan; + alias nan = core.stdc.math.nanf; /// - alias core.stdc.math.nanl nan; + alias nan = core.stdc.math.nanl; /// - alias core.stdc.math.nextafter nextafter; + alias nextafter = core.stdc.math.nextafter; /// - alias core.stdc.math.nextafterf nextafter; + alias nextafter = core.stdc.math.nextafterf; /// - alias core.stdc.math.nextafterl nextafter; + alias nextafter = core.stdc.math.nextafterl; /// - alias core.stdc.math.nexttoward nexttoward; + alias nexttoward = core.stdc.math.nexttoward; /// - alias core.stdc.math.nexttowardf nexttoward; + alias nexttoward = core.stdc.math.nexttowardf; /// - alias core.stdc.math.nexttowardl nexttoward; + alias nexttoward = core.stdc.math.nexttowardl; /// - alias core.stdc.math.fdim fdim; + alias fdim = core.stdc.math.fdim; /// - alias core.stdc.math.fdimf fdim; + alias fdim = core.stdc.math.fdimf; /// - alias core.stdc.math.fdiml fdim; + alias fdim = core.stdc.math.fdiml; /// - alias core.stdc.math.fmax fmax; + alias fmax = core.stdc.math.fmax; /// - alias core.stdc.math.fmaxf fmax; + alias fmax = core.stdc.math.fmaxf; /// - alias core.stdc.math.fmaxl fmax; + alias fmax = core.stdc.math.fmaxl; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fmin fmin; + alias fmin = core.stdc.math.fmin; /// - alias core.stdc.math.fminl fmin; + alias fmin = core.stdc.math.fminl; /// - alias core.stdc.math.fma fma; + alias fma = core.stdc.math.fma; /// - alias core.stdc.math.fmaf fma; + alias fma = core.stdc.math.fmaf; /// - alias core.stdc.math.fmal fma; + alias fma = core.stdc.math.fmal; // @@@DEPRECATED_2.105@@@ - deprecated alias core.stdc.complex.carg carg; - deprecated alias core.stdc.complex.cargf carg; - deprecated alias core.stdc.complex.cargl carg; - deprecated alias core.stdc.complex.cimag cimag; - deprecated alias core.stdc.complex.cimagf cimag; - deprecated alias core.stdc.complex.cimagl cimag; - deprecated alias core.stdc.complex.conj conj; - deprecated alias core.stdc.complex.conjf conj; - deprecated alias core.stdc.complex.conjl conj; - deprecated alias core.stdc.complex.cproj cproj; - deprecated alias core.stdc.complex.cprojf cproj; - deprecated alias core.stdc.complex.cprojl cproj; + deprecated alias carg = core.stdc.complex.carg; + deprecated alias carg = core.stdc.complex.cargf; + deprecated alias carg = core.stdc.complex.cargl; + deprecated alias cimag = core.stdc.complex.cimag; + deprecated alias cimag = core.stdc.complex.cimagf; + deprecated alias cimag = core.stdc.complex.cimagl; + deprecated alias conj = core.stdc.complex.conj; + deprecated alias conj = core.stdc.complex.conjf; + deprecated alias conj = core.stdc.complex.conjl; + deprecated alias cproj = core.stdc.complex.cproj; + deprecated alias cproj = core.stdc.complex.cprojf; + deprecated alias cproj = core.stdc.complex.cprojl; // deprecated alias core.stdc.complex.creal creal; // deprecated alias core.stdc.complex.crealf creal; // deprecated alias core.stdc.complex.creall creal; diff --git a/runtime/druntime/src/core/stdc/time.d b/runtime/druntime/src/core/stdc/time.d index d7a57655fab..ead533718b7 100644 --- a/runtime/druntime/src/core/stdc/time.d +++ b/runtime/druntime/src/core/stdc/time.d @@ -29,26 +29,55 @@ extern (C): nothrow: @nogc: -/// -pragma(mangle, muslRedirTime64Mangle!("difftime", "__difftime64")) -pure double difftime(time_t time1, time_t time0); // MT-Safe -/// -pragma(mangle, muslRedirTime64Mangle!("mktime", "__mktime64")) -@system time_t mktime(scope tm* timeptr); // @system: MT-Safe env locale -/// -pragma(mangle, muslRedirTime64Mangle!("time", "__time64")) -time_t time(scope time_t* timer); +version (NetBSD) +{ + /// + pragma(mangle, "__difftime50") + pure double difftime(time_t time1, time_t time0); // MT-Safe + /// + pragma(mangle, "__mktime50") + @system time_t mktime(scope tm* timeptr); // @system: MT-Safe env locale + /// + pragma(mangle, "__time50") + time_t time(scope time_t* timer); -/// -@system char* asctime(const scope tm* timeptr); // @system: MT-Unsafe race:asctime locale -/// -pragma(mangle, muslRedirTime64Mangle!("ctime", "__ctime64")) -@system char* ctime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf race:asctime env locale -/// -pragma(mangle, muslRedirTime64Mangle!("gmtime", "__gmtime64")) -@system tm* gmtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale -/// -pragma(mangle, muslRedirTime64Mangle!("localtime", "__localtime64")) -@system tm* localtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale -/// -@system size_t strftime(scope char* s, size_t maxsize, const scope char* format, const scope tm* timeptr); // @system: MT-Safe env locale + /// + @system char* asctime(const scope tm* timeptr); // @system: MT-Unsafe race:asctime locale + /// + pragma(mangle, "__ctime50") + @system char* ctime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf race:asctime env locale + /// + pragma(mangle, "__gmtime50") + @system tm* gmtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale + /// + pragma(mangle, "__locatime50") + @system tm* localtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale + /// + @system size_t strftime(scope char* s, size_t maxsize, const scope char* format, const scope tm* timeptr); // @system: MT-Safe env locale +} +else +{ + /// + pragma(mangle, muslRedirTime64Mangle!("difftime", "__difftime64")) + pure double difftime(time_t time1, time_t time0); // MT-Safe + /// + pragma(mangle, muslRedirTime64Mangle!("mktime", "__mktime64")) + @system time_t mktime(scope tm* timeptr); // @system: MT-Safe env locale + /// + pragma(mangle, muslRedirTime64Mangle!("time", "__time64")) + time_t time(scope time_t* timer); + + /// + @system char* asctime(const scope tm* timeptr); // @system: MT-Unsafe race:asctime locale + /// + pragma(mangle, muslRedirTime64Mangle!("ctime", "__ctime64")) + @system char* ctime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf race:asctime env locale + /// + pragma(mangle, muslRedirTime64Mangle!("gmtime", "__gmtime64")) + @system tm* gmtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale + /// + pragma(mangle, muslRedirTime64Mangle!("localtime", "__localtime64")) + @system tm* localtime(const scope time_t* timer); // @system: MT-Unsafe race:tmbuf env locale + /// + @system size_t strftime(scope char* s, size_t maxsize, const scope char* format, const scope tm* timeptr); // @system: MT-Safe env locale +} diff --git a/runtime/druntime/src/core/stdc/wchar_.d b/runtime/druntime/src/core/stdc/wchar_.d index 6ed2dfe8318..43c72ec1905 100644 --- a/runtime/druntime/src/core/stdc/wchar_.d +++ b/runtime/druntime/src/core/stdc/wchar_.d @@ -129,14 +129,31 @@ else version (CRuntime_UClibc) wchar_t __wc = 0; } } +else version (Windows) +{ + /// + struct __mbstate_t + { + int __count; + union ___value + { + wint_t __wch = 0; + char[4] __wchb; + } + ___value __value; + } + + /// + alias mbstate_t = __mbstate_t; +} else { /// - alias int mbstate_t; + alias mbstate_t = int; } /// -alias wchar_t wint_t; +alias wint_t = wchar_t; /// enum wchar_t WEOF = 0xFFFF; diff --git a/runtime/druntime/src/core/stdc/wctype.d b/runtime/druntime/src/core/stdc/wctype.d index 88b6a01245f..2b55f3decbb 100644 --- a/runtime/druntime/src/core/stdc/wctype.d +++ b/runtime/druntime/src/core/stdc/wctype.d @@ -53,9 +53,9 @@ else version (CRuntime_Bionic) else { /// - alias wchar_t wctrans_t; + alias wctrans_t = wchar_t; /// - alias wchar_t wctype_t; + alias wctype_t = wchar_t; } /// diff --git a/runtime/druntime/src/core/sync/condition.d b/runtime/druntime/src/core/sync/condition.d index 3acee7a7f45..9328f6d4886 100644 --- a/runtime/druntime/src/core/sync/condition.d +++ b/runtime/druntime/src/core/sync/condition.d @@ -246,7 +246,7 @@ class Condition } else version (Posix) { - int rc = pthread_cond_wait( cast(pthread_cond_t*) &m_hndl, (cast(Mutex) m_assocMutex).handleAddr() ); + int rc = pthread_cond_wait( cast(pthread_cond_t*) &m_hndl, (cast(Mutex) mutex()).handleAddr() ); if ( rc ) throw staticError!AssertError("Unable to wait for condition", __FILE__, __LINE__); } @@ -307,7 +307,7 @@ class Condition mktspec( t, val ); int rc = pthread_cond_timedwait( cast(pthread_cond_t*) &m_hndl, - (cast(Mutex) m_assocMutex).handleAddr(), + (cast(Mutex) mutex()).handleAddr(), &t ); if ( !rc ) return true; diff --git a/runtime/druntime/src/core/sync/mutex.d b/runtime/druntime/src/core/sync/mutex.d index 8993f85071b..86a112119d8 100644 --- a/runtime/druntime/src/core/sync/mutex.d +++ b/runtime/druntime/src/core/sync/mutex.d @@ -100,7 +100,8 @@ class Mutex : abort("Error: pthread_mutex_init failed."); } - m_proxy.link = this; + auto self = cast(Mutex) this; + self.m_proxy.link = self; this.__monitor = cast(void*) &m_proxy; } @@ -183,13 +184,14 @@ class Mutex : final void lock_nothrow(this Q)() nothrow @trusted @nogc if (is(Q == Mutex) || is(Q == shared Mutex)) { + auto self = cast(Mutex) this; version (Windows) { - EnterCriticalSection(&m_hndl); + EnterCriticalSection(&self.m_hndl); } else version (Posix) { - if (pthread_mutex_lock(&m_hndl) == 0) + if (pthread_mutex_lock(&self.m_hndl) == 0) return; SyncError syncErr = cast(SyncError) __traits(initSymbol, SyncError).ptr; @@ -221,13 +223,14 @@ class Mutex : final void unlock_nothrow(this Q)() nothrow @trusted @nogc if (is(Q == Mutex) || is(Q == shared Mutex)) { + auto self = cast(Mutex) this; version (Windows) { - LeaveCriticalSection(&m_hndl); + LeaveCriticalSection(&self.m_hndl); } else version (Posix) { - if (pthread_mutex_unlock(&m_hndl) == 0) + if (pthread_mutex_unlock(&self.m_hndl) == 0) return; SyncError syncErr = cast(SyncError) __traits(initSymbol, SyncError).ptr; @@ -263,13 +266,14 @@ class Mutex : final bool tryLock_nothrow(this Q)() nothrow @trusted @nogc if (is(Q == Mutex) || is(Q == shared Mutex)) { + auto self = cast(Mutex) this; version (Windows) { - return TryEnterCriticalSection(&m_hndl) != 0; + return TryEnterCriticalSection(&self.m_hndl) != 0; } else version (Posix) { - return pthread_mutex_trylock(&m_hndl) == 0; + return pthread_mutex_trylock(&self.m_hndl) == 0; } } diff --git a/runtime/druntime/src/core/sync/rwmutex.d b/runtime/druntime/src/core/sync/rwmutex.d index cb581621ec5..e46b2f736f4 100644 --- a/runtime/druntime/src/core/sync/rwmutex.d +++ b/runtime/druntime/src/core/sync/rwmutex.d @@ -20,6 +20,7 @@ public import core.sync.exception; import core.sync.condition; import core.sync.mutex; import core.memory; +import core.atomic : atomicLoad; //////////////////////////////////////////////////////////////////////////////// @@ -107,11 +108,11 @@ class ReadWriteMutex if ( !m_commonMutex ) throw new SyncError( "Unable to initialize mutex" ); - m_readerQueue = new shared Condition( m_commonMutex ); + m_readerQueue = new shared Condition(atomicLoad(m_commonMutex)); if ( !m_readerQueue ) throw new SyncError( "Unable to initialize mutex" ); - m_writerQueue = new shared Condition( m_commonMutex ); + m_writerQueue = new shared Condition(atomicLoad(m_commonMutex)); if ( !m_writerQueue ) throw new SyncError( "Unable to initialize mutex" ); @@ -139,7 +140,7 @@ class ReadWriteMutex ///ditto @property Policy policy() shared @safe nothrow { - return m_policy; + return atomicLoad(m_policy); } //////////////////////////////////////////////////////////////////////////// @@ -161,7 +162,7 @@ class ReadWriteMutex ///ditto @property shared(Reader) reader() shared @safe nothrow { - return m_reader; + return atomicLoad(m_reader); } /** @@ -178,7 +179,7 @@ class ReadWriteMutex ///ditto @property shared(Writer) writer() shared @safe nothrow { - return m_writer; + return atomicLoad(m_writer); } @@ -200,7 +201,7 @@ class ReadWriteMutex this(this Q)() @trusted nothrow if (is(Q == Reader) || is(Q == shared Reader)) { - m_proxy.link = this; + m_proxy.link = cast(typeof(m_proxy.link)) this; this.__monitor = cast(void*) &m_proxy; } @@ -223,15 +224,7 @@ class ReadWriteMutex /// ditto @trusted void lock() shared { - synchronized( m_commonMutex ) - { - ++(cast()m_numQueuedReaders); - scope(exit) --(cast()m_numQueuedReaders); - - while ( shouldQueueReader ) - m_readerQueue.wait(); - ++(cast()m_numActiveReaders); - } + (cast() this).lock(); } /** @@ -252,14 +245,7 @@ class ReadWriteMutex /// ditto @trusted void unlock() shared { - synchronized( m_commonMutex ) - { - if ( --(cast()m_numActiveReaders) < 1 ) - { - if ( m_numQueuedWriters > 0 ) - m_writerQueue.notify(); - } - } + (cast() this).unlock(); } /** @@ -284,13 +270,7 @@ class ReadWriteMutex /// ditto @trusted bool tryLock() shared { - synchronized( m_commonMutex ) - { - if ( shouldQueueReader ) - return false; - ++(cast()m_numActiveReaders); - return true; - } + return (cast() this).tryLock(); } /** @@ -341,25 +321,7 @@ class ReadWriteMutex /// ditto @trusted bool tryLock(Duration timeout) shared { - const initialTime = MonoTime.currTime; - synchronized( m_commonMutex ) - { - ++(cast()m_numQueuedReaders); - scope(exit) --(cast()m_numQueuedReaders); - - while (shouldQueueReader) - { - const timeElapsed = MonoTime.currTime - initialTime; - if (timeElapsed >= timeout) - return false; - auto nextWait = timeout - timeElapsed; - // Avoid problems calling wait(Duration) with huge arguments. - enum maxWaitPerCall = dur!"hours"(24 * 365); - m_readerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall); - } - ++(cast()m_numActiveReaders); - return true; - } + return (cast() this).tryLock(timeout); } @@ -410,7 +372,7 @@ class ReadWriteMutex this(this Q)() @trusted nothrow if (is(Q == Writer) || is(Q == shared Writer)) { - m_proxy.link = this; + m_proxy.link = cast(typeof(m_proxy.link)) this; this.__monitor = cast(void*) &m_proxy; } @@ -434,15 +396,7 @@ class ReadWriteMutex /// ditto @trusted void lock() shared { - synchronized( m_commonMutex ) - { - ++(cast()m_numQueuedWriters); - scope(exit) --(cast()m_numQueuedWriters); - - while ( shouldQueueWriter ) - m_writerQueue.wait(); - ++(cast()m_numActiveWriters); - } + (cast() this).lock(); } @@ -477,27 +431,7 @@ class ReadWriteMutex /// ditto @trusted void unlock() shared { - synchronized( m_commonMutex ) - { - if ( --(cast()m_numActiveWriters) < 1 ) - { - switch ( m_policy ) - { - default: - case Policy.PREFER_READERS: - if ( m_numQueuedReaders > 0 ) - m_readerQueue.notifyAll(); - else if ( m_numQueuedWriters > 0 ) - m_writerQueue.notify(); - break; - case Policy.PREFER_WRITERS: - if ( m_numQueuedWriters > 0 ) - m_writerQueue.notify(); - else if ( m_numQueuedReaders > 0 ) - m_readerQueue.notifyAll(); - } - } - } + (cast() this).unlock(); } @@ -523,13 +457,7 @@ class ReadWriteMutex /// ditto @trusted bool tryLock() shared { - synchronized( m_commonMutex ) - { - if ( shouldQueueWriter ) - return false; - ++(cast()m_numActiveWriters); - return true; - } + return (cast() this).tryLock(); } /** @@ -580,25 +508,7 @@ class ReadWriteMutex /// ditto @trusted bool tryLock(Duration timeout) shared { - const initialTime = MonoTime.currTime; - synchronized( m_commonMutex ) - { - ++(cast()m_numQueuedWriters); - scope(exit) --(cast()m_numQueuedWriters); - - while (shouldQueueWriter) - { - const timeElapsed = MonoTime.currTime - initialTime; - if (timeElapsed >= timeout) - return false; - auto nextWait = timeout - timeElapsed; - // Avoid problems calling wait(Duration) with huge arguments. - enum maxWaitPerCall = dur!"hours"(24 * 365); - m_writerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall); - } - ++(cast()m_numActiveWriters); - return true; - } + return (cast() this).tryLock(timeout); } private: diff --git a/runtime/druntime/src/core/sys/darwin/crt_externs.d b/runtime/druntime/src/core/sys/darwin/crt_externs.d index ec0788d7de4..a34db83c9d5 100644 --- a/runtime/druntime/src/core/sys/darwin/crt_externs.d +++ b/runtime/druntime/src/core/sys/darwin/crt_externs.d @@ -8,7 +8,7 @@ */ module core.sys.darwin.crt_externs; -version (CoreDoc) +version (CoreDdoc) { /** * In reality this will be $(REF mach_header, core, sys, darwin, mach, loader) diff --git a/runtime/druntime/src/core/sys/darwin/mach/kern_return.d b/runtime/druntime/src/core/sys/darwin/mach/kern_return.d index 3714e01712c..5fd383bc96e 100644 --- a/runtime/druntime/src/core/sys/darwin/mach/kern_return.d +++ b/runtime/druntime/src/core/sys/darwin/mach/kern_return.d @@ -25,7 +25,7 @@ else version (WatchOS) version (Darwin): extern (C): -alias int kern_return_t; +alias kern_return_t = int; enum : kern_return_t { diff --git a/runtime/druntime/src/core/sys/darwin/mach/semaphore.d b/runtime/druntime/src/core/sys/darwin/mach/semaphore.d index abaa2671116..83c3e7c0f60 100644 --- a/runtime/druntime/src/core/sys/darwin/mach/semaphore.d +++ b/runtime/druntime/src/core/sys/darwin/mach/semaphore.d @@ -30,12 +30,12 @@ nothrow: public import core.sys.darwin.mach.kern_return; public import core.sys.darwin.mach.port; -alias mach_port_t task_t; -alias mach_port_t thread_t; -alias mach_port_t semaphore_t; -alias int sync_policy_t; +alias task_t = mach_port_t; +alias thread_t = mach_port_t; +alias semaphore_t = mach_port_t; +alias sync_policy_t = int; -alias int clock_res_t; +alias clock_res_t = int; struct mach_timespec_t { uint tv_sec; diff --git a/runtime/druntime/src/core/sys/darwin/mach/thread_act.d b/runtime/druntime/src/core/sys/darwin/mach/thread_act.d index d455d1b8303..3a6e051981e 100644 --- a/runtime/druntime/src/core/sys/darwin/mach/thread_act.d +++ b/runtime/druntime/src/core/sys/darwin/mach/thread_act.d @@ -45,10 +45,10 @@ version (PPC64) version (i386) { - alias mach_port_t thread_act_t; - alias void thread_state_t; - alias int thread_state_flavor_t; - alias natural_t mach_msg_type_number_t; + alias thread_act_t = mach_port_t; + alias thread_state_t = void; + alias thread_state_flavor_t = int; + alias mach_msg_type_number_t = natural_t; enum { @@ -136,8 +136,8 @@ version (i386) x86_THREAD_STATE_COUNT = cast(mach_msg_type_number_t)( x86_thread_state_t.sizeof / int.sizeof ), } - alias x86_THREAD_STATE MACHINE_THREAD_STATE; - alias x86_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT; + alias MACHINE_THREAD_STATE = x86_THREAD_STATE; + alias MACHINE_THREAD_STATE_COUNT = x86_THREAD_STATE_COUNT; mach_port_t mach_thread_self(); kern_return_t thread_suspend(thread_act_t); diff --git a/runtime/druntime/src/core/sys/darwin/sys/attr.d b/runtime/druntime/src/core/sys/darwin/sys/attr.d index cb22b380ef6..30c5191df9f 100644 --- a/runtime/druntime/src/core/sys/darwin/sys/attr.d +++ b/runtime/druntime/src/core/sys/darwin/sys/attr.d @@ -50,7 +50,7 @@ enum enum SEARCHFS_MAX_SEARCHPARMS = 4096; -alias uint text_encoding_t, fsobj_type_t, fsobj_tag_t, fsfile_type_t, fsvolid_t, attrgroup_t; +alias text_encoding_t = uint, fsobj_type_t = uint, fsobj_tag_t = uint, fsfile_type_t = uint, fsvolid_t = uint, attrgroup_t = uint; struct attrlist { diff --git a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf32.d b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf32.d index c796cd8fa74..c3c2d88b4b9 100644 --- a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf32.d +++ b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf32.d @@ -13,10 +13,10 @@ extern (C): import core.stdc.stdint; public import core.sys.dragonflybsd.sys.elf_common; -alias uint64_t Elf32_Lword; -alias Elf32_Word Elf32_Hashelt; -alias Elf32_Word Elf32_Size; -alias Elf32_Sword Elf32_Ssize; +alias Elf32_Lword = uint64_t; +alias Elf32_Hashelt = Elf32_Word; +alias Elf32_Size = Elf32_Word; +alias Elf32_Ssize = Elf32_Sword; struct Elf32_Dyn { @@ -28,7 +28,7 @@ struct Elf32_Dyn } _d_un d_un; } -alias Elf_Note Elf32_Nhdr; +alias Elf32_Nhdr = Elf_Note; struct Elf32_Cap { diff --git a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf64.d b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf64.d index 89e3ca38a89..6b911dbe2a4 100644 --- a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf64.d +++ b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf64.d @@ -13,10 +13,10 @@ extern (C): import core.stdc.stdint; public import core.sys.dragonflybsd.sys.elf_common; -alias uint64_t Elf64_Lword; -alias Elf64_Word Elf64_Hashelt; -alias Elf64_Xword Elf64_Size; -alias Elf64_Sxword Elf64_Ssize; +alias Elf64_Lword = uint64_t; +alias Elf64_Hashelt = Elf64_Word; +alias Elf64_Size = Elf64_Xword; +alias Elf64_Ssize = Elf64_Sxword; struct Elf64_Dyn { @@ -35,7 +35,7 @@ extern (D) pure auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; } } -alias Elf_Note Elf64_Nhdr; +alias Elf64_Nhdr = Elf_Note; struct Elf64_Cap { diff --git a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf_common.d b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf_common.d index 90e5861a6ac..e0d6b24d7f1 100644 --- a/runtime/druntime/src/core/sys/dragonflybsd/sys/elf_common.d +++ b/runtime/druntime/src/core/sys/dragonflybsd/sys/elf_common.d @@ -60,7 +60,7 @@ enum DT_USED = 0x7ffffffe; enum DF_1_BIND_NOW = 0x00000001; -alias VER_NDX VER_DEF_IDX; +alias VER_DEF_IDX = VER_NDX; enum VER_FLG_INFO = 0x4; @@ -74,7 +74,7 @@ extern (D) pure @safe enum VER_NEED_WEAK = 32768; enum VER_NEED_HIDDEN = VER_NDX_HIDDEN; -alias VER_NDX VER_NEED_IDX; +alias VER_NEED_IDX = VER_NDX; enum VERSYM_HIDDEN = 0x8000; enum VERSYM_VERSION = 0x7fff; diff --git a/runtime/druntime/src/core/sys/dragonflybsd/sys/link_elf.d b/runtime/druntime/src/core/sys/dragonflybsd/sys/link_elf.d index 5dad964057c..7b7b350001e 100644 --- a/runtime/druntime/src/core/sys/dragonflybsd/sys/link_elf.d +++ b/runtime/druntime/src/core/sys/dragonflybsd/sys/link_elf.d @@ -44,7 +44,7 @@ struct link_map void* l_ld; link_map* l_next, l_prev; } -alias link_map Link_map; +alias Link_map = link_map; enum { @@ -73,8 +73,8 @@ struct dl_phdr_info } -private alias int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = int function(dl_phdr_info*, size_t, void *) @nogc; int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; diff --git a/runtime/druntime/src/core/sys/elf/package.d b/runtime/druntime/src/core/sys/elf/package.d index 60e05d97036..ccf4e6f8637 100644 --- a/runtime/druntime/src/core/sys/elf/package.d +++ b/runtime/druntime/src/core/sys/elf/package.d @@ -11,30 +11,30 @@ nothrow: import core.stdc.stdint; -alias uint16_t Elf32_Half; -alias uint16_t Elf64_Half; +alias Elf32_Half = uint16_t; +alias Elf64_Half = uint16_t; -alias uint32_t Elf32_Word; -alias int32_t Elf32_Sword; -alias uint32_t Elf64_Word; -alias int32_t Elf64_Sword; +alias Elf32_Word = uint32_t; +alias Elf32_Sword = int32_t; +alias Elf64_Word = uint32_t; +alias Elf64_Sword = int32_t; -alias uint64_t Elf32_Xword; -alias int64_t Elf32_Sxword; -alias uint64_t Elf64_Xword; -alias int64_t Elf64_Sxword; +alias Elf32_Xword = uint64_t; +alias Elf32_Sxword = int64_t; +alias Elf64_Xword = uint64_t; +alias Elf64_Sxword = int64_t; -alias uint32_t Elf32_Addr; -alias uint64_t Elf64_Addr; +alias Elf32_Addr = uint32_t; +alias Elf64_Addr = uint64_t; -alias uint32_t Elf32_Off; -alias uint64_t Elf64_Off; +alias Elf32_Off = uint32_t; +alias Elf64_Off = uint64_t; -alias uint16_t Elf32_Section; -alias uint16_t Elf64_Section; +alias Elf32_Section = uint16_t; +alias Elf64_Section = uint16_t; -alias Elf32_Half Elf32_Versym; -alias Elf64_Half Elf64_Versym; +alias Elf32_Versym = Elf32_Half; +alias Elf64_Versym = Elf64_Half; enum EI_NIDENT = 16; @@ -492,9 +492,9 @@ extern (D) auto ELF32_ST_BIND(T)(T val) { return cast(ubyte)val >> 4; } auto ELF32_ST_TYPE(T)(T val) { return val & 0xf; } auto ELF32_ST_INFO(B, T)(B bind, T type) { return (bind << 4) + (type & 0xf); } - alias ELF32_ST_BIND ELF64_ST_BIND; - alias ELF32_ST_TYPE ELF64_ST_TYPE; - alias ELF32_ST_INFO ELF64_ST_INFO; + alias ELF64_ST_BIND = ELF32_ST_BIND; + alias ELF64_ST_TYPE = ELF32_ST_TYPE; + alias ELF64_ST_INFO = ELF32_ST_INFO; } enum STB_LOCAL = 0; @@ -866,9 +866,9 @@ extern (D) auto ELF32_M_INFO(S, SZ)(S sym, SZ size) { return (sym << 8) + cast(ubyte)size; } } -alias ELF32_M_SYM ELF64_M_SYM; -alias ELF32_M_SIZE ELF64_M_SIZE; -alias ELF32_M_INFO ELF64_M_INFO; +alias ELF64_M_SYM = ELF32_M_SYM; +alias ELF64_M_SIZE = ELF32_M_SIZE; +alias ELF64_M_INFO = ELF32_M_INFO; enum EF_CPU32 = 0x00810000; enum R_68K_NONE = 0; @@ -1380,7 +1380,7 @@ enum LL_EXPORTS = (1 << 3); enum LL_DELAY_LOAD = (1 << 4); enum LL_DELTA = (1 << 5); -alias Elf32_Addr Elf32_Conflict; +alias Elf32_Conflict = Elf32_Addr; enum EF_PARISC_TRAPNIL = 0x00010000; enum EF_PARISC_EXT = 0x00020000; diff --git a/runtime/druntime/src/core/sys/freebsd/config.d b/runtime/druntime/src/core/sys/freebsd/config.d index 9011049ec41..144ef055372 100644 --- a/runtime/druntime/src/core/sys/freebsd/config.d +++ b/runtime/druntime/src/core/sys/freebsd/config.d @@ -14,10 +14,12 @@ public import core.sys.posix.config; // NOTE: When adding newer versions of FreeBSD, verify all current versioned // bindings are still compatible with the release. - version (FreeBSD_15) enum __FreeBSD_version = 1500000; -else version (FreeBSD_14) enum __FreeBSD_version = 1400000; -else version (FreeBSD_13) enum __FreeBSD_version = 1302000; -else version (FreeBSD_12) enum __FreeBSD_version = 1204000; + version (CoreDdoc) enum __FreeBSD_version = 1600011; // keep at latest +else version (FreeBSD_16) enum __FreeBSD_version = 1600011; +else version (FreeBSD_15) enum __FreeBSD_version = 1500063; +else version (FreeBSD_14) enum __FreeBSD_version = 1400097; +else version (FreeBSD_13) enum __FreeBSD_version = 1301000; +else version (FreeBSD_12) enum __FreeBSD_version = 1203000; else version (FreeBSD_11) enum __FreeBSD_version = 1104000; else version (FreeBSD_10) enum __FreeBSD_version = 1004000; else version (FreeBSD_9) enum __FreeBSD_version = 903000; diff --git a/runtime/druntime/src/core/sys/freebsd/sys/elf32.d b/runtime/druntime/src/core/sys/freebsd/sys/elf32.d index 4e8ae2843fb..75c293eefd5 100644 --- a/runtime/druntime/src/core/sys/freebsd/sys/elf32.d +++ b/runtime/druntime/src/core/sys/freebsd/sys/elf32.d @@ -13,10 +13,10 @@ nothrow: import core.stdc.stdint; public import core.sys.freebsd.sys.elf_common; -alias uint64_t Elf32_Lword; -alias Elf32_Word Elf32_Hashelt; -alias Elf32_Word Elf32_Size; -alias Elf32_Sword Elf32_Ssize; +alias Elf32_Lword = uint64_t; +alias Elf32_Hashelt = Elf32_Word; +alias Elf32_Size = Elf32_Word; +alias Elf32_Ssize = Elf32_Sword; struct Elf32_Dyn { @@ -28,7 +28,7 @@ struct Elf32_Dyn } _d_un d_un; } -alias Elf_Note Elf32_Nhdr; +alias Elf32_Nhdr = Elf_Note; struct Elf32_Cap { diff --git a/runtime/druntime/src/core/sys/freebsd/sys/elf64.d b/runtime/druntime/src/core/sys/freebsd/sys/elf64.d index c56460c123b..f1dff66ad38 100644 --- a/runtime/druntime/src/core/sys/freebsd/sys/elf64.d +++ b/runtime/druntime/src/core/sys/freebsd/sys/elf64.d @@ -13,10 +13,10 @@ nothrow: import core.stdc.stdint; public import core.sys.freebsd.sys.elf_common; -alias uint64_t Elf64_Lword; -alias Elf64_Word Elf64_Hashelt; -alias Elf64_Xword Elf64_Size; -alias Elf64_Sxword Elf64_Ssize; +alias Elf64_Lword = uint64_t; +alias Elf64_Hashelt = Elf64_Word; +alias Elf64_Size = Elf64_Xword; +alias Elf64_Ssize = Elf64_Sxword; struct Elf64_Dyn { @@ -35,7 +35,7 @@ extern (D) auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; } } -alias Elf_Note Elf64_Nhdr; +alias Elf64_Nhdr = Elf_Note; struct Elf64_Cap { diff --git a/runtime/druntime/src/core/sys/freebsd/sys/elf_common.d b/runtime/druntime/src/core/sys/freebsd/sys/elf_common.d index 05e78bf0dc6..c167c80bb7f 100644 --- a/runtime/druntime/src/core/sys/freebsd/sys/elf_common.d +++ b/runtime/druntime/src/core/sys/freebsd/sys/elf_common.d @@ -79,11 +79,11 @@ enum STV_EXPORTED = 4; enum STV_SINGLETON = 5; enum STV_ELIMINATE = 6; -alias VER_NDX VER_DEF_IDX; +alias VER_DEF_IDX = VER_NDX; enum VER_NEED_WEAK = 32768; enum VER_NEED_HIDDEN = VER_NDX_HIDDEN; -alias VER_NDX VER_NEED_IDX; +alias VER_NEED_IDX = VER_NDX; enum VER_NDX_GIVEN = 2; enum VER_NDX_HIDDEN = 32768; diff --git a/runtime/druntime/src/core/sys/freebsd/sys/link_elf.d b/runtime/druntime/src/core/sys/freebsd/sys/link_elf.d index d743d51a7b2..f1e4c739422 100644 --- a/runtime/druntime/src/core/sys/freebsd/sys/link_elf.d +++ b/runtime/druntime/src/core/sys/freebsd/sys/link_elf.d @@ -42,7 +42,7 @@ struct link_map void* l_ld; link_map* l_next, l_prev; } -alias link_map Link_map; +alias Link_map = link_map; enum { @@ -71,8 +71,8 @@ struct dl_phdr_info } -private alias extern(C) int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias extern(C) int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = extern(C) int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = extern(C) int function(dl_phdr_info*, size_t, void *) @nogc; extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; extern int _rtld_addr_phdr(const void*, dl_phdr_info*) @nogc; diff --git a/runtime/druntime/src/core/sys/linux/dlfcn.d b/runtime/druntime/src/core/sys/linux/dlfcn.d index 9d86d891555..7a110bbbf93 100644 --- a/runtime/druntime/src/core/sys/linux/dlfcn.d +++ b/runtime/druntime/src/core/sys/linux/dlfcn.d @@ -165,7 +165,7 @@ static if (_GNU_SOURCE) { enum RTLD_NEXT = cast(void *)-1L; enum RTLD_DEFAULT = cast(void *)0; - alias c_long Lmid_t; + alias Lmid_t = c_long; enum LM_ID_BASE = 0; enum LM_ID_NEWLM = -1; } diff --git a/runtime/druntime/src/core/sys/linux/elf.d b/runtime/druntime/src/core/sys/linux/elf.d index 0486cbee0bb..18a61354c78 100644 --- a/runtime/druntime/src/core/sys/linux/elf.d +++ b/runtime/druntime/src/core/sys/linux/elf.d @@ -16,7 +16,7 @@ public import core.sys.elf; extern (D) { auto ELF32_ST_VISIBILITY(O)(O o) { return o & 0x03; } - alias ELF32_ST_VISIBILITY ELF64_ST_VISIBILITY; + alias ELF64_ST_VISIBILITY = ELF32_ST_VISIBILITY; } struct Elf32_Nhdr diff --git a/runtime/druntime/src/core/sys/linux/hdlc/ioctl.d b/runtime/druntime/src/core/sys/linux/hdlc/ioctl.d new file mode 100644 index 00000000000..78992964b64 --- /dev/null +++ b/runtime/druntime/src/core/sys/linux/hdlc/ioctl.d @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +module core.sys.linux.hdlc.ioctl; + +version (linux): +import core.sys.linux.net.if_ : IFNAMSIZ; + +extern(C): +@nogc: +nothrow: + +enum GENERIC_HDLC_VERSION = 4; /* For synchronization with sethdlc utility */ + +enum CLOCK_DEFAULT = 0; /* Default setting */ +enum CLOCK_EXT = 1; /* External TX and RX clock - DTE */ +enum CLOCK_INT = 2; /* Internal TX and RX clock - DCE */ +enum CLOCK_TXINT = 3; /* Internal TX and external RX clock */ +enum CLOCK_TXFROMRX = 4; /* TX clock derived from external RX clock */ + + +enum ENCODING_DEFAULT = 0; /* Default setting */ +enum ENCODING_NRZ = 1; +enum ENCODING_NRZI = 2; +enum ENCODING_FM_MARK = 3; +enum ENCODING_FM_SPACE = 4; +enum ENCODING_MANCHESTER = 5; + + +enum PARITY_DEFAULT = 0; /* Default setting */ +enum PARITY_NONE = 1; /* No parity */ +enum PARITY_CRC16_PR0 = 2; /* CRC16, initial value 0x0000 */ +enum PARITY_CRC16_PR1 = 3; /* CRC16, initial value 0xFFFF */ +enum PARITY_CRC16_PR0_CCITT = 4; /* CRC16, initial 0x0000, ITU-T version */ +enum PARITY_CRC16_PR1_CCITT = 5; /* CRC16, initial 0xFFFF, ITU-T version */ +enum PARITY_CRC32_PR0_CCITT = 6; /* CRC32, initial value 0x00000000 */ +enum PARITY_CRC32_PR1_CCITT = 7; /* CRC32, initial value 0xFFFFFFFF */ + +enum LMI_DEFAULT = 0; /* Default setting */ +enum LMI_NONE = 1; /* No LMI, all PVCs are static */ +enum LMI_ANSI = 2; /* ANSI Annex D */ +enum LMI_CCITT = 3; /* ITU-T Annex A */ +enum LMI_CISCO = 4; /* The "original" LMI, aka Gang of Four */ + +struct sync_serial_settings { + uint clock_rate; /* bits per second */ + uint clock_type; /* internal, external, TX-internal etc. */ + ushort loopback; +} /* V.35, V.24, X.21 */ + +struct te1_settings{ + uint clock_rate; /* bits per second */ + uint clock_type; /* internal, external, TX-internal etc. */ + ushort loopback; + uint slot_map; +} /* T1, E1 */ + +struct raw_hdlc_proto { + ushort encoding; + ushort parity; +} + +struct fr_proto { + uint t391; + uint t392; + uint n391; + uint n392; + uint n393; + ushort lmi; + ushort dce; /* 1 for DCE (network side) operation */ +} + +struct fr_proto_pvc { + uint dlci; +} /* for creating/deleting FR PVCs */ + +struct fr_proto_pvc_info { + uint dlci; + char[IFNAMSIZ] master = 0; /* Name of master FRAD device */ +} /* for returning PVC information only */ + +struct cisco_proto { + uint interval; + uint timeout; +} + +struct x25_hdlc_proto { + ushort dce; /* 1 for DCE (network side) operation */ + uint modulo; /* modulo (8 = basic / 128 = extended) */ + uint window; /* frame window size */ + uint t1; /* timeout t1 */ + uint t2; /* timeout t2 */ + uint n2; /* frame retry counter */ +} diff --git a/runtime/druntime/src/core/sys/linux/link.d b/runtime/druntime/src/core/sys/linux/link.d index ebb5771f705..2b0b1f50cac 100644 --- a/runtime/druntime/src/core/sys/linux/link.d +++ b/runtime/druntime/src/core/sys/linux/link.d @@ -33,68 +33,68 @@ import core.sys.linux.elf; // version (Android) { - alias __WORDSIZE __ELF_NATIVE_CLASS; + alias __ELF_NATIVE_CLASS = __WORDSIZE; version (D_LP64) - alias uint64_t Elf_Symndx; + alias Elf_Symndx = uint64_t; else - alias uint32_t Elf_Symndx; + alias Elf_Symndx = uint32_t; } else version (X86_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (HPPA_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (MIPS_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (PPC_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (ARM_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (RISCV_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (SPARC_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else version (IBMZ_Any) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; + alias __ELF_NATIVE_CLASS = __WORDSIZE; static if (__WORDSIZE == 64) - alias uint64_t Elf_Symndx; + alias Elf_Symndx = uint64_t; else - alias uint32_t Elf_Symndx; + alias Elf_Symndx = uint32_t; } else version (LoongArch64) { // http://sourceware.org/git/?p=glibc.git;a=blob;f=bits/elfclass.h - alias __WORDSIZE __ELF_NATIVE_CLASS; - alias uint32_t Elf_Symndx; + alias __ELF_NATIVE_CLASS = __WORDSIZE; + alias Elf_Symndx = uint32_t; } else static assert(0, "unimplemented"); @@ -102,7 +102,7 @@ else template ElfW(string type) { - mixin("alias Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~" ElfW;"); + mixin("alias ElfW = Elf"~__ELF_NATIVE_CLASS.stringof~"_"~type~";"); } enum @@ -182,8 +182,8 @@ struct dl_phdr_info void *dlpi_tls_data; } -private alias extern(C) int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias extern(C) int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = extern(C) int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = extern(C) int function(dl_phdr_info*, size_t, void *) @nogc; extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; diff --git a/runtime/druntime/src/core/sys/linux/net/if_.d b/runtime/druntime/src/core/sys/linux/net/if_.d new file mode 100644 index 00000000000..ba6fc84f130 --- /dev/null +++ b/runtime/druntime/src/core/sys/linux/net/if_.d @@ -0,0 +1,134 @@ +/++ + D header file for Linux's net/if.h. + + Copyright: Copyright 2025 + License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + +/ +module core.sys.linux.net.if_; + +version (linux): +public import core.sys.posix.sys.socket : sockaddr; +public import core.sys.linux.hdlc.ioctl; + +extern(C): +@nogc: +nothrow: + +enum IFNAMSIZ = 16; +enum IFALIASZ = 256; +enum ALTIFNAMSIZ = 128; +enum IFHWADDRLEN = 6; + +enum IFF_UP = 0x1; +enum IFF_BROADCAST = 0x2; +enum IFF_DEBUG = 0x4; +enum IFF_LOOPBACK = 0x8; +enum IFF_POINTOPOINT = 0x10; +enum IFF_NOTRAILERS = 0x20; +enum IFF_RUNNING = 0x40; +enum IFF_NOARP = 0x80; +enum IFF_PROMISC = 0x100; +enum IFF_ALLMULTI = 0x200; +enum IFF_MASTER = 0x400; +enum IFF_SLAVE = 0x800; +enum IFF_MULTICAST = 0x1000; +enum IFF_PORTSEL = 0x2000; +enum IFF_AUTOMEDIA = 0x4000; +enum IFF_DYNAMIC = 0x8000; +enum IFF_LOWER_UP = 0x10000; +enum IFF_DORMANT = 0x20000; +enum IFF_ECHO = 0x40000; + +enum IF_GET_IFACE = 0x0001; /* for querying only */ +enum IF_GET_PROTO = 0x0002; + +/* For definitions see hdlc.h */ +enum IF_IFACE_V35 = 0x1000; /* V.35 serial interface */ +enum IF_IFACE_V24 = 0x1001; /* V.24 serial interface */ +enum IF_IFACE_X21 = 0x1002; /* X.21 serial interface */ +enum IF_IFACE_T1 = 0x1003; /* T1 telco serial interface */ +enum IF_IFACE_E1 = 0x1004; /* E1 telco serial interface */ +enum IF_IFACE_SYNC_SERIAL = 0x1005; /* can't be set by software */ +enum IF_IFACE_X21D = 0x1006; /* X.21 Dual Clocking (FarSite) */ + +/* For definitions see hdlc.h */ +enum IF_PROTO_HDLC = 0x2000; /* raw HDLC protocol */ +enum IF_PROTO_PPP = 0x2001; /* PPP protocol */ +enum IF_PROTO_CISCO = 0x2002; /* Cisco HDLC protocol */ +enum IF_PROTO_FR = 0x2003; /* Frame Relay protocol */ +enum IF_PROTO_FR_ADD_PVC = 0x2004; /* Create FR PVC */ +enum IF_PROTO_FR_DEL_PVC = 0x2005; /* Delete FR PVC */ +enum IF_PROTO_X25 = 0x2006; /* X.25 */ +enum IF_PROTO_HDLC_ETH = 0x2007; /* raw HDLC, Ethernet emulation */ +enum IF_PROTO_FR_ADD_ETH_PVC = 0x2008; /* Create FR Ethernet-bridged PVC */ +enum IF_PROTO_FR_DEL_ETH_PVC = 0x2009; /* Delete FR Ethernet-bridged PVC */ +enum IF_PROTO_FR_PVC = 0x200A; /* for reading PVC status */ +enum IF_PROTO_FR_ETH_PVC = 0x200B; +enum IF_PROTO_RAW = 0x200C; /* RAW Socket */ + +enum IF_OPER_UNKNOWN = 0; +enum IF_OPER_NOTPRESENT = 1; +enum IF_OPER_DOWN = 2; +enum IF_OPER_LOWERLAYERDOWN = 3; +enum IF_OPER_TESTING = 4; +enum IF_OPER_DORMANT = 5; +enum IF_OPER_UP = 6; + +enum IF_LINK_MODE_DEFAULT = 0; +enum IF_LINK_MODE_DORMANT = 1; /* limit upward transition to dormant */ +enum IF_LINK_MODE_TESTING = 2; /* limit upward transition to testing */ + +struct ifmap { + uint mem_start; + uint mem_end; + ushort base_addr; + ubyte irq; + ubyte dma; + ubyte port; + /* 3 bytes spare */ +} + +struct if_settings { + uint type; /* Type of physical device or protocol */ + uint size; /* Size of the data allocated by the caller */ + union { + /* {atm/eth/dsl}_settings anyone ? */ + raw_hdlc_proto* raw_hdlc; + cisco_proto* cisco; + fr_proto* fr; + fr_proto_pvc* fr_pvc; + fr_proto_pvc_info* fr_pvc_info; + x25_hdlc_proto* x25; + + /* interface settings */ + sync_serial_settings* sync; + te1_settings* te1; + }; +} + +struct ifreq { + union + { + char[IFNAMSIZ] ifrn_name = 0; /* if name, e.g. "en0" */ + } + + union { + + short ifru_flags; + int ifru_ivalue; + int ifru_mtu; + ifmap ifru_map; + char[IFNAMSIZ] ifru_slave; /* Just fits the size */ + char[IFNAMSIZ] ifru_newname; + void* ifru_data; + if_settings ifru_settings; + } +} + +struct ifconf { + int ifc_len; /* size of buffer */ + union { + char* ifcu_buf; + ifreq* ifcu_req; + } +} diff --git a/runtime/druntime/src/core/sys/linux/sched.d b/runtime/druntime/src/core/sys/linux/sched.d index 97a1478d76a..155d41d3127 100644 --- a/runtime/druntime/src/core/sys/linux/sched.d +++ b/runtime/druntime/src/core/sys/linux/sched.d @@ -93,7 +93,7 @@ private // helpers } /// Type for array elements in 'cpu_set_t'. -alias c_ulong cpu_mask; +alias cpu_mask = c_ulong; /// Data structure to describe CPU mask. struct cpu_set_t diff --git a/runtime/druntime/src/core/sys/linux/stdio.d b/runtime/druntime/src/core/sys/linux/stdio.d index 2d079fd71f7..1d18429b036 100644 --- a/runtime/druntime/src/core/sys/linux/stdio.d +++ b/runtime/druntime/src/core/sys/linux/stdio.d @@ -16,10 +16,10 @@ import core.stdc.stddef : wchar_t; extern(C) nothrow { - alias ssize_t function(void *cookie, char *buf, size_t size) cookie_read_function_t; - alias ssize_t function(void *cookie, const(char) *buf, size_t size) cookie_write_function_t; - alias int function(void *cookie, off64_t *offset, int whence) cookie_seek_function_t; - alias int function(void *cookie) cookie_close_function_t; + alias cookie_read_function_t = ssize_t function(void *cookie, char *buf, size_t size); + alias cookie_write_function_t = ssize_t function(void *cookie, const(char) *buf, size_t size); + alias cookie_seek_function_t = int function(void *cookie, off64_t *offset, int whence); + alias cookie_close_function_t = int function(void *cookie); struct cookie_io_functions_t { diff --git a/runtime/druntime/src/core/sys/linux/sys/eventfd.d b/runtime/druntime/src/core/sys/linux/sys/eventfd.d index bb2d1371faa..42c81629e88 100644 --- a/runtime/druntime/src/core/sys/linux/sys/eventfd.d +++ b/runtime/druntime/src/core/sys/linux/sys/eventfd.d @@ -30,7 +30,7 @@ version (X86_64) version = X86_Any; import core.stdc.stdint: uint64_t; /// Type for the event counter -alias uint64_t eventfd_t; +alias eventfd_t = uint64_t; /* Return file descriptor for generic event channel. Set initial value to count. */ diff --git a/runtime/druntime/src/core/sys/linux/sys/inotify.d b/runtime/druntime/src/core/sys/linux/sys/inotify.d index 727471e4555..3e582262f1c 100644 --- a/runtime/druntime/src/core/sys/linux/sys/inotify.d +++ b/runtime/druntime/src/core/sys/linux/sys/inotify.d @@ -54,7 +54,7 @@ struct inotify_event enum: uint { - IN_ACCESS = 0x00000000, + IN_ACCESS = 0x00000001, IN_MODIFY = 0x00000002, IN_ATTRIB = 0x00000004, IN_CLOSE_WRITE = 0x00000008, diff --git a/runtime/druntime/src/core/sys/netbsd/sys/elf32.d b/runtime/druntime/src/core/sys/netbsd/sys/elf32.d index 48386f60212..14046cdceff 100644 --- a/runtime/druntime/src/core/sys/netbsd/sys/elf32.d +++ b/runtime/druntime/src/core/sys/netbsd/sys/elf32.d @@ -13,10 +13,10 @@ nothrow: import core.stdc.stdint; public import core.sys.netbsd.sys.elf_common; -alias uint64_t Elf32_Lword; -alias Elf32_Word Elf32_Hashelt; -alias Elf32_Word Elf32_Size; -alias Elf32_Sword Elf32_Ssize; +alias Elf32_Lword = uint64_t; +alias Elf32_Hashelt = Elf32_Word; +alias Elf32_Size = Elf32_Word; +alias Elf32_Ssize = Elf32_Sword; struct Elf32_Dyn { @@ -28,7 +28,7 @@ struct Elf32_Dyn } _d_un d_un; } -alias Elf_Note Elf32_Nhdr; +alias Elf32_Nhdr = Elf_Note; struct Elf32_Cap { diff --git a/runtime/druntime/src/core/sys/netbsd/sys/elf64.d b/runtime/druntime/src/core/sys/netbsd/sys/elf64.d index 3eeaa90cf10..33e25327d9c 100644 --- a/runtime/druntime/src/core/sys/netbsd/sys/elf64.d +++ b/runtime/druntime/src/core/sys/netbsd/sys/elf64.d @@ -13,10 +13,10 @@ nothrow: import core.stdc.stdint; public import core.sys.netbsd.sys.elf_common; -alias uint64_t Elf64_Lword; -alias Elf64_Word Elf64_Hashelt; -alias Elf64_Xword Elf64_Size; -alias Elf64_Sxword Elf64_Ssize; +alias Elf64_Lword = uint64_t; +alias Elf64_Hashelt = Elf64_Word; +alias Elf64_Size = Elf64_Xword; +alias Elf64_Ssize = Elf64_Sxword; struct Elf64_Dyn { @@ -35,7 +35,7 @@ extern (D) auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; } } -alias Elf_Note Elf64_Nhdr; +alias Elf64_Nhdr = Elf_Note; struct Elf64_Cap { diff --git a/runtime/druntime/src/core/sys/netbsd/sys/elf_common.d b/runtime/druntime/src/core/sys/netbsd/sys/elf_common.d index 6c911bdc6b9..1c13f72bb60 100644 --- a/runtime/druntime/src/core/sys/netbsd/sys/elf_common.d +++ b/runtime/druntime/src/core/sys/netbsd/sys/elf_common.d @@ -82,11 +82,11 @@ enum STV_EXPORTED = 4; enum STV_SINGLETON = 5; enum STV_ELIMINATE = 6; -alias VER_NDX VER_DEF_IDX; +alias VER_DEF_IDX = VER_NDX; enum VER_NEED_WEAK = 32768; enum VER_NEED_HIDDEN = VER_NDX_HIDDEN; -alias VER_NDX VER_NEED_IDX; +alias VER_NEED_IDX = VER_NDX; enum VER_NDX_GIVEN = 2; enum VER_NDX_HIDDEN = 32768; diff --git a/runtime/druntime/src/core/sys/netbsd/sys/link_elf.d b/runtime/druntime/src/core/sys/netbsd/sys/link_elf.d index 4caec61adc8..2740f789c3a 100644 --- a/runtime/druntime/src/core/sys/netbsd/sys/link_elf.d +++ b/runtime/druntime/src/core/sys/netbsd/sys/link_elf.d @@ -36,7 +36,7 @@ struct link_map link_map* l_next; link_map* l_prev; } -alias link_map Link_map; +alias Link_map = link_map; enum { @@ -65,7 +65,7 @@ struct dl_phdr_info } -private alias extern(C) int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias extern(C) int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = extern(C) int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = extern(C) int function(dl_phdr_info*, size_t, void *) @nogc; extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; diff --git a/runtime/druntime/src/core/sys/openbsd/sys/elf32.d b/runtime/druntime/src/core/sys/openbsd/sys/elf32.d index c56112186aa..4f3c3336b2e 100644 --- a/runtime/druntime/src/core/sys/openbsd/sys/elf32.d +++ b/runtime/druntime/src/core/sys/openbsd/sys/elf32.d @@ -14,10 +14,10 @@ nothrow: import core.stdc.stdint; public import core.sys.openbsd.sys.elf_common; -alias uint64_t Elf32_Lword; -alias Elf32_Word Elf32_Hashelt; -alias Elf32_Word Elf32_Size; -alias Elf32_Sword Elf32_Ssize; +alias Elf32_Lword = uint64_t; +alias Elf32_Hashelt = Elf32_Word; +alias Elf32_Size = Elf32_Word; +alias Elf32_Ssize = Elf32_Sword; struct Elf32_Dyn { @@ -29,7 +29,7 @@ struct Elf32_Dyn } _d_un d_un; } -alias Elf_Note Elf32_Nhdr; +alias Elf32_Nhdr = Elf_Note; struct Elf32_Cap { diff --git a/runtime/druntime/src/core/sys/openbsd/sys/elf64.d b/runtime/druntime/src/core/sys/openbsd/sys/elf64.d index 47f84d44daf..c5acc72e223 100644 --- a/runtime/druntime/src/core/sys/openbsd/sys/elf64.d +++ b/runtime/druntime/src/core/sys/openbsd/sys/elf64.d @@ -14,10 +14,10 @@ nothrow: import core.stdc.stdint; public import core.sys.openbsd.sys.elf_common; -alias uint64_t Elf64_Lword; -alias Elf64_Word Elf64_Hashelt; -alias Elf64_Xword Elf64_Size; -alias Elf64_Sxword Elf64_Ssize; +alias Elf64_Lword = uint64_t; +alias Elf64_Hashelt = Elf64_Word; +alias Elf64_Size = Elf64_Xword; +alias Elf64_Ssize = Elf64_Sxword; struct Elf64_Dyn { @@ -36,7 +36,7 @@ extern (D) pure auto ELF64_R_TYPE_INFO(D, T)(D d, T t) { return cast(Elf64_Xword) d << 8 + cast(Elf64_Xword) t; } } -alias Elf_Note Elf64_Nhdr; +alias Elf64_Nhdr = Elf_Note; struct Elf64_Cap { diff --git a/runtime/druntime/src/core/sys/openbsd/sys/elf_common.d b/runtime/druntime/src/core/sys/openbsd/sys/elf_common.d index 4812e1f04dd..b30d253ea05 100644 --- a/runtime/druntime/src/core/sys/openbsd/sys/elf_common.d +++ b/runtime/druntime/src/core/sys/openbsd/sys/elf_common.d @@ -61,7 +61,7 @@ enum DT_USED = 0x7ffffffe; enum DF_1_BIND_NOW = 0x00000001; -alias VER_NDX VER_DEF_IDX; +alias VER_DEF_IDX = VER_NDX; enum VER_FLG_INFO = 0x4; @@ -75,7 +75,7 @@ extern (D) pure @safe enum VER_NEED_WEAK = 32768; enum VER_NEED_HIDDEN = VER_NDX_HIDDEN; -alias VER_NDX VER_NEED_IDX; +alias VER_NEED_IDX = VER_NDX; enum VERSYM_HIDDEN = 0x8000; enum VERSYM_VERSION = 0x7fff; diff --git a/runtime/druntime/src/core/sys/openbsd/sys/link_elf.d b/runtime/druntime/src/core/sys/openbsd/sys/link_elf.d index 55fc79268e2..581ff1b4c39 100644 --- a/runtime/druntime/src/core/sys/openbsd/sys/link_elf.d +++ b/runtime/druntime/src/core/sys/openbsd/sys/link_elf.d @@ -58,8 +58,8 @@ struct dl_phdr_info } -private alias int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = int function(dl_phdr_info*, size_t, void *) @nogc; int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; diff --git a/runtime/druntime/src/core/sys/posix/aio.d b/runtime/druntime/src/core/sys/posix/aio.d index 3a537a4a575..674fab9fc99 100644 --- a/runtime/druntime/src/core/sys/posix/aio.d +++ b/runtime/druntime/src/core/sys/posix/aio.d @@ -386,6 +386,18 @@ else version (OpenBSD) { // OpenBSD does not implement aio.h } +else version (NetBSD) +{ + int aio_cancel(int fd, aiocb* aiocbp); + int aio_error(const(aiocb)* aiocbp); + int aio_fsync(int op, aiocb* aiocbp); + int aio_read(aiocb* aiocbp); + ssize_t aio_return(aiocb* aiocbp); + pragma(mangle, "__aio_suspend50") + int aio_suspend(const(aiocb*)* aiocb_list, int nitems, const(timespec)* timeout); + int aio_write(aiocb* aiocbp); + int lio_listio(int mode, const(aiocb*)* aiocb_list, int nitems, sigevent* sevp); +} else { int aio_read(aiocb* aiocbp); diff --git a/runtime/druntime/src/core/sys/posix/arpa/inet.d b/runtime/druntime/src/core/sys/posix/arpa/inet.d index c602e17d322..33f31094e33 100644 --- a/runtime/druntime/src/core/sys/posix/arpa/inet.d +++ b/runtime/druntime/src/core/sys/posix/arpa/inet.d @@ -60,8 +60,8 @@ int inet_pton(int, const scope char*, void*); version (CRuntime_Glibc) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -83,8 +83,8 @@ version (CRuntime_Glibc) } else version (Darwin) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -106,8 +106,8 @@ else version (Darwin) } else version (FreeBSD) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -129,8 +129,8 @@ else version (FreeBSD) } else version (NetBSD) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -152,8 +152,8 @@ else version (NetBSD) } else version (OpenBSD) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -185,8 +185,8 @@ else version (OpenBSD) } else version (DragonFlyBSD) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -208,8 +208,8 @@ else version (DragonFlyBSD) } else version (Solaris) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -231,7 +231,7 @@ else version (Solaris) } else version (CRuntime_Bionic) { - alias uint32_t in_addr_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -263,8 +263,8 @@ else version (CRuntime_Bionic) } else version (CRuntime_Musl) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { @@ -286,8 +286,8 @@ else version (CRuntime_Musl) } else version (CRuntime_UClibc) { - alias uint16_t in_port_t; - alias uint32_t in_addr_t; + alias in_port_t = uint16_t; + alias in_addr_t = uint32_t; struct in_addr { diff --git a/runtime/druntime/src/core/sys/posix/dirent.d b/runtime/druntime/src/core/sys/posix/dirent.d index 0e822f556c7..c77d6da22b2 100644 --- a/runtime/druntime/src/core/sys/posix/dirent.d +++ b/runtime/druntime/src/core/sys/posix/dirent.d @@ -197,7 +197,7 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { dirent* readdir64(DIR*); - alias readdir64 readdir; + alias readdir = readdir64; } else { @@ -256,7 +256,7 @@ else version (FreeBSD) DT_WHT = 14 } - alias void* DIR; + alias DIR = void*; version (GNU) { @@ -285,10 +285,10 @@ else version (NetBSD) DT_WHT = 14 } - alias void* DIR; + alias DIR = void*; dirent* __readdir30(DIR*); - alias __readdir30 readdir; + alias readdir = __readdir30; } else version (OpenBSD) { @@ -304,7 +304,7 @@ else version (OpenBSD) DT_SOCK = 12, } - alias void* DIR; + alias DIR = void*; dirent* readdir(DIR*); } @@ -324,7 +324,7 @@ else version (DragonFlyBSD) DT_DBF = 15, /* database record file */ } - alias void* DIR; + alias DIR = void*; dirent* readdir(DIR*); } @@ -348,7 +348,7 @@ else version (Solaris) static if (__USE_LARGEFILE64) { dirent* readdir64(DIR*); - alias readdir64 readdir; + alias readdir = readdir64; } else { @@ -429,7 +429,7 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { dirent* readdir64(DIR*); - alias readdir64 readdir; + alias readdir = readdir64; } else { @@ -441,6 +441,26 @@ else static assert(false, "Unsupported platform"); } +// +// POSIX.1-2008 +// +/* +int dirfd(DIR*); +*/ +version (NetBSD) +{ + // On NetBSD, this is a macro in dirent.h, not a function. + extern (D) int dirfd()(DIR* dir) nothrow @nogc + { + // ABI guarantees dd_fd remains the first field + return *(cast(int*) dir); + } +} +else +{ + nothrow @nogc int dirfd(DIR* dir); +} + // Only OS X out of the Darwin family needs special treatment. Other Darwins // (iOS, TVOS, WatchOS) are fine with normal symbol names for these functions // in else below. @@ -471,7 +491,7 @@ else version (NetBSD) { int closedir(DIR*); DIR* __opendir30(const scope char*); - alias __opendir30 opendir; + alias opendir = __opendir30; void rewinddir(DIR*); } else @@ -494,7 +514,7 @@ version (CRuntime_Glibc) static if ( __USE_LARGEFILE64 ) { int readdir64_r(DIR*, dirent*, dirent**); - alias readdir64_r readdir_r; + alias readdir_r = readdir64_r; } else { @@ -529,7 +549,7 @@ else version (DragonFlyBSD) else version (NetBSD) { int __readdir_r30(DIR*, dirent*, dirent**); - alias __readdir_r30 readdir_r; + alias readdir_r = __readdir_r30; } else version (OpenBSD) { @@ -540,7 +560,7 @@ else version (Solaris) static if (__USE_LARGEFILE64) { int readdir64_r(DIR*, dirent*, dirent**); - alias readdir64_r readdir_r; + alias readdir_r = readdir64_r; } else { @@ -560,7 +580,7 @@ else version (CRuntime_UClibc) static if ( __USE_LARGEFILE64 ) { int readdir64_r(DIR*, dirent*, dirent**); - alias readdir64_r readdir_r; + alias readdir_r = readdir64_r; } else { diff --git a/runtime/druntime/src/core/sys/posix/fcntl.d b/runtime/druntime/src/core/sys/posix/fcntl.d index 4f7a22592d4..f64e234cedf 100644 --- a/runtime/druntime/src/core/sys/posix/fcntl.d +++ b/runtime/druntime/src/core/sys/posix/fcntl.d @@ -886,13 +886,13 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { int creat64(const scope char*, mode_t); - alias creat64 creat; + alias creat = creat64; int open64(const scope char*, int, ...); - alias open64 open; + alias open = open64; int openat64(int, const scope char*, int, ...); - alias openat64 openat; + alias openat = openat64; } else { @@ -941,9 +941,9 @@ else version (Solaris) static if (__USE_LARGEFILE64) { - alias creat creat64; - alias open open64; - alias openat openat64; + alias creat64 = creat; + alias open64 = open; + alias openat64 = openat; } } else @@ -951,13 +951,13 @@ else version (Solaris) static if (__USE_LARGEFILE64) { int creat64(const scope char*, mode_t); - alias creat64 creat; + alias creat = creat64; int open64(const scope char*, int, ...); - alias open64 open; + alias open = open64; int openat64(int, const scope char*, int, ...); - alias openat64 openat; + alias openat = openat64; } else { @@ -984,13 +984,13 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { int creat64(const scope char*, mode_t); - alias creat64 creat; + alias creat = creat64; int open64(const scope char*, int, ...); - alias open64 open; + alias open = open64; int openat64(int, const scope char*, int, ...); - alias openat64 openat; + alias openat = openat64; } else { diff --git a/runtime/druntime/src/core/sys/posix/iconv.d b/runtime/druntime/src/core/sys/posix/iconv.d index e588fb8210a..f160b8bf039 100644 --- a/runtime/druntime/src/core/sys/posix/iconv.d +++ b/runtime/druntime/src/core/sys/posix/iconv.d @@ -36,7 +36,7 @@ nothrow: @nogc: -alias void* iconv_t; +alias iconv_t = void*; /// Allocate descriptor for code conversion from codeset FROMCODE to /// codeset TOCODE. diff --git a/runtime/druntime/src/core/sys/posix/locale.d b/runtime/druntime/src/core/sys/posix/locale.d index 0864f7c6325..821487afd29 100644 --- a/runtime/druntime/src/core/sys/posix/locale.d +++ b/runtime/druntime/src/core/sys/posix/locale.d @@ -118,8 +118,17 @@ version (DarwinBSDLocale) lconv* localeconv(); /// Create a new locale locale_t newlocale(int mask, const char* locale, locale_t base); - /// Set the C library's notion of natural language formatting style - char* setlocale(int category, const char* locale); + version (NetBSD) + { + /// Set the C library's notion of natural language formatting style + pragma(mangle, "__setlocale50") + char* setlocale(int category, const char* locale); + } + else + { + /// Set the C library's notion of natural language formatting style + char* setlocale(int category, const char* locale); + } /// Set the per-thread locale locale_t uselocale (locale_t locale); } diff --git a/runtime/druntime/src/core/sys/posix/mqueue.d b/runtime/druntime/src/core/sys/posix/mqueue.d index f8b4b150944..a272f85b313 100644 --- a/runtime/druntime/src/core/sys/posix/mqueue.d +++ b/runtime/druntime/src/core/sys/posix/mqueue.d @@ -34,7 +34,7 @@ extern (C): version (CRuntime_Glibc) { /// Message queue descriptor. - alias int mqd_t; + alias mqd_t = int; /** * Used in getting and setting the attributes of a message queue. diff --git a/runtime/druntime/src/core/sys/posix/poll.d b/runtime/druntime/src/core/sys/posix/poll.d index 5901f62b5c3..4a320d158d1 100644 --- a/runtime/druntime/src/core/sys/posix/poll.d +++ b/runtime/druntime/src/core/sys/posix/poll.d @@ -55,7 +55,7 @@ version (CRuntime_Glibc) short revents; } - alias c_ulong nfds_t; + alias nfds_t = c_ulong; int poll(pollfd*, nfds_t, int); } @@ -68,13 +68,13 @@ else version (Darwin) short revents; } - alias uint nfds_t; + alias nfds_t = uint; int poll(pollfd*, nfds_t, int); } else version (FreeBSD) { - alias uint nfds_t; + alias nfds_t = uint; struct pollfd { @@ -87,7 +87,7 @@ else version (FreeBSD) } else version (NetBSD) { - alias uint nfds_t; + alias nfds_t = uint; struct pollfd { @@ -100,7 +100,7 @@ else version (NetBSD) } else version (OpenBSD) { - alias uint nfds_t; + alias nfds_t = uint; struct pollfd { @@ -113,7 +113,7 @@ else version (OpenBSD) } else version (DragonFlyBSD) { - alias uint nfds_t; + alias nfds_t = uint; struct pollfd { @@ -126,7 +126,7 @@ else version (DragonFlyBSD) } else version (Solaris) { - alias c_ulong nfds_t; + alias nfds_t = c_ulong; struct pollfd { @@ -146,7 +146,7 @@ else version (CRuntime_Bionic) short revents; } - alias uint nfds_t; + alias nfds_t = uint; int poll(pollfd*, nfds_t, c_long); } @@ -159,7 +159,7 @@ else version (CRuntime_Musl) short revents; } - alias uint nfds_t; + alias nfds_t = uint; int poll(pollfd*, nfds_t, c_long); } @@ -172,7 +172,7 @@ else version (CRuntime_UClibc) short revents; } - alias c_ulong nfds_t; + alias nfds_t = c_ulong; int poll(pollfd*, nfds_t, int); } diff --git a/runtime/druntime/src/core/sys/posix/pthread.d b/runtime/druntime/src/core/sys/posix/pthread.d index 86844f9c5ce..33c442df08f 100644 --- a/runtime/druntime/src/core/sys/posix/pthread.d +++ b/runtime/druntime/src/core/sys/posix/pthread.d @@ -473,8 +473,8 @@ int pthread_atfork(void function(), void function(), void function()); int pthread_cancel(pthread_t); } -alias void function(void*) _pthread_cleanup_routine; -alias void function(void*) @nogc _pthread_cleanup_routine_nogc; +alias _pthread_cleanup_routine = void function(void*); +alias _pthread_cleanup_routine_nogc = void function(void*) @nogc; version (CRuntime_Glibc) { struct _pthread_cleanup_buffer diff --git a/runtime/druntime/src/core/sys/posix/pwd.d b/runtime/druntime/src/core/sys/posix/pwd.d index e2a77dec3cf..3402a9e263a 100644 --- a/runtime/druntime/src/core/sys/posix/pwd.d +++ b/runtime/druntime/src/core/sys/posix/pwd.d @@ -201,8 +201,16 @@ else static assert(false, "Unsupported platform"); } -passwd* getpwnam(const scope char*); -passwd* getpwuid(uid_t); +version (NetBSD) +{ + pragma(mangle, "__getpwnam50") passwd* getpwnam(const scope char*); + pragma(mangle, "__getpwuid50") passwd* getpwuid(uid_t); +} +else +{ + passwd* getpwnam(const scope char*); + passwd* getpwuid(uid_t); +} // // Thread-Safe Functions (TSF) @@ -230,9 +238,9 @@ else version (FreeBSD) else version (NetBSD) { int __getpwnam_r50(const scope char*, passwd*, char*, size_t, passwd**); - alias __getpwnam_r50 getpwnam_r; + alias getpwnam_r = __getpwnam_r50; int __getpwuid_r50(uid_t, passwd*, char*, size_t, passwd**); - alias __getpwuid_r50 getpwuid_r; + alias getpwuid_r = __getpwuid_r50; } else version (OpenBSD) { @@ -301,7 +309,7 @@ else version (FreeBSD) else version (NetBSD) { void endpwent(); - passwd* getpwent(); + pragma(mangle, "__getpwent50") passwd* getpwent(); void setpwent(); } else version (OpenBSD) diff --git a/runtime/druntime/src/core/sys/posix/sched.d b/runtime/druntime/src/core/sys/posix/sched.d index d5798358415..273be5e8191 100644 --- a/runtime/druntime/src/core/sys/posix/sched.d +++ b/runtime/druntime/src/core/sys/posix/sched.d @@ -262,6 +262,7 @@ else version (NetBSD) { int sched_get_priority_min(int); int sched_get_priority_max(int); + pragma(mangle, "__sched_rr_get_interval50") int sched_rr_get_interval(pid_t, timespec*); } else version (OpenBSD) diff --git a/runtime/druntime/src/core/sys/posix/semaphore.d b/runtime/druntime/src/core/sys/posix/semaphore.d index 4f3b6e951c3..dc9c14fd96b 100644 --- a/runtime/druntime/src/core/sys/posix/semaphore.d +++ b/runtime/druntime/src/core/sys/posix/semaphore.d @@ -51,7 +51,7 @@ int sem_wait(sem_t*); version (CRuntime_Glibc) { - private alias int __atomic_lock_t; + private alias __atomic_lock_t = int; private struct _pthread_fastlock { @@ -70,7 +70,7 @@ version (CRuntime_Glibc) } else version (Darwin) { - alias int sem_t; + alias sem_t = int; enum SEM_FAILED = cast(sem_t*) null; } @@ -92,7 +92,7 @@ else version (FreeBSD) } else version (NetBSD) { - alias size_t sem_t; + alias sem_t = size_t; enum SEM_FAILED = cast(sem_t*) null; } diff --git a/runtime/druntime/src/core/sys/posix/setjmp.d b/runtime/druntime/src/core/sys/posix/setjmp.d index cd378ce03a7..d1fcb1947c2 100644 --- a/runtime/druntime/src/core/sys/posix/setjmp.d +++ b/runtime/druntime/src/core/sys/posix/setjmp.d @@ -49,7 +49,7 @@ version (CRuntime_Glibc) //enum JB_PC = 7; //enum JB_SIZE = 64; - alias long[8] __jmp_buf; + alias __jmp_buf = long[8]; } else version (X86) { @@ -61,11 +61,11 @@ version (CRuntime_Glibc) //enum JB_PC = 5; //enum JB_SIZE = 24; - alias int[6] __jmp_buf; + alias __jmp_buf = int[6]; } else version (SPARC) { - alias int[3] __jmp_buf; + alias __jmp_buf = int[3]; } else version (SPARC64) { @@ -73,11 +73,11 @@ version (CRuntime_Glibc) } else version (AArch64) { - alias long[22] __jmp_buf; + alias __jmp_buf = long[22]; } else version (ARM) { - alias int[64] __jmp_buf; + alias __jmp_buf = int[64]; } else version (HPPA) { @@ -95,11 +95,11 @@ version (CRuntime_Glibc) } else version (PPC) { - alias int[64 + (12*4)] __jmp_buf; + alias __jmp_buf = int[64 + (12*4)]; } else version (PPC64) { - alias long[64] __jmp_buf; + alias __jmp_buf = long[64]; } else version (MIPS32) { @@ -199,9 +199,9 @@ version (CRuntime_Glibc) sigset_t __saved_mask; } - alias __jmp_buf_tag[1] jmp_buf; + alias jmp_buf = __jmp_buf_tag[1]; - alias _setjmp setjmp; // see XOpen block + alias setjmp = _setjmp; // see XOpen block void longjmp(ref jmp_buf, int); } else version (FreeBSD) @@ -235,7 +235,7 @@ else version (FreeBSD) } else static assert(0); - alias _jmp_buf[1] jmp_buf; + alias jmp_buf = _jmp_buf[1]; int setjmp(ref jmp_buf); void longjmp(ref jmp_buf, int); @@ -255,10 +255,10 @@ else version (NetBSD) } else static assert(0); - alias _jmp_buf[_JBLEN] jmp_buf; + alias jmp_buf = _jmp_buf[_JBLEN]; - int setjmp(ref jmp_buf); - void longjmp(ref jmp_buf, int); + pragma(mangle, "__setjmp14") int setjmp(ref jmp_buf); + pragma(mangle, "__longjmp14") void longjmp(ref jmp_buf, int); } else version (OpenBSD) { @@ -313,7 +313,7 @@ else version (DragonFlyBSD) } else static assert(0); - alias _jmp_buf[1] jmp_buf; + alias jmp_buf = _jmp_buf[1]; int setjmp(ref jmp_buf); void longjmp(ref jmp_buf, int); @@ -342,7 +342,7 @@ else version (CRuntime_Bionic) static assert(false, "Architecture not supported."); } - alias c_long[_JBLEN] jmp_buf; + alias jmp_buf = c_long[_JBLEN]; int setjmp(ref jmp_buf); void longjmp(ref jmp_buf, int); @@ -351,11 +351,11 @@ else version (CRuntime_UClibc) { version (X86_64) { - alias long[8] __jmp_buf; + alias __jmp_buf = long[8]; } else version (ARM) { - align(8) alias int[64] __jmp_buf; + align(8) alias __jmp_buf = int[64]; } else version (MIPS32) { @@ -410,9 +410,9 @@ else version (CRuntime_UClibc) sigset_t __saved_mask; } - alias __jmp_buf_tag[1] jmp_buf; + alias jmp_buf = __jmp_buf_tag[1]; - alias _setjmp setjmp; + alias setjmp = _setjmp; void longjmp(ref jmp_buf, int); } @@ -428,10 +428,10 @@ void siglongjmp(sigjmp_buf, int); version (CRuntime_Glibc) { - alias jmp_buf sigjmp_buf; + alias sigjmp_buf = jmp_buf; int __sigsetjmp(sigjmp_buf, int); - alias __sigsetjmp sigsetjmp; + alias sigsetjmp = __sigsetjmp; void siglongjmp(sigjmp_buf, int); } else version (FreeBSD) @@ -466,7 +466,7 @@ else version (FreeBSD) } else static assert(0); - alias _sigjmp_buf[1] sigjmp_buf; + alias sigjmp_buf = _sigjmp_buf[1]; int sigsetjmp(ref sigjmp_buf); void siglongjmp(ref sigjmp_buf, int); @@ -484,10 +484,10 @@ else version (NetBSD) } else static assert(0); - alias _sigjmp_buf[_JBLEN + 1] sigjmp_buf; + alias sigjmp_buf = _sigjmp_buf[_JBLEN + 1]; - int sigsetjmp(ref sigjmp_buf); - void siglongjmp(ref sigjmp_buf, int); + pragma(mangle, "__sigsetjmp14") int sigsetjmp(ref sigjmp_buf); + pragma(mangle, "__siglongjmp14") void siglongjmp(ref sigjmp_buf, int); } else version (OpenBSD) { @@ -505,24 +505,24 @@ else version (DragonFlyBSD) } else static assert(0); - alias _sigjmp_buf[1] sigjmp_buf; + alias sigjmp_buf = _sigjmp_buf[1]; int sigsetjmp(ref sigjmp_buf); void siglongjmp(ref sigjmp_buf, int); } else version (CRuntime_Bionic) { - alias c_long[_JBLEN + 1] sigjmp_buf; + alias sigjmp_buf = c_long[_JBLEN + 1]; int sigsetjmp(ref sigjmp_buf, int); void siglongjmp(ref sigjmp_buf, int); } else version (CRuntime_UClibc) { - alias jmp_buf sigjmp_buf; + alias sigjmp_buf = jmp_buf; int __sigsetjmp(ref sigjmp_buf, int); - alias __sigsetjmp sigsetjmp; + alias sigsetjmp = __sigsetjmp; void siglongjmp(ref sigjmp_buf, int); } diff --git a/runtime/druntime/src/core/sys/posix/signal.d b/runtime/druntime/src/core/sys/posix/signal.d index bdc68687d0f..ffa88f48f14 100644 --- a/runtime/druntime/src/core/sys/posix/signal.d +++ b/runtime/druntime/src/core/sys/posix/signal.d @@ -108,14 +108,14 @@ int raise(int sig); (defined in core.stdc.signal) //sig_atomic_t (defined in core.stdc.signal) -private alias void function(int) sigfn_t; -private alias void function(int, siginfo_t*, void*) sigactfn_t; +private alias sigfn_t = void function(int); +private alias sigactfn_t = void function(int, siginfo_t*, void*); // nothrow versions nothrow @nogc { - private alias void function(int) sigfn_t2; - private alias void function(int, siginfo_t*, void*) sigactfn_t2; + private alias sigfn_t2 = void function(int); + private alias sigactfn_t2 = void function(int, siginfo_t*, void*); } enum @@ -133,9 +133,8 @@ union sigval version (Solaris) { - import core.sys.posix.unistd; - @property int SIGRTMIN() nothrow @nogc { + import core.sys.posix.unistd : sysconf, _SC_SIGRT_MIN; __gshared int sig = -1; if (sig == -1) { sig = cast(int)sysconf(_SC_SIGRT_MIN); @@ -144,6 +143,7 @@ version (Solaris) } @property int SIGRTMAX() nothrow @nogc { + import core.sys.posix.unistd : sysconf, _SC_SIGRT_MAX; __gshared int sig = -1; if (sig == -1) { sig = cast(int)sysconf(_SC_SIGRT_MAX); @@ -414,6 +414,30 @@ version (linux) enum SIGUSR2 = 12; enum SIGURG = 23; } + else version (Emscripten) + { + //SIGABRT (defined in core.stdc.signal) + enum SIGALRM = 14; + enum SIGBUS = 7; + enum SIGCHLD = 17; + enum SIGCONT = 18; + //SIGFPE (defined in core.stdc.signal) + enum SIGHUP = 1; + //SIGILL (defined in core.stdc.signal) + //SIGINT (defined in core.stdc.signal) + enum SIGKILL = 9; + enum SIGPIPE = 13; + enum SIGQUIT = 3; + //SIGSEGV (defined in core.stdc.signal) + enum SIGSTOP = 19; + //SIGTERM (defined in core.stdc.signal) + enum SIGTSTP = 20; + enum SIGTTIN = 21; + enum SIGTTOU = 22; + enum SIGUSR1 = 10; + enum SIGUSR2 = 12; + enum SIGURG = 23; + } else static assert(0, "unimplemented"); } @@ -1037,7 +1061,7 @@ else version (Darwin) { enum SIG_HOLD = cast(sigfn_t2) 5; - alias uint sigset_t; + alias sigset_t = uint; enum SA_NOCLDSTOP = 8; // (CX|XSI) @@ -1492,15 +1516,15 @@ else version (NetBSD) int __sigsuspend14(const scope sigset_t*); int sigwait(const scope sigset_t*, int*); - alias __sigaction14 sigaction; - alias __sigaddset14 sigaddset; - alias __sigdelset14 sigdelset; - alias __sigemptyset14 sigemptyset; - alias __sigfillset14 sigfillset; - alias __sigismember14 sigismember; - alias __sigpending14 sigpending; - alias __sigprocmask14 sigprocmask; - alias __sigsuspend14 sigsuspend; + alias sigaction = __sigaction14; + alias sigaddset = __sigaddset14; + alias sigdelset = __sigdelset14; + alias sigemptyset = __sigemptyset14; + alias sigfillset = __sigfillset14; + alias sigismember = __sigismember14; + alias sigpending = __sigpending14; + alias sigprocmask = __sigprocmask14; + alias sigsuspend = __sigsuspend14; } else version (OpenBSD) { @@ -1784,6 +1808,16 @@ version (linux) enum SIGXCPU = 24; enum SIGXFSZ = 25; } + else version (Emscripten) + { + enum SIGPOLL = 29; + enum SIGPROF = 27; + enum SIGSYS = 31; + enum SIGTRAP = 5; + enum SIGVTALRM = 26; + enum SIGXCPU = 24; + enum SIGXFSZ = 25; + } else static assert(0, "unimplemented"); @@ -2768,6 +2802,11 @@ else version (CRuntime_Musl) enum MINSIGSTKSZ = 2048; enum SIGSTKSZ = 8192; } + else version (Emscripten) + { + enum MINSIGSTKSZ = 2048; + enum SIGSTKSZ = 8192; + } else static assert(0, "unimplemented"); @@ -3019,6 +3058,7 @@ else version (FreeBSD) else version (NetBSD) { int sigqueue(pid_t, int, const sigval); + pragma(mangle, "__sigtimedwait50") int sigtimedwait(const scope sigset_t*, siginfo_t*, const scope timespec*); int sigwaitinfo(const scope sigset_t*, siginfo_t*); } diff --git a/runtime/druntime/src/core/sys/posix/stdc/time.d b/runtime/druntime/src/core/sys/posix/stdc/time.d index c5a2e1b7182..abeb715ad73 100644 --- a/runtime/druntime/src/core/sys/posix/stdc/time.d +++ b/runtime/druntime/src/core/sys/posix/stdc/time.d @@ -1,5 +1,5 @@ /** - * D header file for C99. + * D header file for C99/C11. * * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_time.h.html, _time.h) * @@ -50,6 +50,13 @@ struct tm } public import core.sys.posix.sys.types : time_t, clock_t; +public import core.sys.posix.time : timespec; + +/// timespec_get introduced in C11 +@system int timespec_get(timespec* ts, int base); + +/// Base Value used for timespec_get +enum TIME_UTC = 1; /// version (CRuntime_Glibc) @@ -139,6 +146,7 @@ else version (FreeBSD) else version (NetBSD) { /// + pragma(mangle, "__tzset50") void tzset(); // non-standard /// extern __gshared const(char)*[2] tzname; // non-standard diff --git a/runtime/druntime/src/core/sys/posix/stdio.d b/runtime/druntime/src/core/sys/posix/stdio.d index e3de3e283c1..eceef7f5d44 100644 --- a/runtime/druntime/src/core/sys/posix/stdio.d +++ b/runtime/druntime/src/core/sys/posix/stdio.d @@ -115,21 +115,21 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { int fgetpos64(FILE*, fpos_t *); - alias fgetpos64 fgetpos; + alias fgetpos = fgetpos64; FILE* fopen64(const scope char*, const scope char*); - alias fopen64 fopen; + alias fopen = fopen64; FILE* freopen64(const scope char*, const scope char*, FILE*); - alias freopen64 freopen; + alias freopen = freopen64; int fseek(FILE*, c_long, int); int fsetpos64(FILE*, const scope fpos_t*); - alias fsetpos64 fsetpos; + alias fsetpos = fsetpos64; FILE* tmpfile64(); - alias tmpfile64 tmpfile; + alias tmpfile = tmpfile64; } else { @@ -154,21 +154,21 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { int fgetpos64(FILE*, fpos_t *); - alias fgetpos64 fgetpos; + alias fgetpos = fgetpos64; FILE* fopen64(const scope char*, const scope char*); - alias fopen64 fopen; + alias fopen = fopen64; FILE* freopen64(const scope char*, const scope char*, FILE*); - alias freopen64 freopen; + alias freopen = freopen64; int fseek(FILE*, c_long, int); int fsetpos64(FILE*, const scope fpos_t*); - alias fsetpos64 fsetpos; + alias fsetpos = fsetpos64; FILE* tmpfile64(); - alias tmpfile64 tmpfile; + alias tmpfile = tmpfile64; } else { @@ -256,7 +256,7 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { int fseeko64(FILE*, off_t, int); - alias fseeko64 fseeko; + alias fseeko = fseeko64; } else { @@ -266,7 +266,7 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { off_t ftello64(FILE*); - alias ftello64 ftello; + alias ftello = ftello64; } else { @@ -285,7 +285,7 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { int fseeko64(FILE*, off_t, int); - alias fseeko64 fseeko; + alias fseeko = fseeko64; } else { @@ -295,7 +295,7 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { off_t ftello64(FILE*); - alias ftello64 ftello; + alias ftello = ftello64; } else { @@ -330,7 +330,7 @@ else version (CRuntime_Bionic) static if ( __USE_FILE_OFFSET64 ) { int fseeko64(FILE*, off_t, int); - alias fseeko64 fseeko; + alias fseeko = fseeko64; } else { @@ -340,7 +340,7 @@ else version (CRuntime_Bionic) static if ( __USE_FILE_OFFSET64 ) { off_t ftello64(FILE*); - alias ftello64 ftello; + alias ftello = ftello64; } else { diff --git a/runtime/druntime/src/core/sys/posix/stdlib.d b/runtime/druntime/src/core/sys/posix/stdlib.d index ea7048ec384..3a6a5d2407d 100644 --- a/runtime/druntime/src/core/sys/posix/stdlib.d +++ b/runtime/druntime/src/core/sys/posix/stdlib.d @@ -167,7 +167,7 @@ else version (NetBSD) { int setenv(const scope char*, const scope char*, int); int __unsetenv13(const scope char*); - alias __unsetenv13 unsetenv; + alias unsetenv = __unsetenv13; void* valloc(size_t); // LEGACY non-standard } else version (OpenBSD) @@ -339,7 +339,7 @@ version (CRuntime_Glibc) static if ( __USE_LARGEFILE64 ) { int mkstemp64(char*); - alias mkstemp64 mkstemp; + alias mkstemp = mkstemp64; } else { @@ -459,14 +459,14 @@ else version (NetBSD) c_long nrand48(ref ushort[3]); int posix_openpt(int); char* ptsname(int); - int putenv(char*); + pragma(mangle, "__putenv50") int putenv(char*); c_long random(); char* realpath(const scope char*, char*); ushort *seed48(ref ushort[3]); void setkey(const scope char*); char* setstate(const scope char*); void srand48(c_long); - void srandom(uint); + pragma(mangle, "__srandom60") void srandom(uint); int unlockpt(int); } else version (OpenBSD) @@ -656,14 +656,14 @@ else version (Solaris) int mkstemp(char*); static if ( __USE_LARGEFILE64 ) - alias mkstemp mkstemp64; + alias mkstemp64 = mkstemp; } else { int mkstemp64(char*); static if ( __USE_LARGEFILE64 ) - alias mkstemp64 mkstemp; + alias mkstemp = mkstemp64; else int mkstemp(char*); } @@ -702,7 +702,7 @@ else version (CRuntime_UClibc) static if ( __USE_LARGEFILE64 ) { int mkstemp64(char*); - alias mkstemp64 mkstemp; + alias mkstemp = mkstemp64; } else { diff --git a/runtime/druntime/src/core/sys/posix/sys/msg.d b/runtime/druntime/src/core/sys/posix/sys/msg.d index 19e07bd6468..519811820f6 100644 --- a/runtime/druntime/src/core/sys/posix/sys/msg.d +++ b/runtime/druntime/src/core/sys/posix/sys/msg.d @@ -200,7 +200,10 @@ struct msgbuf char[1] mtext = 0; } -int msgctl(int msqid, int cmd, msqid_ds* __buf); +version (NetBSD) + pragma(mangle, "__msgctl50") int msgctl(int msqid, int cmd, msqid_ds* __buf); +else + int msgctl(int msqid, int cmd, msqid_ds* __buf); int msgget(key_t key, int msgflg); ssize_t msgrcv(int msqid, void* msgp, size_t msgsz, c_long msgtyp, int msgflg); int msgsnd(int msqid, msgbuf* msgp, int msgsz, int msgflg); diff --git a/runtime/druntime/src/core/sys/posix/sys/resource.d b/runtime/druntime/src/core/sys/posix/sys/resource.d index b75c794e926..eb62e4950fd 100644 --- a/runtime/druntime/src/core/sys/posix/sys/resource.d +++ b/runtime/druntime/src/core/sys/posix/sys/resource.d @@ -82,9 +82,9 @@ version (linux) } static if (__USE_FILE_OFFSET64) - alias ulong rlim_t; + alias rlim_t = ulong; else - alias c_ulong rlim_t; + alias rlim_t = c_ulong; static if (__USE_FILE_OFFSET64) enum RLIM_INFINITY = 0xffffffffffffffffUL; @@ -159,7 +159,7 @@ else version (Darwin) PRIO_USER = 2, } - alias ulong rlim_t; + alias rlim_t = ulong; enum { @@ -201,7 +201,7 @@ else version (FreeBSD) PRIO_USER = 2, } - alias long rlim_t; + alias rlim_t = long; enum { @@ -221,7 +221,7 @@ else version (FreeBSD) timeval ru_utime; timeval ru_stime; c_long ru_maxrss; - alias ru_ixrss ru_first; + alias ru_first = ru_ixrss; c_long ru_ixrss; c_long ru_idrss; c_long ru_isrss; @@ -235,7 +235,7 @@ else version (FreeBSD) c_long ru_nsignals; c_long ru_nvcsw; c_long ru_nivcsw; - alias ru_nivcsw ru_last; + alias ru_last = ru_nivcsw; } enum @@ -258,7 +258,7 @@ else version (NetBSD) PRIO_USER = 2, } - alias long rlim_t; + alias rlim_t = long; enum { @@ -278,7 +278,7 @@ else version (NetBSD) timeval ru_utime; timeval ru_stime; c_long ru_maxrss; - alias ru_ixrss ru_first; + alias ru_first = ru_ixrss; c_long ru_ixrss; c_long ru_idrss; c_long ru_isrss; @@ -292,7 +292,7 @@ else version (NetBSD) c_long ru_nsignals; c_long ru_nvcsw; c_long ru_nivcsw; - alias ru_nivcsw ru_last; + alias ru_last = ru_nivcsw; } enum @@ -315,7 +315,7 @@ else version (OpenBSD) PRIO_USER = 2, } - alias ulong rlim_t; + alias rlim_t = ulong; enum { @@ -336,7 +336,7 @@ else version (OpenBSD) timeval ru_utime; timeval ru_stime; c_long ru_maxrss; - alias ru_ixrss ru_first; + alias ru_first = ru_ixrss; c_long ru_ixrss; c_long ru_idrss; c_long ru_isrss; @@ -350,7 +350,7 @@ else version (OpenBSD) c_long ru_nsignals; c_long ru_nvcsw; c_long ru_nivcsw; - alias ru_nivcsw ru_last; + alias ru_last = ru_nivcsw; } enum @@ -374,7 +374,7 @@ else version (DragonFlyBSD) PRIO_USER = 2, } - alias long rlim_t; + alias rlim_t = long; enum { @@ -394,7 +394,7 @@ else version (DragonFlyBSD) timeval ru_utime; timeval ru_stime; c_long ru_maxrss; - alias ru_ixrss ru_first; + alias ru_first = ru_ixrss; c_long ru_ixrss; c_long ru_idrss; c_long ru_isrss; @@ -408,7 +408,7 @@ else version (DragonFlyBSD) c_long ru_nsignals; c_long ru_nvcsw; c_long ru_nivcsw; - alias ru_nivcsw ru_last; + alias ru_last = ru_nivcsw; } enum @@ -431,7 +431,7 @@ else version (Solaris) PRIO_USER = 2, } - alias c_ulong rlim_t; + alias rlim_t = c_ulong; enum : c_long { @@ -530,7 +530,7 @@ else version (NetBSD) { int getpriority(int, int); int getrlimit(int, rlimit*); - int getrusage(int, rusage*); + pragma(mangle, "__getrusage50") int getrusage(int, rusage*); int setpriority(int, int, int); int setrlimit(int, const scope rlimit*); } @@ -564,8 +564,8 @@ else version (CRuntime_Musl) int setpriority(int, id_t, int); int getrlimit(int, rlimit*); int setrlimit(int, const scope rlimit*); - alias getrlimit getrlimit64; - alias setrlimit setrlimit64; + alias getrlimit64 = getrlimit; + alias setrlimit64 = setrlimit; pragma(mangle, muslRedirTime64Mangle!("getrusage", "__getrusage_time64")) int getrusage(int, rusage*); } diff --git a/runtime/druntime/src/core/sys/posix/sys/select.d b/runtime/druntime/src/core/sys/posix/sys/select.d index c8a88bddc0c..5152d0fe17d 100644 --- a/runtime/druntime/src/core/sys/posix/sys/select.d +++ b/runtime/druntime/src/core/sys/posix/sys/select.d @@ -54,7 +54,7 @@ version (CRuntime_Glibc) { private { - alias c_long __fd_mask; + alias __fd_mask = c_long; enum uint __NFDBITS = 8 * __fd_mask.sizeof; extern (D) auto __FDELT()( int d ) pure @@ -175,7 +175,7 @@ else version (FreeBSD) { private { - alias c_ulong __fd_mask; + alias __fd_mask = c_ulong; enum _NFDBITS = __fd_mask.sizeof * 8; } @@ -225,7 +225,7 @@ else version (NetBSD) { private { - alias c_ulong __fd_mask; + alias __fd_mask = c_ulong; enum _NFDBITS = __fd_mask.sizeof * 8; } @@ -268,14 +268,16 @@ else version (NetBSD) _p.fds_bits[--_n] = 0; } + pragma(mangle, "__pselect50") int pselect(int, fd_set*, fd_set*, fd_set*, const scope timespec*, const scope sigset_t*); + pragma(mangle, "__select50") int select(int, fd_set*, fd_set*, fd_set*, timeval*); } else version (OpenBSD) { private { - alias uint __fd_mask; + alias __fd_mask = uint; enum _NFDBITS = __fd_mask.sizeof * 8; } @@ -323,7 +325,7 @@ else version (DragonFlyBSD) { private { - alias c_ulong __fd_mask; + alias __fd_mask = c_ulong; enum _NFDBITS = __fd_mask.sizeof * 8; } @@ -373,7 +375,7 @@ else version (Solaris) { private { - alias c_long fds_mask; + alias fds_mask = c_long; enum _NBBY = 8; enum FD_NFDBITS = fds_mask.sizeof * _NBBY; @@ -416,7 +418,7 @@ else version (CRuntime_Bionic) { private { - alias c_ulong __fd_mask; + alias __fd_mask = c_ulong; enum uint __NFDBITS = 8 * __fd_mask.sizeof; extern (D) auto __FDELT()( int d ) pure @@ -465,7 +467,7 @@ else version (CRuntime_Musl) { enum FD_SETSIZE = 1024; - alias ulong fd_mask; + alias fd_mask = ulong; private { @@ -514,7 +516,7 @@ else version (CRuntime_UClibc) { private { - alias c_long __fd_mask; + alias __fd_mask = c_long; enum uint __NFDBITS = 8 * __fd_mask.sizeof; extern (D) auto __FDELT()( int d ) pure diff --git a/runtime/druntime/src/core/sys/posix/sys/shm.d b/runtime/druntime/src/core/sys/posix/sys/shm.d index 7481d8cc60f..358fcf9e322 100644 --- a/runtime/druntime/src/core/sys/posix/sys/shm.d +++ b/runtime/druntime/src/core/sys/posix/sys/shm.d @@ -58,7 +58,7 @@ version (linux) enum SHM_RND = 0x02000; // 020000 enum SHM_REMAP = 0x4000; // 040000 - alias c_ulong shmatt_t; + alias shmatt_t = c_ulong; /* For any changes, please check /usr/include/bits/shm.h */ struct shmid_ds @@ -83,7 +83,7 @@ else version (FreeBSD) enum SHM_RDONLY = 0x01000; // 010000 enum SHM_RND = 0x02000; // 020000 - alias c_ulong shmatt_t; + alias shmatt_t = c_ulong; struct shmid_ds_old // <= FreeBSD7 { @@ -115,7 +115,7 @@ else version (NetBSD) enum SHM_RDONLY = 0x01000; // 010000 enum SHM_RND = 0x02000; // 020000 - alias c_ulong shmatt_t; + alias shmatt_t = c_ulong; struct shmid_ds { @@ -135,7 +135,7 @@ else version (OpenBSD) enum SHM_RDONLY = 0x01000; // 010000 enum SHM_RND = 0x02000; // 020000 - alias short shmatt_t; + alias shmatt_t = short; struct shmid_ds { @@ -158,7 +158,7 @@ else version (DragonFlyBSD) enum SHM_RDONLY = 0x01000; // 010000 enum SHM_RND = 0x02000; // 020000 - alias c_ulong shmatt_t; + alias shmatt_t = c_ulong; struct shmid_ds { @@ -198,7 +198,7 @@ int shmget(key_t, size_t, int); version (CRuntime_Glibc) { int __getpagesize(); - alias __getpagesize SHMLBA; + alias SHMLBA = __getpagesize; void* shmat(int, const scope void*, int); int shmctl(int, int, shmid_ds*); @@ -219,7 +219,7 @@ else version (NetBSD) enum SHMLBA = 1 << 12; // PAGE_SIZE = (1<= 1200000) { - alias ulong dev_t; - alias ulong ino_t; - alias ulong nlink_t; + alias dev_t = ulong; + alias ino_t = ulong; + alias nlink_t = ulong; } else { - alias uint dev_t; - alias uint ino_t; - alias ushort nlink_t; + alias dev_t = uint; + alias ino_t = uint; + alias nlink_t = ushort; } - alias uint gid_t; - alias ushort mode_t; - alias long off_t; - alias int pid_t; + alias gid_t = uint; + alias mode_t = ushort; + alias off_t = long; + alias pid_t = int; //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; - alias c_long time_t; - alias uint uid_t; - alias uint fflags_t; // non-standard + alias ssize_t = c_long; + alias time_t = c_long; + alias uid_t = uint; + alias fflags_t = uint; // non-standard } else version (NetBSD) { - alias long blkcnt_t; - alias int blksize_t; - alias ulong dev_t; - alias uint gid_t; - alias ulong ino_t; - alias uint mode_t; - alias uint nlink_t; - alias ulong off_t; - alias int pid_t; + alias blkcnt_t = long; + alias blksize_t = int; + alias dev_t = ulong; + alias gid_t = uint; + alias ino_t = ulong; + alias mode_t = uint; + alias nlink_t = uint; + alias off_t = ulong; + alias pid_t = int; //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; - alias c_long time_t; - alias uint uid_t; + alias ssize_t = c_long; + alias time_t = long; // _BSD_TIME_T_ mapped to __int64_t + alias uid_t = uint; } else version (OpenBSD) { - alias char* caddr_t; - alias long blkcnt_t; - alias int blksize_t; - alias int dev_t; - alias uint gid_t; - alias ulong ino_t; - alias uint mode_t; - alias uint nlink_t; - alias long off_t; - alias int pid_t; + alias caddr_t = char*; + alias blkcnt_t = long; + alias blksize_t = int; + alias dev_t = int; + alias gid_t = uint; + alias ino_t = ulong; + alias mode_t = uint; + alias nlink_t = uint; + alias off_t = long; + alias pid_t = int; //size_t (defined in core.stdc.stddef) - alias c_long ssize_t; - alias long time_t; - alias uint uid_t; + alias ssize_t = c_long; + alias time_t = long; + alias uid_t = uint; } else version (DragonFlyBSD) { - alias long blkcnt_t; - alias long blksize_t; - alias uint dev_t; - alias uint gid_t; - alias long ino_t; - alias ushort mode_t; - alias uint nlink_t; - alias long off_t; //__off_t (defined in /usr/include/sys/stdint.h -> core.stdc.stddef) - alias int pid_t; // size_t (defined in /usr/include/sys/stdint.h -> core.stdc.stddef) - alias c_long ssize_t; - alias long time_t; - alias uint uid_t; + alias blkcnt_t = long; + alias blksize_t = long; + alias dev_t = uint; + alias gid_t = uint; + alias ino_t = long; + alias mode_t = ushort; + alias nlink_t = uint; + alias off_t = long; //__off_t (defined in /usr/include/sys/stdint.h -> core.stdc.stddef) + alias pid_t = int; // size_t (defined in /usr/include/sys/stdint.h -> core.stdc.stddef) + alias ssize_t = c_long; + alias time_t = long; + alias uid_t = uint; } else version (Solaris) { - alias char* caddr_t; - alias c_long daddr_t; - alias short cnt_t; + alias caddr_t = char*; + alias daddr_t = c_long; + alias cnt_t = short; static if (__USE_FILE_OFFSET64) { - alias long blkcnt_t; - alias ulong ino_t; - alias long off_t; + alias blkcnt_t = long; + alias ino_t = ulong; + alias off_t = long; } else { - alias c_long blkcnt_t; - alias c_ulong ino_t; - alias c_long off_t; + alias blkcnt_t = c_long; + alias ino_t = c_ulong; + alias off_t = c_long; } version (D_LP64) { - alias blkcnt_t blkcnt64_t; - alias ino_t ino64_t; - alias off_t off64_t; + alias blkcnt64_t = blkcnt_t; + alias ino64_t = ino_t; + alias off64_t = off_t; } else { - alias long blkcnt64_t; - alias ulong ino64_t; - alias long off64_t; + alias blkcnt64_t = long; + alias ino64_t = ulong; + alias off64_t = long; } - alias uint blksize_t; - alias c_ulong dev_t; - alias uid_t gid_t; - alias uint mode_t; - alias uint nlink_t; - alias int pid_t; - alias c_long ssize_t; - alias c_long time_t; - alias uint uid_t; + alias blksize_t = uint; + alias dev_t = c_ulong; + alias gid_t = uid_t; + alias mode_t = uint; + alias nlink_t = uint; + alias pid_t = int; + alias ssize_t = c_long; + alias time_t = c_long; + alias uid_t = uint; } else { @@ -315,94 +350,94 @@ version (linux) { static if ( __USE_FILE_OFFSET64 ) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; } else { - alias ulong_t fsblkcnt_t; - alias ulong_t fsfilcnt_t; + alias fsblkcnt_t = ulong_t; + alias fsfilcnt_t = ulong_t; } - alias slong_t clock_t; - alias uint id_t; - alias int key_t; - alias slong_t suseconds_t; - alias uint useconds_t; + alias clock_t = slong_t; + alias id_t = uint; + alias key_t = int; + alias suseconds_t = slong_t; + alias useconds_t = uint; } else version (Darwin) { - alias uint fsblkcnt_t; - alias uint fsfilcnt_t; - alias c_long clock_t; - alias uint id_t; - alias int key_t; - alias int suseconds_t; - alias uint useconds_t; + alias fsblkcnt_t = uint; + alias fsfilcnt_t = uint; + alias clock_t = c_long; + alias id_t = uint; + alias key_t = int; + alias suseconds_t = int; + alias useconds_t = uint; } else version (FreeBSD) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; - alias c_long clock_t; - alias long id_t; - alias c_long key_t; - alias c_long suseconds_t; - alias uint useconds_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; + alias clock_t = c_long; + alias id_t = long; + alias key_t = c_long; + alias suseconds_t = c_long; + alias useconds_t = uint; } else version (NetBSD) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; - alias c_long clock_t; - alias long id_t; - alias c_long key_t; - alias c_long suseconds_t; - alias uint useconds_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; + alias clock_t = uint; // unsigned int + alias id_t = long; + alias key_t = c_long; + alias suseconds_t = int; // int + alias useconds_t = uint; } else version (OpenBSD) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; - alias long clock_t; - alias uint id_t; - alias c_long key_t; - alias c_long suseconds_t; - alias uint useconds_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; + alias clock_t = long; + alias id_t = uint; + alias key_t = c_long; + alias suseconds_t = c_long; + alias useconds_t = uint; } else version (DragonFlyBSD) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; - alias c_long clock_t; - alias long id_t; - alias c_long key_t; - alias c_long suseconds_t; - alias uint useconds_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; + alias clock_t = c_long; + alias id_t = long; + alias key_t = c_long; + alias suseconds_t = c_long; + alias useconds_t = uint; } else version (Solaris) { static if (__USE_FILE_OFFSET64) { - alias ulong fsblkcnt_t; - alias ulong fsfilcnt_t; + alias fsblkcnt_t = ulong; + alias fsfilcnt_t = ulong; } else { - alias c_ulong fsblkcnt_t; - alias c_ulong fsfilcnt_t; + alias fsblkcnt_t = c_ulong; + alias fsfilcnt_t = c_ulong; } - alias c_long clock_t; - alias int id_t; - alias int key_t; - alias c_long suseconds_t; - alias uint useconds_t; + alias clock_t = c_long; + alias id_t = int; + alias key_t = int; + alias suseconds_t = c_long; + alias useconds_t = uint; - alias id_t taskid_t; - alias id_t projid_t; - alias id_t poolid_t; - alias id_t zoneid_t; - alias id_t ctid_t; + alias taskid_t = id_t; + alias projid_t = id_t; + alias poolid_t = id_t; + alias zoneid_t = id_t; + alias ctid_t = id_t; } else { @@ -657,7 +692,7 @@ version (CRuntime_Glibc) c_long __align; } - private alias int __atomic_lock_t; + private alias __atomic_lock_t = int; private struct _pthread_fastlock { @@ -665,7 +700,7 @@ version (CRuntime_Glibc) __atomic_lock_t __spinlock; } - private alias void* _pthread_descr; + private alias _pthread_descr = void*; union pthread_cond_t { @@ -679,7 +714,7 @@ version (CRuntime_Glibc) int __align; } - alias uint pthread_key_t; + alias pthread_key_t = uint; union pthread_mutex_t { @@ -693,7 +728,7 @@ version (CRuntime_Glibc) int __align; } - alias int pthread_once_t; + alias pthread_once_t = int; struct pthread_rwlock_t { @@ -707,7 +742,7 @@ version (CRuntime_Glibc) c_long __align; } - alias c_ulong pthread_t; + alias pthread_t = c_ulong; } else version (CRuntime_Musl) { @@ -769,7 +804,7 @@ else version (CRuntime_Musl) uint[2] __attr; } - alias uint pthread_key_t; + alias pthread_key_t = uint; struct pthread_condattr_t { @@ -781,9 +816,9 @@ else version (CRuntime_Musl) uint __attr; } - alias int pthread_once_t; + alias pthread_once_t = int; - alias c_ulong pthread_t; + alias pthread_t = c_ulong; } else version (Darwin) { @@ -837,7 +872,7 @@ else version (Darwin) byte[__PTHREAD_CONDATTR_SIZE__] __opaque; } - alias c_ulong pthread_key_t; + alias pthread_key_t = c_ulong; struct pthread_mutex_t { @@ -876,22 +911,22 @@ else version (Darwin) byte[__PTHREAD_SIZE__] __opaque; } - alias _opaque_pthread_t* pthread_t; + alias pthread_t = _opaque_pthread_t*; } else version (FreeBSD) { - alias int lwpid_t; // non-standard - - alias void* pthread_attr_t; - alias void* pthread_cond_t; - alias void* pthread_condattr_t; - alias void* pthread_key_t; - alias void* pthread_mutex_t; - alias void* pthread_mutexattr_t; - alias void* pthread_once_t; - alias void* pthread_rwlock_t; - alias void* pthread_rwlockattr_t; - alias void* pthread_t; + alias lwpid_t = int; // non-standard + + alias pthread_attr_t = void*; + alias pthread_cond_t = void*; + alias pthread_condattr_t = void*; + alias pthread_key_t = void*; + alias pthread_mutex_t = void*; + alias pthread_mutexattr_t = void*; + alias pthread_once_t = void*; + alias pthread_rwlock_t = void*; + alias pthread_rwlockattr_t = void*; + alias pthread_t = void*; } else version (NetBSD) { @@ -958,55 +993,55 @@ else version (NetBSD) void* ptra_private; } - alias uint pthread_key_t; - alias void* pthread_t; + alias pthread_key_t = uint; + alias pthread_t = void*; } else version (OpenBSD) { - alias void* pthread_attr_t; - alias void* pthread_cond_t; - alias void* pthread_condattr_t; - alias int pthread_key_t; - alias void* pthread_mutex_t; - alias void* pthread_mutexattr_t; + alias pthread_attr_t = void*; + alias pthread_cond_t = void*; + alias pthread_condattr_t = void*; + alias pthread_key_t = int; + alias pthread_mutex_t = void*; + alias pthread_mutexattr_t = void*; private struct pthread_once { int state; pthread_mutex_t mutex; } - alias pthread_once pthread_once_t; + alias pthread_once_t = pthread_once; - alias void* pthread_rwlock_t; - alias void* pthread_rwlockattr_t; - alias void* pthread_t; + alias pthread_rwlock_t = void*; + alias pthread_rwlockattr_t = void*; + alias pthread_t = void*; } else version (DragonFlyBSD) { - alias int lwpid_t; + alias lwpid_t = int; - alias void* pthread_attr_t; - alias void* pthread_cond_t; - alias void* pthread_condattr_t; - alias void* pthread_key_t; - alias void* pthread_mutex_t; - alias void* pthread_mutexattr_t; + alias pthread_attr_t = void*; + alias pthread_cond_t = void*; + alias pthread_condattr_t = void*; + alias pthread_key_t = void*; + alias pthread_mutex_t = void*; + alias pthread_mutexattr_t = void*; private struct pthread_once { int state; pthread_mutex_t mutex; } - alias pthread_once pthread_once_t; + alias pthread_once_t = pthread_once; - alias void* pthread_rwlock_t; - alias void* pthread_rwlockattr_t; - alias void* pthread_t; + alias pthread_rwlock_t = void*; + alias pthread_rwlockattr_t = void*; + alias pthread_t = void*; } else version (Solaris) { - alias uint pthread_t; - alias int lwpid_t; // non-standard + alias pthread_t = uint; + alias lwpid_t = int; // non-standard struct pthread_attr_t { @@ -1092,7 +1127,7 @@ else version (Solaris) ulong[4] __pthread_once_pad; } - alias uint pthread_key_t; + alias pthread_key_t = uint; } else version (CRuntime_Bionic) { @@ -1115,8 +1150,8 @@ else version (CRuntime_Bionic) int[1] __private; } - alias c_long pthread_condattr_t; - alias int pthread_key_t; + alias pthread_condattr_t = c_long; + alias pthread_key_t = int; struct pthread_mutex_t { @@ -1126,8 +1161,8 @@ else version (CRuntime_Bionic) int[1] __private; } - alias c_long pthread_mutexattr_t; - alias int pthread_once_t; + alias pthread_mutexattr_t = c_long; + alias pthread_once_t = int; struct pthread_rwlock_t { @@ -1137,8 +1172,8 @@ else version (CRuntime_Bionic) int[10] __private; } - alias c_long pthread_rwlockattr_t; - alias c_long pthread_t; + alias pthread_rwlockattr_t = c_long; + alias pthread_t = c_long; } else version (CRuntime_UClibc) { @@ -1225,7 +1260,7 @@ else version (CRuntime_UClibc) c_long __align; } - alias uint pthread_key_t; + alias pthread_key_t = uint; struct __pthread_slist_t { @@ -1260,7 +1295,7 @@ else version (CRuntime_UClibc) c_long __align; } - alias int pthread_once_t; + alias pthread_once_t = int; struct pthread_rwlock_t { @@ -1298,7 +1333,7 @@ else version (CRuntime_UClibc) c_long __align; } - alias c_ulong pthread_t; + alias pthread_t = c_ulong; } else { @@ -1329,23 +1364,23 @@ version (CRuntime_Glibc) } else version (FreeBSD) { - alias void* pthread_barrier_t; - alias void* pthread_barrierattr_t; + alias pthread_barrier_t = void*; + alias pthread_barrierattr_t = void*; } else version (NetBSD) { - alias void* pthread_barrier_t; - alias void* pthread_barrierattr_t; + alias pthread_barrier_t = void*; + alias pthread_barrierattr_t = void*; } else version (OpenBSD) { - alias void* pthread_barrier_t; - alias void* pthread_barrierattr_t; + alias pthread_barrier_t = void*; + alias pthread_barrierattr_t = void*; } else version (DragonFlyBSD) { - alias void* pthread_barrier_t; - alias void* pthread_barrierattr_t; + alias pthread_barrier_t = void*; + alias pthread_barrierattr_t = void*; } else version (Darwin) { @@ -1422,11 +1457,11 @@ pthread_spinlock_t version (CRuntime_Glibc) { - alias int pthread_spinlock_t; // volatile + alias pthread_spinlock_t = int; // volatile } else version (FreeBSD) { - alias void* pthread_spinlock_t; + alias pthread_spinlock_t = void*; } else version (NetBSD) { @@ -1434,23 +1469,23 @@ else version (NetBSD) } else version (OpenBSD) { - alias void* pthread_spinlock_t; + alias pthread_spinlock_t = void*; } else version (DragonFlyBSD) { - alias void* pthread_spinlock_t; + alias pthread_spinlock_t = void*; } else version (Solaris) { - alias pthread_mutex_t pthread_spinlock_t; + alias pthread_spinlock_t = pthread_mutex_t; } else version (CRuntime_UClibc) { - alias int pthread_spinlock_t; // volatile + alias pthread_spinlock_t = int; // volatile } else version (CRuntime_Musl) { - alias int pthread_spinlock_t; + alias pthread_spinlock_t = int; } // diff --git a/runtime/druntime/src/core/sys/posix/sys/wait.d b/runtime/druntime/src/core/sys/posix/sys/wait.d index 131a9400dcf..0c4e72e999b 100644 --- a/runtime/druntime/src/core/sys/posix/sys/wait.d +++ b/runtime/druntime/src/core/sys/posix/sys/wait.d @@ -257,7 +257,7 @@ else version (CRuntime_Musl) extern (D) bool WIFSIGNALED()( int status ) { return (status&0xffff)-1U < 0xffU; } extern (D) bool WIFSTOPPED()( int status ) { return cast(short)(((status&0xffff)*0x10001)>>8) > 0x7f00; } extern (D) int WTERMSIG()( int status ) { return status & 0x7F; } - alias WEXITSTATUS WSTOPSIG; + alias WSTOPSIG = WEXITSTATUS; } else version (CRuntime_UClibc) { diff --git a/runtime/druntime/src/core/sys/posix/termios.d b/runtime/druntime/src/core/sys/posix/termios.d index e4a99e68651..38181a9d84f 100644 --- a/runtime/druntime/src/core/sys/posix/termios.d +++ b/runtime/druntime/src/core/sys/posix/termios.d @@ -132,9 +132,9 @@ TCOON version (linux) { - alias ubyte cc_t; - alias uint speed_t; - alias uint tcflag_t; + alias cc_t = ubyte; + alias speed_t = uint; + alias tcflag_t = uint; enum NCCS = 32; @@ -230,9 +230,9 @@ version (linux) } else version (Darwin) { - alias ubyte cc_t; - alias c_ulong speed_t; - alias c_ulong tcflag_t; + alias cc_t = ubyte; + alias speed_t = c_ulong; + alias tcflag_t = c_ulong; enum NCCS = 20; @@ -327,9 +327,9 @@ else version (Darwin) } else version (FreeBSD) { - alias ubyte cc_t; - alias uint speed_t; - alias uint tcflag_t; + alias cc_t = ubyte; + alias speed_t = uint; + alias tcflag_t = uint; enum NCCS = 20; @@ -424,9 +424,9 @@ else version (FreeBSD) } else version (DragonFlyBSD) { - alias ubyte cc_t; - alias uint speed_t; - alias uint tcflag_t; + alias cc_t = ubyte; + alias speed_t = uint; + alias tcflag_t = uint; enum NCCS = 20; @@ -521,9 +521,9 @@ else version (DragonFlyBSD) } else version (NetBSD) { - alias ubyte cc_t; - alias uint speed_t; - alias uint tcflag_t; + alias cc_t = ubyte; + alias speed_t = uint; + alias tcflag_t = uint; enum NCCS = 20; @@ -618,9 +618,9 @@ else version (NetBSD) } else version (OpenBSD) { - alias uint tcflag_t; - alias ubyte cc_t; - alias uint speed_t; + alias tcflag_t = uint; + alias cc_t = ubyte; + alias speed_t = uint; enum NCCS = 20; diff --git a/runtime/druntime/src/core/sys/posix/time.d b/runtime/druntime/src/core/sys/posix/time.d index fdd6b0a8880..4fc73aab8c5 100644 --- a/runtime/druntime/src/core/sys/posix/time.d +++ b/runtime/druntime/src/core/sys/posix/time.d @@ -64,6 +64,7 @@ else version (FreeBSD) } else version (NetBSD) { + pragma(mangle, "__timegm50") time_t timegm(tm*); // non-standard } else version (OpenBSD) @@ -257,7 +258,7 @@ else version (Solaris) c_long tv_nsec; } - alias timespec timestruc_t; + alias timestruc_t = timespec; } else { @@ -286,8 +287,8 @@ version (CRuntime_Glibc) enum CLOCK_REALTIME = 0; enum TIMER_ABSTIME = 0x01; - alias int clockid_t; - alias void* timer_t; + alias clockid_t = int; + alias timer_t = void*; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -325,8 +326,8 @@ else version (FreeBSD) enum CLOCK_REALTIME = 0; enum TIMER_ABSTIME = 0x01; - alias int clockid_t; // - alias int timer_t; + alias clockid_t = int; // + alias timer_t = int; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -351,8 +352,8 @@ else version (DragonFlyBSD) enum CLOCK_REALTIME = 0; enum TIMER_ABSTIME = 0x01; - alias int clockid_t; // - alias int timer_t; + alias clockid_t = int; // + alias timer_t = int; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -375,17 +376,23 @@ else version (NetBSD) enum CLOCK_REALTIME = 0; enum TIMER_ABSTIME = 0x01; - alias int clockid_t; // - alias int timer_t; + alias clockid_t = int; // + alias timer_t = int; + pragma(mangle, "__clock_getres50") int clock_getres(clockid_t, timespec*); + pragma(mangle, "__clock_gettime50") int clock_gettime(clockid_t, timespec*); + pragma(mangle, "__clock_settime50") int clock_settime(clockid_t, const scope timespec*); + pragma(mangle, "__nanosleep50") int nanosleep(const scope timespec*, timespec*); int timer_create(clockid_t, sigevent*, timer_t*); int timer_delete(timer_t); + pragma(mangle, "__timer_gettime50") int timer_gettime(timer_t, itimerspec*); int timer_getoverrun(timer_t); + pragma(mangle, "__timer_settime50") int timer_settime(timer_t, int, const scope itimerspec*, itimerspec*); } else version (OpenBSD) @@ -399,8 +406,8 @@ else version (OpenBSD) enum CLOCK_REALTIME = 0; enum TIMER_ABSTIME = 0x1; - alias int clockid_t; // - alias int timer_t; + alias clockid_t = int; // + alias timer_t = int; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -421,8 +428,8 @@ else version (Solaris) enum CLOCK_REALTIME = 3; // enum TIMER_ABSOLUTE = 0x1; - alias int clockid_t; - alias int timer_t; + alias clockid_t = int; + alias timer_t = int; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -452,8 +459,8 @@ else version (CRuntime_Bionic) enum CLOCK_REALTIME_HR = 4; enum TIMER_ABSTIME = 0x01; - alias int clockid_t; - alias void* timer_t; // Updated since Lollipop + alias clockid_t = int; + alias timer_t = void*; // Updated since Lollipop int clock_getres(int, timespec*); int clock_gettime(int, timespec*); @@ -468,8 +475,8 @@ else version (CRuntime_Musl) { static assert(timespec.sizeof == 16); - alias int clockid_t; - alias void* timer_t; + alias clockid_t = int; + alias timer_t = void*; struct itimerspec { @@ -489,6 +496,7 @@ else version (CRuntime_Musl) enum CLOCK_SGI_CYCLE = 10; enum CLOCK_TAI = 11; + pragma(mangle, muslRedirTime64Mangle!("nanosleep", "__nanosleep_time64")) int nanosleep(const scope timespec*, timespec*); pragma(mangle, muslRedirTime64Mangle!("clock_getres", "__clock_getres_time64")) @@ -523,8 +531,8 @@ else version (CRuntime_UClibc) enum TIMER_ABSTIME = 0x01; - alias int clockid_t; - alias void* timer_t; + alias clockid_t = int; + alias timer_t = void*; int clock_getres(clockid_t, timespec*); int clock_gettime(clockid_t, timespec*); @@ -575,8 +583,11 @@ else version (FreeBSD) else version (NetBSD) { char* asctime_r(const scope tm*, char*); + pragma(mangle, "__ctime_r50") char* ctime_r(const scope time_t*, char*); + pragma(mangle, "__gmtime_r50") tm* gmtime_r(const scope time_t*, tm*); + pragma(mangle, "__localtime_r50") tm* localtime_r(const scope time_t*, tm*); } else version (OpenBSD) @@ -685,7 +696,7 @@ else version (Solaris) tm* getdate(const scope char*); char* __strptime_dontzero(const scope char*, const scope char*, tm*); - alias __strptime_dontzero strptime; + alias strptime = __strptime_dontzero; } else version (CRuntime_Bionic) { diff --git a/runtime/druntime/src/core/sys/posix/ucontext.d b/runtime/druntime/src/core/sys/posix/ucontext.d index 451401d3904..3ce5c0cd6b1 100644 --- a/runtime/druntime/src/core/sys/posix/ucontext.d +++ b/runtime/druntime/src/core/sys/posix/ucontext.d @@ -124,9 +124,9 @@ version (linux) enum NGREG = 23; - alias long greg_t; - alias greg_t[NGREG] gregset_t; - alias _libc_fpstate* fpregset_t; + alias greg_t = long; + alias gregset_t = greg_t[NGREG]; + alias fpregset_t = _libc_fpstate*; } struct mcontext_t @@ -196,9 +196,9 @@ version (linux) enum NGREG = 19; - alias int greg_t; - alias greg_t[NGREG] gregset_t; - alias _libc_fpstate* fpregset_t; + alias greg_t = int; + alias gregset_t = greg_t[NGREG]; + alias fpregset_t = _libc_fpstate*; } struct mcontext_t @@ -228,7 +228,7 @@ version (linux) enum NGREG = 80; enum NFPREG = 32; - alias c_ulong greg_t; + alias greg_t = c_ulong; struct gregset_t { @@ -270,8 +270,8 @@ version (linux) enum NGREG = 32; enum NFPREG = 32; - alias ulong greg_t; - alias greg_t[NGREG] gregset_t; + alias greg_t = ulong; + alias gregset_t = greg_t[NGREG]; struct fpregset_t { @@ -349,8 +349,8 @@ version (linux) enum NGREG = 32; enum NFPREG = 32; - alias ulong greg_t; - alias greg_t[NGREG] gregset_t; + alias greg_t = ulong; + alias gregset_t = greg_t[NGREG]; struct fpregset_t { @@ -400,8 +400,8 @@ version (linux) { enum NGREG = 48; - alias c_ulong greg_t; - alias greg_t[NGREG] gregset_t; + alias greg_t = c_ulong; + alias gregset_t = greg_t[NGREG]; struct fpregset_t { @@ -466,9 +466,9 @@ version (linux) enum NFPREG = 33; enum NVRREG = 34; - alias c_ulong greg_t; - alias greg_t[NGREG] gregset_t; - alias double[NFPREG] fpregset_t; + alias greg_t = c_ulong; + alias gregset_t = greg_t[NGREG]; + alias fpregset_t = double[NFPREG]; struct vscr_t { @@ -573,7 +573,7 @@ version (linux) } //alias elf_fpregset_t fpregset_t; - alias sigcontext mcontext_t; + alias mcontext_t = sigcontext; struct ucontext_t { @@ -587,7 +587,7 @@ version (linux) } else version (AArch64) { - alias int greg_t; + alias greg_t = int; struct sigcontext { ulong fault_address; @@ -600,7 +600,7 @@ version (linux) align(16) ubyte[4096] __reserved; } - alias sigcontext mcontext_t; + alias mcontext_t = sigcontext; struct ucontext_t { @@ -615,7 +615,7 @@ version (linux) { private { - alias c_ulong[32] __riscv_mc_gp_state; + alias __riscv_mc_gp_state = c_ulong[32]; struct __riscv_mc_f_ext_state { @@ -791,8 +791,8 @@ version (linux) { enum LARCH_NGREG = 32; - alias ulong greg_t; - alias greg_t[LARCH_NGREG] gregset_t; + alias greg_t = ulong; + alias gregset_t = greg_t[LARCH_NGREG]; } struct mcontext_t @@ -886,9 +886,9 @@ else version (FreeBSD) // version (X86_64) { - alias long __register_t; - alias uint __uint32_t; - alias ushort __uint16_t; + alias __register_t = long; + alias __uint32_t = uint; + alias __uint16_t = ushort; struct mcontext_t { __register_t mc_onstack; @@ -937,7 +937,7 @@ else version (FreeBSD) } else version (X86) { - alias int __register_t; + alias __register_t = int; struct mcontext_t { @@ -1010,9 +1010,9 @@ else version (FreeBSD) } else version (PPC_Any) { - alias size_t __register_t; - alias uint __uint32_t; - alias ulong __uint64_t; + alias __register_t = size_t; + alias __uint32_t = uint; + alias __uint64_t = ulong; struct mcontext_t { int mc_vers; @@ -1299,9 +1299,9 @@ else version (DragonFlyBSD) // version (X86_64) { - alias long __register_t; - alias uint __uint32_t; - alias ushort __uint16_t; + alias __register_t = long; + alias __uint32_t = uint; + alias __uint16_t = ushort; struct mcontext_t { __register_t mc_onstack; diff --git a/runtime/druntime/src/core/sys/posix/unistd.d b/runtime/druntime/src/core/sys/posix/unistd.d index 83536a30401..ea6d866999c 100644 --- a/runtime/druntime/src/core/sys/posix/unistd.d +++ b/runtime/druntime/src/core/sys/posix/unistd.d @@ -120,7 +120,7 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { off_t lseek64(int, off_t, int) @trusted; - alias lseek64 lseek; + alias lseek = lseek64; } else { @@ -129,7 +129,7 @@ version (CRuntime_Glibc) static if ( __USE_LARGEFILE64 ) { int ftruncate64(int, off_t) @trusted; - alias ftruncate64 ftruncate; + alias ftruncate = ftruncate64; } else { @@ -188,6 +188,8 @@ else version (NetBSD) { off_t lseek(int, off_t, int) @trusted; int ftruncate(int, off_t) @trusted; + // NetBSD 10.0 + pragma(mangle, "__dup3100") int dup3(int, int, int) @trusted; int faccessat(int, const scope char*, int, int); int fchownat(int, const scope char*, uid_t, gid_t, int); int fexecve(int, const scope char**, const scope char**); @@ -240,20 +242,20 @@ else version (Solaris) version (D_LP64) { off_t lseek(int, off_t, int) @trusted; - alias lseek lseek64; + alias lseek64 = lseek; int ftruncate(int, off_t) @trusted; - alias ftruncate ftruncate64; + alias ftruncate64 = ftruncate; } else { static if ( __USE_LARGEFILE64 ) { off64_t lseek64(int, off64_t, int) @trusted; - alias lseek64 lseek; + alias lseek = lseek64; int ftruncate64(int, off64_t) @trusted; - alias ftruncate64 ftruncate; + alias ftruncate = ftruncate64; } else { @@ -307,8 +309,8 @@ else version (CRuntime_Musl) { int ftruncate(int, off_t) @trusted; off_t lseek(int, off_t, int) @trusted; - alias ftruncate ftruncate64; - alias lseek lseek64; + alias ftruncate64 = ftruncate; + alias lseek64 = lseek; int dup3(int, int, int) @trusted; int faccessat(int, const scope char*, int, int); int fchownat(int, const scope char*, uid_t, gid_t, int); @@ -330,7 +332,7 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { off_t lseek64(int, off_t, int) @trusted; - alias lseek64 lseek; + alias lseek = lseek64; } else { @@ -339,7 +341,7 @@ else version (CRuntime_UClibc) static if ( __USE_LARGEFILE64 ) { int ftruncate64(int, off_t) @trusted; - alias ftruncate64 ftruncate; + alias ftruncate = ftruncate64; } else { @@ -2618,16 +2620,16 @@ version (CRuntime_Glibc) static if ( __USE_FILE_OFFSET64 ) { int lockf64(int, int, off_t) @trusted; - alias lockf64 lockf; + alias lockf = lockf64; ssize_t pread64(int, void*, size_t, off_t); - alias pread64 pread; + alias pread = pread64; ssize_t pwrite64(int, const scope void*, size_t, off_t); - alias pwrite64 pwrite; + alias pwrite = pwrite64; int truncate64(const scope char*, off_t); - alias truncate64 truncate; + alias truncate = truncate64; } else { @@ -2641,7 +2643,7 @@ else version (CRuntime_Musl) { int fchdir(int) @trusted; int lockf(int, int, off_t); - alias lockf lockf64; + alias lockf64 = lockf; } else version (Darwin) { @@ -2716,7 +2718,7 @@ else version (NetBSD) int truncate(const scope char*, off_t); useconds_t ualarm(useconds_t, useconds_t) @trusted; int usleep(useconds_t) @trusted; - pid_t vfork(); + pragma(mangle, "__vfork14") pid_t vfork(); } else version (OpenBSD) { @@ -2808,32 +2810,32 @@ else version (Solaris) version (D_LP64) { int lockf(int, int, off_t); - alias lockf lockf64; + alias lockf64 = lockf; ssize_t pread(int, void*, size_t, off_t); - alias pread pread64; + alias pread64 = pread; ssize_t pwrite(int, const scope void*, size_t, off_t); - alias pwrite pwrite64; + alias pwrite64 = pwrite; int truncate(const scope char*, off_t); - alias truncate truncate64; + alias truncate64 = truncate; } else { static if ( __USE_FILE_OFFSET64 ) { int lockf64(int, int, off64_t); - alias lockf64 lockf; + alias lockf = lockf64; ssize_t pread64(int, void*, size_t, off64_t); - alias pread64 pread; + alias pread = pread64; ssize_t pwrite64(int, const scope void*, size_t, off_t); - alias pwrite64 pwrite; + alias pwrite = pwrite64; int truncate64(const scope char*, off_t); - alias truncate64 truncate; + alias truncate = truncate64; } else { @@ -2868,16 +2870,16 @@ else version (CRuntime_UClibc) static if ( __USE_FILE_OFFSET64 ) { int lockf64(int, int, off_t) @trusted; - alias lockf64 lockf; + alias lockf = lockf64; ssize_t pread64(int, void*, size_t, off_t); - alias pread64 pread; + alias pread = pread64; ssize_t pwrite64(int, const scope void*, size_t, off_t); - alias pwrite64 pwrite; + alias pwrite = pwrite64; int truncate64(const scope char*, off_t); - alias truncate64 truncate; + alias truncate = truncate64; } else { diff --git a/runtime/druntime/src/core/sys/posix/utime.d b/runtime/druntime/src/core/sys/posix/utime.d index e7059d71283..16a26b23d95 100644 --- a/runtime/druntime/src/core/sys/posix/utime.d +++ b/runtime/druntime/src/core/sys/posix/utime.d @@ -93,7 +93,7 @@ else version (NetBSD) time_t modtime; } - int utime(const scope char*, const scope utimbuf*); + pragma(mangle, "__utime50") int utime(const scope char*, const scope utimbuf*); } else version (OpenBSD) { diff --git a/runtime/druntime/src/core/sys/solaris/dlfcn.d b/runtime/druntime/src/core/sys/solaris/dlfcn.d index 343f003b50d..79fb21b1b1b 100644 --- a/runtime/druntime/src/core/sys/solaris/dlfcn.d +++ b/runtime/druntime/src/core/sys/solaris/dlfcn.d @@ -22,7 +22,7 @@ enum RTLD_PROBE = cast(void *)-4, } -alias c_ulong Lmid_t; +alias Lmid_t = c_ulong; void* dlmopen(Lmid_t, const scope char*, int); diff --git a/runtime/druntime/src/core/sys/solaris/link.d b/runtime/druntime/src/core/sys/solaris/link.d index 1459783b4a8..90eb0488ba1 100644 --- a/runtime/druntime/src/core/sys/solaris/link.d +++ b/runtime/druntime/src/core/sys/solaris/link.d @@ -86,9 +86,9 @@ enum LA_ACT_DELETE = 0x02; enum LA_ACT_MAX = 3; version (D_LP64) - alias long lagreg_t; + alias lagreg_t = long; else - alias int lagreg_t; + alias lagreg_t = int; struct _la_sparc_regs { @@ -104,7 +104,7 @@ struct _la_sparc_regs version (D_LP64) { - alias _la_sparc_regs La_sparcv9_regs; + alias La_sparcv9_regs = _la_sparc_regs; struct La_amd64_regs { lagreg_t lr_rsp; @@ -119,7 +119,7 @@ version (D_LP64) } else { - alias _la_sparc_regs La_sparcv8_regs; + alias La_sparcv8_regs = _la_sparc_regs; struct La_i86_regs { lagreg_t lr_esp; @@ -174,7 +174,7 @@ struct dl_phdr_info void* dlpi_tls_data; // since Solaris 11.5 } -private alias extern(C) int function(dl_phdr_info*, size_t, void *) dl_iterate_phdr_cb; -private alias extern(C) int function(dl_phdr_info*, size_t, void *) @nogc dl_iterate_phdr_cb_ngc; +private alias dl_iterate_phdr_cb = extern(C) int function(dl_phdr_info*, size_t, void *); +private alias dl_iterate_phdr_cb_ngc = extern(C) int function(dl_phdr_info*, size_t, void *) @nogc; extern int dl_iterate_phdr(dl_iterate_phdr_cb __callback, void*__data); extern int dl_iterate_phdr(dl_iterate_phdr_cb_ngc __callback, void*__data) @nogc; diff --git a/runtime/druntime/src/core/sys/solaris/sys/elf.d b/runtime/druntime/src/core/sys/solaris/sys/elf.d index 687e7f7d513..83bcc168325 100644 --- a/runtime/druntime/src/core/sys/solaris/sys/elf.d +++ b/runtime/druntime/src/core/sys/solaris/sys/elf.d @@ -61,7 +61,7 @@ enum SHT_SUNW_versym = 0x6fffffff; extern (D) { auto ELF32_ST_VISIBILITY(O)(O o) { return o & 0x07; } - alias ELF32_ST_VISIBILITY ELF64_ST_VISIBILITY; + alias ELF64_ST_VISIBILITY = ELF32_ST_VISIBILITY; } enum STV_EXPORTED = 4; @@ -100,12 +100,12 @@ struct Elf32_Cap } } -alias Elf32_Word Elf32_Capinfo; -alias Elf32_Word Elf32_Capchain; +alias Elf32_Capinfo = Elf32_Word; +alias Elf32_Capchain = Elf32_Word; -alias ELF32_M_SYM ELF32_C_SYM; -alias ELF32_M_SIZE ELF32_C_GROUP; -alias ELF32_M_INFO ELF32_C_INFO; +alias ELF32_C_SYM = ELF32_M_SYM; +alias ELF32_C_GROUP = ELF32_M_SIZE; +alias ELF32_C_INFO = ELF32_M_INFO; struct Elf64_Cap { @@ -117,8 +117,8 @@ struct Elf64_Cap } } -alias Elf64_Xword Elf64_Capinfo; -alias Elf64_Word Elf64_Capchain; +alias Elf64_Capinfo = Elf64_Xword; +alias Elf64_Capchain = Elf64_Word; extern (D) { diff --git a/runtime/druntime/src/core/sys/solaris/sys/elftypes.d b/runtime/druntime/src/core/sys/solaris/sys/elftypes.d index fe8cfef3958..98dd8ac1618 100644 --- a/runtime/druntime/src/core/sys/solaris/sys/elftypes.d +++ b/runtime/druntime/src/core/sys/solaris/sys/elftypes.d @@ -18,5 +18,5 @@ public import core.sys.elf : Elf64_Sword, Elf64_Sxword, Elf64_Word, Elf64_Xword; -alias uint64_t Elf64_Lword; -alias uint64_t Elf32_Lword; +alias Elf64_Lword = uint64_t; +alias Elf32_Lword = uint64_t; diff --git a/runtime/druntime/src/core/sys/solaris/sys/link.d b/runtime/druntime/src/core/sys/solaris/sys/link.d index 9176b1794f9..17b3a676290 100644 --- a/runtime/druntime/src/core/sys/solaris/sys/link.d +++ b/runtime/druntime/src/core/sys/solaris/sys/link.d @@ -75,7 +75,7 @@ enum SYMINFO_FLG_DEFERRED = 0x0200; enum SYMINFO_BT_NONE = 0xfffd; enum SYMINFO_BT_EXTERN = 0xfffc; -alias link_map Link_map; +alias Link_map = link_map; struct link_map { @@ -92,7 +92,7 @@ struct link_map version (_SYSCALL32) { -alias link_map32 Link_map32; +alias Link_map32 = link_map32; struct link_map32 { diff --git a/runtime/druntime/src/core/sys/solaris/sys/types.d b/runtime/druntime/src/core/sys/solaris/sys/types.d index 58558769b71..bb17a607c58 100644 --- a/runtime/druntime/src/core/sys/solaris/sys/types.d +++ b/runtime/druntime/src/core/sys/solaris/sys/types.d @@ -19,6 +19,6 @@ version (Solaris): nothrow: @nogc: -alias short pri_t; +alias pri_t = short; enum P_MYID = -1; diff --git a/runtime/druntime/src/core/sys/windows/accctrl.d b/runtime/druntime/src/core/sys/windows/accctrl.d index e967da6ed63..b9a9051fc32 100644 --- a/runtime/druntime/src/core/sys/windows/accctrl.d +++ b/runtime/druntime/src/core/sys/windows/accctrl.d @@ -17,7 +17,7 @@ import core.sys.windows.basetyps, core.sys.windows.w32api, core.sys.windows.winb // FIXME: check types and grouping of constants // FIXME: check Windows version support -alias LocalFree AccFree; +alias AccFree = LocalFree; enum uint ACTRL_RESERVED = 0x00000000, @@ -133,8 +133,8 @@ enum uint INHERITED_PARENT = 0x10000000, INHERITED_GRANDPARENT = 0x20000000; -alias ULONG INHERIT_FLAGS, ACCESS_RIGHTS; -alias ULONG* PINHERIT_FLAGS, PACCESS_RIGHTS; +alias INHERIT_FLAGS = ULONG, ACCESS_RIGHTS = ULONG; +alias PINHERIT_FLAGS = ULONG*, PACCESS_RIGHTS = ULONG*; enum ACCESS_MODE { NOT_USED_ACCESS, @@ -194,8 +194,8 @@ struct TRUSTEE_A { TRUSTEE_TYPE TrusteeType; LPSTR ptstrName; } -alias TRUSTEE_A TRUSTEEA; -alias TRUSTEE_A* PTRUSTEE_A, PTRUSTEEA; +alias TRUSTEEA = TRUSTEE_A; +alias PTRUSTEE_A = TRUSTEE_A*, PTRUSTEEA = TRUSTEE_A*; struct TRUSTEE_W { TRUSTEE_W* pMultipleTrustee; @@ -204,8 +204,8 @@ struct TRUSTEE_W { TRUSTEE_TYPE TrusteeType; LPWSTR ptstrName; } -alias TRUSTEE_W TRUSTEEW; -alias TRUSTEEW* PTRUSTEE_W, PTRUSTEEW; +alias TRUSTEEW = TRUSTEE_W; +alias PTRUSTEE_W = TRUSTEEW*, PTRUSTEEW = TRUSTEEW*; struct ACTRL_ACCESS_ENTRYA { TRUSTEE_A Trustee; @@ -215,7 +215,7 @@ struct ACTRL_ACCESS_ENTRYA { INHERIT_FLAGS Inheritance; LPCSTR lpInheritProperty; } -alias ACTRL_ACCESS_ENTRYA* PACTRL_ACCESS_ENTRYA; +alias PACTRL_ACCESS_ENTRYA = ACTRL_ACCESS_ENTRYA*; struct ACTRL_ACCESS_ENTRYW { TRUSTEE_W Trustee; @@ -225,47 +225,47 @@ struct ACTRL_ACCESS_ENTRYW { INHERIT_FLAGS Inheritance; LPCWSTR lpInheritProperty; } -alias ACTRL_ACCESS_ENTRYW* PACTRL_ACCESS_ENTRYW; +alias PACTRL_ACCESS_ENTRYW = ACTRL_ACCESS_ENTRYW*; struct ACTRL_ACCESS_ENTRY_LISTA { ULONG cEntries; ACTRL_ACCESS_ENTRYA* pAccessList; } -alias ACTRL_ACCESS_ENTRY_LISTA* PACTRL_ACCESS_ENTRY_LISTA; +alias PACTRL_ACCESS_ENTRY_LISTA = ACTRL_ACCESS_ENTRY_LISTA*; struct ACTRL_ACCESS_ENTRY_LISTW { ULONG cEntries; ACTRL_ACCESS_ENTRYW* pAccessList; } -alias ACTRL_ACCESS_ENTRY_LISTW* PACTRL_ACCESS_ENTRY_LISTW; +alias PACTRL_ACCESS_ENTRY_LISTW = ACTRL_ACCESS_ENTRY_LISTW*; struct ACTRL_PROPERTY_ENTRYA { LPCSTR lpProperty; PACTRL_ACCESS_ENTRY_LISTA pAccessEntryList; ULONG fListFlags; } -alias ACTRL_PROPERTY_ENTRYA* PACTRL_PROPERTY_ENTRYA; +alias PACTRL_PROPERTY_ENTRYA = ACTRL_PROPERTY_ENTRYA*; struct ACTRL_PROPERTY_ENTRYW { LPCWSTR lpProperty; PACTRL_ACCESS_ENTRY_LISTW pAccessEntryList; ULONG fListFlags; } -alias ACTRL_PROPERTY_ENTRYW* PACTRL_PROPERTY_ENTRYW; +alias PACTRL_PROPERTY_ENTRYW = ACTRL_PROPERTY_ENTRYW*; struct ACTRL_ACCESSA { ULONG cEntries; PACTRL_PROPERTY_ENTRYA pPropertyAccessList; } -alias ACTRL_ACCESSA ACTRL_AUDITA; -alias ACTRL_ACCESSA* PACTRL_ACCESSA, PACTRL_AUDITA; +alias ACTRL_AUDITA = ACTRL_ACCESSA; +alias PACTRL_ACCESSA = ACTRL_ACCESSA*, PACTRL_AUDITA = ACTRL_ACCESSA*; struct ACTRL_ACCESSW { ULONG cEntries; PACTRL_PROPERTY_ENTRYW pPropertyAccessList; } -alias ACTRL_ACCESSW ACTRL_AUDITW; -alias ACTRL_ACCESSW* PACTRL_ACCESSW, PACTRL_AUDITW; +alias ACTRL_AUDITW = ACTRL_ACCESSW; +alias PACTRL_ACCESSW = ACTRL_ACCESSW*, PACTRL_AUDITW = ACTRL_ACCESSW*; struct TRUSTEE_ACCESSA { LPSTR lpProperty; @@ -273,7 +273,7 @@ struct TRUSTEE_ACCESSA { ULONG fAccessFlags; ULONG fReturnedAccess; } -alias TRUSTEE_ACCESSA* PTRUSTEE_ACCESSA; +alias PTRUSTEE_ACCESSA = TRUSTEE_ACCESSA*; struct TRUSTEE_ACCESSW { LPWSTR lpProperty; @@ -281,7 +281,7 @@ struct TRUSTEE_ACCESSW { ULONG fAccessFlags; ULONG fReturnedAccess; } -alias TRUSTEE_ACCESSW* PTRUSTEE_ACCESSW; +alias PTRUSTEE_ACCESSW = TRUSTEE_ACCESSW*; struct ACTRL_OVERLAPPED { union { @@ -291,31 +291,31 @@ struct ACTRL_OVERLAPPED { ULONG Reserved2; HANDLE hEvent; } -alias ACTRL_OVERLAPPED* PACTRL_OVERLAPPED; +alias PACTRL_OVERLAPPED = ACTRL_OVERLAPPED*; struct ACTRL_ACCESS_INFOA { ULONG fAccessPermission; LPSTR lpAccessPermissionName; } -alias ACTRL_ACCESS_INFOA* PACTRL_ACCESS_INFOA; +alias PACTRL_ACCESS_INFOA = ACTRL_ACCESS_INFOA*; struct ACTRL_ACCESS_INFOW { ULONG fAccessPermission; LPWSTR lpAccessPermissionName; } -alias ACTRL_ACCESS_INFOW* PACTRL_ACCESS_INFOW; +alias PACTRL_ACCESS_INFOW = ACTRL_ACCESS_INFOW*; struct ACTRL_CONTROL_INFOA { LPSTR lpControlId; LPSTR lpControlName; } -alias ACTRL_CONTROL_INFOA* PACTRL_CONTROL_INFOA; +alias PACTRL_CONTROL_INFOA = ACTRL_CONTROL_INFOA*; struct ACTRL_CONTROL_INFOW { LPWSTR lpControlId; LPWSTR lpControlName; } -alias ACTRL_CONTROL_INFOW* PACTRL_CONTROL_INFOW; +alias PACTRL_CONTROL_INFOW = ACTRL_CONTROL_INFOW*; struct EXPLICIT_ACCESS_A { DWORD grfAccessPermissions; @@ -323,8 +323,8 @@ struct EXPLICIT_ACCESS_A { DWORD grfInheritance; TRUSTEE_A Trustee; } -alias EXPLICIT_ACCESS_A EXPLICIT_ACCESSA; -alias EXPLICIT_ACCESS_A* PEXPLICIT_ACCESS_A, PEXPLICIT_ACCESSA; +alias EXPLICIT_ACCESSA = EXPLICIT_ACCESS_A; +alias PEXPLICIT_ACCESS_A = EXPLICIT_ACCESS_A*, PEXPLICIT_ACCESSA = EXPLICIT_ACCESS_A*; struct EXPLICIT_ACCESS_W { DWORD grfAccessPermissions; @@ -332,8 +332,8 @@ struct EXPLICIT_ACCESS_W { DWORD grfInheritance; TRUSTEE_W Trustee; } -alias EXPLICIT_ACCESS_W EXPLICIT_ACCESSW; -alias EXPLICIT_ACCESS_W* PEXPLICIT_ACCESS_W, PEXPLICIT_ACCESSW; +alias EXPLICIT_ACCESSW = EXPLICIT_ACCESS_W; +alias PEXPLICIT_ACCESS_W = EXPLICIT_ACCESS_W*, PEXPLICIT_ACCESSW = EXPLICIT_ACCESS_W*; struct OBJECTS_AND_SID { DWORD ObjectsPresent; @@ -341,7 +341,7 @@ struct OBJECTS_AND_SID { GUID InheritedObjectTypeGuid; SID* pSid; } -alias OBJECTS_AND_SID* POBJECTS_AND_SID; +alias POBJECTS_AND_SID = OBJECTS_AND_SID*; struct OBJECTS_AND_NAME_A { DWORD ObjectsPresent; @@ -350,7 +350,7 @@ struct OBJECTS_AND_NAME_A { LPSTR InheritedObjectTypeName; LPSTR ptstrName; } -alias OBJECTS_AND_NAME_A* POBJECTS_AND_NAME_A; +alias POBJECTS_AND_NAME_A = OBJECTS_AND_NAME_A*; struct OBJECTS_AND_NAME_W { DWORD ObjectsPresent; @@ -359,64 +359,64 @@ struct OBJECTS_AND_NAME_W { LPWSTR InheritedObjectTypeName; LPWSTR ptstrName; } -alias OBJECTS_AND_NAME_W* POBJECTS_AND_NAME_W; +alias POBJECTS_AND_NAME_W = OBJECTS_AND_NAME_W*; static if (_WIN32_WINNT >= 0x501) { struct INHERITED_FROMA { LONG GenerationGap; LPSTR AncestorName; } - alias INHERITED_FROMA* PINHERITED_FROMA; + alias PINHERITED_FROMA = INHERITED_FROMA*; struct INHERITED_FROMW { LONG GenerationGap; LPWSTR AncestorName; } - alias INHERITED_FROMW* PINHERITED_FROMW; + alias PINHERITED_FROMW = INHERITED_FROMW*; } version (Unicode) { - alias TRUSTEEW TRUSTEE; - alias ACTRL_ACCESSW ACTRL_ACCESS; - alias ACTRL_ACCESS_ENTRY_LISTW ACTRL_ACCESS_ENTRY_LIST; - alias ACTRL_ACCESS_INFOW ACTRL_ACCESS_INFO; - alias ACTRL_ACCESS_ENTRYW ACTRL_ACCESS_ENTRY; - alias ACTRL_AUDITW ACTRL_AUDIT; - alias ACTRL_CONTROL_INFOW ACTRL_CONTROL_INFO; - alias EXPLICIT_ACCESSW EXPLICIT_ACCESS; - alias TRUSTEE_ACCESSW TRUSTEE_ACCESS; - alias OBJECTS_AND_NAME_W OBJECTS_AND_NAME_; + alias TRUSTEE = TRUSTEEW; + alias ACTRL_ACCESS = ACTRL_ACCESSW; + alias ACTRL_ACCESS_ENTRY_LIST = ACTRL_ACCESS_ENTRY_LISTW; + alias ACTRL_ACCESS_INFO = ACTRL_ACCESS_INFOW; + alias ACTRL_ACCESS_ENTRY = ACTRL_ACCESS_ENTRYW; + alias ACTRL_AUDIT = ACTRL_AUDITW; + alias ACTRL_CONTROL_INFO = ACTRL_CONTROL_INFOW; + alias EXPLICIT_ACCESS = EXPLICIT_ACCESSW; + alias TRUSTEE_ACCESS = TRUSTEE_ACCESSW; + alias OBJECTS_AND_NAME_ = OBJECTS_AND_NAME_W; static if (_WIN32_WINNT >= 0x501) { - alias INHERITED_FROMW INHERITED_FROM; + alias INHERITED_FROM = INHERITED_FROMW; } } else { - alias TRUSTEEA TRUSTEE; - alias ACTRL_ACCESSA ACTRL_ACCESS; - alias ACTRL_ACCESS_ENTRY_LISTA ACTRL_ACCESS_ENTRY_LIST; - alias ACTRL_ACCESS_INFOA ACTRL_ACCESS_INFO; - alias ACTRL_ACCESS_ENTRYA ACTRL_ACCESS_ENTRY; - alias ACTRL_AUDITA ACTRL_AUDIT; - alias ACTRL_CONTROL_INFOA ACTRL_CONTROL_INFO; - alias EXPLICIT_ACCESSA EXPLICIT_ACCESS; - alias TRUSTEE_ACCESSA TRUSTEE_ACCESS; - alias OBJECTS_AND_NAME_A OBJECTS_AND_NAME_; + alias TRUSTEE = TRUSTEEA; + alias ACTRL_ACCESS = ACTRL_ACCESSA; + alias ACTRL_ACCESS_ENTRY_LIST = ACTRL_ACCESS_ENTRY_LISTA; + alias ACTRL_ACCESS_INFO = ACTRL_ACCESS_INFOA; + alias ACTRL_ACCESS_ENTRY = ACTRL_ACCESS_ENTRYA; + alias ACTRL_AUDIT = ACTRL_AUDITA; + alias ACTRL_CONTROL_INFO = ACTRL_CONTROL_INFOA; + alias EXPLICIT_ACCESS = EXPLICIT_ACCESSA; + alias TRUSTEE_ACCESS = TRUSTEE_ACCESSA; + alias OBJECTS_AND_NAME_ = OBJECTS_AND_NAME_A; static if (_WIN32_WINNT >= 0x501) { - alias INHERITED_FROMA INHERITED_FROM; + alias INHERITED_FROM = INHERITED_FROMA; } } -alias TRUSTEE TRUSTEE_; -alias TRUSTEE* PTRUSTEE, PTRUSTEE_; -alias ACTRL_ACCESS* PACTRL_ACCESS; -alias ACTRL_ACCESS_ENTRY_LIST* PACTRL_ACCESS_ENTRY_LIST; -alias ACTRL_ACCESS_INFO* PACTRL_ACCESS_INFO; -alias ACTRL_ACCESS_ENTRY* PACTRL_ACCESS_ENTRY; -alias ACTRL_AUDIT* PACTRL_AUDIT; -alias ACTRL_CONTROL_INFO* PACTRL_CONTROL_INFO; -alias EXPLICIT_ACCESS EXPLICIT_ACCESS_; -alias EXPLICIT_ACCESS* PEXPLICIT_ACCESS, PEXPLICIT_ACCESS_; -alias TRUSTEE_ACCESS* PTRUSTEE_ACCESS; -alias OBJECTS_AND_NAME_* POBJECTS_AND_NAME_; +alias TRUSTEE_ = TRUSTEE; +alias PTRUSTEE = TRUSTEE*, PTRUSTEE_ = TRUSTEE*; +alias PACTRL_ACCESS = ACTRL_ACCESS*; +alias PACTRL_ACCESS_ENTRY_LIST = ACTRL_ACCESS_ENTRY_LIST*; +alias PACTRL_ACCESS_INFO = ACTRL_ACCESS_INFO*; +alias PACTRL_ACCESS_ENTRY = ACTRL_ACCESS_ENTRY*; +alias PACTRL_AUDIT = ACTRL_AUDIT*; +alias PACTRL_CONTROL_INFO = ACTRL_CONTROL_INFO*; +alias EXPLICIT_ACCESS_ = EXPLICIT_ACCESS; +alias PEXPLICIT_ACCESS = EXPLICIT_ACCESS*, PEXPLICIT_ACCESS_ = EXPLICIT_ACCESS*; +alias PTRUSTEE_ACCESS = TRUSTEE_ACCESS*; +alias POBJECTS_AND_NAME_ = OBJECTS_AND_NAME_*; static if (_WIN32_WINNT >= 0x501) { - alias INHERITED_FROM* PINHERITED_FROM; + alias PINHERITED_FROM = INHERITED_FROM*; } diff --git a/runtime/druntime/src/core/sys/windows/aclapi.d b/runtime/druntime/src/core/sys/windows/aclapi.d index 0b9f755ed65..3977aab307a 100644 --- a/runtime/druntime/src/core/sys/windows/aclapi.d +++ b/runtime/druntime/src/core/sys/windows/aclapi.d @@ -93,47 +93,45 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias BuildExplicitAccessWithNameW BuildExplicitAccessWithName; - alias BuildSecurityDescriptorW BuildSecurityDescriptor; - alias BuildTrusteeWithNameW BuildTrusteeWithName; - alias BuildTrusteeWithObjectsAndNameW BuildTrusteeWithObjectsAndName; - alias BuildTrusteeWithObjectsAndSidW BuildTrusteeWithObjectsAndSid; - alias BuildTrusteeWithSidW BuildTrusteeWithSid; - alias GetAuditedPermissionsFromAclW GetAuditedPermissionsFromAcl; - alias GetEffectiveRightsFromAclW GetEffectiveRightsFromAcl; - alias GetExplicitEntriesFromAclW GetExplicitEntriesFromAcl; - alias GetNamedSecurityInfoW GetNamedSecurityInfo; - alias GetTrusteeFormW GetTrusteeForm; - alias GetTrusteeNameW GetTrusteeName; - alias GetTrusteeTypeW GetTrusteeType; - alias LookupSecurityDescriptorPartsW LookupSecurityDescriptorParts; - alias SetEntriesInAclW SetEntriesInAcl; - alias SetNamedSecurityInfoW SetNamedSecurityInfo; - alias BuildImpersonateExplicitAccessWithNameW - BuildImpersonateExplicitAccessWithName; - alias BuildImpersonateTrusteeW BuildImpersonateTrustee; - alias GetMultipleTrusteeW GetMultipleTrustee; - alias GetMultipleTrusteeOperationW GetMultipleTrusteeOperation; + alias BuildExplicitAccessWithName = BuildExplicitAccessWithNameW; + alias BuildSecurityDescriptor = BuildSecurityDescriptorW; + alias BuildTrusteeWithName = BuildTrusteeWithNameW; + alias BuildTrusteeWithObjectsAndName = BuildTrusteeWithObjectsAndNameW; + alias BuildTrusteeWithObjectsAndSid = BuildTrusteeWithObjectsAndSidW; + alias BuildTrusteeWithSid = BuildTrusteeWithSidW; + alias GetAuditedPermissionsFromAcl = GetAuditedPermissionsFromAclW; + alias GetEffectiveRightsFromAcl = GetEffectiveRightsFromAclW; + alias GetExplicitEntriesFromAcl = GetExplicitEntriesFromAclW; + alias GetNamedSecurityInfo = GetNamedSecurityInfoW; + alias GetTrusteeForm = GetTrusteeFormW; + alias GetTrusteeName = GetTrusteeNameW; + alias GetTrusteeType = GetTrusteeTypeW; + alias LookupSecurityDescriptorParts = LookupSecurityDescriptorPartsW; + alias SetEntriesInAcl = SetEntriesInAclW; + alias SetNamedSecurityInfo = SetNamedSecurityInfoW; + alias BuildImpersonateExplicitAccessWithName = BuildImpersonateExplicitAccessWithNameW; + alias BuildImpersonateTrustee = BuildImpersonateTrusteeW; + alias GetMultipleTrustee = GetMultipleTrusteeW; + alias GetMultipleTrusteeOperation = GetMultipleTrusteeOperationW; } else { - alias BuildExplicitAccessWithNameA BuildExplicitAccessWithName; - alias BuildSecurityDescriptorA BuildSecurityDescriptor; - alias BuildTrusteeWithNameA BuildTrusteeWithName; - alias BuildTrusteeWithObjectsAndNameA BuildTrusteeWithObjectsAndName; - alias BuildTrusteeWithObjectsAndSidA BuildTrusteeWithObjectsAndSid; - alias BuildTrusteeWithSidA BuildTrusteeWithSid; - alias GetAuditedPermissionsFromAclA GetAuditedPermissionsFromAcl; - alias GetEffectiveRightsFromAclA GetEffectiveRightsFromAcl; - alias GetExplicitEntriesFromAclA GetExplicitEntriesFromAcl; - alias GetNamedSecurityInfoA GetNamedSecurityInfo; - alias GetTrusteeFormA GetTrusteeForm; - alias GetTrusteeNameA GetTrusteeName; - alias GetTrusteeTypeA GetTrusteeType; - alias LookupSecurityDescriptorPartsA LookupSecurityDescriptorParts; - alias SetEntriesInAclA SetEntriesInAcl; - alias SetNamedSecurityInfoA SetNamedSecurityInfo; - alias BuildImpersonateExplicitAccessWithNameA - BuildImpersonateExplicitAccessWithName; - alias BuildImpersonateTrusteeA BuildImpersonateTrustee; - alias GetMultipleTrusteeA GetMultipleTrustee; - alias GetMultipleTrusteeOperationA GetMultipleTrusteeOperation; + alias BuildExplicitAccessWithName = BuildExplicitAccessWithNameA; + alias BuildSecurityDescriptor = BuildSecurityDescriptorA; + alias BuildTrusteeWithName = BuildTrusteeWithNameA; + alias BuildTrusteeWithObjectsAndName = BuildTrusteeWithObjectsAndNameA; + alias BuildTrusteeWithObjectsAndSid = BuildTrusteeWithObjectsAndSidA; + alias BuildTrusteeWithSid = BuildTrusteeWithSidA; + alias GetAuditedPermissionsFromAcl = GetAuditedPermissionsFromAclA; + alias GetEffectiveRightsFromAcl = GetEffectiveRightsFromAclA; + alias GetExplicitEntriesFromAcl = GetExplicitEntriesFromAclA; + alias GetNamedSecurityInfo = GetNamedSecurityInfoA; + alias GetTrusteeForm = GetTrusteeFormA; + alias GetTrusteeName = GetTrusteeNameA; + alias GetTrusteeType = GetTrusteeTypeA; + alias LookupSecurityDescriptorParts = LookupSecurityDescriptorPartsA; + alias SetEntriesInAcl = SetEntriesInAclA; + alias SetNamedSecurityInfo = SetNamedSecurityInfoA; + alias BuildImpersonateExplicitAccessWithName = BuildImpersonateExplicitAccessWithNameA; + alias BuildImpersonateTrustee = BuildImpersonateTrusteeA; + alias GetMultipleTrustee = GetMultipleTrusteeA; + alias GetMultipleTrusteeOperation = GetMultipleTrusteeOperationA; } diff --git a/runtime/druntime/src/core/sys/windows/aclui.d b/runtime/druntime/src/core/sys/windows/aclui.d index d7db31738f9..58cd8df7c78 100644 --- a/runtime/druntime/src/core/sys/windows/aclui.d +++ b/runtime/druntime/src/core/sys/windows/aclui.d @@ -30,7 +30,7 @@ struct SI_OBJECT_INFO { LPWSTR pszPageTitle; GUID guidObjectType; } -alias SI_OBJECT_INFO* PSI_OBJECT_INFO; +alias PSI_OBJECT_INFO = SI_OBJECT_INFO*; // values for SI_OBJECT_INFO.dwFlags enum DWORD @@ -66,7 +66,7 @@ const(GUID)* pguid; LPCWSTR pszName; DWORD dwFlags; } -alias SI_ACCESS* PSI_ACCESS; +alias PSI_ACCESS = SI_ACCESS*; // values for SI_ACCESS.dwFlags enum DWORD @@ -81,7 +81,7 @@ const(GUID)* pguid; ULONG dwFlags; LPCWSTR pszName; } -alias SI_INHERIT_TYPE* PSI_INHERIT_TYPE; +alias PSI_INHERIT_TYPE = SI_INHERIT_TYPE*; /* values for SI_INHERIT_TYPE.dwFlags INHERIT_ONLY_ACE, CONTAINER_INHERIT_ACE, OBJECT_INHERIT_ACE @@ -105,7 +105,7 @@ interface ISecurityInformation : IUnknown { HRESULT GetInheritTypes(PSI_INHERIT_TYPE*, ULONG*); HRESULT PropertySheetPageCallback(HWND, UINT, SI_PAGE_TYPE); } -alias ISecurityInformation LPSECURITYINFO; +alias LPSECURITYINFO = ISecurityInformation; /* Comment from MinGW * TODO: ISecurityInformation2, IEffectivePermission, ISecurityObjectTypeInfo diff --git a/runtime/druntime/src/core/sys/windows/basetsd.d b/runtime/druntime/src/core/sys/windows/basetsd.d index d06bc5744ec..ab131f4e023 100644 --- a/runtime/druntime/src/core/sys/windows/basetsd.d +++ b/runtime/druntime/src/core/sys/windows/basetsd.d @@ -15,7 +15,7 @@ version (Windows): // import. alias HANDLE = void*; -alias HANDLE* PHANDLE, LPHANDLE; +alias PHANDLE = HANDLE*, LPHANDLE = HANDLE*; // helper for aligned structs // alignVal 0 means the default align. @@ -32,17 +32,17 @@ version (CoreUnittest) { } version (Win64) { - alias long __int3264; + alias __int3264 = long; enum ulong ADDRESS_TAG_BIT = 0x40000000000; - alias long INT_PTR, LONG_PTR; - alias long* PINT_PTR, PLONG_PTR; - alias ulong UINT_PTR, ULONG_PTR, HANDLE_PTR; - alias ulong* PUINT_PTR, PULONG_PTR; - alias int HALF_PTR; - alias int* PHALF_PTR; - alias uint UHALF_PTR; - alias uint* PUHALF_PTR; + alias INT_PTR = long, LONG_PTR = long; + alias PINT_PTR = long*, PLONG_PTR = long*; + alias UINT_PTR = ulong, ULONG_PTR = ulong, HANDLE_PTR = ulong; + alias PUINT_PTR = ulong*, PULONG_PTR = ulong*; + alias HALF_PTR = int; + alias PHALF_PTR = int*; + alias UHALF_PTR = uint; + alias PUHALF_PTR = uint*; uint HandleToULong()(void* h) { return(cast(uint) cast(ULONG_PTR) h); } int HandleToLong()(void* h) { return(cast(int) cast(LONG_PTR) h); } @@ -60,17 +60,17 @@ enum ulong ADDRESS_TAG_BIT = 0x40000000000; void* ULongToPtr()(uint ul) { return(cast(void*) cast(ULONG_PTR) ul); } } else { - alias int __int3264; + alias __int3264 = int; enum uint ADDRESS_TAG_BIT = 0x80000000; - alias int INT_PTR, LONG_PTR; - alias int* PINT_PTR, PLONG_PTR; - alias uint UINT_PTR, ULONG_PTR, HANDLE_PTR; - alias uint* PUINT_PTR, PULONG_PTR; - alias short HALF_PTR; - alias short* PHALF_PTR; - alias ushort UHALF_PTR; - alias ushort* PUHALF_PTR; + alias INT_PTR = int, LONG_PTR = int; + alias PINT_PTR = int*, PLONG_PTR = int*; + alias UINT_PTR = uint, ULONG_PTR = uint, HANDLE_PTR = uint; + alias PUINT_PTR = uint*, PULONG_PTR = uint*; + alias HALF_PTR = short; + alias PHALF_PTR = short*; + alias UHALF_PTR = ushort; + alias PUHALF_PTR = ushort*; uint HandleToUlong()(HANDLE h) { return cast(uint) h; } int HandleToLong()(HANDLE h) { return cast(int) h; } @@ -82,11 +82,11 @@ enum uint ADDRESS_TAG_BIT = 0x80000000; short PtrToShort(const(void)* p) { return cast(short) p; } void* IntToPtr()(int i) { return cast(void*) i; } void* UIntToPtr()(uint ui) { return cast(void*) ui; } - alias IntToPtr LongToPtr; - alias UIntToPtr ULongToPtr; + alias LongToPtr = IntToPtr; + alias ULongToPtr = UIntToPtr; } -alias UIntToPtr UintToPtr, UlongToPtr; +alias UintToPtr = UIntToPtr, UlongToPtr = UIntToPtr; enum : UINT_PTR { MAXUINT_PTR = UINT_PTR.max @@ -115,27 +115,27 @@ enum : HALF_PTR { MINHALF_PTR = HALF_PTR.min } -alias byte INT8; -alias byte* PINT8; -alias ubyte UINT8; -alias ubyte* PUINT8; - -alias short INT16; -alias short* PINT16; -alias ushort UINT16; -alias ushort* PUINT16; - -alias int LONG32, INT32; -alias int* PLONG32, PINT32; -alias uint ULONG32, DWORD32, UINT32; -alias uint* PULONG32, PDWORD32, PUINT32; - -alias ULONG_PTR SIZE_T, DWORD_PTR; -alias ULONG_PTR* PSIZE_T, PDWORD_PTR; -alias LONG_PTR SSIZE_T; -alias LONG_PTR* PSSIZE_T; - -alias long LONG64, INT64; -alias long* PLONG64, PINT64; -alias ulong ULONG64, DWORD64, UINT64; -alias ulong* PULONG64, PDWORD64, PUINT64; +alias INT8 = byte; +alias PINT8 = byte*; +alias UINT8 = ubyte; +alias PUINT8 = ubyte*; + +alias INT16 = short; +alias PINT16 = short*; +alias UINT16 = ushort; +alias PUINT16 = ushort*; + +alias LONG32 = int, INT32 = int; +alias PLONG32 = int*, PINT32 = int*; +alias ULONG32 = uint, DWORD32 = uint, UINT32 = uint; +alias PULONG32 = uint*, PDWORD32 = uint*, PUINT32 = uint*; + +alias SIZE_T = ULONG_PTR, DWORD_PTR = ULONG_PTR; +alias PSIZE_T = ULONG_PTR*, PDWORD_PTR = ULONG_PTR*; +alias SSIZE_T = LONG_PTR; +alias PSSIZE_T = LONG_PTR*; + +alias LONG64 = long, INT64 = long; +alias PLONG64 = long*, PINT64 = long*; +alias ULONG64 = ulong, DWORD64 = ulong, UINT64 = ulong; +alias PULONG64 = ulong*, PDWORD64 = ulong*, PUINT64 = ulong*; diff --git a/runtime/druntime/src/core/sys/windows/basetyps.d b/runtime/druntime/src/core/sys/windows/basetyps.d index d90d9f3425a..7fd6f647c01 100644 --- a/runtime/druntime/src/core/sys/windows/basetyps.d +++ b/runtime/druntime/src/core/sys/windows/basetyps.d @@ -18,10 +18,10 @@ align(1) struct GUID { // size is 16 WORD Data3; BYTE[8] Data4; } -alias GUID UUID, /*IID, CLSID, */FMTID, uuid_t; +alias UUID = GUID, /*IID, CLSID, */FMTID = GUID, uuid_t = GUID; alias IID = const(GUID); alias CLSID = const(GUID); -alias GUID* LPGUID, LPCLSID, LPIID; -alias const(GUID)* LPCGUID, REFGUID, REFIID, REFCLSID, REFFMTID; -alias uint error_status_t, PROPID; +alias LPGUID = GUID*, LPCLSID = GUID*, LPIID = GUID*; +alias LPCGUID = const(GUID)*, REFGUID = const(GUID)*, REFIID = const(GUID)*, REFCLSID = const(GUID)*, REFFMTID = const(GUID)*; +alias error_status_t = uint, PROPID = uint; diff --git a/runtime/druntime/src/core/sys/windows/comcat.d b/runtime/druntime/src/core/sys/windows/comcat.d index 4cc35f467f7..37411498832 100644 --- a/runtime/druntime/src/core/sys/windows/comcat.d +++ b/runtime/druntime/src/core/sys/windows/comcat.d @@ -14,7 +14,7 @@ import core.sys.windows.ole2; import core.sys.windows.basetyps, core.sys.windows.cguid, core.sys.windows.objbase, core.sys.windows.unknwn, core.sys.windows.windef, core.sys.windows.wtypes; -alias IEnumGUID LPENUMGUID; +alias LPENUMGUID = IEnumGUID; interface IEnumGUID : IUnknown { HRESULT Next(ULONG, GUID*, ULONG*); @@ -23,25 +23,25 @@ interface IEnumGUID : IUnknown { HRESULT Clone(LPENUMGUID*); } -alias GUID CATID; -alias REFGUID REFCATID; -alias GUID_NULL CATID_NULL; -alias IsEqualGUID IsEqualCATID; +alias CATID = GUID; +alias REFCATID = REFGUID; +alias CATID_NULL = GUID_NULL; +alias IsEqualCATID = IsEqualGUID; struct CATEGORYINFO { CATID catid; LCID lcid; OLECHAR[128] szDescription = 0; } -alias CATEGORYINFO* LPCATEGORYINFO; +alias LPCATEGORYINFO = CATEGORYINFO*; -alias IEnumGUID IEnumCATID; -alias LPENUMGUID LPENUMCATID; -alias IID_IEnumGUID IID_IEnumCATID; +alias IEnumCATID = IEnumGUID; +alias LPENUMCATID = LPENUMGUID; +alias IID_IEnumCATID = IID_IEnumGUID; -alias IEnumGUID IEnumCLSID; -alias LPENUMGUID LPENUMCLSID; -alias IID_IEnumGUID IID_IEnumCLSID; +alias IEnumCLSID = IEnumGUID; +alias LPENUMCLSID = LPENUMGUID; +alias IID_IEnumCLSID = IID_IEnumGUID; interface ICatInformation : IUnknown { HRESULT EnumCategories(LCID, LPENUMCATEGORYINFO*); @@ -52,7 +52,7 @@ interface ICatInformation : IUnknown { HRESULT EnumImplCategoriesOfClass(REFCLSID, LPENUMCATID*); HRESULT EnumReqCategoriesOfClass(REFCLSID, LPENUMCATID*); } -alias ICatInformation LPCATINFORMATION; +alias LPCATINFORMATION = ICatInformation; interface ICatRegister : IUnknown { HRESULT RegisterCategories(ULONG, CATEGORYINFO*); @@ -62,7 +62,7 @@ interface ICatRegister : IUnknown { HRESULT RegisterClassReqCategories(REFCLSID, ULONG, CATID*); HRESULT UnRegisterClassReqCategories(REFCLSID, ULONG, CATID*); } -alias ICatRegister LPCATREGISTER; +alias LPCATREGISTER = ICatRegister; interface IEnumCATEGORYINFO : IUnknown { HRESULT Next(ULONG, CATEGORYINFO*, ULONG*); @@ -70,4 +70,4 @@ interface IEnumCATEGORYINFO : IUnknown { HRESULT Reset(); HRESULT Clone(LPENUMCATEGORYINFO*); } -alias IEnumCATEGORYINFO LPENUMCATEGORYINFO; +alias LPENUMCATEGORYINFO = IEnumCATEGORYINFO; diff --git a/runtime/druntime/src/core/sys/windows/commctrl.d b/runtime/druntime/src/core/sys/windows/commctrl.d index fcece45be46..c9add615a5f 100644 --- a/runtime/druntime/src/core/sys/windows/commctrl.d +++ b/runtime/druntime/src/core/sys/windows/commctrl.d @@ -947,9 +947,9 @@ static if (_WIN32_IE >= 0x400) { // IE4.0 ??? TTM_SETTITLEW // = WM_USER + 33 } static if (_WIN32_IE >= 0x500) { - alias TTM_SETTITLEW TTM_SETTITLE; + alias TTM_SETTITLE = TTM_SETTITLEW; } else { - alias TTM_SETTITLEA TTM_SETTITLE; + alias TTM_SETTITLE = TTM_SETTITLEA; } } @@ -2535,13 +2535,13 @@ static if (_WIN32_IE >= 0x400) { } version (Unicode) { - alias SB_SETTIPTEXTW SB_SETTIPTEXT; - alias SB_GETTIPTEXTW SB_GETTIPTEXT; - alias RB_GETBANDINFOW RB_GETBANDINFO; + alias SB_SETTIPTEXT = SB_SETTIPTEXTW; + alias SB_GETTIPTEXT = SB_GETTIPTEXTW; + alias RB_GETBANDINFO = RB_GETBANDINFOW; } else { - alias SB_SETTIPTEXTA SB_SETTIPTEXT; - alias SB_GETTIPTEXTA SB_GETTIPTEXT; - alias RB_GETBANDINFOA RB_GETBANDINFO; + alias SB_SETTIPTEXT = SB_SETTIPTEXTA; + alias SB_GETTIPTEXT = SB_GETTIPTEXTA; + alias RB_GETBANDINFO = RB_GETBANDINFOA; } } else { enum { @@ -2586,7 +2586,7 @@ static if (_WIN32_WINNT >= 0x501) { NMHDR hdr; DWORD dwFlags; } - alias NMBCHOTITEM* LPNMBCHOTITEM; + alias LPNMBCHOTITEM = NMBCHOTITEM*; } static if (_WIN32_WINNT >= 0x600) { @@ -2628,7 +2628,7 @@ enum HIMAGELIST BCCL_NOGLYPH = cast(HIMAGELIST)-1; UINT uSplitStyle; SIZE size; } - alias BUTTON_SPLITINFO* PBUTTON_SPLITINFO; + alias PBUTTON_SPLITINFO = BUTTON_SPLITINFO*; } enum { @@ -2745,7 +2745,7 @@ struct TBMETRICS { int cxButtonSpacing; int cyButtonSpacing; } -alias TBMETRICS* LPTBMETRICS; +alias LPTBMETRICS = TBMETRICS*; static if (_WIN32_WINNT >= 0x501) { struct TTGETTITLE { @@ -2754,7 +2754,7 @@ static if (_WIN32_WINNT >= 0x501) { UINT cch; WCHAR* pszTitle; } - alias TTGETTITLE* PTTGETTITLE; + alias PTTGETTITLE = TTGETTITLE*; } static if (_WIN32_WINNT >= 0x600) { @@ -2772,7 +2772,7 @@ static if (_WIN32_WINNT >= 0x600) { PWSTR pszName; size_t cchName; } - alias MCGRIDINFO* PMCGRIDINFO; + alias PMCGRIDINFO = MCGRIDINFO*; struct DATETIMEPICKERINFO { @@ -2785,7 +2785,7 @@ static if (_WIN32_WINNT >= 0x600) { HWND hwndUD; HWND hwndDropDown; } - alias DATETIMEPICKERINFO* LPDATETIMEPICKERINFO; + alias LPDATETIMEPICKERINFO = DATETIMEPICKERINFO*; } struct COMBOBOXEXITEMA { @@ -2799,8 +2799,8 @@ struct COMBOBOXEXITEMA { int iIndent; LPARAM lParam; } -alias COMBOBOXEXITEMA* PCOMBOBOXEXITEMA; -alias const(COMBOBOXEXITEMA)* PCCOMBOEXITEMA; +alias PCOMBOBOXEXITEMA = COMBOBOXEXITEMA*; +alias PCCOMBOEXITEMA = const(COMBOBOXEXITEMA)*; struct COMBOBOXEXITEMW { UINT mask; @@ -2813,42 +2813,42 @@ struct COMBOBOXEXITEMW { int iIndent; LPARAM lParam; } -alias COMBOBOXEXITEMW* PCOMBOBOXEXITEMW; -alias const(COMBOBOXEXITEMW)* PCCOMBOEXITEMW; +alias PCOMBOBOXEXITEMW = COMBOBOXEXITEMW*; +alias PCCOMBOEXITEMW = const(COMBOBOXEXITEMW)*; static if (_WIN32_IE >= 0x400) { struct NMCOMBOBOXEXA { NMHDR hdr; COMBOBOXEXITEMA ceItem; } - alias NMCOMBOBOXEXA* PNMCOMBOBOXEXA; + alias PNMCOMBOBOXEXA = NMCOMBOBOXEXA*; struct NMCOMBOBOXEXW { NMHDR hdr; COMBOBOXEXITEMW ceItem; } - alias NMCOMBOBOXEXW* PNMCOMBOBOXEXW; + alias PNMCOMBOBOXEXW = NMCOMBOBOXEXW*; struct NMCBEDRAGBEGINW { NMHDR hdr; int iItemid; WCHAR[CBEMAXSTRLEN] szText = 0; } - alias NMCBEDRAGBEGINW* LPNMCBEDRAGBEGINW, PNMCBEDRAGBEGINW; + alias LPNMCBEDRAGBEGINW = NMCBEDRAGBEGINW*, PNMCBEDRAGBEGINW = NMCBEDRAGBEGINW*; struct NMCBEDRAGBEGINA { NMHDR hdr; int iItemid; char[CBEMAXSTRLEN] szText = 0; } - alias NMCBEDRAGBEGINA* LPNMCBEDRAGBEGINA, PNMCBEDRAGBEGINA; + alias LPNMCBEDRAGBEGINA = NMCBEDRAGBEGINA*, PNMCBEDRAGBEGINA = NMCBEDRAGBEGINA*; struct NMIPADDRESS { NMHDR hdr; int iField; int iValue; } - alias NMIPADDRESS* LPNMIPADDRESS; + alias LPNMIPADDRESS = NMIPADDRESS*; align (1) struct NMLVKEYDOWN { @@ -2857,7 +2857,7 @@ static if (_WIN32_IE >= 0x400) { WORD wVKey; UINT flags; } - alias NMLVKEYDOWN* LPNMLVKEYDOWN; + alias LPNMLVKEYDOWN = NMLVKEYDOWN*; struct NMPGCALCSIZE { NMHDR hdr; @@ -2865,7 +2865,7 @@ static if (_WIN32_IE >= 0x400) { int iWidth; int iHeight; } - alias NMPGCALCSIZE* LPNMPGCALCSIZE; + alias LPNMPGCALCSIZE = NMPGCALCSIZE*; align (1) struct NMPGSCROLL { @@ -2878,14 +2878,14 @@ static if (_WIN32_IE >= 0x400) { int iYpos; int iScroll; } - alias NMPGSCROLL* LPNMPGSCROLL; + alias LPNMPGSCROLL = NMPGSCROLL*; struct NMSELCHANGE { NMHDR nmhdr; SYSTEMTIME stSelStart; SYSTEMTIME stSelEnd; } - alias NMSELCHANGE* LPNMSELCHANGE; + alias LPNMSELCHANGE = NMSELCHANGE*; struct NMTBHOTITEM { NMHDR hdr; @@ -2893,7 +2893,7 @@ static if (_WIN32_IE >= 0x400) { int idNew; DWORD dwFlags; } - alias NMTBHOTITEM* LPNMTBHOTITEM; + alias LPNMTBHOTITEM = NMTBHOTITEM*; struct NMTBDISPINFOA { NMHDR hdr; @@ -2904,7 +2904,7 @@ static if (_WIN32_IE >= 0x400) { LPSTR pszText; int cchText; } - alias NMTBDISPINFOA* LPNMTBDISPINFOA; + alias LPNMTBDISPINFOA = NMTBDISPINFOA*; struct NMTBDISPINFOW { NMHDR hdr; @@ -2915,7 +2915,7 @@ static if (_WIN32_IE >= 0x400) { LPWSTR pszText; int cchText; } - alias NMTBDISPINFOW* LPNMTBDISPINFOW; + alias LPNMTBDISPINFOW = NMTBDISPINFOW*; struct NMTBGETINFOTIPA { NMHDR hdr; @@ -2924,7 +2924,7 @@ static if (_WIN32_IE >= 0x400) { int iItem; LPARAM lParam; } - alias NMTBGETINFOTIPA* LPNMTBGETINFOTIPA; + alias LPNMTBGETINFOTIPA = NMTBGETINFOTIPA*; struct NMTBGETINFOTIPW { NMHDR hdr; @@ -2933,7 +2933,7 @@ static if (_WIN32_IE >= 0x400) { int iItem; LPARAM lParam; } - alias NMTBGETINFOTIPW* LPNMTBGETINFOTIPW; + alias LPNMTBGETINFOTIPW = NMTBGETINFOTIPW*; struct NMMOUSE { NMHDR hdr; @@ -2942,7 +2942,7 @@ static if (_WIN32_IE >= 0x400) { POINT pt; LPARAM dwHitInfo; } - alias NMMOUSE* LPNMMOUSE; + alias LPNMMOUSE = NMMOUSE*; } static if (_WIN32_IE >= 0x401) { @@ -2950,7 +2950,7 @@ static if (_WIN32_IE >= 0x401) { NMHDR hdr; HWND hwndToolTips; } - alias NMTOOLTIPSCREATED* LPNMTOOLTIPSCREATED; + alias LPNMTOOLTIPSCREATED = NMTOOLTIPSCREATED*; } struct NMDATETIMECHANGE { @@ -2958,7 +2958,7 @@ struct NMDATETIMECHANGE { DWORD dwFlags; SYSTEMTIME st; } -alias NMDATETIMECHANGE* LPNMDATETIMECHANGE; +alias LPNMDATETIMECHANGE = NMDATETIMECHANGE*; struct NMCBEENDEDITW { NMHDR hdr; @@ -2967,7 +2967,7 @@ struct NMCBEENDEDITW { WCHAR[CBEMAXSTRLEN] szText = 0; int iWhy; } -alias NMCBEENDEDITW* LPNMCBEENDEDITW, PNMCBEENDEDITW; +alias LPNMCBEENDEDITW = NMCBEENDEDITW*, PNMCBEENDEDITW = NMCBEENDEDITW*; struct NMCBEENDEDITA { NMHDR hdr; @@ -2976,20 +2976,20 @@ struct NMCBEENDEDITA { char[CBEMAXSTRLEN] szText = 0; int iWhy; } -alias NMCBEENDEDITA* LPNMCBEENDEDITA, PNMCBEENDEDITA; +alias LPNMCBEENDEDITA = NMCBEENDEDITA*, PNMCBEENDEDITA = NMCBEENDEDITA*; struct COLORMAP { COLORREF from; COLORREF to; } -alias COLORMAP* LPCOLORMAP; +alias LPCOLORMAP = COLORMAP*; struct DRAGLISTINFO { UINT uNotification; HWND hWnd; POINT ptCursor; } -alias DRAGLISTINFO* LPDRAGLISTINFO; +alias LPDRAGLISTINFO = DRAGLISTINFO*; struct TBBUTTON { int iBitmap; @@ -3004,8 +3004,8 @@ struct TBBUTTON { DWORD_PTR dwData; INT_PTR iString; } -alias TBBUTTON* PTBBUTTON, LPTBBUTTON; -alias const(TBBUTTON)* LPCTBBUTTON; +alias PTBBUTTON = TBBUTTON*, LPTBBUTTON = TBBUTTON*; +alias LPCTBBUTTON = const(TBBUTTON)*; static if (_WIN32_IE >= 0x400) { struct TBBUTTONINFOA { @@ -3020,7 +3020,7 @@ static if (_WIN32_IE >= 0x400) { LPSTR pszText; int cchText; } - alias TBBUTTONINFOA* LPTBBUTTONINFOA; + alias LPTBBUTTONINFOA = TBBUTTONINFOA*; struct TBBUTTONINFOW { UINT cbSize = TBBUTTONINFOW.sizeof; @@ -3034,13 +3034,13 @@ static if (_WIN32_IE >= 0x400) { LPWSTR pszText; int cchText; } - alias TBBUTTONINFOW* LPTBBUTTONINFOW; + alias LPTBBUTTONINFOW = TBBUTTONINFOW*; struct TBINSERTMARK { int iButton; DWORD dwFlags; } - alias TBINSERTMARK* LPTBINSERTMARK; + alias LPTBINSERTMARK = TBINSERTMARK*; struct LVBKIMAGEA { ULONG ulFlags; @@ -3050,7 +3050,7 @@ static if (_WIN32_IE >= 0x400) { int xOffsetPercent; int yOffsetPercent; } - alias LVBKIMAGEA* LPLVBKIMAGEA; + alias LPLVBKIMAGEA = LVBKIMAGEA*; struct LVBKIMAGEW { ULONG ulFlags; @@ -3060,7 +3060,7 @@ static if (_WIN32_IE >= 0x400) { int xOffsetPercent; int yOffsetPercent; } - alias LVBKIMAGEW* LPLVBKIMAGEW; + alias LPLVBKIMAGEW = LVBKIMAGEW*; } /*struct TBNOTIFY { @@ -3086,7 +3086,7 @@ struct IMAGEINFO { int Unused2; RECT rcImage; } -alias IMAGEINFO* LPIMAGEINFO; +alias LPIMAGEINFO = IMAGEINFO*; static if (_WIN32_IE >= 0x500) { struct HDITEMA { @@ -3161,12 +3161,12 @@ static if (_WIN32_IE >= 0x500) { LPARAM lParam; } } -alias HDITEMA* LPHDITEMA; -alias HDITEMW* LPHDITEMW; +alias LPHDITEMA = HDITEMA*; +alias LPHDITEMW = HDITEMW*; deprecated { - alias HDITEMA HD_ITEMA; - alias HDITEMW HD_ITEMW; + alias HD_ITEMA = HDITEMA; + alias HD_ITEMW = HDITEMW; //alias HDITEM HD_ITEM; fixme } @@ -3174,15 +3174,15 @@ struct HD_LAYOUT { RECT* prc; WINDOWPOS* pwpos; } -alias HD_LAYOUT* LPHDLAYOUT; -deprecated alias HD_LAYOUT HDLAYOUT; +alias LPHDLAYOUT = HD_LAYOUT*; +deprecated alias HDLAYOUT = HD_LAYOUT; struct HD_HITTESTINFO { POINT pt; UINT flags; int iItem; } -alias HD_HITTESTINFO* LPHDHITTESTINFO; +alias LPHDHITTESTINFO = HD_HITTESTINFO*; struct HD_NOTIFYA { NMHDR hdr; @@ -3207,7 +3207,7 @@ struct NMHEADERA { int iButton; HDITEMA* pitem; } -alias NMHEADERA* LPNMHEADERA; +alias LPNMHEADERA = NMHEADERA*; struct NMHEADERW { NMHDR hdr; @@ -3215,14 +3215,14 @@ struct NMHEADERW { int iButton; HDITEMW* pitem; } -alias NMHEADERW* LPNMHEADERW; +alias LPNMHEADERW = NMHEADERW*; version (Unicode) { - alias NMHEADERW NMHEADER; - alias LPNMHEADERW LPNMHEADER; + alias NMHEADER = NMHEADERW; + alias LPNMHEADER = LPNMHEADERW; } else { - alias NMHEADERA NMHEADER; - alias LPNMHEADERA LPNMHEADER; + alias NMHEADER = NMHEADERA; + alias LPNMHEADER = LPNMHEADERA; } // End FIXME @@ -3235,7 +3235,7 @@ struct NMHDDISPINFOA { int iImage; LPARAM lParam; } -alias NMHDDISPINFOA* LPNMHDDISPINFOA; +alias LPNMHDDISPINFOA = NMHDDISPINFOA*; struct NMHDDISPINFOW { NMHDR hdr; @@ -3246,7 +3246,7 @@ struct NMHDDISPINFOW { int iImage; LPARAM lParam; } -alias NMHDDISPINFOW* LPNMHDDISPINFOW; +alias LPNMHDDISPINFOW = NMHDDISPINFOW*; struct NMCUSTOMDRAW { NMHDR hdr; @@ -3257,7 +3257,7 @@ struct NMCUSTOMDRAW { UINT uItemState; LPARAM lItemlParam; } -alias NMCUSTOMDRAW* LPNMCUSTOMDRAW; +alias LPNMCUSTOMDRAW = NMCUSTOMDRAW*; static if (_WIN32_IE >= 0x400) { struct NMLVCUSTOMDRAW { @@ -3273,7 +3273,7 @@ static if (_WIN32_IE >= 0x400) { COLORREF clrTextBk; } } -alias NMLVCUSTOMDRAW* LPNMLVCUSTOMDRAW; +alias LPNMLVCUSTOMDRAW = NMLVCUSTOMDRAW*; static if (_WIN32_IE >= 0x400) { struct NMLVGETINFOTIPA { @@ -3285,7 +3285,7 @@ static if (_WIN32_IE >= 0x400) { int iSubItem; LPARAM lParam; } - alias NMLVGETINFOTIPA* LPNMLVGETINFOTIPA; + alias LPNMLVGETINFOTIPA = NMLVGETINFOTIPA*; struct NMLVGETINFOTIPW { NMHDR hdr; @@ -3296,7 +3296,7 @@ static if (_WIN32_IE >= 0x400) { int iSubItem; LPARAM lParam; } - alias NMLVGETINFOTIPW* LPNMLVGETINFOTIPW; + alias LPNMLVGETINFOTIPW = NMLVGETINFOTIPW*; } static if (_WIN32_IE >= 0x400) { @@ -3313,7 +3313,7 @@ static if (_WIN32_IE >= 0x400) { COLORREF clrTextBk; } } -alias NMTVCUSTOMDRAW* LPNMTVCUSTOMDRAW; +alias LPNMTVCUSTOMDRAW = NMTVCUSTOMDRAW*; static if (_WIN32_IE >= 0x400) { static if (_WIN32_WINNT >= 0x501) { @@ -3350,7 +3350,7 @@ static if (_WIN32_IE >= 0x400) { int nHLStringBkMode; } } - alias NMTBCUSTOMDRAW* LPNMTBCUSTOMDRAW; + alias LPNMTBCUSTOMDRAW = NMTBCUSTOMDRAW*; struct NMITEMACTIVATE { NMHDR hdr; @@ -3363,14 +3363,14 @@ static if (_WIN32_IE >= 0x400) { LPARAM lParam; UINT uKeyFlags; } - alias NMITEMACTIVATE* LPNMITEMACTIVATE; + alias LPNMITEMACTIVATE = NMITEMACTIVATE*; } struct TBADDBITMAP { HINSTANCE hInst; UINT_PTR nID; } -alias TBADDBITMAP* LPTBADDBITMAP; +alias LPTBADDBITMAP = TBADDBITMAP*; struct TBSAVEPARAMSA { HKEY hkr; @@ -3391,7 +3391,7 @@ struct TBREPLACEBITMAP { UINT_PTR nIDNew; int nButtons; } -alias TBREPLACEBITMAP* LPTBREPLACEBITMAP; +alias LPTBREPLACEBITMAP = TBREPLACEBITMAP*; static if (_WIN32_IE >= 0x500) { struct NMTOOLBARA { @@ -3428,14 +3428,14 @@ static if (_WIN32_IE >= 0x500) { LPWSTR pszText; } } -alias NMTOOLBARA* LPNMTOOLBARA; -alias NMTOOLBARW* LPNMTOOLBARW; +alias LPNMTOOLBARA = NMTOOLBARA*; +alias LPNMTOOLBARW = NMTOOLBARW*; -alias NMTOOLBARA TBNOTIFYA; -alias LPNMTOOLBARA LPTBNOTIFYA; +alias TBNOTIFYA = NMTOOLBARA; +alias LPTBNOTIFYA = LPNMTOOLBARA; -alias NMTOOLBARW TBNOTIFYW; -alias LPNMTOOLBARW LPTBNOTIFYW; +alias TBNOTIFYW = NMTOOLBARW; +alias LPTBNOTIFYW = LPNMTOOLBARW; static if (_WIN32_WINNT >= 0x501) { struct TOOLINFOA { @@ -3522,24 +3522,24 @@ enum size_t TTTOOLINFOA_V1_SIZE = TOOLINFOA.sizeof, TTTOOLINFOW_V1_SIZE = TOOLINFOW.sizeof; } -alias TOOLINFOA TTTOOLINFOA; -alias TOOLINFOW TTTOOLINFOW; -alias TTTOOLINFOA* LPTTTOOLINFOA, PTOOLINFOA, LPTOOLINFOA; -alias TTTOOLINFOW* LPTTTOOLINFOW, PTOOLINFOW, LPTOOLINFOW; +alias TTTOOLINFOA = TOOLINFOA; +alias TTTOOLINFOW = TOOLINFOW; +alias LPTTTOOLINFOA = TTTOOLINFOA*, PTOOLINFOA = TTTOOLINFOA*, LPTOOLINFOA = TTTOOLINFOA*; +alias LPTTTOOLINFOW = TTTOOLINFOW*, PTOOLINFOW = TTTOOLINFOW*, LPTOOLINFOW = TTTOOLINFOW*; struct TTHITTESTINFOA { HWND hwnd; POINT pt; TOOLINFOA ti; } -alias TTHITTESTINFOA* LPTTHITTESTINFOA, LPHITTESTINFOA; +alias LPTTHITTESTINFOA = TTHITTESTINFOA*, LPHITTESTINFOA = TTHITTESTINFOA*; struct TTHITTESTINFOW { HWND hwnd; POINT pt; TOOLINFOW ti; } -alias TTHITTESTINFOW* LPTTHITTESTINFOW, LPHITTESTINFOW; +alias LPTTHITTESTINFOW = TTHITTESTINFOW*, LPHITTESTINFOW = TTHITTESTINFOW*; static if (_WIN32_IE >= 0x300) { struct NMTTDISPINFOA { @@ -3576,29 +3576,29 @@ static if (_WIN32_IE >= 0x300) { UINT uFlags; } } -alias NMTTDISPINFOA* LPNMTTDISPINFOA; -alias NMTTDISPINFOW* LPNMTTDISPINFOW; -alias NMTTDISPINFOA TOOLTIPTEXTA; -alias LPNMTTDISPINFOA LPTOOLTIPTEXTA; -alias NMTTDISPINFOW TOOLTIPTEXTW; -alias LPNMTTDISPINFOW LPTOOLTIPTEXTW; +alias LPNMTTDISPINFOA = NMTTDISPINFOA*; +alias LPNMTTDISPINFOW = NMTTDISPINFOW*; +alias TOOLTIPTEXTA = NMTTDISPINFOA; +alias LPTOOLTIPTEXTA = LPNMTTDISPINFOA; +alias TOOLTIPTEXTW = NMTTDISPINFOW; +alias LPTOOLTIPTEXTW = LPNMTTDISPINFOW; struct UDACCEL { UINT nSec; UINT nInc; } -alias UDACCEL* LPUDACCEL; +alias LPUDACCEL = UDACCEL*; struct NMUPDOWN { NMHDR hdr; int iPos; int iDelta; } -alias NMUPDOWN* LPNMUPDOWN; +alias LPNMUPDOWN = NMUPDOWN*; deprecated { - alias NMUPDOWN NM_UPDOWN; - alias LPNMUPDOWN LPNM_UPDOWN; + alias NM_UPDOWN = NMUPDOWN; + alias LPNM_UPDOWN = LPNMUPDOWN; } static if (_WIN32_WINNT >= 0x501) { @@ -3684,10 +3684,10 @@ static if (_WIN32_WINNT >= 0x501) { LPARAM lParam; } } -alias LVITEMA* LPLVITEMA; -alias LVITEMW* LPLVITEMW; -alias LVITEMA LV_ITEMA; -alias LVITEMW LV_ITEMW; +alias LPLVITEMA = LVITEMA*; +alias LPLVITEMW = LVITEMW*; +alias LV_ITEMA = LVITEMA; +alias LV_ITEMW = LVITEMW; struct LVFINDINFOA { UINT flags; @@ -3705,10 +3705,10 @@ struct LVFINDINFOW { UINT vkDirection; } -alias LVFINDINFOA* LPFINDINFOA; -alias LVFINDINFOA LV_FINDINFOA; -alias LVFINDINFOW* LPFINDINFOW; -alias LVFINDINFOW LV_FINDINFOW; +alias LPFINDINFOA = LVFINDINFOA*; +alias LV_FINDINFOA = LVFINDINFOA; +alias LPFINDINFOW = LVFINDINFOW*; +alias LV_FINDINFOW = LVFINDINFOW; struct NMLVFINDITEMA { NMHDR hdr; @@ -3722,8 +3722,8 @@ struct NMLVFINDITEMW { LVFINDINFOW lvfi; } -alias NMLVFINDITEMA* PNMLVFINDITEMA, LPNMLVFINDITEMA; -alias NMLVFINDITEMW* PNMLVFINDITEMW, LPNMLVFINDITEMW; +alias PNMLVFINDITEMA = NMLVFINDITEMA*, LPNMLVFINDITEMA = NMLVFINDITEMA*; +alias PNMLVFINDITEMW = NMLVFINDITEMW*, LPNMLVFINDITEMW = NMLVFINDITEMW*; static if (_WIN32_IE >= 0x300) { struct LVHITTESTINFO { @@ -3739,8 +3739,8 @@ static if (_WIN32_IE >= 0x300) { int iItem; } } -alias LVHITTESTINFO* LPLVHITTESTINFO; -alias LVHITTESTINFO LV_HITTESTINFO; +alias LPLVHITTESTINFO = LVHITTESTINFO*; +alias LV_HITTESTINFO = LVHITTESTINFO; static if (_WIN32_IE >= 0x300) { struct LVCOLUMNA { @@ -3781,10 +3781,10 @@ static if (_WIN32_IE >= 0x300) { int iSubItem; } } -alias LVCOLUMNA* LPLVCOLUMNA; -alias LVCOLUMNW* LPLVCOLUMNW; -alias LVCOLUMNA LV_COLUMNA; -alias LVCOLUMNW LV_COLUMNW; +alias LPLVCOLUMNA = LVCOLUMNA*; +alias LPLVCOLUMNW = LVCOLUMNW*; +alias LV_COLUMNA = LVCOLUMNA; +alias LV_COLUMNW = LVCOLUMNW; static if (_WIN32_WINNT >= 0x501) { /* SG: The definitions in this static if block are from the MSDN docs. @@ -3818,7 +3818,7 @@ static if (_WIN32_WINNT >= 0x501) { UINT cchSubsetTitle; } } - alias LVGROUP* PLVGROUP; + alias PLVGROUP = LVGROUP*; struct LVGROUPMETRICS { UINT cbSize = LVGROUPMETRICS.sizeof; @@ -3834,7 +3834,7 @@ static if (_WIN32_WINNT >= 0x501) { COLORREF crHeader; COLORREF crFooter; } - alias LVGROUPMETRICS* PLVGROUPMETRICS; + alias PLVGROUPMETRICS = LVGROUPMETRICS*; struct LVINSERTMARK { UINT cbSize = LVINSERTMARK.sizeof; @@ -3842,8 +3842,8 @@ static if (_WIN32_WINNT >= 0x501) { int iItem; DWORD dwReserved; } - alias LVINSERTMARK* PLVINSERTMARK; - alias LVINSERTMARK* LPLVINSERTMARK; + alias PLVINSERTMARK = LVINSERTMARK*; + alias LPLVINSERTMARK = LVINSERTMARK*; struct LVTILEINFO { UINT cbSize = LVTILEINFO.sizeof; @@ -3854,7 +3854,7 @@ static if (_WIN32_WINNT >= 0x501) { int* piColFmt; } } - alias LVTILEINFO* PLVTILEINFO; + alias PLVTILEINFO = LVTILEINFO*; struct LVTILEVIEWINFO { UINT cbSize = LVTILEVIEWINFO.sizeof; @@ -3864,16 +3864,16 @@ static if (_WIN32_WINNT >= 0x501) { int cLines; RECT rcLabelMargin; } - alias LVTILEVIEWINFO* PLVTILEVIEWINFO; + alias PLVTILEVIEWINFO = LVTILEVIEWINFO*; struct LVINSERTGROUPSORTED { PFNLVGROUPCOMPARE pfnGroupCompare; LPVOID* pvData; LVGROUP lvGroup; } - alias LVINSERTGROUPSORTED* PLVINSERTGROUPSORTED; + alias PLVINSERTGROUPSORTED = LVINSERTGROUPSORTED*; - extern (Windows) alias int function(INT, INT, VOID*) PFNLVGROUPCOMPARE; + extern (Windows) alias PFNLVGROUPCOMPARE = int function(INT, INT, VOID*); struct LVSETINFOTIP { UINT cbSize = LVSETINFOTIP.sizeof; @@ -3883,14 +3883,14 @@ static if (_WIN32_WINNT >= 0x501) { int iSubItem; HBITMAP hbmp; } - alias LVSETINFOTIP* PLVSETINFOTIP; + alias PLVSETINFOTIP = LVSETINFOTIP*; struct BUTTON_IMAGELIST { HIMAGELIST himl; RECT margin; UINT uAlign; } - alias BUTTON_IMAGELIST* PBUTTON_IMAGELIST; + alias PBUTTON_IMAGELIST = BUTTON_IMAGELIST*; } static if (_WIN32_WINNT >= 0x600) { @@ -3899,7 +3899,7 @@ static if (_WIN32_WINNT >= 0x600) { int iItem; int iGroup; } - alias LVITEMINDEX* PLVITEMINDEX; + alias PLVITEMINDEX = LVITEMINDEX*; struct LVFOOTERINFO { @@ -3908,7 +3908,7 @@ static if (_WIN32_WINNT >= 0x600) { int cchTextMax; UINT cItems; } - alias LVFOOTERINFO* LPLVFOOTERINFO; + alias LPLVFOOTERINFO = LVFOOTERINFO*; struct LVFOOTERITEM { @@ -3919,15 +3919,15 @@ static if (_WIN32_WINNT >= 0x600) { UINT state; UINT stateMask; } - alias LVFOOTERITEM *LPLVFOOTERITEM; + alias LPLVFOOTERITEM = LVFOOTERITEM *; - alias UINT TVITEMPART; + alias TVITEMPART = UINT; enum { TVGIPR_BUTTON = 0x0001, } } -extern (Windows) alias int function(LPARAM, LPARAM, LPARAM) PFNLVCOMPARE; +extern (Windows) alias PFNLVCOMPARE = int function(LPARAM, LPARAM, LPARAM); struct NMLISTVIEW { NMHDR hdr; @@ -3939,26 +3939,26 @@ struct NMLISTVIEW { POINT ptAction; LPARAM lParam; } -alias NMLISTVIEW* LPNMLISTVIEW; +alias LPNMLISTVIEW = NMLISTVIEW*; deprecated { - alias NMLISTVIEW NM_LISTVIEW; - alias LPNMLISTVIEW LPNM_LISTVIEW; + alias NM_LISTVIEW = NMLISTVIEW; + alias LPNM_LISTVIEW = LPNMLISTVIEW; } struct NMLVDISPINFOA { NMHDR hdr; LV_ITEMA item; } -alias NMLVDISPINFOA* LPNMLVDISPINFOA; -alias NMLVDISPINFOA LV_DISPINFOA; +alias LPNMLVDISPINFOA = NMLVDISPINFOA*; +alias LV_DISPINFOA = NMLVDISPINFOA; struct NMLVDISPINFOW { NMHDR hdr; LV_ITEMW item; } -alias NMLVDISPINFOW* LPNMLVDISPINFOW; -alias NMLVDISPINFOW LV_DISPINFOW; +alias LPNMLVDISPINFOW = NMLVDISPINFOW*; +alias LV_DISPINFOW = NMLVDISPINFOW; align (1) struct LV_KEYDOWN { @@ -3973,8 +3973,8 @@ struct NMLVCACHEHINT { int iFrom; int iTo; } -alias NMLVCACHEHINT* LPNMLVCACHEHINT, PNM_CACHEHINT, LPNM_CACHEHINT; -alias NMLVCACHEHINT NM_CACHEHINT; +alias LPNMLVCACHEHINT = NMLVCACHEHINT*, PNM_CACHEHINT = NMLVCACHEHINT*, LPNM_CACHEHINT = NMLVCACHEHINT*; +alias NM_CACHEHINT = NMLVCACHEHINT; struct TVITEMA { UINT mask; @@ -3988,8 +3988,8 @@ struct TVITEMA { int cChildren; LPARAM lParam; } -alias TVITEMA* LPTVITEMA, LPTV_ITEMA; -alias TVITEMA TV_ITEMA; +alias LPTVITEMA = TVITEMA*, LPTV_ITEMA = TVITEMA*; +alias TV_ITEMA = TVITEMA; struct TVITEMW { UINT mask; @@ -4003,8 +4003,8 @@ struct TVITEMW { int cChildren; LPARAM lParam; } -alias TVITEMW* LPTVITEMW, LPTV_ITEMW; -alias TVITEMW TV_ITEMW; +alias LPTVITEMW = TVITEMW*, LPTV_ITEMW = TVITEMW*; +alias TV_ITEMW = TVITEMW; static if (_WIN32_IE >= 0x400) { struct TVITEMEXA { @@ -4020,7 +4020,7 @@ static if (_WIN32_IE >= 0x400) { LPARAM lParam; int iIntegral; } - alias TVITEMEXA* LPTVITEMEXA; + alias LPTVITEMEXA = TVITEMEXA*; struct TVITEMEXW { UINT mask; @@ -4035,7 +4035,7 @@ static if (_WIN32_IE >= 0x400) { LPARAM lParam; int iIntegral; } - alias TVITEMEXW* LPTVITEMEXW; + alias LPTVITEMEXW = TVITEMEXW*; } static if (_WIN32_IE >= 0x400) { @@ -4069,18 +4069,18 @@ static if (_WIN32_IE >= 0x400) { TV_ITEMW item; } } -alias TVINSERTSTRUCTA* LPTVINSERTSTRUCTA, LPTV_INSERTSTRUCTA; -alias TVINSERTSTRUCTA TV_INSERTSTRUCTA; -alias TVINSERTSTRUCTW* LPTVINSERTSTRUCTW, LPTV_INSERTSTRUCTW; -alias TVINSERTSTRUCTW TV_INSERTSTRUCTW; +alias LPTVINSERTSTRUCTA = TVINSERTSTRUCTA*, LPTV_INSERTSTRUCTA = TVINSERTSTRUCTA*; +alias TV_INSERTSTRUCTA = TVINSERTSTRUCTA; +alias LPTVINSERTSTRUCTW = TVINSERTSTRUCTW*, LPTV_INSERTSTRUCTW = TVINSERTSTRUCTW*; +alias TV_INSERTSTRUCTW = TVINSERTSTRUCTW; struct TVHITTESTINFO { POINT pt; UINT flags; HTREEITEM hItem; } -alias TVHITTESTINFO* LPTVHITTESTINFO, LPTV_HITTESTINFO; -alias TVHITTESTINFO TV_HITTESTINFO; +alias LPTVHITTESTINFO = TVHITTESTINFO*, LPTV_HITTESTINFO = TVHITTESTINFO*; +alias TV_HITTESTINFO = TVHITTESTINFO; static if (_WIN32_WINNT >= 0x600) { struct TVGETITEMPARTRECTINFO { @@ -4090,14 +4090,14 @@ static if (_WIN32_WINNT >= 0x600) { } } -extern (Windows) alias int function(LPARAM, LPARAM, LPARAM) PFNTVCOMPARE; +extern (Windows) alias PFNTVCOMPARE = int function(LPARAM, LPARAM, LPARAM); struct TVSORTCB { HTREEITEM hParent; PFNTVCOMPARE lpfnCompare; LPARAM lParam; } -alias TVSORTCB* LPTVSORTCB, LPTV_SORTCB; -alias TVSORTCB TV_SORTCB; +alias LPTVSORTCB = TVSORTCB*, LPTV_SORTCB = TVSORTCB*; +alias TV_SORTCB = TVSORTCB; struct NMTREEVIEWA { NMHDR hdr; @@ -4106,8 +4106,8 @@ struct NMTREEVIEWA { TV_ITEMA itemNew; POINT ptDrag; } -alias NMTREEVIEWA* LPNMTREEVIEWA, LPNM_TREEVIEWA; -alias NMTREEVIEWA NM_TREEVIEWA; +alias LPNMTREEVIEWA = NMTREEVIEWA*, LPNM_TREEVIEWA = NMTREEVIEWA*; +alias NM_TREEVIEWA = NMTREEVIEWA; struct NMTREEVIEWW { NMHDR hdr; @@ -4116,22 +4116,22 @@ struct NMTREEVIEWW { TV_ITEMW itemNew; POINT ptDrag; } -alias NMTREEVIEWW* LPNMTREEVIEWW, LPNM_TREEVIEWW; -alias NMTREEVIEWW NM_TREEVIEWW; +alias LPNMTREEVIEWW = NMTREEVIEWW*, LPNM_TREEVIEWW = NMTREEVIEWW*; +alias NM_TREEVIEWW = NMTREEVIEWW; struct NMTVDISPINFOA { NMHDR hdr; TVITEMA item; } -alias NMTVDISPINFOA* LPNMTVDISPINFOA; -alias NMTVDISPINFOA TV_DISPINFOA; +alias LPNMTVDISPINFOA = NMTVDISPINFOA*; +alias TV_DISPINFOA = NMTVDISPINFOA; struct NMTVDISPINFOW { NMHDR hdr; TVITEMW item; } -alias NMTVDISPINFOW* LPNMTVDISPINFOW; -alias NMTVDISPINFOW TV_DISPINFOW; +alias LPNMTVDISPINFOW = NMTVDISPINFOW*; +alias TV_DISPINFOW = NMTVDISPINFOW; static if (_WIN32_IE >= 0x400) { struct NMTVGETINFOTIPA { @@ -4141,7 +4141,7 @@ static if (_WIN32_IE >= 0x400) { HTREEITEM hItem; LPARAM lParam; } - alias NMTVGETINFOTIPA* LPNMTVGETINFOTIPA; + alias LPNMTVGETINFOTIPA = NMTVGETINFOTIPA*; struct NMTVGETINFOTIPW { NMHDR hdr; @@ -4150,7 +4150,7 @@ static if (_WIN32_IE >= 0x400) { HTREEITEM hItem; LPARAM lParam; } - alias NMTVGETINFOTIPW* LPNMTVGETINFOTIPW; + alias LPNMTVGETINFOTIPW = NMTVGETINFOTIPW*; } align (1) @@ -4220,17 +4220,17 @@ static if (_WIN32_IE >= 0x300) { LPARAM lParam; } } -alias TCITEMA* LPTCITEMA; -alias TCITEMA TC_ITEMA; -alias TCITEMW* LPTCITEMW; -alias TCITEMW TC_ITEMW; +alias LPTCITEMA = TCITEMA*; +alias TC_ITEMA = TCITEMA; +alias LPTCITEMW = TCITEMW*; +alias TC_ITEMW = TCITEMW; struct TCHITTESTINFO { POINT pt; UINT flags; } -alias TCHITTESTINFO* LPTCHITTESTINFO, LPTC_HITTESTINFO; -alias TCHITTESTINFO TC_HITTESTINFO; +alias LPTCHITTESTINFO = TCHITTESTINFO*, LPTC_HITTESTINFO = TCHITTESTINFO*; +alias TC_HITTESTINFO = TCHITTESTINFO; align (1) struct TC_KEYDOWN { @@ -4245,21 +4245,21 @@ static if (_WIN32_IE >= 0x300) { DWORD dwSize = INITCOMMONCONTROLSEX.sizeof; DWORD dwICC; } - alias INITCOMMONCONTROLSEX* LPINITCOMMONCONTROLSEX; + alias LPINITCOMMONCONTROLSEX = INITCOMMONCONTROLSEX*; } struct PBRANGE { int iLow; int iHigh; } -alias PBRANGE* PPBRANGE; +alias PPBRANGE = PBRANGE*; struct COLORSCHEME { DWORD dwSize = COLORSCHEME.sizeof; COLORREF clrBtnHighlight; COLORREF clrBtnShadow; } -alias COLORSCHEME* LPCOLORSCHEME; +alias LPCOLORSCHEME = COLORSCHEME*; struct MCHITTESTINFO { UINT cbSize = MCHITTESTINFO.sizeof; @@ -4267,10 +4267,10 @@ struct MCHITTESTINFO { UINT uHit; SYSTEMTIME st; } -alias MCHITTESTINFO* PMCHITTESTINFO; +alias PMCHITTESTINFO = MCHITTESTINFO*; -alias DWORD MONTHDAYSTATE; -alias MONTHDAYSTATE* LPMONTHDAYSTATE; +alias MONTHDAYSTATE = DWORD; +alias LPMONTHDAYSTATE = MONTHDAYSTATE*; struct NMDAYSTATE { NMHDR nmhdr; @@ -4278,14 +4278,14 @@ struct NMDAYSTATE { int cDayState; LPMONTHDAYSTATE prgDayState; } -alias NMDAYSTATE* LPNMDAYSTATE; +alias LPNMDAYSTATE = NMDAYSTATE*; struct REBARINFO { UINT cbSize = REBARINFO.sizeof; UINT fMask; HIMAGELIST himl; } -alias REBARINFO* LPREBARINFO; +alias LPREBARINFO = REBARINFO*; static if (_WIN32_IE >= 0x400) { struct REBARBANDINFOA { @@ -4378,10 +4378,10 @@ static if (_WIN32_IE >= 0x400) { REBARBANDINFOW_V3_SIZE = REBARBANDINFOW.sizeof } } -alias REBARBANDINFOA* LPREBARBANDINFOA; -alias const(REBARBANDINFOA)* LPCREBARBANDINFOA; -alias REBARBANDINFOW* LPREBARBANDINFOW; -alias const(REBARBANDINFOW)* LPCREBARBANDINFOW; +alias LPREBARBANDINFOA = REBARBANDINFOA*; +alias LPCREBARBANDINFOA = const(REBARBANDINFOA)*; +alias LPREBARBANDINFOW = REBARBANDINFOW*; +alias LPCREBARBANDINFOW = const(REBARBANDINFOW)*; static if (_WIN32_IE >= 0x300) { struct NMLVODSTATECHANGE { @@ -4391,7 +4391,7 @@ static if (_WIN32_IE >= 0x300) { UINT uNewState; UINT uOldState; } - alias NMLVODSTATECHANGE* LPNMLVODSTATECHANGE; + alias LPNMLVODSTATECHANGE = NMLVODSTATECHANGE*; static if (_WIN32_WINNT >= 0x501) { struct IMAGELISTDRAWPARAMS { @@ -4431,7 +4431,7 @@ static if (_WIN32_IE >= 0x300) { DWORD dwRop; } } - alias IMAGELISTDRAWPARAMS* LPIMAGELISTDRAWPARAMS; + alias LPIMAGELISTDRAWPARAMS = IMAGELISTDRAWPARAMS*; } static if (_WIN32_IE >= 0x400) { @@ -4442,7 +4442,7 @@ static if (_WIN32_IE >= 0x400) { RECT rcChild; RECT rcBand; } - alias NMREBARCHILDSIZE* LPNMREBARCHILDSIZE; + alias LPNMREBARCHILDSIZE = NMREBARCHILDSIZE*; struct NMREBAR { NMHDR hdr; @@ -4452,7 +4452,7 @@ static if (_WIN32_IE >= 0x400) { UINT wID; LPARAM lParam; } - alias NMREBAR* LPNMREBAR; + alias LPNMREBAR = NMREBAR*; struct NMRBAUTOSIZE { NMHDR hdr; @@ -4460,7 +4460,7 @@ static if (_WIN32_IE >= 0x400) { RECT rcTarget; RECT rcActual; } - alias NMRBAUTOSIZE* LPNMRBAUTOSIZE; + alias LPNMRBAUTOSIZE = NMRBAUTOSIZE*; static if (_WIN32_IE >= 0x500) { struct NMREBARCHEVRON { @@ -4471,7 +4471,7 @@ static if (_WIN32_IE >= 0x400) { RECT rc; LPARAM lParamNM; } - alias NMREBARCHEVRON* LPNMREBARCHEVRON; + alias LPNMREBARCHEVRON = NMREBARCHEVRON*; } struct RBHITTESTINFO { @@ -4479,440 +4479,439 @@ static if (_WIN32_IE >= 0x400) { UINT flags; int iBand; } - alias RBHITTESTINFO* LPRBHITTESTINFO; + alias LPRBHITTESTINFO = RBHITTESTINFO*; } alias HDSA = HANDLE; alias HDPA = HANDLE; version (Unicode) { - alias HDITEMW HDITEM; - alias LPHDITEMW LPHDITEM; - alias TOOLINFOW TOOLINFO; - alias TOOLINFOW* PTOOLINFO, LPTOOLINFO; - alias TTHITTESTINFOW TTHITTESTINFO; - alias TTHITTESTINFOW* LPHITTESTINFO, LPTTHITTESTINFO; - alias TOOLTIPTEXTW TOOLTIPTEXT; - alias TOOLTIPTEXTW* LPTOOLTIPTEXT; - alias NMTTDISPINFOW NMTTDISPINFO; - alias NMTTDISPINFOW* LPNMTTDISPINFO; - alias TV_ITEMW TV_ITEM; - alias TV_ITEMW* LPTV_ITEM; - alias TVITEMW TVITEM; - alias TVITEMW* LPTVITEM; + alias HDITEM = HDITEMW; + alias LPHDITEM = LPHDITEMW; + alias TOOLINFO = TOOLINFOW; + alias PTOOLINFO = TOOLINFOW*, LPTOOLINFO = TOOLINFOW*; + alias TTHITTESTINFO = TTHITTESTINFOW; + alias LPHITTESTINFO = TTHITTESTINFOW*, LPTTHITTESTINFO = TTHITTESTINFOW*; + alias TOOLTIPTEXT = TOOLTIPTEXTW; + alias LPTOOLTIPTEXT = TOOLTIPTEXTW*; + alias NMTTDISPINFO = NMTTDISPINFOW; + alias LPNMTTDISPINFO = NMTTDISPINFOW*; + alias TV_ITEM = TV_ITEMW; + alias LPTV_ITEM = TV_ITEMW*; + alias TVITEM = TVITEMW; + alias LPTVITEM = TVITEMW*; static if (_WIN32_IE >= 0x400) { - alias TVITEMEXW TVITEMEX; - alias TVITEMEXW* LPTVITEMEX; - } - - alias TV_INSERTSTRUCTW TV_INSERTSTRUCT; - alias TV_INSERTSTRUCTW* LPTV_INSERTSTRUCT; - alias TVINSERTSTRUCTW TVINSERTSTRUCT; - alias TVINSERTSTRUCTW* LPTVINSERTSTRUCT; - alias NM_TREEVIEWW NM_TREEVIEW; - alias NM_TREEVIEWW* LPNM_TREEVIEW; - alias NMTREEVIEWW NMTREEVIEW; - alias NMTREEVIEWW* LPNMTREEVIEW; - alias NMHDDISPINFOW NMHDDISPINFO; - alias NMHDDISPINFOW* LPNMHDDISPINFO; - - alias ACM_OPENW ACM_OPEN; - alias COMBOBOXEXITEMW COMBOBOXEXITEM; - alias PCOMBOBOXEXITEMW PCOMBOBOXEXITEM; + alias TVITEMEX = TVITEMEXW; + alias LPTVITEMEX = TVITEMEXW*; + } + + alias TV_INSERTSTRUCT = TV_INSERTSTRUCTW; + alias LPTV_INSERTSTRUCT = TV_INSERTSTRUCTW*; + alias TVINSERTSTRUCT = TVINSERTSTRUCTW; + alias LPTVINSERTSTRUCT = TVINSERTSTRUCTW*; + alias NM_TREEVIEW = NM_TREEVIEWW; + alias LPNM_TREEVIEW = NM_TREEVIEWW*; + alias NMTREEVIEW = NMTREEVIEWW; + alias LPNMTREEVIEW = NMTREEVIEWW*; + alias NMHDDISPINFO = NMHDDISPINFOW; + alias LPNMHDDISPINFO = NMHDDISPINFOW*; + + alias ACM_OPEN = ACM_OPENW; + alias COMBOBOXEXITEM = COMBOBOXEXITEMW; + alias PCOMBOBOXEXITEM = PCOMBOBOXEXITEMW; //alias PCCOMBOBOXEXITEMW PCCOMBOBOXEXITEM; fixme - alias CBEM_INSERTITEMW CBEM_INSERTITEM; - alias CBEM_SETITEMW CBEM_SETITEM; - alias CBEM_GETITEMW CBEM_GETITEM; - alias CBEN_ENDEDITW CBEN_ENDEDIT; - alias NMCBEENDEDITW NMCBEENDEDIT; - alias LPNMCBEENDEDITW LPNMCBEENDEDIT; - alias PNMCBEENDEDITW PNMCBEENDEDIT; + alias CBEM_INSERTITEM = CBEM_INSERTITEMW; + alias CBEM_SETITEM = CBEM_SETITEMW; + alias CBEM_GETITEM = CBEM_GETITEMW; + alias CBEN_ENDEDIT = CBEN_ENDEDITW; + alias NMCBEENDEDIT = NMCBEENDEDITW; + alias LPNMCBEENDEDIT = LPNMCBEENDEDITW; + alias PNMCBEENDEDIT = PNMCBEENDEDITW; static if (_WIN32_IE >= 0x400) { - alias NMCOMBOBOXEXW NMCOMBOBOXEX; - alias PNMCOMBOBOXEXW PNMCOMBOBOXEX; - alias CBEN_GETDISPINFOW CBEN_GETDISPINFO; - alias CBEN_DRAGBEGINW CBEN_DRAGBEGIN; - alias NMCBEDRAGBEGINW NMCBEDRAGBEGIN; - alias LPNMCBEDRAGBEGINW LPNMCBEDRAGBEGIN; - alias PNMCBEDRAGBEGINW PNMCBEDRAGBEGIN; - } - - alias SB_GETTEXTW SB_GETTEXT; - alias SB_SETTEXTW SB_SETTEXT; - alias SB_GETTEXTLENGTHW SB_GETTEXTLENGTH; - alias HDM_INSERTITEMW HDM_INSERTITEM; - alias HDM_GETITEMW HDM_GETITEM; - alias HDM_SETITEMW HDM_SETITEM; - alias HDN_ITEMCHANGINGW HDN_ITEMCHANGING; - alias HDN_ITEMCHANGEDW HDN_ITEMCHANGED; - alias HDN_ITEMCLICKW HDN_ITEMCLICK; - alias HDN_ITEMDBLCLICKW HDN_ITEMDBLCLICK; - alias HDN_DIVIDERDBLCLICKW HDN_DIVIDERDBLCLICK; - alias HDN_BEGINTRACKW HDN_BEGINTRACK; - alias HDN_ENDTRACKW HDN_ENDTRACK; - alias HDN_TRACKW HDN_TRACK; + alias NMCOMBOBOXEX = NMCOMBOBOXEXW; + alias PNMCOMBOBOXEX = PNMCOMBOBOXEXW; + alias CBEN_GETDISPINFO = CBEN_GETDISPINFOW; + alias CBEN_DRAGBEGIN = CBEN_DRAGBEGINW; + alias NMCBEDRAGBEGIN = NMCBEDRAGBEGINW; + alias LPNMCBEDRAGBEGIN = LPNMCBEDRAGBEGINW; + alias PNMCBEDRAGBEGIN = PNMCBEDRAGBEGINW; + } + + alias SB_GETTEXT = SB_GETTEXTW; + alias SB_SETTEXT = SB_SETTEXTW; + alias SB_GETTEXTLENGTH = SB_GETTEXTLENGTHW; + alias HDM_INSERTITEM = HDM_INSERTITEMW; + alias HDM_GETITEM = HDM_GETITEMW; + alias HDM_SETITEM = HDM_SETITEMW; + alias HDN_ITEMCHANGING = HDN_ITEMCHANGINGW; + alias HDN_ITEMCHANGED = HDN_ITEMCHANGEDW; + alias HDN_ITEMCLICK = HDN_ITEMCLICKW; + alias HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKW; + alias HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKW; + alias HDN_BEGINTRACK = HDN_BEGINTRACKW; + alias HDN_ENDTRACK = HDN_ENDTRACKW; + alias HDN_TRACK = HDN_TRACKW; static if (_WIN32_IE >= 0x300) { - alias HDN_GETDISPINFOW HDN_GETDISPINFO; + alias HDN_GETDISPINFO = HDN_GETDISPINFOW; } - alias HD_NOTIFYW HD_NOTIFY; - alias TBSAVEPARAMSW TBSAVEPARAMS; - alias TB_GETBUTTONTEXTW TB_GETBUTTONTEXT; - alias TB_SAVERESTOREW TB_SAVERESTORE; - alias TB_ADDSTRINGW TB_ADDSTRING; + alias HD_NOTIFY = HD_NOTIFYW; + alias TBSAVEPARAMS = TBSAVEPARAMSW; + alias TB_GETBUTTONTEXT = TB_GETBUTTONTEXTW; + alias TB_SAVERESTORE = TB_SAVERESTOREW; + alias TB_ADDSTRING = TB_ADDSTRINGW; static if (_WIN32_IE >= 0x400) { - alias TBN_GETBUTTONINFOW TBN_GETBUTTONINFO; // fixme - alias TB_GETBUTTONINFOW TB_GETBUTTONINFO; - alias TB_SETBUTTONINFOW TB_SETBUTTONINFO; - alias TB_INSERTBUTTONW TB_INSERTBUTTON; - alias TB_ADDBUTTONSW TB_ADDBUTTONS; - alias TB_MAPACCELERATORW TB_MAPACCELERATOR; - alias TB_GETSTRINGW TB_GETSTRING; - alias TBBUTTONINFOW TBBUTTONINFO; - alias LPTBBUTTONINFOW LPTBBUTTONINFO; - alias TBN_GETDISPINFOW TBN_GETDISPINFO; - alias NMTBDISPINFOW NMTBDISPINFO; - alias LPNMTBDISPINFOW LPNMTBDISPINFO; - alias NMTBGETINFOTIPW NMTBGETINFOTIP; - alias LPNMTBGETINFOTIPW LPNMTBGETINFOTIP; - } - - alias TBNOTIFYW TBNOTIFY; - alias LPTBNOTIFYW LPTBNOTIFY; - alias NMTOOLBARW NMTOOLBAR; - alias LPNMTOOLBARW LPNMTOOLBAR; - alias TTM_ADDTOOLW TTM_ADDTOOL; - alias TTM_DELTOOLW TTM_DELTOOL; - alias TTM_NEWTOOLRECTW TTM_NEWTOOLRECT; - alias TTM_GETTOOLINFOW TTM_GETTOOLINFO; - alias TTM_SETTOOLINFOW TTM_SETTOOLINFO; - alias TTM_HITTESTW TTM_HITTEST; - alias TTM_GETTEXTW TTM_GETTEXT; - alias TTM_UPDATETIPTEXTW TTM_UPDATETIPTEXT; - alias TTM_ENUMTOOLSW TTM_ENUMTOOLS; - alias TTM_GETCURRENTTOOLW TTM_GETCURRENTTOOL; - alias TTN_NEEDTEXTW TTN_NEEDTEXT; - alias TTN_GETDISPINFOW TTN_GETDISPINFO; + alias TBN_GETBUTTONINFO = TBN_GETBUTTONINFOW; // fixme + alias TB_GETBUTTONINFO = TB_GETBUTTONINFOW; + alias TB_SETBUTTONINFO = TB_SETBUTTONINFOW; + alias TB_INSERTBUTTON = TB_INSERTBUTTONW; + alias TB_ADDBUTTONS = TB_ADDBUTTONSW; + alias TB_MAPACCELERATOR = TB_MAPACCELERATORW; + alias TB_GETSTRING = TB_GETSTRINGW; + alias TBBUTTONINFO = TBBUTTONINFOW; + alias LPTBBUTTONINFO = LPTBBUTTONINFOW; + alias TBN_GETDISPINFO = TBN_GETDISPINFOW; + alias NMTBDISPINFO = NMTBDISPINFOW; + alias LPNMTBDISPINFO = LPNMTBDISPINFOW; + alias NMTBGETINFOTIP = NMTBGETINFOTIPW; + alias LPNMTBGETINFOTIP = LPNMTBGETINFOTIPW; + } + + alias TBNOTIFY = TBNOTIFYW; + alias LPTBNOTIFY = LPTBNOTIFYW; + alias NMTOOLBAR = NMTOOLBARW; + alias LPNMTOOLBAR = LPNMTOOLBARW; + alias TTM_ADDTOOL = TTM_ADDTOOLW; + alias TTM_DELTOOL = TTM_DELTOOLW; + alias TTM_NEWTOOLRECT = TTM_NEWTOOLRECTW; + alias TTM_GETTOOLINFO = TTM_GETTOOLINFOW; + alias TTM_SETTOOLINFO = TTM_SETTOOLINFOW; + alias TTM_HITTEST = TTM_HITTESTW; + alias TTM_GETTEXT = TTM_GETTEXTW; + alias TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTW; + alias TTM_ENUMTOOLS = TTM_ENUMTOOLSW; + alias TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLW; + alias TTN_NEEDTEXT = TTN_NEEDTEXTW; + alias TTN_GETDISPINFO = TTN_GETDISPINFOW; //alias SB_GETTEXTW SB_GETTEXT; //alias SB_SETTEXTW SB_SETTEXT; //alias SB_GETTEXTLENGTHW SB_GETTEXTLENGTH; - alias LV_ITEMW LV_ITEM; - alias LVITEMW LVITEM; - alias LVITEM* LPLVITEM; - alias LPSTR_TEXTCALLBACKW LPSTR_TEXTCALLBACK; + alias LV_ITEM = LV_ITEMW; + alias LVITEM = LVITEMW; + alias LPLVITEM = LVITEM*; + alias LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKW; static if (_WIN32_IE >= 0x400) { - alias LVBKIMAGEW LVBKIMAGE; - alias LPLVBKIMAGEW LPLVBKIMAGE; - alias LVM_SETBKIMAGEW LVM_SETBKIMAGE; - alias LVM_GETBKIMAGEW LVM_GETBKIMAGE; - } - - alias LVM_GETITEMW LVM_GETITEM; - alias LVM_SETITEMW LVM_SETITEM; - alias LVM_INSERTITEMW LVM_INSERTITEM; - alias LV_FINDINFOW LV_FINDINFO; - alias LVFINDINFOW LVFINDINFO; - alias LPFINDINFOW LPFINDINFO; - alias NMLVFINDITEMW NMLVFINDITEM; - alias PNMLVFINDITEMW PNMLVFINDITEM; - alias LPNMLVFINDITEMW LPNMLVFINDITEM; - alias LVM_FINDITEMW LVM_FINDITEM; - alias LVM_GETSTRINGWIDTHW LVM_GETSTRINGWIDTH; - alias LVM_EDITLABELW LVM_EDITLABEL; - alias LV_COLUMNW LV_COLUMN; - alias LVCOLUMNW LVCOLUMN; - alias LVCOLUMNW* LPLVCOLUMN; - alias LVM_GETCOLUMNW LVM_GETCOLUMN; - alias LVM_SETCOLUMNW LVM_SETCOLUMN; - alias LVM_INSERTCOLUMNW LVM_INSERTCOLUMN; - alias LVM_GETITEMTEXTW LVM_GETITEMTEXT; - alias LVM_SETITEMTEXTW LVM_SETITEMTEXT; - alias LVM_GETISEARCHSTRINGW LVM_GETISEARCHSTRING; - alias LVN_BEGINLABELEDITW LVN_BEGINLABELEDIT; - alias LVN_ENDLABELEDITW LVN_ENDLABELEDIT; - alias LVN_GETDISPINFOW LVN_GETDISPINFO; - alias LVN_SETDISPINFOW LVN_SETDISPINFO; + alias LVBKIMAGE = LVBKIMAGEW; + alias LPLVBKIMAGE = LPLVBKIMAGEW; + alias LVM_SETBKIMAGE = LVM_SETBKIMAGEW; + alias LVM_GETBKIMAGE = LVM_GETBKIMAGEW; + } + + alias LVM_GETITEM = LVM_GETITEMW; + alias LVM_SETITEM = LVM_SETITEMW; + alias LVM_INSERTITEM = LVM_INSERTITEMW; + alias LV_FINDINFO = LV_FINDINFOW; + alias LVFINDINFO = LVFINDINFOW; + alias LPFINDINFO = LPFINDINFOW; + alias NMLVFINDITEM = NMLVFINDITEMW; + alias PNMLVFINDITEM = PNMLVFINDITEMW; + alias LPNMLVFINDITEM = LPNMLVFINDITEMW; + alias LVM_FINDITEM = LVM_FINDITEMW; + alias LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHW; + alias LVM_EDITLABEL = LVM_EDITLABELW; + alias LV_COLUMN = LV_COLUMNW; + alias LVCOLUMN = LVCOLUMNW; + alias LPLVCOLUMN = LVCOLUMNW*; + alias LVM_GETCOLUMN = LVM_GETCOLUMNW; + alias LVM_SETCOLUMN = LVM_SETCOLUMNW; + alias LVM_INSERTCOLUMN = LVM_INSERTCOLUMNW; + alias LVM_GETITEMTEXT = LVM_GETITEMTEXTW; + alias LVM_SETITEMTEXT = LVM_SETITEMTEXTW; + alias LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGW; + alias LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITW; + alias LVN_ENDLABELEDIT = LVN_ENDLABELEDITW; + alias LVN_GETDISPINFO = LVN_GETDISPINFOW; + alias LVN_SETDISPINFO = LVN_SETDISPINFOW; static if (_WIN32_IE >= 0x400) { - alias LVN_GETINFOTIPW LVN_GETINFOTIP; - alias NMLVGETINFOTIPW NMLVGETINFOTIP; - alias LPNMLVGETINFOTIPW LPNMLVGETINFOTIP; - } - - alias LV_DISPINFOW LV_DISPINFO; - alias NMLVDISPINFOW NMLVDISPINFO; - alias LPNMLVDISPINFOW LPNMLVDISPINFO; - alias TVM_INSERTITEMW TVM_INSERTITEM; - alias TVM_GETITEMW TVM_GETITEM; - alias TVM_SETITEMW TVM_SETITEM; - alias TVM_EDITLABELW TVM_EDITLABEL; - alias TVM_GETISEARCHSTRINGW TVM_GETISEARCHSTRING; - alias NMTVDISPINFOW TV_DISPINFO; - alias NMTVDISPINFOW NMTVDISPINFO; - alias LPNMTVDISPINFOW LPNMTVDISPINFO; + alias LVN_GETINFOTIP = LVN_GETINFOTIPW; + alias NMLVGETINFOTIP = NMLVGETINFOTIPW; + alias LPNMLVGETINFOTIP = LPNMLVGETINFOTIPW; + } + + alias LV_DISPINFO = LV_DISPINFOW; + alias NMLVDISPINFO = NMLVDISPINFOW; + alias LPNMLVDISPINFO = LPNMLVDISPINFOW; + alias TVM_INSERTITEM = TVM_INSERTITEMW; + alias TVM_GETITEM = TVM_GETITEMW; + alias TVM_SETITEM = TVM_SETITEMW; + alias TVM_EDITLABEL = TVM_EDITLABELW; + alias TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGW; + alias TV_DISPINFO = NMTVDISPINFOW; + alias NMTVDISPINFO = NMTVDISPINFOW; + alias LPNMTVDISPINFO = LPNMTVDISPINFOW; static if (_WIN32_IE >= 0x400) { - alias NMTVGETINFOTIPW NMTVGETINFOTIP; - alias LPNMTVGETINFOTIPW LPNMTVGETINFOTIP; - alias TVN_GETINFOTIPW TVN_GETINFOTIP; - } - - alias TVN_SELCHANGINGW TVN_SELCHANGING; - alias TVN_SELCHANGEDW TVN_SELCHANGED; - alias TVN_GETDISPINFOW TVN_GETDISPINFO; - alias TVN_SETDISPINFOW TVN_SETDISPINFO; - alias TVN_ITEMEXPANDINGW TVN_ITEMEXPANDING; - alias TVN_ITEMEXPANDEDW TVN_ITEMEXPANDED; - alias TVN_BEGINDRAGW TVN_BEGINDRAG; - alias TVN_BEGINRDRAGW TVN_BEGINRDRAG; - alias TVN_DELETEITEMW TVN_DELETEITEM; - alias TVN_BEGINLABELEDITW TVN_BEGINLABELEDIT; - alias TVN_ENDLABELEDITW TVN_ENDLABELEDIT; - alias TC_ITEMHEADERW TC_ITEMHEADER; - alias TC_ITEMW TC_ITEM; - alias TCITEMW TCITEM; - alias LPTCITEMW LPTCITEM; - alias TCM_GETITEMW TCM_GETITEM; - alias TCM_SETITEMW TCM_SETITEM; - alias TCM_INSERTITEMW TCM_INSERTITEM; - alias CreateStatusWindowW CreateStatusWindow; - alias DrawStatusTextW DrawStatusText; - alias ImageList_LoadImageW ImageList_LoadImage; - alias DTM_SETFORMATW DTM_SETFORMAT; - alias DTN_USERSTRINGW DTN_USERSTRING; - alias DTN_WMKEYDOWNW DTN_WMKEYDOWN; - alias DTN_FORMATW DTN_FORMAT; - alias DTN_FORMATQUERYW DTN_FORMATQUERY; - alias REBARBANDINFOW REBARBANDINFO; - alias REBARBANDINFO* LPREBARBANDINFO; - alias LPCREBARBANDINFOW LPCREBARBANDINFO; - alias REBARBANDINFOW_V3_SIZE REBARBANDINFO_V3_SIZE; - alias RB_INSERTBANDW RB_INSERTBAND; - alias RB_SETBANDINFOW RB_SETBANDINFO; + alias NMTVGETINFOTIP = NMTVGETINFOTIPW; + alias LPNMTVGETINFOTIP = LPNMTVGETINFOTIPW; + alias TVN_GETINFOTIP = TVN_GETINFOTIPW; + } + + alias TVN_SELCHANGING = TVN_SELCHANGINGW; + alias TVN_SELCHANGED = TVN_SELCHANGEDW; + alias TVN_GETDISPINFO = TVN_GETDISPINFOW; + alias TVN_SETDISPINFO = TVN_SETDISPINFOW; + alias TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGW; + alias TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDW; + alias TVN_BEGINDRAG = TVN_BEGINDRAGW; + alias TVN_BEGINRDRAG = TVN_BEGINRDRAGW; + alias TVN_DELETEITEM = TVN_DELETEITEMW; + alias TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITW; + alias TVN_ENDLABELEDIT = TVN_ENDLABELEDITW; + alias TC_ITEMHEADER = TC_ITEMHEADERW; + alias TC_ITEM = TC_ITEMW; + alias TCITEM = TCITEMW; + alias LPTCITEM = LPTCITEMW; + alias TCM_GETITEM = TCM_GETITEMW; + alias TCM_SETITEM = TCM_SETITEMW; + alias TCM_INSERTITEM = TCM_INSERTITEMW; + alias CreateStatusWindow = CreateStatusWindowW; + alias DrawStatusText = DrawStatusTextW; + alias ImageList_LoadImage = ImageList_LoadImageW; + alias DTM_SETFORMAT = DTM_SETFORMATW; + alias DTN_USERSTRING = DTN_USERSTRINGW; + alias DTN_WMKEYDOWN = DTN_WMKEYDOWNW; + alias DTN_FORMAT = DTN_FORMATW; + alias DTN_FORMATQUERY = DTN_FORMATQUERYW; + alias REBARBANDINFO = REBARBANDINFOW; + alias LPREBARBANDINFO = REBARBANDINFO*; + alias LPCREBARBANDINFO = LPCREBARBANDINFOW; + alias REBARBANDINFO_V3_SIZE = REBARBANDINFOW_V3_SIZE; + alias RB_INSERTBAND = RB_INSERTBANDW; + alias RB_SETBANDINFO = RB_SETBANDINFOW; } else { - alias HDITEMA HDITEM; - alias LPHDITEMA LPHDITEM; - alias TOOLINFOA TOOLINFO; - alias TOOLINFOA* PTOOLINFO, LPTOOLINFO; - alias TTHITTESTINFOA TTHITTESTINFO; - alias TTHITTESTINFOA* LPHITTESTINFO, LPTTHITTESTINFO; - alias TOOLTIPTEXTA TOOLTIPTEXT; - alias TOOLTIPTEXTA* LPTOOLTIPTEXT; - alias NMTTDISPINFOA NMTTDISPINFO; - alias NMTTDISPINFOA* LPNMTTDISPINFO; - alias TV_ITEMA TV_ITEM; - alias TV_ITEMA* LPTV_ITEM; - alias TVITEMA TVITEM; - alias TVITEMA* LPTVITEM; + alias HDITEM = HDITEMA; + alias LPHDITEM = LPHDITEMA; + alias TOOLINFO = TOOLINFOA; + alias PTOOLINFO = TOOLINFOA*, LPTOOLINFO = TOOLINFOA*; + alias TTHITTESTINFO = TTHITTESTINFOA; + alias LPHITTESTINFO = TTHITTESTINFOA*, LPTTHITTESTINFO = TTHITTESTINFOA*; + alias TOOLTIPTEXT = TOOLTIPTEXTA; + alias LPTOOLTIPTEXT = TOOLTIPTEXTA*; + alias NMTTDISPINFO = NMTTDISPINFOA; + alias LPNMTTDISPINFO = NMTTDISPINFOA*; + alias TV_ITEM = TV_ITEMA; + alias LPTV_ITEM = TV_ITEMA*; + alias TVITEM = TVITEMA; + alias LPTVITEM = TVITEMA*; static if (_WIN32_IE >= 0x400) { - alias TVITEMEXA TVITEMEX; - alias TVITEMEXA* LPTVITEMEX; - } - - alias TV_INSERTSTRUCTA TV_INSERTSTRUCT; - alias TV_INSERTSTRUCTA* LPTV_INSERTSTRUCT; - alias TVINSERTSTRUCTA TVINSERTSTRUCT; - alias TVINSERTSTRUCTA* LPTVINSERTSTRUCT; - alias NM_TREEVIEWA NM_TREEVIEW; - alias NM_TREEVIEWA* LPNM_TREEVIEW; - alias NMTREEVIEWA NMTREEVIEW; - alias NMTREEVIEWA* LPNMTREEVIEW; - alias NMHDDISPINFOW NMHDDISPINFO; - alias NMHDDISPINFOW* LPNMHDDISPINFO; - - alias ACM_OPENA ACM_OPEN; - alias COMBOBOXEXITEMA COMBOBOXEXITEM; - alias PCOMBOBOXEXITEMA PCOMBOBOXEXITEM; + alias TVITEMEX = TVITEMEXA; + alias LPTVITEMEX = TVITEMEXA*; + } + + alias TV_INSERTSTRUCT = TV_INSERTSTRUCTA; + alias LPTV_INSERTSTRUCT = TV_INSERTSTRUCTA*; + alias TVINSERTSTRUCT = TVINSERTSTRUCTA; + alias LPTVINSERTSTRUCT = TVINSERTSTRUCTA*; + alias NM_TREEVIEW = NM_TREEVIEWA; + alias LPNM_TREEVIEW = NM_TREEVIEWA*; + alias NMTREEVIEW = NMTREEVIEWA; + alias LPNMTREEVIEW = NMTREEVIEWA*; + alias NMHDDISPINFO = NMHDDISPINFOW; + alias LPNMHDDISPINFO = NMHDDISPINFOW*; + + alias ACM_OPEN = ACM_OPENA; + alias COMBOBOXEXITEM = COMBOBOXEXITEMA; + alias PCOMBOBOXEXITEM = PCOMBOBOXEXITEMA; //alias PCCOMBOBOXEXITEMA PCCOMBOBOXEXITEM; fixme - alias CBEM_INSERTITEMA CBEM_INSERTITEM; - alias CBEM_SETITEMA CBEM_SETITEM; - alias CBEM_GETITEMA CBEM_GETITEM; - alias CBEN_ENDEDITA CBEN_ENDEDIT; - alias NMCBEENDEDITA NMCBEENDEDIT; - alias LPNMCBEENDEDITA LPNMCBEENDEDIT; - alias PNMCBEENDEDITA PNMCBEENDEDIT; + alias CBEM_INSERTITEM = CBEM_INSERTITEMA; + alias CBEM_SETITEM = CBEM_SETITEMA; + alias CBEM_GETITEM = CBEM_GETITEMA; + alias CBEN_ENDEDIT = CBEN_ENDEDITA; + alias NMCBEENDEDIT = NMCBEENDEDITA; + alias LPNMCBEENDEDIT = LPNMCBEENDEDITA; + alias PNMCBEENDEDIT = PNMCBEENDEDITA; static if (_WIN32_IE >= 0x400) { - alias TB_GETBUTTONINFOA TB_GETBUTTONINFO; - alias TB_SETBUTTONINFOA TB_SETBUTTONINFO; - alias TB_INSERTBUTTONA TB_INSERTBUTTON; - alias TB_ADDBUTTONSA TB_ADDBUTTONS; - alias TB_MAPACCELERATORA TB_MAPACCELERATOR; - alias TB_GETSTRINGA TB_GETSTRING; - alias NMCOMBOBOXEXA NMCOMBOBOXEX; - alias PNMCOMBOBOXEXA PNMCOMBOBOXEX; - alias CBEN_DRAGBEGINA CBEN_DRAGBEGIN; - alias CBEN_GETDISPINFOA CBEN_GETDISPINFO; - alias NMCBEDRAGBEGINA NMCBEDRAGBEGIN; - alias LPNMCBEDRAGBEGINA LPNMCBEDRAGBEGIN; - alias PNMCBEDRAGBEGINA PNMCBEDRAGBEGIN; - alias TBN_GETDISPINFOA TBN_GETDISPINFO; - alias NMTBDISPINFOA NMTBDISPINFO; - alias LPNMTBDISPINFOA LPNMTBDISPINFO; - alias NMTBGETINFOTIPA NMTBGETINFOTIP; - alias LPNMTBGETINFOTIPA LPNMTBGETINFOTIP; - } - - alias SB_GETTEXTA SB_GETTEXT; - alias SB_SETTEXTA SB_SETTEXT; - alias SB_GETTEXTLENGTHA SB_GETTEXTLENGTH; - alias HDM_INSERTITEMA HDM_INSERTITEM; - alias HDM_GETITEMA HDM_GETITEM; - alias HDM_SETITEMA HDM_SETITEM; - alias HDN_ITEMCHANGINGA HDN_ITEMCHANGING; - alias HDN_ITEMCHANGEDA HDN_ITEMCHANGED; - alias HDN_ITEMCLICKA HDN_ITEMCLICK; - alias HDN_ITEMDBLCLICKA HDN_ITEMDBLCLICK; - alias HDN_DIVIDERDBLCLICKA HDN_DIVIDERDBLCLICK; - alias HDN_BEGINTRACKA HDN_BEGINTRACK; - alias HDN_ENDTRACKA HDN_ENDTRACK; - alias HDN_TRACKA HDN_TRACK; + alias TB_GETBUTTONINFO = TB_GETBUTTONINFOA; + alias TB_SETBUTTONINFO = TB_SETBUTTONINFOA; + alias TB_INSERTBUTTON = TB_INSERTBUTTONA; + alias TB_ADDBUTTONS = TB_ADDBUTTONSA; + alias TB_MAPACCELERATOR = TB_MAPACCELERATORA; + alias TB_GETSTRING = TB_GETSTRINGA; + alias NMCOMBOBOXEX = NMCOMBOBOXEXA; + alias PNMCOMBOBOXEX = PNMCOMBOBOXEXA; + alias CBEN_DRAGBEGIN = CBEN_DRAGBEGINA; + alias CBEN_GETDISPINFO = CBEN_GETDISPINFOA; + alias NMCBEDRAGBEGIN = NMCBEDRAGBEGINA; + alias LPNMCBEDRAGBEGIN = LPNMCBEDRAGBEGINA; + alias PNMCBEDRAGBEGIN = PNMCBEDRAGBEGINA; + alias TBN_GETDISPINFO = TBN_GETDISPINFOA; + alias NMTBDISPINFO = NMTBDISPINFOA; + alias LPNMTBDISPINFO = LPNMTBDISPINFOA; + alias NMTBGETINFOTIP = NMTBGETINFOTIPA; + alias LPNMTBGETINFOTIP = LPNMTBGETINFOTIPA; + } + + alias SB_GETTEXT = SB_GETTEXTA; + alias SB_SETTEXT = SB_SETTEXTA; + alias SB_GETTEXTLENGTH = SB_GETTEXTLENGTHA; + alias HDM_INSERTITEM = HDM_INSERTITEMA; + alias HDM_GETITEM = HDM_GETITEMA; + alias HDM_SETITEM = HDM_SETITEMA; + alias HDN_ITEMCHANGING = HDN_ITEMCHANGINGA; + alias HDN_ITEMCHANGED = HDN_ITEMCHANGEDA; + alias HDN_ITEMCLICK = HDN_ITEMCLICKA; + alias HDN_ITEMDBLCLICK = HDN_ITEMDBLCLICKA; + alias HDN_DIVIDERDBLCLICK = HDN_DIVIDERDBLCLICKA; + alias HDN_BEGINTRACK = HDN_BEGINTRACKA; + alias HDN_ENDTRACK = HDN_ENDTRACKA; + alias HDN_TRACK = HDN_TRACKA; static if (_WIN32_IE >= 0x300) { - alias HDN_GETDISPINFOA HDN_GETDISPINFO; + alias HDN_GETDISPINFO = HDN_GETDISPINFOA; } - alias HD_NOTIFYA HD_NOTIFY; - alias TBSAVEPARAMSA TBSAVEPARAMS; - alias TB_GETBUTTONTEXTA TB_GETBUTTONTEXT; - alias TB_SAVERESTOREA TB_SAVERESTORE; - alias TB_ADDSTRINGA TB_ADDSTRING; - alias TBN_GETBUTTONINFOA TBN_GETBUTTONINFO; + alias HD_NOTIFY = HD_NOTIFYA; + alias TBSAVEPARAMS = TBSAVEPARAMSA; + alias TB_GETBUTTONTEXT = TB_GETBUTTONTEXTA; + alias TB_SAVERESTORE = TB_SAVERESTOREA; + alias TB_ADDSTRING = TB_ADDSTRINGA; + alias TBN_GETBUTTONINFO = TBN_GETBUTTONINFOA; static if (_WIN32_IE >= 0x400) { - alias TBBUTTONINFOA TBBUTTONINFO; - alias LPTBBUTTONINFOA LPTBBUTTONINFO; - } - - alias TBNOTIFYA TBNOTIFY; - alias LPTBNOTIFYA LPTBNOTIFY; - alias NMTOOLBARA NMTOOLBAR; - alias LPNMTOOLBARA LPNMTOOLBAR; - alias TTM_ADDTOOLA TTM_ADDTOOL; - alias TTM_DELTOOLA TTM_DELTOOL; - alias TTM_NEWTOOLRECTA TTM_NEWTOOLRECT; - alias TTM_GETTOOLINFOA TTM_GETTOOLINFO; - alias TTM_SETTOOLINFOA TTM_SETTOOLINFO; - alias TTM_HITTESTA TTM_HITTEST; - alias TTM_GETTEXTA TTM_GETTEXT; - alias TTM_UPDATETIPTEXTA TTM_UPDATETIPTEXT; - alias TTM_ENUMTOOLSA TTM_ENUMTOOLS; - alias TTM_GETCURRENTTOOLA TTM_GETCURRENTTOOL; - alias TTN_NEEDTEXTA TTN_NEEDTEXT; - alias TTN_GETDISPINFOA TTN_GETDISPINFO; - alias LV_ITEMA LV_ITEM; - alias LVITEMA LVITEM; - alias LVITEM* LPLVITEM; - alias LPSTR_TEXTCALLBACKA LPSTR_TEXTCALLBACK; + alias TBBUTTONINFO = TBBUTTONINFOA; + alias LPTBBUTTONINFO = LPTBBUTTONINFOA; + } + + alias TBNOTIFY = TBNOTIFYA; + alias LPTBNOTIFY = LPTBNOTIFYA; + alias NMTOOLBAR = NMTOOLBARA; + alias LPNMTOOLBAR = LPNMTOOLBARA; + alias TTM_ADDTOOL = TTM_ADDTOOLA; + alias TTM_DELTOOL = TTM_DELTOOLA; + alias TTM_NEWTOOLRECT = TTM_NEWTOOLRECTA; + alias TTM_GETTOOLINFO = TTM_GETTOOLINFOA; + alias TTM_SETTOOLINFO = TTM_SETTOOLINFOA; + alias TTM_HITTEST = TTM_HITTESTA; + alias TTM_GETTEXT = TTM_GETTEXTA; + alias TTM_UPDATETIPTEXT = TTM_UPDATETIPTEXTA; + alias TTM_ENUMTOOLS = TTM_ENUMTOOLSA; + alias TTM_GETCURRENTTOOL = TTM_GETCURRENTTOOLA; + alias TTN_NEEDTEXT = TTN_NEEDTEXTA; + alias TTN_GETDISPINFO = TTN_GETDISPINFOA; + alias LV_ITEM = LV_ITEMA; + alias LVITEM = LVITEMA; + alias LPLVITEM = LVITEM*; + alias LPSTR_TEXTCALLBACK = LPSTR_TEXTCALLBACKA; static if (_WIN32_IE >= 0x400) { - alias LVBKIMAGEA LVBKIMAGE; - alias LPLVBKIMAGEA LPLVBKIMAGE; - alias LVM_SETBKIMAGEA LVM_SETBKIMAGE; - alias LVM_GETBKIMAGEA LVM_GETBKIMAGE; - } - - alias LVM_GETITEMA LVM_GETITEM; - alias LVM_SETITEMA LVM_SETITEM; - alias LVM_INSERTITEMA LVM_INSERTITEM; - alias LV_FINDINFOA LV_FINDINFO; - alias LVFINDINFOA LVFINDINFO; - alias LPFINDINFOA LPFINDINFO; - alias NMLVFINDITEMA NMLVFINDITEM; - alias PNMLVFINDITEMA PNMLVFINDITEM; - alias LPNMLVFINDITEMA LPNMLVFINDITEM; - alias LVM_FINDITEMA LVM_FINDITEM; - alias LVM_GETSTRINGWIDTHA LVM_GETSTRINGWIDTH; - alias LVM_EDITLABELA LVM_EDITLABEL; - alias LV_COLUMNA LV_COLUMN; - alias LVCOLUMNA LVCOLUMN; - alias LVCOLUMNA* LPLVCOLUMN; - alias LVM_GETCOLUMNA LVM_GETCOLUMN; - alias LVM_SETCOLUMNA LVM_SETCOLUMN; - alias LVM_INSERTCOLUMNA LVM_INSERTCOLUMN; - alias LVM_GETITEMTEXTA LVM_GETITEMTEXT; - alias LVM_SETITEMTEXTA LVM_SETITEMTEXT; - alias LVM_GETISEARCHSTRINGA LVM_GETISEARCHSTRING; - alias LVN_BEGINLABELEDITA LVN_BEGINLABELEDIT; - alias LVN_ENDLABELEDITA LVN_ENDLABELEDIT; - alias LVN_GETDISPINFOA LVN_GETDISPINFO; - alias LVN_SETDISPINFOA LVN_SETDISPINFO; + alias LVBKIMAGE = LVBKIMAGEA; + alias LPLVBKIMAGE = LPLVBKIMAGEA; + alias LVM_SETBKIMAGE = LVM_SETBKIMAGEA; + alias LVM_GETBKIMAGE = LVM_GETBKIMAGEA; + } + + alias LVM_GETITEM = LVM_GETITEMA; + alias LVM_SETITEM = LVM_SETITEMA; + alias LVM_INSERTITEM = LVM_INSERTITEMA; + alias LV_FINDINFO = LV_FINDINFOA; + alias LVFINDINFO = LVFINDINFOA; + alias LPFINDINFO = LPFINDINFOA; + alias NMLVFINDITEM = NMLVFINDITEMA; + alias PNMLVFINDITEM = PNMLVFINDITEMA; + alias LPNMLVFINDITEM = LPNMLVFINDITEMA; + alias LVM_FINDITEM = LVM_FINDITEMA; + alias LVM_GETSTRINGWIDTH = LVM_GETSTRINGWIDTHA; + alias LVM_EDITLABEL = LVM_EDITLABELA; + alias LV_COLUMN = LV_COLUMNA; + alias LVCOLUMN = LVCOLUMNA; + alias LPLVCOLUMN = LVCOLUMNA*; + alias LVM_GETCOLUMN = LVM_GETCOLUMNA; + alias LVM_SETCOLUMN = LVM_SETCOLUMNA; + alias LVM_INSERTCOLUMN = LVM_INSERTCOLUMNA; + alias LVM_GETITEMTEXT = LVM_GETITEMTEXTA; + alias LVM_SETITEMTEXT = LVM_SETITEMTEXTA; + alias LVM_GETISEARCHSTRING = LVM_GETISEARCHSTRINGA; + alias LVN_BEGINLABELEDIT = LVN_BEGINLABELEDITA; + alias LVN_ENDLABELEDIT = LVN_ENDLABELEDITA; + alias LVN_GETDISPINFO = LVN_GETDISPINFOA; + alias LVN_SETDISPINFO = LVN_SETDISPINFOA; static if (_WIN32_IE >= 0x400) { - alias LVN_GETINFOTIPA LVN_GETINFOTIP; - alias NMLVGETINFOTIPA NMLVGETINFOTIP; - alias LPNMLVGETINFOTIPA LPNMLVGETINFOTIP; - } - - alias LV_DISPINFOA LV_DISPINFO; - alias NMLVDISPINFOA NMLVDISPINFO; - alias LPNMLVDISPINFOA LPNMLVDISPINFO; - alias TVM_INSERTITEMA TVM_INSERTITEM; - alias TVM_GETITEMA TVM_GETITEM; - alias TVM_SETITEMA TVM_SETITEM; - alias TVM_EDITLABELA TVM_EDITLABEL; - alias TVM_GETISEARCHSTRINGA TVM_GETISEARCHSTRING; - alias NMTVDISPINFOA TV_DISPINFO; - alias NMTVDISPINFOA NMTVDISPINFO; - alias LPNMTVDISPINFOA LPNMTVDISPINFO; + alias LVN_GETINFOTIP = LVN_GETINFOTIPA; + alias NMLVGETINFOTIP = NMLVGETINFOTIPA; + alias LPNMLVGETINFOTIP = LPNMLVGETINFOTIPA; + } + + alias LV_DISPINFO = LV_DISPINFOA; + alias NMLVDISPINFO = NMLVDISPINFOA; + alias LPNMLVDISPINFO = LPNMLVDISPINFOA; + alias TVM_INSERTITEM = TVM_INSERTITEMA; + alias TVM_GETITEM = TVM_GETITEMA; + alias TVM_SETITEM = TVM_SETITEMA; + alias TVM_EDITLABEL = TVM_EDITLABELA; + alias TVM_GETISEARCHSTRING = TVM_GETISEARCHSTRINGA; + alias TV_DISPINFO = NMTVDISPINFOA; + alias NMTVDISPINFO = NMTVDISPINFOA; + alias LPNMTVDISPINFO = LPNMTVDISPINFOA; static if (_WIN32_IE >= 0x400) { - alias NMTVGETINFOTIPA NMTVGETINFOTIP; - alias LPNMTVGETINFOTIPA LPNMTVGETINFOTIP; - alias TVN_GETINFOTIPA TVN_GETINFOTIP; - } - - alias TVN_SELCHANGINGA TVN_SELCHANGING; - alias TVN_SELCHANGEDA TVN_SELCHANGED; - alias TVN_GETDISPINFOA TVN_GETDISPINFO; - alias TVN_SETDISPINFOA TVN_SETDISPINFO; - alias TVN_ITEMEXPANDINGA TVN_ITEMEXPANDING; - alias TVN_ITEMEXPANDEDA TVN_ITEMEXPANDED; - alias TVN_BEGINDRAGA TVN_BEGINDRAG; - alias TVN_BEGINRDRAGA TVN_BEGINRDRAG; - alias TVN_DELETEITEMA TVN_DELETEITEM; - alias TVN_BEGINLABELEDITA TVN_BEGINLABELEDIT; - alias TVN_ENDLABELEDITA TVN_ENDLABELEDIT; - alias TC_ITEMHEADERA TC_ITEMHEADER; - alias TC_ITEMA TC_ITEM; - alias TCITEMA TCITEM; - alias LPTCITEMA LPTCITEM; - alias TCM_GETITEMA TCM_GETITEM; - alias TCM_SETITEMA TCM_SETITEM; - alias TCM_INSERTITEMA TCM_INSERTITEM; - alias CreateStatusWindowA CreateStatusWindow; - alias DrawStatusTextA DrawStatusText; - alias ImageList_LoadImageA ImageList_LoadImage; - alias DTM_SETFORMATA DTM_SETFORMAT; - alias DTN_USERSTRINGA DTN_USERSTRING; - alias DTN_WMKEYDOWNA DTN_WMKEYDOWN; - alias DTN_FORMATA DTN_FORMAT; - alias DTN_FORMATQUERYA DTN_FORMATQUERY; - alias REBARBANDINFOA REBARBANDINFO; - alias REBARBANDINFOA* LPREBARBANDINFO; - alias LPCREBARBANDINFOA LPCREBARBANDINFO; - alias REBARBANDINFOA_V3_SIZE REBARBANDINFO_V3_SIZE; - alias RB_INSERTBANDA RB_INSERTBAND; - alias RB_SETBANDINFOA RB_SETBANDINFO; + alias NMTVGETINFOTIP = NMTVGETINFOTIPA; + alias LPNMTVGETINFOTIP = LPNMTVGETINFOTIPA; + alias TVN_GETINFOTIP = TVN_GETINFOTIPA; + } + + alias TVN_SELCHANGING = TVN_SELCHANGINGA; + alias TVN_SELCHANGED = TVN_SELCHANGEDA; + alias TVN_GETDISPINFO = TVN_GETDISPINFOA; + alias TVN_SETDISPINFO = TVN_SETDISPINFOA; + alias TVN_ITEMEXPANDING = TVN_ITEMEXPANDINGA; + alias TVN_ITEMEXPANDED = TVN_ITEMEXPANDEDA; + alias TVN_BEGINDRAG = TVN_BEGINDRAGA; + alias TVN_BEGINRDRAG = TVN_BEGINRDRAGA; + alias TVN_DELETEITEM = TVN_DELETEITEMA; + alias TVN_BEGINLABELEDIT = TVN_BEGINLABELEDITA; + alias TVN_ENDLABELEDIT = TVN_ENDLABELEDITA; + alias TC_ITEMHEADER = TC_ITEMHEADERA; + alias TC_ITEM = TC_ITEMA; + alias TCITEM = TCITEMA; + alias LPTCITEM = LPTCITEMA; + alias TCM_GETITEM = TCM_GETITEMA; + alias TCM_SETITEM = TCM_SETITEMA; + alias TCM_INSERTITEM = TCM_INSERTITEMA; + alias CreateStatusWindow = CreateStatusWindowA; + alias DrawStatusText = DrawStatusTextA; + alias ImageList_LoadImage = ImageList_LoadImageA; + alias DTM_SETFORMAT = DTM_SETFORMATA; + alias DTN_USERSTRING = DTN_USERSTRINGA; + alias DTN_WMKEYDOWN = DTN_WMKEYDOWNA; + alias DTN_FORMAT = DTN_FORMATA; + alias DTN_FORMATQUERY = DTN_FORMATQUERYA; + alias REBARBANDINFO = REBARBANDINFOA; + alias LPREBARBANDINFO = REBARBANDINFOA*; + alias LPCREBARBANDINFO = LPCREBARBANDINFOA; + alias REBARBANDINFO_V3_SIZE = REBARBANDINFOA_V3_SIZE; + alias RB_INSERTBAND = RB_INSERTBANDA; + alias RB_SETBANDINFO = RB_SETBANDINFOA; } extern (Windows) { -alias INT function(PVOID, PVOID) PFNDPAENUMCALLBACK; -alias INT function(PVOID, PVOID) PFNDSAENUMCALLBACK; -alias INT function(PVOID, PVOID, LPARAM) PFNDPACOMPARE; +alias PFNDPAENUMCALLBACK = INT function(PVOID, PVOID); +alias PFNDSAENUMCALLBACK = INT function(PVOID, PVOID); +alias PFNDPACOMPARE = INT function(PVOID, PVOID, LPARAM); } static if (_WIN32_WINNT >= 0x501) { extern (Windows) - alias LRESULT function(HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR) - SUBCLASSPROC; + alias SUBCLASSPROC = LRESULT function(HWND, UINT, WPARAM, LPARAM, UINT_PTR, DWORD_PTR); struct LITEM { UINT mask; @@ -4922,19 +4921,19 @@ static if (_WIN32_WINNT >= 0x501) { WCHAR[MAX_LINKID_TEXT] szID = 0; WCHAR[L_MAX_URL_LENGTH] szUrl = 0; } - alias LITEM* PLITEM; + alias PLITEM = LITEM*; struct LHITTESTINFO { POINT pt; LITEM item; } - alias LHITTESTINFO* PLHITTESTINFO; + alias PLHITTESTINFO = LHITTESTINFO*; struct NMLINK { NMHDR hdr; LITEM item; } - alias NMLINK* PNMLINK; + alias PNMLINK = NMLINK*; } uint INDEXTOOVERLAYMASK()(uint i) { return i << 8; } @@ -5171,13 +5170,13 @@ extern (Windows) nothrow @nogc { version (Win64) { BOOL FlatSB_GetScrollPropPtr(HWND, INT, PINT_PTR); } else { - alias FlatSB_GetScrollProp FlatSB_GetScrollPropPtr; + alias FlatSB_GetScrollPropPtr = FlatSB_GetScrollProp; } INT FlatSB_SetScrollPos(HWND, INT, INT, BOOL); INT FlatSB_SetScrollInfo(HWND, INT, LPSCROLLINFO, BOOL); INT FlatSB_SetScrollRange(HWND, INT, INT, INT, BOOL); BOOL FlatSB_SetScrollProp(HWND, UINT, INT_PTR, BOOL); - alias FlatSB_SetScrollProp FlatSB_SetScrollPropPtr; + alias FlatSB_SetScrollPropPtr = FlatSB_SetScrollProp; BOOL InitializeFlatSB(HWND); HRESULT UninitializeFlatSB(HWND); } @@ -6287,7 +6286,7 @@ static if (_WIN32_WINNT >= 0x501) { LPCWSTR pszText; INT ttiIcon; } - alias EDITBALLOONTIP* PEDITBALLOONTIP; + alias PEDITBALLOONTIP = EDITBALLOONTIP*; enum EM_SETCUEBANNER = ECM_FIRST + 1; enum EM_GETCUEBANNER = ECM_FIRST + 2; diff --git a/runtime/druntime/src/core/sys/windows/commdlg.d b/runtime/druntime/src/core/sys/windows/commdlg.d index 9be9a9f1f21..a74b599c5d1 100644 --- a/runtime/druntime/src/core/sys/windows/commdlg.d +++ b/runtime/druntime/src/core/sys/windows/commdlg.d @@ -297,9 +297,7 @@ alias CommDlg_OpenSave_GetFolderPath // Callbacks. extern(Windows) { -alias UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow - LPCCHOOKPROC, LPCFHOOKPROC, LPFRHOOKPROC, LPOFNHOOKPROC, - LPPAGEPAINTHOOK, LPPAGESETUPHOOK, LPSETUPHOOKPROC, LPPRINTHOOKPROC; +alias LPCCHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPCFHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPFRHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPOFNHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPPAGEPAINTHOOK = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPPAGESETUPHOOK = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPSETUPHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow, LPPRINTHOOKPROC = UINT_PTR function (HWND, UINT, WPARAM, LPARAM) nothrow; } //align (1): // 1 in Win32, default in Win64 @@ -315,7 +313,7 @@ struct CHOOSECOLORA { LPCCHOOKPROC lpfnHook; LPCSTR lpTemplateName; } -alias CHOOSECOLORA* LPCHOOSECOLORA; +alias LPCHOOSECOLORA = CHOOSECOLORA*; struct CHOOSECOLORW { DWORD lStructSize = CHOOSECOLORW.sizeof; @@ -328,7 +326,7 @@ struct CHOOSECOLORW { LPCCHOOKPROC lpfnHook; LPCWSTR lpTemplateName; } -alias CHOOSECOLORW* LPCHOOSECOLORW; +alias LPCHOOSECOLORW = CHOOSECOLORW*; struct CHOOSEFONTA { DWORD lStructSize = CHOOSEFONTA.sizeof; @@ -348,7 +346,7 @@ struct CHOOSEFONTA { INT nSizeMin; INT nSizeMax; } -alias CHOOSEFONTA* LPCHOOSEFONTA; +alias LPCHOOSEFONTA = CHOOSEFONTA*; struct CHOOSEFONTW { DWORD lStructSize = CHOOSEFONTW.sizeof; @@ -368,7 +366,7 @@ struct CHOOSEFONTW { INT nSizeMin; INT nSizeMax; } -alias CHOOSEFONTW* LPCHOOSEFONTW; +alias LPCHOOSEFONTW = CHOOSEFONTW*; struct DEVNAMES { WORD wDriverOffset; @@ -376,7 +374,7 @@ struct DEVNAMES { WORD wOutputOffset; WORD wDefault; } -alias DEVNAMES* LPDEVNAMES; +alias LPDEVNAMES = DEVNAMES*; struct FINDREPLACEA { DWORD lStructSize = FINDREPLACEA.sizeof; @@ -391,7 +389,7 @@ struct FINDREPLACEA { LPFRHOOKPROC lpfnHook; LPCSTR lpTemplateName; } -alias FINDREPLACEA* LPFINDREPLACEA; +alias LPFINDREPLACEA = FINDREPLACEA*; struct FINDREPLACEW { DWORD lStructSize = FINDREPLACEW.sizeof; @@ -406,7 +404,7 @@ struct FINDREPLACEW { LPFRHOOKPROC lpfnHook; LPCWSTR lpTemplateName; } -alias FINDREPLACEW* LPFINDREPLACEW; +alias LPFINDREPLACEW = FINDREPLACEW*; struct OPENFILENAMEA { DWORD lStructSize = OPENFILENAMEA.sizeof; @@ -436,7 +434,7 @@ struct OPENFILENAMEA { DWORD FlagsEx; //} } -alias OPENFILENAMEA* LPOPENFILENAMEA; +alias LPOPENFILENAMEA = OPENFILENAMEA*; struct OPENFILENAMEW { DWORD lStructSize = OPENFILENAMEW.sizeof; @@ -466,7 +464,7 @@ struct OPENFILENAMEW { DWORD FlagsEx; //} } -alias OPENFILENAMEW* LPOPENFILENAMEW; +alias LPOPENFILENAMEW = OPENFILENAMEW*; enum size_t OPENFILENAME_SIZE_VERSION_400 = 76; @@ -475,14 +473,14 @@ struct OFNOTIFYA { LPOPENFILENAMEA lpOFN; LPSTR pszFile; } -alias OFNOTIFYA* LPOFNOTIFYA; +alias LPOFNOTIFYA = OFNOTIFYA*; struct OFNOTIFYW { NMHDR hdr; LPOPENFILENAMEW lpOFN; LPWSTR pszFile; } -alias OFNOTIFYW* LPOFNOTIFYW; +alias LPOFNOTIFYW = OFNOTIFYW*; struct PAGESETUPDLGA { DWORD lStructSize = PAGESETUPDLGA.sizeof; @@ -500,7 +498,7 @@ struct PAGESETUPDLGA { LPCSTR lpPageSetupTemplateName; HGLOBAL hPageSetupTemplate; } -alias PAGESETUPDLGA* LPPAGESETUPDLGA; +alias LPPAGESETUPDLGA = PAGESETUPDLGA*; struct PAGESETUPDLGW { DWORD lStructSize = PAGESETUPDLGW.sizeof; @@ -518,7 +516,7 @@ struct PAGESETUPDLGW { LPCWSTR lpPageSetupTemplateName; HGLOBAL hPageSetupTemplate; } -alias PAGESETUPDLGW* LPPAGESETUPDLGW; +alias LPPAGESETUPDLGW = PAGESETUPDLGW*; align (1) struct PRINTDLGA { align(1): @@ -546,7 +544,7 @@ align(1): HANDLE hPrintTemplate; HANDLE hSetupTemplate; } -alias PRINTDLGA* LPPRINTDLGA; +alias LPPRINTDLGA = PRINTDLGA*; align (1) struct PRINTDLGW { align(1): @@ -574,7 +572,7 @@ align(1): HANDLE hPrintTemplate; HANDLE hSetupTemplate; } -alias PRINTDLGW* LPPRINTDLGW; +alias LPPRINTDLGW = PRINTDLGW*; //static if (_WIN32_WINNT >= 0x500) { import core.sys.windows.unknwn; // for LPUNKNOWN @@ -584,7 +582,7 @@ alias PRINTDLGW* LPPRINTDLGW; DWORD nFromPage; DWORD nToPage; } - alias PRINTPAGERANGE* LPPRINTPAGERANGE; + alias LPPRINTPAGERANGE = PRINTPAGERANGE*; struct PRINTDLGEXA { DWORD lStructSize = PRINTDLGEXA.sizeof; @@ -609,7 +607,7 @@ alias PRINTDLGW* LPPRINTDLGW; DWORD nStartPage; DWORD dwResultAction; } - alias PRINTDLGEXA* LPPRINTDLGEXA; + alias LPPRINTDLGEXA = PRINTDLGEXA*; struct PRINTDLGEXW { DWORD lStructSize = PRINTDLGEXW.sizeof; @@ -634,7 +632,7 @@ alias PRINTDLGW* LPPRINTDLGW; DWORD nStartPage; DWORD dwResultAction; } - alias PRINTDLGEXW* LPPRINTDLGEXW; + alias LPPRINTDLGEXW = PRINTDLGEXW*; //} // _WIN32_WINNT >= 0x500 @@ -666,63 +664,63 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias CHOOSECOLORW CHOOSECOLOR; - alias CHOOSEFONTW CHOOSEFONT; - alias FINDREPLACEW FINDREPLACE; - alias OPENFILENAMEW OPENFILENAME; - alias OFNOTIFYW OFNOTIFY; - alias PAGESETUPDLGW PAGESETUPDLG; - alias PRINTDLGW PRINTDLG; - - alias ChooseColorW ChooseColor; - alias ChooseFontW ChooseFont; - alias FindTextW FindText; - alias GetFileTitleW GetFileTitle; - alias GetOpenFileNameW GetOpenFileName; - alias GetSaveFileNameW GetSaveFileName; - alias PageSetupDlgW PageSetupDlg; - alias PrintDlgW PrintDlg; - alias ReplaceTextW ReplaceText; + alias CHOOSECOLOR = CHOOSECOLORW; + alias CHOOSEFONT = CHOOSEFONTW; + alias FINDREPLACE = FINDREPLACEW; + alias OPENFILENAME = OPENFILENAMEW; + alias OFNOTIFY = OFNOTIFYW; + alias PAGESETUPDLG = PAGESETUPDLGW; + alias PRINTDLG = PRINTDLGW; + + alias ChooseColor = ChooseColorW; + alias ChooseFont = ChooseFontW; + alias FindText = FindTextW; + alias GetFileTitle = GetFileTitleW; + alias GetOpenFileName = GetOpenFileNameW; + alias GetSaveFileName = GetSaveFileNameW; + alias PageSetupDlg = PageSetupDlgW; + alias PrintDlg = PrintDlgW; + alias ReplaceText = ReplaceTextW; //static if (_WIN32_WINNT >= 0x500) { - alias PRINTDLGEXW PRINTDLGEX; - alias PrintDlgExW PrintDlgEx; + alias PRINTDLGEX = PRINTDLGEXW; + alias PrintDlgEx = PrintDlgExW; //} } else { // UNICODE - alias CHOOSECOLORA CHOOSECOLOR; - alias CHOOSEFONTA CHOOSEFONT; - alias FINDREPLACEA FINDREPLACE; - alias OPENFILENAMEA OPENFILENAME; - alias OFNOTIFYA OFNOTIFY; - alias PAGESETUPDLGA PAGESETUPDLG; - alias PRINTDLGA PRINTDLG; - - alias ChooseColorA ChooseColor; - alias ChooseFontA ChooseFont; - alias FindTextA FindText; - alias GetFileTitleA GetFileTitle; - alias GetOpenFileNameA GetOpenFileName; - alias GetSaveFileNameA GetSaveFileName; - alias PageSetupDlgA PageSetupDlg; - alias PrintDlgA PrintDlg; - alias ReplaceTextA ReplaceText; + alias CHOOSECOLOR = CHOOSECOLORA; + alias CHOOSEFONT = CHOOSEFONTA; + alias FINDREPLACE = FINDREPLACEA; + alias OPENFILENAME = OPENFILENAMEA; + alias OFNOTIFY = OFNOTIFYA; + alias PAGESETUPDLG = PAGESETUPDLGA; + alias PRINTDLG = PRINTDLGA; + + alias ChooseColor = ChooseColorA; + alias ChooseFont = ChooseFontA; + alias FindText = FindTextA; + alias GetFileTitle = GetFileTitleA; + alias GetOpenFileName = GetOpenFileNameA; + alias GetSaveFileName = GetSaveFileNameA; + alias PageSetupDlg = PageSetupDlgA; + alias PrintDlg = PrintDlgA; + alias ReplaceText = ReplaceTextA; //static if (_WIN32_WINNT >= 0x500) { - alias PRINTDLGEXA PRINTDLGEX; - alias PrintDlgExA PrintDlgEx; + alias PRINTDLGEX = PRINTDLGEXA; + alias PrintDlgEx = PrintDlgExA; //} } // UNICODE -alias CHOOSECOLOR* LPCHOOSECOLOR; -alias CHOOSEFONT* LPCHOOSEFONT; -alias FINDREPLACE* LPFINDREPLACE; -alias OPENFILENAME* LPOPENFILENAME; -alias OFNOTIFY* LPOFNOTIFY; -alias PAGESETUPDLG* LPPAGESETUPDLG; -alias PRINTDLG* LPPRINTDLG; +alias LPCHOOSECOLOR = CHOOSECOLOR*; +alias LPCHOOSEFONT = CHOOSEFONT*; +alias LPFINDREPLACE = FINDREPLACE*; +alias LPOPENFILENAME = OPENFILENAME*; +alias LPOFNOTIFY = OFNOTIFY*; +alias LPPAGESETUPDLG = PAGESETUPDLG*; +alias LPPRINTDLG = PRINTDLG*; //static if (_WIN32_WINNT >= 0x500) { - alias PRINTDLGEX* LPPRINTDLGEX; + alias LPPRINTDLGEX = PRINTDLGEX*; //} diff --git a/runtime/druntime/src/core/sys/windows/cpl.d b/runtime/druntime/src/core/sys/windows/cpl.d index df98703520e..6ad65f2a63f 100644 --- a/runtime/druntime/src/core/sys/windows/cpl.d +++ b/runtime/druntime/src/core/sys/windows/cpl.d @@ -34,7 +34,7 @@ enum : uint { CPL_SETUP = 200 } -extern (Windows) alias LONG function(HWND, UINT, LONG, LONG) APPLET_PROC; +extern (Windows) alias APPLET_PROC = LONG function(HWND, UINT, LONG, LONG); align(1) struct CPLINFO { @@ -44,7 +44,7 @@ align(1): int idInfo; LONG_PTR lData; } -alias CPLINFO* LPCPLINFO; +alias LPCPLINFO = CPLINFO*; align(1) struct NEWCPLINFOA { @@ -58,7 +58,7 @@ align(1): CHAR[64] szInfo = 0; CHAR[128] szHelpFile = 0; } -alias NEWCPLINFOA* LPNEWCPLINFOA; +alias LPNEWCPLINFOA = NEWCPLINFOA*; align(1) struct NEWCPLINFOW { @@ -72,14 +72,14 @@ align(1): WCHAR[64] szInfo = 0; WCHAR[128] szHelpFile = 0; } -alias NEWCPLINFOW* LPNEWCPLINFOW; +alias LPNEWCPLINFOW = NEWCPLINFOW*; version (Unicode) { - alias CPL_STARTWPARMSW CPL_STARTWPARMS; - alias NEWCPLINFOW NEWCPLINFO; + alias CPL_STARTWPARMS = CPL_STARTWPARMSW; + alias NEWCPLINFO = NEWCPLINFOW; } else { - alias CPL_STARTWPARMSA CPL_STARTWPARMS; - alias NEWCPLINFOA NEWCPLINFO; + alias CPL_STARTWPARMS = CPL_STARTWPARMSA; + alias NEWCPLINFO = NEWCPLINFOA; } -alias NEWCPLINFO* LPNEWCPLINFO; +alias LPNEWCPLINFO = NEWCPLINFO*; diff --git a/runtime/druntime/src/core/sys/windows/custcntl.d b/runtime/druntime/src/core/sys/windows/custcntl.d index ddac9607382..d7a641fc724 100644 --- a/runtime/druntime/src/core/sys/windows/custcntl.d +++ b/runtime/druntime/src/core/sys/windows/custcntl.d @@ -29,7 +29,7 @@ struct CCSTYLEA { LANGID lgid; WORD wReserved1; } -alias CCSTYLEA* LPCCSTYLEA; +alias LPCCSTYLEA = CCSTYLEA*; struct CCSTYLEW { DWORD flStyle; @@ -38,21 +38,21 @@ struct CCSTYLEW { LANGID lgid; WORD wReserved1; } -alias CCSTYLEW* LPCCSTYLEW; +alias LPCCSTYLEW = CCSTYLEW*; struct CCSTYLEFLAGA { DWORD flStyle; DWORD flStyleMask; LPSTR pszStyle; } -alias CCSTYLEFLAGA* LPCCSTYLEFLAGA; +alias LPCCSTYLEFLAGA = CCSTYLEFLAGA*; struct CCSTYLEFLAGW { DWORD flStyle; DWORD flStyleMask; LPWSTR pszStyle; } -alias CCSTYLEFLAGW* LPCCSTYLEFLAGW; +alias LPCCSTYLEFLAGW = CCSTYLEFLAGW*; struct CCINFOA { CHAR[CCHCCCLASS] szClass = 0; @@ -71,7 +71,7 @@ struct CCINFOA { DWORD dwReserved1; DWORD dwReserved2; } -alias CCINFOA* LPCCINFOA; +alias LPCCINFOA = CCINFOA*; struct CCINFOW { WCHAR[CCHCCCLASS] szClass = 0; @@ -90,36 +90,36 @@ struct CCINFOW { DWORD dwReserved1; DWORD dwReserved2; } -alias CCINFOW* LPCCINFOW; +alias LPCCINFOW = CCINFOW*; extern (Windows) { - alias BOOL function(HWND, LPCCSTYLEA) LPFNCCSTYLEA; - alias BOOL function(HWND, LPCCSTYLEW) LPFNCCSTYLEW; - alias INT function(DWORD, DWORD, HFONT, LPSTR) LPFNCCSIZETOTEXTA; - alias INT function(DWORD, DWORD, HFONT, LPWSTR) LPFNCCSIZETOTEXTW; - alias UINT function(LPCCINFOA) LPFNCCINFOA; - alias UINT function(LPCCINFOW) LPFNCCINFOW; + alias LPFNCCSTYLEA = BOOL function(HWND, LPCCSTYLEA); + alias LPFNCCSTYLEW = BOOL function(HWND, LPCCSTYLEW); + alias LPFNCCSIZETOTEXTA = INT function(DWORD, DWORD, HFONT, LPSTR); + alias LPFNCCSIZETOTEXTW = INT function(DWORD, DWORD, HFONT, LPWSTR); + alias LPFNCCINFOA = UINT function(LPCCINFOA); + alias LPFNCCINFOW = UINT function(LPCCINFOW); nothrow @nogc: UINT CustomControlInfoA(LPCCINFOA acci); UINT CustomControlInfoW(LPCCINFOW acci); } version (Unicode) { - alias CCSTYLEW CCSTYLE; - alias CCSTYLEFLAGW CCSTYLEFLAG; - alias CCINFOW CCINFO; - alias LPFNCCSTYLEW LPFNCCSTYLE; - alias LPFNCCSIZETOTEXTW LPFNCCSIZETOTEXT; - alias LPFNCCINFOW LPFNCCINFO; + alias CCSTYLE = CCSTYLEW; + alias CCSTYLEFLAG = CCSTYLEFLAGW; + alias CCINFO = CCINFOW; + alias LPFNCCSTYLE = LPFNCCSTYLEW; + alias LPFNCCSIZETOTEXT = LPFNCCSIZETOTEXTW; + alias LPFNCCINFO = LPFNCCINFOW; } else { - alias CCSTYLEA CCSTYLE; - alias CCSTYLEFLAGA CCSTYLEFLAG; - alias CCINFOA CCINFO; - alias LPFNCCSTYLEA LPFNCCSTYLE; - alias LPFNCCSIZETOTEXTA LPFNCCSIZETOTEXT; - alias LPFNCCINFOA LPFNCCINFO; + alias CCSTYLE = CCSTYLEA; + alias CCSTYLEFLAG = CCSTYLEFLAGA; + alias CCINFO = CCINFOA; + alias LPFNCCSTYLE = LPFNCCSTYLEA; + alias LPFNCCSIZETOTEXT = LPFNCCSIZETOTEXTA; + alias LPFNCCINFO = LPFNCCINFOA; } -alias CCSTYLE* LPCCSTYLE; -alias CCSTYLEFLAG* LPCCSTYLEFLAG; -alias CCINFO* LPCCINFO; +alias LPCCSTYLE = CCSTYLE*; +alias LPCCSTYLEFLAG = CCSTYLEFLAG*; +alias LPCCINFO = CCINFO*; diff --git a/runtime/druntime/src/core/sys/windows/dbghelp.d b/runtime/druntime/src/core/sys/windows/dbghelp.d index fb6fb668672..45b2041161b 100644 --- a/runtime/druntime/src/core/sys/windows/dbghelp.d +++ b/runtime/druntime/src/core/sys/windows/dbghelp.d @@ -19,31 +19,31 @@ public import core.sys.windows.dbghelp_types; extern(Windows) { - alias BOOL function(HANDLE hProcess, DWORD64 lpBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead) ReadProcessMemoryProc64; - alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) FunctionTableAccessProc64; - alias DWORD64 function(HANDLE hProcess, DWORD64 Address) GetModuleBaseProc64; - alias DWORD64 function(HANDLE hProcess, HANDLE hThread, ADDRESS64 *lpaddr) TranslateAddressProc64; + alias ReadProcessMemoryProc64 = BOOL function(HANDLE hProcess, DWORD64 lpBaseAddress, PVOID lpBuffer, DWORD nSize, LPDWORD lpNumberOfBytesRead); + alias FunctionTableAccessProc64 = PVOID function(HANDLE hProcess, DWORD64 AddrBase); + alias GetModuleBaseProc64 = DWORD64 function(HANDLE hProcess, DWORD64 Address); + alias TranslateAddressProc64 = DWORD64 function(HANDLE hProcess, HANDLE hThread, ADDRESS64 *lpaddr); - alias BOOL function(HANDLE hProcess, PCSTR UserSearchPath, bool fInvadeProcess) SymInitializeFunc; - alias BOOL function(HANDLE hProcess) SymCleanupFunc; - alias DWORD function(DWORD SymOptions) SymSetOptionsFunc; - alias DWORD function() SymGetOptionsFunc; - alias PVOID function(HANDLE hProcess, DWORD64 AddrBase) SymFunctionTableAccess64Func; - alias BOOL function(DWORD MachineType, HANDLE hProcess, HANDLE hThread, STACKFRAME64 *StackFrame, PVOID ContextRecord, + alias SymInitializeFunc = BOOL function(HANDLE hProcess, PCSTR UserSearchPath, bool fInvadeProcess); + alias SymCleanupFunc = BOOL function(HANDLE hProcess); + alias SymSetOptionsFunc = DWORD function(DWORD SymOptions); + alias SymGetOptionsFunc = DWORD function(); + alias SymFunctionTableAccess64Func = PVOID function(HANDLE hProcess, DWORD64 AddrBase); + alias StackWalk64Func = BOOL function(DWORD MachineType, HANDLE hProcess, HANDLE hThread, STACKFRAME64 *StackFrame, PVOID ContextRecord, ReadProcessMemoryProc64 ReadMemoryRoutine, FunctionTableAccessProc64 FunctoinTableAccess, - GetModuleBaseProc64 GetModuleBaseRoutine, TranslateAddressProc64 TranslateAddress) @nogc StackWalk64Func; - alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, IMAGEHLP_LINEA64 *line) SymGetLineFromAddr64Func; - alias DWORD64 function(HANDLE hProcess, DWORD64 dwAddr) SymGetModuleBase64Func; - alias BOOL function(HANDLE hProcess, DWORD64 dwAddr, IMAGEHLP_MODULEA64 *ModuleInfo) SymGetModuleInfo64Func; - alias BOOL function(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, IMAGEHLP_SYMBOLA64 *Symbol) SymGetSymFromAddr64Func; - alias DWORD function(PCSTR DecoratedName, PSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags) UnDecorateSymbolNameFunc; - alias DWORD64 function(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll) SymLoadModule64Func; - alias BOOL function(HANDLE hProcess, PSTR SearchPath, DWORD SearchPathLength) SymGetSearchPathFunc; - alias BOOL function(HANDLE hProcess, PCSTR SearchPath) SymSetSearchPathFunc; - alias BOOL function(HANDLE hProcess, DWORD64 Address) SymUnloadModule64Func; - alias BOOL function(HANDLE hProcess, ULONG ActionCode, ulong CallbackContext, ulong UserContext) PSYMBOL_REGISTERED_CALLBACK64; - alias BOOL function(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext) SymRegisterCallback64Func; - alias API_VERSION* function() ImagehlpApiVersionFunc; + GetModuleBaseProc64 GetModuleBaseRoutine, TranslateAddressProc64 TranslateAddress) @nogc; + alias SymGetLineFromAddr64Func = BOOL function(HANDLE hProcess, DWORD64 dwAddr, PDWORD pdwDisplacement, IMAGEHLP_LINEA64 *line); + alias SymGetModuleBase64Func = DWORD64 function(HANDLE hProcess, DWORD64 dwAddr); + alias SymGetModuleInfo64Func = BOOL function(HANDLE hProcess, DWORD64 dwAddr, IMAGEHLP_MODULEA64 *ModuleInfo); + alias SymGetSymFromAddr64Func = BOOL function(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, IMAGEHLP_SYMBOLA64 *Symbol); + alias UnDecorateSymbolNameFunc = DWORD function(PCSTR DecoratedName, PSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags); + alias SymLoadModule64Func = DWORD64 function(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll); + alias SymGetSearchPathFunc = BOOL function(HANDLE hProcess, PSTR SearchPath, DWORD SearchPathLength); + alias SymSetSearchPathFunc = BOOL function(HANDLE hProcess, PCSTR SearchPath); + alias SymUnloadModule64Func = BOOL function(HANDLE hProcess, DWORD64 Address); + alias PSYMBOL_REGISTERED_CALLBACK64 = BOOL function(HANDLE hProcess, ULONG ActionCode, ulong CallbackContext, ulong UserContext); + alias SymRegisterCallback64Func = BOOL function(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext); + alias ImagehlpApiVersionFunc = API_VERSION* function(); } struct DbgHelp diff --git a/runtime/druntime/src/core/sys/windows/dbghelp_types.d b/runtime/druntime/src/core/sys/windows/dbghelp_types.d index f75f98bc882..f31271037c6 100644 --- a/runtime/druntime/src/core/sys/windows/dbghelp_types.d +++ b/runtime/druntime/src/core/sys/windows/dbghelp_types.d @@ -222,13 +222,13 @@ struct API_VERSION version (Unicode) { - alias IMAGEHLP_LINEW64 IMAGEHLP_LINE64; - alias IMAGEHLP_MODULEW64 IMAGEHLP_MODULE64; - alias IMAGEHLP_SYMBOLW64 IMAGEHLP_SYMBOL64; + alias IMAGEHLP_LINE64 = IMAGEHLP_LINEW64; + alias IMAGEHLP_MODULE64 = IMAGEHLP_MODULEW64; + alias IMAGEHLP_SYMBOL64 = IMAGEHLP_SYMBOLW64; } else { - alias IMAGEHLP_LINEA64 IMAGEHLP_LINE64; - alias IMAGEHLP_MODULEA64 IMAGEHLP_MODULE64; - alias IMAGEHLP_SYMBOLA64 IMAGEHLP_SYMBOL64; + alias IMAGEHLP_LINE64 = IMAGEHLP_LINEA64; + alias IMAGEHLP_MODULE64 = IMAGEHLP_MODULEA64; + alias IMAGEHLP_SYMBOL64 = IMAGEHLP_SYMBOLA64; } diff --git a/runtime/druntime/src/core/sys/windows/dbt.d b/runtime/druntime/src/core/sys/windows/dbt.d index 41f1c32a419..c865fe25586 100644 --- a/runtime/druntime/src/core/sys/windows/dbt.d +++ b/runtime/druntime/src/core/sys/windows/dbt.d @@ -97,7 +97,7 @@ struct DEV_BROADCAST_HDR { DWORD dbch_devicetype; DWORD dbch_reserved; } -alias DEV_BROADCAST_HDR* PDEV_BROADCAST_HDR; +alias PDEV_BROADCAST_HDR = DEV_BROADCAST_HDR*; struct DEV_BROADCAST_OEM { DWORD dbco_size = DEV_BROADCAST_OEM.sizeof; @@ -106,7 +106,7 @@ struct DEV_BROADCAST_OEM { DWORD dbco_identifier; DWORD dbco_suppfunc; } -alias DEV_BROADCAST_OEM* PDEV_BROADCAST_OEM; +alias PDEV_BROADCAST_OEM = DEV_BROADCAST_OEM*; struct DEV_BROADCAST_PORT_A { DWORD dbcp_size = DEV_BROADCAST_PORT_A.sizeof; @@ -115,7 +115,7 @@ struct DEV_BROADCAST_PORT_A { char _dbcp_name = 0; char* dbcp_name() return { return &_dbcp_name; } } -alias DEV_BROADCAST_PORT_A* PDEV_BROADCAST_PORT_A; +alias PDEV_BROADCAST_PORT_A = DEV_BROADCAST_PORT_A*; struct DEV_BROADCAST_PORT_W { DWORD dbcp_size = DEV_BROADCAST_PORT_W.sizeof; @@ -124,7 +124,7 @@ struct DEV_BROADCAST_PORT_W { WCHAR _dbcp_name = 0; WCHAR* dbcp_name() return { return &_dbcp_name; } } -alias DEV_BROADCAST_PORT_W* PDEV_BROADCAST_PORT_W; +alias PDEV_BROADCAST_PORT_W = DEV_BROADCAST_PORT_W*; struct DEV_BROADCAST_USERDEFINED { DEV_BROADCAST_HDR dbud_dbh; @@ -139,14 +139,14 @@ struct DEV_BROADCAST_VOLUME { DWORD dbcv_unitmask; WORD dbcv_flags; } -alias DEV_BROADCAST_VOLUME* PDEV_BROADCAST_VOLUME; +alias PDEV_BROADCAST_VOLUME = DEV_BROADCAST_VOLUME*; version (Unicode) { - alias DEV_BROADCAST_PORT_W DEV_BROADCAST_PORT; + alias DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_W; } else { - alias DEV_BROADCAST_PORT_A DEV_BROADCAST_PORT; + alias DEV_BROADCAST_PORT = DEV_BROADCAST_PORT_A; } -alias DEV_BROADCAST_PORT* PDEV_BROADCAST_PORT; +alias PDEV_BROADCAST_PORT = DEV_BROADCAST_PORT*; //static if (_WIN32_WINNT >= 0x500) { struct DEV_BROADCAST_DEVICEINTERFACE_A { @@ -157,7 +157,7 @@ alias DEV_BROADCAST_PORT* PDEV_BROADCAST_PORT; char _dbcc_name; char* dbcc_name() return { return &_dbcc_name; } } - alias DEV_BROADCAST_DEVICEINTERFACE_A* PDEV_BROADCAST_DEVICEINTERFACE_A; + alias PDEV_BROADCAST_DEVICEINTERFACE_A = DEV_BROADCAST_DEVICEINTERFACE_A*; struct DEV_BROADCAST_DEVICEINTERFACE_W { DWORD dbcc_size = DEV_BROADCAST_DEVICEINTERFACE_W.sizeof; @@ -167,14 +167,14 @@ alias DEV_BROADCAST_PORT* PDEV_BROADCAST_PORT; WCHAR _dbcc_name = 0; WCHAR* dbcc_name() return { return &_dbcc_name; } } - alias DEV_BROADCAST_DEVICEINTERFACE_W* PDEV_BROADCAST_DEVICEINTERFACE_W; + alias PDEV_BROADCAST_DEVICEINTERFACE_W = DEV_BROADCAST_DEVICEINTERFACE_W*; version (Unicode) { - alias DEV_BROADCAST_DEVICEINTERFACE_W DEV_BROADCAST_DEVICEINTERFACE; + alias DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_W; } else { - alias DEV_BROADCAST_DEVICEINTERFACE_A DEV_BROADCAST_DEVICEINTERFACE; + alias DEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE_A; } - alias DEV_BROADCAST_DEVICEINTERFACE* PDEV_BROADCAST_DEVICEINTERFACE; + alias PDEV_BROADCAST_DEVICEINTERFACE = DEV_BROADCAST_DEVICEINTERFACE*; struct DEV_BROADCAST_HANDLE { DWORD dbch_size = DEV_BROADCAST_HANDLE.sizeof; @@ -187,5 +187,5 @@ alias DEV_BROADCAST_PORT* PDEV_BROADCAST_PORT; BYTE _dbch_data; BYTE* dbch_data() return { return &_dbch_data; } } - alias DEV_BROADCAST_HANDLE* PDEV_BROADCAST_HANDLE; + alias PDEV_BROADCAST_HANDLE = DEV_BROADCAST_HANDLE*; //} diff --git a/runtime/druntime/src/core/sys/windows/ddeml.d b/runtime/druntime/src/core/sys/windows/ddeml.d index 0ff1a3f4f1e..8dafb0ed90b 100644 --- a/runtime/druntime/src/core/sys/windows/ddeml.d +++ b/runtime/druntime/src/core/sys/windows/ddeml.d @@ -206,14 +206,14 @@ enum : int { MH_CLEANUP = 4 } -extern (Windows) alias HDDEDATA - function(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR) PFNCALLBACK; +extern (Windows) alias PFNCALLBACK = HDDEDATA + function(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR); struct HSZPAIR { HSZ hszSvc; HSZ hszTopic; } -alias HSZPAIR* PHSZPAIR; +alias PHSZPAIR = HSZPAIR*; struct CONVCONTEXT { UINT cb = CONVCONTEXT.sizeof; @@ -224,7 +224,7 @@ struct CONVCONTEXT { DWORD dwSecurity; SECURITY_QUALITY_OF_SERVICE qos; } -alias CONVCONTEXT* PCONVCONTEXT; +alias PCONVCONTEXT = CONVCONTEXT*; struct CONVINFO { DWORD cb = CONVINFO.sizeof; @@ -244,7 +244,7 @@ struct CONVINFO { HWND hwnd; HWND hwndPartner; } -alias CONVINFO* PCONVINFO; +alias PCONVINFO = CONVINFO*; struct DDEML_MSG_HOOK_DATA { UINT_PTR uiLo; @@ -263,7 +263,7 @@ struct MONHSZSTRUCT { TCHAR* str() return { return _str.ptr; } } -alias MONHSZSTRUCT* PMONHSZSTRUCT; +alias PMONHSZSTRUCT = MONHSZSTRUCT*; struct MONLINKSTRUCT { UINT cb = MONLINKSTRUCT.sizeof; @@ -279,7 +279,7 @@ struct MONLINKSTRUCT { HCONV hConvServer; HCONV hConvClient; } -alias MONLINKSTRUCT* PMONLINKSTRUCT; +alias PMONLINKSTRUCT = MONLINKSTRUCT*; struct MONCONVSTRUCT { UINT cb = MONCONVSTRUCT.sizeof; @@ -291,7 +291,7 @@ struct MONCONVSTRUCT { HCONV hConvClient; HCONV hConvServer; } -alias MONCONVSTRUCT* PMONCONVSTRUCT; +alias PMONCONVSTRUCT = MONCONVSTRUCT*; struct MONCBSTRUCT { UINT cb = MONCBSTRUCT.sizeof; @@ -310,7 +310,7 @@ struct MONCBSTRUCT { DWORD cbData; DWORD[8] Data; } -alias MONCBSTRUCT* PMONCBSTRUCT; +alias PMONCBSTRUCT = MONCBSTRUCT*; struct MONERRSTRUCT { UINT cb = MONERRSTRUCT.sizeof; @@ -318,7 +318,7 @@ struct MONERRSTRUCT { DWORD dwTime; HANDLE hTask; } -alias MONERRSTRUCT* PMONERRSTRUCT; +alias PMONERRSTRUCT = MONERRSTRUCT*; struct MONMSGSTRUCT { UINT cb = MONMSGSTRUCT.sizeof; @@ -330,7 +330,7 @@ struct MONMSGSTRUCT { LPARAM lParam; DDEML_MSG_HOOK_DATA dmhd; } -alias MONMSGSTRUCT* PMONMSGSTRUCT; +alias PMONMSGSTRUCT = MONMSGSTRUCT*; extern (Windows) nothrow @nogc { BOOL DdeAbandonTransaction(DWORD, HCONV, DWORD); @@ -379,11 +379,11 @@ const TCHAR[] SZDDE_ITEM_ITEMLIST = "TopicItemList"; version (Unicode) { - alias DdeCreateStringHandleW DdeCreateStringHandle; - alias DdeInitializeW DdeInitialize; - alias DdeQueryStringW DdeQueryString; + alias DdeCreateStringHandle = DdeCreateStringHandleW; + alias DdeInitialize = DdeInitializeW; + alias DdeQueryString = DdeQueryStringW; } else { - alias DdeCreateStringHandleA DdeCreateStringHandle; - alias DdeInitializeA DdeInitialize; - alias DdeQueryStringA DdeQueryString; + alias DdeCreateStringHandle = DdeCreateStringHandleA; + alias DdeInitialize = DdeInitializeA; + alias DdeQueryString = DdeQueryStringA; } diff --git a/runtime/druntime/src/core/sys/windows/dhcpcsdk.d b/runtime/druntime/src/core/sys/windows/dhcpcsdk.d index 6171469c8c7..9cb80193353 100644 --- a/runtime/druntime/src/core/sys/windows/dhcpcsdk.d +++ b/runtime/druntime/src/core/sys/windows/dhcpcsdk.d @@ -28,7 +28,7 @@ struct DHCPCAPI_CLASSID { LPBYTE Data; ULONG nBytesData; } -alias DHCPCAPI_CLASSID* PDHCPCAPI_CLASSID, LPDHCPCAPI_CLASSID; +alias PDHCPCAPI_CLASSID = DHCPCAPI_CLASSID*, LPDHCPCAPI_CLASSID = DHCPCAPI_CLASSID*; struct DHCPAPI_PARAMS { ULONG Flags; @@ -37,13 +37,13 @@ struct DHCPAPI_PARAMS { LPBYTE Data; DWORD nBytesData; } -alias DHCPAPI_PARAMS* PDHCPAPI_PARAMS, LPDHCPAPI_PARAMS; +alias PDHCPAPI_PARAMS = DHCPAPI_PARAMS*, LPDHCPAPI_PARAMS = DHCPAPI_PARAMS*; struct DHCPCAPI_PARAMS_ARRAY { ULONG nParams; LPDHCPAPI_PARAMS Params; } -alias DHCPCAPI_PARAMS_ARRAY* PDHCPCAPI_PARAMS_ARRAY, LPDHCPCAPI_PARAMS_ARRAY; +alias PDHCPCAPI_PARAMS_ARRAY = DHCPCAPI_PARAMS_ARRAY*, LPDHCPCAPI_PARAMS_ARRAY = DHCPCAPI_PARAMS_ARRAY*; extern (Windows) nothrow @nogc { void DhcpCApiCleanup(); diff --git a/runtime/druntime/src/core/sys/windows/dll.d b/runtime/druntime/src/core/sys/windows/dll.d index 07eadc7e28c..fd2234253f0 100644 --- a/runtime/druntime/src/core/sys/windows/dll.d +++ b/runtime/druntime/src/core/sys/windows/dll.d @@ -34,9 +34,9 @@ extern (C) extern __gshared byte _tls_start; extern __gshared byte _tls_end; extern __gshared void* __xl_a; - alias _tls_start _tlsstart; - alias _tls_end _tlsend; - alias __xl_a _tls_callbacks_a; + alias _tlsstart = _tls_start; + alias _tlsend = _tls_end; + alias _tls_callbacks_a = __xl_a; } extern __gshared int _tls_index; } @@ -221,7 +221,7 @@ version (Win32) } } // Win32 - alias bool BOOLEAN; + alias BOOLEAN = bool; struct UNICODE_STRING { diff --git a/runtime/druntime/src/core/sys/windows/docobj.d b/runtime/druntime/src/core/sys/windows/docobj.d index 4abbea31241..f4f247fd094 100644 --- a/runtime/druntime/src/core/sys/windows/docobj.d +++ b/runtime/druntime/src/core/sys/windows/docobj.d @@ -81,8 +81,8 @@ struct OLECMD { DWORD cmdf; } -alias IOleInPlaceSite LPOLEINPLACESITE; -alias IEnumOleDocumentViews LPENUMOLEDOCUMENTVIEWS; +alias LPOLEINPLACESITE = IOleInPlaceSite; +alias LPENUMOLEDOCUMENTVIEWS = IEnumOleDocumentViews; extern (C) extern const IID IID_IContinueCallback, diff --git a/runtime/druntime/src/core/sys/windows/errorrep.d b/runtime/druntime/src/core/sys/windows/errorrep.d index 840ea61f3ce..f50c0e5ccb6 100644 --- a/runtime/druntime/src/core/sys/windows/errorrep.d +++ b/runtime/druntime/src/core/sys/windows/errorrep.d @@ -36,7 +36,7 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias AddERExcludedApplicationW AddERExcludedApplication; + alias AddERExcludedApplication = AddERExcludedApplicationW; } else { - alias AddERExcludedApplicationA AddERExcludedApplication; + alias AddERExcludedApplication = AddERExcludedApplicationA; } diff --git a/runtime/druntime/src/core/sys/windows/httpext.d b/runtime/druntime/src/core/sys/windows/httpext.d index b7f6aedcbdc..1994ebde5c7 100644 --- a/runtime/druntime/src/core/sys/windows/httpext.d +++ b/runtime/druntime/src/core/sys/windows/httpext.d @@ -53,7 +53,7 @@ struct HSE_VERSION_INFO { DWORD dwExtensionVersion; CHAR[HSE_MAX_EXT_DLL_NAME_LEN] lpszExtensionDesc = 0; } -alias HSE_VERSION_INFO* LPHSE_VERSION_INFO; +alias LPHSE_VERSION_INFO = HSE_VERSION_INFO*; struct EXTENSION_CONTROL_BLOCK { DWORD cbSize = EXTENSION_CONTROL_BLOCK.sizeof; @@ -76,13 +76,13 @@ struct EXTENSION_CONTROL_BLOCK { BOOL function(HCONN, DWORD, LPVOID, LPDWORD, LPDWORD) ServerSupportFunction; } } -alias EXTENSION_CONTROL_BLOCK* LPEXTENSION_CONTROL_BLOCK; +alias LPEXTENSION_CONTROL_BLOCK = EXTENSION_CONTROL_BLOCK*; extern (Windows) { - alias BOOL function(HSE_VERSION_INFO*) PFN_GETEXTENSIONVERSION; - alias DWORD function(EXTENSION_CONTROL_BLOCK*) PFN_HTTPEXTENSIONPROC; - alias BOOL function(DWORD) PFN_TERMINATEEXTENSION; - alias VOID function(EXTENSION_CONTROL_BLOCK*, PVOID, DWORD, DWORD) PFN_HSE_IO_COMPLETION; + alias PFN_GETEXTENSIONVERSION = BOOL function(HSE_VERSION_INFO*); + alias PFN_HTTPEXTENSIONPROC = DWORD function(EXTENSION_CONTROL_BLOCK*); + alias PFN_TERMINATEEXTENSION = BOOL function(DWORD); + alias PFN_HSE_IO_COMPLETION = VOID function(EXTENSION_CONTROL_BLOCK*, PVOID, DWORD, DWORD); } struct HSE_TF_INFO { @@ -98,7 +98,7 @@ struct HSE_TF_INFO { DWORD TailLength; DWORD dwFlags; } -alias HSE_TF_INFO* LPHSE_TF_INFO; +alias LPHSE_TF_INFO = HSE_TF_INFO*; struct HSE_SEND_HEADER_EX_INFO { LPCSTR pszStatus; @@ -107,7 +107,7 @@ struct HSE_SEND_HEADER_EX_INFO { DWORD cchHeader; BOOL fKeepConn; } -alias HSE_SEND_HEADER_EX_INFO* LPHSE_SEND_HEADER_EX_INF; +alias LPHSE_SEND_HEADER_EX_INF = HSE_SEND_HEADER_EX_INFO*; extern (Windows) nothrow @nogc { BOOL GetExtensionVersion(HSE_VERSION_INFO*); diff --git a/runtime/druntime/src/core/sys/windows/imagehlp.d b/runtime/druntime/src/core/sys/windows/imagehlp.d index c6d28e68fd1..0c900a69478 100644 --- a/runtime/druntime/src/core/sys/windows/imagehlp.d +++ b/runtime/druntime/src/core/sys/windows/imagehlp.d @@ -122,7 +122,7 @@ struct LOADED_IMAGE { LIST_ENTRY Links; ULONG SizeOfImage; } -alias LOADED_IMAGE* PLOADED_IMAGE; +alias PLOADED_IMAGE = LOADED_IMAGE*; struct IMAGE_DEBUG_INFORMATION { LIST_ENTRY List; @@ -156,7 +156,7 @@ struct IMAGE_DEBUG_INFORMATION { DWORD NumberOfDebugDirectories; DWORD[3] Reserved; } -alias IMAGE_DEBUG_INFORMATION* PIMAGE_DEBUG_INFORMATION; +alias PIMAGE_DEBUG_INFORMATION = IMAGE_DEBUG_INFORMATION*; enum ADDRESS_MODE { AddrMode1616, @@ -170,7 +170,7 @@ struct ADDRESS { WORD Segment; ADDRESS_MODE Mode; } -alias ADDRESS* LPADDRESS; +alias LPADDRESS = ADDRESS*; struct KDHELP { DWORD Thread; @@ -186,7 +186,7 @@ struct KDHELP { DWORD StackLimit; DWORD[5] Reserved; } -alias KDHELP* PKDHELP; +alias PKDHELP = KDHELP*; struct STACKFRAME { ADDRESS AddrPC; @@ -201,7 +201,7 @@ struct STACKFRAME { KDHELP KdHelp; ADDRESS AddrBStore; } -alias STACKFRAME* LPSTACKFRAME; +alias LPSTACKFRAME = STACKFRAME*; /* struct API_VERSION { @@ -212,7 +212,7 @@ struct API_VERSION { } */ public import core.sys.windows.dbghelp_types : API_VERSION; -alias API_VERSION* LPAPI_VERSION; +alias LPAPI_VERSION = API_VERSION*; enum SYM_TYPE { SymNone, @@ -232,7 +232,7 @@ struct IMAGEHLP_SYMBOL { DWORD MaxNameLength; CHAR[1] Name = 0; } -alias IMAGEHLP_SYMBOL* PIMAGEHLP_SYMBOL; +alias PIMAGEHLP_SYMBOL = IMAGEHLP_SYMBOL*; struct IMAGEHLP_MODULE { DWORD SizeOfStruct; @@ -246,7 +246,7 @@ struct IMAGEHLP_MODULE { CHAR[256] ImageName = 0; CHAR[256] LoadedImageName = 0; } -alias IMAGEHLP_MODULE* PIMAGEHLP_MODULE; +alias PIMAGEHLP_MODULE = IMAGEHLP_MODULE*; struct IMAGEHLP_LINE { DWORD SizeOfStruct; @@ -255,7 +255,7 @@ struct IMAGEHLP_LINE { PCHAR FileName; DWORD Address; } -alias IMAGEHLP_LINE* PIMAGEHLP_LINE; +alias PIMAGEHLP_LINE = IMAGEHLP_LINE*; struct IMAGEHLP_DEFERRED_SYMBOL_LOAD { DWORD SizeOfStruct; @@ -265,7 +265,7 @@ struct IMAGEHLP_DEFERRED_SYMBOL_LOAD { CHAR[MAX_PATH] FileName = 0; BOOLEAN Reparse; } -alias IMAGEHLP_DEFERRED_SYMBOL_LOAD* PIMAGEHLP_DEFERRED_SYMBOL_LOAD; +alias PIMAGEHLP_DEFERRED_SYMBOL_LOAD = IMAGEHLP_DEFERRED_SYMBOL_LOAD*; struct IMAGEHLP_DUPLICATE_SYMBOL { DWORD SizeOfStruct; @@ -273,27 +273,21 @@ struct IMAGEHLP_DUPLICATE_SYMBOL { PIMAGEHLP_SYMBOL Symbol; ULONG SelectedSymbol; } -alias IMAGEHLP_DUPLICATE_SYMBOL* PIMAGEHLP_DUPLICATE_SYMBOL; +alias PIMAGEHLP_DUPLICATE_SYMBOL = IMAGEHLP_DUPLICATE_SYMBOL*; alias DIGEST_HANDLE = HANDLE; extern (Windows) { - alias BOOL function(IMAGEHLP_STATUS_REASON, LPSTR, LPSTR, ULONG_PTR, ULONG_PTR) - PIMAGEHLP_STATUS_ROUTINE; - alias BOOL function(HANDLE , LPCVOID, LPVOID, DWORD, LPDWORD) - PREAD_PROCESS_MEMORY_ROUTINE; - alias LPVOID function(HANDLE, DWORD) PFUNCTION_TABLE_ACCESS_ROUTINE; - alias DWORD function(HANDLE, DWORD) PGET_MODULE_BASE_ROUTINE; - alias DWORD function(HANDLE, HANDLE, LPADDRESS) - PTRANSLATE_ADDRESS_ROUTINE; - alias BOOL function(LPSTR, ULONG, PVOID) PSYM_ENUMMODULES_CALLBACK; - alias BOOL function(LPSTR, ULONG, ULONG, PVOID) PSYM_ENUMSYMBOLS_CALLBACK; - alias BOOL function(LPSTR, ULONG, ULONG, PVOID) - PENUMLOADED_MODULES_CALLBACK; - alias BOOL function(HANDLE, ULONG, PVOID, PVOID) - PSYMBOL_REGISTERED_CALLBACK; - alias BOOL function(DIGEST_HANDLE refdata, PBYTE pData, DWORD dwLength) - DIGEST_FUNCTION; + alias PIMAGEHLP_STATUS_ROUTINE = BOOL function(IMAGEHLP_STATUS_REASON, LPSTR, LPSTR, ULONG_PTR, ULONG_PTR); + alias PREAD_PROCESS_MEMORY_ROUTINE = BOOL function(HANDLE , LPCVOID, LPVOID, DWORD, LPDWORD); + alias PFUNCTION_TABLE_ACCESS_ROUTINE = LPVOID function(HANDLE, DWORD); + alias PGET_MODULE_BASE_ROUTINE = DWORD function(HANDLE, DWORD); + alias PTRANSLATE_ADDRESS_ROUTINE = DWORD function(HANDLE, HANDLE, LPADDRESS); + alias PSYM_ENUMMODULES_CALLBACK = BOOL function(LPSTR, ULONG, PVOID); + alias PSYM_ENUMSYMBOLS_CALLBACK = BOOL function(LPSTR, ULONG, ULONG, PVOID); + alias PENUMLOADED_MODULES_CALLBACK = BOOL function(LPSTR, ULONG, ULONG, PVOID); + alias PSYMBOL_REGISTERED_CALLBACK = BOOL function(HANDLE, ULONG, PVOID, PVOID); + alias DIGEST_FUNCTION = BOOL function(DIGEST_HANDLE refdata, PBYTE pData, DWORD dwLength); nothrow @nogc: PIMAGE_NT_HEADERS CheckSumMappedFile(LPVOID, DWORD, LPDWORD, LPDWORD); @@ -374,7 +368,7 @@ nothrow @nogc: } version (Unicode) { - alias MapFileAndCheckSumW MapFileAndCheckSum; + alias MapFileAndCheckSum = MapFileAndCheckSumW; } else { - alias MapFileAndCheckSumA MapFileAndCheckSum; + alias MapFileAndCheckSum = MapFileAndCheckSumA; } diff --git a/runtime/druntime/src/core/sys/windows/imm.d b/runtime/druntime/src/core/sys/windows/imm.d index 4ad678c9b4d..5cdea4286cd 100644 --- a/runtime/druntime/src/core/sys/windows/imm.d +++ b/runtime/druntime/src/core/sys/windows/imm.d @@ -276,16 +276,16 @@ enum IMFS_DEFAULT=MFS_DEFAULT; enum STYLE_DESCRIPTION_SIZE=32; -alias DWORD HIMC; -alias DWORD HIMCC; -alias HKL* LPHKL; +alias HIMC = DWORD; +alias HIMCC = DWORD; +alias LPHKL = HKL*; struct COMPOSITIONFORM{ DWORD dwStyle; POINT ptCurrentPos; RECT rcArea; } -alias COMPOSITIONFORM* PCOMPOSITIONFORM, LPCOMPOSITIONFORM; +alias PCOMPOSITIONFORM = COMPOSITIONFORM*, LPCOMPOSITIONFORM = COMPOSITIONFORM*; struct CANDIDATEFORM{ DWORD dwIndex; @@ -293,7 +293,7 @@ struct CANDIDATEFORM{ POINT ptCurrentPos; RECT rcArea; } -alias CANDIDATEFORM* PCANDIDATEFORM, LPCANDIDATEFORM; +alias PCANDIDATEFORM = CANDIDATEFORM*, LPCANDIDATEFORM = CANDIDATEFORM*; struct CANDIDATELIST{ DWORD dwSize; @@ -304,31 +304,31 @@ struct CANDIDATELIST{ DWORD dwPageSize; DWORD[1] dwOffset; } -alias CANDIDATELIST* PCANDIDATELIST, LPCANDIDATELIST; +alias PCANDIDATELIST = CANDIDATELIST*, LPCANDIDATELIST = CANDIDATELIST*; struct REGISTERWORDA{ LPSTR lpReading; LPSTR lpWord; } -alias REGISTERWORDA* PREGISTERWORDA, LPREGISTERWORDA; +alias PREGISTERWORDA = REGISTERWORDA*, LPREGISTERWORDA = REGISTERWORDA*; struct REGISTERWORDW{ LPWSTR lpReading; LPWSTR lpWord; } -alias REGISTERWORDW* PREGISTERWORDW, LPREGISTERWORDW; +alias PREGISTERWORDW = REGISTERWORDW*, LPREGISTERWORDW = REGISTERWORDW*; struct STYLEBUFA{ DWORD dwStyle; CHAR[STYLE_DESCRIPTION_SIZE] szDescription = 0; } -alias STYLEBUFA* PSTYLEBUFA, LPSTYLEBUFA; +alias PSTYLEBUFA = STYLEBUFA*, LPSTYLEBUFA = STYLEBUFA*; struct STYLEBUFW{ DWORD dwStyle; WCHAR[STYLE_DESCRIPTION_SIZE] szDescription = 0; } -alias STYLEBUFW* PSTYLEBUFW, LPSTYLEBUFW; +alias PSTYLEBUFW = STYLEBUFW*, LPSTYLEBUFW = STYLEBUFW*; struct IMEMENUITEMINFOA{ UINT cbSize = this.sizeof; @@ -341,7 +341,7 @@ struct IMEMENUITEMINFOA{ CHAR[IMEMENUITEM_STRING_SIZE] szString = 0; HBITMAP hbmpItem; } -alias IMEMENUITEMINFOA* PIMEMENUITEMINFOA, LPIMEMENUITEMINFOA; +alias PIMEMENUITEMINFOA = IMEMENUITEMINFOA*, LPIMEMENUITEMINFOA = IMEMENUITEMINFOA*; struct IMEMENUITEMINFOW{ UINT cbSize = this.sizeof; @@ -354,28 +354,28 @@ struct IMEMENUITEMINFOW{ WCHAR[IMEMENUITEM_STRING_SIZE] szString = 0; HBITMAP hbmpItem; } -alias IMEMENUITEMINFOW* PIMEMENUITEMINFOW, LPIMEMENUITEMINFOW; +alias PIMEMENUITEMINFOW = IMEMENUITEMINFOW*, LPIMEMENUITEMINFOW = IMEMENUITEMINFOW*; extern (Windows) { -alias int function (LPCSTR, DWORD, LPCSTR, LPVOID) REGISTERWORDENUMPROCA; -alias int function (LPCWSTR, DWORD, LPCWSTR, LPVOID) REGISTERWORDENUMPROCW; +alias REGISTERWORDENUMPROCA = int function (LPCSTR, DWORD, LPCSTR, LPVOID); +alias REGISTERWORDENUMPROCW = int function (LPCWSTR, DWORD, LPCWSTR, LPVOID); } version (Unicode) { - alias REGISTERWORDENUMPROCW REGISTERWORDENUMPROC; - alias REGISTERWORDW REGISTERWORD; - alias IMEMENUITEMINFOW IMEMENUITEMINFO; - alias STYLEBUFW STYLEBUF; + alias REGISTERWORDENUMPROC = REGISTERWORDENUMPROCW; + alias REGISTERWORD = REGISTERWORDW; + alias IMEMENUITEMINFO = IMEMENUITEMINFOW; + alias STYLEBUF = STYLEBUFW; } else { - alias REGISTERWORDENUMPROCA REGISTERWORDENUMPROC; - alias REGISTERWORDA REGISTERWORD; - alias IMEMENUITEMINFOA IMEMENUITEMINFO; - alias STYLEBUFA STYLEBUF; + alias REGISTERWORDENUMPROC = REGISTERWORDENUMPROCA; + alias REGISTERWORD = REGISTERWORDA; + alias IMEMENUITEMINFO = IMEMENUITEMINFOA; + alias STYLEBUF = STYLEBUFA; } -alias STYLEBUF* PSTYLEBUF, LPSTYLEBUF; -alias REGISTERWORD* PREGISTERWORD, LPREGISTERWORD; -alias IMEMENUITEMINFO* PIMEMENUITEMINFO, LPIMEMENUITEMINFO; +alias PSTYLEBUF = STYLEBUF*, LPSTYLEBUF = STYLEBUF*; +alias PREGISTERWORD = REGISTERWORD*, LPREGISTERWORD = REGISTERWORD*; +alias PIMEMENUITEMINFO = IMEMENUITEMINFO*, LPIMEMENUITEMINFO = IMEMENUITEMINFO*; extern (Windows): @@ -444,43 +444,43 @@ DWORD ImmGetImeMenuItemsA(HIMC, DWORD, DWORD, LPIMEMENUITEMINFOA, LPIMEMENUITEMI DWORD ImmGetImeMenuItemsW(HIMC, DWORD, DWORD, LPIMEMENUITEMINFOW, LPIMEMENUITEMINFOW, DWORD); version (Unicode) { - alias ImmEnumRegisterWordW ImmEnumRegisterWord; - alias ImmGetRegisterWordStyleW ImmGetRegisterWordStyle; - alias ImmUnregisterWordW ImmUnregisterWord; - alias ImmRegisterWordW ImmRegisterWord; - alias ImmInstallIMEW ImmInstallIME; - alias ImmIsUIMessageW ImmIsUIMessage; - alias ImmGetConversionListW ImmGetConversionList; - alias ImmEscapeW ImmEscape; - alias ImmConfigureIMEW ImmConfigureIME; - alias ImmSetCompositionFontW ImmSetCompositionFont; - alias ImmGetCompositionFontW ImmGetCompositionFont; - alias ImmGetGuideLineW ImmGetGuideLine; - alias ImmGetCandidateListW ImmGetCandidateList; - alias ImmGetCandidateListCountW ImmGetCandidateListCount; - alias ImmSetCompositionStringW ImmSetCompositionString; - alias ImmGetCompositionStringW ImmGetCompositionString; - alias ImmGetDescriptionW ImmGetDescription; - alias ImmGetIMEFileNameW ImmGetIMEFileName; - alias ImmGetImeMenuItemsW ImmGetImeMenuItems; + alias ImmEnumRegisterWord = ImmEnumRegisterWordW; + alias ImmGetRegisterWordStyle = ImmGetRegisterWordStyleW; + alias ImmUnregisterWord = ImmUnregisterWordW; + alias ImmRegisterWord = ImmRegisterWordW; + alias ImmInstallIME = ImmInstallIMEW; + alias ImmIsUIMessage = ImmIsUIMessageW; + alias ImmGetConversionList = ImmGetConversionListW; + alias ImmEscape = ImmEscapeW; + alias ImmConfigureIME = ImmConfigureIMEW; + alias ImmSetCompositionFont = ImmSetCompositionFontW; + alias ImmGetCompositionFont = ImmGetCompositionFontW; + alias ImmGetGuideLine = ImmGetGuideLineW; + alias ImmGetCandidateList = ImmGetCandidateListW; + alias ImmGetCandidateListCount = ImmGetCandidateListCountW; + alias ImmSetCompositionString = ImmSetCompositionStringW; + alias ImmGetCompositionString = ImmGetCompositionStringW; + alias ImmGetDescription = ImmGetDescriptionW; + alias ImmGetIMEFileName = ImmGetIMEFileNameW; + alias ImmGetImeMenuItems = ImmGetImeMenuItemsW; } else { - alias ImmEnumRegisterWordA ImmEnumRegisterWord; - alias ImmGetRegisterWordStyleA ImmGetRegisterWordStyle; - alias ImmUnregisterWordA ImmUnregisterWord; - alias ImmRegisterWordA ImmRegisterWord; - alias ImmInstallIMEA ImmInstallIME; - alias ImmIsUIMessageA ImmIsUIMessage; - alias ImmGetConversionListA ImmGetConversionList; - alias ImmEscapeA ImmEscape; - alias ImmConfigureIMEA ImmConfigureIME; - alias ImmSetCompositionFontA ImmSetCompositionFont; - alias ImmGetCompositionFontA ImmGetCompositionFont; - alias ImmGetGuideLineA ImmGetGuideLine; - alias ImmGetCandidateListA ImmGetCandidateList; - alias ImmGetCandidateListCountA ImmGetCandidateListCount; - alias ImmSetCompositionStringA ImmSetCompositionString; - alias ImmGetCompositionStringA ImmGetCompositionString; - alias ImmGetDescriptionA ImmGetDescription; - alias ImmGetIMEFileNameA ImmGetIMEFileName; - alias ImmGetImeMenuItemsW ImmGetImeMenuItems; + alias ImmEnumRegisterWord = ImmEnumRegisterWordA; + alias ImmGetRegisterWordStyle = ImmGetRegisterWordStyleA; + alias ImmUnregisterWord = ImmUnregisterWordA; + alias ImmRegisterWord = ImmRegisterWordA; + alias ImmInstallIME = ImmInstallIMEA; + alias ImmIsUIMessage = ImmIsUIMessageA; + alias ImmGetConversionList = ImmGetConversionListA; + alias ImmEscape = ImmEscapeA; + alias ImmConfigureIME = ImmConfigureIMEA; + alias ImmSetCompositionFont = ImmSetCompositionFontA; + alias ImmGetCompositionFont = ImmGetCompositionFontA; + alias ImmGetGuideLine = ImmGetGuideLineA; + alias ImmGetCandidateList = ImmGetCandidateListA; + alias ImmGetCandidateListCount = ImmGetCandidateListCountA; + alias ImmSetCompositionString = ImmSetCompositionStringA; + alias ImmGetCompositionString = ImmGetCompositionStringA; + alias ImmGetDescription = ImmGetDescriptionA; + alias ImmGetIMEFileName = ImmGetIMEFileNameA; + alias ImmGetImeMenuItems = ImmGetImeMenuItemsW; } diff --git a/runtime/druntime/src/core/sys/windows/intshcut.d b/runtime/druntime/src/core/sys/windows/intshcut.d index cc4bf623542..d5630ea7d99 100644 --- a/runtime/druntime/src/core/sys/windows/intshcut.d +++ b/runtime/druntime/src/core/sys/windows/intshcut.d @@ -58,8 +58,8 @@ struct URLINVOKECOMMANDINFO { HWND hwndParent; PCSTR pcszVerb; } -alias URLINVOKECOMMANDINFO CURLINVOKECOMMANDINFO; -alias URLINVOKECOMMANDINFO* PURLINVOKECOMMANDINFO, PCURLINVOKECOMMANDINFO; +alias CURLINVOKECOMMANDINFO = URLINVOKECOMMANDINFO; +alias PURLINVOKECOMMANDINFO = URLINVOKECOMMANDINFO*, PCURLINVOKECOMMANDINFO = URLINVOKECOMMANDINFO*; interface IUniformResourceLocator : IUnknown { HRESULT SetURL(PCSTR, DWORD); @@ -67,8 +67,7 @@ interface IUniformResourceLocator : IUnknown { HRESULT InvokeCommand(PURLINVOKECOMMANDINFO); } //alias typeof(*(IUniformResourceLocator.init)) CIUniformResourceLocator; // value-type of interface not representable in D -alias IUniformResourceLocator PIUniformResourceLocator, - PCIUniformResourceLocator; +alias PIUniformResourceLocator = IUniformResourceLocator, PCIUniformResourceLocator = IUniformResourceLocator; extern (Windows) nothrow @nogc { BOOL InetIsOffline(DWORD); @@ -81,11 +80,11 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias TranslateURLW TranslateURL; - alias MIMEAssociationDialogW MIMEAssociationDialog; - alias URLAssociationDialogW URLAssociationDialog; + alias TranslateURL = TranslateURLW; + alias MIMEAssociationDialog = MIMEAssociationDialogW; + alias URLAssociationDialog = URLAssociationDialogW; } else { - alias TranslateURLA TranslateURL; - alias MIMEAssociationDialogA MIMEAssociationDialog; - alias URLAssociationDialogA URLAssociationDialog; + alias TranslateURL = TranslateURLA; + alias MIMEAssociationDialog = MIMEAssociationDialogA; + alias URLAssociationDialog = URLAssociationDialogA; } diff --git a/runtime/druntime/src/core/sys/windows/ipexport.d b/runtime/druntime/src/core/sys/windows/ipexport.d index b0a4a0151ab..f08e6e92239 100644 --- a/runtime/druntime/src/core/sys/windows/ipexport.d +++ b/runtime/druntime/src/core/sys/windows/ipexport.d @@ -63,7 +63,7 @@ enum : ubyte { enum ubyte MAX_OPT_SIZE = 40; -alias uint IPAddr, IPMask, IP_STATUS; +alias IPAddr = uint, IPMask = uint, IP_STATUS = uint; struct IP_OPTION_INFORMATION { ubyte Ttl; @@ -72,7 +72,7 @@ struct IP_OPTION_INFORMATION { ubyte OptionsSize; ubyte* OptionsData; } -alias IP_OPTION_INFORMATION* PIP_OPTION_INFORMATION; +alias PIP_OPTION_INFORMATION = IP_OPTION_INFORMATION*; struct ICMP_ECHO_REPLY { IPAddr Address; @@ -83,13 +83,13 @@ struct ICMP_ECHO_REPLY { void* Data; IP_OPTION_INFORMATION Options; } -alias ICMP_ECHO_REPLY* PICMP_ECHO_REPLY; +alias PICMP_ECHO_REPLY = ICMP_ECHO_REPLY*; struct IP_ADAPTER_INDEX_MAP { ULONG Index; WCHAR[MAX_ADAPTER_NAME] Name = 0; } -alias IP_ADAPTER_INDEX_MAP* PIP_ADAPTER_INDEX_MAP; +alias PIP_ADAPTER_INDEX_MAP = IP_ADAPTER_INDEX_MAP*; struct IP_INTERFACE_INFO { LONG NumAdapters; @@ -97,7 +97,7 @@ struct IP_INTERFACE_INFO { IP_ADAPTER_INDEX_MAP* Adapter() return { return _Adapter.ptr; } } -alias IP_INTERFACE_INFO* PIP_INTERFACE_INFO; +alias PIP_INTERFACE_INFO = IP_INTERFACE_INFO*; struct IP_UNIDIRECTIONAL_ADAPTER_ADDRESS { ULONG NumAdapters; @@ -105,4 +105,4 @@ struct IP_UNIDIRECTIONAL_ADAPTER_ADDRESS { IPAddr* Address() return { return _Address.ptr; } } -alias IP_UNIDIRECTIONAL_ADAPTER_ADDRESS* PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS; +alias PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS = IP_UNIDIRECTIONAL_ADAPTER_ADDRESS*; diff --git a/runtime/druntime/src/core/sys/windows/iprtrmib.d b/runtime/druntime/src/core/sys/windows/iprtrmib.d index 05c31b3dd07..58f8f34207d 100644 --- a/runtime/druntime/src/core/sys/windows/iprtrmib.d +++ b/runtime/druntime/src/core/sys/windows/iprtrmib.d @@ -63,7 +63,7 @@ struct MIB_IPADDRROW { ushort unused1; ushort unused2; } -alias MIB_IPADDRROW* PMIB_IPADDRROW; +alias PMIB_IPADDRROW = MIB_IPADDRROW*; struct MIB_IPADDRTABLE { DWORD dwNumEntries; @@ -71,7 +71,7 @@ struct MIB_IPADDRTABLE { MIB_IPADDRROW* table() return { return _table.ptr; } } -alias MIB_IPADDRTABLE* PMIB_IPADDRTABLE; +alias PMIB_IPADDRTABLE = MIB_IPADDRTABLE*; struct MIB_IPFORWARDROW { DWORD dwForwardDest; @@ -89,7 +89,7 @@ struct MIB_IPFORWARDROW { DWORD dwForwardMetric4; DWORD dwForwardMetric5; } -alias MIB_IPFORWARDROW* PMIB_IPFORWARDROW; +alias PMIB_IPFORWARDROW = MIB_IPFORWARDROW*; struct MIB_IPFORWARDTABLE { DWORD dwNumEntries; @@ -97,7 +97,7 @@ struct MIB_IPFORWARDTABLE { MIB_IPFORWARDROW* table() return { return _table.ptr; } } -alias MIB_IPFORWARDTABLE* PMIB_IPFORWARDTABLE; +alias PMIB_IPFORWARDTABLE = MIB_IPFORWARDTABLE*; struct MIB_IPNETROW { DWORD dwIndex; @@ -106,7 +106,7 @@ struct MIB_IPNETROW { DWORD dwAddr; DWORD dwType; } -alias MIB_IPNETROW* PMIB_IPNETROW; +alias PMIB_IPNETROW = MIB_IPNETROW*; struct MIB_IPNETTABLE { DWORD dwNumEntries; @@ -114,7 +114,7 @@ struct MIB_IPNETTABLE { MIB_IPNETROW* table() return { return _table.ptr; } } -alias MIB_IPNETTABLE* PMIB_IPNETTABLE; +alias PMIB_IPNETTABLE = MIB_IPNETTABLE*; struct MIBICMPSTATS { DWORD dwMsgs; @@ -131,18 +131,18 @@ struct MIBICMPSTATS { DWORD dwAddrMasks; DWORD dwAddrMaskReps; } -alias MIBICMPSTATS* PMIBICMPSTATS; +alias PMIBICMPSTATS = MIBICMPSTATS*; struct MIBICMPINFO { MIBICMPSTATS icmpInStats; MIBICMPSTATS icmpOutStats; } -alias MIBICMPINFO* PMIBICMPINFO; +alias PMIBICMPINFO = MIBICMPINFO*; struct MIB_ICMP { MIBICMPINFO stats; } -alias MIB_ICMP* PMIB_ICMP; +alias PMIB_ICMP = MIB_ICMP*; struct MIB_IFROW { WCHAR[MAX_INTERFACE_NAME_LEN] wszName = 0; @@ -170,7 +170,7 @@ struct MIB_IFROW { DWORD dwDescrLen; BYTE[MAXLEN_IFDESCR] bDescr; } -alias MIB_IFROW* PMIB_IFROW; +alias PMIB_IFROW = MIB_IFROW*; struct MIB_IFTABLE { DWORD dwNumEntries; @@ -178,7 +178,7 @@ struct MIB_IFTABLE { MIB_IFROW* table() return { return _table.ptr; } } -alias MIB_IFTABLE* PMIB_IFTABLE; +alias PMIB_IFTABLE = MIB_IFTABLE*; struct MIB_IPSTATS { DWORD dwForwarding; @@ -205,7 +205,7 @@ struct MIB_IPSTATS { DWORD dwNumAddr; DWORD dwNumRoutes; } -alias MIB_IPSTATS* PMIB_IPSTATS; +alias PMIB_IPSTATS = MIB_IPSTATS*; struct MIB_TCPSTATS { DWORD dwRtoAlgorithm; @@ -224,7 +224,7 @@ struct MIB_TCPSTATS { DWORD dwOutRsts; DWORD dwNumConns; } -alias MIB_TCPSTATS* PMIB_TCPSTATS; +alias PMIB_TCPSTATS = MIB_TCPSTATS*; struct MIB_TCPROW { DWORD dwState; @@ -233,7 +233,7 @@ struct MIB_TCPROW { DWORD dwRemoteAddr; DWORD dwRemotePort; } -alias MIB_TCPROW* PMIB_TCPROW; +alias PMIB_TCPROW = MIB_TCPROW*; struct MIB_TCPTABLE { DWORD dwNumEntries; @@ -241,7 +241,7 @@ struct MIB_TCPTABLE { MIB_TCPROW* table() return { return _table.ptr; } } -alias MIB_TCPTABLE* PMIB_TCPTABLE; +alias PMIB_TCPTABLE = MIB_TCPTABLE*; struct MIB_UDPSTATS { DWORD dwInDatagrams; @@ -250,13 +250,13 @@ struct MIB_UDPSTATS { DWORD dwOutDatagrams; DWORD dwNumAddrs; } -alias MIB_UDPSTATS* PMIB_UDPSTATS; +alias PMIB_UDPSTATS = MIB_UDPSTATS*; struct MIB_UDPROW { DWORD dwLocalAddr; DWORD dwLocalPort; } -alias MIB_UDPROW* PMIB_UDPROW; +alias PMIB_UDPROW = MIB_UDPROW*; struct MIB_UDPTABLE { DWORD dwNumEntries; @@ -264,4 +264,4 @@ struct MIB_UDPTABLE { MIB_UDPROW* table() return { return _table.ptr; } } -alias MIB_UDPTABLE* PMIB_UDPTABLE; +alias PMIB_UDPTABLE = MIB_UDPTABLE*; diff --git a/runtime/druntime/src/core/sys/windows/iptypes.d b/runtime/druntime/src/core/sys/windows/iptypes.d index baaf6ae765b..ecf1e272f35 100644 --- a/runtime/druntime/src/core/sys/windows/iptypes.d +++ b/runtime/druntime/src/core/sys/windows/iptypes.d @@ -41,8 +41,8 @@ enum : UINT { struct IP_ADDRESS_STRING { char[16] String = 0; } -alias IP_ADDRESS_STRING IP_MASK_STRING; -alias IP_ADDRESS_STRING* PIP_ADDRESS_STRING, PIP_MASK_STRING; +alias IP_MASK_STRING = IP_ADDRESS_STRING; +alias PIP_ADDRESS_STRING = IP_ADDRESS_STRING*, PIP_MASK_STRING = IP_ADDRESS_STRING*; struct IP_ADDR_STRING { IP_ADDR_STRING* Next; @@ -50,7 +50,7 @@ struct IP_ADDR_STRING { IP_MASK_STRING IpMask; DWORD Context; } -alias IP_ADDR_STRING* PIP_ADDR_STRING; +alias PIP_ADDR_STRING = IP_ADDR_STRING*; struct IP_ADAPTER_INFO { IP_ADAPTER_INFO* Next; @@ -72,7 +72,7 @@ struct IP_ADAPTER_INFO { time_t LeaseObtained; time_t LeaseExpires; } -alias IP_ADAPTER_INFO* PIP_ADAPTER_INFO; +alias PIP_ADAPTER_INFO = IP_ADAPTER_INFO*; struct IP_PER_ADAPTER_INFO { UINT AutoconfigEnabled; @@ -80,7 +80,7 @@ struct IP_PER_ADAPTER_INFO { PIP_ADDR_STRING CurrentDnsServer; IP_ADDR_STRING DnsServerList; } -alias IP_PER_ADAPTER_INFO* PIP_PER_ADAPTER_INFO; +alias PIP_PER_ADAPTER_INFO = IP_PER_ADAPTER_INFO*; struct FIXED_INFO { char[MAX_HOSTNAME_LEN+4] HostName = 0; @@ -93,4 +93,4 @@ struct FIXED_INFO { UINT EnableProxy; UINT EnableDns; } -alias FIXED_INFO* PFIXED_INFO; +alias PFIXED_INFO = FIXED_INFO*; diff --git a/runtime/druntime/src/core/sys/windows/lmaccess.d b/runtime/druntime/src/core/sys/windows/lmaccess.d index cf6f9d4c4d1..02c5095eac5 100644 --- a/runtime/druntime/src/core/sys/windows/lmaccess.d +++ b/runtime/druntime/src/core/sys/windows/lmaccess.d @@ -234,7 +234,7 @@ enum NETLOGON_REDO_NEEDED=8; struct USER_INFO_0 { LPWSTR usri0_name; } -alias USER_INFO_0* PUSER_INFO_0, LPUSER_INFO_0; +alias PUSER_INFO_0 = USER_INFO_0*, LPUSER_INFO_0 = USER_INFO_0*; struct USER_INFO_1{ LPWSTR usri1_name; @@ -246,7 +246,7 @@ struct USER_INFO_1{ DWORD usri1_flags; LPWSTR usri1_script_path; } -alias USER_INFO_1* PUSER_INFO_1, LPUSER_INFO_1; +alias PUSER_INFO_1 = USER_INFO_1*, LPUSER_INFO_1 = USER_INFO_1*; struct USER_INFO_2{ LPWSTR usri2_name; @@ -274,7 +274,7 @@ struct USER_INFO_2{ DWORD usri2_country_code; DWORD usri2_code_page; } -alias USER_INFO_2* PUSER_INFO_2, LPUSER_INFO_2; +alias PUSER_INFO_2 = USER_INFO_2*, LPUSER_INFO_2 = USER_INFO_2*; struct USER_INFO_3{ LPWSTR usri3_name; @@ -307,7 +307,7 @@ struct USER_INFO_3{ LPWSTR usri3_home_dir_drive; DWORD usri3_password_expired; } -alias USER_INFO_3* PUSER_INFO_3, LPUSER_INFO_3; +alias PUSER_INFO_3 = USER_INFO_3*, LPUSER_INFO_3 = USER_INFO_3*; struct USER_INFO_10{ LPWSTR usri10_name; @@ -315,7 +315,7 @@ struct USER_INFO_10{ LPWSTR usri10_usr_comment; LPWSTR usri10_full_name; } -alias USER_INFO_10* PUSER_INFO_10, LPUSER_INFO_10; +alias PUSER_INFO_10 = USER_INFO_10*, LPUSER_INFO_10 = USER_INFO_10*; struct USER_INFO_11{ LPWSTR usri11_name; @@ -339,7 +339,7 @@ struct USER_INFO_11{ PBYTE usri11_logon_hours; DWORD usri11_code_page; } -alias USER_INFO_11* PUSER_INFO_11, LPUSER_INFO_11; +alias PUSER_INFO_11 = USER_INFO_11*, LPUSER_INFO_11 = USER_INFO_11*; struct USER_INFO_20 { LPWSTR usri20_name; @@ -348,12 +348,12 @@ struct USER_INFO_20 { DWORD usri20_flags; DWORD usri20_user_id; } -alias USER_INFO_20* PUSER_INFO_20, LPUSER_INFO_20; +alias PUSER_INFO_20 = USER_INFO_20*, LPUSER_INFO_20 = USER_INFO_20*; struct USER_INFO_21 { BYTE[ENCRYPTED_PWLEN] usri21_password; } -alias USER_INFO_21* PUSER_INFO_21, LPUSER_INFO_21; +alias PUSER_INFO_21 = USER_INFO_21*, LPUSER_INFO_21 = USER_INFO_21*; struct USER_INFO_22{ LPWSTR usri22_name; @@ -381,108 +381,108 @@ struct USER_INFO_22{ DWORD usri22_country_code; DWORD usri22_code_page; } -alias USER_INFO_22* PUSER_INFO_22, LPUSER_INFO_22; +alias PUSER_INFO_22 = USER_INFO_22*, LPUSER_INFO_22 = USER_INFO_22*; struct USER_INFO_1003{ LPWSTR usri1003_password; } -alias USER_INFO_1003* PUSER_INFO_1003, LPUSER_INFO_1003; +alias PUSER_INFO_1003 = USER_INFO_1003*, LPUSER_INFO_1003 = USER_INFO_1003*; struct USER_INFO_1005{ DWORD usri1005_priv; } -alias USER_INFO_1005* PUSER_INFO_1005, LPUSER_INFO_1005; +alias PUSER_INFO_1005 = USER_INFO_1005*, LPUSER_INFO_1005 = USER_INFO_1005*; struct USER_INFO_1006{ LPWSTR usri1006_home_dir; } -alias USER_INFO_1006* PUSER_INFO_1006, LPUSER_INFO_1006; +alias PUSER_INFO_1006 = USER_INFO_1006*, LPUSER_INFO_1006 = USER_INFO_1006*; struct USER_INFO_1007{ LPWSTR usri1007_comment; } -alias USER_INFO_1007* PUSER_INFO_1007, LPUSER_INFO_1007; +alias PUSER_INFO_1007 = USER_INFO_1007*, LPUSER_INFO_1007 = USER_INFO_1007*; struct USER_INFO_1008{ DWORD usri1008_flags; } -alias USER_INFO_1008* PUSER_INFO_1008, LPUSER_INFO_1008; +alias PUSER_INFO_1008 = USER_INFO_1008*, LPUSER_INFO_1008 = USER_INFO_1008*; struct USER_INFO_1009{ LPWSTR usri1009_script_path; } -alias USER_INFO_1009* PUSER_INFO_1009, LPUSER_INFO_1009; +alias PUSER_INFO_1009 = USER_INFO_1009*, LPUSER_INFO_1009 = USER_INFO_1009*; struct USER_INFO_1010{ DWORD usri1010_auth_flags; } -alias USER_INFO_1010* PUSER_INFO_1010, LPUSER_INFO_1010; +alias PUSER_INFO_1010 = USER_INFO_1010*, LPUSER_INFO_1010 = USER_INFO_1010*; struct USER_INFO_1011{ LPWSTR usri1011_full_name; } -alias USER_INFO_1011* PUSER_INFO_1011, LPUSER_INFO_1011; +alias PUSER_INFO_1011 = USER_INFO_1011*, LPUSER_INFO_1011 = USER_INFO_1011*; struct USER_INFO_1012{ LPWSTR usri1012_usr_comment; } -alias USER_INFO_1012* PUSER_INFO_1012, LPUSER_INFO_1012; +alias PUSER_INFO_1012 = USER_INFO_1012*, LPUSER_INFO_1012 = USER_INFO_1012*; struct USER_INFO_1013{ LPWSTR usri1013_parms; } -alias USER_INFO_1013* PUSER_INFO_1013, LPUSER_INFO_1013; +alias PUSER_INFO_1013 = USER_INFO_1013*, LPUSER_INFO_1013 = USER_INFO_1013*; struct USER_INFO_1014{ LPWSTR usri1014_workstations; } -alias USER_INFO_1014* PUSER_INFO_1014, LPUSER_INFO_1014; +alias PUSER_INFO_1014 = USER_INFO_1014*, LPUSER_INFO_1014 = USER_INFO_1014*; struct USER_INFO_1017{ DWORD usri1017_acct_expires; } -alias USER_INFO_1017* PUSER_INFO_1017, LPUSER_INFO_1017; +alias PUSER_INFO_1017 = USER_INFO_1017*, LPUSER_INFO_1017 = USER_INFO_1017*; struct USER_INFO_1018{ DWORD usri1018_max_storage; } -alias USER_INFO_1018* PUSER_INFO_1018, LPUSER_INFO_1018; +alias PUSER_INFO_1018 = USER_INFO_1018*, LPUSER_INFO_1018 = USER_INFO_1018*; struct USER_INFO_1020{ DWORD usri1020_units_per_week; PBYTE usri1020_logon_hours; } -alias USER_INFO_1020* PUSER_INFO_1020, LPUSER_INFO_1020; +alias PUSER_INFO_1020 = USER_INFO_1020*, LPUSER_INFO_1020 = USER_INFO_1020*; struct USER_INFO_1023{ LPWSTR usri1023_logon_server; } -alias USER_INFO_1023* PUSER_INFO_1023, LPUSER_INFO_1023; +alias PUSER_INFO_1023 = USER_INFO_1023*, LPUSER_INFO_1023 = USER_INFO_1023*; struct USER_INFO_1024{ DWORD usri1024_country_code; } -alias USER_INFO_1024* PUSER_INFO_1024, LPUSER_INFO_1024; +alias PUSER_INFO_1024 = USER_INFO_1024*, LPUSER_INFO_1024 = USER_INFO_1024*; struct USER_INFO_1025{ DWORD usri1025_code_page; } -alias USER_INFO_1025* PUSER_INFO_1025, LPUSER_INFO_1025; +alias PUSER_INFO_1025 = USER_INFO_1025*, LPUSER_INFO_1025 = USER_INFO_1025*; struct USER_INFO_1051{ DWORD usri1051_primary_group_id; } -alias USER_INFO_1051* PUSER_INFO_1051, LPUSER_INFO_1051; +alias PUSER_INFO_1051 = USER_INFO_1051*, LPUSER_INFO_1051 = USER_INFO_1051*; struct USER_INFO_1052{ LPWSTR usri1052_profile; } -alias USER_INFO_1052* PUSER_INFO_1052, LPUSER_INFO_1052; +alias PUSER_INFO_1052 = USER_INFO_1052*, LPUSER_INFO_1052 = USER_INFO_1052*; struct USER_INFO_1053{ LPWSTR usri1053_home_dir_drive; } -alias USER_INFO_1053* PUSER_INFO_1053, LPUSER_INFO_1053; +alias PUSER_INFO_1053 = USER_INFO_1053*, LPUSER_INFO_1053 = USER_INFO_1053*; struct USER_MODALS_INFO_0{ DWORD usrmod0_min_passwd_len; @@ -491,72 +491,72 @@ struct USER_MODALS_INFO_0{ DWORD usrmod0_force_logoff; DWORD usrmod0_password_hist_len; } -alias USER_MODALS_INFO_0* PUSER_MODALS_INFO_0, LPUSER_MODALS_INFO_0; +alias PUSER_MODALS_INFO_0 = USER_MODALS_INFO_0*, LPUSER_MODALS_INFO_0 = USER_MODALS_INFO_0*; struct USER_MODALS_INFO_1{ DWORD usrmod1_role; LPWSTR usrmod1_primary; } -alias USER_MODALS_INFO_1* PUSER_MODALS_INFO_1, LPUSER_MODALS_INFO_1; +alias PUSER_MODALS_INFO_1 = USER_MODALS_INFO_1*, LPUSER_MODALS_INFO_1 = USER_MODALS_INFO_1*; struct USER_MODALS_INFO_2{ LPWSTR usrmod2_domain_name; PSID usrmod2_domain_id; } -alias USER_MODALS_INFO_2* PUSER_MODALS_INFO_2, LPUSER_MODALS_INFO_2; +alias PUSER_MODALS_INFO_2 = USER_MODALS_INFO_2*, LPUSER_MODALS_INFO_2 = USER_MODALS_INFO_2*; struct USER_MODALS_INFO_3{ DWORD usrmod3_lockout_duration; DWORD usrmod3_lockout_observation_window; DWORD usrmod3_lockout_threshold; } -alias USER_MODALS_INFO_3* PUSER_MODALS_INFO_3, LPUSER_MODALS_INFO_3; +alias PUSER_MODALS_INFO_3 = USER_MODALS_INFO_3*, LPUSER_MODALS_INFO_3 = USER_MODALS_INFO_3*; struct USER_MODALS_INFO_1001{ DWORD usrmod1001_min_passwd_len; } -alias USER_MODALS_INFO_1001* PUSER_MODALS_INFO_1001, LPUSER_MODALS_INFO_1001; +alias PUSER_MODALS_INFO_1001 = USER_MODALS_INFO_1001*, LPUSER_MODALS_INFO_1001 = USER_MODALS_INFO_1001*; struct USER_MODALS_INFO_1002{ DWORD usrmod1002_max_passwd_age; } -alias USER_MODALS_INFO_1002* PUSER_MODALS_INFO_1002, LPUSER_MODALS_INFO_1002; +alias PUSER_MODALS_INFO_1002 = USER_MODALS_INFO_1002*, LPUSER_MODALS_INFO_1002 = USER_MODALS_INFO_1002*; struct USER_MODALS_INFO_1003{ DWORD usrmod1003_min_passwd_age; } -alias USER_MODALS_INFO_1003* PUSER_MODALS_INFO_1003, LPUSER_MODALS_INFO_1003; +alias PUSER_MODALS_INFO_1003 = USER_MODALS_INFO_1003*, LPUSER_MODALS_INFO_1003 = USER_MODALS_INFO_1003*; struct USER_MODALS_INFO_1004{ DWORD usrmod1004_force_logoff; } -alias USER_MODALS_INFO_1004* PUSER_MODALS_INFO_1004, LPUSER_MODALS_INFO_1004; +alias PUSER_MODALS_INFO_1004 = USER_MODALS_INFO_1004*, LPUSER_MODALS_INFO_1004 = USER_MODALS_INFO_1004*; struct USER_MODALS_INFO_1005{ DWORD usrmod1005_password_hist_len; } -alias USER_MODALS_INFO_1005* PUSER_MODALS_INFO_1005, LPUSER_MODALS_INFO_1005; +alias PUSER_MODALS_INFO_1005 = USER_MODALS_INFO_1005*, LPUSER_MODALS_INFO_1005 = USER_MODALS_INFO_1005*; struct USER_MODALS_INFO_1006{ DWORD usrmod1006_role; } -alias USER_MODALS_INFO_1006* PUSER_MODALS_INFO_1006, LPUSER_MODALS_INFO_1006; +alias PUSER_MODALS_INFO_1006 = USER_MODALS_INFO_1006*, LPUSER_MODALS_INFO_1006 = USER_MODALS_INFO_1006*; struct USER_MODALS_INFO_1007{ LPWSTR usrmod1007_primary; } -alias USER_MODALS_INFO_1007* PUSER_MODALS_INFO_1007, LPUSER_MODALS_INFO_1007; +alias PUSER_MODALS_INFO_1007 = USER_MODALS_INFO_1007*, LPUSER_MODALS_INFO_1007 = USER_MODALS_INFO_1007*; struct GROUP_INFO_0{ LPWSTR grpi0_name; } -alias GROUP_INFO_0* PGROUP_INFO_0, LPGROUP_INFO_0; +alias PGROUP_INFO_0 = GROUP_INFO_0*, LPGROUP_INFO_0 = GROUP_INFO_0*; struct GROUP_INFO_1{ LPWSTR grpi1_name; LPWSTR grpi1_comment; } -alias GROUP_INFO_1* PGROUP_INFO_1, LPGROUP_INFO_1; +alias PGROUP_INFO_1 = GROUP_INFO_1*, LPGROUP_INFO_1 = GROUP_INFO_1*; struct GROUP_INFO_2{ LPWSTR grpi2_name; @@ -564,73 +564,73 @@ struct GROUP_INFO_2{ DWORD grpi2_group_id; DWORD grpi2_attributes; } -alias GROUP_INFO_2* PGROUP_INFO_2; +alias PGROUP_INFO_2 = GROUP_INFO_2*; struct GROUP_INFO_1002{ LPWSTR grpi1002_comment; } -alias GROUP_INFO_1002* PGROUP_INFO_1002, LPGROUP_INFO_1002; +alias PGROUP_INFO_1002 = GROUP_INFO_1002*, LPGROUP_INFO_1002 = GROUP_INFO_1002*; struct GROUP_INFO_1005{ DWORD grpi1005_attributes; } -alias GROUP_INFO_1005* PGROUP_INFO_1005, LPGROUP_INFO_1005; +alias PGROUP_INFO_1005 = GROUP_INFO_1005*, LPGROUP_INFO_1005 = GROUP_INFO_1005*; struct GROUP_USERS_INFO_0{ LPWSTR grui0_name; } -alias GROUP_USERS_INFO_0* PGROUP_USERS_INFO_0, LPGROUP_USERS_INFO_0; +alias PGROUP_USERS_INFO_0 = GROUP_USERS_INFO_0*, LPGROUP_USERS_INFO_0 = GROUP_USERS_INFO_0*; struct GROUP_USERS_INFO_1{ LPWSTR grui1_name; DWORD grui1_attributes; } -alias GROUP_USERS_INFO_1* PGROUP_USERS_INFO_1, LPGROUP_USERS_INFO_1; +alias PGROUP_USERS_INFO_1 = GROUP_USERS_INFO_1*, LPGROUP_USERS_INFO_1 = GROUP_USERS_INFO_1*; struct LOCALGROUP_INFO_0{ LPWSTR lgrpi0_name; } -alias LOCALGROUP_INFO_0* PLOCALGROUP_INFO_0, LPLOCALGROUP_INFO_0; +alias PLOCALGROUP_INFO_0 = LOCALGROUP_INFO_0*, LPLOCALGROUP_INFO_0 = LOCALGROUP_INFO_0*; struct LOCALGROUP_INFO_1{ LPWSTR lgrpi1_name; LPWSTR lgrpi1_comment; } -alias LOCALGROUP_INFO_1* PLOCALGROUP_INFO_1, LPLOCALGROUP_INFO_1; +alias PLOCALGROUP_INFO_1 = LOCALGROUP_INFO_1*, LPLOCALGROUP_INFO_1 = LOCALGROUP_INFO_1*; struct LOCALGROUP_INFO_1002{ LPWSTR lgrpi1002_comment; } -alias LOCALGROUP_INFO_1002* PLOCALGROUP_INFO_1002, LPLOCALGROUP_INFO_1002; +alias PLOCALGROUP_INFO_1002 = LOCALGROUP_INFO_1002*, LPLOCALGROUP_INFO_1002 = LOCALGROUP_INFO_1002*; struct LOCALGROUP_MEMBERS_INFO_0{ PSID lgrmi0_sid; } -alias LOCALGROUP_MEMBERS_INFO_0* PLOCALGROUP_MEMBERS_INFO_0, LPLOCALGROUP_MEMBERS_INFO_0; +alias PLOCALGROUP_MEMBERS_INFO_0 = LOCALGROUP_MEMBERS_INFO_0*, LPLOCALGROUP_MEMBERS_INFO_0 = LOCALGROUP_MEMBERS_INFO_0*; struct LOCALGROUP_MEMBERS_INFO_1{ PSID lgrmi1_sid; SID_NAME_USE lgrmi1_sidusage; LPWSTR lgrmi1_name; } -alias LOCALGROUP_MEMBERS_INFO_1* PLOCALGROUP_MEMBERS_INFO_1, LPLOCALGROUP_MEMBERS_INFO_1; +alias PLOCALGROUP_MEMBERS_INFO_1 = LOCALGROUP_MEMBERS_INFO_1*, LPLOCALGROUP_MEMBERS_INFO_1 = LOCALGROUP_MEMBERS_INFO_1*; struct LOCALGROUP_MEMBERS_INFO_2{ PSID lgrmi2_sid; SID_NAME_USE lgrmi2_sidusage; LPWSTR lgrmi2_domainandname; } -alias LOCALGROUP_MEMBERS_INFO_2* PLOCALGROUP_MEMBERS_INFO_2, LPLOCALGROUP_MEMBERS_INFO_2; +alias PLOCALGROUP_MEMBERS_INFO_2 = LOCALGROUP_MEMBERS_INFO_2*, LPLOCALGROUP_MEMBERS_INFO_2 = LOCALGROUP_MEMBERS_INFO_2*; struct LOCALGROUP_MEMBERS_INFO_3{ LPWSTR lgrmi3_domainandname; } -alias LOCALGROUP_MEMBERS_INFO_3* PLOCALGROUP_MEMBERS_INFO_3, LPLOCALGROUP_MEMBERS_INFO_3; +alias PLOCALGROUP_MEMBERS_INFO_3 = LOCALGROUP_MEMBERS_INFO_3*, LPLOCALGROUP_MEMBERS_INFO_3 = LOCALGROUP_MEMBERS_INFO_3*; struct LOCALGROUP_USERS_INFO_0{ LPWSTR lgrui0_name; } -alias LOCALGROUP_USERS_INFO_0* PLOCALGROUP_USERS_INFO_0, LPLOCALGROUP_USERS_INFO_0; +alias PLOCALGROUP_USERS_INFO_0 = LOCALGROUP_USERS_INFO_0*, LPLOCALGROUP_USERS_INFO_0 = LOCALGROUP_USERS_INFO_0*; struct NET_DISPLAY_USER{ LPWSTR usri1_name; @@ -640,7 +640,7 @@ struct NET_DISPLAY_USER{ DWORD usri1_user_id; DWORD usri1_next_index; } -alias NET_DISPLAY_USER* PNET_DISPLAY_USER; +alias PNET_DISPLAY_USER = NET_DISPLAY_USER*; struct NET_DISPLAY_MACHINE{ LPWSTR usri2_name; @@ -649,7 +649,7 @@ struct NET_DISPLAY_MACHINE{ DWORD usri2_user_id; DWORD usri2_next_index; } -alias NET_DISPLAY_MACHINE* PNET_DISPLAY_MACHINE; +alias PNET_DISPLAY_MACHINE = NET_DISPLAY_MACHINE*; struct NET_DISPLAY_GROUP{ LPWSTR grpi3_name; @@ -658,36 +658,36 @@ struct NET_DISPLAY_GROUP{ DWORD grpi3_attributes; DWORD grpi3_next_index; } -alias NET_DISPLAY_GROUP* PNET_DISPLAY_GROUP; +alias PNET_DISPLAY_GROUP = NET_DISPLAY_GROUP*; struct ACCESS_INFO_0{ LPTSTR acc0_resource_name; } -alias ACCESS_INFO_0* PACCESS_INFO_0, LPACCESS_INFO_0; +alias PACCESS_INFO_0 = ACCESS_INFO_0*, LPACCESS_INFO_0 = ACCESS_INFO_0*; struct ACCESS_INFO_1{ LPTSTR acc1_resource_name; DWORD acc1_attr; DWORD acc1_count; } -alias ACCESS_INFO_1* PACCESS_INFO_1, LPACCESS_INFO_1; +alias PACCESS_INFO_1 = ACCESS_INFO_1*, LPACCESS_INFO_1 = ACCESS_INFO_1*; struct ACCESS_INFO_1002{ DWORD acc1002_attr; } -alias ACCESS_INFO_1002* PACCESS_INFO_1002, LPACCESS_INFO_1002; +alias PACCESS_INFO_1002 = ACCESS_INFO_1002*, LPACCESS_INFO_1002 = ACCESS_INFO_1002*; struct ACCESS_LIST{ LPTSTR acl_ugname; DWORD acl_access; } -alias ACCESS_LIST* PACCESS_LIST, LPACCESS_LIST; +alias PACCESS_LIST = ACCESS_LIST*, LPACCESS_LIST = ACCESS_LIST*; struct NETLOGON_INFO_1{ DWORD netlog1_flags; NET_API_STATUS netlog1_pdc_connection_status; } -alias NETLOGON_INFO_1* PNETLOGON_INFO_1; +alias PNETLOGON_INFO_1 = NETLOGON_INFO_1*; struct NETLOGON_INFO_2{ DWORD netlog2_flags; @@ -695,7 +695,7 @@ struct NETLOGON_INFO_2{ LPWSTR netlog2_trusted_dc_name; NET_API_STATUS netlog2_tc_connection_status; } -alias NETLOGON_INFO_2* PNETLOGON_INFO_2; +alias PNETLOGON_INFO_2 = NETLOGON_INFO_2*; struct NETLOGON_INFO_3{ DWORD netlog3_flags; @@ -706,7 +706,7 @@ struct NETLOGON_INFO_3{ DWORD netlog3_reserved4; DWORD netlog3_reserved5; } -alias NETLOGON_INFO_3* PNETLOGON_INFO_3; +alias PNETLOGON_INFO_3 = NETLOGON_INFO_3*; extern (Windows) nothrow @nogc { deprecated { diff --git a/runtime/druntime/src/core/sys/windows/lmalert.d b/runtime/druntime/src/core/sys/windows/lmalert.d index acb96cfbc90..a2aa4de2c1c 100644 --- a/runtime/druntime/src/core/sys/windows/lmalert.d +++ b/runtime/druntime/src/core/sys/windows/lmalert.d @@ -42,20 +42,20 @@ struct ADMIN_OTHER_INFO{ DWORD alrtad_errcode; DWORD alrtad_numstrings; } -alias ADMIN_OTHER_INFO* PADMIN_OTHER_INFO, LPADMIN_OTHER_INFO; +alias PADMIN_OTHER_INFO = ADMIN_OTHER_INFO*, LPADMIN_OTHER_INFO = ADMIN_OTHER_INFO*; struct STD_ALERT{ DWORD alrt_timestamp; TCHAR[EVLEN+1] alrt_eventname = 0; TCHAR[SNLEN+1] alrt_servicename = 0; } -alias STD_ALERT* PSTD_ALERT, LPSTD_ALERT; +alias PSTD_ALERT = STD_ALERT*, LPSTD_ALERT = STD_ALERT*; struct ERRLOG_OTHER_INFO{ DWORD alrter_errcode; DWORD alrter_offset; } -alias ERRLOG_OTHER_INFO* PERRLOG_OTHER_INFO, LPERRLOG_OTHER_INFO; +alias PERRLOG_OTHER_INFO = ERRLOG_OTHER_INFO*, LPERRLOG_OTHER_INFO = ERRLOG_OTHER_INFO*; struct PRINT_OTHER_INFO{ DWORD alrtpr_jobid; @@ -63,13 +63,13 @@ struct PRINT_OTHER_INFO{ DWORD alrtpr_submitted; DWORD alrtpr_size; } -alias PRINT_OTHER_INFO* PPRINT_OTHER_INFO, LPPRINT_OTHER_INFO; +alias PPRINT_OTHER_INFO = PRINT_OTHER_INFO*, LPPRINT_OTHER_INFO = PRINT_OTHER_INFO*; struct USER_OTHER_INFO{ DWORD alrtus_errcode; DWORD alrtus_numstrings; } -alias USER_OTHER_INFO* PUSER_OTHER_INFO, LPUSER_OTHER_INFO; +alias PUSER_OTHER_INFO = USER_OTHER_INFO*, LPUSER_OTHER_INFO = USER_OTHER_INFO*; extern (Windows) nothrow @nogc { NET_API_STATUS NetAlertRaise(LPCWSTR,PVOID,DWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmat.d b/runtime/druntime/src/core/sys/windows/lmat.d index ee1249e9157..7c593efaba0 100644 --- a/runtime/druntime/src/core/sys/windows/lmat.d +++ b/runtime/druntime/src/core/sys/windows/lmat.d @@ -30,7 +30,7 @@ struct AT_ENUM { UCHAR Flags; LPWSTR Command; } -alias AT_ENUM* PAT_ENUM, LPAT_ENUM; +alias PAT_ENUM = AT_ENUM*, LPAT_ENUM = AT_ENUM*; struct AT_INFO { DWORD_PTR JobTime; @@ -39,7 +39,7 @@ struct AT_INFO { UCHAR Flags; LPWSTR Command; } -alias AT_INFO* PAT_INFO, LPAT_INFO; +alias PAT_INFO = AT_INFO*, LPAT_INFO = AT_INFO*; extern (Windows) { NET_API_STATUS NetScheduleJobAdd(LPWSTR, PBYTE, LPDWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmaudit.d b/runtime/druntime/src/core/sys/windows/lmaudit.d index 8db56f17631..88f1588dc69 100644 --- a/runtime/druntime/src/core/sys/windows/lmaudit.d +++ b/runtime/druntime/src/core/sys/windows/lmaudit.d @@ -97,7 +97,7 @@ struct AUDIT_ENTRY{ DWORD ae_data_offset; DWORD ae_data_size; } -alias AUDIT_ENTRY* PAUDIT_ENTRY, LPAUDIT_ENTRY; +alias PAUDIT_ENTRY = AUDIT_ENTRY*, LPAUDIT_ENTRY = AUDIT_ENTRY*; struct HLOG{ DWORD time; @@ -105,32 +105,32 @@ struct HLOG{ DWORD offset; DWORD rec_offset; } -alias HLOG* PHLOG, LPHLOG; +alias PHLOG = HLOG*, LPHLOG = HLOG*; struct AE_SRVSTATUS{ DWORD ae_sv_status; } -alias AE_SRVSTATUS* PAE_SRVSTATUS, LPAE_SRVSTATUS; +alias PAE_SRVSTATUS = AE_SRVSTATUS*, LPAE_SRVSTATUS = AE_SRVSTATUS*; struct AE_SESSLOGON{ DWORD ae_so_compname; DWORD ae_so_username; DWORD ae_so_privilege; } -alias AE_SESSLOGON* PAE_SESSLOGON, LPAE_SESSLOGON; +alias PAE_SESSLOGON = AE_SESSLOGON*, LPAE_SESSLOGON = AE_SESSLOGON*; struct AE_SESSLOGOFF{ DWORD ae_sf_compname; DWORD ae_sf_username; DWORD ae_sf_reason; } -alias AE_SESSLOGOFF* PAE_SESSLOGOFF, LPAE_SESSLOGOFF; +alias PAE_SESSLOGOFF = AE_SESSLOGOFF*, LPAE_SESSLOGOFF = AE_SESSLOGOFF*; struct AE_SESSPWERR{ DWORD ae_sp_compname; DWORD ae_sp_username; } -alias AE_SESSPWERR* PAE_SESSPWERR, LPAE_SESSPWERR; +alias PAE_SESSPWERR = AE_SESSPWERR*, LPAE_SESSPWERR = AE_SESSPWERR*; struct AE_CONNSTART{ DWORD ae_ct_compname; @@ -138,7 +138,7 @@ struct AE_CONNSTART{ DWORD ae_ct_netname; DWORD ae_ct_connid; } -alias AE_CONNSTART* PAE_CONNSTART, LPAE_CONNSTART; +alias PAE_CONNSTART = AE_CONNSTART*, LPAE_CONNSTART = AE_CONNSTART*; struct AE_CONNSTOP{ DWORD ae_cp_compname; @@ -147,7 +147,7 @@ struct AE_CONNSTOP{ DWORD ae_cp_connid; DWORD ae_cp_reason; } -alias AE_CONNSTOP* PAE_CONNSTOP, LPAE_CONNSTOP; +alias PAE_CONNSTOP = AE_CONNSTOP*, LPAE_CONNSTOP = AE_CONNSTOP*; struct AE_CONNREJ{ DWORD ae_cr_compname; @@ -155,7 +155,7 @@ struct AE_CONNREJ{ DWORD ae_cr_netname; DWORD ae_cr_reason; } -alias AE_CONNREJ* PAE_CONNREJ, LPAE_CONNREJ; +alias PAE_CONNREJ = AE_CONNREJ*, LPAE_CONNREJ = AE_CONNREJ*; struct AE_RESACCESS{ DWORD ae_ra_compname; @@ -166,7 +166,7 @@ struct AE_RESACCESS{ DWORD ae_ra_restype; DWORD ae_ra_fileid; } -alias AE_RESACCESS* PAE_RESACCESS, LPAE_RESACCESS; +alias PAE_RESACCESS = AE_RESACCESS*, LPAE_RESACCESS = AE_RESACCESS*; struct AE_RESACCESSREJ{ DWORD ae_rr_compname; @@ -174,7 +174,7 @@ struct AE_RESACCESSREJ{ DWORD ae_rr_resname; DWORD ae_rr_operation; } -alias AE_RESACCESSREJ* PAE_RESACCESSREJ, LPAE_RESACCESSREJ; +alias PAE_RESACCESSREJ = AE_RESACCESSREJ*, LPAE_RESACCESSREJ = AE_RESACCESSREJ*; struct AE_CLOSEFILE{ DWORD ae_cf_compname; @@ -184,7 +184,7 @@ struct AE_CLOSEFILE{ DWORD ae_cf_duration; DWORD ae_cf_reason; } -alias AE_CLOSEFILE* PAE_CLOSEFILE, LPAE_CLOSEFILE; +alias PAE_CLOSEFILE = AE_CLOSEFILE*, LPAE_CLOSEFILE = AE_CLOSEFILE*; struct AE_SERVICESTAT{ DWORD ae_ss_compname; @@ -195,7 +195,7 @@ struct AE_SERVICESTAT{ DWORD ae_ss_text; DWORD ae_ss_returnval; } -alias AE_SERVICESTAT* PAE_SERVICESTAT, LPAE_SERVICESTAT; +alias PAE_SERVICESTAT = AE_SERVICESTAT*, LPAE_SERVICESTAT = AE_SERVICESTAT*; struct AE_ACLMOD{ DWORD ae_am_compname; @@ -204,7 +204,7 @@ struct AE_ACLMOD{ DWORD ae_am_action; DWORD ae_am_datalen; } -alias AE_ACLMOD* PAE_ACLMOD, LPAE_ACLMOD; +alias PAE_ACLMOD = AE_ACLMOD*, LPAE_ACLMOD = AE_ACLMOD*; struct AE_UASMOD{ DWORD ae_um_compname; @@ -214,7 +214,7 @@ struct AE_UASMOD{ DWORD ae_um_action; DWORD ae_um_datalen; } -alias AE_UASMOD* PAE_UASMOD, LPAE_UASMOD; +alias PAE_UASMOD = AE_UASMOD*, LPAE_UASMOD = AE_UASMOD*; struct AE_NETLOGON{ DWORD ae_no_compname; @@ -222,7 +222,7 @@ struct AE_NETLOGON{ DWORD ae_no_privilege; DWORD ae_no_authflags; } -alias AE_NETLOGON* PAE_NETLOGON, LPAE_NETLOGON; +alias PAE_NETLOGON = AE_NETLOGON*, LPAE_NETLOGON = AE_NETLOGON*; struct AE_NETLOGOFF{ DWORD ae_nf_compname; @@ -230,7 +230,7 @@ struct AE_NETLOGOFF{ DWORD ae_nf_reserved1; DWORD ae_nf_reserved2; } -alias AE_NETLOGOFF* PAE_NETLOGOFF, LPAE_NETLOGOFF; +alias PAE_NETLOGOFF = AE_NETLOGOFF*, LPAE_NETLOGOFF = AE_NETLOGOFF*; struct AE_ACCLIM{ DWORD ae_al_compname; @@ -238,7 +238,7 @@ struct AE_ACCLIM{ DWORD ae_al_resname; DWORD ae_al_limit; } -alias AE_ACCLIM* PAE_ACCLIM, LPAE_ACCLIM; +alias PAE_ACCLIM = AE_ACCLIM*, LPAE_ACCLIM = AE_ACCLIM*; struct AE_LOCKOUT{ DWORD ae_lk_compname; @@ -246,7 +246,7 @@ struct AE_LOCKOUT{ DWORD ae_lk_action; DWORD ae_lk_bad_pw_count; } -alias AE_LOCKOUT* PAE_LOCKOUT, LPAE_LOCKOUT; +alias PAE_LOCKOUT = AE_LOCKOUT*, LPAE_LOCKOUT = AE_LOCKOUT*; struct AE_GENERIC{ DWORD ae_ge_msgfile; @@ -262,7 +262,7 @@ struct AE_GENERIC{ DWORD ae_ge_param8; DWORD ae_ge_param9; } -alias AE_GENERIC* PAE_GENERIC, LPAE_GENERIC; +alias PAE_GENERIC = AE_GENERIC*, LPAE_GENERIC = AE_GENERIC*; extern (Windows) { deprecated { diff --git a/runtime/druntime/src/core/sys/windows/lmbrowsr.d b/runtime/druntime/src/core/sys/windows/lmbrowsr.d index 16cc6611394..3d96b36155b 100644 --- a/runtime/druntime/src/core/sys/windows/lmbrowsr.d +++ b/runtime/druntime/src/core/sys/windows/lmbrowsr.d @@ -35,7 +35,7 @@ struct BROWSER_STATISTICS { ULONG NumberOfDuplicateMasterAnnouncements; LARGE_INTEGER NumberOfIllegalDatagrams; } -alias BROWSER_STATISTICS* PBROWSER_STATISTICS, LPBROWSER_STATISTICS; +alias PBROWSER_STATISTICS = BROWSER_STATISTICS*, LPBROWSER_STATISTICS = BROWSER_STATISTICS*; struct BROWSER_STATISTICS_100 { LARGE_INTEGER StartTime; @@ -46,7 +46,7 @@ struct BROWSER_STATISTICS_100 { ULONG NumberOfGetBrowserServerListRequests; LARGE_INTEGER NumberOfIllegalDatagrams; } -alias BROWSER_STATISTICS_100* PBROWSER_STATISTICS_100; +alias PBROWSER_STATISTICS_100 = BROWSER_STATISTICS_100*; struct BROWSER_STATISTICS_101 { LARGE_INTEGER StartTime; @@ -66,7 +66,7 @@ struct BROWSER_STATISTICS_101 { ULONG NumberOfFailedMailslotOpens; ULONG NumberOfDuplicateMasterAnnouncements; } -alias BROWSER_STATISTICS_101* PBROWSER_STATISTICS_101; +alias PBROWSER_STATISTICS_101 = BROWSER_STATISTICS_101*; extern (Windows) { NET_API_STATUS I_BrowserServerEnum(LPCWSTR, LPCWSTR, LPCWSTR, DWORD, diff --git a/runtime/druntime/src/core/sys/windows/lmchdev.d b/runtime/druntime/src/core/sys/windows/lmchdev.d index 55460e16bdf..db496aae601 100644 --- a/runtime/druntime/src/core/sys/windows/lmchdev.d +++ b/runtime/druntime/src/core/sys/windows/lmchdev.d @@ -36,7 +36,7 @@ enum CHARDEVQ_MIN_PRIORITY = 9; struct CHARDEV_INFO_0 { LPWSTR ch0_dev; } -alias CHARDEV_INFO_0* PCHARDEV_INFO_0, LPCHARDEV_INFO_0; +alias PCHARDEV_INFO_0 = CHARDEV_INFO_0*, LPCHARDEV_INFO_0 = CHARDEV_INFO_0*; struct CHARDEV_INFO_1{ LPWSTR ch1_dev; @@ -44,12 +44,12 @@ struct CHARDEV_INFO_1{ LPWSTR ch1_username; DWORD ch1_time; } -alias CHARDEV_INFO_1* PCHARDEV_INFO_1, LPCHARDEV_INFO_1; +alias PCHARDEV_INFO_1 = CHARDEV_INFO_1*, LPCHARDEV_INFO_1 = CHARDEV_INFO_1*; struct CHARDEVQ_INFO_0 { LPWSTR cq0_dev; } -alias CHARDEVQ_INFO_0* PCHARDEVQ_INFO_0, LPCHARDEVQ_INFO_0; +alias PCHARDEVQ_INFO_0 = CHARDEVQ_INFO_0*, LPCHARDEVQ_INFO_0 = CHARDEVQ_INFO_0*; struct CHARDEVQ_INFO_1{ LPWSTR cq1_dev; @@ -58,23 +58,23 @@ struct CHARDEVQ_INFO_1{ DWORD cq1_numusers; DWORD cq1_numahead; } -alias CHARDEVQ_INFO_1* PCHARDEVQ_INFO_1, LPCHARDEVQ_INFO_1; +alias PCHARDEVQ_INFO_1 = CHARDEVQ_INFO_1*, LPCHARDEVQ_INFO_1 = CHARDEVQ_INFO_1*; struct CHARDEVQ_INFO_1002 { DWORD cq1002_priority; } -alias CHARDEVQ_INFO_1002* PCHARDEVQ_INFO_1002, LPCHARDEVQ_INFO_1002; +alias PCHARDEVQ_INFO_1002 = CHARDEVQ_INFO_1002*, LPCHARDEVQ_INFO_1002 = CHARDEVQ_INFO_1002*; struct CHARDEVQ_INFO_1003 { LPWSTR cq1003_devs; } -alias CHARDEVQ_INFO_1003* PCHARDEVQ_INFO_1003, LPCHARDEVQ_INFO_1003; +alias PCHARDEVQ_INFO_1003 = CHARDEVQ_INFO_1003*, LPCHARDEVQ_INFO_1003 = CHARDEVQ_INFO_1003*; struct HANDLE_INFO_1{ DWORD hdli1_chartime; DWORD hdli1_charcount; } -alias HANDLE_INFO_1* PHANDLE_INFO_1, LPHANDLE_INFO_1; +alias PHANDLE_INFO_1 = HANDLE_INFO_1*, LPHANDLE_INFO_1 = HANDLE_INFO_1*; extern (Windows) { NET_API_STATUS NetCharDevEnum(LPCWSTR, DWORD, PBYTE*, DWORD, PDWORD, PDWORD, PDWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmconfig.d b/runtime/druntime/src/core/sys/windows/lmconfig.d index 6652a521448..10172c60363 100644 --- a/runtime/druntime/src/core/sys/windows/lmconfig.d +++ b/runtime/druntime/src/core/sys/windows/lmconfig.d @@ -19,7 +19,7 @@ deprecated { LPWSTR cfgi0_data; } - alias CONFIG_INFO_0* PCONFIG_INFO_0, LPCONFIG_INFO_0; + alias PCONFIG_INFO_0 = CONFIG_INFO_0*, LPCONFIG_INFO_0 = CONFIG_INFO_0*; extern (Windows) { NET_API_STATUS NetConfigGet(LPCWSTR, LPCWSTR, LPCWSTR, PBYTE*); diff --git a/runtime/druntime/src/core/sys/windows/lmcons.d b/runtime/druntime/src/core/sys/windows/lmcons.d index 838748a1387..a16294c7b42 100644 --- a/runtime/druntime/src/core/sys/windows/lmcons.d +++ b/runtime/druntime/src/core/sys/windows/lmcons.d @@ -19,7 +19,7 @@ const TCHAR[] OS2MSG_FILENAME = "BASE", HELP_MSG_FILENAME = "NETH"; -alias DWORD NET_API_STATUS, API_RET_TYPE; +alias NET_API_STATUS = DWORD, API_RET_TYPE = DWORD; enum MIN_LANMAN_MESSAGE_ID = NERR_BASE; enum MAX_LANMAN_MESSAGE_ID = 5799; @@ -80,9 +80,9 @@ enum PLATFORM_ID_VMS = 700; // this is a new typedef in W2K, but it should be harmless for earlier Windows versions. version (Unicode) { - alias LPWSTR LMSTR; - alias LPCWSTR LMCSTR; + alias LMSTR = LPWSTR; + alias LMCSTR = LPCWSTR; } else { - alias LPSTR LMSTR; - alias LPCSTR LMCSTR; + alias LMSTR = LPSTR; + alias LMCSTR = LPCSTR; } diff --git a/runtime/druntime/src/core/sys/windows/lmerrlog.d b/runtime/druntime/src/core/sys/windows/lmerrlog.d index effe73a9ae5..159e010c044 100644 --- a/runtime/druntime/src/core/sys/windows/lmerrlog.d +++ b/runtime/druntime/src/core/sys/windows/lmerrlog.d @@ -209,7 +209,7 @@ struct ERROR_LOG { DWORD el_data_size; DWORD el_nstrings; } -alias ERROR_LOG* PERROR_LOG, LPERROR_LOG; +alias PERROR_LOG = ERROR_LOG*, LPERROR_LOG = ERROR_LOG*; extern (Windows) { deprecated { diff --git a/runtime/druntime/src/core/sys/windows/lmmsg.d b/runtime/druntime/src/core/sys/windows/lmmsg.d index eab87882747..40ad5f7ec12 100644 --- a/runtime/druntime/src/core/sys/windows/lmmsg.d +++ b/runtime/druntime/src/core/sys/windows/lmmsg.d @@ -23,14 +23,14 @@ enum MSGNAME_FORWARDED_FROM = 16; struct MSG_INFO_0 { LPWSTR msgi0_name; } -alias MSG_INFO_0* PMSG_INFO_0, LPMSG_INFO_0; +alias PMSG_INFO_0 = MSG_INFO_0*, LPMSG_INFO_0 = MSG_INFO_0*; struct MSG_INFO_1 { LPWSTR msgi1_name; DWORD msgi1_forward_flag; LPWSTR msgi1_forward; } -alias MSG_INFO_1* PMSG_INFO_1, LPMSG_INFO_1; +alias PMSG_INFO_1 = MSG_INFO_1*, LPMSG_INFO_1 = MSG_INFO_1*; extern (Windows) nothrow @nogc { NET_API_STATUS NetMessageBufferSend(LPCWSTR, LPCWSTR, LPCWSTR, PBYTE, diff --git a/runtime/druntime/src/core/sys/windows/lmremutl.d b/runtime/druntime/src/core/sys/windows/lmremutl.d index 196be667fec..565feea3778 100644 --- a/runtime/druntime/src/core/sys/windows/lmremutl.d +++ b/runtime/druntime/src/core/sys/windows/lmremutl.d @@ -32,9 +32,9 @@ enum USE_SPECIFIC_TRANSPORT = 0x80000000; //[No] typedef WCHAR DESC_CHAR; //[No] #endif // FIXME (D): Is this OK? -alias TCHAR DESC_CHAR; +alias DESC_CHAR = TCHAR; -alias DESC_CHAR* LPDESC; +alias LPDESC = DESC_CHAR*; struct TIME_OF_DAY_INFO { DWORD tod_elapsedt; @@ -50,7 +50,7 @@ struct TIME_OF_DAY_INFO { DWORD tod_year; DWORD tod_weekday; } -alias TIME_OF_DAY_INFO* PTIME_OF_DAY_INFO, LPTIME_OF_DAY_INFO; +alias PTIME_OF_DAY_INFO = TIME_OF_DAY_INFO*, LPTIME_OF_DAY_INFO = TIME_OF_DAY_INFO*; extern (Windows) nothrow @nogc { NET_API_STATUS NetRemoteTOD(LPCWSTR, PBYTE*); diff --git a/runtime/druntime/src/core/sys/windows/lmrepl.d b/runtime/druntime/src/core/sys/windows/lmrepl.d index 1563a5e2902..1cf9ed838bc 100644 --- a/runtime/druntime/src/core/sys/windows/lmrepl.d +++ b/runtime/druntime/src/core/sys/windows/lmrepl.d @@ -47,39 +47,39 @@ struct REPL_INFO_0 { DWORD rp0_guardtime; DWORD rp0_random; } -alias REPL_INFO_0* PREPL_INFO_0, LPREPL_INFO_0; +alias PREPL_INFO_0 = REPL_INFO_0*, LPREPL_INFO_0 = REPL_INFO_0*; struct REPL_INFO_1000 { DWORD rp1000_interval; } -alias REPL_INFO_1000* PREPL_INFO_1000, LPREPL_INFO_1000; +alias PREPL_INFO_1000 = REPL_INFO_1000*, LPREPL_INFO_1000 = REPL_INFO_1000*; struct REPL_INFO_1001 { DWORD rp1001_pulse; } -alias REPL_INFO_1001* PREPL_INFO_1001, LPREPL_INFO_1001; +alias PREPL_INFO_1001 = REPL_INFO_1001*, LPREPL_INFO_1001 = REPL_INFO_1001*; struct REPL_INFO_1002 { DWORD rp1002_guardtime; } -alias REPL_INFO_1002* PREPL_INFO_1002, LPREPL_INFO_1002; +alias PREPL_INFO_1002 = REPL_INFO_1002*, LPREPL_INFO_1002 = REPL_INFO_1002*; struct REPL_INFO_1003 { DWORD rp1003_random; } -alias REPL_INFO_1003* PREPL_INFO_1003, LPREPL_INFO_1003; +alias PREPL_INFO_1003 = REPL_INFO_1003*, LPREPL_INFO_1003 = REPL_INFO_1003*; struct REPL_EDIR_INFO_0 { LPWSTR rped0_dirname; } -alias REPL_EDIR_INFO_0* PREPL_EDIR_INFO_0, LPREPL_EDIR_INFO_0; +alias PREPL_EDIR_INFO_0 = REPL_EDIR_INFO_0*, LPREPL_EDIR_INFO_0 = REPL_EDIR_INFO_0*; struct REPL_EDIR_INFO_1 { LPWSTR rped1_dirname; DWORD rped1_integrity; DWORD rped1_extent; } -alias REPL_EDIR_INFO_1* PREPL_EDIR_INFO_1, LPREPL_EDIR_INFO_1; +alias PREPL_EDIR_INFO_1 = REPL_EDIR_INFO_1*, LPREPL_EDIR_INFO_1 = REPL_EDIR_INFO_1*; struct REPL_EDIR_INFO_2 { LPWSTR rped2_dirname; @@ -88,22 +88,22 @@ struct REPL_EDIR_INFO_2 { DWORD rped2_lockcount; DWORD rped2_locktime; } -alias REPL_EDIR_INFO_2* PREPL_EDIR_INFO_2, LPREPL_EDIR_INFO_2; +alias PREPL_EDIR_INFO_2 = REPL_EDIR_INFO_2*, LPREPL_EDIR_INFO_2 = REPL_EDIR_INFO_2*; struct REPL_EDIR_INFO_1000 { DWORD rped1000_integrity; } -alias REPL_EDIR_INFO_1000* PREPL_EDIR_INFO_1000, LPREPL_EDIR_INFO_1000; +alias PREPL_EDIR_INFO_1000 = REPL_EDIR_INFO_1000*, LPREPL_EDIR_INFO_1000 = REPL_EDIR_INFO_1000*; struct REPL_EDIR_INFO_1001 { DWORD rped1001_extent; } -alias REPL_EDIR_INFO_1001* PREPL_EDIR_INFO_1001, LPREPL_EDIR_INFO_1001; +alias PREPL_EDIR_INFO_1001 = REPL_EDIR_INFO_1001*, LPREPL_EDIR_INFO_1001 = REPL_EDIR_INFO_1001*; struct REPL_IDIR_INFO_0 { LPWSTR rpid0_dirname; } -alias REPL_IDIR_INFO_0* PREPL_IDIR_INFO_0, LPREPL_IDIR_INFO_0; +alias PREPL_IDIR_INFO_0 = REPL_IDIR_INFO_0*, LPREPL_IDIR_INFO_0 = REPL_IDIR_INFO_0*; struct REPL_IDIR_INFO_1 { LPWSTR rpid1_dirname; @@ -113,7 +113,7 @@ struct REPL_IDIR_INFO_1 { DWORD rpid1_lockcount; DWORD rpid1_locktime; } -alias REPL_IDIR_INFO_1* PREPL_IDIR_INFO_1, LPREPL_IDIR_INFO_1; +alias PREPL_IDIR_INFO_1 = REPL_IDIR_INFO_1*, LPREPL_IDIR_INFO_1 = REPL_IDIR_INFO_1*; extern (Windows) { NET_API_STATUS NetReplGetInfo(LPCWSTR,DWORD,PBYTE*); diff --git a/runtime/druntime/src/core/sys/windows/lmserver.d b/runtime/druntime/src/core/sys/windows/lmserver.d index 5a550bca80d..8e5ad0845de 100644 --- a/runtime/druntime/src/core/sys/windows/lmserver.d +++ b/runtime/druntime/src/core/sys/windows/lmserver.d @@ -16,7 +16,7 @@ struct SERVER_INFO_100 { DWORD sv100_platform_id; LPWSTR sv100_name; } -alias SERVER_INFO_100* PSERVER_INFO_100, LPSERVER_INFO_100; +alias PSERVER_INFO_100 = SERVER_INFO_100*, LPSERVER_INFO_100 = SERVER_INFO_100*; struct SERVER_INFO_101 { DWORD sv101_platform_id; @@ -26,7 +26,7 @@ struct SERVER_INFO_101 { DWORD sv101_type; LPWSTR sv101_comment; } -alias SERVER_INFO_101* PSERVER_INFO_101, LPSERVER_INFO_101; +alias PSERVER_INFO_101 = SERVER_INFO_101*, LPSERVER_INFO_101 = SERVER_INFO_101*; struct SERVER_INFO_102 { DWORD sv102_platform_id; @@ -43,7 +43,7 @@ struct SERVER_INFO_102 { DWORD sv102_licenses; LPWSTR sv102_userpath; } -alias SERVER_INFO_102* PSERVER_INFO_102, LPSERVER_INFO_102; +alias PSERVER_INFO_102 = SERVER_INFO_102*, LPSERVER_INFO_102 = SERVER_INFO_102*; struct SERVER_INFO_402 { DWORD sv402_ulist_mtime; @@ -78,7 +78,7 @@ struct SERVER_INFO_402 { DWORD sv402_maxauditsz; LPWSTR sv402_srvheuristics; } -alias SERVER_INFO_402* PSERVER_INFO_402, LPSERVER_INFO_402; +alias PSERVER_INFO_402 = SERVER_INFO_402*, LPSERVER_INFO_402 = SERVER_INFO_402*; struct SERVER_INFO_403 { DWORD sv403_ulist_mtime; @@ -116,7 +116,7 @@ struct SERVER_INFO_403 { DWORD sv403_autoprofile; LPWSTR sv403_autopath; } -alias SERVER_INFO_403* PSERVER_INFO_403, LPSERVER_INFO_403; +alias PSERVER_INFO_403 = SERVER_INFO_403*, LPSERVER_INFO_403 = SERVER_INFO_403*; struct SERVER_INFO_502 { DWORD sv502_sessopens; @@ -138,7 +138,7 @@ struct SERVER_INFO_502 { BOOL sv502_acceptdownlevelapis; BOOL sv502_lmannounce; } -alias SERVER_INFO_502* PSERVER_INFO_502, LPSERVER_INFO_502; +alias PSERVER_INFO_502 = SERVER_INFO_502*, LPSERVER_INFO_502 = SERVER_INFO_502*; struct SERVER_INFO_503 { DWORD sv503_sessopens; @@ -184,7 +184,7 @@ struct SERVER_INFO_503 { DWORD sv503_minfreeconnections; DWORD sv503_maxfreeconnections; } -alias SERVER_INFO_503* PSERVER_INFO_503, LPSERVER_INFO_503; +alias PSERVER_INFO_503 = SERVER_INFO_503*, LPSERVER_INFO_503 = SERVER_INFO_503*; struct SERVER_INFO_599 { DWORD sv599_sessopens; @@ -244,7 +244,7 @@ struct SERVER_INFO_599 { DWORD sv599_scavqosinfoupdatetime; DWORD sv599_maxworkitemidletime; } -alias SERVER_INFO_599* PSERVER_INFO_599, LPSERVER_INFO_599; +alias PSERVER_INFO_599 = SERVER_INFO_599*, LPSERVER_INFO_599 = SERVER_INFO_599*; struct SERVER_INFO_598 { DWORD sv598_maxrawworkitems; @@ -274,401 +274,401 @@ struct SERVER_INFO_598 { DWORD sv598_maxpagedpoolchunksize; BOOL sv598_sendsfrompreferredprocessor; } -alias SERVER_INFO_598* PSERVER_INFO_598, LPSERVER_INFO_598; +alias PSERVER_INFO_598 = SERVER_INFO_598*, LPSERVER_INFO_598 = SERVER_INFO_598*; struct SERVER_INFO_1005 { LPWSTR sv1005_comment; } -alias SERVER_INFO_1005* PSERVER_INFO_1005, LPSERVER_INFO_1005; +alias PSERVER_INFO_1005 = SERVER_INFO_1005*, LPSERVER_INFO_1005 = SERVER_INFO_1005*; struct SERVER_INFO_1107 { DWORD sv1107_users; } -alias SERVER_INFO_1107* PSERVER_INFO_1107, LPSERVER_INFO_1107; +alias PSERVER_INFO_1107 = SERVER_INFO_1107*, LPSERVER_INFO_1107 = SERVER_INFO_1107*; struct SERVER_INFO_1010 { LONG sv1010_disc; } -alias SERVER_INFO_1010* PSERVER_INFO_1010, LPSERVER_INFO_1010; +alias PSERVER_INFO_1010 = SERVER_INFO_1010*, LPSERVER_INFO_1010 = SERVER_INFO_1010*; struct SERVER_INFO_1016 { BOOL sv1016_hidden; } -alias SERVER_INFO_1016* PSERVER_INFO_1016, LPSERVER_INFO_1016; +alias PSERVER_INFO_1016 = SERVER_INFO_1016*, LPSERVER_INFO_1016 = SERVER_INFO_1016*; struct SERVER_INFO_1017 { DWORD sv1017_announce; } -alias SERVER_INFO_1017* PSERVER_INFO_1017, LPSERVER_INFO_1017; +alias PSERVER_INFO_1017 = SERVER_INFO_1017*, LPSERVER_INFO_1017 = SERVER_INFO_1017*; struct SERVER_INFO_1018 { DWORD sv1018_anndelta; } -alias SERVER_INFO_1018* PSERVER_INFO_1018, LPSERVER_INFO_1018; +alias PSERVER_INFO_1018 = SERVER_INFO_1018*, LPSERVER_INFO_1018 = SERVER_INFO_1018*; struct SERVER_INFO_1501 { DWORD sv1501_sessopens; } -alias SERVER_INFO_1501* PSERVER_INFO_1501, LPSERVER_INFO_1501; +alias PSERVER_INFO_1501 = SERVER_INFO_1501*, LPSERVER_INFO_1501 = SERVER_INFO_1501*; struct SERVER_INFO_1502 { DWORD sv1502_sessvcs; } -alias SERVER_INFO_1502* PSERVER_INFO_1502, LPSERVER_INFO_1502; +alias PSERVER_INFO_1502 = SERVER_INFO_1502*, LPSERVER_INFO_1502 = SERVER_INFO_1502*; struct SERVER_INFO_1503 { DWORD sv1503_opensearch; } -alias SERVER_INFO_1503* PSERVER_INFO_1503, LPSERVER_INFO_1503; +alias PSERVER_INFO_1503 = SERVER_INFO_1503*, LPSERVER_INFO_1503 = SERVER_INFO_1503*; struct SERVER_INFO_1506 { DWORD sv1506_maxworkitems; } -alias SERVER_INFO_1506* PSERVER_INFO_1506, LPSERVER_INFO_1506; +alias PSERVER_INFO_1506 = SERVER_INFO_1506*, LPSERVER_INFO_1506 = SERVER_INFO_1506*; struct SERVER_INFO_1509 { DWORD sv1509_maxrawbuflen; } -alias SERVER_INFO_1509* PSERVER_INFO_1509, LPSERVER_INFO_1509; +alias PSERVER_INFO_1509 = SERVER_INFO_1509*, LPSERVER_INFO_1509 = SERVER_INFO_1509*; struct SERVER_INFO_1510 { DWORD sv1510_sessusers; } -alias SERVER_INFO_1510* PSERVER_INFO_1510, LPSERVER_INFO_1510; +alias PSERVER_INFO_1510 = SERVER_INFO_1510*, LPSERVER_INFO_1510 = SERVER_INFO_1510*; struct SERVER_INFO_1511 { DWORD sv1511_sessconns; -} alias SERVER_INFO_1511* PSERVER_INFO_1511, LPSERVER_INFO_1511; +} alias PSERVER_INFO_1511 = SERVER_INFO_1511*, LPSERVER_INFO_1511 = SERVER_INFO_1511*; struct SERVER_INFO_1512 { DWORD sv1512_maxnonpagedmemoryusage; } -alias SERVER_INFO_1512* PSERVER_INFO_1512, LPSERVER_INFO_1512; +alias PSERVER_INFO_1512 = SERVER_INFO_1512*, LPSERVER_INFO_1512 = SERVER_INFO_1512*; struct SERVER_INFO_1513 { DWORD sv1513_maxpagedmemoryusage; } -alias SERVER_INFO_1513* PSERVER_INFO_1513, LPSERVER_INFO_1513; +alias PSERVER_INFO_1513 = SERVER_INFO_1513*, LPSERVER_INFO_1513 = SERVER_INFO_1513*; struct SERVER_INFO_1514 { BOOL sv1514_enablesoftcompat; } -alias SERVER_INFO_1514* PSERVER_INFO_1514, LPSERVER_INFO_1514; +alias PSERVER_INFO_1514 = SERVER_INFO_1514*, LPSERVER_INFO_1514 = SERVER_INFO_1514*; struct SERVER_INFO_1515 { BOOL sv1515_enableforcedlogoff; } -alias SERVER_INFO_1515* PSERVER_INFO_1515, LPSERVER_INFO_1515; +alias PSERVER_INFO_1515 = SERVER_INFO_1515*, LPSERVER_INFO_1515 = SERVER_INFO_1515*; struct SERVER_INFO_1516 { BOOL sv1516_timesource; } -alias SERVER_INFO_1516* PSERVER_INFO_1516, LPSERVER_INFO_1516; +alias PSERVER_INFO_1516 = SERVER_INFO_1516*, LPSERVER_INFO_1516 = SERVER_INFO_1516*; struct SERVER_INFO_1518 { BOOL sv1518_lmannounce; } -alias SERVER_INFO_1518* PSERVER_INFO_1518, LPSERVER_INFO_1518; +alias PSERVER_INFO_1518 = SERVER_INFO_1518*, LPSERVER_INFO_1518 = SERVER_INFO_1518*; struct SERVER_INFO_1520 { DWORD sv1520_maxcopyreadlen; } -alias SERVER_INFO_1520* PSERVER_INFO_1520, LPSERVER_INFO_1520; +alias PSERVER_INFO_1520 = SERVER_INFO_1520*, LPSERVER_INFO_1520 = SERVER_INFO_1520*; struct SERVER_INFO_1521 { DWORD sv1521_maxcopywritelen; } -alias SERVER_INFO_1521* PSERVER_INFO_1521, LPSERVER_INFO_1521; +alias PSERVER_INFO_1521 = SERVER_INFO_1521*, LPSERVER_INFO_1521 = SERVER_INFO_1521*; struct SERVER_INFO_1522 { DWORD sv1522_minkeepsearch; } -alias SERVER_INFO_1522* PSERVER_INFO_1522, LPSERVER_INFO_1522; +alias PSERVER_INFO_1522 = SERVER_INFO_1522*, LPSERVER_INFO_1522 = SERVER_INFO_1522*; struct SERVER_INFO_1523 { DWORD sv1523_maxkeepsearch; } -alias SERVER_INFO_1523* PSERVER_INFO_1523, LPSERVER_INFO_1523; +alias PSERVER_INFO_1523 = SERVER_INFO_1523*, LPSERVER_INFO_1523 = SERVER_INFO_1523*; struct SERVER_INFO_1524 { DWORD sv1524_minkeepcomplsearch; } -alias SERVER_INFO_1524* PSERVER_INFO_1524, LPSERVER_INFO_1524; +alias PSERVER_INFO_1524 = SERVER_INFO_1524*, LPSERVER_INFO_1524 = SERVER_INFO_1524*; struct SERVER_INFO_1525 { DWORD sv1525_maxkeepcomplsearch; } -alias SERVER_INFO_1525* PSERVER_INFO_1525, LPSERVER_INFO_1525; +alias PSERVER_INFO_1525 = SERVER_INFO_1525*, LPSERVER_INFO_1525 = SERVER_INFO_1525*; struct SERVER_INFO_1528 { DWORD sv1528_scavtimeout; } -alias SERVER_INFO_1528* PSERVER_INFO_1528, LPSERVER_INFO_1528; +alias PSERVER_INFO_1528 = SERVER_INFO_1528*, LPSERVER_INFO_1528 = SERVER_INFO_1528*; struct SERVER_INFO_1529 { DWORD sv1529_minrcvqueue; } -alias SERVER_INFO_1529* PSERVER_INFO_1529, LPSERVER_INFO_1529; +alias PSERVER_INFO_1529 = SERVER_INFO_1529*, LPSERVER_INFO_1529 = SERVER_INFO_1529*; struct SERVER_INFO_1530 { DWORD sv1530_minfreeworkitems; } -alias SERVER_INFO_1530* PSERVER_INFO_1530, LPSERVER_INFO_1530; +alias PSERVER_INFO_1530 = SERVER_INFO_1530*, LPSERVER_INFO_1530 = SERVER_INFO_1530*; struct SERVER_INFO_1533 { DWORD sv1533_maxmpxct; } -alias SERVER_INFO_1533* PSERVER_INFO_1533, LPSERVER_INFO_1533; +alias PSERVER_INFO_1533 = SERVER_INFO_1533*, LPSERVER_INFO_1533 = SERVER_INFO_1533*; struct SERVER_INFO_1534 { DWORD sv1534_oplockbreakwait; } -alias SERVER_INFO_1534* PSERVER_INFO_1534, LPSERVER_INFO_1534; +alias PSERVER_INFO_1534 = SERVER_INFO_1534*, LPSERVER_INFO_1534 = SERVER_INFO_1534*; struct SERVER_INFO_1535 { DWORD sv1535_oplockbreakresponsewait; } -alias SERVER_INFO_1535* PSERVER_INFO_1535, LPSERVER_INFO_1535; +alias PSERVER_INFO_1535 = SERVER_INFO_1535*, LPSERVER_INFO_1535 = SERVER_INFO_1535*; struct SERVER_INFO_1536 { BOOL sv1536_enableoplocks; } -alias SERVER_INFO_1536* PSERVER_INFO_1536, LPSERVER_INFO_1536; +alias PSERVER_INFO_1536 = SERVER_INFO_1536*, LPSERVER_INFO_1536 = SERVER_INFO_1536*; struct SERVER_INFO_1537 { BOOL sv1537_enableoplockforceclose; } -alias SERVER_INFO_1537* PSERVER_INFO_1537, LPSERVER_INFO_1537; +alias PSERVER_INFO_1537 = SERVER_INFO_1537*, LPSERVER_INFO_1537 = SERVER_INFO_1537*; struct SERVER_INFO_1538 { BOOL sv1538_enablefcbopens; } -alias SERVER_INFO_1538* PSERVER_INFO_1538, LPSERVER_INFO_1538; +alias PSERVER_INFO_1538 = SERVER_INFO_1538*, LPSERVER_INFO_1538 = SERVER_INFO_1538*; struct SERVER_INFO_1539 { BOOL sv1539_enableraw; } -alias SERVER_INFO_1539* PSERVER_INFO_1539, LPSERVER_INFO_1539; +alias PSERVER_INFO_1539 = SERVER_INFO_1539*, LPSERVER_INFO_1539 = SERVER_INFO_1539*; struct SERVER_INFO_1540 { BOOL sv1540_enablesharednetdrives; } -alias SERVER_INFO_1540* PSERVER_INFO_1540, LPSERVER_INFO_1540; +alias PSERVER_INFO_1540 = SERVER_INFO_1540*, LPSERVER_INFO_1540 = SERVER_INFO_1540*; struct SERVER_INFO_1541 { BOOL sv1541_minfreeconnections; } -alias SERVER_INFO_1541* PSERVER_INFO_1541, LPSERVER_INFO_1541; +alias PSERVER_INFO_1541 = SERVER_INFO_1541*, LPSERVER_INFO_1541 = SERVER_INFO_1541*; struct SERVER_INFO_1542 { BOOL sv1542_maxfreeconnections; } -alias SERVER_INFO_1542* PSERVER_INFO_1542, LPSERVER_INFO_1542; +alias PSERVER_INFO_1542 = SERVER_INFO_1542*, LPSERVER_INFO_1542 = SERVER_INFO_1542*; struct SERVER_INFO_1543 { DWORD sv1543_initsesstable; } -alias SERVER_INFO_1543* PSERVER_INFO_1543, LPSERVER_INFO_1543; +alias PSERVER_INFO_1543 = SERVER_INFO_1543*, LPSERVER_INFO_1543 = SERVER_INFO_1543*; struct SERVER_INFO_1544 { DWORD sv1544_initconntable; } -alias SERVER_INFO_1544* PSERVER_INFO_1544, LPSERVER_INFO_1544; +alias PSERVER_INFO_1544 = SERVER_INFO_1544*, LPSERVER_INFO_1544 = SERVER_INFO_1544*; struct SERVER_INFO_1545 { DWORD sv1545_initfiletable; } -alias SERVER_INFO_1545* PSERVER_INFO_1545, LPSERVER_INFO_1545; +alias PSERVER_INFO_1545 = SERVER_INFO_1545*, LPSERVER_INFO_1545 = SERVER_INFO_1545*; struct SERVER_INFO_1546 { DWORD sv1546_initsearchtable; } -alias SERVER_INFO_1546* PSERVER_INFO_1546, LPSERVER_INFO_1546; +alias PSERVER_INFO_1546 = SERVER_INFO_1546*, LPSERVER_INFO_1546 = SERVER_INFO_1546*; struct SERVER_INFO_1547 { DWORD sv1547_alertschedule; } -alias SERVER_INFO_1547* PSERVER_INFO_1547, LPSERVER_INFO_1547; +alias PSERVER_INFO_1547 = SERVER_INFO_1547*, LPSERVER_INFO_1547 = SERVER_INFO_1547*; struct SERVER_INFO_1548 { DWORD sv1548_errorthreshold; } -alias SERVER_INFO_1548* PSERVER_INFO_1548, LPSERVER_INFO_1548; +alias PSERVER_INFO_1548 = SERVER_INFO_1548*, LPSERVER_INFO_1548 = SERVER_INFO_1548*; struct SERVER_INFO_1549 { DWORD sv1549_networkerrorthreshold; } -alias SERVER_INFO_1549* PSERVER_INFO_1549, LPSERVER_INFO_1549; +alias PSERVER_INFO_1549 = SERVER_INFO_1549*, LPSERVER_INFO_1549 = SERVER_INFO_1549*; struct SERVER_INFO_1550 { DWORD sv1550_diskspacethreshold; } -alias SERVER_INFO_1550* PSERVER_INFO_1550, LPSERVER_INFO_1550; +alias PSERVER_INFO_1550 = SERVER_INFO_1550*, LPSERVER_INFO_1550 = SERVER_INFO_1550*; struct SERVER_INFO_1552 { DWORD sv1552_maxlinkdelay; } -alias SERVER_INFO_1552* PSERVER_INFO_1552, LPSERVER_INFO_1552; +alias PSERVER_INFO_1552 = SERVER_INFO_1552*, LPSERVER_INFO_1552 = SERVER_INFO_1552*; struct SERVER_INFO_1553 { DWORD sv1553_minlinkthroughput; } -alias SERVER_INFO_1553* PSERVER_INFO_1553, LPSERVER_INFO_1553; +alias PSERVER_INFO_1553 = SERVER_INFO_1553*, LPSERVER_INFO_1553 = SERVER_INFO_1553*; struct SERVER_INFO_1554 { DWORD sv1554_linkinfovalidtime; } -alias SERVER_INFO_1554* PSERVER_INFO_1554, LPSERVER_INFO_1554; +alias PSERVER_INFO_1554 = SERVER_INFO_1554*, LPSERVER_INFO_1554 = SERVER_INFO_1554*; struct SERVER_INFO_1555 { DWORD sv1555_scavqosinfoupdatetime; } -alias SERVER_INFO_1555* PSERVER_INFO_1555, LPSERVER_INFO_1555; +alias PSERVER_INFO_1555 = SERVER_INFO_1555*, LPSERVER_INFO_1555 = SERVER_INFO_1555*; struct SERVER_INFO_1556 { DWORD sv1556_maxworkitemidletime; } -alias SERVER_INFO_1556* PSERVER_INFO_1556, LPSERVER_INFO_1556; +alias PSERVER_INFO_1556 = SERVER_INFO_1556*, LPSERVER_INFO_1556 = SERVER_INFO_1556*; struct SERVER_INFO_1557 { DWORD sv1557_maxrawworkitems; } -alias SERVER_INFO_1557* PSERVER_INFO_1557, LPSERVER_INFO_1557; +alias PSERVER_INFO_1557 = SERVER_INFO_1557*, LPSERVER_INFO_1557 = SERVER_INFO_1557*; struct SERVER_INFO_1560 { DWORD sv1560_producttype; } -alias SERVER_INFO_1560* PSERVER_INFO_1560, LPSERVER_INFO_1560; +alias PSERVER_INFO_1560 = SERVER_INFO_1560*, LPSERVER_INFO_1560 = SERVER_INFO_1560*; struct SERVER_INFO_1561 { DWORD sv1561_serversize; } -alias SERVER_INFO_1561* PSERVER_INFO_1561, LPSERVER_INFO_1561; +alias PSERVER_INFO_1561 = SERVER_INFO_1561*, LPSERVER_INFO_1561 = SERVER_INFO_1561*; struct SERVER_INFO_1562 { DWORD sv1562_connectionlessautodisc; } -alias SERVER_INFO_1562* PSERVER_INFO_1562, LPSERVER_INFO_1562; +alias PSERVER_INFO_1562 = SERVER_INFO_1562*, LPSERVER_INFO_1562 = SERVER_INFO_1562*; struct SERVER_INFO_1563 { DWORD sv1563_sharingviolationretries; } -alias SERVER_INFO_1563* PSERVER_INFO_1563, LPSERVER_INFO_1563; +alias PSERVER_INFO_1563 = SERVER_INFO_1563*, LPSERVER_INFO_1563 = SERVER_INFO_1563*; struct SERVER_INFO_1564 { DWORD sv1564_sharingviolationdelay; } -alias SERVER_INFO_1564* PSERVER_INFO_1564, LPSERVER_INFO_1564; +alias PSERVER_INFO_1564 = SERVER_INFO_1564*, LPSERVER_INFO_1564 = SERVER_INFO_1564*; struct SERVER_INFO_1565 { DWORD sv1565_maxglobalopensearch; } -alias SERVER_INFO_1565* PSERVER_INFO_1565, LPSERVER_INFO_1565; +alias PSERVER_INFO_1565 = SERVER_INFO_1565*, LPSERVER_INFO_1565 = SERVER_INFO_1565*; struct SERVER_INFO_1566 { BOOL sv1566_removeduplicatesearches; } -alias SERVER_INFO_1566* PSERVER_INFO_1566, LPSERVER_INFO_1566; +alias PSERVER_INFO_1566 = SERVER_INFO_1566*, LPSERVER_INFO_1566 = SERVER_INFO_1566*; struct SERVER_INFO_1567 { DWORD sv1567_lockviolationretries; } -alias SERVER_INFO_1567* PSERVER_INFO_1567, LPSERVER_INFO_1567; +alias PSERVER_INFO_1567 = SERVER_INFO_1567*, LPSERVER_INFO_1567 = SERVER_INFO_1567*; struct SERVER_INFO_1568 { DWORD sv1568_lockviolationoffset; } -alias SERVER_INFO_1568* PSERVER_INFO_1568, LPSERVER_INFO_1568; +alias PSERVER_INFO_1568 = SERVER_INFO_1568*, LPSERVER_INFO_1568 = SERVER_INFO_1568*; struct SERVER_INFO_1569 { DWORD sv1569_lockviolationdelay; } -alias SERVER_INFO_1569* PSERVER_INFO_1569, LPSERVER_INFO_1569; +alias PSERVER_INFO_1569 = SERVER_INFO_1569*, LPSERVER_INFO_1569 = SERVER_INFO_1569*; struct SERVER_INFO_1570 { DWORD sv1570_mdlreadswitchover; } -alias SERVER_INFO_1570* PSERVER_INFO_1570, LPSERVER_INFO_1570; +alias PSERVER_INFO_1570 = SERVER_INFO_1570*, LPSERVER_INFO_1570 = SERVER_INFO_1570*; struct SERVER_INFO_1571 { DWORD sv1571_cachedopenlimit; } -alias SERVER_INFO_1571* PSERVER_INFO_1571, LPSERVER_INFO_1571; +alias PSERVER_INFO_1571 = SERVER_INFO_1571*, LPSERVER_INFO_1571 = SERVER_INFO_1571*; struct SERVER_INFO_1572 { DWORD sv1572_criticalthreads; } -alias SERVER_INFO_1572* PSERVER_INFO_1572, LPSERVER_INFO_1572; +alias PSERVER_INFO_1572 = SERVER_INFO_1572*, LPSERVER_INFO_1572 = SERVER_INFO_1572*; struct SERVER_INFO_1573 { DWORD sv1573_restrictnullsessaccess; } -alias SERVER_INFO_1573* PSERVER_INFO_1573, LPSERVER_INFO_1573; +alias PSERVER_INFO_1573 = SERVER_INFO_1573*, LPSERVER_INFO_1573 = SERVER_INFO_1573*; struct SERVER_INFO_1574 { DWORD sv1574_enablewfw311directipx; } -alias SERVER_INFO_1574* PSERVER_INFO_1574, LPSERVER_INFO_1574; +alias PSERVER_INFO_1574 = SERVER_INFO_1574*, LPSERVER_INFO_1574 = SERVER_INFO_1574*; struct SERVER_INFO_1575 { DWORD sv1575_otherqueueaffinity; } -alias SERVER_INFO_1575* PSERVER_INFO_1575, LPSERVER_INFO_1575; +alias PSERVER_INFO_1575 = SERVER_INFO_1575*, LPSERVER_INFO_1575 = SERVER_INFO_1575*; struct SERVER_INFO_1576 { DWORD sv1576_queuesamplesecs; } -alias SERVER_INFO_1576* PSERVER_INFO_1576, LPSERVER_INFO_1576; +alias PSERVER_INFO_1576 = SERVER_INFO_1576*, LPSERVER_INFO_1576 = SERVER_INFO_1576*; struct SERVER_INFO_1577 { DWORD sv1577_balancecount; } -alias SERVER_INFO_1577* PSERVER_INFO_1577, LPSERVER_INFO_1577; +alias PSERVER_INFO_1577 = SERVER_INFO_1577*, LPSERVER_INFO_1577 = SERVER_INFO_1577*; struct SERVER_INFO_1578 { DWORD sv1578_preferredaffinity; } -alias SERVER_INFO_1578* PSERVER_INFO_1578, LPSERVER_INFO_1578; +alias PSERVER_INFO_1578 = SERVER_INFO_1578*, LPSERVER_INFO_1578 = SERVER_INFO_1578*; struct SERVER_INFO_1579 { DWORD sv1579_maxfreerfcbs; } -alias SERVER_INFO_1579* PSERVER_INFO_1579, LPSERVER_INFO_1579; +alias PSERVER_INFO_1579 = SERVER_INFO_1579*, LPSERVER_INFO_1579 = SERVER_INFO_1579*; struct SERVER_INFO_1580 { DWORD sv1580_maxfreemfcbs; } -alias SERVER_INFO_1580* PSERVER_INFO_1580, LPSERVER_INFO_1580; +alias PSERVER_INFO_1580 = SERVER_INFO_1580*, LPSERVER_INFO_1580 = SERVER_INFO_1580*; struct SERVER_INFO_1581 { DWORD sv1581_maxfreemlcbs; } -alias SERVER_INFO_1581* PSERVER_INFO_1581, LPSERVER_INFO_1581; +alias PSERVER_INFO_1581 = SERVER_INFO_1581*, LPSERVER_INFO_1581 = SERVER_INFO_1581*; struct SERVER_INFO_1582 { DWORD sv1582_maxfreepagedpoolchunks; } -alias SERVER_INFO_1582* PSERVER_INFO_1582, LPSERVER_INFO_1582; +alias PSERVER_INFO_1582 = SERVER_INFO_1582*, LPSERVER_INFO_1582 = SERVER_INFO_1582*; struct SERVER_INFO_1583 { DWORD sv1583_minpagedpoolchunksize; } -alias SERVER_INFO_1583* PSERVER_INFO_1583, LPSERVER_INFO_1583; +alias PSERVER_INFO_1583 = SERVER_INFO_1583*, LPSERVER_INFO_1583 = SERVER_INFO_1583*; struct SERVER_INFO_1584 { DWORD sv1584_maxpagedpoolchunksize; } -alias SERVER_INFO_1584* PSERVER_INFO_1584, LPSERVER_INFO_1584; +alias PSERVER_INFO_1584 = SERVER_INFO_1584*, LPSERVER_INFO_1584 = SERVER_INFO_1584*; struct SERVER_INFO_1585 { BOOL sv1585_sendsfrompreferredprocessor; } -alias SERVER_INFO_1585* PSERVER_INFO_1585, LPSERVER_INFO_1585; +alias PSERVER_INFO_1585 = SERVER_INFO_1585*, LPSERVER_INFO_1585 = SERVER_INFO_1585*; struct SERVER_INFO_1586 { BOOL sv1586_maxthreadsperqueue; } -alias SERVER_INFO_1586* PSERVER_INFO_1586, LPSERVER_INFO_1586; +alias PSERVER_INFO_1586 = SERVER_INFO_1586*, LPSERVER_INFO_1586 = SERVER_INFO_1586*; struct SERVER_TRANSPORT_INFO_0 { DWORD svti0_numberofvcs; @@ -677,8 +677,7 @@ struct SERVER_TRANSPORT_INFO_0 { DWORD svti0_transportaddresslength; LPWSTR svti0_networkaddress; } -alias SERVER_TRANSPORT_INFO_0* PSERVER_TRANSPORT_INFO_0, - LPSERVER_TRANSPORT_INFO_0; +alias PSERVER_TRANSPORT_INFO_0 = SERVER_TRANSPORT_INFO_0*, LPSERVER_TRANSPORT_INFO_0 = SERVER_TRANSPORT_INFO_0*; extern (Windows): NET_API_STATUS NetServerEnum(LPCWSTR,DWORD,PBYTE*,DWORD,PDWORD,PDWORD,DWORD,LPCWSTR,PDWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmshare.d b/runtime/druntime/src/core/sys/windows/lmshare.d index bd8eecb46dd..0b34069c4cb 100644 --- a/runtime/druntime/src/core/sys/windows/lmshare.d +++ b/runtime/druntime/src/core/sys/windows/lmshare.d @@ -51,7 +51,7 @@ enum PERM_FILE_CREATE = 4; struct FILE_INFO_2 { DWORD fi2_id; } -alias FILE_INFO_2* PFILE_INFO_2, LPFILE_INFO_2; +alias PFILE_INFO_2 = FILE_INFO_2*, LPFILE_INFO_2 = FILE_INFO_2*; struct FILE_INFO_3 { DWORD fi3_id; @@ -60,19 +60,19 @@ struct FILE_INFO_3 { LPTSTR fi3_pathname; LPTSTR fi3_username; } -alias FILE_INFO_3* PFILE_INFO_3, LPFILE_INFO_3; +alias PFILE_INFO_3 = FILE_INFO_3*, LPFILE_INFO_3 = FILE_INFO_3*; struct SHARE_INFO_0 { LPTSTR shi0_netname; } -alias SHARE_INFO_0* PSHARE_INFO_0, LPSHARE_INFO_0; +alias PSHARE_INFO_0 = SHARE_INFO_0*, LPSHARE_INFO_0 = SHARE_INFO_0*; struct SHARE_INFO_1 { LPTSTR shi1_netname; DWORD shi1_type; LPTSTR shi1_remark; } -alias SHARE_INFO_1* PSHARE_INFO_1, LPSHARE_INFO_1; +alias PSHARE_INFO_1 = SHARE_INFO_1*, LPSHARE_INFO_1 = SHARE_INFO_1*; struct SHARE_INFO_2 { LPTSTR shi2_netname; @@ -84,7 +84,7 @@ struct SHARE_INFO_2 { LPTSTR shi2_path; LPTSTR shi2_passwd; } -alias SHARE_INFO_2* PSHARE_INFO_2, LPSHARE_INFO_2; +alias PSHARE_INFO_2 = SHARE_INFO_2*, LPSHARE_INFO_2 = SHARE_INFO_2*; struct SHARE_INFO_502 { LPTSTR shi502_netname; @@ -98,28 +98,28 @@ struct SHARE_INFO_502 { DWORD shi502_reserved; PSECURITY_DESCRIPTOR shi502_security_descriptor; } -alias SHARE_INFO_502* PSHARE_INFO_502, LPSHARE_INFO_502; +alias PSHARE_INFO_502 = SHARE_INFO_502*, LPSHARE_INFO_502 = SHARE_INFO_502*; struct SHARE_INFO_1004 { LPTSTR shi1004_remark; } -alias SHARE_INFO_1004* PSHARE_INFO_1004, LPSHARE_INFO_1004; +alias PSHARE_INFO_1004 = SHARE_INFO_1004*, LPSHARE_INFO_1004 = SHARE_INFO_1004*; struct SHARE_INFO_1006 { DWORD shi1006_max_uses; } -alias SHARE_INFO_1006* PSHARE_INFO_1006, LPSHARE_INFO_1006; +alias PSHARE_INFO_1006 = SHARE_INFO_1006*, LPSHARE_INFO_1006 = SHARE_INFO_1006*; struct SHARE_INFO_1501 { DWORD shi1501_reserved; PSECURITY_DESCRIPTOR shi1501_security_descriptor; } -alias SHARE_INFO_1501* PSHARE_INFO_1501, LPSHARE_INFO_1501; +alias PSHARE_INFO_1501 = SHARE_INFO_1501*, LPSHARE_INFO_1501 = SHARE_INFO_1501*; struct SESSION_INFO_0 { LPWSTR sesi0_cname; } -alias SESSION_INFO_0* PSESSION_INFO_0, LPSESSION_INFO_0; +alias PSESSION_INFO_0 = SESSION_INFO_0*, LPSESSION_INFO_0 = SESSION_INFO_0*; struct SESSION_INFO_1 { LPTSTR sesi1_cname; @@ -129,7 +129,7 @@ struct SESSION_INFO_1 { DWORD sesi1_idle_time; DWORD sesi1_user_flags; } -alias SESSION_INFO_1* PSESSION_INFO_1, LPSESSION_INFO_1; +alias PSESSION_INFO_1 = SESSION_INFO_1*, LPSESSION_INFO_1 = SESSION_INFO_1*; struct SESSION_INFO_2 { LPTSTR sesi2_cname; @@ -140,7 +140,7 @@ struct SESSION_INFO_2 { DWORD sesi2_user_flags; LPWSTR sesi2_cltype_name; } -alias SESSION_INFO_2* PSESSION_INFO_2, LPSESSION_INFO_2; +alias PSESSION_INFO_2 = SESSION_INFO_2*, LPSESSION_INFO_2 = SESSION_INFO_2*; struct SESSION_INFO_10 { LPWSTR sesi10_cname; @@ -148,7 +148,7 @@ struct SESSION_INFO_10 { DWORD sesi10_time; DWORD sesi10_idle_time; } -alias SESSION_INFO_10* PSESSION_INFO_10, LPSESSION_INFO_10; +alias PSESSION_INFO_10 = SESSION_INFO_10*, LPSESSION_INFO_10 = SESSION_INFO_10*; struct SESSION_INFO_502 { LPWSTR sesi502_cname; @@ -160,12 +160,12 @@ struct SESSION_INFO_502 { LPWSTR sesi502_cltype_name; LPWSTR sesi502_transport; } -alias SESSION_INFO_502* PSESSION_INFO_502, LPSESSION_INFO_502; +alias PSESSION_INFO_502 = SESSION_INFO_502*, LPSESSION_INFO_502 = SESSION_INFO_502*; struct CONNECTION_INFO_0 { DWORD coni0_id; } -alias CONNECTION_INFO_0* PCONNECTION_INFO_0, LPCONNECTION_INFO_0; +alias PCONNECTION_INFO_0 = CONNECTION_INFO_0*, LPCONNECTION_INFO_0 = CONNECTION_INFO_0*; struct CONNECTION_INFO_1 { DWORD coni1_id; @@ -176,7 +176,7 @@ struct CONNECTION_INFO_1 { LPWSTR coni1_username; LPWSTR coni1_netname; } -alias CONNECTION_INFO_1* PCONNECTION_INFO_1, LPCONNECTION_INFO_1; +alias PCONNECTION_INFO_1 = CONNECTION_INFO_1*, LPCONNECTION_INFO_1 = CONNECTION_INFO_1*; extern (Windows) { NET_API_STATUS NetShareAdd(LPWSTR,DWORD,PBYTE,PDWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmstats.d b/runtime/druntime/src/core/sys/windows/lmstats.d index e83808b12a7..4e80c64dbcd 100644 --- a/runtime/druntime/src/core/sys/windows/lmstats.d +++ b/runtime/druntime/src/core/sys/windows/lmstats.d @@ -36,7 +36,7 @@ struct STAT_SERVER_0{ DWORD sts0_reqbufneed; DWORD sts0_bigbufneed; } -alias STAT_SERVER_0* PSTAT_SERVER_0, LPSTAT_SERVER_0; +alias PSTAT_SERVER_0 = STAT_SERVER_0*, LPSTAT_SERVER_0 = STAT_SERVER_0*; // #ifdef LM20_WORKSTATION_STATISTICS // typedef struct _STAT_WORKSTATION_0 { @@ -115,7 +115,7 @@ struct STAT_WORKSTATION_0{ DWORD FailedUseCount; DWORD CurrentCommands; } -alias STAT_WORKSTATION_0* PSTAT_WORKSTATION_0, LPSTAT_WORKSTATION_0; +alias PSTAT_WORKSTATION_0 = STAT_WORKSTATION_0*, LPSTAT_WORKSTATION_0 = STAT_WORKSTATION_0*; extern (Windows): NET_API_STATUS NetStatisticsGet(LPWSTR,LPWSTR,DWORD,DWORD,PBYTE*); diff --git a/runtime/druntime/src/core/sys/windows/lmsvc.d b/runtime/druntime/src/core/sys/windows/lmsvc.d index ddea61c7d0b..52e30b05a17 100644 --- a/runtime/druntime/src/core/sys/windows/lmsvc.d +++ b/runtime/druntime/src/core/sys/windows/lmsvc.d @@ -117,7 +117,7 @@ enum SERVICE_UIC_M_DATABASE_ERROR = SERVICE2_BASE+2; struct SERVICE_INFO_0 { LPWSTR svci0_name; } -alias SERVICE_INFO_0* PSERVICE_INFO_0, LPSERVICE_INFO_0; +alias PSERVICE_INFO_0 = SERVICE_INFO_0*, LPSERVICE_INFO_0 = SERVICE_INFO_0*; struct SERVICE_INFO_1 { LPWSTR svci1_name; @@ -125,7 +125,7 @@ struct SERVICE_INFO_1 { DWORD svci1_code; DWORD svci1_pid; } -alias SERVICE_INFO_1* PSERVICE_INFO_1, LPSERVICE_INFO_1; +alias PSERVICE_INFO_1 = SERVICE_INFO_1*, LPSERVICE_INFO_1 = SERVICE_INFO_1*; struct SERVICE_INFO_2 { LPWSTR svci2_name; @@ -136,7 +136,7 @@ struct SERVICE_INFO_2 { DWORD svci2_specific_error; LPWSTR svci2_display_name; } -alias SERVICE_INFO_2* PSERVICE_INFO_2, LPSERVICE_INFO_2; +alias PSERVICE_INFO_2 = SERVICE_INFO_2*, LPSERVICE_INFO_2 = SERVICE_INFO_2*; extern (Windows) { deprecated { diff --git a/runtime/druntime/src/core/sys/windows/lmuse.d b/runtime/druntime/src/core/sys/windows/lmuse.d index a48d72e0050..10b659337bb 100644 --- a/runtime/druntime/src/core/sys/windows/lmuse.d +++ b/runtime/druntime/src/core/sys/windows/lmuse.d @@ -45,7 +45,7 @@ struct USE_INFO_0 { LPWSTR ui0_local; LPWSTR ui0_remote; } -alias USE_INFO_0* PUSE_INFO_0, LPUSE_INFO_0; +alias PUSE_INFO_0 = USE_INFO_0*, LPUSE_INFO_0 = USE_INFO_0*; struct USE_INFO_1 { LPWSTR ui1_local; @@ -56,7 +56,7 @@ struct USE_INFO_1 { DWORD ui1_refcount; DWORD ui1_usecount; } -alias USE_INFO_1* PUSE_INFO_1, LPUSE_INFO_1; +alias PUSE_INFO_1 = USE_INFO_1*, LPUSE_INFO_1 = USE_INFO_1*; struct USE_INFO_2 { LPWSTR ui2_local; @@ -69,7 +69,7 @@ struct USE_INFO_2 { LPWSTR ui2_username; LPWSTR ui2_domainname; } -alias USE_INFO_2* PUSE_INFO_2, LPUSE_INFO_2; +alias PUSE_INFO_2 = USE_INFO_2*, LPUSE_INFO_2 = USE_INFO_2*; extern (Windows) { NET_API_STATUS NetUseAdd(LPWSTR, DWORD, PBYTE, PDWORD); diff --git a/runtime/druntime/src/core/sys/windows/lmwksta.d b/runtime/druntime/src/core/sys/windows/lmwksta.d index 29ddca76d89..86e394e057d 100644 --- a/runtime/druntime/src/core/sys/windows/lmwksta.d +++ b/runtime/druntime/src/core/sys/windows/lmwksta.d @@ -80,7 +80,7 @@ struct WKSTA_INFO_100{ DWORD wki100_ver_major; DWORD wki100_ver_minor; } -alias WKSTA_INFO_100* PWKSTA_INFO_100, LPWKSTA_INFO_100; +alias PWKSTA_INFO_100 = WKSTA_INFO_100*, LPWKSTA_INFO_100 = WKSTA_INFO_100*; struct WKSTA_INFO_101{ DWORD wki101_platform_id; @@ -90,7 +90,7 @@ struct WKSTA_INFO_101{ DWORD wki101_ver_minor; LPWSTR wki101_lanroot; } -alias WKSTA_INFO_101* PWKSTA_INFO_101, LPWKSTA_INFO_101; +alias PWKSTA_INFO_101 = WKSTA_INFO_101*, LPWKSTA_INFO_101 = WKSTA_INFO_101*; struct WKSTA_INFO_102{ DWORD wki102_platform_id; @@ -101,7 +101,7 @@ struct WKSTA_INFO_102{ LPWSTR wki102_lanroot; DWORD wki102_logged_on_users; } -alias WKSTA_INFO_102* PWKSTA_INFO_102, LPWKSTA_INFO_102; +alias PWKSTA_INFO_102 = WKSTA_INFO_102*, LPWKSTA_INFO_102 = WKSTA_INFO_102*; struct WKSTA_INFO_302{ DWORD wki302_char_wait; @@ -125,7 +125,7 @@ struct WKSTA_INFO_302{ DWORD wki302_mailslots; DWORD wki302_num_dgram_buf; } -alias WKSTA_INFO_302* PWKSTA_INFO_302, LPWKSTA_INFO_302; +alias PWKSTA_INFO_302 = WKSTA_INFO_302*, LPWKSTA_INFO_302 = WKSTA_INFO_302*; struct WKSTA_INFO_402{ DWORD wki402_char_wait; @@ -150,7 +150,7 @@ struct WKSTA_INFO_402{ DWORD wki402_num_dgram_buf; DWORD wki402_max_threads; } -alias WKSTA_INFO_402* PWKSTA_INFO_402, LPWKSTA_INFO_402; +alias PWKSTA_INFO_402 = WKSTA_INFO_402*, LPWKSTA_INFO_402 = WKSTA_INFO_402*; struct WKSTA_INFO_502{ DWORD wki502_char_wait; @@ -189,172 +189,172 @@ struct WKSTA_INFO_502{ BOOL wki502_force_core_create_mode; BOOL wki502_use_512_byte_max_transfer; } -alias WKSTA_INFO_502* PWKSTA_INFO_502, LPWKSTA_INFO_502; +alias PWKSTA_INFO_502 = WKSTA_INFO_502*, LPWKSTA_INFO_502 = WKSTA_INFO_502*; struct WKSTA_INFO_1010 { DWORD wki1010_char_wait; } -alias WKSTA_INFO_1010* PWKSTA_INFO_1010, LPWKSTA_INFO_1010; +alias PWKSTA_INFO_1010 = WKSTA_INFO_1010*, LPWKSTA_INFO_1010 = WKSTA_INFO_1010*; struct WKSTA_INFO_1011 { DWORD wki1011_collection_time; } -alias WKSTA_INFO_1011* PWKSTA_INFO_1011, LPWKSTA_INFO_1011; +alias PWKSTA_INFO_1011 = WKSTA_INFO_1011*, LPWKSTA_INFO_1011 = WKSTA_INFO_1011*; struct WKSTA_INFO_1012 { DWORD wki1012_maximum_collection_count; } -alias WKSTA_INFO_1012* PWKSTA_INFO_1012, LPWKSTA_INFO_1012; +alias PWKSTA_INFO_1012 = WKSTA_INFO_1012*, LPWKSTA_INFO_1012 = WKSTA_INFO_1012*; struct WKSTA_INFO_1027 { DWORD wki1027_errlog_sz; } -alias WKSTA_INFO_1027* PWKSTA_INFO_1027, LPWKSTA_INFO_1027; +alias PWKSTA_INFO_1027 = WKSTA_INFO_1027*, LPWKSTA_INFO_1027 = WKSTA_INFO_1027*; struct WKSTA_INFO_1028 { DWORD wki1028_print_buf_time; } -alias WKSTA_INFO_1028* PWKSTA_INFO_1028, LPWKSTA_INFO_1028; +alias PWKSTA_INFO_1028 = WKSTA_INFO_1028*, LPWKSTA_INFO_1028 = WKSTA_INFO_1028*; struct WKSTA_INFO_1032 { DWORD wki1032_wrk_heuristics; } -alias WKSTA_INFO_1032* PWKSTA_INFO_1032, LPWKSTA_INFO_1032; +alias PWKSTA_INFO_1032 = WKSTA_INFO_1032*, LPWKSTA_INFO_1032 = WKSTA_INFO_1032*; struct WKSTA_INFO_1013 { DWORD wki1013_keep_conn; } -alias WKSTA_INFO_1013* PWKSTA_INFO_1013, LPWKSTA_INFO_1013; +alias PWKSTA_INFO_1013 = WKSTA_INFO_1013*, LPWKSTA_INFO_1013 = WKSTA_INFO_1013*; struct WKSTA_INFO_1018 { DWORD wki1018_sess_timeout; } -alias WKSTA_INFO_1018* PWKSTA_INFO_1018, LPWKSTA_INFO_1018; +alias PWKSTA_INFO_1018 = WKSTA_INFO_1018*, LPWKSTA_INFO_1018 = WKSTA_INFO_1018*; struct WKSTA_INFO_1023 { DWORD wki1023_siz_char_buf; } -alias WKSTA_INFO_1023* PWKSTA_INFO_1023, LPWKSTA_INFO_1023; +alias PWKSTA_INFO_1023 = WKSTA_INFO_1023*, LPWKSTA_INFO_1023 = WKSTA_INFO_1023*; struct WKSTA_INFO_1033 { DWORD wki1033_max_threads; } -alias WKSTA_INFO_1033* PWKSTA_INFO_1033, LPWKSTA_INFO_1033; +alias PWKSTA_INFO_1033 = WKSTA_INFO_1033*, LPWKSTA_INFO_1033 = WKSTA_INFO_1033*; struct WKSTA_INFO_1041 { DWORD wki1041_lock_quota; } -alias WKSTA_INFO_1041* PWKSTA_INFO_1041, LPWKSTA_INFO_1041; +alias PWKSTA_INFO_1041 = WKSTA_INFO_1041*, LPWKSTA_INFO_1041 = WKSTA_INFO_1041*; struct WKSTA_INFO_1042 { DWORD wki1042_lock_increment; } -alias WKSTA_INFO_1042* PWKSTA_INFO_1042, LPWKSTA_INFO_1042; +alias PWKSTA_INFO_1042 = WKSTA_INFO_1042*, LPWKSTA_INFO_1042 = WKSTA_INFO_1042*; struct WKSTA_INFO_1043 { DWORD wki1043_lock_maximum; } -alias WKSTA_INFO_1043* PWKSTA_INFO_1043, LPWKSTA_INFO_1043; +alias PWKSTA_INFO_1043 = WKSTA_INFO_1043*, LPWKSTA_INFO_1043 = WKSTA_INFO_1043*; struct WKSTA_INFO_1044 { DWORD wki1044_pipe_increment; } -alias WKSTA_INFO_1044* PWKSTA_INFO_1044, LPWKSTA_INFO_1044; +alias PWKSTA_INFO_1044 = WKSTA_INFO_1044*, LPWKSTA_INFO_1044 = WKSTA_INFO_1044*; struct WKSTA_INFO_1045 { DWORD wki1045_pipe_maximum; } -alias WKSTA_INFO_1045* PWKSTA_INFO_1045, LPWKSTA_INFO_1045; +alias PWKSTA_INFO_1045 = WKSTA_INFO_1045*, LPWKSTA_INFO_1045 = WKSTA_INFO_1045*; struct WKSTA_INFO_1046 { DWORD wki1046_dormant_file_limit; } -alias WKSTA_INFO_1046* PWKSTA_INFO_1046, LPWKSTA_INFO_1046; +alias PWKSTA_INFO_1046 = WKSTA_INFO_1046*, LPWKSTA_INFO_1046 = WKSTA_INFO_1046*; struct WKSTA_INFO_1047 { DWORD wki1047_cache_file_timeout; } -alias WKSTA_INFO_1047* PWKSTA_INFO_1047, LPWKSTA_INFO_1047; +alias PWKSTA_INFO_1047 = WKSTA_INFO_1047*, LPWKSTA_INFO_1047 = WKSTA_INFO_1047*; struct WKSTA_INFO_1048 { BOOL wki1048_use_opportunistic_locking; } -alias WKSTA_INFO_1048* PWKSTA_INFO_1048, LPWKSTA_INFO_1048; +alias PWKSTA_INFO_1048 = WKSTA_INFO_1048*, LPWKSTA_INFO_1048 = WKSTA_INFO_1048*; struct WKSTA_INFO_1049 { BOOL wki1049_use_unlock_behind; } -alias WKSTA_INFO_1049* PWKSTA_INFO_1049, LPWKSTA_INFO_1049; +alias PWKSTA_INFO_1049 = WKSTA_INFO_1049*, LPWKSTA_INFO_1049 = WKSTA_INFO_1049*; struct WKSTA_INFO_1050 { BOOL wki1050_use_close_behind; } -alias WKSTA_INFO_1050* PWKSTA_INFO_1050, LPWKSTA_INFO_1050; +alias PWKSTA_INFO_1050 = WKSTA_INFO_1050*, LPWKSTA_INFO_1050 = WKSTA_INFO_1050*; struct WKSTA_INFO_1051 { BOOL wki1051_buf_named_pipes; } -alias WKSTA_INFO_1051* PWKSTA_INFO_1051, LPWKSTA_INFO_1051; +alias PWKSTA_INFO_1051 = WKSTA_INFO_1051*, LPWKSTA_INFO_1051 = WKSTA_INFO_1051*; struct WKSTA_INFO_1052 { BOOL wki1052_use_lock_read_unlock; } -alias WKSTA_INFO_1052* PWKSTA_INFO_1052, LPWKSTA_INFO_1052; +alias PWKSTA_INFO_1052 = WKSTA_INFO_1052*, LPWKSTA_INFO_1052 = WKSTA_INFO_1052*; struct WKSTA_INFO_1053 { BOOL wki1053_utilize_nt_caching; } -alias WKSTA_INFO_1053* PWKSTA_INFO_1053, LPWKSTA_INFO_1053; +alias PWKSTA_INFO_1053 = WKSTA_INFO_1053*, LPWKSTA_INFO_1053 = WKSTA_INFO_1053*; struct WKSTA_INFO_1054 { BOOL wki1054_use_raw_read; } -alias WKSTA_INFO_1054* PWKSTA_INFO_1054, LPWKSTA_INFO_1054; +alias PWKSTA_INFO_1054 = WKSTA_INFO_1054*, LPWKSTA_INFO_1054 = WKSTA_INFO_1054*; struct WKSTA_INFO_1055 { BOOL wki1055_use_raw_write; } -alias WKSTA_INFO_1055* PWKSTA_INFO_1055, LPWKSTA_INFO_1055; +alias PWKSTA_INFO_1055 = WKSTA_INFO_1055*, LPWKSTA_INFO_1055 = WKSTA_INFO_1055*; struct WKSTA_INFO_1056 { BOOL wki1056_use_write_raw_data; } -alias WKSTA_INFO_1056* PWKSTA_INFO_1056, LPWKSTA_INFO_1056; +alias PWKSTA_INFO_1056 = WKSTA_INFO_1056*, LPWKSTA_INFO_1056 = WKSTA_INFO_1056*; struct WKSTA_INFO_1057 { BOOL wki1057_use_encryption; } -alias WKSTA_INFO_1057* PWKSTA_INFO_1057, LPWKSTA_INFO_1057; +alias PWKSTA_INFO_1057 = WKSTA_INFO_1057*, LPWKSTA_INFO_1057 = WKSTA_INFO_1057*; struct WKSTA_INFO_1058 { BOOL wki1058_buf_files_deny_write; } -alias WKSTA_INFO_1058* PWKSTA_INFO_1058, LPWKSTA_INFO_1058; +alias PWKSTA_INFO_1058 = WKSTA_INFO_1058*, LPWKSTA_INFO_1058 = WKSTA_INFO_1058*; struct WKSTA_INFO_1059 { BOOL wki1059_buf_read_only_files; } -alias WKSTA_INFO_1059* PWKSTA_INFO_1059, LPWKSTA_INFO_1059; +alias PWKSTA_INFO_1059 = WKSTA_INFO_1059*, LPWKSTA_INFO_1059 = WKSTA_INFO_1059*; struct WKSTA_INFO_1060 { BOOL wki1060_force_core_create_mode; } -alias WKSTA_INFO_1060* PWKSTA_INFO_1060, LPWKSTA_INFO_1060; +alias PWKSTA_INFO_1060 = WKSTA_INFO_1060*, LPWKSTA_INFO_1060 = WKSTA_INFO_1060*; struct WKSTA_INFO_1061 { BOOL wki1061_use_512_byte_max_transfer; } -alias WKSTA_INFO_1061* PWKSTA_INFO_1061, LPWKSTA_INFO_1061; +alias PWKSTA_INFO_1061 = WKSTA_INFO_1061*, LPWKSTA_INFO_1061 = WKSTA_INFO_1061*; struct WKSTA_INFO_1062 { DWORD wki1062_read_ahead_throughput; } -alias WKSTA_INFO_1062* PWKSTA_INFO_1062, LPWKSTA_INFO_1062; +alias PWKSTA_INFO_1062 = WKSTA_INFO_1062*, LPWKSTA_INFO_1062 = WKSTA_INFO_1062*; struct WKSTA_USER_INFO_0 { LPWSTR wkui0_username; } -alias WKSTA_USER_INFO_0* PWKSTA_USER_INFO_0, LPWKSTA_USER_INFO_0; +alias PWKSTA_USER_INFO_0 = WKSTA_USER_INFO_0*, LPWKSTA_USER_INFO_0 = WKSTA_USER_INFO_0*; struct WKSTA_USER_INFO_1{ LPWSTR wkui1_username; @@ -362,12 +362,12 @@ struct WKSTA_USER_INFO_1{ LPWSTR wkui1_oth_domains; LPWSTR wkui1_logon_server; } -alias WKSTA_USER_INFO_1* PWKSTA_USER_INFO_1, LPWKSTA_USER_INFO_1; +alias PWKSTA_USER_INFO_1 = WKSTA_USER_INFO_1*, LPWKSTA_USER_INFO_1 = WKSTA_USER_INFO_1*; struct WKSTA_USER_INFO_1101 { LPWSTR wkui1101_oth_domains; } -alias WKSTA_USER_INFO_1101* PWKSTA_USER_INFO_1101, LPWKSTA_USER_INFO_1101; +alias PWKSTA_USER_INFO_1101 = WKSTA_USER_INFO_1101*, LPWKSTA_USER_INFO_1101 = WKSTA_USER_INFO_1101*; struct WKSTA_TRANSPORT_INFO_0{ DWORD wkti0_quality_of_service; @@ -376,7 +376,7 @@ struct WKSTA_TRANSPORT_INFO_0{ LPWSTR wkti0_transport_address; BOOL wkti0_wan_ish; } -alias WKSTA_TRANSPORT_INFO_0* PWKSTA_TRANSPORT_INFO_0, LPWKSTA_TRANSPORT_INFO_0; +alias PWKSTA_TRANSPORT_INFO_0 = WKSTA_TRANSPORT_INFO_0*, LPWKSTA_TRANSPORT_INFO_0 = WKSTA_TRANSPORT_INFO_0*; extern (Windows) { NET_API_STATUS NetWkstaGetInfo(LPWSTR,DWORD,PBYTE*); diff --git a/runtime/druntime/src/core/sys/windows/lzexpand.d b/runtime/druntime/src/core/sys/windows/lzexpand.d index 6c3bd0084fe..2a76eecd384 100644 --- a/runtime/druntime/src/core/sys/windows/lzexpand.d +++ b/runtime/druntime/src/core/sys/windows/lzexpand.d @@ -42,9 +42,9 @@ INT LZRead(INT, LPSTR, INT); LONG LZSeek(INT, LONG, INT); version (Unicode) { - alias GetExpandedNameW GetExpandedName; - alias LZOpenFileW LZOpenFile; + alias GetExpandedName = GetExpandedNameW; + alias LZOpenFile = LZOpenFileW; } else { - alias GetExpandedNameA GetExpandedName; - alias LZOpenFileA LZOpenFile; + alias GetExpandedName = GetExpandedNameA; + alias LZOpenFile = LZOpenFileA; } diff --git a/runtime/druntime/src/core/sys/windows/mapi.d b/runtime/druntime/src/core/sys/windows/mapi.d index 8f8eea1e12b..74e20f3bc7b 100644 --- a/runtime/druntime/src/core/sys/windows/mapi.d +++ b/runtime/druntime/src/core/sys/windows/mapi.d @@ -74,10 +74,10 @@ enum MAPI_UNREAD = 0x0001; enum MAPI_RECEIPT_REQUESTED = 0x0002; enum MAPI_SENT = 0x0004; -alias uint FLAGS; -alias uint* LPULONG; -alias ULONG_PTR LHANDLE; -alias ULONG_PTR* LPLHANDLE; +alias FLAGS = uint; +alias LPULONG = uint*; +alias LHANDLE = ULONG_PTR; +alias LPLHANDLE = ULONG_PTR*; struct MapiRecipDesc { ULONG ulReserved; @@ -87,7 +87,7 @@ struct MapiRecipDesc { ULONG ulEIDSize; LPVOID lpEntryID; } -alias MapiRecipDesc* lpMapiRecipDesc; +alias lpMapiRecipDesc = MapiRecipDesc*; struct MapiFileDesc { ULONG ulReserved; @@ -97,7 +97,7 @@ struct MapiFileDesc { LPSTR lpszFileName; LPVOID lpFileType; } -alias MapiFileDesc* lpMapiFileDesc; +alias lpMapiFileDesc = MapiFileDesc*; struct MapiFileTagExt { ULONG ulReserved; @@ -106,7 +106,7 @@ struct MapiFileTagExt { ULONG cbEncoding; LPBYTE lpEncoding; } -alias MapiFileTagExt* lpMapiFileTagExt; +alias lpMapiFileTagExt = MapiFileTagExt*; struct MapiMessage { ULONG ulReserved; @@ -122,7 +122,7 @@ struct MapiMessage { ULONG nFileCount; lpMapiFileDesc lpFiles; } -alias MapiMessage* lpMapiMessage; +alias lpMapiMessage = MapiMessage*; extern (Windows) { ULONG MAPILogon(ULONG_PTR, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE); @@ -145,26 +145,18 @@ extern (Windows) { ULONG MAPI_NSCP_SynchronizeClient(LHANDLE, ULONG); // Handles for use with GetProcAddress - alias ULONG function(ULONG_PTR, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE) - LPMAPILOGON; - alias ULONG function(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG) - LPMAPISENDMAIL; - alias ULONG function(ULONG_PTR, LPSTR, LPSTR, LPSTR, ULONG) - LPMAPISENDDOCUMENTS; - alias ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG, lpMapiMessage*) - LPMAPIREADMAIL; - alias ULONG function(LHANDLE, ULONG_PTR, LPSTR, LPSTR, FLAGS, ULONG, LPSTR) - LPMAPIFINDNEXT; - alias ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG, - lpMapiRecipDesc*) LPMAPIRESOLVENAME; - alias ULONG function(LHANDLE, ULONG_PTR, LPSTR, ULONG, LPSTR, ULONG, - lpMapiRecipDesc, FLAGS, ULONG, LPULONG, lpMapiRecipDesc*) LPMAPIADDRESS; - alias ULONG function(LPVOID lpv) LPMAPIFREEBUFFER; - alias ULONG function(LHANDLE, ULONG_PTR, lpMapiRecipDesc, FLAGS, ULONG) - LPMAPIDETAILS; - alias ULONG function(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG, LPSTR) - LPMAPISAVEMAIL; - alias ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG) - LPMAPIDELETEMAIL; - alias ULONG function(LHANDLE, ULONG_PTR, FLAGS, ULONG) LPMAPILOGOFF; + alias LPMAPILOGON = ULONG function(ULONG_PTR, LPSTR, LPSTR, FLAGS, ULONG, LPLHANDLE); + alias LPMAPISENDMAIL = ULONG function(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG); + alias LPMAPISENDDOCUMENTS = ULONG function(ULONG_PTR, LPSTR, LPSTR, LPSTR, ULONG); + alias LPMAPIREADMAIL = ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG, lpMapiMessage*); + alias LPMAPIFINDNEXT = ULONG function(LHANDLE, ULONG_PTR, LPSTR, LPSTR, FLAGS, ULONG, LPSTR); + alias LPMAPIRESOLVENAME = ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG, + lpMapiRecipDesc*); + alias LPMAPIADDRESS = ULONG function(LHANDLE, ULONG_PTR, LPSTR, ULONG, LPSTR, ULONG, + lpMapiRecipDesc, FLAGS, ULONG, LPULONG, lpMapiRecipDesc*); + alias LPMAPIFREEBUFFER = ULONG function(LPVOID lpv); + alias LPMAPIDETAILS = ULONG function(LHANDLE, ULONG_PTR, lpMapiRecipDesc, FLAGS, ULONG); + alias LPMAPISAVEMAIL = ULONG function(LHANDLE, ULONG_PTR, lpMapiMessage, FLAGS, ULONG, LPSTR); + alias LPMAPIDELETEMAIL = ULONG function(LHANDLE, ULONG_PTR, LPSTR, FLAGS, ULONG); + alias LPMAPILOGOFF = ULONG function(LHANDLE, ULONG_PTR, FLAGS, ULONG); } diff --git a/runtime/druntime/src/core/sys/windows/mcx.d b/runtime/druntime/src/core/sys/windows/mcx.d index 5c6ac24a315..864c3f27da7 100644 --- a/runtime/druntime/src/core/sys/windows/mcx.d +++ b/runtime/druntime/src/core/sys/windows/mcx.d @@ -78,7 +78,7 @@ struct MODEMDEVCAPS { BYTE* abVariablePortion() return { return &_abVariablePortion; } } -alias MODEMDEVCAPS* PMODEMDEVCAPS, LPMODEMDEVCAPS; +alias PMODEMDEVCAPS = MODEMDEVCAPS*, LPMODEMDEVCAPS = MODEMDEVCAPS*; struct MODEMSETTINGS { DWORD dwActualSize; @@ -96,4 +96,4 @@ struct MODEMSETTINGS { BYTE* abVariablePortion() return { return &_abVariablePortion; } } -alias MODEMSETTINGS* PMODEMSETTINGS, LPMODEMSETTINGS; +alias PMODEMSETTINGS = MODEMSETTINGS*, LPMODEMSETTINGS = MODEMSETTINGS*; diff --git a/runtime/druntime/src/core/sys/windows/mgmtapi.d b/runtime/druntime/src/core/sys/windows/mgmtapi.d index 336d24e750e..11b2aa66178 100644 --- a/runtime/druntime/src/core/sys/windows/mgmtapi.d +++ b/runtime/druntime/src/core/sys/windows/mgmtapi.d @@ -27,7 +27,7 @@ enum { enum MGMCTL_SETAGENTPORT = 1; -alias PVOID LPSNMP_MGR_SESSION; +alias LPSNMP_MGR_SESSION = PVOID; extern (Windows) nothrow @nogc { BOOL SnmpMgrClose(LPSNMP_MGR_SESSION); diff --git a/runtime/druntime/src/core/sys/windows/mmsystem.d b/runtime/druntime/src/core/sys/windows/mmsystem.d index 2ce75aa7888..6957a444965 100644 --- a/runtime/druntime/src/core/sys/windows/mmsystem.d +++ b/runtime/druntime/src/core/sys/windows/mmsystem.d @@ -1018,11 +1018,11 @@ enum C1_TRANSPARENT=1; //const SEEK_END=2; public import core.stdc.stdio : SEEK_SET, SEEK_CUR, SEEK_END; -alias DWORD MCIERROR; -alias UINT MCIDEVICEID; -extern(Windows) alias UINT function (MCIDEVICEID, DWORD) YIELDPROC; -alias UINT MMVERSION; -alias UINT MMRESULT; +alias MCIERROR = DWORD; +alias MCIDEVICEID = UINT; +extern(Windows) alias YIELDPROC = UINT function (MCIDEVICEID, DWORD); +alias MMVERSION = UINT; +alias MMRESULT = UINT; struct MMTIME { UINT wType; @@ -1047,9 +1047,9 @@ struct MMTIME { _midi midi; } } -alias MMTIME* PMMTIME, LPMMTIME; +alias PMMTIME = MMTIME*, LPMMTIME = MMTIME*; -alias HANDLE HDRVR; +alias HDRVR = HANDLE; struct DRVCONFIGINFO { align(1): @@ -1057,7 +1057,7 @@ align(1): LPCWSTR lpszDCISectionName; LPCWSTR lpszDCIAliasName; } -alias DRVCONFIGINFO * PDRVCONFIGINFO, LPDRVCONFIGINFO; +alias PDRVCONFIGINFO = DRVCONFIGINFO *, LPDRVCONFIGINFO = DRVCONFIGINFO *; struct DRVCONFIGINFOEX { align(1): @@ -1066,7 +1066,7 @@ align(1): LPCWSTR lpszDCIAliasName; DWORD dnDevNode; } -alias DRVCONFIGINFOEX* PDRVCONFIGINFOEX, LPDRVCONFIGINFOEX; +alias PDRVCONFIGINFOEX = DRVCONFIGINFOEX*, LPDRVCONFIGINFOEX = DRVCONFIGINFOEX*; extern(Windows): @@ -1083,12 +1083,12 @@ alias MIDICALLBACK* LPMIDICALLBACK; +/ -alias HANDLE HWAVE; -alias HANDLE HWAVEIN; -alias HANDLE HWAVEOUT; +alias HWAVE = HANDLE; +alias HWAVEIN = HANDLE; +alias HWAVEOUT = HANDLE; -alias HWAVEIN* LPHWAVEIN; -alias HWAVEOUT* LPHWAVEOUT; +alias LPHWAVEIN = HWAVEIN*; +alias LPHWAVEOUT = HWAVEOUT*; struct WAVEHDR { LPSTR lpData; @@ -1100,7 +1100,7 @@ struct WAVEHDR { WAVEHDR *lpNext; DWORD_PTR reserved; } -alias WAVEHDR* PWAVEHDR, LPWAVEHDR; +alias PWAVEHDR = WAVEHDR*, LPWAVEHDR = WAVEHDR*; struct WAVEOUTCAPSA { WORD wMid; @@ -1112,7 +1112,7 @@ struct WAVEOUTCAPSA { WORD wReserved1; DWORD dwSupport; } -alias WAVEOUTCAPSA* PWAVEOUTCAPSA, LPWAVEOUTCAPSA; +alias PWAVEOUTCAPSA = WAVEOUTCAPSA*, LPWAVEOUTCAPSA = WAVEOUTCAPSA*; struct WAVEOUTCAPSW { WORD wMid; @@ -1124,7 +1124,7 @@ struct WAVEOUTCAPSW { WORD wReserved1; DWORD dwSupport; } -alias WAVEOUTCAPSW* PWAVEOUTCAPSW, LPWAVEOUTCAPSW; +alias PWAVEOUTCAPSW = WAVEOUTCAPSW*, LPWAVEOUTCAPSW = WAVEOUTCAPSW*; struct WAVEINCAPSA { WORD wMid; @@ -1135,7 +1135,7 @@ struct WAVEINCAPSA { WORD wChannels; WORD wReserved1; } -alias WAVEINCAPSA* PWAVEINCAPSA, LPWAVEINCAPSA; +alias PWAVEINCAPSA = WAVEINCAPSA*, LPWAVEINCAPSA = WAVEINCAPSA*; struct WAVEINCAPSW { WORD wMid; @@ -1146,7 +1146,7 @@ struct WAVEINCAPSW { WORD wChannels; WORD wReserved1; } -alias WAVEINCAPSW* PWAVEINCAPSW, LPWAVEINCAPSW; +alias PWAVEINCAPSW = WAVEINCAPSW*, LPWAVEINCAPSW = WAVEINCAPSW*; struct WAVEFORMAT { WORD wFormatTag; @@ -1155,13 +1155,13 @@ struct WAVEFORMAT { DWORD nAvgBytesPerSec; WORD nBlockAlign; } -alias WAVEFORMAT* PWAVEFORMAT, LPWAVEFORMAT; +alias PWAVEFORMAT = WAVEFORMAT*, LPWAVEFORMAT = WAVEFORMAT*; struct PCMWAVEFORMAT { WAVEFORMAT wf; WORD wBitsPerSample; } -alias PCMWAVEFORMAT* PPCMWAVEFORMAT, LPPCMWAVEFORMAT; +alias PPCMWAVEFORMAT = PCMWAVEFORMAT*, LPPCMWAVEFORMAT = PCMWAVEFORMAT*; struct WAVEFORMATEX { WORD wFormatTag; @@ -1172,23 +1172,23 @@ struct WAVEFORMATEX { WORD wBitsPerSample; WORD cbSize; } -alias WAVEFORMATEX* PWAVEFORMATEX, LPWAVEFORMATEX; -alias const(WAVEFORMATEX)* LPCWAVEFORMATEX; +alias PWAVEFORMATEX = WAVEFORMATEX*, LPWAVEFORMATEX = WAVEFORMATEX*; +alias LPCWAVEFORMATEX = const(WAVEFORMATEX)*; -alias HANDLE HMIDI; -alias HANDLE HMIDIIN; -alias HANDLE HMIDIOUT; -alias HANDLE HMIDISTRM; +alias HMIDI = HANDLE; +alias HMIDIIN = HANDLE; +alias HMIDIOUT = HANDLE; +alias HMIDISTRM = HANDLE; -alias HMIDI* LPHMIDI; -alias HMIDIIN* LPHMIDIIN; -alias HMIDIOUT* LPHMIDIOUT; -alias HMIDISTRM* LPHMIDISTRM; +alias LPHMIDI = HMIDI*; +alias LPHMIDIIN = HMIDIIN*; +alias LPHMIDIOUT = HMIDIOUT*; +alias LPHMIDISTRM = HMIDISTRM*; -alias WORD[MIDIPATCHSIZE] PATCHARRAY; -alias WORD* LPPATCHARRAY; -alias WORD[MIDIPATCHSIZE] KEYARRAY; -alias WORD* LPKEYARRAY; +alias PATCHARRAY = WORD[MIDIPATCHSIZE]; +alias LPPATCHARRAY = WORD*; +alias KEYARRAY = WORD[MIDIPATCHSIZE]; +alias LPKEYARRAY = WORD*; struct MIDIOUTCAPSA { WORD wMid; @@ -1201,7 +1201,7 @@ struct MIDIOUTCAPSA { WORD wChannelMask; DWORD dwSupport; } -alias MIDIOUTCAPSA* PMIDIOUTCAPSA, LPMIDIOUTCAPSA; +alias PMIDIOUTCAPSA = MIDIOUTCAPSA*, LPMIDIOUTCAPSA = MIDIOUTCAPSA*; struct MIDIOUTCAPSW { WORD wMid; @@ -1214,7 +1214,7 @@ struct MIDIOUTCAPSW { WORD wChannelMask; DWORD dwSupport; } -alias MIDIOUTCAPSW* PMIDIOUTCAPSW, LPMIDIOUTCAPSW; +alias PMIDIOUTCAPSW = MIDIOUTCAPSW*, LPMIDIOUTCAPSW = MIDIOUTCAPSW*; struct MIDIINCAPSA { WORD wMid; @@ -1223,7 +1223,7 @@ struct MIDIINCAPSA { CHAR[MAXPNAMELEN] szPname = 0; DWORD dwSupport; } -alias MIDIINCAPSA* PMIDIINCAPSA, LPMIDIINCAPSA; +alias PMIDIINCAPSA = MIDIINCAPSA*, LPMIDIINCAPSA = MIDIINCAPSA*; struct MIDIINCAPSW { WORD wMid; @@ -1232,7 +1232,7 @@ struct MIDIINCAPSW { WCHAR[MAXPNAMELEN] szPname = 0; DWORD dwSupport; } -alias MIDIINCAPSW* PMIDIINCAPSW, LPMIDIINCAPSW; +alias PMIDIINCAPSW = MIDIINCAPSW*, LPMIDIINCAPSW = MIDIINCAPSW*; struct MIDIHDR { align(1): @@ -1246,7 +1246,7 @@ align(1): DWORD dwOffset; DWORD_PTR[8] dwReserved; } -alias MIDIHDR* PMIDIHDR, LPMIDIHDR; +alias PMIDIHDR = MIDIHDR*, LPMIDIHDR = MIDIHDR*; struct MIDIEVENT { DWORD dwDeltaTime; @@ -1265,13 +1265,13 @@ struct MIDIPROPTIMEDIV { DWORD cbStruct; DWORD dwTimeDiv; } -alias MIDIPROPTIMEDIV* LPMIDIPROPTIMEDIV; +alias LPMIDIPROPTIMEDIV = MIDIPROPTIMEDIV*; struct MIDIPROPTEMPO { DWORD cbStruct; DWORD dwTempo; } -alias MIDIPROPTEMPO* LPMIDIPROPTEMPO; +alias LPMIDIPROPTEMPO = MIDIPROPTEMPO*; struct AUXCAPSA { WORD wMid; @@ -1282,7 +1282,7 @@ struct AUXCAPSA { WORD wReserved1; DWORD dwSupport; } -alias AUXCAPSA* PAUXCAPSA, LPAUXCAPSA; +alias PAUXCAPSA = AUXCAPSA*, LPAUXCAPSA = AUXCAPSA*; struct AUXCAPSW { WORD wMid; @@ -1293,13 +1293,13 @@ struct AUXCAPSW { WORD wReserved1; DWORD dwSupport; } -alias AUXCAPSW* PAUXCAPSW, LPAUXCAPSW; +alias PAUXCAPSW = AUXCAPSW*, LPAUXCAPSW = AUXCAPSW*; -alias HANDLE HMIXEROBJ; -alias HMIXEROBJ* LPHMIXEROBJ; +alias HMIXEROBJ = HANDLE; +alias LPHMIXEROBJ = HMIXEROBJ*; -alias HANDLE HMIXER; -alias HMIXER* LPHMIXER; +alias HMIXER = HANDLE; +alias LPHMIXER = HMIXER*; struct MIXERCAPSA { WORD wMid; @@ -1309,7 +1309,7 @@ struct MIXERCAPSA { DWORD fdwSupport; DWORD cDestinations; } -alias MIXERCAPSA* PMIXERCAPSA, LPMIXERCAPSA; +alias PMIXERCAPSA = MIXERCAPSA*, LPMIXERCAPSA = MIXERCAPSA*; struct MIXERCAPSW { WORD wMid; @@ -1319,7 +1319,7 @@ struct MIXERCAPSW { DWORD fdwSupport; DWORD cDestinations; } -alias MIXERCAPSW* PMIXERCAPSW, LPMIXERCAPSW; +alias PMIXERCAPSW = MIXERCAPSW*, LPMIXERCAPSW = MIXERCAPSW*; struct MIXERLINEA { align(1): @@ -1345,7 +1345,7 @@ align(1): } _Target Target; } -alias MIXERLINEA* PMIXERLINEA, LPMIXERLINEA; +alias PMIXERLINEA = MIXERLINEA*, LPMIXERLINEA = MIXERLINEA*; struct MIXERLINEW { align(1): @@ -1371,7 +1371,7 @@ align(1): } _Target Target; } -alias MIXERLINEW* PMIXERLINEW, LPMIXERLINEW; +alias PMIXERLINEW = MIXERLINEW*, LPMIXERLINEW = MIXERLINEW*; struct MIXERCONTROLA { DWORD cbStruct; @@ -1400,7 +1400,7 @@ struct MIXERCONTROLA { } _Metrics Metrics; } -alias MIXERCONTROLA* PMIXERCONTROLA, LPMIXERCONTROLA; +alias PMIXERCONTROLA = MIXERCONTROLA*, LPMIXERCONTROLA = MIXERCONTROLA*; struct MIXERCONTROLW { DWORD cbStruct; @@ -1430,7 +1430,7 @@ struct MIXERCONTROLW { _Metrics Metrics; } -alias MIXERCONTROLW* PMIXERCONTROLW, LPMIXERCONTROLW; +alias PMIXERCONTROLW = MIXERCONTROLW*, LPMIXERCONTROLW = MIXERCONTROLW*; struct MIXERLINECONTROLSA { align(1): @@ -1444,7 +1444,7 @@ align(1): DWORD cbmxctrl; LPMIXERCONTROLA pamxctrl; } -alias MIXERLINECONTROLSA* PMIXERLINECONTROLSA, LPMIXERLINECONTROLSA; +alias PMIXERLINECONTROLSA = MIXERLINECONTROLSA*, LPMIXERLINECONTROLSA = MIXERLINECONTROLSA*; struct MIXERLINECONTROLSW { align(1): @@ -1458,7 +1458,7 @@ align(1): DWORD cbmxctrl; LPMIXERCONTROLW pamxctrl; } -alias MIXERLINECONTROLSW* PMIXERLINECONTROLSW, LPMIXERLINECONTROLSW; +alias PMIXERLINECONTROLSW = MIXERLINECONTROLSW*, LPMIXERLINECONTROLSW = MIXERLINECONTROLSW*; struct MIXERCONTROLDETAILS { align(1): @@ -1472,44 +1472,44 @@ align(1): DWORD cbDetails; PVOID paDetails; } -alias MIXERCONTROLDETAILS* PMIXERCONTROLDETAILS, LPMIXERCONTROLDETAILS; +alias PMIXERCONTROLDETAILS = MIXERCONTROLDETAILS*, LPMIXERCONTROLDETAILS = MIXERCONTROLDETAILS*; struct MIXERCONTROLDETAILS_LISTTEXTA { DWORD dwParam1; DWORD dwParam2; CHAR[MIXER_LONG_NAME_CHARS] szName = 0; } -alias MIXERCONTROLDETAILS_LISTTEXTA* PMIXERCONTROLDETAILS_LISTTEXTA, LPMIXERCONTROLDETAILS_LISTTEXTA; +alias PMIXERCONTROLDETAILS_LISTTEXTA = MIXERCONTROLDETAILS_LISTTEXTA*, LPMIXERCONTROLDETAILS_LISTTEXTA = MIXERCONTROLDETAILS_LISTTEXTA*; struct MIXERCONTROLDETAILS_LISTTEXTW { DWORD dwParam1; DWORD dwParam2; WCHAR[MIXER_LONG_NAME_CHARS] szName = 0; } -alias MIXERCONTROLDETAILS_LISTTEXTW* PMIXERCONTROLDETAILS_LISTTEXTW, LPMIXERCONTROLDETAILS_LISTTEXTW; +alias PMIXERCONTROLDETAILS_LISTTEXTW = MIXERCONTROLDETAILS_LISTTEXTW*, LPMIXERCONTROLDETAILS_LISTTEXTW = MIXERCONTROLDETAILS_LISTTEXTW*; struct MIXERCONTROLDETAILS_BOOLEAN { LONG fValue; } -alias MIXERCONTROLDETAILS_BOOLEAN* PMIXERCONTROLDETAILS_BOOLEAN, LPMIXERCONTROLDETAILS_BOOLEAN; +alias PMIXERCONTROLDETAILS_BOOLEAN = MIXERCONTROLDETAILS_BOOLEAN*, LPMIXERCONTROLDETAILS_BOOLEAN = MIXERCONTROLDETAILS_BOOLEAN*; struct MIXERCONTROLDETAILS_SIGNED { LONG lValue; } -alias MIXERCONTROLDETAILS_SIGNED* PMIXERCONTROLDETAILS_SIGNED, LPMIXERCONTROLDETAILS_SIGNED; +alias PMIXERCONTROLDETAILS_SIGNED = MIXERCONTROLDETAILS_SIGNED*, LPMIXERCONTROLDETAILS_SIGNED = MIXERCONTROLDETAILS_SIGNED*; struct MIXERCONTROLDETAILS_UNSIGNED { DWORD dwValue; } -alias MIXERCONTROLDETAILS_UNSIGNED* PMIXERCONTROLDETAILS_UNSIGNED, LPMIXERCONTROLDETAILS_UNSIGNED; +alias PMIXERCONTROLDETAILS_UNSIGNED = MIXERCONTROLDETAILS_UNSIGNED*, LPMIXERCONTROLDETAILS_UNSIGNED = MIXERCONTROLDETAILS_UNSIGNED*; -alias void function (UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR) LPTIMECALLBACK; +alias LPTIMECALLBACK = void function (UINT, UINT, DWORD_PTR, DWORD_PTR, DWORD_PTR); struct TIMECAPS { UINT wPeriodMin; UINT wPeriodMax; } -alias TIMECAPS* PTIMECAPS, LPTIMECAPS; +alias PTIMECAPS = TIMECAPS*, LPTIMECAPS = TIMECAPS*; struct JOYCAPSA { WORD wMid; @@ -1537,7 +1537,7 @@ struct JOYCAPSA { CHAR[MAXPNAMELEN] szRegKey = 0; CHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD = 0; } -alias JOYCAPSA* PJOYCAPSA, LPJOYCAPSA; +alias PJOYCAPSA = JOYCAPSA*, LPJOYCAPSA = JOYCAPSA*; struct JOYCAPSW { WORD wMid; @@ -1565,7 +1565,7 @@ struct JOYCAPSW { WCHAR[MAXPNAMELEN] szRegKey = 0; WCHAR[MAX_JOYSTICKOEMVXDNAME] szOEMVxD = 0; } -alias JOYCAPSW* PJOYCAPSW, LPJOYCAPSW; +alias PJOYCAPSW = JOYCAPSW*, LPJOYCAPSW = JOYCAPSW*; struct JOYINFO { UINT wXpos; @@ -1573,7 +1573,7 @@ struct JOYINFO { UINT wZpos; UINT wButtons; } -alias JOYINFO* PJOYINFO, LPJOYINFO; +alias PJOYINFO = JOYINFO*, LPJOYINFO = JOYINFO*; struct JOYINFOEX { DWORD dwSize; @@ -1590,14 +1590,14 @@ struct JOYINFOEX { DWORD dwReserved1; DWORD dwReserved2; } -alias JOYINFOEX* PJOYINFOEX, LPJOYINFOEX; +alias PJOYINFOEX = JOYINFOEX*, LPJOYINFOEX = JOYINFOEX*; -alias DWORD FOURCC; -alias char* HPSTR; +alias FOURCC = DWORD; +alias HPSTR = char*; -alias HANDLE HMMIO; +alias HMMIO = HANDLE; -alias LRESULT function (LPSTR, UINT, LPARAM, LPARAM) LPMMIOPROC; +alias LPMMIOPROC = LRESULT function (LPSTR, UINT, LPARAM, LPARAM); struct MMIOINFO { align(1): @@ -1618,8 +1618,8 @@ align(1): DWORD dwReserved2; HMMIO hmmio; } -alias MMIOINFO* PMMIOINFO, LPMMIOINFO; -alias const(MMIOINFO)* LPCMMIOINFO; +alias PMMIOINFO = MMIOINFO*, LPMMIOINFO = MMIOINFO*; +alias LPCMMIOINFO = const(MMIOINFO)*; struct MMCKINFO { FOURCC ckid; @@ -1628,13 +1628,13 @@ struct MMCKINFO { DWORD dwDataOffset; DWORD dwFlags; } -alias MMCKINFO* PMMCKINFO, LPMMCKINFO; -alias const(MMCKINFO)* LPCMMCKINFO; +alias PMMCKINFO = MMCKINFO*, LPMMCKINFO = MMCKINFO*; +alias LPCMMCKINFO = const(MMCKINFO)*; struct MCI_GENERIC_PARMS { DWORD_PTR dwCallback; } -alias MCI_GENERIC_PARMS* PMCI_GENERIC_PARMS, LPMCI_GENERIC_PARMS; +alias PMCI_GENERIC_PARMS = MCI_GENERIC_PARMS*, LPMCI_GENERIC_PARMS = MCI_GENERIC_PARMS*; struct MCI_OPEN_PARMSA { align(1): @@ -1644,7 +1644,7 @@ align(1): LPCSTR lpstrElementName; LPCSTR lpstrAlias; } -alias MCI_OPEN_PARMSA* PMCI_OPEN_PARMSA, LPMCI_OPEN_PARMSA; +alias PMCI_OPEN_PARMSA = MCI_OPEN_PARMSA*, LPMCI_OPEN_PARMSA = MCI_OPEN_PARMSA*; struct MCI_OPEN_PARMSW { align(1): @@ -1654,20 +1654,20 @@ align(1): LPCWSTR lpstrElementName; LPCWSTR lpstrAlias; } -alias MCI_OPEN_PARMSW* PMCI_OPEN_PARMSW, LPMCI_OPEN_PARMSW; +alias PMCI_OPEN_PARMSW = MCI_OPEN_PARMSW*, LPMCI_OPEN_PARMSW = MCI_OPEN_PARMSW*; struct MCI_PLAY_PARMS { DWORD_PTR dwCallback; DWORD dwFrom; DWORD dwTo; } -alias MCI_PLAY_PARMS* PMCI_PLAY_PARMS, LPMCI_PLAY_PARMS; +alias PMCI_PLAY_PARMS = MCI_PLAY_PARMS*, LPMCI_PLAY_PARMS = MCI_PLAY_PARMS*; struct MCI_SEEK_PARMS { DWORD_PTR dwCallback; DWORD dwTo; } -alias MCI_SEEK_PARMS* PMCI_SEEK_PARMS, LPMCI_SEEK_PARMS; +alias PMCI_SEEK_PARMS = MCI_SEEK_PARMS*, LPMCI_SEEK_PARMS = MCI_SEEK_PARMS*; struct MCI_STATUS_PARMS { DWORD_PTR dwCallback; @@ -1675,28 +1675,28 @@ struct MCI_STATUS_PARMS { DWORD dwItem; DWORD dwTrack; } -alias MCI_STATUS_PARMS* PMCI_STATUS_PARMS, LPMCI_STATUS_PARMS; +alias PMCI_STATUS_PARMS = MCI_STATUS_PARMS*, LPMCI_STATUS_PARMS = MCI_STATUS_PARMS*; struct MCI_INFO_PARMSA { DWORD_PTR dwCallback; LPSTR lpstrReturn; DWORD dwRetSize; } -alias MCI_INFO_PARMSA* LPMCI_INFO_PARMSA; +alias LPMCI_INFO_PARMSA = MCI_INFO_PARMSA*; struct MCI_INFO_PARMSW { DWORD_PTR dwCallback; LPWSTR lpstrReturn; DWORD dwRetSize; } -alias MCI_INFO_PARMSW* LPMCI_INFO_PARMSW; +alias LPMCI_INFO_PARMSW = MCI_INFO_PARMSW*; struct MCI_GETDEVCAPS_PARMS { DWORD_PTR dwCallback; DWORD dwReturn; DWORD dwItem; } -alias MCI_GETDEVCAPS_PARMS* PMCI_GETDEVCAPS_PARMS, LPMCI_GETDEVCAPS_PARMS; +alias PMCI_GETDEVCAPS_PARMS = MCI_GETDEVCAPS_PARMS*, LPMCI_GETDEVCAPS_PARMS = MCI_GETDEVCAPS_PARMS*; struct MCI_SYSINFO_PARMSA { DWORD_PTR dwCallback; @@ -1705,7 +1705,7 @@ struct MCI_SYSINFO_PARMSA { DWORD dwNumber; UINT wDeviceType; } -alias MCI_SYSINFO_PARMSA* PMCI_SYSINFO_PARMSA, LPMCI_SYSINFO_PARMSA; +alias PMCI_SYSINFO_PARMSA = MCI_SYSINFO_PARMSA*, LPMCI_SYSINFO_PARMSA = MCI_SYSINFO_PARMSA*; struct MCI_SYSINFO_PARMSW { DWORD_PTR dwCallback; @@ -1714,14 +1714,14 @@ struct MCI_SYSINFO_PARMSW { DWORD dwNumber; UINT wDeviceType; } -alias MCI_SYSINFO_PARMSW* PMCI_SYSINFO_PARMSW, LPMCI_SYSINFO_PARMSW; +alias PMCI_SYSINFO_PARMSW = MCI_SYSINFO_PARMSW*, LPMCI_SYSINFO_PARMSW = MCI_SYSINFO_PARMSW*; struct MCI_SET_PARMS { DWORD_PTR dwCallback; DWORD dwTimeFormat; DWORD dwAudio; } -alias MCI_SET_PARMS* PMCI_SET_PARMS, LPMCI_SET_PARMS; +alias PMCI_SET_PARMS = MCI_SET_PARMS*, LPMCI_SET_PARMS = MCI_SET_PARMS*; struct MCI_BREAK_PARMS { align(1): @@ -1729,38 +1729,38 @@ align(1): int nVirtKey; HWND hwndBreak; } -alias MCI_BREAK_PARMS* PMCI_BREAK_PARMS, LPMCI_BREAK_PARMS; +alias PMCI_BREAK_PARMS = MCI_BREAK_PARMS*, LPMCI_BREAK_PARMS = MCI_BREAK_PARMS*; struct MCI_SAVE_PARMSA { DWORD_PTR dwCallback; LPCSTR lpfilename; } -alias MCI_SAVE_PARMSA* PMCI_SAVE_PARMSA, LPMCI_SAVE_PARMSA; +alias PMCI_SAVE_PARMSA = MCI_SAVE_PARMSA*, LPMCI_SAVE_PARMSA = MCI_SAVE_PARMSA*; struct MCI_SAVE_PARMSW { DWORD_PTR dwCallback; LPCWSTR lpfilename; } -alias MCI_SAVE_PARMSW* PMCI_SAVE_PARMSW, LPMCI_SAVE_PARMSW; +alias PMCI_SAVE_PARMSW = MCI_SAVE_PARMSW*, LPMCI_SAVE_PARMSW = MCI_SAVE_PARMSW*; struct MCI_LOAD_PARMSA { DWORD_PTR dwCallback; LPCSTR lpfilename; } -alias MCI_LOAD_PARMSA* PMCI_LOAD_PARMSA, LPMCI_LOAD_PARMSA; +alias PMCI_LOAD_PARMSA = MCI_LOAD_PARMSA*, LPMCI_LOAD_PARMSA = MCI_LOAD_PARMSA*; struct MCI_LOAD_PARMSW { DWORD_PTR dwCallback; LPCWSTR lpfilename; } -alias MCI_LOAD_PARMSW* PMCI_LOAD_PARMSW, LPMCI_LOAD_PARMSW; +alias PMCI_LOAD_PARMSW = MCI_LOAD_PARMSW*, LPMCI_LOAD_PARMSW = MCI_LOAD_PARMSW*; struct MCI_RECORD_PARMS { DWORD_PTR dwCallback; DWORD dwFrom; DWORD dwTo; } -alias MCI_RECORD_PARMS* LPMCI_RECORD_PARMS; +alias LPMCI_RECORD_PARMS = MCI_RECORD_PARMS*; struct MCI_VD_PLAY_PARMS { DWORD_PTR dwCallback; @@ -1768,25 +1768,25 @@ struct MCI_VD_PLAY_PARMS { DWORD dwTo; DWORD dwSpeed; } -alias MCI_VD_PLAY_PARMS* PMCI_VD_PLAY_PARMS, LPMCI_VD_PLAY_PARMS; +alias PMCI_VD_PLAY_PARMS = MCI_VD_PLAY_PARMS*, LPMCI_VD_PLAY_PARMS = MCI_VD_PLAY_PARMS*; struct MCI_VD_STEP_PARMS { DWORD_PTR dwCallback; DWORD dwFrames; } -alias MCI_VD_STEP_PARMS* PMCI_VD_STEP_PARMS, LPMCI_VD_STEP_PARMS; +alias PMCI_VD_STEP_PARMS = MCI_VD_STEP_PARMS*, LPMCI_VD_STEP_PARMS = MCI_VD_STEP_PARMS*; struct MCI_VD_ESCAPE_PARMSA { DWORD_PTR dwCallback; LPCSTR lpstrCommand; } -alias MCI_VD_ESCAPE_PARMSA* PMCI_VD_ESCAPE_PARMSA, LPMCI_VD_ESCAPE_PARMSA; +alias PMCI_VD_ESCAPE_PARMSA = MCI_VD_ESCAPE_PARMSA*, LPMCI_VD_ESCAPE_PARMSA = MCI_VD_ESCAPE_PARMSA*; struct MCI_VD_ESCAPE_PARMSW { DWORD_PTR dwCallback; LPCWSTR lpstrCommand; } -alias MCI_VD_ESCAPE_PARMSW* PMCI_VD_ESCAPE_PARMSW, LPMCI_VD_ESCAPE_PARMSW; +alias PMCI_VD_ESCAPE_PARMSW = MCI_VD_ESCAPE_PARMSW*, LPMCI_VD_ESCAPE_PARMSW = MCI_VD_ESCAPE_PARMSW*; struct MCI_WAVE_OPEN_PARMSA { align(1): @@ -1797,7 +1797,7 @@ align(1): LPCSTR lpstrAlias; DWORD dwBufferSeconds; } -alias MCI_WAVE_OPEN_PARMSA* PMCI_WAVE_OPEN_PARMSA, LPMCI_WAVE_OPEN_PARMSA; +alias PMCI_WAVE_OPEN_PARMSA = MCI_WAVE_OPEN_PARMSA*, LPMCI_WAVE_OPEN_PARMSA = MCI_WAVE_OPEN_PARMSA*; struct MCI_WAVE_OPEN_PARMSW { align(1): @@ -1808,14 +1808,14 @@ align(1): LPCWSTR lpstrAlias; DWORD dwBufferSeconds; } -alias MCI_WAVE_OPEN_PARMSW* PMCI_WAVE_OPEN_PARMSW, LPMCI_WAVE_OPEN_PARMSW; +alias PMCI_WAVE_OPEN_PARMSW = MCI_WAVE_OPEN_PARMSW*, LPMCI_WAVE_OPEN_PARMSW = MCI_WAVE_OPEN_PARMSW*; struct MCI_WAVE_DELETE_PARMS { DWORD_PTR dwCallback; DWORD dwFrom; DWORD dwTo; } -alias MCI_WAVE_DELETE_PARMS* PMCI_WAVE_DELETE_PARMS, LPMCI_WAVE_DELETE_PARMS; +alias PMCI_WAVE_DELETE_PARMS = MCI_WAVE_DELETE_PARMS*, LPMCI_WAVE_DELETE_PARMS = MCI_WAVE_DELETE_PARMS*; struct MCI_WAVE_SET_PARMS { DWORD_PTR dwCallback; @@ -1834,7 +1834,7 @@ struct MCI_WAVE_SET_PARMS { WORD wBitsPerSample; WORD wReserved5; } -alias MCI_WAVE_SET_PARMS* PMCI_WAVE_SET_PARMS, LPMCI_WAVE_SET_PARMS; +alias PMCI_WAVE_SET_PARMS = MCI_WAVE_SET_PARMS*, LPMCI_WAVE_SET_PARMS = MCI_WAVE_SET_PARMS*; extern (Windows) nothrow @nogc: LRESULT CloseDriver(HDRVR, LONG, LONG); @@ -2013,7 +2013,7 @@ struct MCI_SEQ_SET_PARMS { DWORD dwMaster; DWORD dwOffset; } -alias MCI_SEQ_SET_PARMS* PMCI_SEQ_SET_PARMS, LPMCI_SEQ_SET_PARMS; +alias PMCI_SEQ_SET_PARMS = MCI_SEQ_SET_PARMS*, LPMCI_SEQ_SET_PARMS = MCI_SEQ_SET_PARMS*; struct MCI_ANIM_OPEN_PARMSA { align(1): @@ -2025,7 +2025,7 @@ align(1): DWORD dwStyle; HWND hWndParent; } -alias MCI_ANIM_OPEN_PARMSA* PMCI_ANIM_OPEN_PARMSA, LPMCI_ANIM_OPEN_PARMSA; +alias PMCI_ANIM_OPEN_PARMSA = MCI_ANIM_OPEN_PARMSA*, LPMCI_ANIM_OPEN_PARMSA = MCI_ANIM_OPEN_PARMSA*; struct MCI_ANIM_OPEN_PARMSW { align(1): @@ -2037,7 +2037,7 @@ align(1): DWORD dwStyle; HWND hWndParent; } -alias MCI_ANIM_OPEN_PARMSW* PMCI_ANIM_OPEN_PARMSW, LPMCI_ANIM_OPEN_PARMSW; +alias PMCI_ANIM_OPEN_PARMSW = MCI_ANIM_OPEN_PARMSW*, LPMCI_ANIM_OPEN_PARMSW = MCI_ANIM_OPEN_PARMSW*; struct MCI_ANIM_PLAY_PARMS { DWORD_PTR dwCallback; @@ -2045,13 +2045,13 @@ struct MCI_ANIM_PLAY_PARMS { DWORD dwTo; DWORD dwSpeed; } -alias MCI_ANIM_PLAY_PARMS* PMCI_ANIM_PLAY_PARMS, LPMCI_ANIM_PLAY_PARMS; +alias PMCI_ANIM_PLAY_PARMS = MCI_ANIM_PLAY_PARMS*, LPMCI_ANIM_PLAY_PARMS = MCI_ANIM_PLAY_PARMS*; struct MCI_ANIM_STEP_PARMS { DWORD_PTR dwCallback; DWORD dwFrames; } -alias MCI_ANIM_STEP_PARMS* PMCI_ANIM_STEP_PARMS, LPMCI_ANIM_STEP_PARMS; +alias PMCI_ANIM_STEP_PARMS = MCI_ANIM_STEP_PARMS*, LPMCI_ANIM_STEP_PARMS = MCI_ANIM_STEP_PARMS*; struct MCI_ANIM_WINDOW_PARMSA { align(1): @@ -2060,7 +2060,7 @@ align(1): UINT nCmdShow; LPCSTR lpstrText; } -alias MCI_ANIM_WINDOW_PARMSA* PMCI_ANIM_WINDOW_PARMSA, LPMCI_ANIM_WINDOW_PARMSA; +alias PMCI_ANIM_WINDOW_PARMSA = MCI_ANIM_WINDOW_PARMSA*, LPMCI_ANIM_WINDOW_PARMSA = MCI_ANIM_WINDOW_PARMSA*; struct MCI_ANIM_WINDOW_PARMSW { align(1): @@ -2069,7 +2069,7 @@ align(1): UINT nCmdShow; LPCWSTR lpstrText; } -alias MCI_ANIM_WINDOW_PARMSW* PMCI_ANIM_WINDOW_PARMSW, LPMCI_ANIM_WINDOW_PARMSW; +alias PMCI_ANIM_WINDOW_PARMSW = MCI_ANIM_WINDOW_PARMSW*, LPMCI_ANIM_WINDOW_PARMSW = MCI_ANIM_WINDOW_PARMSW*; struct MCI_ANIM_RECT_PARMS { DWORD_PTR dwCallback; @@ -2080,14 +2080,14 @@ struct MCI_ANIM_RECT_PARMS { RECT rc; //#endif } -alias MCI_ANIM_RECT_PARMS* PMCI_ANIM_RECT_PARMS, LPMCI_ANIM_RECT_PARMS; +alias PMCI_ANIM_RECT_PARMS = MCI_ANIM_RECT_PARMS*, LPMCI_ANIM_RECT_PARMS = MCI_ANIM_RECT_PARMS*; struct MCI_ANIM_UPDATE_PARMS { DWORD_PTR dwCallback; RECT rc; HDC hDC; } -alias MCI_ANIM_UPDATE_PARMS* PMCI_ANIM_UPDATE_PARMS, LPMCI_ANIM_UPDATE_PARMS; +alias PMCI_ANIM_UPDATE_PARMS = MCI_ANIM_UPDATE_PARMS*, LPMCI_ANIM_UPDATE_PARMS = MCI_ANIM_UPDATE_PARMS*; struct MCI_OVLY_OPEN_PARMSA { align(1): @@ -2099,7 +2099,7 @@ align(1): DWORD dwStyle; HWND hWndParent; } -alias MCI_OVLY_OPEN_PARMSA* PMCI_OVLY_OPEN_PARMSA, LPMCI_OVLY_OPEN_PARMSA; +alias PMCI_OVLY_OPEN_PARMSA = MCI_OVLY_OPEN_PARMSA*, LPMCI_OVLY_OPEN_PARMSA = MCI_OVLY_OPEN_PARMSA*; struct MCI_OVLY_OPEN_PARMSW { align(1): @@ -2111,7 +2111,7 @@ align(1): DWORD dwStyle; HWND hWndParent; } -alias MCI_OVLY_OPEN_PARMSW* PMCI_OVLY_OPEN_PARMSW, LPMCI_OVLY_OPEN_PARMSW; +alias PMCI_OVLY_OPEN_PARMSW = MCI_OVLY_OPEN_PARMSW*, LPMCI_OVLY_OPEN_PARMSW = MCI_OVLY_OPEN_PARMSW*; struct MCI_OVLY_WINDOW_PARMSA { align(1): @@ -2120,7 +2120,7 @@ align(1): UINT nCmdShow; LPCSTR lpstrText; } -alias MCI_OVLY_WINDOW_PARMSA* PMCI_OVLY_WINDOW_PARMSA, LPMCI_OVLY_WINDOW_PARMSA; +alias PMCI_OVLY_WINDOW_PARMSA = MCI_OVLY_WINDOW_PARMSA*, LPMCI_OVLY_WINDOW_PARMSA = MCI_OVLY_WINDOW_PARMSA*; struct MCI_OVLY_WINDOW_PARMSW { align(1): @@ -2129,7 +2129,7 @@ align(1): UINT nCmdShow; LPCWSTR lpstrText; } -alias MCI_OVLY_WINDOW_PARMSW* PMCI_OVLY_WINDOW_PARMSW, LPMCI_OVLY_WINDOW_PARMSW; +alias PMCI_OVLY_WINDOW_PARMSW = MCI_OVLY_WINDOW_PARMSW*, LPMCI_OVLY_WINDOW_PARMSW = MCI_OVLY_WINDOW_PARMSW*; struct MCI_OVLY_RECT_PARMS { DWORD_PTR dwCallback; @@ -2140,159 +2140,159 @@ struct MCI_OVLY_RECT_PARMS { RECT rc; //#endif } -alias MCI_OVLY_RECT_PARMS* PMCI_OVLY_RECT_PARMS, LPMCI_OVLY_RECT_PARMS; +alias PMCI_OVLY_RECT_PARMS = MCI_OVLY_RECT_PARMS*, LPMCI_OVLY_RECT_PARMS = MCI_OVLY_RECT_PARMS*; struct MCI_OVLY_SAVE_PARMSA { DWORD_PTR dwCallback; LPCSTR lpfilename; RECT rc; } -alias MCI_OVLY_SAVE_PARMSA* PMCI_OVLY_SAVE_PARMSA, LPMCI_OVLY_SAVE_PARMSA; +alias PMCI_OVLY_SAVE_PARMSA = MCI_OVLY_SAVE_PARMSA*, LPMCI_OVLY_SAVE_PARMSA = MCI_OVLY_SAVE_PARMSA*; struct MCI_OVLY_SAVE_PARMSW { DWORD_PTR dwCallback; LPCWSTR lpfilename; RECT rc; } -alias MCI_OVLY_SAVE_PARMSW* PMCI_OVLY_SAVE_PARMSW, LPMCI_OVLY_SAVE_PARMSW; +alias PMCI_OVLY_SAVE_PARMSW = MCI_OVLY_SAVE_PARMSW*, LPMCI_OVLY_SAVE_PARMSW = MCI_OVLY_SAVE_PARMSW*; struct MCI_OVLY_LOAD_PARMSA { DWORD_PTR dwCallback; LPCSTR lpfilename; RECT rc; } -alias MCI_OVLY_LOAD_PARMSA* PMCI_OVLY_LOAD_PARMSA, LPMCI_OVLY_LOAD_PARMSA; +alias PMCI_OVLY_LOAD_PARMSA = MCI_OVLY_LOAD_PARMSA*, LPMCI_OVLY_LOAD_PARMSA = MCI_OVLY_LOAD_PARMSA*; struct MCI_OVLY_LOAD_PARMSW { DWORD_PTR dwCallback; LPCWSTR lpfilename; RECT rc; } -alias MCI_OVLY_LOAD_PARMSW* PMCI_OVLY_LOAD_PARMSW, LPMCI_OVLY_LOAD_PARMSW; +alias PMCI_OVLY_LOAD_PARMSW = MCI_OVLY_LOAD_PARMSW*, LPMCI_OVLY_LOAD_PARMSW = MCI_OVLY_LOAD_PARMSW*; version (Unicode) { - alias WAVEOUTCAPSW WAVEOUTCAPS; - alias WAVEINCAPSW WAVEINCAPS; - alias MIDIOUTCAPSW MIDIOUTCAPS; - alias MIDIINCAPSW MIDIINCAPS; - alias AUXCAPSW AUXCAPS; - alias MIXERCAPSW MIXERCAPS; - alias MIXERLINEW MIXERLINE; - alias MIXERCONTROLA MIXERCONTROL; - alias MIXERLINECONTROLSW MIXERLINECONTROLS; - alias MIXERCONTROLDETAILS_LISTTEXTW MIXERCONTROLDETAILS_LISTTEXT; - alias JOYCAPSW JOYCAPS; - alias MCI_OPEN_PARMSW MCI_OPEN_PARMS; - alias MCI_INFO_PARMSW MCI_INFO_PARMS; - alias MCI_SYSINFO_PARMSW MCI_SYSINFO_PARMS; - alias MCI_SAVE_PARMSW MCI_SAVE_PARMS; - alias MCI_LOAD_PARMSW MCI_LOAD_PARMS; - alias MCI_VD_ESCAPE_PARMSW MCI_VD_ESCAPE_PARMS; - alias MCI_WAVE_OPEN_PARMSW MCI_WAVE_OPEN_PARMS; - alias MCI_ANIM_OPEN_PARMSW MCI_ANIM_OPEN_PARMS; - alias MCI_ANIM_WINDOW_PARMSW MCI_ANIM_WINDOW_PARMS; - alias MCI_OVLY_OPEN_PARMSW MCI_OVLY_OPEN_PARMS; - alias MCI_OVLY_WINDOW_PARMSW MCI_OVLY_WINDOW_PARMS; - alias MCI_OVLY_SAVE_PARMSW MCI_OVLY_SAVE_PARMS; - - alias sndPlaySoundW sndPlaySound; - alias PlaySoundW PlaySound; - alias waveOutGetDevCapsW waveOutGetDevCaps; - alias waveOutGetErrorTextW waveOutGetErrorText; - alias waveInGetDevCapsW waveInGetDevCaps; - alias waveInGetErrorTextW waveInGetErrorText; - alias midiOutGetDevCapsW midiOutGetDevCaps; - alias midiOutGetErrorTextW midiOutGetErrorText; - alias midiInGetDevCapsW midiInGetDevCaps; - alias midiInGetErrorTextW midiInGetErrorText; - alias auxGetDevCapsW auxGetDevCaps; - alias mixerGetDevCapsW mixerGetDevCaps; - alias mixerGetLineInfoW mixerGetLineInfo; - alias mixerGetLineControlsW mixerGetLineControls; - alias mixerGetControlDetailsW mixerGetControlDetails; - alias joyGetDevCapsW joyGetDevCaps; - alias mmioInstallIOProcW mmioInstallIOProc; - alias mmioStringToFOURCCW mmioStringToFOURCC; - alias mmioOpenW mmioOpen; - alias mmioRenameW mmioRename; - alias mciSendCommandW mciSendCommand; - alias mciSendStringW mciSendString; - alias mciGetDeviceIDW mciGetDeviceID; - alias mciGetDeviceIDFromElementIDW mciGetDeviceIDFromElementID; - alias mciGetErrorStringW mciGetErrorString; + alias WAVEOUTCAPS = WAVEOUTCAPSW; + alias WAVEINCAPS = WAVEINCAPSW; + alias MIDIOUTCAPS = MIDIOUTCAPSW; + alias MIDIINCAPS = MIDIINCAPSW; + alias AUXCAPS = AUXCAPSW; + alias MIXERCAPS = MIXERCAPSW; + alias MIXERLINE = MIXERLINEW; + alias MIXERCONTROL = MIXERCONTROLA; + alias MIXERLINECONTROLS = MIXERLINECONTROLSW; + alias MIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXTW; + alias JOYCAPS = JOYCAPSW; + alias MCI_OPEN_PARMS = MCI_OPEN_PARMSW; + alias MCI_INFO_PARMS = MCI_INFO_PARMSW; + alias MCI_SYSINFO_PARMS = MCI_SYSINFO_PARMSW; + alias MCI_SAVE_PARMS = MCI_SAVE_PARMSW; + alias MCI_LOAD_PARMS = MCI_LOAD_PARMSW; + alias MCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMSW; + alias MCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMSW; + alias MCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMSW; + alias MCI_ANIM_WINDOW_PARMS = MCI_ANIM_WINDOW_PARMSW; + alias MCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMSW; + alias MCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMSW; + alias MCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMSW; + + alias sndPlaySound = sndPlaySoundW; + alias PlaySound = PlaySoundW; + alias waveOutGetDevCaps = waveOutGetDevCapsW; + alias waveOutGetErrorText = waveOutGetErrorTextW; + alias waveInGetDevCaps = waveInGetDevCapsW; + alias waveInGetErrorText = waveInGetErrorTextW; + alias midiOutGetDevCaps = midiOutGetDevCapsW; + alias midiOutGetErrorText = midiOutGetErrorTextW; + alias midiInGetDevCaps = midiInGetDevCapsW; + alias midiInGetErrorText = midiInGetErrorTextW; + alias auxGetDevCaps = auxGetDevCapsW; + alias mixerGetDevCaps = mixerGetDevCapsW; + alias mixerGetLineInfo = mixerGetLineInfoW; + alias mixerGetLineControls = mixerGetLineControlsW; + alias mixerGetControlDetails = mixerGetControlDetailsW; + alias joyGetDevCaps = joyGetDevCapsW; + alias mmioInstallIOProc = mmioInstallIOProcW; + alias mmioStringToFOURCC = mmioStringToFOURCCW; + alias mmioOpen = mmioOpenW; + alias mmioRename = mmioRenameW; + alias mciSendCommand = mciSendCommandW; + alias mciSendString = mciSendStringW; + alias mciGetDeviceID = mciGetDeviceIDW; + alias mciGetDeviceIDFromElementID = mciGetDeviceIDFromElementIDW; + alias mciGetErrorString = mciGetErrorStringW; } else { - alias WAVEOUTCAPSA WAVEOUTCAPS; - alias WAVEINCAPSA WAVEINCAPS; - alias MIDIOUTCAPSA MIDIOUTCAPS; - alias MIDIINCAPSA MIDIINCAPS; - alias AUXCAPSA AUXCAPS; - alias MIXERCAPSA MIXERCAPS; - alias MIXERLINEA MIXERLINE; - alias MIXERCONTROLA MIXERCONTROL; - alias MIXERLINECONTROLSA MIXERLINECONTROLS; - alias MIXERCONTROLDETAILS_LISTTEXTA MIXERCONTROLDETAILS_LISTTEXT; - alias JOYCAPSA JOYCAPS; - alias MCI_OPEN_PARMSA MCI_OPEN_PARMS; - alias MCI_INFO_PARMSA MCI_INFO_PARMS; - alias MCI_SYSINFO_PARMSA MCI_SYSINFO_PARMS; - alias MCI_SAVE_PARMSA MCI_SAVE_PARMS; - alias MCI_LOAD_PARMSA MCI_LOAD_PARMS; - alias MCI_VD_ESCAPE_PARMSA MCI_VD_ESCAPE_PARMS; - alias MCI_WAVE_OPEN_PARMSA MCI_WAVE_OPEN_PARMS; - alias MCI_ANIM_OPEN_PARMSA MCI_ANIM_OPEN_PARMS; - alias MCI_ANIM_WINDOW_PARMSA MCI_ANIM_WINDOW_PARMS; - alias MCI_OVLY_OPEN_PARMSA MCI_OVLY_OPEN_PARMS; - alias MCI_OVLY_WINDOW_PARMSA MCI_OVLY_WINDOW_PARMS; - alias MCI_OVLY_SAVE_PARMSA MCI_OVLY_SAVE_PARMS; - - alias sndPlaySoundA sndPlaySound; - alias PlaySoundA PlaySound; - alias waveOutGetDevCapsA waveOutGetDevCaps; - alias waveOutGetErrorTextA waveOutGetErrorText; - alias waveInGetDevCapsA waveInGetDevCaps; - alias waveInGetErrorTextA waveInGetErrorText; - alias midiOutGetDevCapsA midiOutGetDevCaps; - alias midiOutGetErrorTextA midiOutGetErrorText; - alias midiInGetDevCapsA midiInGetDevCaps; - alias midiInGetErrorTextA midiInGetErrorText; - alias auxGetDevCapsA auxGetDevCaps; - alias mixerGetDevCapsA mixerGetDevCaps; - alias mixerGetLineInfoA mixerGetLineInfo; - alias mixerGetLineControlsA mixerGetLineControls; - alias mixerGetControlDetailsA mixerGetControlDetails; - alias joyGetDevCapsA joyGetDevCaps; - alias mmioInstallIOProcA mmioInstallIOProc; - alias mmioStringToFOURCCA mmioStringToFOURCC; - alias mmioOpenA mmioOpen; - alias mmioRenameA mmioRename; - alias mciSendCommandA mciSendCommand; - alias mciSendStringA mciSendString; - alias mciGetDeviceIDA mciGetDeviceID; - alias mciGetDeviceIDFromElementIDA mciGetDeviceIDFromElementID; - alias mciGetErrorStringA mciGetErrorString; -} - -alias WAVEOUTCAPS* PWAVEOUTCAPS, LPWAVEOUTCAPS; -alias WAVEINCAPS* PWAVEINCAPS, LPWAVEINCAPS; -alias MIDIOUTCAPS* PMIDIOUTCAPS, LPMIDIOUTCAPS; -alias MIDIINCAPS* PMIDIINCAPS, LPMIDIINCAPS; -alias AUXCAPS* PAUXCAPS, LPAUXCAPS; -alias MIXERCAPS* PMIXERCAPS, LPMIXERCAPS; -alias MIXERLINE* PMIXERLINE, LPMIXERLINE; -alias MIXERCONTROL* PMIXERCONTROL, LPMIXERCONTROL; -alias MIXERLINECONTROLS* PMIXERLINECONTROLS, LPMIXERLINECONTROLS; -alias MIXERCONTROLDETAILS_LISTTEXT* PMIXERCONTROLDETAILS_LISTTEXT, LPMIXERCONTROLDETAILS_LISTTEXT; -alias JOYCAPS* PJOYCAPS, LPJOYCAPS; -alias MCI_OPEN_PARMS* PMCI_OPEN_PARMS, LPMCI_OPEN_PARMS; -alias MCI_INFO_PARMS* LPMCI_INFO_PARMS; -alias MCI_SYSINFO_PARMS* PMCI_SYSINFO_PARMS, LPMCI_SYSINFO_PARMS; -alias MCI_SAVE_PARMS* PMCI_SAVE_PARMS, LPMCI_SAVE_PARMS; -alias MCI_LOAD_PARMS* PMCI_LOAD_PARMS, LPMCI_LOAD_PARMS; -alias MCI_VD_ESCAPE_PARMS* PMCI_VD_ESCAPE_PARMS, LPMCI_VD_ESCAPE_PARMS; -alias MCI_WAVE_OPEN_PARMS* PMCI_WAVE_OPEN_PARMS, LPMCI_WAVE_OPEN_PARMS; -alias MCI_ANIM_OPEN_PARMS* PMCI_ANIM_OPEN_PARMS, LPMCI_ANIM_OPEN_PARMS; -alias MCI_ANIM_WINDOW_PARMS* PMCI_ANIM_WINDOW_PARMS, LPMCI_ANIM_WINDOW_PARMS; -alias MCI_OVLY_OPEN_PARMS* PMCI_OVLY_OPEN_PARMS, LPMCI_OVLY_OPEN_PARMS; -alias MCI_OVLY_WINDOW_PARMS* PMCI_OVLY_WINDOW_PARMS, LPMCI_OVLY_WINDOW_PARMS; -alias MCI_OVLY_SAVE_PARMS* PMCI_OVLY_SAVE_PARMS, LPMCI_OVLY_SAVE_PARMS; + alias WAVEOUTCAPS = WAVEOUTCAPSA; + alias WAVEINCAPS = WAVEINCAPSA; + alias MIDIOUTCAPS = MIDIOUTCAPSA; + alias MIDIINCAPS = MIDIINCAPSA; + alias AUXCAPS = AUXCAPSA; + alias MIXERCAPS = MIXERCAPSA; + alias MIXERLINE = MIXERLINEA; + alias MIXERCONTROL = MIXERCONTROLA; + alias MIXERLINECONTROLS = MIXERLINECONTROLSA; + alias MIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXTA; + alias JOYCAPS = JOYCAPSA; + alias MCI_OPEN_PARMS = MCI_OPEN_PARMSA; + alias MCI_INFO_PARMS = MCI_INFO_PARMSA; + alias MCI_SYSINFO_PARMS = MCI_SYSINFO_PARMSA; + alias MCI_SAVE_PARMS = MCI_SAVE_PARMSA; + alias MCI_LOAD_PARMS = MCI_LOAD_PARMSA; + alias MCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMSA; + alias MCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMSA; + alias MCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMSA; + alias MCI_ANIM_WINDOW_PARMS = MCI_ANIM_WINDOW_PARMSA; + alias MCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMSA; + alias MCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMSA; + alias MCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMSA; + + alias sndPlaySound = sndPlaySoundA; + alias PlaySound = PlaySoundA; + alias waveOutGetDevCaps = waveOutGetDevCapsA; + alias waveOutGetErrorText = waveOutGetErrorTextA; + alias waveInGetDevCaps = waveInGetDevCapsA; + alias waveInGetErrorText = waveInGetErrorTextA; + alias midiOutGetDevCaps = midiOutGetDevCapsA; + alias midiOutGetErrorText = midiOutGetErrorTextA; + alias midiInGetDevCaps = midiInGetDevCapsA; + alias midiInGetErrorText = midiInGetErrorTextA; + alias auxGetDevCaps = auxGetDevCapsA; + alias mixerGetDevCaps = mixerGetDevCapsA; + alias mixerGetLineInfo = mixerGetLineInfoA; + alias mixerGetLineControls = mixerGetLineControlsA; + alias mixerGetControlDetails = mixerGetControlDetailsA; + alias joyGetDevCaps = joyGetDevCapsA; + alias mmioInstallIOProc = mmioInstallIOProcA; + alias mmioStringToFOURCC = mmioStringToFOURCCA; + alias mmioOpen = mmioOpenA; + alias mmioRename = mmioRenameA; + alias mciSendCommand = mciSendCommandA; + alias mciSendString = mciSendStringA; + alias mciGetDeviceID = mciGetDeviceIDA; + alias mciGetDeviceIDFromElementID = mciGetDeviceIDFromElementIDA; + alias mciGetErrorString = mciGetErrorStringA; +} + +alias PWAVEOUTCAPS = WAVEOUTCAPS*, LPWAVEOUTCAPS = WAVEOUTCAPS*; +alias PWAVEINCAPS = WAVEINCAPS*, LPWAVEINCAPS = WAVEINCAPS*; +alias PMIDIOUTCAPS = MIDIOUTCAPS*, LPMIDIOUTCAPS = MIDIOUTCAPS*; +alias PMIDIINCAPS = MIDIINCAPS*, LPMIDIINCAPS = MIDIINCAPS*; +alias PAUXCAPS = AUXCAPS*, LPAUXCAPS = AUXCAPS*; +alias PMIXERCAPS = MIXERCAPS*, LPMIXERCAPS = MIXERCAPS*; +alias PMIXERLINE = MIXERLINE*, LPMIXERLINE = MIXERLINE*; +alias PMIXERCONTROL = MIXERCONTROL*, LPMIXERCONTROL = MIXERCONTROL*; +alias PMIXERLINECONTROLS = MIXERLINECONTROLS*, LPMIXERLINECONTROLS = MIXERLINECONTROLS*; +alias PMIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXT*, LPMIXERCONTROLDETAILS_LISTTEXT = MIXERCONTROLDETAILS_LISTTEXT*; +alias PJOYCAPS = JOYCAPS*, LPJOYCAPS = JOYCAPS*; +alias PMCI_OPEN_PARMS = MCI_OPEN_PARMS*, LPMCI_OPEN_PARMS = MCI_OPEN_PARMS*; +alias LPMCI_INFO_PARMS = MCI_INFO_PARMS*; +alias PMCI_SYSINFO_PARMS = MCI_SYSINFO_PARMS*, LPMCI_SYSINFO_PARMS = MCI_SYSINFO_PARMS*; +alias PMCI_SAVE_PARMS = MCI_SAVE_PARMS*, LPMCI_SAVE_PARMS = MCI_SAVE_PARMS*; +alias PMCI_LOAD_PARMS = MCI_LOAD_PARMS*, LPMCI_LOAD_PARMS = MCI_LOAD_PARMS*; +alias PMCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMS*, LPMCI_VD_ESCAPE_PARMS = MCI_VD_ESCAPE_PARMS*; +alias PMCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMS*, LPMCI_WAVE_OPEN_PARMS = MCI_WAVE_OPEN_PARMS*; +alias PMCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMS*, LPMCI_ANIM_OPEN_PARMS = MCI_ANIM_OPEN_PARMS*; +alias PMCI_ANIM_WINDOW_PARMS = MCI_ANIM_WINDOW_PARMS*, LPMCI_ANIM_WINDOW_PARMS = MCI_ANIM_WINDOW_PARMS*; +alias PMCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMS*, LPMCI_OVLY_OPEN_PARMS = MCI_OVLY_OPEN_PARMS*; +alias PMCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMS*, LPMCI_OVLY_WINDOW_PARMS = MCI_OVLY_WINDOW_PARMS*; +alias PMCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMS*, LPMCI_OVLY_SAVE_PARMS = MCI_OVLY_SAVE_PARMS*; diff --git a/runtime/druntime/src/core/sys/windows/msacm.d b/runtime/druntime/src/core/sys/windows/msacm.d index df4d6c4fc92..18936b7d4bc 100644 --- a/runtime/druntime/src/core/sys/windows/msacm.d +++ b/runtime/druntime/src/core/sys/windows/msacm.d @@ -16,7 +16,7 @@ import core.sys.windows.basetsd, core.sys.windows.mmsystem, core.sys.windows.win alias HACMDRIVERID = HANDLE; alias HACMDRIVER = HANDLE; -alias HACMDRIVER* LPHACMDRIVER; +alias LPHACMDRIVER = HACMDRIVER*; enum size_t ACMDRIVERDETAILS_SHORTNAME_CHARS = 32, @@ -40,7 +40,7 @@ struct ACMFORMATDETAILSA { DWORD cbwfx; char[ACMFORMATDETAILS_FORMAT_CHARS] szFormat = 0; } -alias ACMFORMATDETAILSA* LPACMFORMATDETAILSA; +alias LPACMFORMATDETAILSA = ACMFORMATDETAILSA*; struct ACMFORMATDETAILSW { DWORD cbStruct = ACMFORMATDETAILSW.sizeof; @@ -51,7 +51,7 @@ struct ACMFORMATDETAILSW { DWORD cbwfx; WCHAR[ACMFORMATDETAILS_FORMAT_CHARS] szFormat = 0; } -alias ACMFORMATDETAILSW* LPACMFORMATDETAILSW; +alias LPACMFORMATDETAILSW = ACMFORMATDETAILSW*; struct ACMFORMATTAGDETAILSA { DWORD cbStruct = ACMFORMATTAGDETAILSA.sizeof; @@ -62,7 +62,7 @@ struct ACMFORMATTAGDETAILSA { DWORD cStandardFormats; char[ACMFORMATTAGDETAILS_FORMATTAG_CHARS] szFormatTag = 0; } -alias ACMFORMATTAGDETAILSA* LPACMFORMATTAGDETAILSA; +alias LPACMFORMATTAGDETAILSA = ACMFORMATTAGDETAILSA*; struct ACMFORMATTAGDETAILSW { DWORD cbStruct = ACMFORMATTAGDETAILSW.sizeof; @@ -73,7 +73,7 @@ struct ACMFORMATTAGDETAILSW { DWORD cStandardFormats; WCHAR[ACMFORMATTAGDETAILS_FORMATTAG_CHARS] szFormatTag = 0; } -alias ACMFORMATTAGDETAILSW* LPACMFORMATTAGDETAILSW; +alias LPACMFORMATTAGDETAILSW = ACMFORMATTAGDETAILSW*; struct ACMDRIVERDETAILSA { align(1): @@ -94,7 +94,7 @@ align(1): char[ACMDRIVERDETAILS_LICENSING_CHARS] szLicensing = 0; char[ACMDRIVERDETAILS_FEATURES_CHARS] szFeatures = 0; } -alias ACMDRIVERDETAILSA* LPACMDRIVERDETAILSA; +alias LPACMDRIVERDETAILSA = ACMDRIVERDETAILSA*; struct ACMDRIVERDETAILSW { align(1): @@ -115,19 +115,19 @@ align(1): WCHAR[ACMDRIVERDETAILS_LICENSING_CHARS] szLicensing = 0; WCHAR[ACMDRIVERDETAILS_FEATURES_CHARS] szFeatures = 0; } -alias ACMDRIVERDETAILSW* LPACMDRIVERDETAILSW; +alias LPACMDRIVERDETAILSW = ACMDRIVERDETAILSW*; extern (Windows) { - alias BOOL function(HACMDRIVERID hadid, LPACMFORMATDETAILSA pafd, - DWORD_PTR dwInstance, DWORD fdwSupport) ACMFORMATENUMCBA; - alias BOOL function(HACMDRIVERID hadid, LPACMFORMATDETAILSW pafd, - DWORD_PTR dwInstance, DWORD fdwSupport) ACMFORMATENUMCBW; - alias BOOL function(HACMDRIVERID hadid, LPACMFORMATTAGDETAILSA paftd, - DWORD_PTR dwInstance, DWORD fdwSupport) ACMFORMATTAGENUMCBA; - alias BOOL function(HACMDRIVERID hadid, LPACMFORMATTAGDETAILSW paftd, - DWORD_PTR dwInstance, DWORD fdwSupport) ACMFORMATTAGENUMCBW; - alias BOOL function(HACMDRIVERID hadid, DWORD_PTR dwInstance, - DWORD fdwSupport) ACMDRIVERENUMCB; + alias ACMFORMATENUMCBA = BOOL function(HACMDRIVERID hadid, LPACMFORMATDETAILSA pafd, + DWORD_PTR dwInstance, DWORD fdwSupport); + alias ACMFORMATENUMCBW = BOOL function(HACMDRIVERID hadid, LPACMFORMATDETAILSW pafd, + DWORD_PTR dwInstance, DWORD fdwSupport); + alias ACMFORMATTAGENUMCBA = BOOL function(HACMDRIVERID hadid, LPACMFORMATTAGDETAILSA paftd, + DWORD_PTR dwInstance, DWORD fdwSupport); + alias ACMFORMATTAGENUMCBW = BOOL function(HACMDRIVERID hadid, LPACMFORMATTAGDETAILSW paftd, + DWORD_PTR dwInstance, DWORD fdwSupport); + alias ACMDRIVERENUMCB = BOOL function(HACMDRIVERID hadid, DWORD_PTR dwInstance, + DWORD fdwSupport); MMRESULT acmDriverOpen(LPHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpen); @@ -149,25 +149,25 @@ extern (Windows) { } version (Unicode) { - alias ACMFORMATDETAILSW ACMFORMATDETAILS; - alias ACMFORMATTAGDETAILSW ACMFORMATTAGDETAILS; - alias ACMDRIVERDETAILSW ACMDRIVERDETAILS; - alias ACMFORMATENUMCBW ACMFORMATENUMCB; - alias ACMFORMATTAGENUMCBW ACMFORMATTAGENUMCB; - alias acmFormatEnumW acmFormatEnum; - alias acmDriverDetailsW acmDriverDetails; - alias acmFormatTagEnumW acmFormatTagEnum; + alias ACMFORMATDETAILS = ACMFORMATDETAILSW; + alias ACMFORMATTAGDETAILS = ACMFORMATTAGDETAILSW; + alias ACMDRIVERDETAILS = ACMDRIVERDETAILSW; + alias ACMFORMATENUMCB = ACMFORMATENUMCBW; + alias ACMFORMATTAGENUMCB = ACMFORMATTAGENUMCBW; + alias acmFormatEnum = acmFormatEnumW; + alias acmDriverDetails = acmDriverDetailsW; + alias acmFormatTagEnum = acmFormatTagEnumW; } else { - alias ACMFORMATDETAILSA ACMFORMATDETAILS; - alias ACMFORMATTAGDETAILSA ACMFORMATTAGDETAILS; - alias ACMDRIVERDETAILSA ACMDRIVERDETAILS; - alias ACMFORMATENUMCBA ACMFORMATENUMCB; - alias ACMFORMATTAGENUMCBA ACMFORMATTAGENUMCB; - alias acmFormatEnumA acmFormatEnum; - alias acmDriverDetailsA acmDriverDetails; - alias acmFormatTagEnumA acmFormatTagEnum; + alias ACMFORMATDETAILS = ACMFORMATDETAILSA; + alias ACMFORMATTAGDETAILS = ACMFORMATTAGDETAILSA; + alias ACMDRIVERDETAILS = ACMDRIVERDETAILSA; + alias ACMFORMATENUMCB = ACMFORMATENUMCBA; + alias ACMFORMATTAGENUMCB = ACMFORMATTAGENUMCBA; + alias acmFormatEnum = acmFormatEnumA; + alias acmDriverDetails = acmDriverDetailsA; + alias acmFormatTagEnum = acmFormatTagEnumA; } -alias ACMFORMATDETAILS* LPACMFORMATDETAILS; -alias ACMFORMATTAGDETAILS* LPACMFORMATTAGDETAILS; -alias ACMDRIVERDETAILS* LPACMDRIVERDETAILS; +alias LPACMFORMATDETAILS = ACMFORMATDETAILS*; +alias LPACMFORMATTAGDETAILS = ACMFORMATTAGDETAILS*; +alias LPACMDRIVERDETAILS = ACMDRIVERDETAILS*; diff --git a/runtime/druntime/src/core/sys/windows/mshtml.d b/runtime/druntime/src/core/sys/windows/mshtml.d index d20c4bbb304..033e459ca85 100644 --- a/runtime/druntime/src/core/sys/windows/mshtml.d +++ b/runtime/druntime/src/core/sys/windows/mshtml.d @@ -14,34 +14,34 @@ import core.sys.windows.basetyps, core.sys.windows.oaidl, core.sys.windows.unknw // These are used in this file, but not defined in MinGW. interface IHTMLStyleSheet {} -alias IHTMLStyle LPHTMLSTYLE; -alias IHTMLStyleSheet LPHTMLSTYLESHEET; +alias LPHTMLSTYLE = IHTMLStyle; +alias LPHTMLSTYLESHEET = IHTMLStyleSheet; interface IHTMLLocation {} -alias IHTMLLocation LPHTMLLOCATION; +alias LPHTMLLOCATION = IHTMLLocation; interface IHTMLFramesCollection {} -alias IHTMLFramesCollection LPHTMLFRAMESCOLLECTION; +alias LPHTMLFRAMESCOLLECTION = IHTMLFramesCollection; interface IHTMLStyleSheetsCollection {} -alias IHTMLStyleSheetsCollection LPHTMLSTYLESHEETSCOLLECTION; +alias LPHTMLSTYLESHEETSCOLLECTION = IHTMLStyleSheetsCollection; interface IHTMLStyle {} interface IHTMLFiltersCollection {} -alias IHTMLFiltersCollection LPHTMLFILTERSCOLLECTION; +alias LPHTMLFILTERSCOLLECTION = IHTMLFiltersCollection; interface IOmHistory : IDispatch { HRESULT get_length(short* p); HRESULT back(VARIANT*); HRESULT forward(VARIANT*); HRESULT go(VARIANT*); } -alias IOmHistory LPOMHISTORY; +alias LPOMHISTORY = IOmHistory; interface IOmNavigator {} -alias IOmNavigator LPOMNAVIGATOR; +alias LPOMNAVIGATOR = IOmNavigator; interface IHTMLImageElementFactory {} -alias IHTMLImageElementFactory LPHTMLIMAGEELEMENTFACTORY; +alias LPHTMLIMAGEELEMENTFACTORY = IHTMLImageElementFactory; interface IHTMLEventObj {} -alias IHTMLEventObj LPHTMLEVENTOBJ; +alias LPHTMLEVENTOBJ = IHTMLEventObj; interface IHTMLScreen {} -alias IHTMLScreen LPHTMLSCREEN; +alias LPHTMLSCREEN = IHTMLScreen; interface IHTMLOptionElementFactory {} -alias IHTMLOptionElementFactory LPHTMLOPTIONELEMENTFACTORY; +alias LPHTMLOPTIONELEMENTFACTORY = IHTMLOptionElementFactory; interface IHTMLLinkElement : IDispatch { HRESULT put_href(BSTR); @@ -65,7 +65,7 @@ interface IHTMLLinkElement : IDispatch { HRESULT put_media(BSTR); HRESULT get_media(BSTR*); } -alias IHTMLLinkElement LPHTMLLINKELEMENT; +alias LPHTMLLINKELEMENT = IHTMLLinkElement; interface IHTMLImgElement : IDispatch { HRESULT put_isMap(VARIANT_BOOL); @@ -117,7 +117,7 @@ interface IHTMLImgElement : IDispatch { HRESULT put_start(BSTR); HRESULT get_start(BSTR*); } -alias IHTMLImgElement LPHTMLIMGELEMENT; +alias LPHTMLIMGELEMENT = IHTMLImgElement; interface IHTMLElementCollection : IDispatch { HRESULT toString(BSTR*); @@ -127,7 +127,7 @@ interface IHTMLElementCollection : IDispatch { HRESULT item(VARIANT,VARIANT,IDispatch* pDisp); HRESULT tags(VARIANT,IDispatch* pdisp); } -alias IHTMLElementCollection LPHTMLELEMENTCOLLECTION; +alias LPHTMLELEMENTCOLLECTION = IHTMLElementCollection; interface IHTMLDocument : IDispatch { HRESULT get_Script(IDispatch*); @@ -250,7 +250,7 @@ interface IHTMLSelectionObject : IDispatch { HRESULT clear(); HRESULT get_type(BSTR*); } -alias IHTMLSelectionObject LPHTMLSELECTIONOBJECT; +alias LPHTMLSELECTIONOBJECT = IHTMLSelectionObject; interface IHTMLTxtRange : IDispatch { HRESULT get_htmlText(BSTR*); @@ -374,7 +374,7 @@ interface IHTMLElement : IDispatch { HRESULT get_children(IDispatch*); HRESULT get_all(IDispatch*); } -alias IHTMLElement LPHTMLELEMENT; +alias LPHTMLELEMENT = IHTMLElement; interface IHTMLFramesCollection2 : IDispatch { HRESULT item(VARIANT*,VARIANT*); @@ -451,7 +451,7 @@ interface IHTMLWindow2 : IHTMLFramesCollection2 { HRESULT resizeBy(LONG,LONG); HRESULT get_external(IDispatch*); } -alias IHTMLWindow2 LPHTMLWINDOW2; +alias LPHTMLWINDOW2 = IHTMLWindow2; interface IHTMLFrameBase : IDispatch { HRESULT put_src(BSTR); diff --git a/runtime/druntime/src/core/sys/windows/mswsock.d b/runtime/druntime/src/core/sys/windows/mswsock.d index d8beee421a1..0cefbf40649 100644 --- a/runtime/druntime/src/core/sys/windows/mswsock.d +++ b/runtime/druntime/src/core/sys/windows/mswsock.d @@ -82,7 +82,7 @@ struct TRANSMIT_FILE_BUFFERS { PVOID Tail; DWORD TailLength; } -alias TRANSMIT_FILE_BUFFERS* PTRANSMIT_FILE_BUFFERS, LPTRANSMIT_FILE_BUFFERS; +alias PTRANSMIT_FILE_BUFFERS = TRANSMIT_FILE_BUFFERS*, LPTRANSMIT_FILE_BUFFERS = TRANSMIT_FILE_BUFFERS*; extern(Windows) { /* Win95+, WinNT3.51+ @@ -99,10 +99,10 @@ extern(Windows) { /* WinNT3.51+ ms-help://MS.MSDNQTR.2003FEB.1033/winsock/winsock/acceptex_2.htm */ - alias BOOL function(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED) LPFN_ACCEPTEX; + alias LPFN_ACCEPTEX = BOOL function(SOCKET, SOCKET, PVOID, DWORD, DWORD, DWORD, LPDWORD, LPOVERLAPPED); const GUID WSAID_ACCEPTEX = {0xb5367df1,0xcbac,0x11cf,[0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92]}; - alias BOOL function(SOCKET, SOCKADDR*, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED) LPFN_CONNECTEX; + alias LPFN_CONNECTEX = BOOL function(SOCKET, SOCKADDR*, int, PVOID, DWORD, LPDWORD, LPOVERLAPPED); const GUID WSAID_CONNECTEX = {0x25a207b9,0xddf3,0x4660,[0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e]}; } @@ -136,7 +136,7 @@ static if (_WIN32_WINNT >= 0x501) { CHAR* buf; } - alias WSABUF* LPWSABUF; + alias LPWSABUF = WSABUF*; /* WinXP+, Server2003+: * ms-help://MS.MSDNQTR.2003FEB.1033/winsock/winsock/wsamsg_2.htm @@ -150,7 +150,7 @@ static if (_WIN32_WINNT >= 0x501) { DWORD dwFlags; } - alias WSAMSG* PWSAMSG, LPWSAMSG; + alias PWSAMSG = WSAMSG*, LPWSAMSG = WSAMSG*; /* According to MSDN docs, the WSAMSG.Control buffer starts with a cmsghdr header of the following form. See also RFC 2292. */ diff --git a/runtime/druntime/src/core/sys/windows/nb30.d b/runtime/druntime/src/core/sys/windows/nb30.d index cfa57d609e3..746bf0cfe29 100644 --- a/runtime/druntime/src/core/sys/windows/nb30.d +++ b/runtime/druntime/src/core/sys/windows/nb30.d @@ -125,7 +125,7 @@ struct ACTION_HEADER { USHORT action_code; USHORT reserved; } -alias ACTION_HEADER* PACTION_HEADER; +alias PACTION_HEADER = ACTION_HEADER*; struct ADAPTER_STATUS { UCHAR[6] adapter_address; @@ -156,7 +156,7 @@ struct ADAPTER_STATUS { WORD max_sess_pkt_size; WORD name_count; } -alias ADAPTER_STATUS* PADAPTER_STATUS; +alias PADAPTER_STATUS = ADAPTER_STATUS*; struct FIND_NAME_BUFFER { /* From Win32 API docs @@ -175,27 +175,27 @@ struct FIND_NAME_BUFFER { UCHAR[6] source_addr; UCHAR[18] routing_info; } -alias FIND_NAME_BUFFER* PFIND_NAME_BUFFER; +alias PFIND_NAME_BUFFER = FIND_NAME_BUFFER*; struct FIND_NAME_HEADER { WORD node_count; UCHAR reserved; UCHAR unique_group; } -alias FIND_NAME_HEADER* PFIND_NAME_HEADER; +alias PFIND_NAME_HEADER = FIND_NAME_HEADER*; struct LANA_ENUM { UCHAR length; UCHAR[MAX_LANA+1] lana; } -alias LANA_ENUM* PLANA_ENUM; +alias PLANA_ENUM = LANA_ENUM*; struct NAME_BUFFER { UCHAR[NCBNAMSZ] name; UCHAR name_num; UCHAR name_flags; } -alias NAME_BUFFER* PNAME_BUFFER; +alias PNAME_BUFFER = NAME_BUFFER*; struct NCB { UCHAR ncb_command; @@ -217,7 +217,7 @@ struct NCB { UCHAR[10] ncb_reserve; HANDLE ncb_event; } -alias NCB* PNCB; +alias PNCB = NCB*; struct SESSION_BUFFER { UCHAR lsn; @@ -227,7 +227,7 @@ struct SESSION_BUFFER { UCHAR rcvs_outstanding; UCHAR sends_outstanding; } -alias SESSION_BUFFER* PSESSION_BUFFER; +alias PSESSION_BUFFER = SESSION_BUFFER*; struct SESSION_HEADER { UCHAR sess_name; @@ -235,6 +235,6 @@ struct SESSION_HEADER { UCHAR rcv_dg_outstanding; UCHAR rcv_any_outstanding; } -alias SESSION_HEADER* PSESSION_HEADER; +alias PSESSION_HEADER = SESSION_HEADER*; extern (Windows) UCHAR Netbios(PNCB); diff --git a/runtime/druntime/src/core/sys/windows/nddeapi.d b/runtime/druntime/src/core/sys/windows/nddeapi.d index 3efca620e17..80d8fc7b9c8 100644 --- a/runtime/druntime/src/core/sys/windows/nddeapi.d +++ b/runtime/druntime/src/core/sys/windows/nddeapi.d @@ -134,31 +134,31 @@ extern (Windows) { } version (Unicode) { - alias NDdeShareAddW NDdeShareAdd; - alias NDdeShareDelW NDdeShareDel; - alias NDdeSetShareSecurityW NDdeSetShareSecurity; - alias NDdeGetShareSecurityW NDdeGetShareSecurity; - alias NDdeShareEnumW NDdeShareEnum; - alias NDdeShareGetInfoW NDdeShareGetInfo; - alias NDdeShareSetInfoW NDdeShareSetInfo; - alias NDdeGetErrorStringW NDdeGetErrorString; - alias NDdeIsValidShareNameW NDdeIsValidShareName; - alias NDdeIsValidAppTopicListW NDdeIsValidAppTopicList; - alias NDdeSetTrustedShareW NDdeSetTrustedShare; - alias NDdeGetTrustedShareW NDdeGetTrustedShare; - alias NDdeTrustedShareEnumW NDdeTrustedShareEnum; + alias NDdeShareAdd = NDdeShareAddW; + alias NDdeShareDel = NDdeShareDelW; + alias NDdeSetShareSecurity = NDdeSetShareSecurityW; + alias NDdeGetShareSecurity = NDdeGetShareSecurityW; + alias NDdeShareEnum = NDdeShareEnumW; + alias NDdeShareGetInfo = NDdeShareGetInfoW; + alias NDdeShareSetInfo = NDdeShareSetInfoW; + alias NDdeGetErrorString = NDdeGetErrorStringW; + alias NDdeIsValidShareName = NDdeIsValidShareNameW; + alias NDdeIsValidAppTopicList = NDdeIsValidAppTopicListW; + alias NDdeSetTrustedShare = NDdeSetTrustedShareW; + alias NDdeGetTrustedShare = NDdeGetTrustedShareW; + alias NDdeTrustedShareEnum = NDdeTrustedShareEnumW; } else { - alias NDdeShareAddA NDdeShareAdd; - alias NDdeShareDelA NDdeShareDel; - alias NDdeSetShareSecurityA NDdeSetShareSecurity; - alias NDdeGetShareSecurityA NDdeGetShareSecurity; - alias NDdeShareEnumA NDdeShareEnum; - alias NDdeShareGetInfoA NDdeShareGetInfo; - alias NDdeShareSetInfoA NDdeShareSetInfo; - alias NDdeGetErrorStringA NDdeGetErrorString; - alias NDdeIsValidShareNameA NDdeIsValidShareName; - alias NDdeIsValidAppTopicListA NDdeIsValidAppTopicList; - alias NDdeSetTrustedShareA NDdeSetTrustedShare; - alias NDdeGetTrustedShareA NDdeGetTrustedShare; - alias NDdeTrustedShareEnumA NDdeTrustedShareEnum; + alias NDdeShareAdd = NDdeShareAddA; + alias NDdeShareDel = NDdeShareDelA; + alias NDdeSetShareSecurity = NDdeSetShareSecurityA; + alias NDdeGetShareSecurity = NDdeGetShareSecurityA; + alias NDdeShareEnum = NDdeShareEnumA; + alias NDdeShareGetInfo = NDdeShareGetInfoA; + alias NDdeShareSetInfo = NDdeShareSetInfoA; + alias NDdeGetErrorString = NDdeGetErrorStringA; + alias NDdeIsValidShareName = NDdeIsValidShareNameA; + alias NDdeIsValidAppTopicList = NDdeIsValidAppTopicListA; + alias NDdeSetTrustedShare = NDdeSetTrustedShareA; + alias NDdeGetTrustedShare = NDdeGetTrustedShareA; + alias NDdeTrustedShareEnum = NDdeTrustedShareEnumA; } diff --git a/runtime/druntime/src/core/sys/windows/nspapi.d b/runtime/druntime/src/core/sys/windows/nspapi.d index bac6526849d..62537533811 100644 --- a/runtime/druntime/src/core/sys/windows/nspapi.d +++ b/runtime/druntime/src/core/sys/windows/nspapi.d @@ -55,7 +55,7 @@ struct SOCKET_ADDRESS { LPSOCKADDR lpSockaddr; INT iSockaddrLength; } -alias SOCKET_ADDRESS* PSOCKET_ADDRESS, LPSOCKET_ADDRESS; +alias PSOCKET_ADDRESS = SOCKET_ADDRESS*, LPSOCKET_ADDRESS = SOCKET_ADDRESS*; struct CSADDR_INFO { SOCKET_ADDRESS LocalAddr; @@ -63,13 +63,13 @@ struct CSADDR_INFO { INT iSocketType; INT iProtocol; } -alias CSADDR_INFO* PCSADDR_INFO, LPCSADDR_INFO; +alias PCSADDR_INFO = CSADDR_INFO*, LPCSADDR_INFO = CSADDR_INFO*; struct BLOB { ULONG cbSize; BYTE* pBlobData; } -alias BLOB* PBLOB, LPBLOB; +alias PBLOB = BLOB*, LPBLOB = BLOB*; struct SERVICE_ADDRESS { DWORD dwAddressType; @@ -86,7 +86,7 @@ struct SERVICE_ADDRESSES { SERVICE_ADDRESS* Addresses() return { return &_Addresses; } } -alias SERVICE_ADDRESSES* PSERVICE_ADDRESSES, LPSERVICE_ADDRESSES; +alias PSERVICE_ADDRESSES = SERVICE_ADDRESSES*, LPSERVICE_ADDRESSES = SERVICE_ADDRESSES*; struct SERVICE_INFOA { LPGUID lpServiceType; @@ -100,7 +100,7 @@ struct SERVICE_INFOA { LPSERVICE_ADDRESSES lpServiceAddress; BLOB ServiceSpecificInfo; } -alias SERVICE_INFOA* LPSERVICE_INFOA; +alias LPSERVICE_INFOA = SERVICE_INFOA*; struct SERVICE_INFOW { LPGUID lpServiceType; @@ -114,9 +114,9 @@ struct SERVICE_INFOW { LPSERVICE_ADDRESSES lpServiceAddress; BLOB ServiceSpecificInfo; } -alias SERVICE_INFOW* LPSERVICE_INFOW; +alias LPSERVICE_INFOW = SERVICE_INFOW*; -alias void* LPSERVICE_ASYNC_INFO; +alias LPSERVICE_ASYNC_INFO = void*; extern (Windows) { INT SetServiceA(DWORD, DWORD, DWORD, LPSERVICE_INFOA, @@ -130,14 +130,14 @@ extern (Windows) { } version (Unicode) { - alias SERVICE_INFOW SERVICE_INFO; - alias SetServiceW SetService; - alias GetAddressByNameW GetAddressByName; + alias SERVICE_INFO = SERVICE_INFOW; + alias SetService = SetServiceW; + alias GetAddressByName = GetAddressByNameW; } else { - alias SERVICE_INFOA SERVICE_INFO; - alias SetServiceA SetService; - alias GetAddressByNameA GetAddressByName; + alias SERVICE_INFO = SERVICE_INFOA; + alias SetService = SetServiceA; + alias GetAddressByName = GetAddressByNameA; } -alias SERVICE_INFO _SERVICE_INFO; -alias SERVICE_INFO* LPSERVICE_INFO; +alias _SERVICE_INFO = SERVICE_INFO; +alias LPSERVICE_INFO = SERVICE_INFO*; diff --git a/runtime/druntime/src/core/sys/windows/ntdef.d b/runtime/druntime/src/core/sys/windows/ntdef.d index e45d0effcd9..e5da02295a6 100644 --- a/runtime/druntime/src/core/sys/windows/ntdef.d +++ b/runtime/druntime/src/core/sys/windows/ntdef.d @@ -44,27 +44,27 @@ pragma(inline, true) @safe pure nothrow @nogc { * type aliases are defined in ntdef.h, ntsecapi.h and subauth.h, each of * which checks that none of the others is already included. */ -alias int NTSTATUS; -alias int* PNTSTATUS; +alias NTSTATUS = int; +alias PNTSTATUS = int*; struct UNICODE_STRING { USHORT Length; USHORT MaximumLength; PWSTR Buffer; } -alias UNICODE_STRING* PUNICODE_STRING; -alias const(UNICODE_STRING)* PCUNICODE_STRING; +alias PUNICODE_STRING = UNICODE_STRING*; +alias PCUNICODE_STRING = const(UNICODE_STRING)*; struct STRING { USHORT Length; USHORT MaximumLength; PCHAR Buffer; } -alias STRING ANSI_STRING, OEM_STRING; -alias STRING* PSTRING, PANSI_STRING, POEM_STRING; +alias ANSI_STRING = STRING, OEM_STRING = STRING; +alias PSTRING = STRING*, PANSI_STRING = STRING*, POEM_STRING = STRING*; -alias LARGE_INTEGER PHYSICAL_ADDRESS; -alias LARGE_INTEGER* PPHYSICAL_ADDRESS; +alias PHYSICAL_ADDRESS = LARGE_INTEGER; +alias PPHYSICAL_ADDRESS = LARGE_INTEGER*; enum SECTION_INHERIT { ViewShare = 1, @@ -82,4 +82,4 @@ struct OBJECT_ATTRIBUTES { PVOID SecurityDescriptor; PVOID SecurityQualityOfService; } -alias OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTES; +alias POBJECT_ATTRIBUTES = OBJECT_ATTRIBUTES*; diff --git a/runtime/druntime/src/core/sys/windows/ntsecapi.d b/runtime/druntime/src/core/sys/windows/ntsecapi.d index 7088cb10202..8dd430a9689 100644 --- a/runtime/druntime/src/core/sys/windows/ntsecapi.d +++ b/runtime/druntime/src/core/sys/windows/ntsecapi.d @@ -182,10 +182,10 @@ enum { TRUST_TYPE_DCE } -alias UNICODE_STRING LSA_UNICODE_STRING; -alias UNICODE_STRING* PLSA_UNICODE_STRING; -alias STRING LSA_STRING; -alias STRING* PLSA_STRING; +alias LSA_UNICODE_STRING = UNICODE_STRING; +alias PLSA_UNICODE_STRING = UNICODE_STRING*; +alias LSA_STRING = STRING; +alias PLSA_STRING = STRING*; enum MSV1_0_LOGON_SUBMIT_TYPE { MsV1_0InteractiveLogon = 2, @@ -194,14 +194,14 @@ enum MSV1_0_LOGON_SUBMIT_TYPE { MsV1_0SubAuthLogon, MsV1_0WorkstationUnlockLogon = 7 } -alias MSV1_0_LOGON_SUBMIT_TYPE* PMSV1_0_LOGON_SUBMIT_TYPE; +alias PMSV1_0_LOGON_SUBMIT_TYPE = MSV1_0_LOGON_SUBMIT_TYPE*; enum MSV1_0_PROFILE_BUFFER_TYPE { MsV1_0InteractiveProfile = 2, MsV1_0Lm20LogonProfile, MsV1_0SmartCardProfile } -alias MSV1_0_PROFILE_BUFFER_TYPE* PMSV1_0_PROFILE_BUFFER_TYPE; +alias PMSV1_0_PROFILE_BUFFER_TYPE = MSV1_0_PROFILE_BUFFER_TYPE*; enum MSV1_0_AVID { @@ -226,19 +226,19 @@ enum MSV1_0_PROTOCOL_MESSAGE_TYPE { MsV1_0DeriveCredential, MsV1_0CacheLookup } -alias MSV1_0_PROTOCOL_MESSAGE_TYPE* PMSV1_0_PROTOCOL_MESSAGE_TYPE; +alias PMSV1_0_PROTOCOL_MESSAGE_TYPE = MSV1_0_PROTOCOL_MESSAGE_TYPE*; enum POLICY_LSA_SERVER_ROLE { PolicyServerRoleBackup = 2, PolicyServerRolePrimary } -alias POLICY_LSA_SERVER_ROLE* PPOLICY_LSA_SERVER_ROLE; +alias PPOLICY_LSA_SERVER_ROLE = POLICY_LSA_SERVER_ROLE*; enum POLICY_SERVER_ENABLE_STATE { PolicyServerEnabled = 2, PolicyServerDisabled } -alias POLICY_SERVER_ENABLE_STATE* PPOLICY_SERVER_ENABLE_STATE; +alias PPOLICY_SERVER_ENABLE_STATE = POLICY_SERVER_ENABLE_STATE*; enum POLICY_INFORMATION_CLASS { PolicyAuditLogInformation = 1, @@ -255,7 +255,7 @@ enum POLICY_INFORMATION_CLASS { PolicyDnsDomainInformation, PolicyEfsInformation } -alias POLICY_INFORMATION_CLASS* PPOLICY_INFORMATION_CLASS; +alias PPOLICY_INFORMATION_CLASS = POLICY_INFORMATION_CLASS*; enum POLICY_AUDIT_EVENT_TYPE { AuditCategorySystem, @@ -268,7 +268,7 @@ enum POLICY_AUDIT_EVENT_TYPE { AuditCategoryDirectoryServiceAccess, AuditCategoryAccountLogon } -alias POLICY_AUDIT_EVENT_TYPE* PPOLICY_AUDIT_EVENT_TYPE; +alias PPOLICY_AUDIT_EVENT_TYPE = POLICY_AUDIT_EVENT_TYPE*; enum POLICY_LOCAL_INFORMATION_CLASS { PolicyLocalAuditEventsInformation = 1, @@ -285,7 +285,7 @@ enum POLICY_LOCAL_INFORMATION_CLASS { PolicyLocalQualityOfServiceInformation, PolicyLocalPolicyLocationInformation } -alias POLICY_LOCAL_INFORMATION_CLASS* PPOLICY_LOCAL_INFORMATION_CLASS; +alias PPOLICY_LOCAL_INFORMATION_CLASS = POLICY_LOCAL_INFORMATION_CLASS*; enum POLICY_DOMAIN_INFORMATION_CLASS { PolicyDomainIPSecReferenceInformation = 1, @@ -296,7 +296,7 @@ enum POLICY_DOMAIN_INFORMATION_CLASS { PolicyDomainLockoutInformation, PolicyDomainKerberosTicketInformation } -alias POLICY_DOMAIN_INFORMATION_CLASS* PPOLICY_DOMAIN_INFORMATION_CLASS; +alias PPOLICY_DOMAIN_INFORMATION_CLASS = POLICY_DOMAIN_INFORMATION_CLASS*; enum SECURITY_LOGON_TYPE { Interactive = 2, @@ -306,7 +306,7 @@ enum SECURITY_LOGON_TYPE { Proxy, Unlock } -alias SECURITY_LOGON_TYPE* PSECURITY_LOGON_TYPE; +alias PSECURITY_LOGON_TYPE = SECURITY_LOGON_TYPE*; enum TRUSTED_INFORMATION_CLASS { TrustedDomainNameInformation = 1, @@ -318,7 +318,7 @@ enum TRUSTED_INFORMATION_CLASS { TrustedDomainAuthInformation, TrustedDomainFullInformation } -alias TRUSTED_INFORMATION_CLASS* PTRUSTED_INFORMATION_CLASS; +alias PTRUSTED_INFORMATION_CLASS = TRUSTED_INFORMATION_CLASS*; struct DOMAIN_PASSWORD_INFORMATION { USHORT MinPasswordLength; @@ -327,47 +327,47 @@ struct DOMAIN_PASSWORD_INFORMATION { LARGE_INTEGER MaxPasswordAge; LARGE_INTEGER MinPasswordAge; } -alias DOMAIN_PASSWORD_INFORMATION* PDOMAIN_PASSWORD_INFORMATION; +alias PDOMAIN_PASSWORD_INFORMATION = DOMAIN_PASSWORD_INFORMATION*; struct LSA_ENUMERATION_INFORMATION { PSID Sid; } -alias LSA_ENUMERATION_INFORMATION* PLSA_ENUMERATION_INFORMATION; +alias PLSA_ENUMERATION_INFORMATION = LSA_ENUMERATION_INFORMATION*; -alias OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES; -alias OBJECT_ATTRIBUTES* PLSA_OBJECT_ATTRIBUTES; +alias LSA_OBJECT_ATTRIBUTES = OBJECT_ATTRIBUTES; +alias PLSA_OBJECT_ATTRIBUTES = OBJECT_ATTRIBUTES*; struct LSA_TRUST_INFORMATION { LSA_UNICODE_STRING Name; PSID Sid; } -alias LSA_TRUST_INFORMATION TRUSTED_DOMAIN_INFORMATION_BASIC; -alias LSA_TRUST_INFORMATION* PLSA_TRUST_INFORMATION; +alias TRUSTED_DOMAIN_INFORMATION_BASIC = LSA_TRUST_INFORMATION; +alias PLSA_TRUST_INFORMATION = LSA_TRUST_INFORMATION*; /* in MinGW (further down the code): * typedef PLSA_TRUST_INFORMATION *PTRUSTED_DOMAIN_INFORMATION_BASIC; * but it doesn't look right.... */ -alias LSA_TRUST_INFORMATION** PTRUSTED_DOMAIN_INFORMATION_BASIC; +alias PTRUSTED_DOMAIN_INFORMATION_BASIC = LSA_TRUST_INFORMATION**; struct LSA_REFERENCED_DOMAIN_LIST { ULONG Entries; PLSA_TRUST_INFORMATION Domains; } -alias LSA_REFERENCED_DOMAIN_LIST* PLSA_REFERENCED_DOMAIN_LIST; +alias PLSA_REFERENCED_DOMAIN_LIST = LSA_REFERENCED_DOMAIN_LIST*; struct LSA_TRANSLATED_SID { SID_NAME_USE Use; ULONG RelativeId; LONG DomainIndex; } -alias LSA_TRANSLATED_SID* PLSA_TRANSLATED_SID; +alias PLSA_TRANSLATED_SID = LSA_TRANSLATED_SID*; struct LSA_TRANSLATED_NAME { SID_NAME_USE Use; LSA_UNICODE_STRING Name; LONG DomainIndex; } -alias LSA_TRANSLATED_NAME* PLSA_TRANSLATED_NAME; +alias PLSA_TRANSLATED_NAME = LSA_TRANSLATED_NAME*; struct MSV1_0_INTERACTIVE_LOGON { MSV1_0_LOGON_SUBMIT_TYPE MessageType; @@ -375,7 +375,7 @@ struct MSV1_0_INTERACTIVE_LOGON { UNICODE_STRING UserName; UNICODE_STRING Password; } -alias MSV1_0_INTERACTIVE_LOGON* PMSV1_0_INTERACTIVE_LOGON; +alias PMSV1_0_INTERACTIVE_LOGON = MSV1_0_INTERACTIVE_LOGON*; struct MSV1_0_INTERACTIVE_PROFILE { MSV1_0_PROFILE_BUFFER_TYPE MessageType; @@ -395,7 +395,7 @@ struct MSV1_0_INTERACTIVE_PROFILE { UNICODE_STRING LogonServer; ULONG UserFlags; } -alias MSV1_0_INTERACTIVE_PROFILE* PMSV1_0_INTERACTIVE_PROFILE; +alias PMSV1_0_INTERACTIVE_PROFILE = MSV1_0_INTERACTIVE_PROFILE*; struct MSV1_0_LM20_LOGON { MSV1_0_LOGON_SUBMIT_TYPE MessageType; @@ -407,7 +407,7 @@ struct MSV1_0_LM20_LOGON { STRING CaseInsensitiveChallengeResponse; ULONG ParameterControl; } -alias MSV1_0_LM20_LOGON* PMSV1_0_LM20_LOGON; +alias PMSV1_0_LM20_LOGON = MSV1_0_LM20_LOGON*; //static if (_WIN32_WINNT >= 0x500) { struct MSV1_0_SUBAUTH_LOGON { @@ -421,7 +421,7 @@ alias MSV1_0_LM20_LOGON* PMSV1_0_LM20_LOGON; ULONG ParameterControl; ULONG SubAuthPackageId; } - alias MSV1_0_SUBAUTH_LOGON* PMSV1_0_SUBAUTH_LOGON; + alias PMSV1_0_SUBAUTH_LOGON = MSV1_0_SUBAUTH_LOGON*; //} struct MSV1_0_LM20_LOGON_PROFILE { @@ -435,7 +435,7 @@ struct MSV1_0_LM20_LOGON_PROFILE { UNICODE_STRING LogonServer; UNICODE_STRING UserParameters; } -alias MSV1_0_LM20_LOGON_PROFILE* PMSV1_0_LM20_LOGON_PROFILE; +alias PMSV1_0_LM20_LOGON_PROFILE = MSV1_0_LM20_LOGON_PROFILE*; struct MSV1_0_SUPPLEMENTAL_CREDENTIAL { ULONG Version; @@ -443,7 +443,7 @@ struct MSV1_0_SUPPLEMENTAL_CREDENTIAL { UCHAR[MSV1_0_OWF_PASSWORD_LENGTH] LmPassword; UCHAR[MSV1_0_OWF_PASSWORD_LENGTH] NtPassword; } -alias MSV1_0_SUPPLEMENTAL_CREDENTIAL* PMSV1_0_SUPPLEMENTAL_CREDENTIAL; +alias PMSV1_0_SUPPLEMENTAL_CREDENTIAL = MSV1_0_SUPPLEMENTAL_CREDENTIAL*; struct MSV1_0_NTLM3_RESPONSE { UCHAR[MSV1_0_NTLM3_RESPONSE_LENGTH] Response; @@ -457,13 +457,13 @@ struct MSV1_0_NTLM3_RESPONSE { UCHAR _Buffer; UCHAR* Buffer() return { return &_Buffer; } } -alias MSV1_0_NTLM3_RESPONSE* PMSV1_0_NTLM3_RESPONSE; +alias PMSV1_0_NTLM3_RESPONSE = MSV1_0_NTLM3_RESPONSE*; struct MSV1_0_AV_PAIR { USHORT AvId; USHORT AvLen; } -alias MSV1_0_AV_PAIR* PMSV1_0_AV_PAIR; +alias PMSV1_0_AV_PAIR = MSV1_0_AV_PAIR*; struct MSV1_0_CHANGEPASSWORD_REQUEST { MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; @@ -473,14 +473,14 @@ struct MSV1_0_CHANGEPASSWORD_REQUEST { UNICODE_STRING NewPassword; BOOLEAN Impersonating; } -alias MSV1_0_CHANGEPASSWORD_REQUEST* PMSV1_0_CHANGEPASSWORD_REQUEST; +alias PMSV1_0_CHANGEPASSWORD_REQUEST = MSV1_0_CHANGEPASSWORD_REQUEST*; struct MSV1_0_CHANGEPASSWORD_RESPONSE { MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; BOOLEAN PasswordInfoValid; DOMAIN_PASSWORD_INFORMATION DomainPasswordInfo; } -alias MSV1_0_CHANGEPASSWORD_RESPONSE* PMSV1_0_CHANGEPASSWORD_RESPONSE; +alias PMSV1_0_CHANGEPASSWORD_RESPONSE = MSV1_0_CHANGEPASSWORD_RESPONSE*; struct MSV1_0_SUBAUTH_REQUEST { MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; @@ -488,14 +488,14 @@ struct MSV1_0_SUBAUTH_REQUEST { ULONG SubAuthInfoLength; PUCHAR SubAuthSubmitBuffer; } -alias MSV1_0_SUBAUTH_REQUEST* PMSV1_0_SUBAUTH_REQUEST; +alias PMSV1_0_SUBAUTH_REQUEST = MSV1_0_SUBAUTH_REQUEST*; struct MSV1_0_SUBAUTH_RESPONSE { MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; ULONG SubAuthInfoLength; PUCHAR SubAuthReturnBuffer; } -alias MSV1_0_SUBAUTH_RESPONSE* PMSV1_0_SUBAUTH_RESPONSE; +alias PMSV1_0_SUBAUTH_RESPONSE = MSV1_0_SUBAUTH_RESPONSE*; enum MSV1_0_DERIVECRED_TYPE_SHA1 = 0; @@ -507,7 +507,7 @@ struct MSV1_0_DERIVECRED_REQUEST { UCHAR _DeriveCredSubmitBuffer; UCHAR* DeriveCredSubmitBuffer() return { return &_DeriveCredSubmitBuffer; } } -alias MSV1_0_DERIVECRED_REQUEST* PMSV1_0_DERIVECRED_REQUEST; +alias PMSV1_0_DERIVECRED_REQUEST = MSV1_0_DERIVECRED_REQUEST*; struct MSV1_0_DERIVECRED_RESPONSE { MSV1_0_PROTOCOL_MESSAGE_TYPE MessageType; @@ -515,18 +515,16 @@ struct MSV1_0_DERIVECRED_RESPONSE { UCHAR _DeriveCredReturnBuffer; UCHAR* DeriveCredReturnBuffer() return { return &_DeriveCredReturnBuffer; } } -alias MSV1_0_DERIVECRED_RESPONSE* PMSV1_0_DERIVECRED_RESPONSE; +alias PMSV1_0_DERIVECRED_RESPONSE = MSV1_0_DERIVECRED_RESPONSE*; -alias uint LSA_ENUMERATION_HANDLE, LSA_OPERATIONAL_MODE, - POLICY_AUDIT_EVENT_OPTIONS; -alias uint* PLSA_ENUMERATION_HANDLE, PLSA_OPERATIONAL_MODE, - PPOLICY_AUDIT_EVENT_OPTIONS; +alias LSA_ENUMERATION_HANDLE = uint, LSA_OPERATIONAL_MODE = uint, POLICY_AUDIT_EVENT_OPTIONS = uint; +alias PLSA_ENUMERATION_HANDLE = uint*, PLSA_OPERATIONAL_MODE = uint*, PPOLICY_AUDIT_EVENT_OPTIONS = uint*; struct POLICY_PRIVILEGE_DEFINITION { LSA_UNICODE_STRING Name; LUID LocalValue; } -alias POLICY_PRIVILEGE_DEFINITION* PPOLICY_PRIVILEGE_DEFINITION; +alias PPOLICY_PRIVILEGE_DEFINITION = POLICY_PRIVILEGE_DEFINITION*; struct POLICY_AUDIT_LOG_INFO { ULONG AuditLogPercentFull; @@ -536,26 +534,26 @@ struct POLICY_AUDIT_LOG_INFO { LARGE_INTEGER TimeToShutdown; ULONG NextAuditRecordId; } -alias POLICY_AUDIT_LOG_INFO* PPOLICY_AUDIT_LOG_INFO; +alias PPOLICY_AUDIT_LOG_INFO = POLICY_AUDIT_LOG_INFO*; struct POLICY_AUDIT_EVENTS_INFO { BOOLEAN AuditingMode; PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions; ULONG MaximumAuditEventCount; } -alias POLICY_AUDIT_EVENTS_INFO* PPOLICY_AUDIT_EVENTS_INFO; +alias PPOLICY_AUDIT_EVENTS_INFO = POLICY_AUDIT_EVENTS_INFO*; struct POLICY_ACCOUNT_DOMAIN_INFO { LSA_UNICODE_STRING DomainName; PSID DomainSid; } -alias POLICY_ACCOUNT_DOMAIN_INFO* PPOLICY_ACCOUNT_DOMAIN_INFO; +alias PPOLICY_ACCOUNT_DOMAIN_INFO = POLICY_ACCOUNT_DOMAIN_INFO*; struct POLICY_PRIMARY_DOMAIN_INFO { LSA_UNICODE_STRING Name; PSID Sid; } -alias POLICY_PRIMARY_DOMAIN_INFO* PPOLICY_PRIMARY_DOMAIN_INFO; +alias PPOLICY_PRIMARY_DOMAIN_INFO = POLICY_PRIMARY_DOMAIN_INFO*; struct POLICY_DNS_DOMAIN_INFO { LSA_UNICODE_STRING Name; @@ -564,88 +562,85 @@ struct POLICY_DNS_DOMAIN_INFO { GUID DomainGuid; PSID Sid; } -alias POLICY_DNS_DOMAIN_INFO* PPOLICY_DNS_DOMAIN_INFO; +alias PPOLICY_DNS_DOMAIN_INFO = POLICY_DNS_DOMAIN_INFO*; struct POLICY_PD_ACCOUNT_INFO { LSA_UNICODE_STRING Name; } -alias POLICY_PD_ACCOUNT_INFO* PPOLICY_PD_ACCOUNT_INFO; +alias PPOLICY_PD_ACCOUNT_INFO = POLICY_PD_ACCOUNT_INFO*; struct POLICY_LSA_SERVER_ROLE_INFO { POLICY_LSA_SERVER_ROLE LsaServerRole; } -alias POLICY_LSA_SERVER_ROLE_INFO* PPOLICY_LSA_SERVER_ROLE_INFO; +alias PPOLICY_LSA_SERVER_ROLE_INFO = POLICY_LSA_SERVER_ROLE_INFO*; struct POLICY_REPLICA_SOURCE_INFO { LSA_UNICODE_STRING ReplicaSource; LSA_UNICODE_STRING ReplicaAccountName; } -alias POLICY_REPLICA_SOURCE_INFO* PPOLICY_REPLICA_SOURCE_INFO; +alias PPOLICY_REPLICA_SOURCE_INFO = POLICY_REPLICA_SOURCE_INFO*; struct POLICY_DEFAULT_QUOTA_INFO { QUOTA_LIMITS QuotaLimits; } -alias POLICY_DEFAULT_QUOTA_INFO* PPOLICY_DEFAULT_QUOTA_INFO; +alias PPOLICY_DEFAULT_QUOTA_INFO = POLICY_DEFAULT_QUOTA_INFO*; struct POLICY_MODIFICATION_INFO { LARGE_INTEGER ModifiedId; LARGE_INTEGER DatabaseCreationTime; } -alias POLICY_MODIFICATION_INFO* PPOLICY_MODIFICATION_INFO; +alias PPOLICY_MODIFICATION_INFO = POLICY_MODIFICATION_INFO*; struct POLICY_AUDIT_FULL_SET_INFO { BOOLEAN ShutDownOnFull; } -alias POLICY_AUDIT_FULL_SET_INFO* PPOLICY_AUDIT_FULL_SET_INFO; +alias PPOLICY_AUDIT_FULL_SET_INFO = POLICY_AUDIT_FULL_SET_INFO*; struct POLICY_AUDIT_FULL_QUERY_INFO { BOOLEAN ShutDownOnFull; BOOLEAN LogIsFull; } -alias POLICY_AUDIT_FULL_QUERY_INFO* PPOLICY_AUDIT_FULL_QUERY_INFO; +alias PPOLICY_AUDIT_FULL_QUERY_INFO = POLICY_AUDIT_FULL_QUERY_INFO*; struct POLICY_EFS_INFO { ULONG InfoLength; PUCHAR EfsBlob; } -alias POLICY_EFS_INFO* PPOLICY_EFS_INFO; +alias PPOLICY_EFS_INFO = POLICY_EFS_INFO*; struct POLICY_LOCAL_IPSEC_REFERENCE_INFO { LSA_UNICODE_STRING ObjectPath; } -alias POLICY_LOCAL_IPSEC_REFERENCE_INFO* PPOLICY_LOCAL_IPSEC_REFERENCE_INFO; +alias PPOLICY_LOCAL_IPSEC_REFERENCE_INFO = POLICY_LOCAL_IPSEC_REFERENCE_INFO*; struct POLICY_LOCAL_MACHINE_PASSWORD_INFO { LARGE_INTEGER PasswordChangeInterval; } -alias POLICY_LOCAL_MACHINE_PASSWORD_INFO* PPOLICY_LOCAL_MACHINE_PASSWORD_INFO; +alias PPOLICY_LOCAL_MACHINE_PASSWORD_INFO = POLICY_LOCAL_MACHINE_PASSWORD_INFO*; struct POLICY_LOCAL_POLICY_LOCATION_INFO { ULONG PolicyLocation; } -alias POLICY_LOCAL_POLICY_LOCATION_INFO* PPOLICY_LOCAL_POLICY_LOCATION_INFO; +alias PPOLICY_LOCAL_POLICY_LOCATION_INFO = POLICY_LOCAL_POLICY_LOCATION_INFO*; struct POLICY_LOCAL_QUALITY_OF_SERVICE_INFO{ ULONG QualityOfService; } -alias POLICY_LOCAL_QUALITY_OF_SERVICE_INFO - POLICY_DOMAIN_QUALITY_OF_SERVICE_INFO; -alias POLICY_LOCAL_QUALITY_OF_SERVICE_INFO* - PPOLICY_LOCAL_QUALITY_OF_SERVICE_INFO, - PPOLICY_DOMAIN_QUALITY_OF_SERVICE_INFO; +alias POLICY_DOMAIN_QUALITY_OF_SERVICE_INFO = POLICY_LOCAL_QUALITY_OF_SERVICE_INFO; +alias PPOLICY_LOCAL_QUALITY_OF_SERVICE_INFO = POLICY_LOCAL_QUALITY_OF_SERVICE_INFO*, PPOLICY_DOMAIN_QUALITY_OF_SERVICE_INFO = POLICY_LOCAL_QUALITY_OF_SERVICE_INFO*; struct POLICY_DOMAIN_PUBLIC_KEY_INFO { ULONG InfoLength; PUCHAR PublicKeyInfo; } -alias POLICY_DOMAIN_PUBLIC_KEY_INFO* PPOLICY_DOMAIN_PUBLIC_KEY_INFO; +alias PPOLICY_DOMAIN_PUBLIC_KEY_INFO = POLICY_DOMAIN_PUBLIC_KEY_INFO*; struct POLICY_DOMAIN_LOCKOUT_INFO { LARGE_INTEGER LockoutDuration; LARGE_INTEGER LockoutObservationWindow; USHORT LockoutThreshold; } -alias POLICY_DOMAIN_LOCKOUT_INFO* PPOLICY_DOMAIN_LOCKOUT_INFO; +alias PPOLICY_DOMAIN_LOCKOUT_INFO = POLICY_DOMAIN_LOCKOUT_INFO*; struct POLICY_DOMAIN_PASSWORD_INFO { USHORT MinPasswordLength; @@ -654,7 +649,7 @@ struct POLICY_DOMAIN_PASSWORD_INFO { LARGE_INTEGER MaxPasswordAge; LARGE_INTEGER MinPasswordAge; } -alias POLICY_DOMAIN_PASSWORD_INFO* PPOLICY_DOMAIN_PASSWORD_INFO; +alias PPOLICY_DOMAIN_PASSWORD_INFO = POLICY_DOMAIN_PASSWORD_INFO*; struct POLICY_DOMAIN_KERBEROS_TICKET_INFO { ULONG AuthenticationOptions; @@ -664,32 +659,32 @@ struct POLICY_DOMAIN_KERBEROS_TICKET_INFO { LARGE_INTEGER ProxyLifetime; LARGE_INTEGER ForceLogoff; } -alias POLICY_DOMAIN_KERBEROS_TICKET_INFO* PPOLICY_DOMAIN_KERBEROS_TICKET_INFO; +alias PPOLICY_DOMAIN_KERBEROS_TICKET_INFO = POLICY_DOMAIN_KERBEROS_TICKET_INFO*; alias LSA_HANDLE = HANDLE; -alias LSA_HANDLE* PLSA_HANDLE; +alias PLSA_HANDLE = LSA_HANDLE*; struct TRUSTED_DOMAIN_NAME_INFO { LSA_UNICODE_STRING Name; } -alias TRUSTED_DOMAIN_NAME_INFO* PTRUSTED_DOMAIN_NAME_INFO; +alias PTRUSTED_DOMAIN_NAME_INFO = TRUSTED_DOMAIN_NAME_INFO*; struct TRUSTED_CONTROLLERS_INFO { ULONG Entries; PLSA_UNICODE_STRING Names; } -alias TRUSTED_CONTROLLERS_INFO* PTRUSTED_CONTROLLERS_INFO; +alias PTRUSTED_CONTROLLERS_INFO = TRUSTED_CONTROLLERS_INFO*; struct TRUSTED_POSIX_OFFSET_INFO { ULONG Offset; } -alias TRUSTED_POSIX_OFFSET_INFO* PTRUSTED_POSIX_OFFSET_INFO; +alias PTRUSTED_POSIX_OFFSET_INFO = TRUSTED_POSIX_OFFSET_INFO*; struct TRUSTED_PASSWORD_INFO { LSA_UNICODE_STRING Password; LSA_UNICODE_STRING OldPassword; } -alias TRUSTED_PASSWORD_INFO* PTRUSTED_PASSWORD_INFO; +alias PTRUSTED_PASSWORD_INFO = TRUSTED_PASSWORD_INFO*; struct TRUSTED_DOMAIN_INFORMATION_EX { LSA_UNICODE_STRING Name; @@ -699,7 +694,7 @@ struct TRUSTED_DOMAIN_INFORMATION_EX { ULONG TrustType; ULONG TrustAttributes; } -alias TRUSTED_DOMAIN_INFORMATION_EX* PTRUSTED_DOMAIN_INFORMATION_EX; +alias PTRUSTED_DOMAIN_INFORMATION_EX = TRUSTED_DOMAIN_INFORMATION_EX*; struct LSA_AUTH_INFORMATION { LARGE_INTEGER LastUpdateTime; @@ -707,7 +702,7 @@ struct LSA_AUTH_INFORMATION { ULONG AuthInfoLength; PUCHAR AuthInfo; } -alias LSA_AUTH_INFORMATION* PLSA_AUTH_INFORMATION; +alias PLSA_AUTH_INFORMATION = LSA_AUTH_INFORMATION*; struct TRUSTED_DOMAIN_AUTH_INFORMATION { ULONG IncomingAuthInfos; @@ -717,14 +712,14 @@ struct TRUSTED_DOMAIN_AUTH_INFORMATION { PLSA_AUTH_INFORMATION OutgoingAuthenticationInformation; PLSA_AUTH_INFORMATION OutgoingPreviousAuthenticationInformation; } -alias TRUSTED_DOMAIN_AUTH_INFORMATION* PTRUSTED_DOMAIN_AUTH_INFORMATION; +alias PTRUSTED_DOMAIN_AUTH_INFORMATION = TRUSTED_DOMAIN_AUTH_INFORMATION*; struct TRUSTED_DOMAIN_FULL_INFORMATION { TRUSTED_DOMAIN_INFORMATION_EX Information; TRUSTED_POSIX_OFFSET_INFO PosixOffset; TRUSTED_DOMAIN_AUTH_INFORMATION AuthInformation; } -alias TRUSTED_DOMAIN_FULL_INFORMATION* PTRUSTED_DOMAIN_FULL_INFORMATION; +alias PTRUSTED_DOMAIN_FULL_INFORMATION = TRUSTED_DOMAIN_FULL_INFORMATION*; extern (Windows) nothrow @nogc { NTSTATUS LsaAddAccountRights(LSA_HANDLE, PSID, PLSA_UNICODE_STRING, @@ -789,8 +784,7 @@ extern (Windows) nothrow @nogc { PLSA_UNICODE_STRING); } -alias NTSTATUS function(PUNICODE_STRING, ULONG, PUNICODE_STRING) - PSAM_PASSWORD_NOTIFICATION_ROUTINE; -alias BOOLEAN function() PSAM_INIT_NOTIFICATION_ROUTINE; -alias BOOLEAN function(PUNICODE_STRING, PUNICODE_STRING, - PUNICODE_STRING, BOOLEAN) PSAM_PASSWORD_FILTER_ROUTINE; +alias PSAM_PASSWORD_NOTIFICATION_ROUTINE = NTSTATUS function(PUNICODE_STRING, ULONG, PUNICODE_STRING); +alias PSAM_INIT_NOTIFICATION_ROUTINE = BOOLEAN function(); +alias PSAM_PASSWORD_FILTER_ROUTINE = BOOLEAN function(PUNICODE_STRING, PUNICODE_STRING, + PUNICODE_STRING, BOOLEAN); diff --git a/runtime/druntime/src/core/sys/windows/ntsecpkg.d b/runtime/druntime/src/core/sys/windows/ntsecpkg.d index 56803b043c4..02110716fd5 100644 --- a/runtime/druntime/src/core/sys/windows/ntsecpkg.d +++ b/runtime/druntime/src/core/sys/windows/ntsecpkg.d @@ -70,7 +70,7 @@ enum LSA_TOKEN_INFORMATION_TYPE { LsaTokenInformationNull, LsaTokenInformationV1 } -alias LSA_TOKEN_INFORMATION_TYPE* PLSA_TOKEN_INFORMATION_TYPE; +alias PLSA_TOKEN_INFORMATION_TYPE = LSA_TOKEN_INFORMATION_TYPE*; enum SECPKG_EXTENDED_INFORMATION_CLASS { SecpkgGssInfo = 1, @@ -102,18 +102,18 @@ struct SECPKG_PRIMARY_CRED { UNICODE_STRING Spare3; UNICODE_STRING Spare4; } -alias SECPKG_PRIMARY_CRED* PSECPKG_PRIMARY_CRED; +alias PSECPKG_PRIMARY_CRED = SECPKG_PRIMARY_CRED*; struct SECPKG_SUPPLEMENTAL_CRED { UNICODE_STRING PackageName; ULONG CredentialSize; PUCHAR Credentials; } -alias SECPKG_SUPPLEMENTAL_CRED* PSECPKG_SUPPLEMENTAL_CRED; +alias PSECPKG_SUPPLEMENTAL_CRED = SECPKG_SUPPLEMENTAL_CRED*; struct SECPKG_SUPPLEMENTAL_CRED_ARRAY { ULONG CredentialCount; SECPKG_SUPPLEMENTAL_CRED[1] Credentials; } -alias SECPKG_SUPPLEMENTAL_CRED_ARRAY* PSECPKG_SUPPLEMENTAL_CRED_ARRAY; +alias PSECPKG_SUPPLEMENTAL_CRED_ARRAY = SECPKG_SUPPLEMENTAL_CRED_ARRAY*; struct SECPKG_PARAMETERS { ULONG Version; ULONG MachineState; @@ -123,8 +123,8 @@ struct SECPKG_PARAMETERS { UNICODE_STRING DnsDomainName; GUID DomainGuid; } -alias SECPKG_PARAMETERS* PSECPKG_PARAMETERS,PSECPKG_EVENT_DOMAIN_CHANGE; -alias SECPKG_PARAMETERS SECPKG_EVENT_DOMAIN_CHANGE; +alias PSECPKG_PARAMETERS = SECPKG_PARAMETERS*, PSECPKG_EVENT_DOMAIN_CHANGE = SECPKG_PARAMETERS*; +alias SECPKG_EVENT_DOMAIN_CHANGE = SECPKG_PARAMETERS; struct SECPKG_CLIENT_INFO { LUID LogonId; ULONG ProcessID; @@ -133,36 +133,36 @@ struct SECPKG_CLIENT_INFO { BOOLEAN Impersonating; BOOLEAN Restricted; } -alias SECPKG_CLIENT_INFO* PSECPKG_CLIENT_INFO; +alias PSECPKG_CLIENT_INFO = SECPKG_CLIENT_INFO*; struct SECURITY_USER_DATA { SECURITY_STRING UserName; SECURITY_STRING LogonDomainName; SECURITY_STRING LogonServer; PSID pSid; } -alias SECURITY_USER_DATA* PSECURITY_USER_DATA,PSecurityUserData; -alias SECURITY_USER_DATA SecurityUserData; +alias PSECURITY_USER_DATA = SECURITY_USER_DATA*, PSecurityUserData = SECURITY_USER_DATA*; +alias SecurityUserData = SECURITY_USER_DATA; struct SECPKG_GSS_INFO { ULONG EncodedIdLength; UCHAR[4] EncodedId; } -alias SECPKG_GSS_INFO* PSECPKG_GSS_INFO; +alias PSECPKG_GSS_INFO = SECPKG_GSS_INFO*; struct SECPKG_CONTEXT_THUNKS { ULONG InfoLevelCount; ULONG[1] Levels; } -alias SECPKG_CONTEXT_THUNKS* PSECPKG_CONTEXT_THUNKS; +alias PSECPKG_CONTEXT_THUNKS = SECPKG_CONTEXT_THUNKS*; struct SECPKG_MUTUAL_AUTH_LEVEL { ULONG MutualAuthLevel; } -alias SECPKG_MUTUAL_AUTH_LEVEL* PSECPKG_MUTUAL_AUTH_LEVEL; +alias PSECPKG_MUTUAL_AUTH_LEVEL = SECPKG_MUTUAL_AUTH_LEVEL*; struct SECPKG_CALL_INFO { ULONG ProcessId; ULONG ThreadId; ULONG Attributes; ULONG CallCount; } -alias SECPKG_CALL_INFO* PSECPKG_CALL_INFO; +alias PSECPKG_CALL_INFO = SECPKG_CALL_INFO*; struct SECPKG_EXTENDED_INFORMATION { SECPKG_EXTENDED_INFORMATION_CLASS Class; union _Info{ @@ -172,86 +172,86 @@ struct SECPKG_EXTENDED_INFORMATION { } _Info Info; } -alias SECPKG_EXTENDED_INFORMATION* PSECPKG_EXTENDED_INFORMATION; +alias PSECPKG_EXTENDED_INFORMATION = SECPKG_EXTENDED_INFORMATION*; /* callbacks implemented by SSP/AP dlls and called by the LSA */ -alias void function(ULONG_PTR, ULONG_PTR, PSecBuffer, - PSecBuffer) PLSA_CALLBACK_FUNCTION; +alias PLSA_CALLBACK_FUNCTION = void function(ULONG_PTR, ULONG_PTR, PSecBuffer, + PSecBuffer); /* misc typedefs used in the below prototypes */ -alias PVOID* PLSA_CLIENT_REQUEST; -alias ULONG_PTR LSA_SEC_HANDLE; -alias LSA_SEC_HANDLE* PLSA_SEC_HANDLE; -alias LPTHREAD_START_ROUTINE SEC_THREAD_START; -alias PSECURITY_ATTRIBUTES SEC_ATTRS; +alias PLSA_CLIENT_REQUEST = PVOID*; +alias LSA_SEC_HANDLE = ULONG_PTR; +alias PLSA_SEC_HANDLE = LSA_SEC_HANDLE*; +alias SEC_THREAD_START = LPTHREAD_START_ROUTINE; +alias SEC_ATTRS = PSECURITY_ATTRIBUTES; /* functions used by SSP/AP obtainable by dispatch tables */ -alias NTSTATUS function(ULONG, PLSA_CALLBACK_FUNCTION) PLSA_REGISTER_CALLBACK; -alias NTSTATUS function(PLUID) PLSA_CREATE_LOGON_SESSION; -alias NTSTATUS function(PLUID) PLSA_DELETE_LOGON_SESSION; -alias NTSTATUS function(PLUID, ULONG, PLSA_STRING, - PLSA_STRING) PLSA_ADD_CREDENTIAL; -alias NTSTATUS function(PLUID, ULONG, PULONG, BOOLEAN, - PLSA_STRING, PULONG, PLSA_STRING) PLSA_GET_CREDENTIALS; -alias NTSTATUS function(PLUID, ULONG, PLSA_STRING) PLSA_DELETE_CREDENTIAL; -alias PVOID function(ULONG) PLSA_ALLOCATE_LSA_HEAP; -alias void function(PVOID) PLSA_FREE_LSA_HEAP; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, - ULONG, PVOID*) PLSA_ALLOCATE_CLIENT_BUFFER; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, PVOID) PLSA_FREE_CLIENT_BUFFER; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, ULONG, - PVOID, PVOID) PLSA_COPY_TO_CLIENT_BUFFER; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, - ULONG, PVOID, PVOID) PLSA_COPY_FROM_CLIENT_BUFFER; -alias NTSTATUS function() PLSA_IMPERSONATE_CLIENT; -alias NTSTATUS function() PLSA_UNLOAD_PACKAGE; -alias NTSTATUS function(HANDLE, PHANDLE) PLSA_DUPLICATE_HANDLE; -alias NTSTATUS function(PLUID, ULONG, - PVOID, BOOLEAN) PLSA_SAVE_SUPPLEMENTAL_CREDENTIALS; -alias HANDLE function(SEC_ATTRS, ULONG, SEC_THREAD_START, - PVOID, ULONG, PULONG) PLSA_CREATE_THREAD; -alias NTSTATUS function(PSECPKG_CLIENT_INFO) PLSA_GET_CLIENT_INFO; -alias HANDLE function(SEC_THREAD_START, PVOID, - ULONG, ULONG, ULONG, ULONG, HANDLE) PLSA_REGISTER_NOTIFICATION; -alias NTSTATUS function(HANDLE) PLSA_CANCEL_NOTIFICATION; -alias NTSTATUS function(PSecBuffer, PSecBuffer) PLSA_MAP_BUFFER; -alias NTSTATUS function(PLUID, PTOKEN_SOURCE, +alias PLSA_REGISTER_CALLBACK = NTSTATUS function(ULONG, PLSA_CALLBACK_FUNCTION); +alias PLSA_CREATE_LOGON_SESSION = NTSTATUS function(PLUID); +alias PLSA_DELETE_LOGON_SESSION = NTSTATUS function(PLUID); +alias PLSA_ADD_CREDENTIAL = NTSTATUS function(PLUID, ULONG, PLSA_STRING, + PLSA_STRING); +alias PLSA_GET_CREDENTIALS = NTSTATUS function(PLUID, ULONG, PULONG, BOOLEAN, + PLSA_STRING, PULONG, PLSA_STRING); +alias PLSA_DELETE_CREDENTIAL = NTSTATUS function(PLUID, ULONG, PLSA_STRING); +alias PLSA_ALLOCATE_LSA_HEAP = PVOID function(ULONG); +alias PLSA_FREE_LSA_HEAP = void function(PVOID); +alias PLSA_ALLOCATE_CLIENT_BUFFER = NTSTATUS function(PLSA_CLIENT_REQUEST, + ULONG, PVOID*); +alias PLSA_FREE_CLIENT_BUFFER = NTSTATUS function(PLSA_CLIENT_REQUEST, PVOID); +alias PLSA_COPY_TO_CLIENT_BUFFER = NTSTATUS function(PLSA_CLIENT_REQUEST, ULONG, + PVOID, PVOID); +alias PLSA_COPY_FROM_CLIENT_BUFFER = NTSTATUS function(PLSA_CLIENT_REQUEST, + ULONG, PVOID, PVOID); +alias PLSA_IMPERSONATE_CLIENT = NTSTATUS function(); +alias PLSA_UNLOAD_PACKAGE = NTSTATUS function(); +alias PLSA_DUPLICATE_HANDLE = NTSTATUS function(HANDLE, PHANDLE); +alias PLSA_SAVE_SUPPLEMENTAL_CREDENTIALS = NTSTATUS function(PLUID, ULONG, + PVOID, BOOLEAN); +alias PLSA_CREATE_THREAD = HANDLE function(SEC_ATTRS, ULONG, SEC_THREAD_START, + PVOID, ULONG, PULONG); +alias PLSA_GET_CLIENT_INFO = NTSTATUS function(PSECPKG_CLIENT_INFO); +alias PLSA_REGISTER_NOTIFICATION = HANDLE function(SEC_THREAD_START, PVOID, + ULONG, ULONG, ULONG, ULONG, HANDLE); +alias PLSA_CANCEL_NOTIFICATION = NTSTATUS function(HANDLE); +alias PLSA_MAP_BUFFER = NTSTATUS function(PSecBuffer, PSecBuffer); +alias PLSA_CREATE_TOKEN = NTSTATUS function(PLUID, PTOKEN_SOURCE, SECURITY_LOGON_TYPE, SECURITY_IMPERSONATION_LEVEL, LSA_TOKEN_INFORMATION_TYPE, PVOID, PTOKEN_GROUPS, PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING, - PUNICODE_STRING, PHANDLE, PNTSTATUS) PLSA_CREATE_TOKEN; -alias void function(NTSTATUS, NTSTATUS, PUNICODE_STRING, + PUNICODE_STRING, PHANDLE, PNTSTATUS); +alias PLSA_AUDIT_LOGON = void function(NTSTATUS, NTSTATUS, PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING, PSID, SECURITY_LOGON_TYPE, - PTOKEN_SOURCE, PLUID) PLSA_AUDIT_LOGON; -alias NTSTATUS function(PUNICODE_STRING, PVOID, ULONG, - PVOID*, PULONG, PNTSTATUS) PLSA_CALL_PACKAGE; -alias BOOLEAN function(PSECPKG_CALL_INFO) PLSA_GET_CALL_INFO; -alias NTSTATUS function(PUNICODE_STRING, PVOID, PVOID, - ULONG, PVOID*, PULONG, PNTSTATUS) PLSA_CALL_PACKAGEEX; -alias PVOID function(ULONG, ULONG) PLSA_CREATE_SHARED_MEMORY; -alias PVOID function(PVOID, ULONG) PLSA_ALLOCATE_SHARED_MEMORY; -alias void function(PVOID, PVOID) PLSA_FREE_SHARED_MEMORY; -alias BOOLEAN function(PVOID) PLSA_DELETE_SHARED_MEMORY; -alias NTSTATUS function(PSECURITY_STRING, SECPKG_NAME_TYPE, - PSECURITY_STRING, BOOLEAN, ULONG, PVOID*) PLSA_OPEN_SAM_USER; -alias NTSTATUS function(PVOID, PVOID *, PULONG, - PVOID *, PULONG) PLSA_GET_USER_CREDENTIALS; -alias NTSTATUS function(PVOID, PUCHAR *, PULONG) PLSA_GET_USER_AUTH_DATA; -alias NTSTATUS function(PVOID) PLSA_CLOSE_SAM_USER; -alias NTSTATUS function(PVOID, ULONG, + PTOKEN_SOURCE, PLUID); +alias PLSA_CALL_PACKAGE = NTSTATUS function(PUNICODE_STRING, PVOID, ULONG, + PVOID*, PULONG, PNTSTATUS); +alias PLSA_GET_CALL_INFO = BOOLEAN function(PSECPKG_CALL_INFO); +alias PLSA_CALL_PACKAGEEX = NTSTATUS function(PUNICODE_STRING, PVOID, PVOID, + ULONG, PVOID*, PULONG, PNTSTATUS); +alias PLSA_CREATE_SHARED_MEMORY = PVOID function(ULONG, ULONG); +alias PLSA_ALLOCATE_SHARED_MEMORY = PVOID function(PVOID, ULONG); +alias PLSA_FREE_SHARED_MEMORY = void function(PVOID, PVOID); +alias PLSA_DELETE_SHARED_MEMORY = BOOLEAN function(PVOID); +alias PLSA_OPEN_SAM_USER = NTSTATUS function(PSECURITY_STRING, SECPKG_NAME_TYPE, + PSECURITY_STRING, BOOLEAN, ULONG, PVOID*); +alias PLSA_GET_USER_CREDENTIALS = NTSTATUS function(PVOID, PVOID *, PULONG, + PVOID *, PULONG); +alias PLSA_GET_USER_AUTH_DATA = NTSTATUS function(PVOID, PUCHAR *, PULONG); +alias PLSA_CLOSE_SAM_USER = NTSTATUS function(PVOID); +alias PLSA_CONVERT_AUTH_DATA_TO_TOKEN = NTSTATUS function(PVOID, ULONG, SECURITY_IMPERSONATION_LEVEL, PTOKEN_SOURCE, SECURITY_LOGON_TYPE, - PUNICODE_STRING, PHANDLE, PLUID, PUNICODE_STRING, PNTSTATUS) PLSA_CONVERT_AUTH_DATA_TO_TOKEN; -alias NTSTATUS function(PCHAR, ULONG_PTR, ULONG_PTR, - PSecBuffer, PSecBuffer) PLSA_CLIENT_CALLBACK; -alias NTSTATUS function(PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY) PLSA_UPDATE_PRIMARY_CREDENTIALS; -alias NTSTATUS function(PSECURITY_STRING, - SECPKG_NAME_TYPE, PSECURITY_STRING, PUCHAR *, PULONG, PUNICODE_STRING) PLSA_GET_AUTH_DATA_FOR_USER; -alias NTSTATUS function(ULONG, BOOLEAN, + PUNICODE_STRING, PHANDLE, PLUID, PUNICODE_STRING, PNTSTATUS); +alias PLSA_CLIENT_CALLBACK = NTSTATUS function(PCHAR, ULONG_PTR, ULONG_PTR, + PSecBuffer, PSecBuffer); +alias PLSA_UPDATE_PRIMARY_CREDENTIALS = NTSTATUS function(PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY); +alias PLSA_GET_AUTH_DATA_FOR_USER = NTSTATUS function(PSECURITY_STRING, + SECPKG_NAME_TYPE, PSECURITY_STRING, PUCHAR *, PULONG, PUNICODE_STRING); +alias PLSA_CRACK_SINGLE_NAME = NTSTATUS function(ULONG, BOOLEAN, PUNICODE_STRING, PUNICODE_STRING, ULONG, PUNICODE_STRING, PUNICODE_STRING, - PULONG) PLSA_CRACK_SINGLE_NAME; -alias NTSTATUS function(ULONG, BOOLEAN, - PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING, NTSTATUS) PLSA_AUDIT_ACCOUNT_LOGON; -alias NTSTATUS function(PUNICODE_STRING, PVOID, - PVOID, ULONG, PVOID*, PULONG, PNTSTATUS) PLSA_CALL_PACKAGE_PASSTHROUGH; + PULONG); +alias PLSA_AUDIT_ACCOUNT_LOGON = NTSTATUS function(ULONG, BOOLEAN, + PUNICODE_STRING, PUNICODE_STRING, PUNICODE_STRING, NTSTATUS); +alias PLSA_CALL_PACKAGE_PASSTHROUGH = NTSTATUS function(PUNICODE_STRING, PVOID, + PVOID, ULONG, PVOID*, PULONG, PNTSTATUS); /* Dispatch tables of functions used by SSP/AP */ struct SECPKG_DLL_FUNCTIONS { @@ -259,7 +259,7 @@ struct SECPKG_DLL_FUNCTIONS { PLSA_FREE_LSA_HEAP FreeHeap; PLSA_REGISTER_CALLBACK RegisterCallback; } -alias SECPKG_DLL_FUNCTIONS* PSECPKG_DLL_FUNCTIONS; +alias PSECPKG_DLL_FUNCTIONS = SECPKG_DLL_FUNCTIONS*; struct LSA_DISPATCH_TABLE { PLSA_CREATE_LOGON_SESSION CreateLogonSession; PLSA_DELETE_LOGON_SESSION DeleteLogonSession; @@ -273,7 +273,7 @@ struct LSA_DISPATCH_TABLE { PLSA_COPY_TO_CLIENT_BUFFER CopyToClientBuffer; PLSA_COPY_FROM_CLIENT_BUFFER CopyFromClientBuffer; } -alias LSA_DISPATCH_TABLE* PLSA_DISPATCH_TABLE; +alias PLSA_DISPATCH_TABLE = LSA_DISPATCH_TABLE*; struct LSA_SECPKG_FUNCTION_TABLE { PLSA_CREATE_LOGON_SESSION CreateLogonSession; PLSA_DELETE_LOGON_SESSION DeleteLogonSession; @@ -317,76 +317,76 @@ struct LSA_SECPKG_FUNCTION_TABLE { PLSA_AUDIT_ACCOUNT_LOGON AuditAccountLogon; PLSA_CALL_PACKAGE_PASSTHROUGH CallPackagePassthrough; } -alias LSA_SECPKG_FUNCTION_TABLE* PLSA_SECPKG_FUNCTION_TABLE; +alias PLSA_SECPKG_FUNCTION_TABLE = LSA_SECPKG_FUNCTION_TABLE*; /* functions implemented by SSP/AP obtainable by dispatch tables */ -alias NTSTATUS function(ULONG, PLSA_DISPATCH_TABLE, - PLSA_STRING, PLSA_STRING, PLSA_STRING *) PLSA_AP_INITIALIZE_PACKAGE; -alias NTSTATUS function(LPWSTR, LPWSTR, LPWSTR, LPWSTR, - DWORD, DWORD, PHANDLE) PLSA_AP_LOGON_USER; -alias NTSTATUS function(PUNICODE_STRING, PVOID, ULONG, - PVOID *, PULONG, PNTSTATUS) PLSA_AP_CALL_PACKAGE; -alias void function(PLUID) PLSA_AP_LOGON_TERMINATED; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, - PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS) PLSA_AP_CALL_PACKAGE_UNTRUSTED; -alias NTSTATUS function(PUNICODE_STRING, - PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS) PLSA_AP_CALL_PACKAGE_PASSTHROUGH; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, +alias PLSA_AP_INITIALIZE_PACKAGE = NTSTATUS function(ULONG, PLSA_DISPATCH_TABLE, + PLSA_STRING, PLSA_STRING, PLSA_STRING *); +alias PLSA_AP_LOGON_USER = NTSTATUS function(LPWSTR, LPWSTR, LPWSTR, LPWSTR, + DWORD, DWORD, PHANDLE); +alias PLSA_AP_CALL_PACKAGE = NTSTATUS function(PUNICODE_STRING, PVOID, ULONG, + PVOID *, PULONG, PNTSTATUS); +alias PLSA_AP_LOGON_TERMINATED = void function(PLUID); +alias PLSA_AP_CALL_PACKAGE_UNTRUSTED = NTSTATUS function(PLSA_CLIENT_REQUEST, + PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS); +alias PLSA_AP_CALL_PACKAGE_PASSTHROUGH = NTSTATUS function(PUNICODE_STRING, + PVOID, PVOID, ULONG, PVOID *, PULONG, PNTSTATUS); +alias PLSA_AP_LOGON_USER_EX = NTSTATUS function(PLSA_CLIENT_REQUEST, SECURITY_LOGON_TYPE, PVOID, PVOID, ULONG, PVOID *, PULONG, PLUID, PNTSTATUS, PLSA_TOKEN_INFORMATION_TYPE, PVOID *, PUNICODE_STRING *, PUNICODE_STRING *, - PUNICODE_STRING *) PLSA_AP_LOGON_USER_EX; -alias NTSTATUS function(PLSA_CLIENT_REQUEST, + PUNICODE_STRING *); +alias PLSA_AP_LOGON_USER_EX2 = NTSTATUS function(PLSA_CLIENT_REQUEST, SECURITY_LOGON_TYPE, PVOID, PVOID, ULONG, PVOID *, PULONG, PLUID, PNTSTATUS, PLSA_TOKEN_INFORMATION_TYPE, PVOID *, PUNICODE_STRING *, PUNICODE_STRING *, - PUNICODE_STRING *, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY *) PLSA_AP_LOGON_USER_EX2; -alias NTSTATUS function(ULONG_PTR, PSECPKG_PARAMETERS, - PLSA_SECPKG_FUNCTION_TABLE) SpInitializeFn; -alias NTSTATUS function() SpShutDownFn; -alias NTSTATUS function(PSecPkgInfoW) SpGetInfoFn; -alias NTSTATUS function(SECURITY_LOGON_TYPE, - PUNICODE_STRING, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED) SpAcceptCredentialsFn; -alias NTSTATUS function(PUNICODE_STRING, ULONG, - PLUID, PVOID, PVOID, PVOID, PLSA_SEC_HANDLE, PTimeStamp) SpAcquireCredentialsHandleFn; -alias NTSTATUS function(LSA_SEC_HANDLE, ULONG, PVOID) SpQueryCredentialsAttributesFn; -alias NTSTATUS function(LSA_SEC_HANDLE) SpFreeCredentialsHandleFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer) SpSaveCredentialsFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer) SpGetCredentialsFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer) SpDeleteCredentialsFn; -alias NTSTATUS function(LSA_SEC_HANDLE, LSA_SEC_HANDLE, + PUNICODE_STRING *, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED_ARRAY *); +alias SpInitializeFn = NTSTATUS function(ULONG_PTR, PSECPKG_PARAMETERS, + PLSA_SECPKG_FUNCTION_TABLE); +alias SpShutDownFn = NTSTATUS function(); +alias SpGetInfoFn = NTSTATUS function(PSecPkgInfoW); +alias SpAcceptCredentialsFn = NTSTATUS function(SECURITY_LOGON_TYPE, + PUNICODE_STRING, PSECPKG_PRIMARY_CRED, PSECPKG_SUPPLEMENTAL_CRED); +alias SpAcquireCredentialsHandleFn = NTSTATUS function(PUNICODE_STRING, ULONG, + PLUID, PVOID, PVOID, PVOID, PLSA_SEC_HANDLE, PTimeStamp); +alias SpQueryCredentialsAttributesFn = NTSTATUS function(LSA_SEC_HANDLE, ULONG, PVOID); +alias SpFreeCredentialsHandleFn = NTSTATUS function(LSA_SEC_HANDLE); +alias SpSaveCredentialsFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer); +alias SpGetCredentialsFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer); +alias SpDeleteCredentialsFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer); +alias SpInitLsaModeContextFn = NTSTATUS function(LSA_SEC_HANDLE, LSA_SEC_HANDLE, PUNICODE_STRING, ULONG, ULONG, PSecBufferDesc, PLSA_SEC_HANDLE, PSecBufferDesc, - PULONG, PTimeStamp, PBOOLEAN, PSecBuffer) SpInitLsaModeContextFn; -alias NTSTATUS function(LSA_SEC_HANDLE, + PULONG, PTimeStamp, PBOOLEAN, PSecBuffer); +alias SpAcceptLsaModeContextFn = NTSTATUS function(LSA_SEC_HANDLE, LSA_SEC_HANDLE, PSecBufferDesc, ULONG, ULONG, PLSA_SEC_HANDLE, PSecBufferDesc, - PULONG, PTimeStamp, PBOOLEAN, PSecBuffer) SpAcceptLsaModeContextFn; -alias NTSTATUS function(LSA_SEC_HANDLE) SpDeleteContextFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc) SpApplyControlTokenFn; -alias NTSTATUS function(PLUID, ULONG, PSecurityUserData *) SpGetUserInfoFn; -alias NTSTATUS function(SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION *) SpGetExtendedInformationFn; -alias NTSTATUS function(LSA_SEC_HANDLE, ULONG, PVOID) SpQueryContextAttributesFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PUNICODE_STRING, - PUNICODE_STRING, ULONG, PVOID, PVOID, PVOID, PTimeStamp) SpAddCredentialsFn; -alias NTSTATUS function( - SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION) SpSetExtendedInformationFn; -alias NTSTATUS function(ULONG, PSECPKG_DLL_FUNCTIONS, - PVOID *) SpInstanceInitFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer) SpInitUserModeContextFn; -alias NTSTATUS function(LSA_SEC_HANDLE, ULONG, - PSecBufferDesc, ULONG) SpMakeSignatureFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc, - ULONG, PULONG) SpVerifySignatureFn; -alias NTSTATUS function(LSA_SEC_HANDLE, ULONG, PSecBufferDesc, - ULONG) SpSealMessageFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc, - ULONG, PULONG) SpUnsealMessageFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PHANDLE) SpGetContextTokenFn; -alias NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc) SpCompleteAuthTokenFn; -alias NTSTATUS function(PSecBuffer, PSecBuffer) SpFormatCredentialsFn; -alias NTSTATUS function(ULONG, PUCHAR, PULONG, - PVOID *) SpMarshallSupplementalCredsFn; -alias NTSTATUS function(LSA_SEC_HANDLE, ULONG, - PSecBuffer, PHANDLE) SpExportSecurityContextFn; -alias NTSTATUS function(PSecBuffer, HANDLE, - PLSA_SEC_HANDLE) SpImportSecurityContextFn; + PULONG, PTimeStamp, PBOOLEAN, PSecBuffer); +alias SpDeleteContextFn = NTSTATUS function(LSA_SEC_HANDLE); +alias SpApplyControlTokenFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc); +alias SpGetUserInfoFn = NTSTATUS function(PLUID, ULONG, PSecurityUserData *); +alias SpGetExtendedInformationFn = NTSTATUS function(SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION *); +alias SpQueryContextAttributesFn = NTSTATUS function(LSA_SEC_HANDLE, ULONG, PVOID); +alias SpAddCredentialsFn = NTSTATUS function(LSA_SEC_HANDLE, PUNICODE_STRING, + PUNICODE_STRING, ULONG, PVOID, PVOID, PVOID, PTimeStamp); +alias SpSetExtendedInformationFn = NTSTATUS function( + SECPKG_EXTENDED_INFORMATION_CLASS, PSECPKG_EXTENDED_INFORMATION); +alias SpInstanceInitFn = NTSTATUS function(ULONG, PSECPKG_DLL_FUNCTIONS, + PVOID *); +alias SpInitUserModeContextFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBuffer); +alias SpMakeSignatureFn = NTSTATUS function(LSA_SEC_HANDLE, ULONG, + PSecBufferDesc, ULONG); +alias SpVerifySignatureFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc, + ULONG, PULONG); +alias SpSealMessageFn = NTSTATUS function(LSA_SEC_HANDLE, ULONG, PSecBufferDesc, + ULONG); +alias SpUnsealMessageFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc, + ULONG, PULONG); +alias SpGetContextTokenFn = NTSTATUS function(LSA_SEC_HANDLE, PHANDLE); +alias SpCompleteAuthTokenFn = NTSTATUS function(LSA_SEC_HANDLE, PSecBufferDesc); +alias SpFormatCredentialsFn = NTSTATUS function(PSecBuffer, PSecBuffer); +alias SpMarshallSupplementalCredsFn = NTSTATUS function(ULONG, PUCHAR, PULONG, + PVOID *); +alias SpExportSecurityContextFn = NTSTATUS function(LSA_SEC_HANDLE, ULONG, + PSecBuffer, PHANDLE); +alias SpImportSecurityContextFn = NTSTATUS function(PSecBuffer, HANDLE, + PLSA_SEC_HANDLE); /* Dispatch tables of functions implemented by SSP/AP */ struct SECPKG_FUNCTION_TABLE { @@ -418,7 +418,7 @@ struct SECPKG_FUNCTION_TABLE { SpAddCredentialsFn *AddCredentials; SpSetExtendedInformationFn *SetExtendedInformation; } -alias SECPKG_FUNCTION_TABLE* PSECPKG_FUNCTION_TABLE; +alias PSECPKG_FUNCTION_TABLE = SECPKG_FUNCTION_TABLE*; struct SECPKG_USER_FUNCTION_TABLE { SpInstanceInitFn *InstanceInit; @@ -436,10 +436,10 @@ struct SECPKG_USER_FUNCTION_TABLE { SpExportSecurityContextFn *ExportContext; SpImportSecurityContextFn *ImportContext; } -alias SECPKG_USER_FUNCTION_TABLE* PSECPKG_USER_FUNCTION_TABLE; +alias PSECPKG_USER_FUNCTION_TABLE = SECPKG_USER_FUNCTION_TABLE*; /* Entry points to SSP/AP */ -alias NTSTATUS function(ULONG, PULONG, - PSECPKG_FUNCTION_TABLE *, PULONG) SpLsaModeInitializeFn; -alias NTSTATUS function(ULONG, PULONG, - PSECPKG_USER_FUNCTION_TABLE *, PULONG) SpUserModeInitializeFn; +alias SpLsaModeInitializeFn = NTSTATUS function(ULONG, PULONG, + PSECPKG_FUNCTION_TABLE *, PULONG); +alias SpUserModeInitializeFn = NTSTATUS function(ULONG, PULONG, + PSECPKG_USER_FUNCTION_TABLE *, PULONG); diff --git a/runtime/druntime/src/core/sys/windows/oaidl.d b/runtime/druntime/src/core/sys/windows/oaidl.d index cd11061d0bb..49e36f46983 100644 --- a/runtime/druntime/src/core/sys/windows/oaidl.d +++ b/runtime/druntime/src/core/sys/windows/oaidl.d @@ -77,15 +77,15 @@ struct TLIBATTR { WORD wMinorVerNum; WORD wLibFlags; } -alias TLIBATTR* LPTLIBATTR; +alias LPTLIBATTR = TLIBATTR*; -alias CY CURRENCY; +alias CURRENCY = CY; struct SAFEARRAYBOUND { ULONG cElements; LONG lLbound; } -alias SAFEARRAYBOUND* LPSAFEARRAYBOUND; +alias LPSAFEARRAYBOUND = SAFEARRAYBOUND*; struct SAFEARR_BSTR { ULONG Size; @@ -125,7 +125,7 @@ struct _wireBRECORD { LPRECORDINFO* pRecInfo; byte* pRecord; } -alias _wireBRECORD* wireBRECORD; +alias wireBRECORD = _wireBRECORD*; struct SAFEARR_BRECORD { ULONG Size; @@ -163,9 +163,9 @@ struct _wireSAFEARRAY { SAFEARRAYUNION uArrayStructs; SAFEARRAYBOUND[1] rgsabound; } -alias _wireSAFEARRAY* wireSAFEARRAY; +alias wireSAFEARRAY = _wireSAFEARRAY*; -alias wireSAFEARRAY* wirePSAFEARRAY; +alias wirePSAFEARRAY = wireSAFEARRAY*; struct SAFEARRAY { USHORT cDims; @@ -175,7 +175,7 @@ struct SAFEARRAY { PVOID pvData; SAFEARRAYBOUND[1] rgsabound; } -alias SAFEARRAY* LPSAFEARRAY; +alias LPSAFEARRAY = SAFEARRAY*; struct VARIANT { union { @@ -238,10 +238,10 @@ struct VARIANT { DECIMAL decVal; } } -alias VARIANT* LPVARIANT; +alias LPVARIANT = VARIANT*; -alias VARIANT VARIANTARG; -alias VARIANT* LPVARIANTARG; +alias VARIANTARG = VARIANT; +alias LPVARIANTARG = VARIANT*; struct _wireVARIANT { DWORD clSize; @@ -297,11 +297,11 @@ struct _wireVARIANT { UINT* puintVal; } } -alias _wireVARIANT* wireVARIANT; +alias wireVARIANT = _wireVARIANT*; -alias LONG DISPID; -alias DISPID MEMBERID; -alias DWORD HREFTYPE; +alias DISPID = LONG; +alias MEMBERID = DISPID; +alias HREFTYPE = DWORD; enum TYPEKIND { TKIND_ENUM, TKIND_RECORD, TKIND_MODULE, TKIND_INTERFACE, TKIND_DISPATCH, @@ -327,19 +327,19 @@ struct PARAMDESCEX { ULONG cBytes; VARIANTARG varDefaultValue; } -alias PARAMDESCEX* LPPARAMDESCEX; +alias LPPARAMDESCEX = PARAMDESCEX*; struct PARAMDESC { LPPARAMDESCEX pparamdescex; USHORT wParamFlags; } -alias PARAMDESC* LPPARAMDESC; +alias LPPARAMDESC = PARAMDESC*; struct IDLDESC { ULONG_PTR dwReserved; USHORT wIDLFlags; } -alias IDLDESC* LPIDLDESC; +alias LPIDLDESC = IDLDESC*; struct ELEMDESC { TYPEDESC tdesc; @@ -348,7 +348,7 @@ struct ELEMDESC { PARAMDESC paramdesc; } } -alias ELEMDESC* LPELEMDESC; +alias LPELEMDESC = ELEMDESC*; struct TYPEATTR { GUID guid; @@ -370,7 +370,7 @@ struct TYPEATTR { TYPEDESC tdescAlias; IDLDESC idldescType; } -alias TYPEATTR* LPTYPEATTR; +alias LPTYPEATTR = TYPEATTR*; struct DISPPARAMS { VARIANTARG* rgvarg; @@ -392,7 +392,7 @@ struct EXCEPINFO { } SCODE scode; } -alias EXCEPINFO* LPEXCEPINFO; +alias LPEXCEPINFO = EXCEPINFO*; enum CALLCONV { CC_FASTCALL, @@ -437,7 +437,7 @@ struct FUNCDESC { ELEMDESC elemdescFunc; WORD wFuncFlags; } -alias FUNCDESC* LPFUNCDESC; +alias LPFUNCDESC = FUNCDESC*; enum VARKIND { VAR_PERINSTANCE, VAR_STATIC, VAR_CONST, VAR_DISPATCH @@ -454,7 +454,7 @@ struct VARDESC { WORD wVarFlags; VARKIND varkind; } -alias VARDESC* LPVARDESC; +alias LPVARDESC = VARDESC*; enum TYPEFLAGS { TYPEFLAG_FAPPOBJECT = 1, @@ -515,13 +515,13 @@ struct CUSTDATAITEM { GUID guid; VARIANTARG varValue; } -alias CUSTDATAITEM* LPCUSTDATAITEM; +alias LPCUSTDATAITEM = CUSTDATAITEM*; struct CUSTDATA { DWORD cCustData; LPCUSTDATAITEM prgCustData; } -alias CUSTDATA* LPCUSTDATA; +alias LPCUSTDATA = CUSTDATA*; enum DESCKIND { DESCKIND_NONE = 0, @@ -537,7 +537,7 @@ union BINDPTR { LPVARDESC lpvardesc; LPTYPECOMP lptcomp; } -alias BINDPTR* LPBINDPTR; +alias LPBINDPTR = BINDPTR*; interface IDispatch : IUnknown { HRESULT GetTypeInfoCount(UINT*); @@ -545,7 +545,7 @@ interface IDispatch : IUnknown { HRESULT GetIDsOfNames(REFIID, LPOLESTR*, UINT, LCID, DISPID*); HRESULT Invoke(DISPID, REFIID, LCID, WORD, DISPPARAMS*, VARIANT*, EXCEPINFO*, UINT*); } -alias IDispatch LPDISPATCH; +alias LPDISPATCH = IDispatch; interface IEnumVARIANT : IUnknown { HRESULT Next(ULONG, VARIANT*, ULONG*); @@ -553,13 +553,13 @@ interface IEnumVARIANT : IUnknown { HRESULT Reset(); HRESULT Clone(IEnumVARIANT*); } -alias IEnumVARIANT LPENUMVARIANT; +alias LPENUMVARIANT = IEnumVARIANT; interface ITypeComp : IUnknown { HRESULT Bind(LPOLESTR, ULONG, WORD, LPTYPEINFO*, DESCKIND*, LPBINDPTR); HRESULT BindType(LPOLESTR, ULONG, LPTYPEINFO*, LPTYPECOMP*); } -alias ITypeComp LPTYPECOMP; +alias LPTYPECOMP = ITypeComp; interface ITypeInfo : IUnknown { HRESULT GetTypeAttr(LPTYPEATTR*); @@ -583,7 +583,7 @@ interface ITypeInfo : IUnknown { void ReleaseFuncDesc(LPFUNCDESC); void ReleaseVarDesc(LPVARDESC); } -alias ITypeInfo LPTYPEINFO; +alias LPTYPEINFO = ITypeInfo; interface ITypeInfo2 : ITypeInfo { HRESULT GetTypeKind(TYPEKIND*); @@ -602,7 +602,7 @@ interface ITypeInfo2 : ITypeInfo { HRESULT GetAllVarCustData(UINT, CUSTDATA*); HRESULT GetAllImplTypeCustData(UINT, CUSTDATA*); } -alias ITypeInfo2 LPTYPEINFO2; +alias LPTYPEINFO2 = ITypeInfo2; interface ITypeLib : IUnknown { UINT GetTypeInfoCount(); @@ -616,7 +616,7 @@ interface ITypeLib : IUnknown { HRESULT FindName(LPOLESTR, ULONG, ITypeInfo*, MEMBERID*, USHORT*); void ReleaseTLibAttr(TLIBATTR*); } -alias ITypeLib LPTYPELIB; +alias LPTYPELIB = ITypeLib; interface ITypeLib2 : ITypeLib { HRESULT GetCustData(REFGUID, VARIANT*); @@ -624,7 +624,7 @@ interface ITypeLib2 : ITypeLib { HRESULT GetDocumentation2(INT, LCID, BSTR*, DWORD*, BSTR*); HRESULT GetAllCustData(CUSTDATA*); } -alias ITypeLib2 LPTYPELIB2; +alias LPTYPELIB2 = ITypeLib2; interface IErrorInfo : IUnknown { HRESULT GetGUID(GUID*); @@ -633,7 +633,7 @@ interface IErrorInfo : IUnknown { HRESULT GetHelpFile(BSTR*); HRESULT GetHelpContext(DWORD*); } -alias IErrorInfo LPERRORINFO; +alias LPERRORINFO = IErrorInfo; interface ICreateErrorInfo : IUnknown { HRESULT SetGUID(REFGUID); @@ -642,12 +642,12 @@ interface ICreateErrorInfo : IUnknown { HRESULT SetHelpFile(LPOLESTR); HRESULT SetHelpContext(DWORD); } -alias ICreateErrorInfo LPCREATEERRORINFO; +alias LPCREATEERRORINFO = ICreateErrorInfo; interface ISupportErrorInfo : IUnknown { HRESULT InterfaceSupportsErrorInfo(REFIID); } -alias ISupportErrorInfo LPSUPPORTERRORINFO; +alias LPSUPPORTERRORINFO = ISupportErrorInfo; interface IRecordInfo : IUnknown { HRESULT RecordInit(PVOID); @@ -667,7 +667,7 @@ interface IRecordInfo : IUnknown { HRESULT RecordCreateCopy(PVOID, PVOID*); HRESULT RecordDestroy (PVOID); } -alias IRecordInfo LPRECORDINFO; +alias LPRECORDINFO = IRecordInfo; interface ITypeMarshal : IUnknown { HRESULT Size(PVOID, DWORD, PVOID, ULONG*); diff --git a/runtime/druntime/src/core/sys/windows/objbase.d b/runtime/druntime/src/core/sys/windows/objbase.d index 350c2b88396..5d63fa168cd 100644 --- a/runtime/druntime/src/core/sys/windows/objbase.d +++ b/runtime/druntime/src/core/sys/windows/objbase.d @@ -87,8 +87,8 @@ extern (Windows) BOOL IsEqualGUID( REFGUID rguid2 ); -alias IsEqualGUID IsEqualIID; -alias IsEqualGUID IsEqualCLSID; +alias IsEqualIID = IsEqualGUID; +alias IsEqualCLSID = IsEqualGUID; enum COINIT { COINIT_APARTMENTTHREADED = 2, @@ -103,8 +103,8 @@ enum STDMSHLFLAGS { } extern(Windows) { - alias HRESULT function(REFCLSID, REFIID, PVOID*) LPFNGETCLASSOBJECT; - alias HRESULT function() LPFNCANUNLOADNOW; + alias LPFNGETCLASSOBJECT = HRESULT function(REFCLSID, REFIID, PVOID*); + alias LPFNCANUNLOADNOW = HRESULT function(); DWORD CoBuildVersion(); HRESULT CoInitialize(PVOID); diff --git a/runtime/druntime/src/core/sys/windows/objfwd.d b/runtime/druntime/src/core/sys/windows/objfwd.d index 076e02e608c..1571775e4e2 100644 --- a/runtime/druntime/src/core/sys/windows/objfwd.d +++ b/runtime/druntime/src/core/sys/windows/objfwd.d @@ -59,45 +59,45 @@ extern(Windows) { interface IRpcStubBuffer; } +/ -alias IMoniker LPMONIKER; -alias IStream LPSTREAM; -alias IMarshal LPMARSHAL; -alias IMalloc LPMALLOC; -alias IMallocSpy LPMALLOCSPY; -alias IMessageFilter LPMESSAGEFILTER; -alias IPersist LPPERSIST; -alias IPersistStream LPPERSISTSTREAM; -alias IRunningObjectTable LPRUNNINGOBJECTTABLE; -alias IBindCtx LPBINDCTX, LPBC; -alias IAdviseSink LPADVISESINK; -alias IAdviseSink2 LPADVISESINK2; -alias IDataObject LPDATAOBJECT; -alias IDataAdviseHolder LPDATAADVISEHOLDER; -alias IEnumMoniker LPENUMMONIKER; -alias IEnumFORMATETC LPENUMFORMATETC; -alias IEnumSTATDATA LPENUMSTATDATA; -alias IEnumSTATSTG LPENUMSTATSTG; -alias IEnumSTATPROPSTG LPENUMSTATPROPSTG; -alias IEnumString LPENUMSTRING; -alias IEnumUnknown LPENUMUNKNOWN; -alias IStorage LPSTORAGE; -alias IPersistStorage LPPERSISTSTORAGE; -alias ILockBytes LPLOCKBYTES; -alias IStdMarshalInfo LPSTDMARSHALINFO; -alias IExternalConnection LPEXTERNALCONNECTION; -alias IRunnableObject LPRUNNABLEOBJECT; -alias IROTData LPROTDATA; -alias IPersistFile LPPERSISTFILE; -alias IRootStorage LPROOTSTORAGE; -alias IRpcChannelBuffer LPRPCCHANNELBUFFER; -alias IRpcProxyBuffer LPRPCPROXYBUFFER; -alias IRpcStubBuffer LPRPCSTUBBUFFER; -alias IPropertyStorage LPPROPERTYSTORAGE; -alias IEnumSTATPROPSETSTG LPENUMSTATPROPSETSTG; -alias IPropertySetStorage LPPROPERTYSETSTORAGE; -alias IClientSecurity LPCLIENTSECURITY; -alias IServerSecurity LPSERVERSECURITY; -alias IClassActivator LPCLASSACTIVATOR; -alias IFillLockBytes LPFILLLOCKBYTES; -alias IProgressNotify LPPROGRESSNOTIFY; -alias ILayoutStorage LPLAYOUTSTORAGE; +alias LPMONIKER = IMoniker; +alias LPSTREAM = IStream; +alias LPMARSHAL = IMarshal; +alias LPMALLOC = IMalloc; +alias LPMALLOCSPY = IMallocSpy; +alias LPMESSAGEFILTER = IMessageFilter; +alias LPPERSIST = IPersist; +alias LPPERSISTSTREAM = IPersistStream; +alias LPRUNNINGOBJECTTABLE = IRunningObjectTable; +alias LPBINDCTX = IBindCtx, LPBC = IBindCtx; +alias LPADVISESINK = IAdviseSink; +alias LPADVISESINK2 = IAdviseSink2; +alias LPDATAOBJECT = IDataObject; +alias LPDATAADVISEHOLDER = IDataAdviseHolder; +alias LPENUMMONIKER = IEnumMoniker; +alias LPENUMFORMATETC = IEnumFORMATETC; +alias LPENUMSTATDATA = IEnumSTATDATA; +alias LPENUMSTATSTG = IEnumSTATSTG; +alias LPENUMSTATPROPSTG = IEnumSTATPROPSTG; +alias LPENUMSTRING = IEnumString; +alias LPENUMUNKNOWN = IEnumUnknown; +alias LPSTORAGE = IStorage; +alias LPPERSISTSTORAGE = IPersistStorage; +alias LPLOCKBYTES = ILockBytes; +alias LPSTDMARSHALINFO = IStdMarshalInfo; +alias LPEXTERNALCONNECTION = IExternalConnection; +alias LPRUNNABLEOBJECT = IRunnableObject; +alias LPROTDATA = IROTData; +alias LPPERSISTFILE = IPersistFile; +alias LPROOTSTORAGE = IRootStorage; +alias LPRPCCHANNELBUFFER = IRpcChannelBuffer; +alias LPRPCPROXYBUFFER = IRpcProxyBuffer; +alias LPRPCSTUBBUFFER = IRpcStubBuffer; +alias LPPROPERTYSTORAGE = IPropertyStorage; +alias LPENUMSTATPROPSETSTG = IEnumSTATPROPSETSTG; +alias LPPROPERTYSETSTORAGE = IPropertySetStorage; +alias LPCLIENTSECURITY = IClientSecurity; +alias LPSERVERSECURITY = IServerSecurity; +alias LPCLASSACTIVATOR = IClassActivator; +alias LPFILLLOCKBYTES = IFillLockBytes; +alias LPPROGRESSNOTIFY = IProgressNotify; +alias LPLAYOUTSTORAGE = ILayoutStorage; diff --git a/runtime/druntime/src/core/sys/windows/objidl.d b/runtime/druntime/src/core/sys/windows/objidl.d index aa51840a51c..ab656c20ce3 100644 --- a/runtime/druntime/src/core/sys/windows/objidl.d +++ b/runtime/druntime/src/core/sys/windows/objidl.d @@ -54,7 +54,7 @@ struct INTERFACEINFO { IID iid; WORD wMethod; } -alias INTERFACEINFO* LPINTERFACEINFO; +alias LPINTERFACEINFO = INTERFACEINFO*; enum CALLTYPE { CALLTYPE_TOPLEVEL = 1, @@ -75,14 +75,14 @@ enum PENDINGMSG { PENDINGMSG_WAITDEFPROCESS } -alias OLECHAR** SNB; +alias SNB = OLECHAR**; enum DATADIR { DATADIR_GET = 1, DATADIR_SET } -alias WORD CLIPFORMAT; -alias CLIPFORMAT* LPCLIPFORMAT; +alias CLIPFORMAT = WORD; +alias LPCLIPFORMAT = CLIPFORMAT*; struct DVTARGETDEVICE { DWORD tdSize; @@ -100,7 +100,7 @@ struct FORMATETC { LONG lindex; DWORD tymed; } -alias FORMATETC* LPFORMATETC; +alias LPFORMATETC = FORMATETC*; struct RemSTGMEDIUM { DWORD tymed; @@ -177,7 +177,7 @@ struct BIND_OPTS { DWORD grfMode; DWORD dwTickCountDeadline; } -alias BIND_OPTS* LPBIND_OPTS; +alias LPBIND_OPTS = BIND_OPTS*; struct BIND_OPTS2 { DWORD cbStruct; @@ -189,7 +189,7 @@ struct BIND_OPTS2 { LCID locale; COSERVERINFO* pServerInfo; } -alias BIND_OPTS2* LPBIND_OPTS2; +alias LPBIND_OPTS2 = BIND_OPTS2*; enum BIND_FLAGS { BIND_MAYBOTHERUSER = 1, @@ -209,7 +209,7 @@ struct STGMEDIUM { } LPUNKNOWN pUnkForRelease; } -alias STGMEDIUM* LPSTGMEDIUM; +alias LPSTGMEDIUM = STGMEDIUM*; enum LOCKTYPE { LOCK_WRITE = 1, @@ -217,7 +217,7 @@ enum LOCKTYPE { LOCK_ONLYONCE = 4 } -alias uint RPCOLEDATAREP; +alias RPCOLEDATAREP = uint; struct RPCOLEMESSAGE { PVOID reserved1; @@ -228,7 +228,7 @@ struct RPCOLEMESSAGE { PVOID[5] reserved2; ULONG rpcFlags; } -alias RPCOLEMESSAGE* PRPCOLEMESSAGE; +alias PRPCOLEMESSAGE = RPCOLEMESSAGE*; enum MKSYS { MKSYS_NONE, @@ -378,7 +378,7 @@ struct CACLSID { ULONG cElems; CLSID* pElems; } -alias PROPVARIANT* LPPROPVARIANT; +alias LPPROPVARIANT = PROPVARIANT*; struct CAPROPVARIANT { ULONG cElems; @@ -791,7 +791,7 @@ interface IPSFactoryBuffer : IUnknown { HRESULT CreateProxy(LPUNKNOWN, REFIID, LPRPCPROXYBUFFER*, PVOID*); HRESULT CreateStub(REFIID, LPUNKNOWN, LPRPCSTUBBUFFER*); } -alias IPSFactoryBuffer LPPSFACTORYBUFFER; +alias LPPSFACTORYBUFFER = IPSFactoryBuffer; interface ILockBytes : IUnknown { HRESULT ReadAt(ULARGE_INTEGER, PVOID, ULONG, ULONG*); diff --git a/runtime/druntime/src/core/sys/windows/ocidl.d b/runtime/druntime/src/core/sys/windows/ocidl.d index 9bacbf0f34f..b1cc0dea9e6 100644 --- a/runtime/druntime/src/core/sys/windows/ocidl.d +++ b/runtime/druntime/src/core/sys/windows/ocidl.d @@ -41,18 +41,18 @@ interface IBindHost : IUnknown //[Yes] #ifndef OLE2ANSI -alias TEXTMETRICW TEXTMETRICOLE; +alias TEXTMETRICOLE = TEXTMETRICW; //} else { //alias TEXTMETRIC TEXTMETRICOLE; //} -alias TEXTMETRICOLE* LPTEXTMETRICOLE; +alias LPTEXTMETRICOLE = TEXTMETRICOLE*; -alias DWORD OLE_COLOR; -alias UINT OLE_HANDLE; -alias int OLE_XPOS_HIMETRIC; -alias int OLE_YPOS_HIMETRIC; -alias int OLE_XSIZE_HIMETRIC; -alias int OLE_YSIZE_HIMETRIC; +alias OLE_COLOR = DWORD; +alias OLE_HANDLE = UINT; +alias OLE_XPOS_HIMETRIC = int; +alias OLE_YPOS_HIMETRIC = int; +alias OLE_XSIZE_HIMETRIC = int; +alias OLE_YSIZE_HIMETRIC = int; enum READYSTATE { READYSTATE_UNINITIALIZED = 0, @@ -124,7 +124,7 @@ struct POINTF { float x; float y; } -alias POINTF* LPPOINTF; +alias LPPOINTF = POINTF*; struct CONTROLINFO { ULONG cb; @@ -132,38 +132,38 @@ struct CONTROLINFO { USHORT cAccel; DWORD dwFlags; } -alias CONTROLINFO* LPCONTROLINFO; +alias LPCONTROLINFO = CONTROLINFO*; struct CONNECTDATA { LPUNKNOWN pUnk; DWORD dwCookie; } -alias CONNECTDATA* LPCONNECTDATA; +alias LPCONNECTDATA = CONNECTDATA*; struct LICINFO { int cbLicInfo; BOOL fRuntimeKeyAvail; BOOL fLicVerified; } -alias LICINFO* LPLICINFO; +alias LPLICINFO = LICINFO*; struct CAUUID { ULONG cElems; GUID* pElems; } -alias CAUUID* LPCAUUID; +alias LPCAUUID = CAUUID*; struct CALPOLESTR { ULONG cElems; LPOLESTR* pElems; } -alias CALPOLESTR* LPCALPOLESTR; +alias LPCALPOLESTR = CALPOLESTR*; struct CADWORD { ULONG cElems; DWORD* pElems; } -alias CADWORD* LPCADWORD; +alias LPCADWORD = CADWORD*; struct PROPPAGEINFO { ULONG cb; @@ -173,7 +173,7 @@ struct PROPPAGEINFO { LPOLESTR pszHelpFile; DWORD dwHelpContext; } -alias PROPPAGEINFO* LPPROPPAGEINFO; +alias LPPROPPAGEINFO = PROPPAGEINFO*; interface IOleControl : IUnknown { HRESULT GetControlInfo(LPCONTROLINFO); @@ -200,13 +200,13 @@ interface ISimpleFrameSite : IUnknown { interface IErrorLog : IUnknown { HRESULT AddError(LPCOLESTR, LPEXCEPINFO); } -alias IErrorLog LPERRORLOG; +alias LPERRORLOG = IErrorLog; interface IPropertyBag : IUnknown { HRESULT Read(LPCOLESTR, LPVARIANT, LPERRORLOG); HRESULT Write(LPCOLESTR, LPVARIANT); } -alias IPropertyBag LPPROPERTYBAG; +alias LPPROPERTYBAG = IPropertyBag; interface IPropertyBag2 : IUnknown { HRESULT Read(ULONG, PROPBAG2*, LPERRORLOG, VARIANT*, HRESULT*); @@ -215,7 +215,7 @@ interface IPropertyBag2 : IUnknown { HRESULT GetPropertyInfo(ULONG, ULONG, PROPBAG2*, ULONG*); HRESULT LoadObject(LPCOLESTR, DWORD, IUnknown, LPERRORLOG); } -alias IPropertyBag2 LPPROPERTYBAG2; +alias LPPROPERTYBAG2 = IPropertyBag2; interface IPersistPropertyBag : IPersist { HRESULT InitNew(); @@ -270,7 +270,7 @@ interface IEnumConnectionPoints : IUnknown { HRESULT Reset(); HRESULT Clone(LPENUMCONNECTIONPOINTS*); } -alias IEnumConnectionPoints LPENUMCONNECTIONPOINTS; +alias LPENUMCONNECTIONPOINTS = IEnumConnectionPoints; interface IConnectionPoint : IUnknown { HRESULT GetConnectionInterface(IID*); @@ -279,7 +279,7 @@ interface IConnectionPoint : IUnknown { HRESULT Unadvise(DWORD); HRESULT EnumConnections(LPENUMCONNECTIONS*); } -alias IConnectionPoint LPCONNECTIONPOINT; +alias LPCONNECTIONPOINT = IConnectionPoint; interface IEnumConnections : IUnknown { HRESULT Next(ULONG, LPCONNECTDATA, PULONG); @@ -287,7 +287,7 @@ interface IEnumConnections : IUnknown { HRESULT Reset(); HRESULT Clone(LPENUMCONNECTIONS*); } -alias IEnumConnections LPENUMCONNECTIONS; +alias LPENUMCONNECTIONS = IEnumConnections; interface IClassFactory2 : IClassFactory { HRESULT GetLicInfo(LPLICINFO); @@ -312,7 +312,7 @@ interface IPropertyPageSite : IUnknown { HRESULT GetPageContainer(LPUNKNOWN*); HRESULT TranslateAccelerator(LPMSG); } -alias IPropertyPageSite LPPROPERTYPAGESITE; +alias LPPROPERTYPAGESITE = IPropertyPageSite; interface IPropertyPage : IUnknown { HRESULT SetPageSite(LPPROPERTYPAGESITE); @@ -359,11 +359,11 @@ interface IFont : IUnknown { HRESULT ReleaseHfont(HFONT); HRESULT SetHdc(HDC); } -alias IFont LPFONT; +alias LPFONT = IFont; interface IFontDisp : IDispatch { } -alias IFontDisp LPFONTDISP; +alias LPFONTDISP = IFontDisp; interface IPicture : IUnknown { HRESULT get_Handle(OLE_HANDLE*); @@ -463,7 +463,7 @@ interface IOleUndoManager : IUnknown { HRESULT GetLastRedoDescription(BSTR*); HRESULT Enable(BOOL); } -alias IOleUndoManager LPOLEUNDOMANAGER; +alias LPOLEUNDOMANAGER = IOleUndoManager; interface IQuickActivate : IUnknown { HRESULT QuickActivate(QACONTAINER*, QACONTROL*); diff --git a/runtime/druntime/src/core/sys/windows/odbcinst.d b/runtime/druntime/src/core/sys/windows/odbcinst.d index ebacb5889ff..6120aaf5f10 100644 --- a/runtime/druntime/src/core/sys/windows/odbcinst.d +++ b/runtime/druntime/src/core/sys/windows/odbcinst.d @@ -142,27 +142,27 @@ static if (ODBCVER >= 0x0300) { } version (Unicode) { - alias SQLConfigDataSourceW SQLConfigDataSource; - alias SQLConfigDriverW SQLConfigDriver; - alias SQLCreateDataSourceW SQLCreateDataSource; - alias SQLGetAvailableDriversW SQLGetAvailableDrivers; - alias SQLGetInstalledDriversW SQLGetInstalledDrivers; - alias SQLGetPrivateProfileStringW SQLGetPrivateProfileString; - alias SQLGetTranslatorW SQLGetTranslator; - alias SQLInstallDriverW SQLInstallDriver; - alias SQLInstallDriverExW SQLInstallDriverEx; - alias SQLInstallDriverManagerW SQLInstallDriverManager; - alias SQLInstallerErrorW SQLInstallerError; - alias SQLInstallODBCW SQLInstallODBC; - deprecated alias SQLInstallTranslatorW SQLInstallTranslator; - alias SQLInstallTranslatorExW SQLInstallTranslatorEx; - alias SQLPostInstallerErrorW SQLPostInstallerError; - alias SQLReadFileDSNW SQLReadFileDSN; - alias SQLRemoveDriverW SQLRemoveDriver; - alias SQLRemoveDSNFromIniW SQLRemoveDSNFromIni; - alias SQLRemoveTranslatorW SQLRemoveTranslator; - alias SQLValidDSNW SQLValidDSN; - alias SQLWriteDSNToIniW SQLWriteDSNToIni; - alias SQLWriteFileDSNW SQLWriteFileDSN; - alias SQLWritePrivateProfileStringW SQLWritePrivateProfileString; + alias SQLConfigDataSource = SQLConfigDataSourceW; + alias SQLConfigDriver = SQLConfigDriverW; + alias SQLCreateDataSource = SQLCreateDataSourceW; + alias SQLGetAvailableDrivers = SQLGetAvailableDriversW; + alias SQLGetInstalledDrivers = SQLGetInstalledDriversW; + alias SQLGetPrivateProfileString = SQLGetPrivateProfileStringW; + alias SQLGetTranslator = SQLGetTranslatorW; + alias SQLInstallDriver = SQLInstallDriverW; + alias SQLInstallDriverEx = SQLInstallDriverExW; + alias SQLInstallDriverManager = SQLInstallDriverManagerW; + alias SQLInstallerError = SQLInstallerErrorW; + alias SQLInstallODBC = SQLInstallODBCW; + deprecated alias SQLInstallTranslator = SQLInstallTranslatorW; + alias SQLInstallTranslatorEx = SQLInstallTranslatorExW; + alias SQLPostInstallerError = SQLPostInstallerErrorW; + alias SQLReadFileDSN = SQLReadFileDSNW; + alias SQLRemoveDriver = SQLRemoveDriverW; + alias SQLRemoveDSNFromIni = SQLRemoveDSNFromIniW; + alias SQLRemoveTranslator = SQLRemoveTranslatorW; + alias SQLValidDSN = SQLValidDSNW; + alias SQLWriteDSNToIni = SQLWriteDSNToIniW; + alias SQLWriteFileDSN = SQLWriteFileDSNW; + alias SQLWritePrivateProfileString = SQLWritePrivateProfileStringW; } diff --git a/runtime/druntime/src/core/sys/windows/ole.d b/runtime/druntime/src/core/sys/windows/ole.d index 7c51d7a1be8..c5eb17d9f07 100644 --- a/runtime/druntime/src/core/sys/windows/ole.d +++ b/runtime/druntime/src/core/sys/windows/ole.d @@ -13,7 +13,7 @@ pragma(lib, "ole32"); import core.sys.windows.windef, core.sys.windows.wingdi, core.sys.windows.uuid; -alias LPCSTR OLE_LPCSTR; +alias OLE_LPCSTR = LPCSTR; /+#define LRESULT LONG #define HGLOBAL HANDLE+/ @@ -40,7 +40,7 @@ struct OLETARGETDEVICE { BYTE _otdData; BYTE* otdData() return { return &_otdData; } } -alias OLETARGETDEVICE* LPOLETARGETDEVICE; +alias LPOLETARGETDEVICE = OLETARGETDEVICE*; enum OLESTATUS { OLE_OK, @@ -144,7 +144,7 @@ enum OLEOPT_RENDER { olerender_format } -alias WORD OLECLIPFORMAT; +alias OLECLIPFORMAT = WORD; enum OLEOPT_UPDATE { oleupdate_always, @@ -156,7 +156,7 @@ enum OLEOPT_UPDATE { } alias HOBJECT = HANDLE; -alias LONG_PTR LHSERVER, LHCLIENTDOC, LHSERVERDOC; +alias LHSERVER = LONG_PTR, LHCLIENTDOC = LONG_PTR, LHSERVERDOC = LONG_PTR; struct OLEOBJECTVTBL { extern (Windows) { @@ -207,36 +207,36 @@ struct OLEOBJECTVTBL { //#endif } } -alias OLEOBJECTVTBL* LPOLEOBJECTVTBL; +alias LPOLEOBJECTVTBL = OLEOBJECTVTBL*; //#ifndef OLE_INTERNAL struct OLEOBJECT { LPOLEOBJECTVTBL lpvtbl; } -alias OLEOBJECT* LPOLEOBJECT; +alias LPOLEOBJECT = OLEOBJECT*; //#endif struct OLECLIENTVTBL { extern (Windows) int function(LPOLECLIENT, OLE_NOTIFICATION, LPOLEOBJECT) CallBack; } -alias OLECLIENTVTBL* LPOLECLIENTVTBL; +alias LPOLECLIENTVTBL = OLECLIENTVTBL*; struct OLECLIENT { LPOLECLIENTVTBL lpvtbl; } -alias OLECLIENT* LPOLECLIENT; +alias LPOLECLIENT = OLECLIENT*; struct OLESTREAMVTBL { extern (Windows): DWORD function(LPOLESTREAM, void*, DWORD) Get; DWORD function(LPOLESTREAM, void*, DWORD) Put; } -alias OLESTREAMVTBL* LPOLESTREAMVTBL; +alias LPOLESTREAMVTBL = OLESTREAMVTBL*; struct OLESTREAM { LPOLESTREAMVTBL lpstbl; } -alias OLESTREAM* LPOLESTREAM; +alias LPOLESTREAM = OLESTREAM*; enum OLE_SERVER_USE { OLE_SERVER_MULTI, @@ -257,12 +257,12 @@ struct OLESERVERVTBL { OLESTATUS function(LPOLESERVER) Release; OLESTATUS function(LPOLESERVER, HGLOBAL) Execute; } -alias OLESERVERVTBL* LPOLESERVERVTBL; +alias LPOLESERVERVTBL = OLESERVERVTBL*; struct OLESERVER { LPOLESERVERVTBL lpvtbl; } -alias OLESERVER* LPOLESERVER; +alias LPOLESERVER = OLESERVER*; struct OLESERVERDOCVTBL { extern (Windows): @@ -276,12 +276,12 @@ extern (Windows): OLESTATUS function(LPOLESERVERDOC, LOGPALETTE*) SetColorScheme; OLESTATUS function(LPOLESERVERDOC, HGLOBAL) Execute; } -alias OLESERVERDOCVTBL* LPOLESERVERDOCVTBL; +alias LPOLESERVERDOCVTBL = OLESERVERDOCVTBL*; struct OLESERVERDOC { LPOLESERVERDOCVTBL lpvtbl; } -alias OLESERVERDOC* LPOLESERVERDOC; +alias LPOLESERVERDOC = OLESERVERDOC*; extern (Windows) nothrow @nogc { OLESTATUS OleDelete(LPOLEOBJECT); diff --git a/runtime/druntime/src/core/sys/windows/ole2.d b/runtime/druntime/src/core/sys/windows/ole2.d index fcbbc8a3d2c..71ec1f9382a 100644 --- a/runtime/druntime/src/core/sys/windows/ole2.d +++ b/runtime/druntime/src/core/sys/windows/ole2.d @@ -38,7 +38,7 @@ align(8): struct OLESTREAM { LPOLESTREAMVTBL lpstbl; } -alias OLESTREAM* LPOLESTREAM; +alias LPOLESTREAM = OLESTREAM*; extern (Windows) { struct OLESTREAMVTBL { @@ -46,7 +46,7 @@ extern (Windows) { DWORD function (LPOLESTREAM, const(void)*, DWORD) Put; } } -alias OLESTREAMVTBL* LPOLESTREAMVTBL; +alias LPOLESTREAMVTBL = OLESTREAMVTBL*; extern (Windows) nothrow @nogc { HRESULT CreateDataAdviseHolder(LPDATAADVISEHOLDER*); diff --git a/runtime/druntime/src/core/sys/windows/oleacc.d b/runtime/druntime/src/core/sys/windows/oleacc.d index 8a97a93e347..1e2bbfe95ff 100644 --- a/runtime/druntime/src/core/sys/windows/oleacc.d +++ b/runtime/druntime/src/core/sys/windows/oleacc.d @@ -184,7 +184,7 @@ interface IAccessible : IDispatch { HRESULT put_accValue(VARIANT, BSTR); } -alias IAccessible LPACCESSIBLE; +alias LPACCESSIBLE = IAccessible; extern (Windows) nothrow @nogc { HRESULT AccessibleChildren(IAccessible, LONG, LONG, VARIANT*, LONG*); @@ -206,11 +206,11 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias CreateStdAccessibleProxyW CreateStdAccessibleProxy; - alias GetRoleTextW GetRoleText; - alias GetStateTextW GetStateText; + alias CreateStdAccessibleProxy = CreateStdAccessibleProxyW; + alias GetRoleText = GetRoleTextW; + alias GetStateText = GetStateTextW; } else { - alias CreateStdAccessibleProxyA CreateStdAccessibleProxy; - alias GetRoleTextA GetRoleText; - alias GetStateTextA GetStateText; + alias CreateStdAccessibleProxy = CreateStdAccessibleProxyA; + alias GetRoleText = GetRoleTextA; + alias GetStateText = GetStateTextA; } diff --git a/runtime/druntime/src/core/sys/windows/oleauto.d b/runtime/druntime/src/core/sys/windows/oleauto.d index cc7b937a03a..53b24fafd3b 100644 --- a/runtime/druntime/src/core/sys/windows/oleauto.d +++ b/runtime/druntime/src/core/sys/windows/oleauto.d @@ -175,7 +175,7 @@ struct PARAMDATA{ OLECHAR* szName; VARTYPE vt; } -alias PARAMDATA* LPPARAMDATA; +alias LPPARAMDATA = PARAMDATA*; struct METHODDATA{ OLECHAR* szName; @@ -187,13 +187,13 @@ struct METHODDATA{ WORD wFlags; VARTYPE vtReturn; } -alias METHODDATA* LPMETHODDATA; +alias LPMETHODDATA = METHODDATA*; struct INTERFACEDATA{ METHODDATA* pmethdata; UINT cMembers; } -alias INTERFACEDATA* LPINTERFACEDATA; +alias LPINTERFACEDATA = INTERFACEDATA*; struct UDATE { SYSTEMTIME st; @@ -220,10 +220,10 @@ deprecated { // not actually deprecated, but they aren't converted yet. interface ICreateTypeLib {} interface ICreateTypeLib2 {} - alias ICreateTypeInfo LPCREATETYPEINFO; - alias ICreateTypeInfo2 LPCREATETYPEINFO2; - alias ICreateTypeLib LPCREATETYPELIB; - alias ICreateTypeLib2 LPCREATETYPELIB2; + alias LPCREATETYPEINFO = ICreateTypeInfo; + alias LPCREATETYPEINFO2 = ICreateTypeInfo2; + alias LPCREATETYPELIB = ICreateTypeLib; + alias LPCREATETYPELIB2 = ICreateTypeLib2; } extern (Windows) nothrow @nogc { diff --git a/runtime/druntime/src/core/sys/windows/olectl.d b/runtime/druntime/src/core/sys/windows/olectl.d index df8266b142d..9aae47d37a5 100644 --- a/runtime/druntime/src/core/sys/windows/olectl.d +++ b/runtime/druntime/src/core/sys/windows/olectl.d @@ -291,35 +291,35 @@ enum { DISPID_PICT_RENDER // = 6 } -alias IOleControl LPOLECONTROL; -alias IOleControlSite LPOLECONTROLSITE; -alias ISimpleFrameSite LPSIMPLEFRAMESITE; -alias IPersistPropertyBag LPPERSISTPROPERTYBAG; -alias IPersistStreamInit LPPERSISTSTREAMINIT; -alias IPersistMemory LPPERSISTMEMORY; -alias IPropertyNotifySink LPPROPERTYNOTIFYSINK; -alias IProvideClassInfo LPPROVIDECLASSINFO; -alias IProvideClassInfo2 LPPROVIDECLASSINFO2; -alias IConnectionPointContainer LPCONNECTIONPOINTCONTAINER; -alias IClassFactory2 LPCLASSFACTORY2; -alias ISpecifyPropertyPages LPSPECIFYPROPERTYPAGES; -alias IPerPropertyBrowsing LPPERPROPERTYBROWSING; -alias IPropertyPage LPPROPERTYPAGE; -alias IPropertyPage2 LPPROPERTYPAGE2; - -alias IPicture LPPICTURE; -alias IPictureDisp LPPICTUREDISP; -alias int OLE_XPOS_PIXELS; -alias int OLE_YPOS_PIXELS; -alias int OLE_XSIZE_PIXELS; -alias int OLE_YSIZE_PIXELS; -alias float OLE_XPOS_CONTAINER; -alias float OLE_YPOS_CONTAINER; -alias float OLE_XSIZE_CONTAINER; - -alias VARIANT_BOOL OLE_OPTEXCLUSIVE; -alias VARIANT_BOOL OLE_CANCELBOOL; -alias VARIANT_BOOL OLE_ENABLEDEFAULTBOOL; +alias LPOLECONTROL = IOleControl; +alias LPOLECONTROLSITE = IOleControlSite; +alias LPSIMPLEFRAMESITE = ISimpleFrameSite; +alias LPPERSISTPROPERTYBAG = IPersistPropertyBag; +alias LPPERSISTSTREAMINIT = IPersistStreamInit; +alias LPPERSISTMEMORY = IPersistMemory; +alias LPPROPERTYNOTIFYSINK = IPropertyNotifySink; +alias LPPROVIDECLASSINFO = IProvideClassInfo; +alias LPPROVIDECLASSINFO2 = IProvideClassInfo2; +alias LPCONNECTIONPOINTCONTAINER = IConnectionPointContainer; +alias LPCLASSFACTORY2 = IClassFactory2; +alias LPSPECIFYPROPERTYPAGES = ISpecifyPropertyPages; +alias LPPERPROPERTYBROWSING = IPerPropertyBrowsing; +alias LPPROPERTYPAGE = IPropertyPage; +alias LPPROPERTYPAGE2 = IPropertyPage2; + +alias LPPICTURE = IPicture; +alias LPPICTUREDISP = IPictureDisp; +alias OLE_XPOS_PIXELS = int; +alias OLE_YPOS_PIXELS = int; +alias OLE_XSIZE_PIXELS = int; +alias OLE_YSIZE_PIXELS = int; +alias OLE_XPOS_CONTAINER = float; +alias OLE_YPOS_CONTAINER = float; +alias OLE_XSIZE_CONTAINER = float; + +alias OLE_OPTEXCLUSIVE = VARIANT_BOOL; +alias OLE_CANCELBOOL = VARIANT_BOOL; +alias OLE_ENABLEDEFAULTBOOL = VARIANT_BOOL; align(8): @@ -342,7 +342,7 @@ struct OCPFIPARAMS { LCID lcid; DISPID dispidInitialProperty; } -alias OCPFIPARAMS* LPOCPFIPARAMS; +alias LPOCPFIPARAMS = OCPFIPARAMS*; struct FONTDESC { UINT cbSizeofstruct; @@ -354,7 +354,7 @@ struct FONTDESC { BOOL fUnderline; BOOL fStrikethrough; } -alias FONTDESC* LPFONTDESC; +alias LPFONTDESC = FONTDESC*; struct PICTDESC { @@ -382,7 +382,7 @@ struct PICTDESC _emf emf; } } -alias PICTDESC* LPPICTDESC; +alias LPPICTDESC = PICTDESC*; extern(Windows) { HRESULT DllRegisterServer(); diff --git a/runtime/druntime/src/core/sys/windows/oledlg.d b/runtime/druntime/src/core/sys/windows/oledlg.d index 26e0a791609..486291c1eff 100644 --- a/runtime/druntime/src/core/sys/windows/oledlg.d +++ b/runtime/druntime/src/core/sys/windows/oledlg.d @@ -332,7 +332,7 @@ enum VPF_DISABLESCALE=4; align(8): extern (Windows) { - alias UINT function(HWND, UINT, WPARAM, LPARAM) LPFNOLEUIHOOK; + alias LPFNOLEUIHOOK = UINT function(HWND, UINT, WPARAM, LPARAM); } struct OLEUIINSERTOBJECTW { @@ -359,7 +359,7 @@ struct OLEUIINSERTOBJECTW { SCODE sc; HGLOBAL hMetaPict; } -alias OLEUIINSERTOBJECTW* POLEUIINSERTOBJECTW, LPOLEUIINSERTOBJECTW; +alias POLEUIINSERTOBJECTW = OLEUIINSERTOBJECTW*, LPOLEUIINSERTOBJECTW = OLEUIINSERTOBJECTW*; struct OLEUIINSERTOBJECTA { DWORD cbStruct; @@ -385,7 +385,7 @@ struct OLEUIINSERTOBJECTA { SCODE sc; HGLOBAL hMetaPict; } -alias OLEUIINSERTOBJECTA* POLEUIINSERTOBJECTA, LPOLEUIINSERTOBJECTA; +alias POLEUIINSERTOBJECTA = OLEUIINSERTOBJECTA*, LPOLEUIINSERTOBJECTA = OLEUIINSERTOBJECTA*; extern (Windows) nothrow @nogc { UINT OleUIInsertObjectW(LPOLEUIINSERTOBJECTW); @@ -414,7 +414,7 @@ struct OLEUIPASTEENTRYW { DWORD dwFlags; DWORD dwScratchSpace; } -alias OLEUIPASTEENTRYW* POLEUIPASTEENTRYW, LPOLEUIPASTEENTRYW; +alias POLEUIPASTEENTRYW = OLEUIPASTEENTRYW*, LPOLEUIPASTEENTRYW = OLEUIPASTEENTRYW*; struct OLEUIPASTEENTRYA { FORMATETC fmtetc; @@ -423,7 +423,7 @@ struct OLEUIPASTEENTRYA { DWORD dwFlags; DWORD dwScratchSpace; } -alias OLEUIPASTEENTRYA* POLEUIPASTEENTRYA, LPOLEUIPASTEENTRYA; +alias POLEUIPASTEENTRYA = OLEUIPASTEENTRYA*, LPOLEUIPASTEENTRYA = OLEUIPASTEENTRYA*; struct OLEUIPASTESPECIALW { DWORD cbStruct; @@ -447,7 +447,7 @@ struct OLEUIPASTESPECIALW { HGLOBAL hMetaPict; SIZEL sizel; } -alias OLEUIPASTESPECIALW* POLEUIPASTESPECIALW, LPOLEUIPASTESPECIALW; +alias POLEUIPASTESPECIALW = OLEUIPASTESPECIALW*, LPOLEUIPASTESPECIALW = OLEUIPASTESPECIALW*; struct OLEUIPASTESPECIALA { DWORD cbStruct; @@ -471,7 +471,7 @@ struct OLEUIPASTESPECIALA { HGLOBAL hMetaPict; SIZEL sizel; } -alias OLEUIPASTESPECIALA* POLEUIPASTESPECIALA, LPOLEUIPASTESPECIALA; +alias POLEUIPASTESPECIALA = OLEUIPASTESPECIALA*, LPOLEUIPASTESPECIALA = OLEUIPASTESPECIALA*; interface IOleUILinkContainerW : IUnknown { @@ -487,7 +487,7 @@ interface IOleUILinkContainerW : IUnknown HRESULT UpdateLink(DWORD, BOOL, BOOL); HRESULT CancelLink(DWORD); } -alias IOleUILinkContainerW LPOLEUILINKCONTAINERW; +alias LPOLEUILINKCONTAINERW = IOleUILinkContainerW; interface IOleUILinkContainerA : IUnknown { @@ -503,7 +503,7 @@ interface IOleUILinkContainerA : IUnknown HRESULT UpdateLink(DWORD, BOOL, BOOL); HRESULT CancelLink(DWORD); } -alias IOleUILinkContainerA LPOLEUILINKCONTAINERA; +alias LPOLEUILINKCONTAINERA = IOleUILinkContainerA; struct OLEUIEDITLINKSW { DWORD cbStruct; @@ -517,7 +517,7 @@ struct OLEUIEDITLINKSW { HRSRC hResource; LPOLEUILINKCONTAINERW lpOleUILinkContainer; } -alias OLEUIEDITLINKSW* POLEUIEDITLINKSW, LPOLEUIEDITLINKSW; +alias POLEUIEDITLINKSW = OLEUIEDITLINKSW*, LPOLEUIEDITLINKSW = OLEUIEDITLINKSW*; struct OLEUIEDITLINKSA { DWORD cbStruct; @@ -531,7 +531,7 @@ struct OLEUIEDITLINKSA { HRSRC hResource; LPOLEUILINKCONTAINERA lpOleUILinkContainer; } -alias OLEUIEDITLINKSA* POLEUIEDITLINKSA, LPOLEUIEDITLINKSA; +alias POLEUIEDITLINKSA = OLEUIEDITLINKSA*, LPOLEUIEDITLINKSA = OLEUIEDITLINKSA*; struct OLEUICHANGEICONW { DWORD cbStruct; @@ -548,7 +548,7 @@ struct OLEUICHANGEICONW { WCHAR[MAX_PATH] szIconExe = 0; int cchIconExe; } -alias OLEUICHANGEICONW* POLEUICHANGEICONW, LPOLEUICHANGEICONW; +alias POLEUICHANGEICONW = OLEUICHANGEICONW*, LPOLEUICHANGEICONW = OLEUICHANGEICONW*; struct OLEUICHANGEICONA { DWORD cbStruct; @@ -565,7 +565,7 @@ struct OLEUICHANGEICONA { CHAR[MAX_PATH] szIconExe = 0; int cchIconExe; } -alias OLEUICHANGEICONA* POLEUICHANGEICONA, LPOLEUICHANGEICONA; +alias POLEUICHANGEICONA = OLEUICHANGEICONA*, LPOLEUICHANGEICONA = OLEUICHANGEICONA*; struct OLEUICONVERTW { DWORD cbStruct; @@ -591,7 +591,7 @@ struct OLEUICONVERTW { UINT cClsidExclude; LPCLSID lpClsidExclude; } -alias OLEUICONVERTW* POLEUICONVERTW, LPOLEUICONVERTW; +alias POLEUICONVERTW = OLEUICONVERTW*, LPOLEUICONVERTW = OLEUICONVERTW*; struct OLEUICONVERTA { DWORD cbStruct; @@ -617,7 +617,7 @@ struct OLEUICONVERTA { UINT cClsidExclude; LPCLSID lpClsidExclude; } -alias OLEUICONVERTA* POLEUICONVERTA, LPOLEUICONVERTA; +alias POLEUICONVERTA = OLEUICONVERTA*, LPOLEUICONVERTA = OLEUICONVERTA*; struct OLEUIBUSYW { DWORD cbStruct; @@ -632,7 +632,7 @@ struct OLEUIBUSYW { HTASK hTask; HWND *lphWndDialog; } -alias OLEUIBUSYW* POLEUIBUSYW, LPOLEUIBUSYW; +alias POLEUIBUSYW = OLEUIBUSYW*, LPOLEUIBUSYW = OLEUIBUSYW*; struct OLEUIBUSYA { DWORD cbStruct; @@ -647,7 +647,7 @@ struct OLEUIBUSYA { HTASK hTask; HWND *lphWndDialog; } -alias OLEUIBUSYA* POLEUIBUSYA, LPOLEUIBUSYA; +alias POLEUIBUSYA = OLEUIBUSYA*, LPOLEUIBUSYA = OLEUIBUSYA*; struct OLEUICHANGESOURCEW { DWORD cbStruct; @@ -668,7 +668,7 @@ struct OLEUICHANGESOURCEW { LPWSTR lpszFrom; LPWSTR lpszTo; } -alias OLEUICHANGESOURCEW* POLEUICHANGESOURCEW, LPOLEUICHANGESOURCEW; +alias POLEUICHANGESOURCEW = OLEUICHANGESOURCEW*, LPOLEUICHANGESOURCEW = OLEUICHANGESOURCEW*; struct OLEUICHANGESOURCEA { DWORD cbStruct; @@ -689,7 +689,7 @@ struct OLEUICHANGESOURCEA { LPSTR lpszFrom; LPSTR lpszTo; } -alias OLEUICHANGESOURCEA* POLEUICHANGESOURCEA, LPOLEUICHANGESOURCEA; +alias POLEUICHANGESOURCEA = OLEUICHANGESOURCEA*, LPOLEUICHANGESOURCEA = OLEUICHANGESOURCEA*; interface IOleUIObjInfoW : IUnknown { @@ -702,7 +702,7 @@ interface IOleUIObjInfoW : IUnknown HRESULT GetViewInfo(DWORD, HGLOBAL*, PDWORD, int*); HRESULT SetViewInfo(DWORD, HGLOBAL, DWORD, int, BOOL); } -alias IOleUIObjInfoW LPOLEUIOBJINFOW; +alias LPOLEUIOBJINFOW = IOleUIObjInfoW; interface IOleUIObjInfoA : IUnknown { @@ -715,7 +715,7 @@ interface IOleUIObjInfoA : IUnknown HRESULT GetViewInfo(DWORD, HGLOBAL*, PDWORD, int*); HRESULT SetViewInfo(DWORD, HGLOBAL, DWORD, int, BOOL); } -alias IOleUIObjInfoA LPOLEUIOBJINFOA; +alias LPOLEUIOBJINFOA = IOleUIObjInfoA; interface IOleUILinkInfoW : IOleUILinkContainerW { @@ -732,7 +732,7 @@ interface IOleUILinkInfoW : IOleUILinkContainerW HRESULT CancelLink(DWORD); HRESULT GetLastUpdate(DWORD, FILETIME*); } -alias IOleUILinkInfoW LPOLEUILINKINFOW; +alias LPOLEUILINKINFOW = IOleUILinkInfoW; interface IOleUILinkInfoA : IOleUILinkContainerA { @@ -749,7 +749,7 @@ interface IOleUILinkInfoA : IOleUILinkContainerA HRESULT CancelLink(DWORD); HRESULT GetLastUpdate(DWORD, FILETIME*); } -alias IOleUILinkInfoA LPOLEUILINKINFOA; +alias LPOLEUILINKINFOA = IOleUILinkInfoA; struct OLEUIGNRLPROPSW { DWORD cbStruct; @@ -760,7 +760,7 @@ struct OLEUIGNRLPROPSW { DWORD[3] dwReserved2; OLEUIOBJECTPROPSW* lpOP; } -alias OLEUIGNRLPROPSW* POLEUIGNRLPROPSW, LPOLEUIGNRLPROPSW; +alias POLEUIGNRLPROPSW = OLEUIGNRLPROPSW*, LPOLEUIGNRLPROPSW = OLEUIGNRLPROPSW*; struct OLEUIGNRLPROPSA { DWORD cbStruct; @@ -771,7 +771,7 @@ struct OLEUIGNRLPROPSA { DWORD[3] dwReserved2; OLEUIOBJECTPROPSA* lpOP; } -alias OLEUIGNRLPROPSA* POLEUIGNRLPROPSA, LPOLEUIGNRLPROPSA; +alias POLEUIGNRLPROPSA = OLEUIGNRLPROPSA*, LPOLEUIGNRLPROPSA = OLEUIGNRLPROPSA*; struct OLEUIVIEWPROPSW { DWORD cbStruct; @@ -784,7 +784,7 @@ struct OLEUIVIEWPROPSW { int nScaleMin; int nScaleMax; } -alias OLEUIVIEWPROPSW* POLEUIVIEWPROPSW, LPOLEUIVIEWPROPSW; +alias POLEUIVIEWPROPSW = OLEUIVIEWPROPSW*, LPOLEUIVIEWPROPSW = OLEUIVIEWPROPSW*; struct OLEUIVIEWPROPSA { DWORD cbStruct; @@ -797,7 +797,7 @@ struct OLEUIVIEWPROPSA { int nScaleMin; int nScaleMax; } -alias OLEUIVIEWPROPSA* POLEUIVIEWPROPSA, LPOLEUIVIEWPROPSA; +alias POLEUIVIEWPROPSA = OLEUIVIEWPROPSA*, LPOLEUIVIEWPROPSA = OLEUIVIEWPROPSA*; struct OLEUILINKPROPSW { DWORD cbStruct; @@ -808,7 +808,7 @@ struct OLEUILINKPROPSW { DWORD[3] dwReserved2; OLEUIOBJECTPROPSW *lpOP; } -alias OLEUILINKPROPSW* POLEUILINKPROPSW, LPOLEUILINKPROPSW; +alias POLEUILINKPROPSW = OLEUILINKPROPSW*, LPOLEUILINKPROPSW = OLEUILINKPROPSW*; struct OLEUILINKPROPSA { DWORD cbStruct; @@ -819,7 +819,7 @@ struct OLEUILINKPROPSA { DWORD[3] dwReserved2; OLEUIOBJECTPROPSA* lpOP; } -alias OLEUILINKPROPSA* POLEUILINKPROPSA, LPOLEUILINKPROPSA; +alias POLEUILINKPROPSA = OLEUILINKPROPSA*, LPOLEUILINKPROPSA = OLEUILINKPROPSA*; struct OLEUIOBJECTPROPSW { DWORD cbStruct; @@ -833,7 +833,7 @@ struct OLEUIOBJECTPROPSW { LPOLEUIVIEWPROPSW lpVP; LPOLEUILINKPROPSW lpLP; } -alias OLEUIOBJECTPROPSW* POLEUIOBJECTPROPSW, LPOLEUIOBJECTPROPSW; +alias POLEUIOBJECTPROPSW = OLEUIOBJECTPROPSW*, LPOLEUIOBJECTPROPSW = OLEUIOBJECTPROPSW*; struct OLEUIOBJECTPROPSA { DWORD cbStruct; @@ -847,7 +847,7 @@ struct OLEUIOBJECTPROPSA { LPOLEUIVIEWPROPSA lpVP; LPOLEUILINKPROPSA lpLP; } -alias OLEUIOBJECTPROPSA* POLEUIOBJECTPROPSA, LPOLEUIOBJECTPROPSA; +alias POLEUIOBJECTPROPSA = OLEUIOBJECTPROPSA*, LPOLEUIOBJECTPROPSA = OLEUIOBJECTPROPSA*; extern (Windows) nothrow @nogc { BOOL OleUIAddVerbMenuW(LPOLEOBJECT, LPCWSTR, HMENU, UINT, UINT, UINT, BOOL, UINT, HMENU*); @@ -877,117 +877,117 @@ extern (C) { } version (Unicode) { - alias IDD_SERVERNOTREGW IDD_SERVERNOTREG; - alias IDD_LINKTYPECHANGEDW IDD_LINKTYPECHANGED; - alias OleUIUpdateLinksW OleUIUpdateLinks; - alias OleUIAddVerbMenuW OleUIAddVerbMenu; - alias OLEUIOBJECTPROPSW OLEUIOBJECTPROPS; - alias POLEUIOBJECTPROPSW POLEUIOBJECTPROPS; - alias LPOLEUIOBJECTPROPSW LPOLEUIOBJECTPROPS; - alias OleUIObjectPropertiesW OleUIObjectProperties; - alias OLEUIINSERTOBJECTW OLEUIINSERTOBJECT; - alias POLEUIINSERTOBJECTW POLEUIINSERTOBJECT; - alias LPOLEUIINSERTOBJECTW LPOLEUIINSERTOBJECT; - alias OleUIInsertObjectW OleUIInsertObject; - alias OleUIPromptUserW OleUIPromptUser; - alias OLEUIPASTEENTRYW OLEUIPASTEENTRY; - alias POLEUIPASTEENTRYW POLEUIPASTEENTRY; - alias LPOLEUIPASTEENTRYW LPOLEUIPASTEENTRY; - alias OLEUIPASTESPECIALW OLEUIPASTESPECIAL; - alias POLEUIPASTESPECIALW POLEUIPASTESPECIAL; - alias LPOLEUIPASTESPECIALW LPOLEUIPASTESPECIAL; - alias OleUIPasteSpecialW OleUIPasteSpecial; - alias IOleUILinkContainerW IOleUILinkContainer; - alias LPOLEUILINKCONTAINERW LPOLEUILINKCONTAINER; - alias OLEUIEDITLINKSW OLEUIEDITLINKS; - alias POLEUIEDITLINKSW POLEUIEDITLINKS; - alias LPOLEUIEDITLINKSW LPOLEUIEDITLINKS; - alias OleUIEditLinksW OleUIEditLinks; - alias OLEUICHANGEICONW OLEUICHANGEICON; - alias POLEUICHANGEICONW POLEUICHANGEICON; - alias LPOLEUICHANGEICONW LPOLEUICHANGEICON; - alias OleUIChangeIconW OleUIChangeIcon; - alias OLEUICONVERTW OLEUICONVERT; - alias POLEUICONVERTW POLEUICONVERT; - alias LPOLEUICONVERTW LPOLEUICONVERT; - alias OleUIConvertW OleUIConvert; - alias OLEUIBUSYW OLEUIBUSY; - alias POLEUIBUSYW POLEUIBUSY; - alias LPOLEUIBUSYW LPOLEUIBUSY; - alias OleUIBusyW OleUIBusy; - alias OLEUICHANGESOURCEW OLEUICHANGESOURCE; - alias POLEUICHANGESOURCEW POLEUICHANGESOURCE; - alias LPOLEUICHANGESOURCEW LPOLEUICHANGESOURCE; - alias OleUIChangeSourceW OleUIChangeSource; - alias IOleUIObjInfoW IOleUIObjInfo; - alias LPOLEUIOBJINFOW LPOLEUIOBJINFO; - alias IOleUILinkInfoW IOleUILinkInfo; + alias IDD_SERVERNOTREG = IDD_SERVERNOTREGW; + alias IDD_LINKTYPECHANGED = IDD_LINKTYPECHANGEDW; + alias OleUIUpdateLinks = OleUIUpdateLinksW; + alias OleUIAddVerbMenu = OleUIAddVerbMenuW; + alias OLEUIOBJECTPROPS = OLEUIOBJECTPROPSW; + alias POLEUIOBJECTPROPS = POLEUIOBJECTPROPSW; + alias LPOLEUIOBJECTPROPS = LPOLEUIOBJECTPROPSW; + alias OleUIObjectProperties = OleUIObjectPropertiesW; + alias OLEUIINSERTOBJECT = OLEUIINSERTOBJECTW; + alias POLEUIINSERTOBJECT = POLEUIINSERTOBJECTW; + alias LPOLEUIINSERTOBJECT = LPOLEUIINSERTOBJECTW; + alias OleUIInsertObject = OleUIInsertObjectW; + alias OleUIPromptUser = OleUIPromptUserW; + alias OLEUIPASTEENTRY = OLEUIPASTEENTRYW; + alias POLEUIPASTEENTRY = POLEUIPASTEENTRYW; + alias LPOLEUIPASTEENTRY = LPOLEUIPASTEENTRYW; + alias OLEUIPASTESPECIAL = OLEUIPASTESPECIALW; + alias POLEUIPASTESPECIAL = POLEUIPASTESPECIALW; + alias LPOLEUIPASTESPECIAL = LPOLEUIPASTESPECIALW; + alias OleUIPasteSpecial = OleUIPasteSpecialW; + alias IOleUILinkContainer = IOleUILinkContainerW; + alias LPOLEUILINKCONTAINER = LPOLEUILINKCONTAINERW; + alias OLEUIEDITLINKS = OLEUIEDITLINKSW; + alias POLEUIEDITLINKS = POLEUIEDITLINKSW; + alias LPOLEUIEDITLINKS = LPOLEUIEDITLINKSW; + alias OleUIEditLinks = OleUIEditLinksW; + alias OLEUICHANGEICON = OLEUICHANGEICONW; + alias POLEUICHANGEICON = POLEUICHANGEICONW; + alias LPOLEUICHANGEICON = LPOLEUICHANGEICONW; + alias OleUIChangeIcon = OleUIChangeIconW; + alias OLEUICONVERT = OLEUICONVERTW; + alias POLEUICONVERT = POLEUICONVERTW; + alias LPOLEUICONVERT = LPOLEUICONVERTW; + alias OleUIConvert = OleUIConvertW; + alias OLEUIBUSY = OLEUIBUSYW; + alias POLEUIBUSY = POLEUIBUSYW; + alias LPOLEUIBUSY = LPOLEUIBUSYW; + alias OleUIBusy = OleUIBusyW; + alias OLEUICHANGESOURCE = OLEUICHANGESOURCEW; + alias POLEUICHANGESOURCE = POLEUICHANGESOURCEW; + alias LPOLEUICHANGESOURCE = LPOLEUICHANGESOURCEW; + alias OleUIChangeSource = OleUIChangeSourceW; + alias IOleUIObjInfo = IOleUIObjInfoW; + alias LPOLEUIOBJINFO = LPOLEUIOBJINFOW; + alias IOleUILinkInfo = IOleUILinkInfoW; //alias IOleUILinkInfoWVtbl IOleUILinkInfoVtbl; - alias LPOLEUILINKINFOW LPOLEUILINKINFO; - alias OLEUIGNRLPROPSW OLEUIGNRLPROPS; - alias POLEUIGNRLPROPSW POLEUIGNRLPROPS; - alias LPOLEUIGNRLPROPSW LPOLEUIGNRLPROPS; - alias OLEUIVIEWPROPSW OLEUIVIEWPROPS; - alias POLEUIVIEWPROPSW POLEUIVIEWPROPS; - alias LPOLEUIVIEWPROPSW LPOLEUIVIEWPROPS; - alias OLEUILINKPROPSW OLEUILINKPROPS; - alias POLEUILINKPROPSW POLEUILINKPROPS; - alias LPOLEUILINKPROPSW LPOLEUILINKPROPS; + alias LPOLEUILINKINFO = LPOLEUILINKINFOW; + alias OLEUIGNRLPROPS = OLEUIGNRLPROPSW; + alias POLEUIGNRLPROPS = POLEUIGNRLPROPSW; + alias LPOLEUIGNRLPROPS = LPOLEUIGNRLPROPSW; + alias OLEUIVIEWPROPS = OLEUIVIEWPROPSW; + alias POLEUIVIEWPROPS = POLEUIVIEWPROPSW; + alias LPOLEUIVIEWPROPS = LPOLEUIVIEWPROPSW; + alias OLEUILINKPROPS = OLEUILINKPROPSW; + alias POLEUILINKPROPS = POLEUILINKPROPSW; + alias LPOLEUILINKPROPS = LPOLEUILINKPROPSW; } else { - alias IDD_SERVERNOTREGA IDD_SERVERNOTREG; - alias IDD_LINKTYPECHANGEDA IDD_LINKTYPECHANGED; - alias OleUIUpdateLinksA OleUIUpdateLinks; - alias OleUIAddVerbMenuA OleUIAddVerbMenu; - alias OLEUIOBJECTPROPSA OLEUIOBJECTPROPS; - alias POLEUIOBJECTPROPSA POLEUIOBJECTPROPS; - alias LPOLEUIOBJECTPROPSA LPOLEUIOBJECTPROPS; - alias OleUIObjectPropertiesA OleUIObjectProperties; - alias OLEUIINSERTOBJECTA OLEUIINSERTOBJECT; - alias POLEUIINSERTOBJECTA POLEUIINSERTOBJECT; - alias LPOLEUIINSERTOBJECTA LPOLEUIINSERTOBJECT; - alias OleUIInsertObjectA OleUIInsertObject; - alias OleUIPromptUserA OleUIPromptUser; - alias OLEUIPASTEENTRYA OLEUIPASTEENTRY; - alias POLEUIPASTEENTRYA POLEUIPASTEENTRY; - alias LPOLEUIPASTEENTRYA LPOLEUIPASTEENTRY; - alias OLEUIPASTESPECIALA OLEUIPASTESPECIAL; - alias POLEUIPASTESPECIALA POLEUIPASTESPECIAL; - alias LPOLEUIPASTESPECIALA LPOLEUIPASTESPECIAL; - alias OleUIPasteSpecialA OleUIPasteSpecial; - alias IOleUILinkContainerA IOleUILinkContainer; - alias LPOLEUILINKCONTAINERA LPOLEUILINKCONTAINER; - alias OLEUIEDITLINKSA OLEUIEDITLINKS; - alias POLEUIEDITLINKSA POLEUIEDITLINKS; - alias LPOLEUIEDITLINKSA LPOLEUIEDITLINKS; - alias OleUIEditLinksA OleUIEditLinks; - alias OLEUICHANGEICONA OLEUICHANGEICON; - alias POLEUICHANGEICONA POLEUICHANGEICON; - alias LPOLEUICHANGEICONA LPOLEUICHANGEICON; - alias OleUIChangeIconA OleUIChangeIcon; - alias OLEUICONVERTA OLEUICONVERT; - alias POLEUICONVERTA POLEUICONVERT; - alias LPOLEUICONVERTA LPOLEUICONVERT; - alias OleUIConvertA OleUIConvert; - alias OLEUIBUSYA OLEUIBUSY; - alias POLEUIBUSYA POLEUIBUSY; - alias LPOLEUIBUSYA LPOLEUIBUSY; - alias OleUIBusyA OleUIBusy; - alias OLEUICHANGESOURCEA OLEUICHANGESOURCE; - alias POLEUICHANGESOURCEA POLEUICHANGESOURCE; - alias LPOLEUICHANGESOURCEA LPOLEUICHANGESOURCE; - alias OleUIChangeSourceA OleUIChangeSource; - alias IOleUIObjInfoA IOleUIObjInfo; - alias LPOLEUIOBJINFOA LPOLEUIOBJINFO; - alias IOleUILinkInfoA IOleUILinkInfo; + alias IDD_SERVERNOTREG = IDD_SERVERNOTREGA; + alias IDD_LINKTYPECHANGED = IDD_LINKTYPECHANGEDA; + alias OleUIUpdateLinks = OleUIUpdateLinksA; + alias OleUIAddVerbMenu = OleUIAddVerbMenuA; + alias OLEUIOBJECTPROPS = OLEUIOBJECTPROPSA; + alias POLEUIOBJECTPROPS = POLEUIOBJECTPROPSA; + alias LPOLEUIOBJECTPROPS = LPOLEUIOBJECTPROPSA; + alias OleUIObjectProperties = OleUIObjectPropertiesA; + alias OLEUIINSERTOBJECT = OLEUIINSERTOBJECTA; + alias POLEUIINSERTOBJECT = POLEUIINSERTOBJECTA; + alias LPOLEUIINSERTOBJECT = LPOLEUIINSERTOBJECTA; + alias OleUIInsertObject = OleUIInsertObjectA; + alias OleUIPromptUser = OleUIPromptUserA; + alias OLEUIPASTEENTRY = OLEUIPASTEENTRYA; + alias POLEUIPASTEENTRY = POLEUIPASTEENTRYA; + alias LPOLEUIPASTEENTRY = LPOLEUIPASTEENTRYA; + alias OLEUIPASTESPECIAL = OLEUIPASTESPECIALA; + alias POLEUIPASTESPECIAL = POLEUIPASTESPECIALA; + alias LPOLEUIPASTESPECIAL = LPOLEUIPASTESPECIALA; + alias OleUIPasteSpecial = OleUIPasteSpecialA; + alias IOleUILinkContainer = IOleUILinkContainerA; + alias LPOLEUILINKCONTAINER = LPOLEUILINKCONTAINERA; + alias OLEUIEDITLINKS = OLEUIEDITLINKSA; + alias POLEUIEDITLINKS = POLEUIEDITLINKSA; + alias LPOLEUIEDITLINKS = LPOLEUIEDITLINKSA; + alias OleUIEditLinks = OleUIEditLinksA; + alias OLEUICHANGEICON = OLEUICHANGEICONA; + alias POLEUICHANGEICON = POLEUICHANGEICONA; + alias LPOLEUICHANGEICON = LPOLEUICHANGEICONA; + alias OleUIChangeIcon = OleUIChangeIconA; + alias OLEUICONVERT = OLEUICONVERTA; + alias POLEUICONVERT = POLEUICONVERTA; + alias LPOLEUICONVERT = LPOLEUICONVERTA; + alias OleUIConvert = OleUIConvertA; + alias OLEUIBUSY = OLEUIBUSYA; + alias POLEUIBUSY = POLEUIBUSYA; + alias LPOLEUIBUSY = LPOLEUIBUSYA; + alias OleUIBusy = OleUIBusyA; + alias OLEUICHANGESOURCE = OLEUICHANGESOURCEA; + alias POLEUICHANGESOURCE = POLEUICHANGESOURCEA; + alias LPOLEUICHANGESOURCE = LPOLEUICHANGESOURCEA; + alias OleUIChangeSource = OleUIChangeSourceA; + alias IOleUIObjInfo = IOleUIObjInfoA; + alias LPOLEUIOBJINFO = LPOLEUIOBJINFOA; + alias IOleUILinkInfo = IOleUILinkInfoA; //alias IOleUILinkInfoAVtbl IOleUILinkInfoVtbl; - alias LPOLEUILINKINFOA LPOLEUILINKINFO; - alias OLEUIGNRLPROPSA OLEUIGNRLPROPS; - alias POLEUIGNRLPROPSA POLEUIGNRLPROPS; - alias LPOLEUIGNRLPROPSA LPOLEUIGNRLPROPS; - alias OLEUIVIEWPROPSA OLEUIVIEWPROPS; - alias POLEUIVIEWPROPSA POLEUIVIEWPROPS; - alias LPOLEUIVIEWPROPSA LPOLEUIVIEWPROPS; - alias OLEUILINKPROPSA OLEUILINKPROPS; - alias POLEUILINKPROPSA POLEUILINKPROPS; - alias LPOLEUILINKPROPSA LPOLEUILINKPROPS; + alias LPOLEUILINKINFO = LPOLEUILINKINFOA; + alias OLEUIGNRLPROPS = OLEUIGNRLPROPSA; + alias POLEUIGNRLPROPS = POLEUIGNRLPROPSA; + alias LPOLEUIGNRLPROPS = LPOLEUIGNRLPROPSA; + alias OLEUIVIEWPROPS = OLEUIVIEWPROPSA; + alias POLEUIVIEWPROPS = POLEUIVIEWPROPSA; + alias LPOLEUIVIEWPROPS = LPOLEUIVIEWPROPSA; + alias OLEUILINKPROPS = OLEUILINKPROPSA; + alias POLEUILINKPROPS = POLEUILINKPROPSA; + alias LPOLEUILINKPROPS = LPOLEUILINKPROPSA; } diff --git a/runtime/druntime/src/core/sys/windows/oleidl.d b/runtime/druntime/src/core/sys/windows/oleidl.d index 17e1d647b32..fdd320b2ac8 100644 --- a/runtime/druntime/src/core/sys/windows/oleidl.d +++ b/runtime/druntime/src/core/sys/windows/oleidl.d @@ -56,9 +56,9 @@ enum DROPEFFECT { struct OLEMENUGROUPWIDTHS { LONG[6] width; } -alias OLEMENUGROUPWIDTHS* LPOLEMENUGROUPWIDTHS; +alias LPOLEMENUGROUPWIDTHS = OLEMENUGROUPWIDTHS*; -alias HGLOBAL HOLEMENU; +alias HOLEMENU = HGLOBAL; enum OLECLOSE { OLECLOSE_SAVEIFDIRTY, @@ -72,11 +72,11 @@ struct OLEVERB { DWORD fuFlags; DWORD grfAttribs; } -alias OLEVERB* LPOLEVERB; +alias LPOLEVERB = OLEVERB*; -alias RECT BORDERWIDTHS; -alias LPRECT LPBORDERWIDTHS; -alias LPCRECT LPCBORDERWIDTHS; +alias BORDERWIDTHS = RECT; +alias LPBORDERWIDTHS = LPRECT; +alias LPCBORDERWIDTHS = LPCRECT; struct OLEINPLACEFRAMEINFO { UINT cb; @@ -85,7 +85,7 @@ struct OLEINPLACEFRAMEINFO { HACCEL haccel; UINT cAccelEntries; } -alias OLEINPLACEFRAMEINFO* LPOLEINPLACEFRAMEINFO; +alias LPOLEINPLACEFRAMEINFO = OLEINPLACEFRAMEINFO*; interface IEnumOLEVERB : IUnknown { @@ -95,19 +95,19 @@ interface IEnumOLEVERB : IUnknown HRESULT Clone(IEnumOLEVERB*); } //alias IEnumOLEVERB IEnumOleVerb; -alias IEnumOLEVERB LPENUMOLEVERB; +alias LPENUMOLEVERB = IEnumOLEVERB; interface IParseDisplayName : IUnknown { HRESULT ParseDisplayName(IBindCtx,LPOLESTR,ULONG*,IMoniker*); } -alias IParseDisplayName LPPARSEDISPLAYNAME; +alias LPPARSEDISPLAYNAME = IParseDisplayName; interface IOleContainer : IParseDisplayName { HRESULT EnumObjects(DWORD,IEnumUnknown*); HRESULT LockContainer(BOOL); } -alias IOleContainer LPOLECONTAINER; +alias LPOLECONTAINER = IOleContainer; interface IOleItemContainer : IOleContainer { HRESULT GetObject(LPOLESTR,DWORD,IBindCtx,REFIID,void**); @@ -124,7 +124,7 @@ interface IOleClientSite : IUnknown { HRESULT OnShowWindow(BOOL); HRESULT RequestNewObjectLayout(); } -alias IOleClientSite LPOLECLIENTSITE; +alias LPOLECLIENTSITE = IOleClientSite; interface IOleObject : IUnknown { HRESULT SetClientSite(LPOLECLIENTSITE); @@ -149,13 +149,13 @@ interface IOleObject : IUnknown { HRESULT GetMiscStatus(DWORD,PDWORD); HRESULT SetColorScheme(LPLOGPALETTE); } -alias IOleObject LPOLEOBJECT; +alias LPOLEOBJECT = IOleObject; interface IOleWindow : IUnknown { HRESULT GetWindow(HWND*); HRESULT ContextSensitiveHelp(BOOL); } -alias IOleWindow LPOLEWINDOW; +alias LPOLEWINDOW = IOleWindow; interface IOleInPlaceUIWindow : IOleWindow { HRESULT GetBorder(LPRECT); @@ -163,7 +163,7 @@ interface IOleInPlaceUIWindow : IOleWindow { HRESULT SetBorderSpace(LPCBORDERWIDTHS); HRESULT SetActiveObject(LPOLEINPLACEACTIVEOBJECT,LPCOLESTR); } -alias IOleInPlaceUIWindow LPOLEINPLACEUIWINDOW; +alias LPOLEINPLACEUIWINDOW = IOleInPlaceUIWindow; interface IOleInPlaceObject : IOleWindow { HRESULT InPlaceDeactivate(); @@ -180,7 +180,7 @@ interface IOleInPlaceActiveObject : IOleWindow { HRESULT ResizeBorder(LPCRECT,LPOLEINPLACEUIWINDOW,BOOL); HRESULT EnableModeless(BOOL); } -alias IOleInPlaceActiveObject LPOLEINPLACEACTIVEOBJECT; +alias LPOLEINPLACEACTIVEOBJECT = IOleInPlaceActiveObject; interface IOleInPlaceFrame : IOleInPlaceUIWindow { HRESULT InsertMenus(HMENU,LPOLEMENUGROUPWIDTHS); @@ -190,7 +190,7 @@ interface IOleInPlaceFrame : IOleInPlaceUIWindow { HRESULT EnableModeless(BOOL); HRESULT TranslateAccelerator(LPMSG,WORD); } -alias IOleInPlaceFrame LPOLEINPLACEFRAME; +alias LPOLEINPLACEFRAME = IOleInPlaceFrame; interface IOleInPlaceSite : IOleWindow { HRESULT CanInPlaceActivate(); @@ -213,13 +213,13 @@ interface IOleAdviseHolder : IUnknown { HRESULT SendOnSave(); HRESULT SendOnClose(); } -alias IOleAdviseHolder LPOLEADVISEHOLDER; +alias LPOLEADVISEHOLDER = IOleAdviseHolder; interface IDropSource : IUnknown { HRESULT QueryContinueDrag(BOOL,DWORD); HRESULT GiveFeedback(DWORD); } -alias IDropSource LPDROPSOURCE; +alias LPDROPSOURCE = IDropSource; interface IDropTarget : IUnknown { HRESULT DragEnter(LPDATAOBJECT,DWORD,POINTL,PDWORD); @@ -227,10 +227,10 @@ interface IDropTarget : IUnknown { HRESULT DragLeave(); HRESULT Drop(LPDATAOBJECT,DWORD,POINTL,PDWORD); } -alias IDropTarget LPDROPTARGET; +alias LPDROPTARGET = IDropTarget; extern (Windows) { - alias BOOL function(ULONG_PTR) __IView_pfncont; + alias __IView_pfncont = BOOL function(ULONG_PTR); } interface IViewObject : IUnknown { @@ -241,12 +241,12 @@ interface IViewObject : IUnknown { HRESULT SetAdvise(DWORD,DWORD,IAdviseSink); HRESULT GetAdvise(PDWORD,PDWORD,IAdviseSink*); } -alias IViewObject LPVIEWOBJECT; +alias LPVIEWOBJECT = IViewObject; interface IViewObject2 : IViewObject { HRESULT GetExtent(DWORD,LONG,DVTARGETDEVICE*,LPSIZEL); } -alias IViewObject2 LPVIEWOBJECT2; +alias LPVIEWOBJECT2 = IViewObject2; interface IOleCache : IUnknown { HRESULT Cache(FORMATETC*,DWORD,DWORD*); @@ -255,16 +255,16 @@ interface IOleCache : IUnknown { HRESULT InitCache(LPDATAOBJECT); HRESULT SetData(FORMATETC*,STGMEDIUM*,BOOL); } -alias IOleCache LPOLECACHE; +alias LPOLECACHE = IOleCache; interface IOleCache2 : IOleCache { HRESULT UpdateCache(LPDATAOBJECT,DWORD,LPVOID); HRESULT DiscardCache(DWORD); } -alias IOleCache2 LPOLECACHE2; +alias LPOLECACHE2 = IOleCache2; interface IOleCacheControl : IUnknown { HRESULT OnRun(LPDATAOBJECT); HRESULT OnStop(); } -alias IOleCacheControl LPOLECACHECONTROL; +alias LPOLECACHECONTROL = IOleCacheControl; diff --git a/runtime/druntime/src/core/sys/windows/powrprof.d b/runtime/druntime/src/core/sys/windows/powrprof.d index be4d0aa2d20..5bc41310923 100644 --- a/runtime/druntime/src/core/sys/windows/powrprof.d +++ b/runtime/druntime/src/core/sys/windows/powrprof.d @@ -31,7 +31,7 @@ struct GLOBAL_MACHINE_POWER_POLICY { SYSTEM_POWER_STATE LidOpenWakeDc; ULONG BroadcastCapacityResolution; } -alias GLOBAL_MACHINE_POWER_POLICY* PGLOBAL_MACHINE_POWER_POLICY; +alias PGLOBAL_MACHINE_POWER_POLICY = GLOBAL_MACHINE_POWER_POLICY*; struct GLOBAL_USER_POWER_POLICY { ULONG Revision; @@ -44,13 +44,13 @@ struct GLOBAL_USER_POWER_POLICY { SYSTEM_POWER_LEVEL[NUM_DISCHARGE_POLICIES] DischargePolicy; ULONG GlobalFlags; } -alias GLOBAL_USER_POWER_POLICY* PGLOBAL_USER_POWER_POLICY; +alias PGLOBAL_USER_POWER_POLICY = GLOBAL_USER_POWER_POLICY*; struct GLOBAL_POWER_POLICY { GLOBAL_USER_POWER_POLICY user; GLOBAL_MACHINE_POWER_POLICY mach; } -alias GLOBAL_POWER_POLICY* PGLOBAL_POWER_POLICY; +alias PGLOBAL_POWER_POLICY = GLOBAL_POWER_POLICY*; struct MACHINE_POWER_POLICY { ULONG Revision; @@ -68,14 +68,14 @@ struct MACHINE_POWER_POLICY { POWER_ACTION_POLICY OverThrottledAc; POWER_ACTION_POLICY OverThrottledDc; } -alias MACHINE_POWER_POLICY* PMACHINE_POWER_POLICY; +alias PMACHINE_POWER_POLICY = MACHINE_POWER_POLICY*; struct MACHINE_PROCESSOR_POWER_POLICY { ULONG Revision; PROCESSOR_POWER_POLICY ProcessorPolicyAc; PROCESSOR_POWER_POLICY ProcessorPolicyDc; } -alias MACHINE_PROCESSOR_POWER_POLICY* PMACHINE_PROCESSOR_POWER_POLICY; +alias PMACHINE_PROCESSOR_POWER_POLICY = MACHINE_PROCESSOR_POWER_POLICY*; struct USER_POWER_POLICY { ULONG Revision; @@ -101,19 +101,18 @@ struct USER_POWER_POLICY { UCHAR ForcedThrottleAc; UCHAR ForcedThrottleDc; } -alias USER_POWER_POLICY* PUSER_POWER_POLICY; +alias PUSER_POWER_POLICY = USER_POWER_POLICY*; struct POWER_POLICY { USER_POWER_POLICY user; MACHINE_POWER_POLICY mach; } -alias POWER_POLICY* PPOWER_POLICY; +alias PPOWER_POLICY = POWER_POLICY*; extern (Windows) { - alias BOOLEAN function(UINT, DWORD, LPTSTR, DWORD, LPTSTR, PPOWER_POLICY, - LPARAM) PWRSCHEMESENUMPROC; - alias BOOLEAN function(POWER_ACTION, SYSTEM_POWER_STATE, ULONG, BOOLEAN) - PFNNTINITIATEPWRACTION; + alias PWRSCHEMESENUMPROC = BOOLEAN function(UINT, DWORD, LPTSTR, DWORD, LPTSTR, PPOWER_POLICY, + LPARAM); + alias PFNNTINITIATEPWRACTION = BOOLEAN function(POWER_ACTION, SYSTEM_POWER_STATE, ULONG, BOOLEAN); NTSTATUS CallNtPowerInformation(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG); diff --git a/runtime/druntime/src/core/sys/windows/prsht.d b/runtime/druntime/src/core/sys/windows/prsht.d index 570d1689b38..b3a7a2fd2f0 100644 --- a/runtime/druntime/src/core/sys/windows/prsht.d +++ b/runtime/druntime/src/core/sys/windows/prsht.d @@ -190,9 +190,9 @@ enum { } extern (Windows) { - alias UINT function(HWND, UINT, LPPROPSHEETPAGEA) LPFNPSPCALLBACKA; - alias UINT function(HWND, UINT, LPPROPSHEETPAGEW) LPFNPSPCALLBACKW; - alias int function(HWND, UINT, LPARAM) PFNPROPSHEETCALLBACK; + alias LPFNPSPCALLBACKA = UINT function(HWND, UINT, LPPROPSHEETPAGEA); + alias LPFNPSPCALLBACKW = UINT function(HWND, UINT, LPPROPSHEETPAGEW); + alias PFNPROPSHEETCALLBACK = int function(HWND, UINT, LPARAM); } align(4): @@ -219,8 +219,8 @@ struct PROPSHEETPAGEA { LPCSTR pszHeaderSubTitle; } } -alias PROPSHEETPAGEA* LPPROPSHEETPAGEA; -alias const(PROPSHEETPAGEA)* LPCPROPSHEETPAGEA; +alias LPPROPSHEETPAGEA = PROPSHEETPAGEA*; +alias LPCPROPSHEETPAGEA = const(PROPSHEETPAGEA)*; struct PROPSHEETPAGEW { DWORD dwSize = PROPSHEETPAGEW.sizeof; @@ -244,8 +244,8 @@ struct PROPSHEETPAGEW { LPCWSTR pszHeaderSubTitle; } } -alias PROPSHEETPAGEW* LPPROPSHEETPAGEW; -alias const(PROPSHEETPAGEW)* LPCPROPSHEETPAGEW; +alias LPPROPSHEETPAGEW = PROPSHEETPAGEW*; +alias LPCPROPSHEETPAGEW = const(PROPSHEETPAGEW)*; alias HPROPSHEETPAGE = HANDLE; @@ -281,8 +281,8 @@ struct PROPSHEETHEADERA { } } } -alias PROPSHEETHEADERA* LPPROPSHEETHEADERA; -alias const(PROPSHEETHEADERA)* LPCPROPSHEETHEADERA; +alias LPPROPSHEETHEADERA = PROPSHEETHEADERA*; +alias LPCPROPSHEETHEADERA = const(PROPSHEETHEADERA)*; struct PROPSHEETHEADERW { DWORD dwSize = PROPSHEETHEADERW.sizeof; @@ -316,20 +316,19 @@ struct PROPSHEETHEADERW { } } } -alias PROPSHEETHEADERW* LPPROPSHEETHEADERW; -alias const(PROPSHEETHEADERW)* LPCPROPSHEETHEADERW; +alias LPPROPSHEETHEADERW = PROPSHEETHEADERW*; +alias LPCPROPSHEETHEADERW = const(PROPSHEETHEADERW)*; extern (Windows) { - alias BOOL function(HPROPSHEETPAGE, LPARAM) LPFNADDPROPSHEETPAGE; - alias BOOL function(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM) - LPFNADDPROPSHEETPAGES; + alias LPFNADDPROPSHEETPAGE = BOOL function(HPROPSHEETPAGE, LPARAM); + alias LPFNADDPROPSHEETPAGES = BOOL function(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM); } struct PSHNOTIFY { NMHDR hdr; LPARAM lParam; } -alias PSHNOTIFY* LPPSHNOTIFY; +alias LPPSHNOTIFY = PSHNOTIFY*; extern (Windows) nothrow @nogc { HPROPSHEETPAGE CreatePropertySheetPageA(LPCPROPSHEETPAGEA); @@ -340,29 +339,29 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias LPFNPSPCALLBACKW LPFNPSPCALLBACK; - alias PROPSHEETPAGEW PROPSHEETPAGE; - alias LPPROPSHEETPAGEW LPPROPSHEETPAGE; - alias LPCPROPSHEETPAGEW LPCPROPSHEETPAGE; - alias PROPSHEETHEADERW PROPSHEETHEADER; - alias LPPROPSHEETHEADERW LPPROPSHEETHEADER; - alias LPCPROPSHEETHEADERW LPCPROPSHEETHEADER; - alias PSM_SETTITLEW PSM_SETTITLE; - alias PSM_SETFINISHTEXTW PSM_SETFINISHTEXT; - alias CreatePropertySheetPageW CreatePropertySheetPage; - alias PropertySheetW PropertySheet; + alias LPFNPSPCALLBACK = LPFNPSPCALLBACKW; + alias PROPSHEETPAGE = PROPSHEETPAGEW; + alias LPPROPSHEETPAGE = LPPROPSHEETPAGEW; + alias LPCPROPSHEETPAGE = LPCPROPSHEETPAGEW; + alias PROPSHEETHEADER = PROPSHEETHEADERW; + alias LPPROPSHEETHEADER = LPPROPSHEETHEADERW; + alias LPCPROPSHEETHEADER = LPCPROPSHEETHEADERW; + alias PSM_SETTITLE = PSM_SETTITLEW; + alias PSM_SETFINISHTEXT = PSM_SETFINISHTEXTW; + alias CreatePropertySheetPage = CreatePropertySheetPageW; + alias PropertySheet = PropertySheetW; } else { - alias LPFNPSPCALLBACKA LPFNPSPCALLBACK; - alias PROPSHEETPAGEA PROPSHEETPAGE; - alias LPPROPSHEETPAGEA LPPROPSHEETPAGE; - alias LPCPROPSHEETPAGEA LPCPROPSHEETPAGE; - alias PROPSHEETHEADERA PROPSHEETHEADER; - alias LPPROPSHEETHEADERA LPPROPSHEETHEADER; - alias LPCPROPSHEETHEADERA LPCPROPSHEETHEADER; - alias PSM_SETTITLEA PSM_SETTITLE; - alias PSM_SETFINISHTEXTA PSM_SETFINISHTEXT; - alias CreatePropertySheetPageA CreatePropertySheetPage; - alias PropertySheetA PropertySheet; + alias LPFNPSPCALLBACK = LPFNPSPCALLBACKA; + alias PROPSHEETPAGE = PROPSHEETPAGEA; + alias LPPROPSHEETPAGE = LPPROPSHEETPAGEA; + alias LPCPROPSHEETPAGE = LPCPROPSHEETPAGEA; + alias PROPSHEETHEADER = PROPSHEETHEADERA; + alias LPPROPSHEETHEADER = LPPROPSHEETHEADERA; + alias LPCPROPSHEETHEADER = LPCPROPSHEETHEADERA; + alias PSM_SETTITLE = PSM_SETTITLEA; + alias PSM_SETFINISHTEXT = PSM_SETFINISHTEXTA; + alias CreatePropertySheetPage = CreatePropertySheetPageA; + alias PropertySheet = PropertySheetA; } BOOL PropSheet_SetCurSel(HWND hPropSheetDlg, HPROPSHEETPAGE hpage, diff --git a/runtime/druntime/src/core/sys/windows/psapi.d b/runtime/druntime/src/core/sys/windows/psapi.d index 42fc5fdd6bd..75f4f5c777f 100644 --- a/runtime/druntime/src/core/sys/windows/psapi.d +++ b/runtime/druntime/src/core/sys/windows/psapi.d @@ -25,20 +25,20 @@ struct MODULEINFO { DWORD SizeOfImage; LPVOID EntryPoint; } -alias MODULEINFO* LPMODULEINFO; +alias LPMODULEINFO = MODULEINFO*; struct PSAPI_WS_WATCH_INFORMATION { LPVOID FaultingPc; LPVOID FaultingVa; } -alias PSAPI_WS_WATCH_INFORMATION* PPSAPI_WS_WATCH_INFORMATION; +alias PPSAPI_WS_WATCH_INFORMATION = PSAPI_WS_WATCH_INFORMATION*; struct PSAPI_WS_WATCH_INFORMATION_EX { PSAPI_WS_WATCH_INFORMATION BasicInfo; ULONG_PTR FaultingThreadId; ULONG_PTR Flags; } -alias PSAPI_WS_WATCH_INFORMATION_EX* PPSAPI_WS_WATCH_INFORMATION_EX; +alias PPSAPI_WS_WATCH_INFORMATION_EX = PSAPI_WS_WATCH_INFORMATION_EX*; struct PROCESS_MEMORY_COUNTERS { DWORD cb; @@ -52,7 +52,7 @@ struct PROCESS_MEMORY_COUNTERS { SIZE_T PagefileUsage; SIZE_T PeakPagefileUsage; } -alias PROCESS_MEMORY_COUNTERS* PPROCESS_MEMORY_COUNTERS; +alias PPROCESS_MEMORY_COUNTERS = PROCESS_MEMORY_COUNTERS*; struct PERFORMANCE_INFORMATION { DWORD cb; @@ -70,7 +70,7 @@ struct PERFORMANCE_INFORMATION { DWORD ProcessCount; DWORD ThreadCount; } -alias PERFORMANCE_INFORMATION* PPERFORMANCE_INFORMATION; +alias PPERFORMANCE_INFORMATION = PERFORMANCE_INFORMATION*; struct ENUM_PAGE_FILE_INFORMATION { DWORD cb; @@ -79,14 +79,12 @@ struct ENUM_PAGE_FILE_INFORMATION { SIZE_T TotalInUse; SIZE_T PeakUsage; } -alias ENUM_PAGE_FILE_INFORMATION* PENUM_PAGE_FILE_INFORMATION; +alias PENUM_PAGE_FILE_INFORMATION = ENUM_PAGE_FILE_INFORMATION*; /* application-defined callback function used with the EnumPageFiles() * http://windowssdk.msdn.microsoft.com/library/ms682627.aspx */ -alias BOOL function(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR) - PENUM_PAGE_FILE_CALLBACKW; -alias BOOL function(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR) - PENUM_PAGE_FILE_CALLBACKA; +alias PENUM_PAGE_FILE_CALLBACKW = BOOL function(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCWSTR); +alias PENUM_PAGE_FILE_CALLBACKA = BOOL function(LPVOID, PENUM_PAGE_FILE_INFORMATION, LPCSTR); // Grouped by application, not in alphabetical order. @@ -140,21 +138,21 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias PENUM_PAGE_FILE_CALLBACKW PENUM_PAGE_FILE_CALLBACK; - alias GetModuleBaseNameW GetModuleBaseName; - alias GetModuleFileNameExW GetModuleFileNameEx; - alias GetMappedFileNameW GetMappedFileName; - alias GetDeviceDriverBaseNameW GetDeviceDriverBaseName; - alias GetDeviceDriverFileNameW GetDeviceDriverFileName; - alias EnumPageFilesW EnumPageFiles; - alias GetProcessImageFileNameW GetProcessImageFileName; + alias PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKW; + alias GetModuleBaseName = GetModuleBaseNameW; + alias GetModuleFileNameEx = GetModuleFileNameExW; + alias GetMappedFileName = GetMappedFileNameW; + alias GetDeviceDriverBaseName = GetDeviceDriverBaseNameW; + alias GetDeviceDriverFileName = GetDeviceDriverFileNameW; + alias EnumPageFiles = EnumPageFilesW; + alias GetProcessImageFileName = GetProcessImageFileNameW; } else { - alias PENUM_PAGE_FILE_CALLBACKA PENUM_PAGE_FILE_CALLBACK; - alias GetModuleBaseNameA GetModuleBaseName; - alias GetModuleFileNameExA GetModuleFileNameEx; - alias GetMappedFileNameA GetMappedFileName; - alias GetDeviceDriverBaseNameA GetDeviceDriverBaseName; - alias GetDeviceDriverFileNameA GetDeviceDriverFileName; - alias EnumPageFilesA EnumPageFiles; - alias GetProcessImageFileNameA GetProcessImageFileName; + alias PENUM_PAGE_FILE_CALLBACK = PENUM_PAGE_FILE_CALLBACKA; + alias GetModuleBaseName = GetModuleBaseNameA; + alias GetModuleFileNameEx = GetModuleFileNameExA; + alias GetMappedFileName = GetMappedFileNameA; + alias GetDeviceDriverBaseName = GetDeviceDriverBaseNameA; + alias GetDeviceDriverFileName = GetDeviceDriverFileNameA; + alias EnumPageFiles = EnumPageFilesA; + alias GetProcessImageFileName = GetProcessImageFileNameA; } diff --git a/runtime/druntime/src/core/sys/windows/rapi.d b/runtime/druntime/src/core/sys/windows/rapi.d index 2fc640468b9..86112313bba 100644 --- a/runtime/druntime/src/core/sys/windows/rapi.d +++ b/runtime/druntime/src/core/sys/windows/rapi.d @@ -30,7 +30,7 @@ interface IRAPIStream HRESULT GetRapiStat(RAPISTREAMFLAG, DWORD*); } -alias HRESULT function(DWORD, BYTE, DWORD, BYTE, IRAPIStream) RAPIEXT; +alias RAPIEXT = HRESULT function(DWORD, BYTE, DWORD, BYTE, IRAPIStream); struct RAPIINIT { diff --git a/runtime/druntime/src/core/sys/windows/ras.d b/runtime/druntime/src/core/sys/windows/ras.d index 4561799a870..8dc770a126c 100644 --- a/runtime/druntime/src/core/sys/windows/ras.d +++ b/runtime/druntime/src/core/sys/windows/ras.d @@ -208,7 +208,7 @@ enum RASCONNSTATE { RASCS_Connected = RASCS_DONE, RASCS_Disconnected } -alias RASCONNSTATE* LPRASCONNSTATE; +alias LPRASCONNSTATE = RASCONNSTATE*; enum RASPROJECTION { RASP_Amb = 0x10000, @@ -221,10 +221,10 @@ enum RASPROJECTION { RASP_PppLcp = 0xC021, RASP_Slip = 0x20000 } -alias RASPROJECTION* LPRASPROJECTION; +alias LPRASPROJECTION = RASPROJECTION*; -alias HANDLE HRASCONN; -alias HRASCONN* LPHRASCONN; +alias HRASCONN = HANDLE; +alias LPHRASCONN = HRASCONN*; struct RASCONNW { align(4): @@ -247,7 +247,7 @@ align(4): LUID luid; } } -alias RASCONNW* LPRASCONNW; +alias LPRASCONNW = RASCONNW*; struct RASCONNA { align(4): @@ -270,7 +270,7 @@ align(4): LUID luid; } } -alias RASCONNA* LPRASCONNA; +alias LPRASCONNA = RASCONNA*; struct RASCONNSTATUSW { DWORD dwSize; @@ -282,7 +282,7 @@ struct RASCONNSTATUSW { WCHAR[RAS_MaxPhoneNumber + 1] szPhoneNumber = 0; } } -alias RASCONNSTATUSW* LPRASCONNSTATUSW; +alias LPRASCONNSTATUSW = RASCONNSTATUSW*; struct RASCONNSTATUSA { DWORD dwSize; @@ -294,7 +294,7 @@ struct RASCONNSTATUSA { CHAR[RAS_MaxPhoneNumber + 1] szPhoneNumber = 0; } } -alias RASCONNSTATUSA* LPRASCONNSTATUSA; +alias LPRASCONNSTATUSA = RASCONNSTATUSA*; struct RASDIALPARAMSW { align(4): @@ -312,7 +312,7 @@ align { ULONG_PTR dwCallbackId; } } -alias RASDIALPARAMSW* LPRASDIALPARAMSW; +alias LPRASDIALPARAMSW = RASDIALPARAMSW*; struct RASDIALPARAMSA{ align(4): @@ -330,7 +330,7 @@ align { ULONG_PTR dwCallbackId; } } -alias RASDIALPARAMSA* LPRASDIALPARAMSA; +alias LPRASDIALPARAMSA = RASDIALPARAMSA*; //static if (_WIN32_WINNT >= 0x500) { struct RASEAPINFO { @@ -351,7 +351,7 @@ align(4): RASEAPINFO RasEapInfo; //} } -alias RASDIALEXTENSIONS* LPRASDIALEXTENSIONS; +alias LPRASDIALEXTENSIONS = RASDIALEXTENSIONS*; struct RASENTRYNAMEW { DWORD dwSize; @@ -361,7 +361,7 @@ struct RASENTRYNAMEW { WCHAR[MAX_PATH + 1] szPhonebookPath = 0; //} } -alias RASENTRYNAMEW* LPRASENTRYNAMEW; +alias LPRASENTRYNAMEW = RASENTRYNAMEW*; struct RASENTRYNAMEA{ DWORD dwSize; @@ -371,7 +371,7 @@ struct RASENTRYNAMEA{ CHAR[MAX_PATH + 1] szPhonebookPath = 0; //} } -alias RASENTRYNAMEA* LPRASENTRYNAMEA; +alias LPRASENTRYNAMEA = RASENTRYNAMEA*; struct RASAMBW{ DWORD dwSize; @@ -379,7 +379,7 @@ struct RASAMBW{ WCHAR[NETBIOS_NAME_LEN + 1] szNetBiosError = 0; BYTE bLana; } -alias RASAMBW* LPRASAMBW; +alias LPRASAMBW = RASAMBW*; struct RASAMBA{ DWORD dwSize; @@ -387,7 +387,7 @@ struct RASAMBA{ CHAR[NETBIOS_NAME_LEN + 1] szNetBiosError = 0; BYTE bLana; } -alias RASAMBA* LPRASAMBA; +alias LPRASAMBA = RASAMBA*; struct RASPPPNBFW{ DWORD dwSize; @@ -397,7 +397,7 @@ struct RASPPPNBFW{ WCHAR[NETBIOS_NAME_LEN + 1] szWorkstationName = 0; BYTE bLana; } -alias RASPPPNBFW* LPRASPPPNBFW; +alias LPRASPPPNBFW = RASPPPNBFW*; struct RASPPPNBFA{ DWORD dwSize; @@ -407,21 +407,21 @@ struct RASPPPNBFA{ CHAR[NETBIOS_NAME_LEN + 1] szWorkstationName = 0; BYTE bLana; } -alias RASPPPNBFA* LPRASPPPNBFA; +alias LPRASPPPNBFA = RASPPPNBFA*; struct RASPPPIPXW { DWORD dwSize; DWORD dwError; WCHAR[RAS_MaxIpxAddress + 1] szIpxAddress = 0; } -alias RASPPPIPXW* LPRASPPPIPXW; +alias LPRASPPPIPXW = RASPPPIPXW*; struct RASPPPIPXA { DWORD dwSize; DWORD dwError; CHAR[RAS_MaxIpxAddress + 1] szIpxAddress = 0; } -alias RASPPPIPXA* LPRASPPPIPXA; +alias LPRASPPPIPXA = RASPPPIPXA*; struct RASPPPIPW{ DWORD dwSize; @@ -435,7 +435,7 @@ struct RASPPPIPW{ DWORD dwServerOptions; //} } -alias RASPPPIPW* LPRASPPPIPW; +alias LPRASPPPIPW = RASPPPIPW*; struct RASPPPIPA{ DWORD dwSize; @@ -449,7 +449,7 @@ struct RASPPPIPA{ DWORD dwServerOptions; //} } -alias RASPPPIPA* LPRASPPPIPA; +alias LPRASPPPIPA = RASPPPIPA*; struct RASPPPLCPW{ DWORD dwSize; @@ -470,7 +470,7 @@ struct RASPPPLCPW{ DWORD dwServerOptions; //} } -alias RASPPPLCPW* LPRASPPPLCPW; +alias LPRASPPPLCPW = RASPPPLCPW*; struct RASPPPLCPA{ DWORD dwSize; @@ -491,35 +491,35 @@ struct RASPPPLCPA{ DWORD dwServerOptions; //} } -alias RASPPPLCPA* LPRASPPPLCPA; +alias LPRASPPPLCPA = RASPPPLCPA*; struct RASSLIPW{ DWORD dwSize; DWORD dwError; WCHAR[RAS_MaxIpAddress + 1] szIpAddress = 0; } -alias RASSLIPW* LPRASSLIPW; +alias LPRASSLIPW = RASSLIPW*; struct RASSLIPA{ DWORD dwSize; DWORD dwError; CHAR[RAS_MaxIpAddress + 1] szIpAddress = 0; } -alias RASSLIPA* LPRASSLIPA; +alias LPRASSLIPA = RASSLIPA*; struct RASDEVINFOW{ DWORD dwSize; WCHAR[RAS_MaxDeviceType + 1] szDeviceType = 0; WCHAR[RAS_MaxDeviceName + 1] szDeviceName = 0; } -alias RASDEVINFOW* LPRASDEVINFOW; +alias LPRASDEVINFOW = RASDEVINFOW*; struct RASDEVINFOA{ DWORD dwSize; CHAR[RAS_MaxDeviceType + 1] szDeviceType = 0; CHAR[RAS_MaxDeviceName + 1] szDeviceName = 0; } -alias RASDEVINFOA* LPRASDEVINFOA; +alias LPRASDEVINFOA = RASDEVINFOA*; struct RASCTRYINFO { DWORD dwSize; @@ -528,10 +528,10 @@ struct RASCTRYINFO { DWORD dwCountryCode; DWORD dwCountryNameOffset; } -alias RASCTRYINFO* LPRASCTRYINFO; -alias RASCTRYINFO RASCTRYINFOW, RASCTRYINFOA; -alias RASCTRYINFOW* LPRASCTRYINFOW; -alias RASCTRYINFOA* LPRASCTRYINFOA; +alias LPRASCTRYINFO = RASCTRYINFO*; +alias RASCTRYINFOW = RASCTRYINFO, RASCTRYINFOA = RASCTRYINFO; +alias LPRASCTRYINFOW = RASCTRYINFOW*; +alias LPRASCTRYINFOA = RASCTRYINFOA*; struct RASIPADDR { BYTE a; @@ -586,7 +586,7 @@ struct RASENTRYW { DWORD dwVpnStrategy; //} } -alias RASENTRYW* LPRASENTRYW; +alias LPRASENTRYW = RASENTRYW*; struct RASENTRYA { DWORD dwSize; @@ -634,7 +634,7 @@ struct RASENTRYA { DWORD dwVpnStrategy; //} } -alias RASENTRYA* LPRASENTRYA; +alias LPRASENTRYA = RASENTRYA*; //static if (_WIN32_WINNT >= 0x401) { @@ -646,7 +646,7 @@ alias RASENTRYA* LPRASENTRYA; LONG xDlg; LONG yDlg; } - alias RASADPARAMS* LPRASADPARAMS; + alias LPRASADPARAMS = RASADPARAMS*; struct RASSUBENTRYW{ DWORD dwSize; @@ -656,7 +656,7 @@ alias RASENTRYA* LPRASENTRYA; WCHAR[RAS_MaxPhoneNumber + 1] szLocalPhoneNumber = 0; DWORD dwAlternateOffset; } - alias RASSUBENTRYW* LPRASSUBENTRYW; + alias LPRASSUBENTRYW = RASSUBENTRYW*; struct RASSUBENTRYA{ DWORD dwSize; @@ -666,7 +666,7 @@ alias RASENTRYA* LPRASENTRYA; CHAR[RAS_MaxPhoneNumber + 1] szLocalPhoneNumber = 0; DWORD dwAlternateOffset; } - alias RASSUBENTRYA* LPRASSUBENTRYA; + alias LPRASSUBENTRYA = RASSUBENTRYA*; struct RASCREDENTIALSW{ DWORD dwSize; @@ -675,7 +675,7 @@ alias RASENTRYA* LPRASENTRYA; WCHAR[PWLEN + 1] szPassword = 0; WCHAR[DNLEN + 1] szDomain = 0; } - alias RASCREDENTIALSW* LPRASCREDENTIALSW; + alias LPRASCREDENTIALSW = RASCREDENTIALSW*; struct RASCREDENTIALSA{ DWORD dwSize; @@ -684,7 +684,7 @@ alias RASENTRYA* LPRASENTRYA; CHAR[PWLEN + 1] szPassword = 0; CHAR[DNLEN + 1] szDomain = 0; } - alias RASCREDENTIALSA* LPRASCREDENTIALSA; + alias LPRASCREDENTIALSA = RASCREDENTIALSA*; struct RASAUTODIALENTRYW{ DWORD dwSize; @@ -692,7 +692,7 @@ alias RASENTRYA* LPRASENTRYA; DWORD dwDialingLocation; WCHAR[RAS_MaxEntryName + 1] szEntry = 0; } - alias RASAUTODIALENTRYW* LPRASAUTODIALENTRYW; + alias LPRASAUTODIALENTRYW = RASAUTODIALENTRYW*; struct RASAUTODIALENTRYA{ DWORD dwSize; @@ -700,7 +700,7 @@ alias RASENTRYA* LPRASENTRYA; DWORD dwDialingLocation; CHAR[RAS_MaxEntryName + 1] szEntry = 0; } - alias RASAUTODIALENTRYA* LPRASAUTODIALENTRYA; + alias LPRASAUTODIALENTRYA = RASAUTODIALENTRYA*; //} //static if (_WIN32_WINNT >= 0x500) { @@ -712,21 +712,21 @@ alias RASENTRYA* LPRASENTRYA; DWORD dwServerCompressionAlgorithm; DWORD dwServerOptions; } - alias RASPPPCCP* LPRASPPPCCP; + alias LPRASPPPCCP = RASPPPCCP*; struct RASEAPUSERIDENTITYW{ WCHAR[UNLEN + 1] szUserName = 0; DWORD dwSizeofEapInfo; BYTE[1] pbEapInfo; } - alias RASEAPUSERIDENTITYW* LPRASEAPUSERIDENTITYW; + alias LPRASEAPUSERIDENTITYW = RASEAPUSERIDENTITYW*; struct RASEAPUSERIDENTITYA{ CHAR[UNLEN + 1] szUserName = 0; DWORD dwSizeofEapInfo; BYTE[1] pbEapInfo; } - alias RASEAPUSERIDENTITYA* LPRASEAPUSERIDENTITYA; + alias LPRASEAPUSERIDENTITYA = RASEAPUSERIDENTITYA*; struct RAS_STATS{ DWORD dwSize; @@ -745,93 +745,93 @@ alias RASENTRYA* LPRASENTRYA; DWORD dwBps; DWORD dwConnectDuration; } - alias RAS_STATS* PRAS_STATS; + alias PRAS_STATS = RAS_STATS*; //} /* UNICODE typedefs for structures*/ version (Unicode) { - alias RASCONNW RASCONN; - alias RASENTRYW RASENTRY; - alias RASCONNSTATUSW RASCONNSTATUS; - alias RASDIALPARAMSW RASDIALPARAMS; - alias RASAMBW RASAMB; - alias RASPPPNBFW RASPPPNBF; - alias RASPPPIPXW RASPPPIPX; - alias RASPPPIPW RASPPPIP; - alias RASPPPLCPW RASPPPLCP; - alias RASSLIPW RASSLIP; - alias RASDEVINFOW RASDEVINFO; - alias RASENTRYNAMEW RASENTRYNAME; + alias RASCONN = RASCONNW; + alias RASENTRY = RASENTRYW; + alias RASCONNSTATUS = RASCONNSTATUSW; + alias RASDIALPARAMS = RASDIALPARAMSW; + alias RASAMB = RASAMBW; + alias RASPPPNBF = RASPPPNBFW; + alias RASPPPIPX = RASPPPIPXW; + alias RASPPPIP = RASPPPIPW; + alias RASPPPLCP = RASPPPLCPW; + alias RASSLIP = RASSLIPW; + alias RASDEVINFO = RASDEVINFOW; + alias RASENTRYNAME = RASENTRYNAMEW; //static if (_WIN32_WINNT >= 0x401) { - alias RASSUBENTRYW RASSUBENTRY; - alias RASCREDENTIALSW RASCREDENTIALS; - alias RASAUTODIALENTRYW RASAUTODIALENTRY; + alias RASSUBENTRY = RASSUBENTRYW; + alias RASCREDENTIALS = RASCREDENTIALSW; + alias RASAUTODIALENTRY = RASAUTODIALENTRYW; //} //static if (_WIN32_WINNT >= 0x500) { - alias RASEAPUSERIDENTITYW RASEAPUSERIDENTITY; + alias RASEAPUSERIDENTITY = RASEAPUSERIDENTITYW; //} } else { // ! defined UNICODE - alias RASCONNA RASCONN; - alias RASENTRYA RASENTRY; - alias RASCONNSTATUSA RASCONNSTATUS; - alias RASDIALPARAMSA RASDIALPARAMS; - alias RASAMBA RASAMB; - alias RASPPPNBFA RASPPPNBF; - alias RASPPPIPXA RASPPPIPX; - alias RASPPPIPA RASPPPIP; - alias RASPPPLCPA RASPPPLCP; - alias RASSLIPA RASSLIP; - alias RASDEVINFOA RASDEVINFO; - alias RASENTRYNAMEA RASENTRYNAME; + alias RASCONN = RASCONNA; + alias RASENTRY = RASENTRYA; + alias RASCONNSTATUS = RASCONNSTATUSA; + alias RASDIALPARAMS = RASDIALPARAMSA; + alias RASAMB = RASAMBA; + alias RASPPPNBF = RASPPPNBFA; + alias RASPPPIPX = RASPPPIPXA; + alias RASPPPIP = RASPPPIPA; + alias RASPPPLCP = RASPPPLCPA; + alias RASSLIP = RASSLIPA; + alias RASDEVINFO = RASDEVINFOA; + alias RASENTRYNAME = RASENTRYNAMEA; //static if (_WIN32_WINNT >= 0x401) { - alias RASSUBENTRYA RASSUBENTRY; - alias RASCREDENTIALSA RASCREDENTIALS; - alias RASAUTODIALENTRYA RASAUTODIALENTRY; + alias RASSUBENTRY = RASSUBENTRYA; + alias RASCREDENTIALS = RASCREDENTIALSA; + alias RASAUTODIALENTRY = RASAUTODIALENTRYA; //} //static if (_WIN32_WINNT >= 0x500) { - alias RASEAPUSERIDENTITYA RASEAPUSERIDENTITY; + alias RASEAPUSERIDENTITY = RASEAPUSERIDENTITYA; //} }// ! UNICODE -alias RASCONN* LPRASCONN; -alias RASENTRY* LPRASENTRY; -alias RASCONNSTATUS* LPRASCONNSTATUS; -alias RASDIALPARAMS* LPRASDIALPARAMS; -alias RASAMB* LPRASAM; -alias RASPPPNBF* LPRASPPPNBF; -alias RASPPPIPX* LPRASPPPIPX; -alias RASPPPIP* LPRASPPPIP; -alias RASPPPLCP* LPRASPPPLCP; -alias RASSLIP* LPRASSLIP; -alias RASDEVINFO* LPRASDEVINFO; -alias RASENTRYNAME* LPRASENTRYNAME; +alias LPRASCONN = RASCONN*; +alias LPRASENTRY = RASENTRY*; +alias LPRASCONNSTATUS = RASCONNSTATUS*; +alias LPRASDIALPARAMS = RASDIALPARAMS*; +alias LPRASAM = RASAMB*; +alias LPRASPPPNBF = RASPPPNBF*; +alias LPRASPPPIPX = RASPPPIPX*; +alias LPRASPPPIP = RASPPPIP*; +alias LPRASPPPLCP = RASPPPLCP*; +alias LPRASSLIP = RASSLIP*; +alias LPRASDEVINFO = RASDEVINFO*; +alias LPRASENTRYNAME = RASENTRYNAME*; //static if (_WIN32_WINNT >= 0x401) { - alias RASSUBENTRY* LPRASSUBENTRY; - alias RASCREDENTIALS* LPRASCREDENTIALS; - alias RASAUTODIALENTRY* LPRASAUTODIALENTRY; + alias LPRASSUBENTRY = RASSUBENTRY*; + alias LPRASCREDENTIALS = RASCREDENTIALS*; + alias LPRASAUTODIALENTRY = RASAUTODIALENTRY*; //} //static if (_WIN32_WINNT >= 0x500) { - alias RASEAPUSERIDENTITY* LPRASEAPUSERIDENTITY; + alias LPRASEAPUSERIDENTITY = RASEAPUSERIDENTITY*; //} /* Callback prototypes */ extern (Windows) { /* WINAPI */ deprecated { - alias BOOL function (HWND, LPSTR, DWORD, LPDWORD) ORASADFUNC; + alias ORASADFUNC = BOOL function (HWND, LPSTR, DWORD, LPDWORD); } - alias void function (UINT, RASCONNSTATE, DWORD) RASDIALFUNC; - alias void function(HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD) RASDIALFUNC1; - alias DWORD function (ULONG_PTR, DWORD, HRASCONN, UINT, - RASCONNSTATE, DWORD, DWORD) RASDIALFUNC2; + alias RASDIALFUNC = void function (UINT, RASCONNSTATE, DWORD); + alias RASDIALFUNC1 = void function(HRASCONN, UINT, RASCONNSTATE, DWORD, DWORD); + alias RASDIALFUNC2 = DWORD function (ULONG_PTR, DWORD, HRASCONN, UINT, + RASCONNSTATE, DWORD, DWORD); /* External functions */ DWORD RasDialA(LPRASDIALEXTENSIONS, LPCSTR, LPRASDIALPARAMSA, DWORD, LPVOID, LPHRASCONN); @@ -872,8 +872,8 @@ extern (Windows) { /* WINAPI */ DWORD RasValidateEntryNameW(LPCWSTR, LPCWSTR); //static if (_WIN32_WINNT >= 0x401) { - alias BOOL function(LPSTR, LPSTR, LPRASADPARAMS, LPDWORD) RASADFUNCA; - alias BOOL function(LPWSTR, LPWSTR, LPRASADPARAMS, LPDWORD) RASADFUNCW; + alias RASADFUNCA = BOOL function(LPSTR, LPSTR, LPRASADPARAMS, LPDWORD); + alias RASADFUNCW = BOOL function(LPWSTR, LPWSTR, LPRASADPARAMS, LPDWORD); DWORD RasGetSubEntryHandleA(HRASCONN, DWORD, LPHRASCONN); DWORD RasGetSubEntryHandleW(HRASCONN, DWORD, LPHRASCONN); @@ -904,10 +904,10 @@ extern (Windows) { /* WINAPI */ //} static if (_WIN32_WINNT >= 0x500) { - alias DWORD function(HRASCONN) RasCustomHangUpFn; - alias DWORD function(LPCTSTR, LPCTSTR, DWORD) RasCustomDeleteEntryNotifyFn; - alias DWORD function(HINSTANCE, LPRASDIALEXTENSIONS, LPCTSTR, LPRASDIALPARAMS, DWORD, LPVOID, - LPHRASCONN, DWORD) RasCustomDialFn; + alias RasCustomHangUpFn = DWORD function(HRASCONN); + alias RasCustomDeleteEntryNotifyFn = DWORD function(LPCTSTR, LPCTSTR, DWORD); + alias RasCustomDialFn = DWORD function(HINSTANCE, LPRASDIALEXTENSIONS, LPCTSTR, LPRASDIALPARAMS, DWORD, LPVOID, + LPHRASCONN, DWORD); DWORD RasInvokeEapUI(HRASCONN, DWORD, LPRASDIALEXTENSIONS, HWND); DWORD RasGetLinkStatistics(HRASCONN, DWORD, RAS_STATS*); @@ -932,94 +932,94 @@ static if (_WIN32_WINNT >= 0x500) { /* UNICODE defines for functions */ version (Unicode) { - alias RasDialW RasDial; - alias RasEnumConnectionsW RasEnumConnections; - alias RasEnumEntriesW RasEnumEntries; - alias RasGetConnectStatusW RasGetConnectStatus; - alias RasGetErrorStringW RasGetErrorString; - alias RasHangUpW RasHangUp; - alias RasGetProjectionInfoW RasGetProjectionInfo; - alias RasCreatePhonebookEntryW RasCreatePhonebookEntry; - alias RasEditPhonebookEntryW RasEditPhonebookEntry; - alias RasSetEntryDialParamsW RasSetEntryDialParams; - alias RasGetEntryDialParamsW RasGetEntryDialParams; - alias RasEnumDevicesW RasEnumDevices; - alias RasGetCountryInfoW RasGetCountryInfo; - alias RasGetEntryPropertiesW RasGetEntryProperties; - alias RasSetEntryPropertiesW RasSetEntryProperties; - alias RasRenameEntryW RasRenameEntry; - alias RasDeleteEntryW RasDeleteEntry; - alias RasValidateEntryNameW RasValidateEntryName; + alias RasDial = RasDialW; + alias RasEnumConnections = RasEnumConnectionsW; + alias RasEnumEntries = RasEnumEntriesW; + alias RasGetConnectStatus = RasGetConnectStatusW; + alias RasGetErrorString = RasGetErrorStringW; + alias RasHangUp = RasHangUpW; + alias RasGetProjectionInfo = RasGetProjectionInfoW; + alias RasCreatePhonebookEntry = RasCreatePhonebookEntryW; + alias RasEditPhonebookEntry = RasEditPhonebookEntryW; + alias RasSetEntryDialParams = RasSetEntryDialParamsW; + alias RasGetEntryDialParams = RasGetEntryDialParamsW; + alias RasEnumDevices = RasEnumDevicesW; + alias RasGetCountryInfo = RasGetCountryInfoW; + alias RasGetEntryProperties = RasGetEntryPropertiesW; + alias RasSetEntryProperties = RasSetEntryPropertiesW; + alias RasRenameEntry = RasRenameEntryW; + alias RasDeleteEntry = RasDeleteEntryW; + alias RasValidateEntryName = RasValidateEntryNameW; //static if (_WIN32_WINNT >= 0x401) { - alias RASADFUNCW RASADFUNC; - alias RasGetSubEntryHandleW RasGetSubEntryHandle; - alias RasConnectionNotificationW RasConnectionNotification; - alias RasGetSubEntryPropertiesW RasGetSubEntryProperties; - alias RasSetSubEntryPropertiesW RasSetSubEntryProperties; - alias RasGetCredentialsW RasGetCredentials; - alias RasSetCredentialsW RasSetCredentials; - alias RasGetAutodialAddressW RasGetAutodialAddress; - alias RasSetAutodialAddressW RasSetAutodialAddress; - alias RasEnumAutodialAddressesW RasEnumAutodialAddresses; - alias RasGetAutodialEnableW RasGetAutodialEnable; - alias RasSetAutodialEnableW RasSetAutodialEnable; - alias RasGetAutodialParamW RasGetAutodialParam; - alias RasSetAutodialParamW RasSetAutodialParam; + alias RASADFUNC = RASADFUNCW; + alias RasGetSubEntryHandle = RasGetSubEntryHandleW; + alias RasConnectionNotification = RasConnectionNotificationW; + alias RasGetSubEntryProperties = RasGetSubEntryPropertiesW; + alias RasSetSubEntryProperties = RasSetSubEntryPropertiesW; + alias RasGetCredentials = RasGetCredentialsW; + alias RasSetCredentials = RasSetCredentialsW; + alias RasGetAutodialAddress = RasGetAutodialAddressW; + alias RasSetAutodialAddress = RasSetAutodialAddressW; + alias RasEnumAutodialAddresses = RasEnumAutodialAddressesW; + alias RasGetAutodialEnable = RasGetAutodialEnableW; + alias RasSetAutodialEnable = RasSetAutodialEnableW; + alias RasGetAutodialParam = RasGetAutodialParamW; + alias RasSetAutodialParam = RasSetAutodialParamW; //} //static if (_WIN32_WINNT >= 0x500) { - alias RasGetEapUserDataW RasGetEapUserData; - alias RasSetEapUserDataW RasSetEapUserData; - alias RasGetCustomAuthDataW RasGetCustomAuthData; - alias RasSetCustomAuthDataW RasSetCustomAuthData; - alias RasGetEapUserIdentityW RasGetEapUserIdentity; - alias RasFreeEapUserIdentityW RasFreeEapUserIdentity; + alias RasGetEapUserData = RasGetEapUserDataW; + alias RasSetEapUserData = RasSetEapUserDataW; + alias RasGetCustomAuthData = RasGetCustomAuthDataW; + alias RasSetCustomAuthData = RasSetCustomAuthDataW; + alias RasGetEapUserIdentity = RasGetEapUserIdentityW; + alias RasFreeEapUserIdentity = RasFreeEapUserIdentityW; //} } else { // !Unicode - alias RasDialA RasDial; - alias RasEnumConnectionsA RasEnumConnections; - alias RasEnumEntriesA RasEnumEntries; - alias RasGetConnectStatusA RasGetConnectStatus; - alias RasGetErrorStringA RasGetErrorString; - alias RasHangUpA RasHangUp; - alias RasGetProjectionInfoA RasGetProjectionInfo; - alias RasCreatePhonebookEntryA RasCreatePhonebookEntry; - alias RasEditPhonebookEntryA RasEditPhonebookEntry; - alias RasSetEntryDialParamsA RasSetEntryDialParams; - alias RasGetEntryDialParamsA RasGetEntryDialParams; - alias RasEnumDevicesA RasEnumDevices; - alias RasGetCountryInfoA RasGetCountryInfo; - alias RasGetEntryPropertiesA RasGetEntryProperties; - alias RasSetEntryPropertiesA RasSetEntryProperties; - alias RasRenameEntryA RasRenameEntry; - alias RasDeleteEntryA RasDeleteEntry; - alias RasValidateEntryNameA RasValidateEntryName; + alias RasDial = RasDialA; + alias RasEnumConnections = RasEnumConnectionsA; + alias RasEnumEntries = RasEnumEntriesA; + alias RasGetConnectStatus = RasGetConnectStatusA; + alias RasGetErrorString = RasGetErrorStringA; + alias RasHangUp = RasHangUpA; + alias RasGetProjectionInfo = RasGetProjectionInfoA; + alias RasCreatePhonebookEntry = RasCreatePhonebookEntryA; + alias RasEditPhonebookEntry = RasEditPhonebookEntryA; + alias RasSetEntryDialParams = RasSetEntryDialParamsA; + alias RasGetEntryDialParams = RasGetEntryDialParamsA; + alias RasEnumDevices = RasEnumDevicesA; + alias RasGetCountryInfo = RasGetCountryInfoA; + alias RasGetEntryProperties = RasGetEntryPropertiesA; + alias RasSetEntryProperties = RasSetEntryPropertiesA; + alias RasRenameEntry = RasRenameEntryA; + alias RasDeleteEntry = RasDeleteEntryA; + alias RasValidateEntryName = RasValidateEntryNameA; //static if (_WIN32_WINNT >= 0x401) { - alias RASADFUNCA RASADFUNC; - alias RasGetSubEntryHandleA RasGetSubEntryHandle; - alias RasConnectionNotificationA RasConnectionNotification; - alias RasGetSubEntryPropertiesA RasGetSubEntryProperties; - alias RasSetSubEntryPropertiesA RasSetSubEntryProperties; - alias RasGetCredentialsA RasGetCredentials; - alias RasSetCredentialsA RasSetCredentials; - alias RasGetAutodialAddressA RasGetAutodialAddress; - alias RasSetAutodialAddressA RasSetAutodialAddress; - alias RasEnumAutodialAddressesA RasEnumAutodialAddresses; - alias RasGetAutodialEnableA RasGetAutodialEnable; - alias RasSetAutodialEnableA RasSetAutodialEnable; - alias RasGetAutodialParamA RasGetAutodialParam; - alias RasSetAutodialParamA RasSetAutodialParam; + alias RASADFUNC = RASADFUNCA; + alias RasGetSubEntryHandle = RasGetSubEntryHandleA; + alias RasConnectionNotification = RasConnectionNotificationA; + alias RasGetSubEntryProperties = RasGetSubEntryPropertiesA; + alias RasSetSubEntryProperties = RasSetSubEntryPropertiesA; + alias RasGetCredentials = RasGetCredentialsA; + alias RasSetCredentials = RasSetCredentialsA; + alias RasGetAutodialAddress = RasGetAutodialAddressA; + alias RasSetAutodialAddress = RasSetAutodialAddressA; + alias RasEnumAutodialAddresses = RasEnumAutodialAddressesA; + alias RasGetAutodialEnable = RasGetAutodialEnableA; + alias RasSetAutodialEnable = RasSetAutodialEnableA; + alias RasGetAutodialParam = RasGetAutodialParamA; + alias RasSetAutodialParam = RasSetAutodialParamA; //} //static if (_WIN32_WINNT >= 0x500) { - alias RasGetEapUserDataA RasGetEapUserData; - alias RasSetEapUserDataA RasSetEapUserData; - alias RasGetCustomAuthDataA RasGetCustomAuthData; - alias RasSetCustomAuthDataA RasSetCustomAuthData; - alias RasGetEapUserIdentityA RasGetEapUserIdentity; - alias RasFreeEapUserIdentityA RasFreeEapUserIdentity; + alias RasGetEapUserData = RasGetEapUserDataA; + alias RasSetEapUserData = RasSetEapUserDataA; + alias RasGetCustomAuthData = RasGetCustomAuthDataA; + alias RasSetCustomAuthData = RasSetCustomAuthDataA; + alias RasGetEapUserIdentity = RasGetEapUserIdentityA; + alias RasFreeEapUserIdentity = RasFreeEapUserIdentityA; //} } //#endif // !Unicode diff --git a/runtime/druntime/src/core/sys/windows/rasdlg.d b/runtime/druntime/src/core/sys/windows/rasdlg.d index a980d270f89..50fd63b6762 100644 --- a/runtime/druntime/src/core/sys/windows/rasdlg.d +++ b/runtime/druntime/src/core/sys/windows/rasdlg.d @@ -49,7 +49,7 @@ align(4): ULONG_PTR reserved; ULONG_PTR reserved2; } -alias RASENTRYDLGA* LPRASENTRYDLGA; +alias LPRASENTRYDLGA = RASENTRYDLGA*; struct RASENTRYDLGW { align(4): @@ -63,7 +63,7 @@ align(4): ULONG_PTR reserved; ULONG_PTR reserved2; } -alias RASENTRYDLGW* LPRASENTRYDLGW; +alias LPRASENTRYDLGW = RASENTRYDLGW*; struct RASDIALDLG { align(4): @@ -77,12 +77,12 @@ align(4): ULONG_PTR reserved; ULONG_PTR reserved2; } -alias RASDIALDLG* LPRASDIALDLG; +alias LPRASDIALDLG = RASDIALDLG*; // Application-defined callback functions extern (Windows) { - alias VOID function(ULONG_PTR, DWORD, LPWSTR, LPVOID) RASPBDLGFUNCW; - alias VOID function(ULONG_PTR, DWORD, LPSTR, LPVOID) RASPBDLGFUNCA; + alias RASPBDLGFUNCW = VOID function(ULONG_PTR, DWORD, LPWSTR, LPVOID); + alias RASPBDLGFUNCA = VOID function(ULONG_PTR, DWORD, LPSTR, LPVOID); } struct RASPBDLGA { @@ -98,7 +98,7 @@ align(4): ULONG_PTR reserved; ULONG_PTR reserved2; } -alias RASPBDLGA* LPRASPBDLGA; +alias LPRASPBDLGA = RASPBDLGA*; struct RASPBDLGW { align(4): @@ -113,7 +113,7 @@ align(4): ULONG_PTR reserved; ULONG_PTR reserved2; } -alias RASPBDLGW* LPRASPBDLGW; +alias LPRASPBDLGW = RASPBDLGW*; struct RASNOUSERA { @@ -124,7 +124,7 @@ struct RASNOUSERA CHAR[PWLEN + 1] szPassword = 0; CHAR[DNLEN + 1] szDomain = 0; } -alias RASNOUSERA* LPRASNOUSERA; +alias LPRASNOUSERA = RASNOUSERA*; struct RASNOUSERW { DWORD dwSize = RASNOUSERW.sizeof; @@ -134,7 +134,7 @@ struct RASNOUSERW { WCHAR[PWLEN + 1] szPassword = 0; WCHAR[DNLEN + 1] szDomain = 0; } -alias RASNOUSERW* LPRASNOUSERW; +alias LPRASNOUSERW = RASNOUSERW*; extern (Windows) { BOOL RasDialDlgA(LPSTR, LPSTR, LPSTR, LPRASDIALDLG); @@ -146,21 +146,21 @@ extern (Windows) { } version (Unicode) { - alias RASENTRYDLGW RASENTRYDLG; - alias RASPBDLGW RASPBDLG; - alias RASNOUSERW RASNOUSER; - alias RasDialDlgW RasDialDlg; - alias RasEntryDlgW RasEntryDlg; - alias RasPhonebookDlgW RasPhonebookDlg; + alias RASENTRYDLG = RASENTRYDLGW; + alias RASPBDLG = RASPBDLGW; + alias RASNOUSER = RASNOUSERW; + alias RasDialDlg = RasDialDlgW; + alias RasEntryDlg = RasEntryDlgW; + alias RasPhonebookDlg = RasPhonebookDlgW; } else { - alias RASENTRYDLGA RASENTRYDLG; - alias RASPBDLGA RASPBDLG; - alias RASNOUSERA RASNOUSER; - alias RasDialDlgA RasDialDlg; - alias RasEntryDlgA RasEntryDlg; - alias RasPhonebookDlgA RasPhonebookDlg; + alias RASENTRYDLG = RASENTRYDLGA; + alias RASPBDLG = RASPBDLGA; + alias RASNOUSER = RASNOUSERA; + alias RasDialDlg = RasDialDlgA; + alias RasEntryDlg = RasEntryDlgA; + alias RasPhonebookDlg = RasPhonebookDlgA; } -alias RASENTRYDLG* LPRASENTRYDLG; -alias RASPBDLG* LPRASPBDLG; -alias RASNOUSER* LPRASNOUSER; +alias LPRASENTRYDLG = RASENTRYDLG*; +alias LPRASPBDLG = RASPBDLG*; +alias LPRASNOUSER = RASNOUSER*; diff --git a/runtime/druntime/src/core/sys/windows/rassapi.d b/runtime/druntime/src/core/sys/windows/rassapi.d index 5244ca41157..27d3f465c0b 100644 --- a/runtime/druntime/src/core/sys/windows/rassapi.d +++ b/runtime/druntime/src/core/sys/windows/rassapi.d @@ -73,7 +73,7 @@ enum { RASADMIN_CURRENT = 40 } -alias ULONG IPADDR; +alias IPADDR = ULONG; enum RAS_PARAMS_FORMAT { ParamNumber = 0, @@ -100,7 +100,7 @@ struct RAS_USER_0 { BYTE bfPrivilege; WCHAR[RASSAPI_MAX_PHONENUMBER_SIZE + 1] szPhoneNumber = 0; } -alias RAS_USER_0* PRAS_USER_0; +alias PRAS_USER_0 = RAS_USER_0*; struct RAS_PORT_0 { WCHAR[RASSAPI_MAX_PORT_NAME] wszPortName = 0; @@ -115,7 +115,7 @@ struct RAS_PORT_0 { WCHAR[DNLEN + 1] wszLogonDomain = 0; BOOL fAdvancedServer; } -alias RAS_PORT_0* PRAS_PORT_0; +alias PRAS_PORT_0 = RAS_PORT_0*; struct RAS_PPP_NBFCP_RESULT { DWORD dwError; @@ -156,7 +156,7 @@ struct RAS_PORT_1 { DWORD SizeMediaParms; RAS_PPP_PROJECTION_RESULT ProjResult; } -alias RAS_PORT_1* PRAS_PORT_1; +alias PRAS_PORT_1 = RAS_PORT_1*; struct RAS_PORT_STATISTICS { DWORD dwBytesXmited; @@ -188,14 +188,14 @@ struct RAS_PORT_STATISTICS { DWORD dwPortBytesXmitedCompressed; DWORD dwPortBytesRcvedCompressed; } -alias RAS_PORT_STATISTICS* PRAS_PORT_STATISTICS; +alias PRAS_PORT_STATISTICS = RAS_PORT_STATISTICS*; struct RAS_SERVER_0 { WORD TotalPorts; WORD PortsInUse; DWORD RasVersion; } -alias RAS_SERVER_0* PRAS_SERVER_0; +alias PRAS_SERVER_0 = RAS_SERVER_0*; extern (Windows) { DWORD RasAdminServerGetInfo(const(WCHAR)*, PRAS_SERVER_0); diff --git a/runtime/druntime/src/core/sys/windows/regstr.d b/runtime/druntime/src/core/sys/windows/regstr.d index f8851fa720b..9327c46913a 100644 --- a/runtime/druntime/src/core/sys/windows/regstr.d +++ b/runtime/druntime/src/core/sys/windows/regstr.d @@ -813,4 +813,4 @@ struct DSKTLSYSTEMTIME { WORD wMilliseconds; WORD wResult; } -alias DSKTLSYSTEMTIME* PDSKTLSYSTEMTIME, LPDSKTLSYSTEMTIME; +alias PDSKTLSYSTEMTIME = DSKTLSYSTEMTIME*, LPDSKTLSYSTEMTIME = DSKTLSYSTEMTIME*; diff --git a/runtime/druntime/src/core/sys/windows/richedit.d b/runtime/druntime/src/core/sys/windows/richedit.d index 0f56fef0979..c128d79fd43 100644 --- a/runtime/druntime/src/core/sys/windows/richedit.d +++ b/runtime/druntime/src/core/sys/windows/richedit.d @@ -287,7 +287,7 @@ enum SCF_WORD = 2; enum SCF_ALL = 4; enum SCF_USEUIRULES = 8; -alias DWORD TEXTMODE; +alias TEXTMODE = DWORD; enum TM_PLAINTEXT=1; enum TM_RICHTEXT=2; enum TM_SINGLELEVELUNDO=4; @@ -301,7 +301,7 @@ enum GT_USECRLF=1; enum yHeightCharPtsMost=1638; enum lDefaultTab=720; -alias DWORD UNDONAMEID; +alias UNDONAMEID = DWORD; enum UID_UNKNOWN = 0; enum UID_TYPING = 1; enum UID_DELETE = 2; @@ -388,7 +388,7 @@ struct COMPCOLOR { } extern (Windows) { - alias DWORD function(DWORD_PTR,PBYTE,LONG,LONG*) EDITSTREAMCALLBACK; + alias EDITSTREAMCALLBACK = DWORD function(DWORD_PTR,PBYTE,LONG,LONG*); } struct EDITSTREAM { @@ -438,7 +438,7 @@ align(4): LPARAM lParam; CHARRANGE chrg; } -alias ENPROTECTED* LPENPROTECTED; +alias LPENPROTECTED = ENPROTECTED*; struct ENSAVECLIPBOARD { align(4): @@ -568,7 +568,7 @@ align(4): } extern (Windows) { -alias LONG function(char*,LONG,BYTE,INT) EDITWORDBREAKPROCEX; +alias EDITWORDBREAKPROCEX = LONG function(char*,LONG,BYTE,INT); } /* Defines for EM_SETTYPOGRAPHYOPTIONS */ @@ -590,15 +590,15 @@ align(4): } version (Unicode) { - alias CHARFORMATW CHARFORMAT; - alias CHARFORMAT2W CHARFORMAT2; - alias FINDTEXTW FINDTEXT; - alias FINDTEXTEXW FINDTEXTEX; - alias TEXTRANGEW TEXTRANGE; + alias CHARFORMAT = CHARFORMATW; + alias CHARFORMAT2 = CHARFORMAT2W; + alias FINDTEXT = FINDTEXTW; + alias FINDTEXTEX = FINDTEXTEXW; + alias TEXTRANGE = TEXTRANGEW; } else { - alias CHARFORMATA CHARFORMAT; - alias CHARFORMAT2A CHARFORMAT2; - alias FINDTEXTA FINDTEXT; - alias FINDTEXTEXA FINDTEXTEX; - alias TEXTRANGEA TEXTRANGE; + alias CHARFORMAT = CHARFORMATA; + alias CHARFORMAT2 = CHARFORMAT2A; + alias FINDTEXT = FINDTEXTA; + alias FINDTEXTEX = FINDTEXTEXA; + alias TEXTRANGE = TEXTRANGEA; } diff --git a/runtime/druntime/src/core/sys/windows/richole.d b/runtime/druntime/src/core/sys/windows/richole.d index 01518189df0..e44ee4348df 100644 --- a/runtime/druntime/src/core/sys/windows/richole.d +++ b/runtime/druntime/src/core/sys/windows/richole.d @@ -84,7 +84,7 @@ interface IRichEditOle : IUnknown { HRESULT GetClipboardData(CHARRANGE*, DWORD, LPDATAOBJECT*); HRESULT ImportDataObject(LPDATAOBJECT, CLIPFORMAT, HGLOBAL); } -alias IRichEditOle LPRICHEDITOLE; +alias LPRICHEDITOLE = IRichEditOle; interface IRichEditOleCallback : IUnknown { HRESULT GetNewStorage(LPSTORAGE*); @@ -98,4 +98,4 @@ interface IRichEditOleCallback : IUnknown { HRESULT GetDragDropEffect(BOOL, DWORD, PDWORD); HRESULT GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE*, HMENU*); } -alias IRichEditOleCallback LPRICHEDITOLECALLBACK; +alias LPRICHEDITOLECALLBACK = IRichEditOleCallback; diff --git a/runtime/druntime/src/core/sys/windows/rpc.d b/runtime/druntime/src/core/sys/windows/rpc.d index 3b7e28d213c..77d6064667c 100644 --- a/runtime/druntime/src/core/sys/windows/rpc.d +++ b/runtime/druntime/src/core/sys/windows/rpc.d @@ -23,8 +23,8 @@ public import core.sys.windows.rpcnsi; public import core.sys.windows.rpcnterr; public import core.sys.windows.winerror; -alias MIDL_user_allocate midl_user_allocate; -alias MIDL_user_free midl_user_free; +alias midl_user_allocate = MIDL_user_allocate; +alias midl_user_free = MIDL_user_free; extern (Windows) nothrow @nogc { int I_RpcMapWin32Status(RPC_STATUS); diff --git a/runtime/druntime/src/core/sys/windows/rpcdce.d b/runtime/druntime/src/core/sys/windows/rpcdce.d index 951480b955d..83a5a828c1a 100644 --- a/runtime/druntime/src/core/sys/windows/rpcdce.d +++ b/runtime/druntime/src/core/sys/windows/rpcdce.d @@ -20,9 +20,9 @@ import core.sys.windows.basetyps, core.sys.windows.w32api, core.sys.windows.wind // FIXME: clean up Windows version support -alias UUID uuid_t; -alias UUID_VECTOR uuid_vector_t; -alias void RPC_MGR_EPV; +alias uuid_t = UUID; +alias uuid_vector_t = UUID_VECTOR; +alias RPC_MGR_EPV = void; // for RpcMgmtSetComTimeout() enum : uint { @@ -114,16 +114,16 @@ enum RPC_C_AUTHZ_NAME=1; enum RPC_C_AUTHZ_DCE=2; enum RPC_C_AUTHZ_DEFAULT=0xFFFFFFFF; -alias I_RPC_HANDLE RPC_BINDING_HANDLE; -alias RPC_BINDING_HANDLE handle_t; +alias RPC_BINDING_HANDLE = I_RPC_HANDLE; +alias handle_t = RPC_BINDING_HANDLE; struct RPC_BINDING_VECTOR { uint Count; RPC_BINDING_HANDLE[1] BindingH; } -alias RPC_BINDING_HANDLE rpc_binding_handle_t; -alias RPC_BINDING_VECTOR rpc_binding_vector_t; +alias rpc_binding_handle_t = RPC_BINDING_HANDLE; +alias rpc_binding_vector_t = RPC_BINDING_VECTOR; struct UUID_VECTOR { @@ -131,7 +131,7 @@ struct UUID_VECTOR { UUID*[1] Uuid; } -alias void* RPC_IF_HANDLE; +alias RPC_IF_HANDLE = void*; struct RPC_IF_ID { UUID Uuid; @@ -144,11 +144,11 @@ struct RPC_POLICY { uint EndpointFlags; uint NICFlags; } -alias RPC_POLICY* PRPC_POLICY; +alias PRPC_POLICY = RPC_POLICY*; extern (Windows) { - alias void function(UUID*, UUID*, RPC_STATUS*) RPC_OBJECT_INQ_FN; - alias RPC_STATUS function(RPC_IF_HANDLE, void*) RPC_IF_CALLBACK_FN; + alias RPC_OBJECT_INQ_FN = void function(UUID*, UUID*, RPC_STATUS*); + alias RPC_IF_CALLBACK_FN = RPC_STATUS function(RPC_IF_HANDLE, void*); } struct RPC_STATS_VECTOR { @@ -169,7 +169,7 @@ struct RPC_SECURITY_QOS { uint IdentityTracking; uint ImpersonationType; } -alias RPC_SECURITY_QOS* PRPC_SECURITY_QOS; +alias PRPC_SECURITY_QOS = RPC_SECURITY_QOS*; struct SEC_WINNT_AUTH_IDENTITY_W { ushort* User; @@ -180,7 +180,7 @@ struct SEC_WINNT_AUTH_IDENTITY_W { uint PasswordLength; uint Flags; } -alias SEC_WINNT_AUTH_IDENTITY_W* PSEC_WINNT_AUTH_IDENTITY_W; +alias PSEC_WINNT_AUTH_IDENTITY_W = SEC_WINNT_AUTH_IDENTITY_W*; struct SEC_WINNT_AUTH_IDENTITY_A { ubyte* User; @@ -191,7 +191,7 @@ struct SEC_WINNT_AUTH_IDENTITY_A { uint PasswordLength; uint Flags; } -alias SEC_WINNT_AUTH_IDENTITY_A* PSEC_WINNT_AUTH_IDENTITY_A; +alias PSEC_WINNT_AUTH_IDENTITY_A = SEC_WINNT_AUTH_IDENTITY_A*; struct RPC_CLIENT_INFORMATION1 { ubyte* UserName; @@ -199,10 +199,10 @@ struct RPC_CLIENT_INFORMATION1 { ushort Privilege; uint AuthFlags; } -alias RPC_CLIENT_INFORMATION1* PRPC_CLIENT_INFORMATION1; -alias I_RPC_HANDLE* RPC_EP_INQ_HANDLE; +alias PRPC_CLIENT_INFORMATION1 = RPC_CLIENT_INFORMATION1*; +alias RPC_EP_INQ_HANDLE = I_RPC_HANDLE*; extern (Windows) { - alias int function(RPC_BINDING_HANDLE, uint, RPC_STATUS*) RPC_MGMT_AUTHORIZATION_FN; + alias RPC_MGMT_AUTHORIZATION_FN = int function(RPC_BINDING_HANDLE, uint, RPC_STATUS*); } struct RPC_PROTSEQ_VECTORA { @@ -260,7 +260,7 @@ extern (Windows) { RPC_STATUS RpcBindingSetAuthInfoExW(RPC_BINDING_HANDLE, wchar*, uint, uint, RPC_AUTH_IDENTITY_HANDLE, uint, RPC_SECURITY_QOS*); RPC_STATUS RpcBindingInqAuthInfoExA(RPC_BINDING_HANDLE, char**, uint*, uint*, RPC_AUTH_IDENTITY_HANDLE*, uint*, uint, RPC_SECURITY_QOS*); RPC_STATUS RpcBindingInqAuthInfoExW(RPC_BINDING_HANDLE, wchar**, uint*, uint*, RPC_AUTH_IDENTITY_HANDLE*, uint*, uint, RPC_SECURITY_QOS*); - alias void function(void*, wchar*, uint, void**, RPC_STATUS*) RPC_AUTH_KEY_RETRIEVAL_FN; + alias RPC_AUTH_KEY_RETRIEVAL_FN = void function(void*, wchar*, uint, void**, RPC_STATUS*); RPC_STATUS RpcServerRegisterAuthInfoA(char*, uint, RPC_AUTH_KEY_RETRIEVAL_FN, void*); RPC_STATUS RpcServerRegisterAuthInfoW(wchar*, uint, RPC_AUTH_KEY_RETRIEVAL_FN, void*); RPC_STATUS UuidToStringA(UUID*, char**); @@ -282,71 +282,71 @@ extern (Windows) { } version (Unicode) { - alias RPC_PROTSEQ_VECTORW RPC_PROTSEQ_VECTOR; - alias SEC_WINNT_AUTH_IDENTITY_W SEC_WINNT_AUTH_IDENTITY; - alias PSEC_WINNT_AUTH_IDENTITY_W PSEC_WINNT_AUTH_IDENTITY; - alias RpcMgmtEpEltInqNextW RpcMgmtEpEltInqNext; - alias RpcBindingFromStringBindingW RpcBindingFromStringBinding; - alias RpcBindingToStringBindingW RpcBindingToStringBinding; - alias RpcStringBindingComposeW RpcStringBindingCompose; - alias RpcStringBindingParseW RpcStringBindingParse; - alias RpcStringFreeW RpcStringFree; - alias RpcNetworkIsProtseqValidW RpcNetworkIsProtseqValid; - alias RpcNetworkInqProtseqsW RpcNetworkInqProtseqs; - alias RpcProtseqVectorFreeW RpcProtseqVectorFree; - alias RpcServerUseProtseqW RpcServerUseProtseq; - alias RpcServerUseProtseqExW RpcServerUseProtseqEx; - alias RpcServerUseProtseqEpW RpcServerUseProtseqEp; - alias RpcServerUseProtseqEpExW RpcServerUseProtseqEpEx; - alias RpcServerUseProtseqIfW RpcServerUseProtseqIf; - alias RpcServerUseProtseqIfExW RpcServerUseProtseqIfEx; - alias RpcMgmtInqServerPrincNameW RpcMgmtInqServerPrincName; - alias RpcServerInqDefaultPrincNameW RpcServerInqDefaultPrincName; - alias RpcNsBindingInqEntryNameW RpcNsBindingInqEntryName; - alias RpcBindingInqAuthClientW RpcBindingInqAuthClient; - alias RpcBindingInqAuthInfoW RpcBindingInqAuthInfo; - alias RpcBindingSetAuthInfoW RpcBindingSetAuthInfo; - alias RpcServerRegisterAuthInfoW RpcServerRegisterAuthInfo; - alias RpcBindingInqAuthInfoExW RpcBindingInqAuthInfoEx; - alias RpcBindingSetAuthInfoExW RpcBindingSetAuthInfoEx; - alias UuidFromStringW UuidFromString; - alias UuidToStringW UuidToString; - alias RpcEpRegisterNoReplaceW RpcEpRegisterNoReplace; - alias RpcEpRegisterW RpcEpRegister; - alias DceErrorInqTextW DceErrorInqText; + alias RPC_PROTSEQ_VECTOR = RPC_PROTSEQ_VECTORW; + alias SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_W; + alias PSEC_WINNT_AUTH_IDENTITY = PSEC_WINNT_AUTH_IDENTITY_W; + alias RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextW; + alias RpcBindingFromStringBinding = RpcBindingFromStringBindingW; + alias RpcBindingToStringBinding = RpcBindingToStringBindingW; + alias RpcStringBindingCompose = RpcStringBindingComposeW; + alias RpcStringBindingParse = RpcStringBindingParseW; + alias RpcStringFree = RpcStringFreeW; + alias RpcNetworkIsProtseqValid = RpcNetworkIsProtseqValidW; + alias RpcNetworkInqProtseqs = RpcNetworkInqProtseqsW; + alias RpcProtseqVectorFree = RpcProtseqVectorFreeW; + alias RpcServerUseProtseq = RpcServerUseProtseqW; + alias RpcServerUseProtseqEx = RpcServerUseProtseqExW; + alias RpcServerUseProtseqEp = RpcServerUseProtseqEpW; + alias RpcServerUseProtseqEpEx = RpcServerUseProtseqEpExW; + alias RpcServerUseProtseqIf = RpcServerUseProtseqIfW; + alias RpcServerUseProtseqIfEx = RpcServerUseProtseqIfExW; + alias RpcMgmtInqServerPrincName = RpcMgmtInqServerPrincNameW; + alias RpcServerInqDefaultPrincName = RpcServerInqDefaultPrincNameW; + alias RpcNsBindingInqEntryName = RpcNsBindingInqEntryNameW; + alias RpcBindingInqAuthClient = RpcBindingInqAuthClientW; + alias RpcBindingInqAuthInfo = RpcBindingInqAuthInfoW; + alias RpcBindingSetAuthInfo = RpcBindingSetAuthInfoW; + alias RpcServerRegisterAuthInfo = RpcServerRegisterAuthInfoW; + alias RpcBindingInqAuthInfoEx = RpcBindingInqAuthInfoExW; + alias RpcBindingSetAuthInfoEx = RpcBindingSetAuthInfoExW; + alias UuidFromString = UuidFromStringW; + alias UuidToString = UuidToStringW; + alias RpcEpRegisterNoReplace = RpcEpRegisterNoReplaceW; + alias RpcEpRegister = RpcEpRegisterW; + alias DceErrorInqText = DceErrorInqTextW; } else { // Ansi - alias RPC_PROTSEQ_VECTORA RPC_PROTSEQ_VECTOR; - alias SEC_WINNT_AUTH_IDENTITY_A SEC_WINNT_AUTH_IDENTITY; - alias PSEC_WINNT_AUTH_IDENTITY_A PSEC_WINNT_AUTH_IDENTITY; - alias RpcMgmtEpEltInqNextA RpcMgmtEpEltInqNext; - alias RpcBindingFromStringBindingA RpcBindingFromStringBinding; - alias RpcBindingToStringBindingA RpcBindingToStringBinding; - alias RpcStringBindingComposeA RpcStringBindingCompose; - alias RpcStringBindingParseA RpcStringBindingParse; - alias RpcStringFreeA RpcStringFree; - alias RpcNetworkIsProtseqValidA RpcNetworkIsProtseqValid; - alias RpcNetworkInqProtseqsA RpcNetworkInqProtseqs; - alias RpcProtseqVectorFreeA RpcProtseqVectorFree; - alias RpcServerUseProtseqA RpcServerUseProtseq; - alias RpcServerUseProtseqExA RpcServerUseProtseqEx; - alias RpcServerUseProtseqEpA RpcServerUseProtseqEp; - alias RpcServerUseProtseqEpExA RpcServerUseProtseqEpEx; - alias RpcServerUseProtseqIfA RpcServerUseProtseqIf; - alias RpcServerUseProtseqIfExA RpcServerUseProtseqIfEx; - alias RpcMgmtInqServerPrincNameA RpcMgmtInqServerPrincName; - alias RpcServerInqDefaultPrincNameA RpcServerInqDefaultPrincName; - alias RpcNsBindingInqEntryNameA RpcNsBindingInqEntryName; - alias RpcBindingInqAuthClientA RpcBindingInqAuthClient; - alias RpcBindingInqAuthInfoA RpcBindingInqAuthInfo; - alias RpcBindingSetAuthInfoA RpcBindingSetAuthInfo; - alias RpcServerRegisterAuthInfoA RpcServerRegisterAuthInfo; - alias RpcBindingInqAuthInfoExA RpcBindingInqAuthInfoEx; - alias RpcBindingSetAuthInfoExA RpcBindingSetAuthInfoEx; - alias UuidFromStringA UuidFromString; - alias UuidToStringA UuidToString; - alias RpcEpRegisterNoReplaceA RpcEpRegisterNoReplace; - alias RpcEpRegisterA RpcEpRegister; - alias DceErrorInqTextA DceErrorInqText; + alias RPC_PROTSEQ_VECTOR = RPC_PROTSEQ_VECTORA; + alias SEC_WINNT_AUTH_IDENTITY = SEC_WINNT_AUTH_IDENTITY_A; + alias PSEC_WINNT_AUTH_IDENTITY = PSEC_WINNT_AUTH_IDENTITY_A; + alias RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextA; + alias RpcBindingFromStringBinding = RpcBindingFromStringBindingA; + alias RpcBindingToStringBinding = RpcBindingToStringBindingA; + alias RpcStringBindingCompose = RpcStringBindingComposeA; + alias RpcStringBindingParse = RpcStringBindingParseA; + alias RpcStringFree = RpcStringFreeA; + alias RpcNetworkIsProtseqValid = RpcNetworkIsProtseqValidA; + alias RpcNetworkInqProtseqs = RpcNetworkInqProtseqsA; + alias RpcProtseqVectorFree = RpcProtseqVectorFreeA; + alias RpcServerUseProtseq = RpcServerUseProtseqA; + alias RpcServerUseProtseqEx = RpcServerUseProtseqExA; + alias RpcServerUseProtseqEp = RpcServerUseProtseqEpA; + alias RpcServerUseProtseqEpEx = RpcServerUseProtseqEpExA; + alias RpcServerUseProtseqIf = RpcServerUseProtseqIfA; + alias RpcServerUseProtseqIfEx = RpcServerUseProtseqIfExA; + alias RpcMgmtInqServerPrincName = RpcMgmtInqServerPrincNameA; + alias RpcServerInqDefaultPrincName = RpcServerInqDefaultPrincNameA; + alias RpcNsBindingInqEntryName = RpcNsBindingInqEntryNameA; + alias RpcBindingInqAuthClient = RpcBindingInqAuthClientA; + alias RpcBindingInqAuthInfo = RpcBindingInqAuthInfoA; + alias RpcBindingSetAuthInfo = RpcBindingSetAuthInfoA; + alias RpcServerRegisterAuthInfo = RpcServerRegisterAuthInfoA; + alias RpcBindingInqAuthInfoEx = RpcBindingInqAuthInfoExA; + alias RpcBindingSetAuthInfoEx = RpcBindingSetAuthInfoExA; + alias UuidFromString = UuidFromStringA; + alias UuidToString = UuidToStringA; + alias RpcEpRegisterNoReplace = RpcEpRegisterNoReplaceA; + alias RpcEpRegister = RpcEpRegisterA; + alias DceErrorInqText = DceErrorInqTextA; } //#endif // UNICODE extern (Windows) { diff --git a/runtime/druntime/src/core/sys/windows/rpcdce2.d b/runtime/druntime/src/core/sys/windows/rpcdce2.d index 08348c06235..85b4cb146a3 100644 --- a/runtime/druntime/src/core/sys/windows/rpcdce2.d +++ b/runtime/druntime/src/core/sys/windows/rpcdce2.d @@ -69,11 +69,11 @@ extern (Windows) { } version (Unicode) { - alias RpcMgmtEpEltInqNextW RpcMgmtEpEltInqNext; - alias DceErrorInqTextW DceErrorInqText; + alias RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextW; + alias DceErrorInqText = DceErrorInqTextW; } else { - alias RpcMgmtEpEltInqNextA RpcMgmtEpEltInqNext; - alias DceErrorInqTextA DceErrorInqText; + alias RpcMgmtEpEltInqNext = RpcMgmtEpEltInqNextA; + alias DceErrorInqText = DceErrorInqTextA; } /+ #else /* RPC_UNICODE_SUPPORTED */ diff --git a/runtime/druntime/src/core/sys/windows/rpcdcep.d b/runtime/druntime/src/core/sys/windows/rpcdcep.d index 421c2752b1c..d123feb1efa 100644 --- a/runtime/druntime/src/core/sys/windows/rpcdcep.d +++ b/runtime/druntime/src/core/sys/windows/rpcdcep.d @@ -16,7 +16,7 @@ import core.sys.windows.w32api; import core.sys.windows.windef; alias I_RPC_HANDLE = HANDLE; -alias long RPC_STATUS; +alias RPC_STATUS = long; enum RPC_NCA_FLAGS_DEFAULT=0; enum RPC_NCA_FLAGS_IDEMPOTENT=1; @@ -39,7 +39,7 @@ struct RPC_SYNTAX_IDENTIFIER { GUID SyntaxGUID; RPC_VERSION SyntaxVersion; } -alias RPC_SYNTAX_IDENTIFIER* PRPC_SYNTAX_IDENTIFIER; +alias PRPC_SYNTAX_IDENTIFIER = RPC_SYNTAX_IDENTIFIER*; struct RPC_MESSAGE { HANDLE Handle; @@ -54,10 +54,10 @@ struct RPC_MESSAGE { void* ImportContext; uint RpcFlags; } -alias RPC_MESSAGE* PRPC_MESSAGE; +alias PRPC_MESSAGE = RPC_MESSAGE*; extern (Windows) { -alias void function (PRPC_MESSAGE Message) RPC_DISPATCH_FUNCTION; +alias RPC_DISPATCH_FUNCTION = void function (PRPC_MESSAGE Message); } struct RPC_DISPATCH_TABLE { @@ -65,13 +65,13 @@ struct RPC_DISPATCH_TABLE { RPC_DISPATCH_FUNCTION* DispatchTable; LONG_PTR Reserved; } -alias RPC_DISPATCH_TABLE* PRPC_DISPATCH_TABLE; +alias PRPC_DISPATCH_TABLE = RPC_DISPATCH_TABLE*; struct RPC_PROTSEQ_ENDPOINT { ubyte* RpcProtocolSequence; ubyte* Endpoint; } -alias RPC_PROTSEQ_ENDPOINT* PRPC_PROTSEQ_ENDPOINT; +alias PRPC_PROTSEQ_ENDPOINT = RPC_PROTSEQ_ENDPOINT*; struct RPC_SERVER_INTERFACE { uint Length; @@ -83,7 +83,7 @@ struct RPC_SERVER_INTERFACE { void* DefaultManagerEpv; const(void)* InterpreterInfo; } -alias RPC_SERVER_INTERFACE* PRPC_SERVER_INTERFACE; +alias PRPC_SERVER_INTERFACE = RPC_SERVER_INTERFACE*; struct RPC_CLIENT_INTERFACE { uint Length; @@ -95,19 +95,19 @@ struct RPC_CLIENT_INTERFACE { ULONG_PTR Reserved; const(void)* InterpreterInfo; } -alias RPC_CLIENT_INTERFACE* PRPC_CLIENT_INTERFACE; +alias PRPC_CLIENT_INTERFACE = RPC_CLIENT_INTERFACE*; -alias void* I_RPC_MUTEX; +alias I_RPC_MUTEX = void*; struct RPC_TRANSFER_SYNTAX { GUID Uuid; ushort VersMajor; ushort VersMinor; } -alias RPC_STATUS function(void*, void*, void*) RPC_BLOCKING_FN; +alias RPC_BLOCKING_FN = RPC_STATUS function(void*, void*, void*); extern (Windows) { - alias void function(void*) PRPC_RUNDOWN; + alias PRPC_RUNDOWN = void function(void*); int I_RpcGetBuffer(RPC_MESSAGE*); int I_RpcSendReceive(RPC_MESSAGE*); @@ -147,7 +147,7 @@ extern (Windows) { } version (Unicode) { - alias I_RpcServerUnregisterEndpointW I_RpcServerUnregisterEndpoint; + alias I_RpcServerUnregisterEndpoint = I_RpcServerUnregisterEndpointW; } else { - alias I_RpcServerUnregisterEndpointA I_RpcServerUnregisterEndpoint; + alias I_RpcServerUnregisterEndpoint = I_RpcServerUnregisterEndpointA; } diff --git a/runtime/druntime/src/core/sys/windows/rpcndr.d b/runtime/druntime/src/core/sys/windows/rpcndr.d index f5744ecdb0c..ee9417fbbad 100644 --- a/runtime/druntime/src/core/sys/windows/rpcndr.d +++ b/runtime/druntime/src/core/sys/windows/rpcndr.d @@ -37,12 +37,12 @@ enum uint NDR_CHAR_REP_MASK = 0xF, NDR_LOCAL_DATA_REPRESENTATION = 0x10, NDR_LOCAL_ENDIAN = NDR_LITTLE_ENDIAN; -alias MIDL_user_allocate midl_user_allocate; -alias MIDL_user_free midl_user_free; +alias midl_user_allocate = MIDL_user_allocate; +alias midl_user_free = MIDL_user_free; -alias long hyper; -alias ulong MIDL_uhyper; -alias char small; +alias hyper = long; +alias MIDL_uhyper = ulong; +alias small = char; enum cbNDRContext=20; //MACRO #define NDRSContextValue(hContext) (&(hContext)->userContext) @@ -97,27 +97,27 @@ enum cbNDRContext=20; //MACRO #define NdrFcShort(s) (unsigned char)(s & 0xff), (unsigned char)(s >> 8) //MACRO #define NdrFcLong(s) (unsigned char)(s & 0xff), (unsigned char)((s & 0x0000ff00) >> 8), (unsigned char)((s & 0x00ff0000) >> 16), (unsigned char)(s >> 24) -alias void * NDR_CCONTEXT; +alias NDR_CCONTEXT = void *; struct tagNDR_SCONTEXT { void*[2] pad; void *userContext; } -alias tagNDR_SCONTEXT * NDR_SCONTEXT; +alias NDR_SCONTEXT = tagNDR_SCONTEXT *; struct SCONTEXT_QUEUE { uint NumberOfObjects; NDR_SCONTEXT *ArrayOfObjects; } -alias SCONTEXT_QUEUE * PSCONTEXT_QUEUE; +alias PSCONTEXT_QUEUE = SCONTEXT_QUEUE *; struct _MIDL_STUB_MESSAGE; struct _MIDL_STUB_DESC; struct _FULL_PTR_XLAT_TABLES; -alias ubyte *RPC_BUFPTR; -alias uint RPC_LENGTH; +alias RPC_BUFPTR = ubyte *; +alias RPC_LENGTH = uint; -alias const(char)* PFORMAT_STRING; +alias PFORMAT_STRING = const(char)*; struct ARRAY_INFO { int Dimension; @@ -127,7 +127,7 @@ struct ARRAY_INFO { uint *OffsetArray; uint *ActualCountArray; } -alias ARRAY_INFO * PARRAY_INFO; +alias PARRAY_INFO = ARRAY_INFO *; RPC_BINDING_HANDLE NDRCContextBinding(NDR_CCONTEXT); void NDRCContextMarshall(NDR_CCONTEXT,void*); @@ -212,16 +212,16 @@ const(_MIDL_STUB_DESC)* StubDesc; uint dwStubPhase; INT_PTR[5] w2kReserved; } -alias MIDL_STUB_MESSAGE * PMIDL_STUB_MESSAGE; +alias PMIDL_STUB_MESSAGE = MIDL_STUB_MESSAGE *; extern (Windows) { - alias void* function (void*) GENERIC_BINDING_ROUTINE; - alias void function (void*,ubyte*) GENERIC_UNBIND_ROUTINE; - alias uint function (uint *,uint,void *) USER_MARSHAL_SIZING_ROUTINE; - alias ubyte * function (uint *,ubyte *,void *) USER_MARSHAL_MARSHALLING_ROUTINE; - alias ubyte * function (uint *,ubyte *,void *) USER_MARSHAL_UNMARSHALLING_ROUTINE; - alias void function (uint *,void *) USER_MARSHAL_FREEING_ROUTINE; - alias void function () NDR_NOTIFY_ROUTINE; + alias GENERIC_BINDING_ROUTINE = void* function (void*); + alias GENERIC_UNBIND_ROUTINE = void function (void*,ubyte*); + alias USER_MARSHAL_SIZING_ROUTINE = uint function (uint *,uint,void *); + alias USER_MARSHAL_MARSHALLING_ROUTINE = ubyte * function (uint *,ubyte *,void *); + alias USER_MARSHAL_UNMARSHALLING_ROUTINE = ubyte * function (uint *,ubyte *,void *); + alias USER_MARSHAL_FREEING_ROUTINE = void function (uint *,void *); + alias NDR_NOTIFY_ROUTINE = void function (); } align: @@ -229,7 +229,7 @@ struct GENERIC_BINDING_ROUTINE_PAIR { GENERIC_BINDING_ROUTINE pfnBind; GENERIC_UNBIND_ROUTINE pfnUnbind; } -alias GENERIC_BINDING_ROUTINE_PAIR * PGENERIC_BINDING_ROUTINE_PAIR; +alias PGENERIC_BINDING_ROUTINE_PAIR = GENERIC_BINDING_ROUTINE_PAIR *; struct GENERIC_BINDING_INFO { void *pObj; @@ -237,7 +237,7 @@ struct GENERIC_BINDING_INFO { GENERIC_BINDING_ROUTINE pfnBind; GENERIC_UNBIND_ROUTINE pfnUnbind; } -alias GENERIC_BINDING_INFO * PGENERIC_BINDING_INFO; +alias PGENERIC_BINDING_INFO = GENERIC_BINDING_INFO *; struct XMIT_ROUTINE_QUINTUPLE { @@ -246,7 +246,7 @@ struct XMIT_ROUTINE_QUINTUPLE { XMIT_HELPER_ROUTINE pfnFreeXmit; XMIT_HELPER_ROUTINE pfnFreeInst; } -alias XMIT_ROUTINE_QUINTUPLE * PXMIT_ROUTINE_QUINTUPLE; +alias PXMIT_ROUTINE_QUINTUPLE = XMIT_ROUTINE_QUINTUPLE *; struct MALLOC_FREE_STRUCT { void* function (uint) pfnAllocate; @@ -310,9 +310,9 @@ const(NDR_CS_ROUTINES)* CsRoutineTables; void *Reserved4; ULONG_PTR Reserved5; } -alias const(MIDL_STUB_DESC)* PMIDL_STUB_DESC; +alias PMIDL_STUB_DESC = const(MIDL_STUB_DESC)*; -alias void * PMIDL_XMIT_TYPE; +alias PMIDL_XMIT_TYPE = void *; struct MIDL_FORMAT_STRING { short Pad; @@ -326,14 +326,14 @@ const(SERVER_ROUTINE)* DispatchTable; const(ushort)* FmtStringOffset; const(STUB_THUNK)* ThunkTable; } -alias MIDL_SERVER_INFO * PMIDL_SERVER_INFO; +alias PMIDL_SERVER_INFO = MIDL_SERVER_INFO *; struct MIDL_STUBLESS_PROXY_INFO { PMIDL_STUB_DESC pStubDesc; PFORMAT_STRING ProcFormatString; const(ushort)* FormatStringOffset; } -alias MIDL_STUBLESS_PROXY_INFO *PMIDL_STUBLESS_PROXY_INFO; +alias PMIDL_STUBLESS_PROXY_INFO = MIDL_STUBLESS_PROXY_INFO *; union CLIENT_CALL_RETURN { void *Pointer; @@ -350,7 +350,7 @@ struct FULL_PTR_TO_REFID_ELEMENT { uint RefId; ubyte State; } -alias FULL_PTR_TO_REFID_ELEMENT * PFULL_PTR_TO_REFID_ELEMENT; +alias PFULL_PTR_TO_REFID_ELEMENT = FULL_PTR_TO_REFID_ELEMENT *; struct FULL_PTR_XLAT_TABLES { struct _RefIdToPointer { @@ -369,7 +369,7 @@ struct FULL_PTR_XLAT_TABLES { uint NextRefId; XLAT_SIDE XlatSide; } -alias FULL_PTR_XLAT_TABLES * PFULL_PTR_XLAT_TABLES; +alias PFULL_PTR_XLAT_TABLES = FULL_PTR_XLAT_TABLES *; enum STUB_PHASE { @@ -387,25 +387,25 @@ enum PROXY_PHASE { PROXY_UNMARSHAL } -alias void * RPC_SS_THREAD_HANDLE; +alias RPC_SS_THREAD_HANDLE = void *; extern (Windows) { -alias void function (void*) NDR_RUNDOWN; -alias void function (_MIDL_STUB_MESSAGE*) EXPR_EVAL; -alias void function(PMIDL_STUB_MESSAGE) XMIT_HELPER_ROUTINE; -alias void function (RPC_BINDING_HANDLE,uint,uint,IDL_CS_CONVERT*,uint*,error_status_t*) CS_TYPE_NET_SIZE_ROUTINE; -alias void function (RPC_BINDING_HANDLE,uint,uint,IDL_CS_CONVERT*,uint*,error_status_t*) CS_TYPE_LOCAL_SIZE_ROUTINE; -alias void function (RPC_BINDING_HANDLE,uint,void*,uint,byte*,uint*,error_status_t*) CS_TYPE_TO_NETCS_ROUTINE; -alias void function (RPC_BINDING_HANDLE,uint,byte*,uint,uint,void*,uint*,error_status_t*) CS_TYPE_FROM_NETCS_ROUTINE; -alias void function (RPC_BINDING_HANDLE,int,uint*,uint*,uint*,error_status_t*) CS_TAG_GETTING_ROUTINE; +alias NDR_RUNDOWN = void function (void*); +alias EXPR_EVAL = void function (_MIDL_STUB_MESSAGE*); +alias XMIT_HELPER_ROUTINE = void function(PMIDL_STUB_MESSAGE); +alias CS_TYPE_NET_SIZE_ROUTINE = void function (RPC_BINDING_HANDLE,uint,uint,IDL_CS_CONVERT*,uint*,error_status_t*); +alias CS_TYPE_LOCAL_SIZE_ROUTINE = void function (RPC_BINDING_HANDLE,uint,uint,IDL_CS_CONVERT*,uint*,error_status_t*); +alias CS_TYPE_TO_NETCS_ROUTINE = void function (RPC_BINDING_HANDLE,uint,void*,uint,byte*,uint*,error_status_t*); +alias CS_TYPE_FROM_NETCS_ROUTINE = void function (RPC_BINDING_HANDLE,uint,byte*,uint,uint,void*,uint*,error_status_t*); +alias CS_TAG_GETTING_ROUTINE = void function (RPC_BINDING_HANDLE,int,uint*,uint*,uint*,error_status_t*); //alias void* RPC_CLIENT_ALLOC(uint); //alias void RPC_CLIENT_FREE(void*); -alias void* function(uint) PRPC_CLIENT_ALLOC; -alias void function(void*) PRPC_CLIENT_FREE; +alias PRPC_CLIENT_ALLOC = void* function(uint); +alias PRPC_CLIENT_FREE = void function(void*); - alias void function (PMIDL_STUB_MESSAGE) STUB_THUNK; - alias int function() SERVER_ROUTINE; + alias STUB_THUNK = void function (PMIDL_STUB_MESSAGE); + alias SERVER_ROUTINE = int function(); } void NdrSimpleTypeMarshall(PMIDL_STUB_MESSAGE,ubyte*,ubyte); diff --git a/runtime/druntime/src/core/sys/windows/rpcnsi.d b/runtime/druntime/src/core/sys/windows/rpcnsi.d index 60c7b0972af..ee2d2093e23 100644 --- a/runtime/druntime/src/core/sys/windows/rpcnsi.d +++ b/runtime/druntime/src/core/sys/windows/rpcnsi.d @@ -107,45 +107,45 @@ version (Unicode) { } version (Unicode) { - alias RpcNsBindingLookupBeginW RpcNsBindingLookupBegin; - alias RpcNsBindingImportBeginW RpcNsBindingImportBegin; - alias RpcNsBindingExportW RpcNsBindingExport; - alias RpcNsBindingUnexportW RpcNsBindingUnexport; - alias RpcNsGroupDeleteW RpcNsGroupDelete; - alias RpcNsGroupMbrAddW RpcNsGroupMbrAdd; - alias RpcNsGroupMbrRemoveW RpcNsGroupMbrRemove; - alias RpcNsGroupMbrInqBeginW RpcNsGroupMbrInqBegin; - alias RpcNsGroupMbrInqNextW RpcNsGroupMbrInqNext; - alias RpcNsEntryExpandNameW RpcNsEntryExpandName; - alias RpcNsEntryObjectInqBeginW RpcNsEntryObjectInqBegin; - alias RpcNsMgmtBindingUnexportW RpcNsMgmtBindingUnexport; - alias RpcNsMgmtEntryCreateW RpcNsMgmtEntryCreate; - alias RpcNsMgmtEntryDeleteW RpcNsMgmtEntryDelete; - alias RpcNsMgmtEntryInqIfIdsW RpcNsMgmtEntryInqIfIds; - alias RpcNsProfileDeleteW RpcNsProfileDelete; - alias RpcNsProfileEltAddW RpcNsProfileEltAdd; - alias RpcNsProfileEltRemoveW RpcNsProfileEltRemove; - alias RpcNsProfileEltInqBeginW RpcNsProfileEltInqBegin; - alias RpcNsProfileEltInqNextW RpcNsProfileEltInqNext; + alias RpcNsBindingLookupBegin = RpcNsBindingLookupBeginW; + alias RpcNsBindingImportBegin = RpcNsBindingImportBeginW; + alias RpcNsBindingExport = RpcNsBindingExportW; + alias RpcNsBindingUnexport = RpcNsBindingUnexportW; + alias RpcNsGroupDelete = RpcNsGroupDeleteW; + alias RpcNsGroupMbrAdd = RpcNsGroupMbrAddW; + alias RpcNsGroupMbrRemove = RpcNsGroupMbrRemoveW; + alias RpcNsGroupMbrInqBegin = RpcNsGroupMbrInqBeginW; + alias RpcNsGroupMbrInqNext = RpcNsGroupMbrInqNextW; + alias RpcNsEntryExpandName = RpcNsEntryExpandNameW; + alias RpcNsEntryObjectInqBegin = RpcNsEntryObjectInqBeginW; + alias RpcNsMgmtBindingUnexport = RpcNsMgmtBindingUnexportW; + alias RpcNsMgmtEntryCreate = RpcNsMgmtEntryCreateW; + alias RpcNsMgmtEntryDelete = RpcNsMgmtEntryDeleteW; + alias RpcNsMgmtEntryInqIfIds = RpcNsMgmtEntryInqIfIdsW; + alias RpcNsProfileDelete = RpcNsProfileDeleteW; + alias RpcNsProfileEltAdd = RpcNsProfileEltAddW; + alias RpcNsProfileEltRemove = RpcNsProfileEltRemoveW; + alias RpcNsProfileEltInqBegin = RpcNsProfileEltInqBeginW; + alias RpcNsProfileEltInqNext = RpcNsProfileEltInqNextW; } else { - alias RpcNsBindingLookupBeginA RpcNsBindingLookupBegin; - alias RpcNsBindingImportBeginA RpcNsBindingImportBegin; - alias RpcNsBindingExportA RpcNsBindingExport; - alias RpcNsBindingUnexportA RpcNsBindingUnexport; - alias RpcNsGroupDeleteA RpcNsGroupDelete; - alias RpcNsGroupMbrAddA RpcNsGroupMbrAdd; - alias RpcNsGroupMbrRemoveA RpcNsGroupMbrRemove; - alias RpcNsGroupMbrInqBeginA RpcNsGroupMbrInqBegin; - alias RpcNsGroupMbrInqNextA RpcNsGroupMbrInqNext; - alias RpcNsEntryExpandNameA RpcNsEntryExpandName; - alias RpcNsEntryObjectInqBeginA RpcNsEntryObjectInqBegin; - alias RpcNsMgmtBindingUnexportA RpcNsMgmtBindingUnexport; - alias RpcNsMgmtEntryCreateA RpcNsMgmtEntryCreate; - alias RpcNsMgmtEntryDeleteA RpcNsMgmtEntryDelete; - alias RpcNsMgmtEntryInqIfIdsA RpcNsMgmtEntryInqIfIds; - alias RpcNsProfileDeleteA RpcNsProfileDelete; - alias RpcNsProfileEltAddA RpcNsProfileEltAdd; - alias RpcNsProfileEltRemoveA RpcNsProfileEltRemove; - alias RpcNsProfileEltInqBeginA RpcNsProfileEltInqBegin; - alias RpcNsProfileEltInqNextA RpcNsProfileEltInqNext; + alias RpcNsBindingLookupBegin = RpcNsBindingLookupBeginA; + alias RpcNsBindingImportBegin = RpcNsBindingImportBeginA; + alias RpcNsBindingExport = RpcNsBindingExportA; + alias RpcNsBindingUnexport = RpcNsBindingUnexportA; + alias RpcNsGroupDelete = RpcNsGroupDeleteA; + alias RpcNsGroupMbrAdd = RpcNsGroupMbrAddA; + alias RpcNsGroupMbrRemove = RpcNsGroupMbrRemoveA; + alias RpcNsGroupMbrInqBegin = RpcNsGroupMbrInqBeginA; + alias RpcNsGroupMbrInqNext = RpcNsGroupMbrInqNextA; + alias RpcNsEntryExpandName = RpcNsEntryExpandNameA; + alias RpcNsEntryObjectInqBegin = RpcNsEntryObjectInqBeginA; + alias RpcNsMgmtBindingUnexport = RpcNsMgmtBindingUnexportA; + alias RpcNsMgmtEntryCreate = RpcNsMgmtEntryCreateA; + alias RpcNsMgmtEntryDelete = RpcNsMgmtEntryDeleteA; + alias RpcNsMgmtEntryInqIfIds = RpcNsMgmtEntryInqIfIdsA; + alias RpcNsProfileDelete = RpcNsProfileDeleteA; + alias RpcNsProfileEltAdd = RpcNsProfileEltAddA; + alias RpcNsProfileEltRemove = RpcNsProfileEltRemoveA; + alias RpcNsProfileEltInqBegin = RpcNsProfileEltInqBeginA; + alias RpcNsProfileEltInqNext = RpcNsProfileEltInqNextA; } diff --git a/runtime/druntime/src/core/sys/windows/rpcnsip.d b/runtime/druntime/src/core/sys/windows/rpcnsip.d index ccf026f495f..f951e11ad98 100644 --- a/runtime/druntime/src/core/sys/windows/rpcnsip.d +++ b/runtime/druntime/src/core/sys/windows/rpcnsip.d @@ -16,7 +16,7 @@ struct RPC_IMPORT_CONTEXT_P { RPC_BINDING_HANDLE ProposedHandle; RPC_BINDING_VECTOR* Bindings; } -alias RPC_IMPORT_CONTEXT_P* PRPC_IMPORT_CONTEXT_P; +alias PRPC_IMPORT_CONTEXT_P = RPC_IMPORT_CONTEXT_P*; extern(Windows) { RPC_STATUS I_RpcNsGetBuffer(PRPC_MESSAGE); diff --git a/runtime/druntime/src/core/sys/windows/schannel.d b/runtime/druntime/src/core/sys/windows/schannel.d index 6ffab30f174..4456a3f4b7c 100644 --- a/runtime/druntime/src/core/sys/windows/schannel.d +++ b/runtime/druntime/src/core/sys/windows/schannel.d @@ -69,30 +69,30 @@ struct SCHANNEL_CRED { DWORD dwFlags; DWORD reserved; } -alias SCHANNEL_CRED* PSCHANNEL_CRED; +alias PSCHANNEL_CRED = SCHANNEL_CRED*; struct SecPkgCred_SupportedAlgs { DWORD cSupportedAlgs; ALG_ID* palgSupportedAlgs; } -alias SecPkgCred_SupportedAlgs* PSecPkgCred_SupportedAlgs; +alias PSecPkgCred_SupportedAlgs = SecPkgCred_SupportedAlgs*; struct SecPkgCred_CypherStrengths { DWORD dwMinimumCypherStrength; DWORD dwMaximumCypherStrength; } -alias SecPkgCred_CypherStrengths* PSecPkgCred_CypherStrengths; +alias PSecPkgCred_CypherStrengths = SecPkgCred_CypherStrengths*; struct SecPkgCred_SupportedProtocols { DWORD grbitProtocol; } -alias SecPkgCred_SupportedProtocols* PSecPkgCred_SupportedProtocols; +alias PSecPkgCred_SupportedProtocols = SecPkgCred_SupportedProtocols*; struct SecPkgContext_IssuerListInfoEx { PCERT_NAME_BLOB aIssuers; DWORD cIssuers; } -alias SecPkgContext_IssuerListInfoEx* PSecPkgContext_IssuerListInfoEx; +alias PSecPkgContext_IssuerListInfoEx = SecPkgContext_IssuerListInfoEx*; struct SecPkgContext_ConnectionInfo { DWORD dwProtocol; @@ -103,4 +103,4 @@ struct SecPkgContext_ConnectionInfo { ALG_ID aiExch; DWORD dwExchStrength; } -alias SecPkgContext_ConnectionInfo* PSecPkgContext_ConnectionInfo; +alias PSecPkgContext_ConnectionInfo = SecPkgContext_ConnectionInfo*; diff --git a/runtime/druntime/src/core/sys/windows/secext.d b/runtime/druntime/src/core/sys/windows/secext.d index ab615365aa5..79b7bececc0 100644 --- a/runtime/druntime/src/core/sys/windows/secext.d +++ b/runtime/druntime/src/core/sys/windows/secext.d @@ -30,7 +30,7 @@ enum EXTENDED_NAME_FORMAT { NameServicePrincipal, // = 10 NameDnsDomain = 12 } -alias EXTENDED_NAME_FORMAT* PEXTENDED_NAME_FORMAT; +alias PEXTENDED_NAME_FORMAT = EXTENDED_NAME_FORMAT*; extern (Windows) { BOOLEAN GetComputerObjectNameA(EXTENDED_NAME_FORMAT, LPSTR, PULONG); @@ -44,11 +44,11 @@ extern (Windows) { } version (Unicode) { - alias GetComputerObjectNameW GetComputerObjectName; - alias GetUserNameExW GetUserNameEx; - alias TranslateNameW TranslateName; + alias GetComputerObjectName = GetComputerObjectNameW; + alias GetUserNameEx = GetUserNameExW; + alias TranslateName = TranslateNameW; } else { - alias GetComputerObjectNameA GetComputerObjectName; - alias GetUserNameExA GetUserNameEx; - alias TranslateNameA TranslateName; + alias GetComputerObjectName = GetComputerObjectNameA; + alias GetUserNameEx = GetUserNameExA; + alias TranslateName = TranslateNameA; } diff --git a/runtime/druntime/src/core/sys/windows/setupapi.d b/runtime/druntime/src/core/sys/windows/setupapi.d index da503864787..2c226eb83e2 100644 --- a/runtime/druntime/src/core/sys/windows/setupapi.d +++ b/runtime/druntime/src/core/sys/windows/setupapi.d @@ -163,7 +163,7 @@ enum : DWORD { DICS_FLAG_CONFIGGENERAL = 4 } -alias UINT DI_FUNCTION; +alias DI_FUNCTION = UINT; enum : DI_FUNCTION { DIF_SELECTDEVICE = 1, @@ -566,7 +566,7 @@ enum : DWORD { INFINFO_INF_PATH_LIST_SEARCH // = 5 } -alias DWORD LogSeverity; +alias LogSeverity = DWORD; enum : LogSeverity { LogSevInformation, LogSevWarning, @@ -856,11 +856,11 @@ enum : DWORD { SRCLIST_NOSTRIPPLATFORM = 0x00000400 } -alias PVOID HINF; -alias PVOID HDSKSPC; +alias HINF = PVOID; +alias HDSKSPC = PVOID; alias HDEVINFO = HANDLE; -alias PVOID HSPFILEQ; -alias PVOID HSPFILELOG; +alias HSPFILEQ = PVOID; +alias HSPFILELOG = PVOID; enum SetupFileLogInfo { SetupFileLogSourceFilename, @@ -882,7 +882,7 @@ struct INFCONTEXT { UINT Section; UINT Line; } -alias INFCONTEXT* PINFCONTEXT; +alias PINFCONTEXT = INFCONTEXT*; mixin AlignedStr!(_alignVal, "SP_INF_INFORMATION", q{ DWORD InfStyle; @@ -890,7 +890,7 @@ mixin AlignedStr!(_alignVal, "SP_INF_INFORMATION", q{ BYTE[1] _VersionData; BYTE* VersionData() return { return _VersionData.ptr; } }); -alias SP_INF_INFORMATION* PSP_INF_INFORMATION; +alias PSP_INF_INFORMATION = SP_INF_INFORMATION*; struct SP_ALTPLATFORM_INFO { DWORD cbSize = SP_ALTPLATFORM_INFO.sizeof; @@ -900,21 +900,21 @@ struct SP_ALTPLATFORM_INFO { WORD ProcessorArchitecture; WORD Reserved; } -alias SP_ALTPLATFORM_INFO* PSP_ALTPLATFORM_INFO; +alias PSP_ALTPLATFORM_INFO = SP_ALTPLATFORM_INFO*; struct SP_ORIGINAL_FILE_INFO_A { DWORD cbSize = SP_ORIGINAL_FILE_INFO_A.sizeof; CHAR[MAX_PATH] OriginalInfName = 0; CHAR[MAX_PATH] OriginalCatalogName = 0; } -alias SP_ORIGINAL_FILE_INFO_A* PSP_ORIGINAL_FILE_INFO_A; +alias PSP_ORIGINAL_FILE_INFO_A = SP_ORIGINAL_FILE_INFO_A*; struct SP_ORIGINAL_FILE_INFO_W { DWORD cbSize = SP_ORIGINAL_FILE_INFO_W.sizeof; WCHAR[MAX_PATH] OriginalInfName = 0; WCHAR[MAX_PATH] OriginalCatalogName = 0; } -alias SP_ORIGINAL_FILE_INFO_W* PSP_ORIGINAL_FILE_INFO_W; +alias PSP_ORIGINAL_FILE_INFO_W = SP_ORIGINAL_FILE_INFO_W*; struct FILEPATHS_A { PCSTR Target; @@ -922,7 +922,7 @@ struct FILEPATHS_A { UINT Win32Error; DWORD Flags; } -alias FILEPATHS_A* PFILEPATHS_A; +alias PFILEPATHS_A = FILEPATHS_A*; struct FILEPATHS_W { PCWSTR Target; @@ -930,7 +930,7 @@ struct FILEPATHS_W { UINT Win32Error; DWORD Flags; } -alias FILEPATHS_W* PFILEPATHS_W; +alias PFILEPATHS_W = FILEPATHS_W*; struct SOURCE_MEDIA_A { PCSTR Reserved; @@ -940,7 +940,7 @@ struct SOURCE_MEDIA_A { PCSTR SourceFile; DWORD Flags; } -alias SOURCE_MEDIA_A* PSOURCE_MEDIA_A; +alias PSOURCE_MEDIA_A = SOURCE_MEDIA_A*; struct SOURCE_MEDIA_W { PCWSTR Reserved; @@ -950,7 +950,7 @@ struct SOURCE_MEDIA_W { PCWSTR SourceFile; DWORD Flags; } -alias SOURCE_MEDIA_W* PSOURCE_MEDIA_W; +alias PSOURCE_MEDIA_W = SOURCE_MEDIA_W*; struct CABINET_INFO_A { PCSTR CabinetPath; @@ -959,7 +959,7 @@ struct CABINET_INFO_A { USHORT SetId; USHORT CabinetNumber; } -alias CABINET_INFO_A* PCABINET_INFO_A; +alias PCABINET_INFO_A = CABINET_INFO_A*; struct CABINET_INFO_W { PCWSTR CabinetPath; @@ -968,7 +968,7 @@ struct CABINET_INFO_W { USHORT SetId; USHORT CabinetNumber; } -alias CABINET_INFO_W* PCABINET_INFO_W; +alias PCABINET_INFO_W = CABINET_INFO_W*; mixin AlignedStr!(_alignVal, "FILE_IN_CABINET_INFO_A", q{ PCSTR NameInCabinet; @@ -979,7 +979,7 @@ mixin AlignedStr!(_alignVal, "FILE_IN_CABINET_INFO_A", q{ WORD DosAttribs; CHAR[MAX_PATH] FullTargetName = 0; }); -alias FILE_IN_CABINET_INFO_A* PFILE_IN_CABINET_INFO_A; +alias PFILE_IN_CABINET_INFO_A = FILE_IN_CABINET_INFO_A*; mixin AlignedStr!(_alignVal, "FILE_IN_CABINET_INFO_W", q{ PCWSTR NameInCabinet; @@ -990,7 +990,7 @@ mixin AlignedStr!(_alignVal, "FILE_IN_CABINET_INFO_W", q{ WORD DosAttribs; WCHAR[MAX_PATH] FullTargetName = 0; }); -alias FILE_IN_CABINET_INFO_W* PFILE_IN_CABINET_INFO_W; +alias PFILE_IN_CABINET_INFO_W = FILE_IN_CABINET_INFO_W*; struct SP_FILE_COPY_PARAMS_A { DWORD cbSize = SP_FILE_COPY_PARAMS_A.sizeof; @@ -1006,7 +1006,7 @@ struct SP_FILE_COPY_PARAMS_A { HINF LayoutInf; PCSTR SecurityDescriptor; } -alias SP_FILE_COPY_PARAMS_A* PSP_FILE_COPY_PARAMS_A; +alias PSP_FILE_COPY_PARAMS_A = SP_FILE_COPY_PARAMS_A*; struct SP_FILE_COPY_PARAMS_W { DWORD cbSize = SP_FILE_COPY_PARAMS_W.sizeof; @@ -1022,7 +1022,7 @@ struct SP_FILE_COPY_PARAMS_W { HINF LayoutInf; PCWSTR SecurityDescriptor; } -alias SP_FILE_COPY_PARAMS_W* PSP_FILE_COPY_PARAMS_W; +alias PSP_FILE_COPY_PARAMS_W = SP_FILE_COPY_PARAMS_W*; struct SP_DEVINFO_DATA { DWORD cbSize = SP_DEVINFO_DATA.sizeof; @@ -1030,7 +1030,7 @@ struct SP_DEVINFO_DATA { DWORD DevInst; ULONG_PTR Reserved; } -alias SP_DEVINFO_DATA* PSP_DEVINFO_DATA; +alias PSP_DEVINFO_DATA = SP_DEVINFO_DATA*; mixin AlignedStr!(_alignVal, "SP_DEVICE_INTERFACE_DATA", q{ DWORD cbSize = SP_DEVICE_INTERFACE_DATA.sizeof; @@ -1038,28 +1038,28 @@ mixin AlignedStr!(_alignVal, "SP_DEVICE_INTERFACE_DATA", q{ DWORD Flags; ULONG_PTR Reserved; }); -alias SP_DEVICE_INTERFACE_DATA* PSP_DEVICE_INTERFACE_DATA; -deprecated alias SP_DEVICE_INTERFACE_DATA SP_INTERFACE_DEVICE_DATA; -deprecated alias SP_DEVICE_INTERFACE_DATA* PSP_INTERFACE_DEVICE_DATA; +alias PSP_DEVICE_INTERFACE_DATA = SP_DEVICE_INTERFACE_DATA*; +deprecated alias SP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA; +deprecated alias PSP_INTERFACE_DEVICE_DATA = SP_DEVICE_INTERFACE_DATA*; mixin AlignedStr!(_alignVal, "SP_DEVICE_INTERFACE_DETAIL_DATA_A", q{ DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_A.sizeof; CHAR[1] _DevicePath = 0; CHAR* DevicePath() return { return _DevicePath.ptr; } }); -alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_DEVICE_INTERFACE_DETAIL_DATA_A; +alias PSP_DEVICE_INTERFACE_DETAIL_DATA_A = SP_DEVICE_INTERFACE_DETAIL_DATA_A*; mixin AlignedStr!(_alignVal, "SP_DEVICE_INTERFACE_DETAIL_DATA_W", q{ DWORD cbSize = SP_DEVICE_INTERFACE_DETAIL_DATA_W.sizeof; WCHAR[1] _DevicePath = 0; WCHAR* DevicePath() return { return _DevicePath.ptr; } }); -alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_DEVICE_INTERFACE_DETAIL_DATA_W; +alias PSP_DEVICE_INTERFACE_DETAIL_DATA_W = SP_DEVICE_INTERFACE_DETAIL_DATA_W*; -deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA_A; -deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_INTERFACE_DEVICE_DETAIL_DATA_A; -deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA_W; -deprecated alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_INTERFACE_DEVICE_DETAIL_DATA_W; +deprecated alias SP_INTERFACE_DEVICE_DETAIL_DATA_A = SP_DEVICE_INTERFACE_DETAIL_DATA_A; +deprecated alias PSP_INTERFACE_DEVICE_DETAIL_DATA_A = SP_DEVICE_INTERFACE_DETAIL_DATA_A*; +deprecated alias SP_INTERFACE_DEVICE_DETAIL_DATA_W = SP_DEVICE_INTERFACE_DETAIL_DATA_W; +deprecated alias PSP_INTERFACE_DEVICE_DETAIL_DATA_W = SP_DEVICE_INTERFACE_DETAIL_DATA_W*; mixin AlignedStr!(_alignVal, "SP_DEVINFO_LIST_DETAIL_DATA_A", q{ DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_A.sizeof; @@ -1067,7 +1067,7 @@ mixin AlignedStr!(_alignVal, "SP_DEVINFO_LIST_DETAIL_DATA_A", q{ HANDLE RemoteMachineHandle; CHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName = 0; }); -alias SP_DEVINFO_LIST_DETAIL_DATA_A* PSP_DEVINFO_LIST_DETAIL_DATA_A; +alias PSP_DEVINFO_LIST_DETAIL_DATA_A = SP_DEVINFO_LIST_DETAIL_DATA_A*; mixin AlignedStr!(_alignVal, "SP_DEVINFO_LIST_DETAIL_DATA_W", q{ DWORD cbSize = SP_DEVINFO_LIST_DETAIL_DATA_W.sizeof; @@ -1075,10 +1075,10 @@ mixin AlignedStr!(_alignVal, "SP_DEVINFO_LIST_DETAIL_DATA_W", q{ HANDLE RemoteMachineHandle; WCHAR[SP_MAX_MACHINENAME_LENGTH] RemoteMachineName = 0; }); -alias SP_DEVINFO_LIST_DETAIL_DATA_W* PSP_DEVINFO_LIST_DETAIL_DATA_W; +alias PSP_DEVINFO_LIST_DETAIL_DATA_W = SP_DEVINFO_LIST_DETAIL_DATA_W*; -extern(Windows) alias UINT function(PVOID, UINT, UINT_PTR, UINT_PTR) PSP_FILE_CALLBACK_A; -extern(Windows) alias UINT function(PVOID, UINT, UINT_PTR, UINT_PTR) PSP_FILE_CALLBACK_W; +extern(Windows) alias PSP_FILE_CALLBACK_A = UINT function(PVOID, UINT, UINT_PTR, UINT_PTR); +extern(Windows) alias PSP_FILE_CALLBACK_W = UINT function(PVOID, UINT, UINT_PTR, UINT_PTR); struct SP_DEVINSTALL_PARAMS_A { DWORD cbSize = SP_DEVINSTALL_PARAMS_A.sizeof; @@ -1092,7 +1092,7 @@ struct SP_DEVINSTALL_PARAMS_A { DWORD Reserved; CHAR[MAX_PATH] DriverPath = 0; } -alias SP_DEVINSTALL_PARAMS_A* PSP_DEVINSTALL_PARAMS_A; +alias PSP_DEVINSTALL_PARAMS_A = SP_DEVINSTALL_PARAMS_A*; struct SP_DEVINSTALL_PARAMS_W { DWORD cbSize = SP_DEVINSTALL_PARAMS_W.sizeof; @@ -1106,26 +1106,26 @@ struct SP_DEVINSTALL_PARAMS_W { DWORD Reserved; WCHAR[MAX_PATH] DriverPath = 0; } -alias SP_DEVINSTALL_PARAMS_W* PSP_DEVINSTALL_PARAMS_W; +alias PSP_DEVINSTALL_PARAMS_W = SP_DEVINSTALL_PARAMS_W*; struct SP_CLASSINSTALL_HEADER { DWORD cbSize = SP_CLASSINSTALL_HEADER.sizeof; DI_FUNCTION InstallFunction; } -alias SP_CLASSINSTALL_HEADER* PSP_CLASSINSTALL_HEADER; +alias PSP_CLASSINSTALL_HEADER = SP_CLASSINSTALL_HEADER*; struct SP_ENABLECLASS_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; GUID ClassGuid; DWORD EnableMessage; } -alias SP_ENABLECLASS_PARAMS* PSP_ENABLECLASS_PARAMS; +alias PSP_ENABLECLASS_PARAMS = SP_ENABLECLASS_PARAMS*; struct SP_MOVEDEV_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; SP_DEVINFO_DATA SourceDeviceInfoData; } -alias SP_MOVEDEV_PARAMS* PSP_MOVEDEV_PARAMS; +alias PSP_MOVEDEV_PARAMS = SP_MOVEDEV_PARAMS*; struct SP_PROPCHANGE_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; @@ -1133,21 +1133,21 @@ struct SP_PROPCHANGE_PARAMS { DWORD Scope; DWORD HwProfile; } -alias SP_PROPCHANGE_PARAMS* PSP_PROPCHANGE_PARAMS; +alias PSP_PROPCHANGE_PARAMS = SP_PROPCHANGE_PARAMS*; struct SP_REMOVEDEVICE_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; DWORD Scope; DWORD HwProfile; } -alias SP_REMOVEDEVICE_PARAMS* PSP_REMOVEDEVICE_PARAMS; +alias PSP_REMOVEDEVICE_PARAMS = SP_REMOVEDEVICE_PARAMS*; struct SP_UNREMOVEDEVICE_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; DWORD Scope; DWORD HwProfile; } -alias SP_UNREMOVEDEVICE_PARAMS* PSP_UNREMOVEDEVICE_PARAMS; +alias PSP_UNREMOVEDEVICE_PARAMS = SP_UNREMOVEDEVICE_PARAMS*; struct SP_SELECTDEVICE_PARAMS_A { SP_CLASSINSTALL_HEADER ClassInstallHeader; @@ -1157,7 +1157,7 @@ struct SP_SELECTDEVICE_PARAMS_A { CHAR[MAX_SUBTITLE_LEN] SubTitle = 0; BYTE[2] Reserved; } -alias SP_SELECTDEVICE_PARAMS_A* PSP_SELECTDEVICE_PARAMS_A; +alias PSP_SELECTDEVICE_PARAMS_A = SP_SELECTDEVICE_PARAMS_A*; struct SP_SELECTDEVICE_PARAMS_W { SP_CLASSINSTALL_HEADER ClassInstallHeader; @@ -1166,16 +1166,16 @@ struct SP_SELECTDEVICE_PARAMS_W { WCHAR[MAX_LABEL_LEN] ListLabel = 0; WCHAR[MAX_SUBTITLE_LEN] SubTitle = 0; } -alias SP_SELECTDEVICE_PARAMS_W* PSP_SELECTDEVICE_PARAMS_W; +alias PSP_SELECTDEVICE_PARAMS_W = SP_SELECTDEVICE_PARAMS_W*; -extern(Windows) alias BOOL function(PVOID, DWORD) PDETECT_PROGRESS_NOTIFY; +extern(Windows) alias PDETECT_PROGRESS_NOTIFY = BOOL function(PVOID, DWORD); struct SP_DETECTDEVICE_PARAMS { SP_CLASSINSTALL_HEADER ClassInstallHeader; PDETECT_PROGRESS_NOTIFY DetectProgressNotify; PVOID ProgressNotifyParam; } -alias SP_DETECTDEVICE_PARAMS* PSP_DETECTDEVICE_PARAMS; +alias PSP_DETECTDEVICE_PARAMS = SP_DETECTDEVICE_PARAMS*; struct SP_INSTALLWIZARD_DATA { SP_CLASSINSTALL_HEADER ClassInstallHeader; @@ -1187,7 +1187,7 @@ struct SP_INSTALLWIZARD_DATA { LPARAM PrivateData; HWND hwndWizardDlg; } -alias SP_INSTALLWIZARD_DATA* PSP_INSTALLWIZARD_DATA; +alias PSP_INSTALLWIZARD_DATA = SP_INSTALLWIZARD_DATA*; struct SP_NEWDEVICEWIZARD_DATA { SP_CLASSINSTALL_HEADER ClassInstallHeader; @@ -1196,35 +1196,35 @@ struct SP_NEWDEVICEWIZARD_DATA { DWORD NumDynamicPages; HWND hwndWizardDlg; } -alias SP_NEWDEVICEWIZARD_DATA* PSP_NEWDEVICEWIZARD_DATA; -alias SP_NEWDEVICEWIZARD_DATA SP_ADDPROPERTYPAGE_DATA; -alias SP_NEWDEVICEWIZARD_DATA* PSP_ADDPROPERTYPAGE_DATA; +alias PSP_NEWDEVICEWIZARD_DATA = SP_NEWDEVICEWIZARD_DATA*; +alias SP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA; +alias PSP_ADDPROPERTYPAGE_DATA = SP_NEWDEVICEWIZARD_DATA*; struct SP_TROUBLESHOOTER_PARAMS_A { SP_CLASSINSTALL_HEADER ClassInstallHeader; CHAR[MAX_PATH] ChmFile = 0; CHAR[MAX_PATH] HtmlTroubleShooter = 0; } -alias SP_TROUBLESHOOTER_PARAMS_A* PSP_TROUBLESHOOTER_PARAMS_A; +alias PSP_TROUBLESHOOTER_PARAMS_A = SP_TROUBLESHOOTER_PARAMS_A*; struct SP_TROUBLESHOOTER_PARAMS_W { SP_CLASSINSTALL_HEADER ClassInstallHeader; WCHAR[MAX_PATH] ChmFile = 0; WCHAR[MAX_PATH] HtmlTroubleShooter = 0; } -alias SP_TROUBLESHOOTER_PARAMS_W* PSP_TROUBLESHOOTER_PARAMS_W; +alias PSP_TROUBLESHOOTER_PARAMS_W = SP_TROUBLESHOOTER_PARAMS_W*; struct SP_POWERMESSAGEWAKE_PARAMS_A { SP_CLASSINSTALL_HEADER ClassInstallHeader; CHAR[LINE_LEN*2] PowerMessageWake = 0; } -alias SP_POWERMESSAGEWAKE_PARAMS_A* PSP_POWERMESSAGEWAKE_PARAMS_A; +alias PSP_POWERMESSAGEWAKE_PARAMS_A = SP_POWERMESSAGEWAKE_PARAMS_A*; struct SP_POWERMESSAGEWAKE_PARAMS_W { SP_CLASSINSTALL_HEADER ClassInstallHeader; WCHAR[LINE_LEN*2] PowerMessageWake = 0; } -alias SP_POWERMESSAGEWAKE_PARAMS_W* PSP_POWERMESSAGEWAKE_PARAMS_W; +alias PSP_POWERMESSAGEWAKE_PARAMS_W = SP_POWERMESSAGEWAKE_PARAMS_W*; mixin AlignedStr!(_alignVal, "SP_DRVINFO_DATA_V2_A", q{ DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; @@ -1236,7 +1236,7 @@ mixin AlignedStr!(_alignVal, "SP_DRVINFO_DATA_V2_A", q{ FILETIME DriverDate; DWORDLONG DriverVersion; }); -alias SP_DRVINFO_DATA_V2_A* PSP_DRVINFO_DATA_V2_A; +alias PSP_DRVINFO_DATA_V2_A = SP_DRVINFO_DATA_V2_A*; mixin AlignedStr!(_alignVal, "SP_DRVINFO_DATA_V2_W", q{ DWORD cbSize = SP_DRVINFO_DATA_V2_A.sizeof; @@ -1248,7 +1248,7 @@ mixin AlignedStr!(_alignVal, "SP_DRVINFO_DATA_V2_W", q{ FILETIME DriverDate; DWORDLONG DriverVersion; }); -alias SP_DRVINFO_DATA_V2_W* PSP_DRVINFO_DATA_V2_W; +alias PSP_DRVINFO_DATA_V2_W = SP_DRVINFO_DATA_V2_W*; struct SP_DRVINFO_DATA_V1_A { DWORD cbSize = SP_DRVINFO_DATA_V1_A.sizeof; @@ -1258,7 +1258,7 @@ struct SP_DRVINFO_DATA_V1_A { CHAR[LINE_LEN] MfgName = 0; CHAR[LINE_LEN] ProviderName = 0; } -alias SP_DRVINFO_DATA_V1_A* PSP_DRVINFO_DATA_V1_A; +alias PSP_DRVINFO_DATA_V1_A = SP_DRVINFO_DATA_V1_A*; struct SP_DRVINFO_DATA_V1_W { DWORD cbSize = SP_DRVINFO_DATA_V1_W.sizeof; @@ -1268,35 +1268,35 @@ struct SP_DRVINFO_DATA_V1_W { WCHAR[LINE_LEN] MfgName = 0; WCHAR[LINE_LEN] ProviderName = 0; } -alias SP_DRVINFO_DATA_V1_W* PSP_DRVINFO_DATA_V1_W; +alias PSP_DRVINFO_DATA_V1_W = SP_DRVINFO_DATA_V1_W*; version (Unicode) { - alias SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_V1; - alias SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_V2; + alias SP_DRVINFO_DATA_V1 = SP_DRVINFO_DATA_V1_W; + alias SP_DRVINFO_DATA_V2 = SP_DRVINFO_DATA_V2_W; } else { - alias SP_DRVINFO_DATA_V1_A SP_DRVINFO_DATA_V1; - alias SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_V2; + alias SP_DRVINFO_DATA_V1 = SP_DRVINFO_DATA_V1_A; + alias SP_DRVINFO_DATA_V2 = SP_DRVINFO_DATA_V2_A; } -alias SP_DRVINFO_DATA_V1* PSP_DRVINFO_DATA_V1; -alias SP_DRVINFO_DATA_V2* PSP_DRVINFO_DATA_V2; +alias PSP_DRVINFO_DATA_V1 = SP_DRVINFO_DATA_V1*; +alias PSP_DRVINFO_DATA_V2 = SP_DRVINFO_DATA_V2*; static if (USE_SP_DRVINFO_DATA_V1) { - alias SP_DRVINFO_DATA_V1_A SP_DRVINFO_DATA_A; - alias SP_DRVINFO_DATA_V1_A* PSP_DRVINFO_DATA_A; - alias SP_DRVINFO_DATA_V1_W SP_DRVINFO_DATA_W; - alias SP_DRVINFO_DATA_V1_W* PSP_DRVINFO_DATA_W; - alias SP_DRVINFO_DATA_V1 SP_DRVINFO_DATA; - alias SP_DRVINFO_DATA_V1* PSP_DRVINFO_DATA; + alias SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V1_A; + alias PSP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V1_A*; + alias SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V1_W; + alias PSP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V1_W*; + alias SP_DRVINFO_DATA = SP_DRVINFO_DATA_V1; + alias PSP_DRVINFO_DATA = SP_DRVINFO_DATA_V1*; } else { - alias SP_DRVINFO_DATA_V2_A SP_DRVINFO_DATA_A; - alias SP_DRVINFO_DATA_V2_A* PSP_DRVINFO_DATA_A; - alias SP_DRVINFO_DATA_V2_W SP_DRVINFO_DATA_W; - alias SP_DRVINFO_DATA_V2_W* PSP_DRVINFO_DATA_W; - alias SP_DRVINFO_DATA_V2 SP_DRVINFO_DATA; - alias SP_DRVINFO_DATA_V2* PSP_DRVINFO_DATA; + alias SP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A; + alias PSP_DRVINFO_DATA_A = SP_DRVINFO_DATA_V2_A*; + alias SP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W; + alias PSP_DRVINFO_DATA_W = SP_DRVINFO_DATA_V2_W*; + alias SP_DRVINFO_DATA = SP_DRVINFO_DATA_V2; + alias PSP_DRVINFO_DATA = SP_DRVINFO_DATA_V2*; } -extern(Windows) alias DWORD function(HDEVINFO, PSP_DEVINFO_DATA, PSP_DEVINFO_DATA, PVOID) PSP_DETSIG_CMPPROC; +extern(Windows) alias PSP_DETSIG_CMPPROC = DWORD function(HDEVINFO, PSP_DEVINFO_DATA, PSP_DEVINFO_DATA, PVOID); mixin AlignedStr!(_alignVal, "SP_DRVINFO_DETAIL_DATA_A", q{ DWORD cbSize = SP_DRVINFO_DETAIL_DATA_A.sizeof; @@ -1310,7 +1310,7 @@ mixin AlignedStr!(_alignVal, "SP_DRVINFO_DETAIL_DATA_A", q{ CHAR[1] _HardwareID = 0; CHAR* HardwareID() return { return _HardwareID.ptr; } }); -alias SP_DRVINFO_DETAIL_DATA_A* PSP_DRVINFO_DETAIL_DATA_A; +alias PSP_DRVINFO_DETAIL_DATA_A = SP_DRVINFO_DETAIL_DATA_A*; mixin AlignedStr!(_alignVal, "SP_DRVINFO_DETAIL_DATA_W", q{ DWORD cbSize = SP_DRVINFO_DETAIL_DATA_W.sizeof; @@ -1324,7 +1324,7 @@ mixin AlignedStr!(_alignVal, "SP_DRVINFO_DETAIL_DATA_W", q{ WCHAR[1] _HardwareID = 0; WCHAR* HardwareID() return { return _HardwareID.ptr; } }); -alias SP_DRVINFO_DETAIL_DATA_W* PSP_DRVINFO_DETAIL_DATA_W; +alias PSP_DRVINFO_DETAIL_DATA_W = SP_DRVINFO_DETAIL_DATA_W*; struct SP_DRVINSTALL_PARAMS { DWORD cbSize = SP_DRVINSTALL_PARAMS.sizeof; @@ -1333,21 +1333,21 @@ struct SP_DRVINSTALL_PARAMS { DWORD_PTR PrivateData; DWORD Reserved; } -alias SP_DRVINSTALL_PARAMS* PSP_DRVINSTALL_PARAMS; +alias PSP_DRVINSTALL_PARAMS = SP_DRVINSTALL_PARAMS*; struct COINSTALLER_CONTEXT_DATA { BOOL PostProcessing; DWORD InstallResult; PVOID PrivateData; } -alias COINSTALLER_CONTEXT_DATA* PCOINSTALLER_CONTEXT_DATA; +alias PCOINSTALLER_CONTEXT_DATA = COINSTALLER_CONTEXT_DATA*; struct SP_CLASSIMAGELIST_DATA { DWORD cbSize = SP_CLASSIMAGELIST_DATA.sizeof; HIMAGELIST ImageList; ULONG_PTR Reserved; } -alias SP_CLASSIMAGELIST_DATA* PSP_CLASSIMAGELIST_DATA; +alias PSP_CLASSIMAGELIST_DATA = SP_CLASSIMAGELIST_DATA*; struct SP_PROPSHEETPAGE_REQUEST { DWORD cbSize = SP_PROPSHEETPAGE_REQUEST.sizeof; @@ -1355,88 +1355,88 @@ struct SP_PROPSHEETPAGE_REQUEST { HDEVINFO DeviceInfoSet; PSP_DEVINFO_DATA DeviceInfoData; } -alias SP_PROPSHEETPAGE_REQUEST* PSP_PROPSHEETPAGE_REQUEST; +alias PSP_PROPSHEETPAGE_REQUEST = SP_PROPSHEETPAGE_REQUEST*; struct SP_BACKUP_QUEUE_PARAMS_A { DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_A.sizeof; CHAR[MAX_PATH] FullInfPath = 0; INT FilenameOffset; } -alias SP_BACKUP_QUEUE_PARAMS_A* PSP_BACKUP_QUEUE_PARAMS_A; +alias PSP_BACKUP_QUEUE_PARAMS_A = SP_BACKUP_QUEUE_PARAMS_A*; struct SP_BACKUP_QUEUE_PARAMS_W { DWORD cbSize = SP_BACKUP_QUEUE_PARAMS_W.sizeof; WCHAR[MAX_PATH] FullInfPath = 0; INT FilenameOffset; } -alias SP_BACKUP_QUEUE_PARAMS_W* PSP_BACKUP_QUEUE_PARAMS_W; +alias PSP_BACKUP_QUEUE_PARAMS_W = SP_BACKUP_QUEUE_PARAMS_W*; version (Unicode) { - alias SP_ORIGINAL_FILE_INFO_W SP_ORIGINAL_FILE_INFO; - alias SP_ORIGINAL_FILE_INFO_W* PSP_ORIGINAL_FILE_INFO; - alias FILEPATHS_W FILEPATHS; - alias FILEPATHS_W* PFILEPATHS; - alias SOURCE_MEDIA_W SOURCE_MEDIA; - alias SOURCE_MEDIA_W* PSOURCE_MEDIA; - alias CABINET_INFO_W CABINET_INFO; - alias CABINET_INFO_W* PCABINET_INFO; - alias FILE_IN_CABINET_INFO_W FILE_IN_CABINET_INFO; - alias FILE_IN_CABINET_INFO_W* PFILE_IN_CABINET_INFO; - alias SP_FILE_COPY_PARAMS_W SP_FILE_COPY_PARAMS; - alias SP_FILE_COPY_PARAMS_W* PSP_FILE_COPY_PARAMS; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_DEVICE_INTERFACE_DETAIL_DATA; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_DEVICE_INTERFACE_DETAIL_DATA; + alias SP_ORIGINAL_FILE_INFO = SP_ORIGINAL_FILE_INFO_W; + alias PSP_ORIGINAL_FILE_INFO = SP_ORIGINAL_FILE_INFO_W*; + alias FILEPATHS = FILEPATHS_W; + alias PFILEPATHS = FILEPATHS_W*; + alias SOURCE_MEDIA = SOURCE_MEDIA_W; + alias PSOURCE_MEDIA = SOURCE_MEDIA_W*; + alias CABINET_INFO = CABINET_INFO_W; + alias PCABINET_INFO = CABINET_INFO_W*; + alias FILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_W; + alias PFILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_W*; + alias SP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_W; + alias PSP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_W*; + alias SP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_W; + alias PSP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_W*; deprecated { - alias SP_DEVICE_INTERFACE_DETAIL_DATA_W SP_INTERFACE_DEVICE_DETAIL_DATA; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_W* PSP_INTERFACE_DEVICE_DETAIL_DATA; + alias SP_INTERFACE_DEVICE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_W; + alias PSP_INTERFACE_DEVICE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_W*; } - alias SP_DEVINFO_LIST_DETAIL_DATA_W SP_DEVINFO_LIST_DETAIL_DATA; - alias SP_DEVINFO_LIST_DETAIL_DATA_W *PSP_DEVINFO_LIST_DETAIL_DATA; - alias SP_DEVINSTALL_PARAMS_W SP_DEVINSTALL_PARAMS; - alias SP_DEVINSTALL_PARAMS_W* PSP_DEVINSTALL_PARAMS; - alias SP_SELECTDEVICE_PARAMS_W SP_SELECTDEVICE_PARAMS; - alias SP_SELECTDEVICE_PARAMS_W* PSP_SELECTDEVICE_PARAMS; - alias SP_TROUBLESHOOTER_PARAMS_W SP_TROUBLESHOOTER_PARAMS; - alias SP_TROUBLESHOOTER_PARAMS_W* PSP_TROUBLESHOOTER_PARAMS; - alias SP_POWERMESSAGEWAKE_PARAMS_W SP_POWERMESSAGEWAKE_PARAMS; - alias SP_POWERMESSAGEWAKE_PARAMS_W* PSP_POWERMESSAGEWAKE_PARAMS; - alias SP_DRVINFO_DETAIL_DATA_W SP_DRVINFO_DETAIL_DATA; - alias SP_DRVINFO_DETAIL_DATA_W* PSP_DRVINFO_DETAIL_DATA; - alias SP_BACKUP_QUEUE_PARAMS_W SP_BACKUP_QUEUE_PARAMS; - alias SP_BACKUP_QUEUE_PARAMS_W* PSP_BACKUP_QUEUE_PARAMS; + alias SP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_W; + alias PSP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_W *; + alias SP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_W; + alias PSP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_W*; + alias SP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_W; + alias PSP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_W*; + alias SP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_W; + alias PSP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_W*; + alias SP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_W; + alias PSP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_W*; + alias SP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_W; + alias PSP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_W*; + alias SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_W; + alias PSP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_W*; } else { - alias SP_ORIGINAL_FILE_INFO_A SP_ORIGINAL_FILE_INFO; - alias SP_ORIGINAL_FILE_INFO_A* PSP_ORIGINAL_FILE_INFO; - alias FILEPATHS_A FILEPATHS; - alias FILEPATHS_A* PFILEPATHS; - alias SOURCE_MEDIA_A SOURCE_MEDIA; - alias SOURCE_MEDIA_A* PSOURCE_MEDIA; - alias CABINET_INFO_A CABINET_INFO; - alias CABINET_INFO_A* PCABINET_INFO; - alias FILE_IN_CABINET_INFO_A FILE_IN_CABINET_INFO; - alias FILE_IN_CABINET_INFO_A* PFILE_IN_CABINET_INFO; - alias SP_FILE_COPY_PARAMS_A SP_FILE_COPY_PARAMS; - alias SP_FILE_COPY_PARAMS_A* PSP_FILE_COPY_PARAMS; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_DEVICE_INTERFACE_DETAIL_DATA; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_DEVICE_INTERFACE_DETAIL_DATA; + alias SP_ORIGINAL_FILE_INFO = SP_ORIGINAL_FILE_INFO_A; + alias PSP_ORIGINAL_FILE_INFO = SP_ORIGINAL_FILE_INFO_A*; + alias FILEPATHS = FILEPATHS_A; + alias PFILEPATHS = FILEPATHS_A*; + alias SOURCE_MEDIA = SOURCE_MEDIA_A; + alias PSOURCE_MEDIA = SOURCE_MEDIA_A*; + alias CABINET_INFO = CABINET_INFO_A; + alias PCABINET_INFO = CABINET_INFO_A*; + alias FILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_A; + alias PFILE_IN_CABINET_INFO = FILE_IN_CABINET_INFO_A*; + alias SP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_A; + alias PSP_FILE_COPY_PARAMS = SP_FILE_COPY_PARAMS_A*; + alias SP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_A; + alias PSP_DEVICE_INTERFACE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_A*; deprecated { - alias SP_DEVICE_INTERFACE_DETAIL_DATA_A SP_INTERFACE_DEVICE_DETAIL_DATA; - alias SP_DEVICE_INTERFACE_DETAIL_DATA_A* PSP_INTERFACE_DEVICE_DETAIL_DATA; + alias SP_INTERFACE_DEVICE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_A; + alias PSP_INTERFACE_DEVICE_DETAIL_DATA = SP_DEVICE_INTERFACE_DETAIL_DATA_A*; } - alias SP_DEVINFO_LIST_DETAIL_DATA_A SP_DEVINFO_LIST_DETAIL_DATA; - alias SP_DEVINFO_LIST_DETAIL_DATA_A* PSP_DEVINFO_LIST_DETAIL_DATA; - alias SP_DEVINSTALL_PARAMS_A SP_DEVINSTALL_PARAMS; - alias SP_DEVINSTALL_PARAMS_A* PSP_DEVINSTALL_PARAMS; - alias SP_SELECTDEVICE_PARAMS_A SP_SELECTDEVICE_PARAMS; - alias SP_SELECTDEVICE_PARAMS_A* PSP_SELECTDEVICE_PARAMS; - alias SP_TROUBLESHOOTER_PARAMS_A SP_TROUBLESHOOTER_PARAMS; - alias SP_TROUBLESHOOTER_PARAMS_A* PSP_TROUBLESHOOTER_PARAMS; - alias SP_POWERMESSAGEWAKE_PARAMS_A SP_POWERMESSAGEWAKE_PARAMS; - alias SP_POWERMESSAGEWAKE_PARAMS_A* PSP_POWERMESSAGEWAKE_PARAMS; - alias SP_DRVINFO_DETAIL_DATA_A SP_DRVINFO_DETAIL_DATA; - alias SP_DRVINFO_DETAIL_DATA_A* PSP_DRVINFO_DETAIL_DATA; - alias SP_BACKUP_QUEUE_PARAMS_A SP_BACKUP_QUEUE_PARAMS; - alias SP_BACKUP_QUEUE_PARAMS_A* PSP_BACKUP_QUEUE_PARAMS; + alias SP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_A; + alias PSP_DEVINFO_LIST_DETAIL_DATA = SP_DEVINFO_LIST_DETAIL_DATA_A*; + alias SP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_A; + alias PSP_DEVINSTALL_PARAMS = SP_DEVINSTALL_PARAMS_A*; + alias SP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_A; + alias PSP_SELECTDEVICE_PARAMS = SP_SELECTDEVICE_PARAMS_A*; + alias SP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_A; + alias PSP_TROUBLESHOOTER_PARAMS = SP_TROUBLESHOOTER_PARAMS_A*; + alias SP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_A; + alias PSP_POWERMESSAGEWAKE_PARAMS = SP_POWERMESSAGEWAKE_PARAMS_A*; + alias SP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_A; + alias PSP_DRVINFO_DETAIL_DATA = SP_DRVINFO_DETAIL_DATA_A*; + alias SP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_A; + alias PSP_BACKUP_QUEUE_PARAMS = SP_BACKUP_QUEUE_PARAMS_A*; } extern (Windows) { @@ -1732,253 +1732,253 @@ extern (Windows) { } deprecated { - alias SetupDiCreateDeviceInterfaceW SetupDiCreateInterfaceDeviceW; - alias SetupDiCreateDeviceInterfaceRegKeyW SetupDiCreateInterfaceDeviceRegKeyW; - alias SetupDiOpenDeviceInterfaceW SetupDiOpenInterfaceDeviceW; - alias SetupDiGetDeviceInterfaceDetailW SetupDiGetInterfaceDeviceDetailW; - alias SetupDiCreateDeviceInterfaceA SetupDiCreateInterfaceDeviceA; - alias SetupDiCreateDeviceInterfaceRegKeyA SetupDiCreateInterfaceDeviceRegKeyA; - alias SetupDiOpenDeviceInterfaceA SetupDiOpenInterfaceDeviceA; - alias SetupDiGetDeviceInterfaceDetailA SetupDiGetInterfaceDeviceDetailA; + alias SetupDiCreateInterfaceDeviceW = SetupDiCreateDeviceInterfaceW; + alias SetupDiCreateInterfaceDeviceRegKeyW = SetupDiCreateDeviceInterfaceRegKeyW; + alias SetupDiOpenInterfaceDeviceW = SetupDiOpenDeviceInterfaceW; + alias SetupDiGetInterfaceDeviceDetailW = SetupDiGetDeviceInterfaceDetailW; + alias SetupDiCreateInterfaceDeviceA = SetupDiCreateDeviceInterfaceA; + alias SetupDiCreateInterfaceDeviceRegKeyA = SetupDiCreateDeviceInterfaceRegKeyA; + alias SetupDiOpenInterfaceDeviceA = SetupDiOpenDeviceInterfaceA; + alias SetupDiGetInterfaceDeviceDetailA = SetupDiGetDeviceInterfaceDetailA; } version (Unicode) { - alias PSP_FILE_CALLBACK_W PSP_FILE_CALLBACK; - alias SetupAddInstallSectionToDiskSpaceListW SetupAddInstallSectionToDiskSpaceList; - alias SetupAddSectionToDiskSpaceListW SetupAddSectionToDiskSpaceList; - alias SetupAddToDiskSpaceListW SetupAddToDiskSpaceList; - alias SetupAddToSourceListW SetupAddToSourceList; - alias SetupAdjustDiskSpaceListW SetupAdjustDiskSpaceList; - alias SetupBackupErrorW SetupBackupError; - alias SetupCommitFileQueueW SetupCommitFileQueue; - alias SetupCopyErrorW SetupCopyError; - alias SetupCopyOEMInfW SetupCopyOEMInf; - alias SetupCreateDiskSpaceListW SetupCreateDiskSpaceList; - alias SetupDecompressOrCopyFileW SetupDecompressOrCopyFile; - alias SetupDefaultQueueCallbackW SetupDefaultQueueCallback; - alias SetupDeleteErrorW SetupDeleteError; - alias SetupDiBuildClassInfoListExW SetupDiBuildClassInfoListEx; - alias SetupDiClassGuidsFromNameExW SetupDiClassGuidsFromNameEx; - alias SetupDiClassGuidsFromNameW SetupDiClassGuidsFromName; - alias SetupDiClassNameFromGuidExW SetupDiClassNameFromGuidEx; - alias SetupDiClassNameFromGuidW SetupDiClassNameFromGuid; - alias SetupDiCreateDeviceInfoListExW SetupDiCreateDeviceInfoListEx; - alias SetupDiCreateDeviceInfoW SetupDiCreateDeviceInfo; - alias SetupDiCreateDeviceInterfaceRegKeyW SetupDiCreateDeviceInterfaceRegKey; - deprecated alias SetupDiCreateDeviceInterfaceRegKeyW SetupDiCreateInterfaceDeviceRegKey; - alias SetupDiCreateDeviceInterfaceW SetupDiCreateDeviceInterface; - deprecated alias SetupDiCreateDeviceInterfaceW SetupDiCreateInterfaceDevice; - alias SetupDiCreateDevRegKeyW SetupDiCreateDevRegKey; - alias SetupDiEnumDriverInfoW SetupDiEnumDriverInfo; - alias SetupDiGetActualSectionToInstallW SetupDiGetActualSectionToInstall; - alias SetupDiGetClassDescriptionExW SetupDiGetClassDescriptionEx; - alias SetupDiGetClassDescriptionW SetupDiGetClassDescription; - alias SetupDiGetClassDevPropertySheetsW SetupDiGetClassDevPropertySheets; - alias SetupDiGetClassDevsExW SetupDiGetClassDevsEx; - alias SetupDiGetClassDevsW SetupDiGetClassDevs; - alias SetupDiGetClassImageListExW SetupDiGetClassImageListEx; - alias SetupDiGetClassInstallParamsW SetupDiGetClassInstallParams; - alias SetupDiGetClassRegistryPropertyW SetupDiGetClassRegistryProperty; - alias SetupDiGetDeviceInfoListDetailW SetupDiGetDeviceInfoListDetail; - alias SetupDiGetDeviceInstallParamsW SetupDiGetDeviceInstallParams; - alias SetupDiGetDeviceInstanceIdW SetupDiGetDeviceInstanceId; - alias SetupDiGetDeviceInterfaceDetailW SetupDiGetDeviceInterfaceDetail; - deprecated alias SetupDiGetDeviceInterfaceDetailW SetupDiGetInterfaceDeviceDetail; - alias SetupDiGetDeviceRegistryPropertyW SetupDiGetDeviceRegistryProperty; - alias SetupDiGetDriverInfoDetailW SetupDiGetDriverInfoDetail; - alias SetupDiGetDriverInstallParamsW SetupDiGetDriverInstallParams; - alias SetupDiGetHwProfileFriendlyNameExW SetupDiGetHwProfileFriendlyNameEx; - alias SetupDiGetHwProfileFriendlyNameW SetupDiGetHwProfileFriendlyName; - alias SetupDiGetHwProfileListExW SetupDiGetHwProfileListEx; - alias SetupDiGetINFClassW SetupDiGetINFClass; - alias SetupDiGetSelectedDriverW SetupDiGetSelectedDriver; - alias SetupDiInstallClassExW SetupDiInstallClassEx; - alias SetupDiInstallClassW SetupDiInstallClass; - alias SetupDiOpenClassRegKeyExW SetupDiOpenClassRegKeyEx; - alias SetupDiOpenDeviceInfoW SetupDiOpenDeviceInfo; - alias SetupDiOpenDeviceInterfaceW SetupDiOpenDeviceInterface; - deprecated alias SetupDiOpenDeviceInterfaceW SetupDiOpenInterfaceDevice; - alias SetupDiSetClassInstallParamsW SetupDiSetClassInstallParams; - alias SetupDiSetClassRegistryPropertyW SetupDiSetClassRegistryProperty; - alias SetupDiSetDeviceInstallParamsW SetupDiSetDeviceInstallParams; - alias SetupDiSetDeviceRegistryPropertyW SetupDiSetDeviceRegistryProperty; - alias SetupDiSetDriverInstallParamsW SetupDiSetDriverInstallParams; - alias SetupDiSetSelectedDriverW SetupDiSetSelectedDriver; - alias SetupDuplicateDiskSpaceListW SetupDuplicateDiskSpaceList; - alias SetupFindFirstLineW SetupFindFirstLine; - alias SetupFindNextMatchLineW SetupFindNextMatchLine; - alias SetupFreeSourceListW SetupFreeSourceList; - alias SetupGetBackupInformationW SetupGetBackupInformation; - alias SetupGetFileCompressionInfoW SetupGetFileCompressionInfo; - alias SetupGetInfFileListW SetupGetInfFileList; - alias SetupGetInfInformationW SetupGetInfInformation; - alias SetupGetLineByIndexW SetupGetLineByIndex; - alias SetupGetLineCountW SetupGetLineCount; - alias SetupGetLineTextW SetupGetLineText; - alias SetupGetMultiSzFieldW SetupGetMultiSzField; - alias SetupGetSourceFileLocationW SetupGetSourceFileLocation; - alias SetupGetSourceFileSizeW SetupGetSourceFileSize; - alias SetupGetSourceInfoW SetupGetSourceInfo; - alias SetupGetStringFieldW SetupGetStringField; - alias SetupGetTargetPathW SetupGetTargetPath; - alias SetupInitializeFileLogW SetupInitializeFileLog; - alias SetupInstallFileExW SetupInstallFileEx; - alias SetupInstallFilesFromInfSectionW SetupInstallFilesFromInfSection; - alias SetupInstallFileW SetupInstallFile; - alias SetupInstallFromInfSectionW SetupInstallFromInfSection; - alias SetupInstallServicesFromInfSectionExW SetupInstallServicesFromInfSectionEx; - alias SetupInstallServicesFromInfSectionW SetupInstallServicesFromInfSection; - alias SetupIterateCabinetW SetupIterateCabinet; - alias SetupLogErrorW SetupLogError; - alias SetupLogFileW SetupLogFile; - alias SetupOpenAppendInfFileW SetupOpenAppendInfFile; - alias SetupOpenInfFileW SetupOpenInfFile; - alias SetupPromptForDiskW SetupPromptForDisk; - alias SetupQueryDrivesInDiskSpaceListW SetupQueryDrivesInDiskSpaceList; - alias SetupQueryFileLogW SetupQueryFileLog; - alias SetupQueryInfFileInformationW SetupQueryInfFileInformation; - alias SetupQueryInfOriginalFileInformationW SetupQueryInfOriginalFileInformation; - alias SetupQueryInfVersionInformationW SetupQueryInfVersionInformation; - alias SetupQuerySourceListW SetupQuerySourceList; - alias SetupQuerySpaceRequiredOnDriveW SetupQuerySpaceRequiredOnDrive; - alias SetupQueueCopyIndirectW SetupQueueCopyIndirect; - alias SetupQueueCopySectionW SetupQueueCopySection; - alias SetupQueueCopyW SetupQueueCopy; - alias SetupQueueDefaultCopyW SetupQueueDefaultCopy; - alias SetupQueueDeleteSectionW SetupQueueDeleteSection; - alias SetupQueueDeleteW SetupQueueDelete; - alias SetupQueueRenameSectionW SetupQueueRenameSection; - alias SetupQueueRenameW SetupQueueRename; - alias SetupRemoveFileLogEntryW SetupRemoveFileLogEntry; - alias SetupRemoveFromDiskSpaceListW SetupRemoveFromDiskSpaceList; - alias SetupRemoveFromSourceListW SetupRemoveFromSourceList; - alias SetupRemoveInstallSectionFromDiskSpaceListW SetupRemoveInstallSectionFromDiskSpaceList; - alias SetupRemoveSectionFromDiskSpaceListW SetupRemoveSectionFromDiskSpaceList; - alias SetupRenameErrorW SetupRenameError; - alias SetupScanFileQueueW SetupScanFileQueue; - alias SetupSetDirectoryIdExW SetupSetDirectoryIdEx; - alias SetupSetDirectoryIdW SetupSetDirectoryId; - alias SetupSetFileQueueAlternatePlatformW SetupSetFileQueueAlternatePlatform; - alias SetupSetPlatformPathOverrideW SetupSetPlatformPathOverride; - alias SetupSetSourceListW SetupSetSourceList; + alias PSP_FILE_CALLBACK = PSP_FILE_CALLBACK_W; + alias SetupAddInstallSectionToDiskSpaceList = SetupAddInstallSectionToDiskSpaceListW; + alias SetupAddSectionToDiskSpaceList = SetupAddSectionToDiskSpaceListW; + alias SetupAddToDiskSpaceList = SetupAddToDiskSpaceListW; + alias SetupAddToSourceList = SetupAddToSourceListW; + alias SetupAdjustDiskSpaceList = SetupAdjustDiskSpaceListW; + alias SetupBackupError = SetupBackupErrorW; + alias SetupCommitFileQueue = SetupCommitFileQueueW; + alias SetupCopyError = SetupCopyErrorW; + alias SetupCopyOEMInf = SetupCopyOEMInfW; + alias SetupCreateDiskSpaceList = SetupCreateDiskSpaceListW; + alias SetupDecompressOrCopyFile = SetupDecompressOrCopyFileW; + alias SetupDefaultQueueCallback = SetupDefaultQueueCallbackW; + alias SetupDeleteError = SetupDeleteErrorW; + alias SetupDiBuildClassInfoListEx = SetupDiBuildClassInfoListExW; + alias SetupDiClassGuidsFromNameEx = SetupDiClassGuidsFromNameExW; + alias SetupDiClassGuidsFromName = SetupDiClassGuidsFromNameW; + alias SetupDiClassNameFromGuidEx = SetupDiClassNameFromGuidExW; + alias SetupDiClassNameFromGuid = SetupDiClassNameFromGuidW; + alias SetupDiCreateDeviceInfoListEx = SetupDiCreateDeviceInfoListExW; + alias SetupDiCreateDeviceInfo = SetupDiCreateDeviceInfoW; + alias SetupDiCreateDeviceInterfaceRegKey = SetupDiCreateDeviceInterfaceRegKeyW; + deprecated alias SetupDiCreateInterfaceDeviceRegKey = SetupDiCreateDeviceInterfaceRegKeyW; + alias SetupDiCreateDeviceInterface = SetupDiCreateDeviceInterfaceW; + deprecated alias SetupDiCreateInterfaceDevice = SetupDiCreateDeviceInterfaceW; + alias SetupDiCreateDevRegKey = SetupDiCreateDevRegKeyW; + alias SetupDiEnumDriverInfo = SetupDiEnumDriverInfoW; + alias SetupDiGetActualSectionToInstall = SetupDiGetActualSectionToInstallW; + alias SetupDiGetClassDescriptionEx = SetupDiGetClassDescriptionExW; + alias SetupDiGetClassDescription = SetupDiGetClassDescriptionW; + alias SetupDiGetClassDevPropertySheets = SetupDiGetClassDevPropertySheetsW; + alias SetupDiGetClassDevsEx = SetupDiGetClassDevsExW; + alias SetupDiGetClassDevs = SetupDiGetClassDevsW; + alias SetupDiGetClassImageListEx = SetupDiGetClassImageListExW; + alias SetupDiGetClassInstallParams = SetupDiGetClassInstallParamsW; + alias SetupDiGetClassRegistryProperty = SetupDiGetClassRegistryPropertyW; + alias SetupDiGetDeviceInfoListDetail = SetupDiGetDeviceInfoListDetailW; + alias SetupDiGetDeviceInstallParams = SetupDiGetDeviceInstallParamsW; + alias SetupDiGetDeviceInstanceId = SetupDiGetDeviceInstanceIdW; + alias SetupDiGetDeviceInterfaceDetail = SetupDiGetDeviceInterfaceDetailW; + deprecated alias SetupDiGetInterfaceDeviceDetail = SetupDiGetDeviceInterfaceDetailW; + alias SetupDiGetDeviceRegistryProperty = SetupDiGetDeviceRegistryPropertyW; + alias SetupDiGetDriverInfoDetail = SetupDiGetDriverInfoDetailW; + alias SetupDiGetDriverInstallParams = SetupDiGetDriverInstallParamsW; + alias SetupDiGetHwProfileFriendlyNameEx = SetupDiGetHwProfileFriendlyNameExW; + alias SetupDiGetHwProfileFriendlyName = SetupDiGetHwProfileFriendlyNameW; + alias SetupDiGetHwProfileListEx = SetupDiGetHwProfileListExW; + alias SetupDiGetINFClass = SetupDiGetINFClassW; + alias SetupDiGetSelectedDriver = SetupDiGetSelectedDriverW; + alias SetupDiInstallClassEx = SetupDiInstallClassExW; + alias SetupDiInstallClass = SetupDiInstallClassW; + alias SetupDiOpenClassRegKeyEx = SetupDiOpenClassRegKeyExW; + alias SetupDiOpenDeviceInfo = SetupDiOpenDeviceInfoW; + alias SetupDiOpenDeviceInterface = SetupDiOpenDeviceInterfaceW; + deprecated alias SetupDiOpenInterfaceDevice = SetupDiOpenDeviceInterfaceW; + alias SetupDiSetClassInstallParams = SetupDiSetClassInstallParamsW; + alias SetupDiSetClassRegistryProperty = SetupDiSetClassRegistryPropertyW; + alias SetupDiSetDeviceInstallParams = SetupDiSetDeviceInstallParamsW; + alias SetupDiSetDeviceRegistryProperty = SetupDiSetDeviceRegistryPropertyW; + alias SetupDiSetDriverInstallParams = SetupDiSetDriverInstallParamsW; + alias SetupDiSetSelectedDriver = SetupDiSetSelectedDriverW; + alias SetupDuplicateDiskSpaceList = SetupDuplicateDiskSpaceListW; + alias SetupFindFirstLine = SetupFindFirstLineW; + alias SetupFindNextMatchLine = SetupFindNextMatchLineW; + alias SetupFreeSourceList = SetupFreeSourceListW; + alias SetupGetBackupInformation = SetupGetBackupInformationW; + alias SetupGetFileCompressionInfo = SetupGetFileCompressionInfoW; + alias SetupGetInfFileList = SetupGetInfFileListW; + alias SetupGetInfInformation = SetupGetInfInformationW; + alias SetupGetLineByIndex = SetupGetLineByIndexW; + alias SetupGetLineCount = SetupGetLineCountW; + alias SetupGetLineText = SetupGetLineTextW; + alias SetupGetMultiSzField = SetupGetMultiSzFieldW; + alias SetupGetSourceFileLocation = SetupGetSourceFileLocationW; + alias SetupGetSourceFileSize = SetupGetSourceFileSizeW; + alias SetupGetSourceInfo = SetupGetSourceInfoW; + alias SetupGetStringField = SetupGetStringFieldW; + alias SetupGetTargetPath = SetupGetTargetPathW; + alias SetupInitializeFileLog = SetupInitializeFileLogW; + alias SetupInstallFileEx = SetupInstallFileExW; + alias SetupInstallFilesFromInfSection = SetupInstallFilesFromInfSectionW; + alias SetupInstallFile = SetupInstallFileW; + alias SetupInstallFromInfSection = SetupInstallFromInfSectionW; + alias SetupInstallServicesFromInfSectionEx = SetupInstallServicesFromInfSectionExW; + alias SetupInstallServicesFromInfSection = SetupInstallServicesFromInfSectionW; + alias SetupIterateCabinet = SetupIterateCabinetW; + alias SetupLogError = SetupLogErrorW; + alias SetupLogFile = SetupLogFileW; + alias SetupOpenAppendInfFile = SetupOpenAppendInfFileW; + alias SetupOpenInfFile = SetupOpenInfFileW; + alias SetupPromptForDisk = SetupPromptForDiskW; + alias SetupQueryDrivesInDiskSpaceList = SetupQueryDrivesInDiskSpaceListW; + alias SetupQueryFileLog = SetupQueryFileLogW; + alias SetupQueryInfFileInformation = SetupQueryInfFileInformationW; + alias SetupQueryInfOriginalFileInformation = SetupQueryInfOriginalFileInformationW; + alias SetupQueryInfVersionInformation = SetupQueryInfVersionInformationW; + alias SetupQuerySourceList = SetupQuerySourceListW; + alias SetupQuerySpaceRequiredOnDrive = SetupQuerySpaceRequiredOnDriveW; + alias SetupQueueCopyIndirect = SetupQueueCopyIndirectW; + alias SetupQueueCopySection = SetupQueueCopySectionW; + alias SetupQueueCopy = SetupQueueCopyW; + alias SetupQueueDefaultCopy = SetupQueueDefaultCopyW; + alias SetupQueueDeleteSection = SetupQueueDeleteSectionW; + alias SetupQueueDelete = SetupQueueDeleteW; + alias SetupQueueRenameSection = SetupQueueRenameSectionW; + alias SetupQueueRename = SetupQueueRenameW; + alias SetupRemoveFileLogEntry = SetupRemoveFileLogEntryW; + alias SetupRemoveFromDiskSpaceList = SetupRemoveFromDiskSpaceListW; + alias SetupRemoveFromSourceList = SetupRemoveFromSourceListW; + alias SetupRemoveInstallSectionFromDiskSpaceList = SetupRemoveInstallSectionFromDiskSpaceListW; + alias SetupRemoveSectionFromDiskSpaceList = SetupRemoveSectionFromDiskSpaceListW; + alias SetupRenameError = SetupRenameErrorW; + alias SetupScanFileQueue = SetupScanFileQueueW; + alias SetupSetDirectoryIdEx = SetupSetDirectoryIdExW; + alias SetupSetDirectoryId = SetupSetDirectoryIdW; + alias SetupSetFileQueueAlternatePlatform = SetupSetFileQueueAlternatePlatformW; + alias SetupSetPlatformPathOverride = SetupSetPlatformPathOverrideW; + alias SetupSetSourceList = SetupSetSourceListW; } else { - alias PSP_FILE_CALLBACK_A PSP_FILE_CALLBACK; - alias SetupAddInstallSectionToDiskSpaceListA SetupAddInstallSectionToDiskSpaceList; - alias SetupAddSectionToDiskSpaceListA SetupAddSectionToDiskSpaceList; - alias SetupAddToDiskSpaceListA SetupAddToDiskSpaceList; - alias SetupAddToSourceListA SetupAddToSourceList; - alias SetupAdjustDiskSpaceListA SetupAdjustDiskSpaceList; - alias SetupBackupErrorA SetupBackupError; - alias SetupCommitFileQueueA SetupCommitFileQueue; - alias SetupCopyErrorA SetupCopyError; - alias SetupCopyOEMInfA SetupCopyOEMInf; - alias SetupCreateDiskSpaceListA SetupCreateDiskSpaceList; - alias SetupDecompressOrCopyFileA SetupDecompressOrCopyFile; - alias SetupDefaultQueueCallbackA SetupDefaultQueueCallback; - alias SetupDeleteErrorA SetupDeleteError; - alias SetupDiBuildClassInfoListExA SetupDiBuildClassInfoListEx; - alias SetupDiClassGuidsFromNameA SetupDiClassGuidsFromName; - alias SetupDiClassGuidsFromNameExA SetupDiClassGuidsFromNameEx; - alias SetupDiClassNameFromGuidA SetupDiClassNameFromGuid; - alias SetupDiClassNameFromGuidExA SetupDiClassNameFromGuidEx; - alias SetupDiCreateDeviceInfoA SetupDiCreateDeviceInfo; - alias SetupDiCreateDeviceInfoListExA SetupDiCreateDeviceInfoListEx; - alias SetupDiCreateDeviceInterfaceA SetupDiCreateDeviceInterface; - deprecated alias SetupDiCreateDeviceInterfaceA SetupDiCreateInterfaceDevice; - alias SetupDiCreateDeviceInterfaceRegKeyA SetupDiCreateDeviceInterfaceRegKey; - deprecated alias SetupDiCreateDeviceInterfaceRegKeyA SetupDiCreateInterfaceDeviceRegKey; - alias SetupDiCreateDevRegKeyA SetupDiCreateDevRegKey; - alias SetupDiDeleteDeviceInterfaceData SetupDiDeleteInterfaceDeviceData; - alias SetupDiEnumDriverInfoA SetupDiEnumDriverInfo; - alias SetupDiGetActualSectionToInstallA SetupDiGetActualSectionToInstall; - alias SetupDiGetClassDescriptionA SetupDiGetClassDescription; - alias SetupDiGetClassDescriptionExA SetupDiGetClassDescriptionEx; - alias SetupDiGetClassDevPropertySheetsA SetupDiGetClassDevPropertySheets; - alias SetupDiGetClassDevsA SetupDiGetClassDevs; - alias SetupDiGetClassDevsExA SetupDiGetClassDevsEx; - alias SetupDiGetClassImageListExA SetupDiGetClassImageListEx; - alias SetupDiGetClassInstallParamsA SetupDiGetClassInstallParams; - alias SetupDiGetClassRegistryPropertyA SetupDiGetClassRegistryProperty; - alias SetupDiGetDeviceInfoListDetailA SetupDiGetDeviceInfoListDetail; - alias SetupDiGetDeviceInstallParamsA SetupDiGetDeviceInstallParams; - alias SetupDiGetDeviceInstanceIdA SetupDiGetDeviceInstanceId; - alias SetupDiGetDeviceInterfaceDetailA SetupDiGetDeviceInterfaceDetail; - deprecated alias SetupDiGetDeviceInterfaceDetailA SetupDiGetInterfaceDeviceDetail; - alias SetupDiGetDeviceRegistryPropertyA SetupDiGetDeviceRegistryProperty; - alias SetupDiGetDriverInfoDetailA SetupDiGetDriverInfoDetail; - alias SetupDiGetDriverInstallParamsA SetupDiGetDriverInstallParams; - alias SetupDiGetHwProfileFriendlyNameA SetupDiGetHwProfileFriendlyName; - alias SetupDiGetHwProfileFriendlyNameExA SetupDiGetHwProfileFriendlyNameEx; - alias SetupDiGetHwProfileListExA SetupDiGetHwProfileListEx; - alias SetupDiGetINFClassA SetupDiGetINFClass; - alias SetupDiGetSelectedDriverA SetupDiGetSelectedDriver; - alias SetupDiInstallClassA SetupDiInstallClass; - alias SetupDiInstallClassExA SetupDiInstallClassEx; - alias SetupDiOpenClassRegKeyExA SetupDiOpenClassRegKeyEx; - alias SetupDiOpenDeviceInfoA SetupDiOpenDeviceInfo; - alias SetupDiOpenDeviceInterfaceA SetupDiOpenDeviceInterface; - deprecated alias SetupDiOpenDeviceInterfaceA SetupDiOpenInterfaceDevice; - alias SetupDiSetClassInstallParamsA SetupDiSetClassInstallParams; - alias SetupDiSetClassRegistryPropertyA SetupDiSetClassRegistryProperty; - alias SetupDiSetDeviceInstallParamsA SetupDiSetDeviceInstallParams; - alias SetupDiSetDeviceRegistryPropertyA SetupDiSetDeviceRegistryProperty; - alias SetupDiSetDriverInstallParamsA SetupDiSetDriverInstallParams; - alias SetupDiSetSelectedDriverA SetupDiSetSelectedDriver; - alias SetupDuplicateDiskSpaceListA SetupDuplicateDiskSpaceList; - alias SetupFindFirstLineA SetupFindFirstLine; - alias SetupFindNextMatchLineA SetupFindNextMatchLine; - alias SetupFreeSourceListA SetupFreeSourceList; - alias SetupGetBackupInformationA SetupGetBackupInformation; - alias SetupGetFileCompressionInfoA SetupGetFileCompressionInfo; - alias SetupGetInfFileListA SetupGetInfFileList; - alias SetupGetInfInformationA SetupGetInfInformation; - alias SetupGetLineByIndexA SetupGetLineByIndex; - alias SetupGetLineCountA SetupGetLineCount; - alias SetupGetLineTextA SetupGetLineText; - alias SetupGetMultiSzFieldA SetupGetMultiSzField; - alias SetupGetSourceFileLocationA SetupGetSourceFileLocation; - alias SetupGetSourceFileSizeA SetupGetSourceFileSize; - alias SetupGetSourceInfoA SetupGetSourceInfo; - alias SetupGetStringFieldA SetupGetStringField; - alias SetupGetTargetPathA SetupGetTargetPath; - alias SetupInitializeFileLogA SetupInitializeFileLog; - alias SetupInstallFileA SetupInstallFile; - alias SetupInstallFileExA SetupInstallFileEx; - alias SetupInstallFilesFromInfSectionA SetupInstallFilesFromInfSection; - alias SetupInstallFromInfSectionA SetupInstallFromInfSection; - alias SetupInstallServicesFromInfSectionA SetupInstallServicesFromInfSection; - alias SetupInstallServicesFromInfSectionExA SetupInstallServicesFromInfSectionEx; - alias SetupIterateCabinetA SetupIterateCabinet; - alias SetupLogErrorA SetupLogError; - alias SetupLogFileA SetupLogFile; - alias SetupOpenAppendInfFileA SetupOpenAppendInfFile; - alias SetupOpenInfFileA SetupOpenInfFile; - alias SetupPromptForDiskA SetupPromptForDisk; - alias SetupQueryDrivesInDiskSpaceListA SetupQueryDrivesInDiskSpaceList; - alias SetupQueryFileLogA SetupQueryFileLog; - alias SetupQueryInfFileInformationA SetupQueryInfFileInformation; - alias SetupQueryInfOriginalFileInformationA SetupQueryInfOriginalFileInformation; - alias SetupQueryInfVersionInformationA SetupQueryInfVersionInformation; - alias SetupQuerySourceListA SetupQuerySourceList; - alias SetupQuerySpaceRequiredOnDriveA SetupQuerySpaceRequiredOnDrive; - alias SetupQueueCopyA SetupQueueCopy; - alias SetupQueueCopyIndirectA SetupQueueCopyIndirect; - alias SetupQueueCopySectionA SetupQueueCopySection; - alias SetupQueueDefaultCopyA SetupQueueDefaultCopy; - alias SetupQueueDeleteA SetupQueueDelete; - alias SetupQueueDeleteSectionA SetupQueueDeleteSection; - alias SetupQueueRenameA SetupQueueRename; - alias SetupQueueRenameSectionA SetupQueueRenameSection; - alias SetupRemoveFileLogEntryA SetupRemoveFileLogEntry; - alias SetupRemoveFromDiskSpaceListA SetupRemoveFromDiskSpaceList; - alias SetupRemoveFromSourceListA SetupRemoveFromSourceList; - alias SetupRemoveInstallSectionFromDiskSpaceListA SetupRemoveInstallSectionFromDiskSpaceList; - alias SetupRemoveSectionFromDiskSpaceListA SetupRemoveSectionFromDiskSpaceList; - alias SetupRenameErrorA SetupRenameError; - alias SetupScanFileQueueA SetupScanFileQueue; - alias SetupSetDirectoryIdA SetupSetDirectoryId; - alias SetupSetDirectoryIdExA SetupSetDirectoryIdEx; - alias SetupSetFileQueueAlternatePlatformA SetupSetFileQueueAlternatePlatform; - alias SetupSetPlatformPathOverrideA SetupSetPlatformPathOverride; - alias SetupSetSourceListA SetupSetSourceList; + alias PSP_FILE_CALLBACK = PSP_FILE_CALLBACK_A; + alias SetupAddInstallSectionToDiskSpaceList = SetupAddInstallSectionToDiskSpaceListA; + alias SetupAddSectionToDiskSpaceList = SetupAddSectionToDiskSpaceListA; + alias SetupAddToDiskSpaceList = SetupAddToDiskSpaceListA; + alias SetupAddToSourceList = SetupAddToSourceListA; + alias SetupAdjustDiskSpaceList = SetupAdjustDiskSpaceListA; + alias SetupBackupError = SetupBackupErrorA; + alias SetupCommitFileQueue = SetupCommitFileQueueA; + alias SetupCopyError = SetupCopyErrorA; + alias SetupCopyOEMInf = SetupCopyOEMInfA; + alias SetupCreateDiskSpaceList = SetupCreateDiskSpaceListA; + alias SetupDecompressOrCopyFile = SetupDecompressOrCopyFileA; + alias SetupDefaultQueueCallback = SetupDefaultQueueCallbackA; + alias SetupDeleteError = SetupDeleteErrorA; + alias SetupDiBuildClassInfoListEx = SetupDiBuildClassInfoListExA; + alias SetupDiClassGuidsFromName = SetupDiClassGuidsFromNameA; + alias SetupDiClassGuidsFromNameEx = SetupDiClassGuidsFromNameExA; + alias SetupDiClassNameFromGuid = SetupDiClassNameFromGuidA; + alias SetupDiClassNameFromGuidEx = SetupDiClassNameFromGuidExA; + alias SetupDiCreateDeviceInfo = SetupDiCreateDeviceInfoA; + alias SetupDiCreateDeviceInfoListEx = SetupDiCreateDeviceInfoListExA; + alias SetupDiCreateDeviceInterface = SetupDiCreateDeviceInterfaceA; + deprecated alias SetupDiCreateInterfaceDevice = SetupDiCreateDeviceInterfaceA; + alias SetupDiCreateDeviceInterfaceRegKey = SetupDiCreateDeviceInterfaceRegKeyA; + deprecated alias SetupDiCreateInterfaceDeviceRegKey = SetupDiCreateDeviceInterfaceRegKeyA; + alias SetupDiCreateDevRegKey = SetupDiCreateDevRegKeyA; + alias SetupDiDeleteInterfaceDeviceData = SetupDiDeleteDeviceInterfaceData; + alias SetupDiEnumDriverInfo = SetupDiEnumDriverInfoA; + alias SetupDiGetActualSectionToInstall = SetupDiGetActualSectionToInstallA; + alias SetupDiGetClassDescription = SetupDiGetClassDescriptionA; + alias SetupDiGetClassDescriptionEx = SetupDiGetClassDescriptionExA; + alias SetupDiGetClassDevPropertySheets = SetupDiGetClassDevPropertySheetsA; + alias SetupDiGetClassDevs = SetupDiGetClassDevsA; + alias SetupDiGetClassDevsEx = SetupDiGetClassDevsExA; + alias SetupDiGetClassImageListEx = SetupDiGetClassImageListExA; + alias SetupDiGetClassInstallParams = SetupDiGetClassInstallParamsA; + alias SetupDiGetClassRegistryProperty = SetupDiGetClassRegistryPropertyA; + alias SetupDiGetDeviceInfoListDetail = SetupDiGetDeviceInfoListDetailA; + alias SetupDiGetDeviceInstallParams = SetupDiGetDeviceInstallParamsA; + alias SetupDiGetDeviceInstanceId = SetupDiGetDeviceInstanceIdA; + alias SetupDiGetDeviceInterfaceDetail = SetupDiGetDeviceInterfaceDetailA; + deprecated alias SetupDiGetInterfaceDeviceDetail = SetupDiGetDeviceInterfaceDetailA; + alias SetupDiGetDeviceRegistryProperty = SetupDiGetDeviceRegistryPropertyA; + alias SetupDiGetDriverInfoDetail = SetupDiGetDriverInfoDetailA; + alias SetupDiGetDriverInstallParams = SetupDiGetDriverInstallParamsA; + alias SetupDiGetHwProfileFriendlyName = SetupDiGetHwProfileFriendlyNameA; + alias SetupDiGetHwProfileFriendlyNameEx = SetupDiGetHwProfileFriendlyNameExA; + alias SetupDiGetHwProfileListEx = SetupDiGetHwProfileListExA; + alias SetupDiGetINFClass = SetupDiGetINFClassA; + alias SetupDiGetSelectedDriver = SetupDiGetSelectedDriverA; + alias SetupDiInstallClass = SetupDiInstallClassA; + alias SetupDiInstallClassEx = SetupDiInstallClassExA; + alias SetupDiOpenClassRegKeyEx = SetupDiOpenClassRegKeyExA; + alias SetupDiOpenDeviceInfo = SetupDiOpenDeviceInfoA; + alias SetupDiOpenDeviceInterface = SetupDiOpenDeviceInterfaceA; + deprecated alias SetupDiOpenInterfaceDevice = SetupDiOpenDeviceInterfaceA; + alias SetupDiSetClassInstallParams = SetupDiSetClassInstallParamsA; + alias SetupDiSetClassRegistryProperty = SetupDiSetClassRegistryPropertyA; + alias SetupDiSetDeviceInstallParams = SetupDiSetDeviceInstallParamsA; + alias SetupDiSetDeviceRegistryProperty = SetupDiSetDeviceRegistryPropertyA; + alias SetupDiSetDriverInstallParams = SetupDiSetDriverInstallParamsA; + alias SetupDiSetSelectedDriver = SetupDiSetSelectedDriverA; + alias SetupDuplicateDiskSpaceList = SetupDuplicateDiskSpaceListA; + alias SetupFindFirstLine = SetupFindFirstLineA; + alias SetupFindNextMatchLine = SetupFindNextMatchLineA; + alias SetupFreeSourceList = SetupFreeSourceListA; + alias SetupGetBackupInformation = SetupGetBackupInformationA; + alias SetupGetFileCompressionInfo = SetupGetFileCompressionInfoA; + alias SetupGetInfFileList = SetupGetInfFileListA; + alias SetupGetInfInformation = SetupGetInfInformationA; + alias SetupGetLineByIndex = SetupGetLineByIndexA; + alias SetupGetLineCount = SetupGetLineCountA; + alias SetupGetLineText = SetupGetLineTextA; + alias SetupGetMultiSzField = SetupGetMultiSzFieldA; + alias SetupGetSourceFileLocation = SetupGetSourceFileLocationA; + alias SetupGetSourceFileSize = SetupGetSourceFileSizeA; + alias SetupGetSourceInfo = SetupGetSourceInfoA; + alias SetupGetStringField = SetupGetStringFieldA; + alias SetupGetTargetPath = SetupGetTargetPathA; + alias SetupInitializeFileLog = SetupInitializeFileLogA; + alias SetupInstallFile = SetupInstallFileA; + alias SetupInstallFileEx = SetupInstallFileExA; + alias SetupInstallFilesFromInfSection = SetupInstallFilesFromInfSectionA; + alias SetupInstallFromInfSection = SetupInstallFromInfSectionA; + alias SetupInstallServicesFromInfSection = SetupInstallServicesFromInfSectionA; + alias SetupInstallServicesFromInfSectionEx = SetupInstallServicesFromInfSectionExA; + alias SetupIterateCabinet = SetupIterateCabinetA; + alias SetupLogError = SetupLogErrorA; + alias SetupLogFile = SetupLogFileA; + alias SetupOpenAppendInfFile = SetupOpenAppendInfFileA; + alias SetupOpenInfFile = SetupOpenInfFileA; + alias SetupPromptForDisk = SetupPromptForDiskA; + alias SetupQueryDrivesInDiskSpaceList = SetupQueryDrivesInDiskSpaceListA; + alias SetupQueryFileLog = SetupQueryFileLogA; + alias SetupQueryInfFileInformation = SetupQueryInfFileInformationA; + alias SetupQueryInfOriginalFileInformation = SetupQueryInfOriginalFileInformationA; + alias SetupQueryInfVersionInformation = SetupQueryInfVersionInformationA; + alias SetupQuerySourceList = SetupQuerySourceListA; + alias SetupQuerySpaceRequiredOnDrive = SetupQuerySpaceRequiredOnDriveA; + alias SetupQueueCopy = SetupQueueCopyA; + alias SetupQueueCopyIndirect = SetupQueueCopyIndirectA; + alias SetupQueueCopySection = SetupQueueCopySectionA; + alias SetupQueueDefaultCopy = SetupQueueDefaultCopyA; + alias SetupQueueDelete = SetupQueueDeleteA; + alias SetupQueueDeleteSection = SetupQueueDeleteSectionA; + alias SetupQueueRename = SetupQueueRenameA; + alias SetupQueueRenameSection = SetupQueueRenameSectionA; + alias SetupRemoveFileLogEntry = SetupRemoveFileLogEntryA; + alias SetupRemoveFromDiskSpaceList = SetupRemoveFromDiskSpaceListA; + alias SetupRemoveFromSourceList = SetupRemoveFromSourceListA; + alias SetupRemoveInstallSectionFromDiskSpaceList = SetupRemoveInstallSectionFromDiskSpaceListA; + alias SetupRemoveSectionFromDiskSpaceList = SetupRemoveSectionFromDiskSpaceListA; + alias SetupRenameError = SetupRenameErrorA; + alias SetupScanFileQueue = SetupScanFileQueueA; + alias SetupSetDirectoryId = SetupSetDirectoryIdA; + alias SetupSetDirectoryIdEx = SetupSetDirectoryIdExA; + alias SetupSetFileQueueAlternatePlatform = SetupSetFileQueueAlternatePlatformA; + alias SetupSetPlatformPathOverride = SetupSetPlatformPathOverrideA; + alias SetupSetSourceList = SetupSetSourceListA; } diff --git a/runtime/druntime/src/core/sys/windows/shellapi.d b/runtime/druntime/src/core/sys/windows/shellapi.d index 2ddf680e1f0..9c19e018e66 100644 --- a/runtime/druntime/src/core/sys/windows/shellapi.d +++ b/runtime/druntime/src/core/sys/windows/shellapi.d @@ -187,7 +187,7 @@ enum SHERB_NOCONFIRMATION = 1; enum SHERB_NOPROGRESSUI = 2; enum SHERB_NOSOUND = 4; -alias WORD FILEOP_FLAGS, PRINTEROP_FLAGS; +alias FILEOP_FLAGS = WORD, PRINTEROP_FLAGS = WORD; alias HDROP = HANDLE; //align(2): // 1 in Win32, default in Win64 @@ -200,7 +200,7 @@ struct APPBARDATA { RECT rc; LPARAM lParam; } -alias APPBARDATA* PAPPBARDATA; +alias PAPPBARDATA = APPBARDATA*; struct NOTIFYICONDATAA { DWORD cbSize = NOTIFYICONDATAA.sizeof; @@ -227,7 +227,7 @@ struct NOTIFYICONDATAA { GUID guidItem; } } -alias NOTIFYICONDATAA* PNOTIFYICONDATAA; +alias PNOTIFYICONDATAA = NOTIFYICONDATAA*; struct NOTIFYICONDATAW { DWORD cbSize = NOTIFYICONDATAW.sizeof; @@ -254,7 +254,7 @@ struct NOTIFYICONDATAW { GUID guidItem; } } -alias NOTIFYICONDATAW* PNOTIFYICONDATAW; +alias PNOTIFYICONDATAW = NOTIFYICONDATAW*; struct SHELLEXECUTEINFOA { DWORD cbSize = SHELLEXECUTEINFOA.sizeof; @@ -273,7 +273,7 @@ struct SHELLEXECUTEINFOA { HANDLE hIcon; HANDLE hProcess; } -alias SHELLEXECUTEINFOA* LPSHELLEXECUTEINFOA; +alias LPSHELLEXECUTEINFOA = SHELLEXECUTEINFOA*; struct SHELLEXECUTEINFOW { DWORD cbSize = SHELLEXECUTEINFOW.sizeof; @@ -292,7 +292,7 @@ struct SHELLEXECUTEINFOW { HANDLE hIcon; HANDLE hProcess; } -alias SHELLEXECUTEINFOW* LPSHELLEXECUTEINFOW; +alias LPSHELLEXECUTEINFOW = SHELLEXECUTEINFOW*; align(1) struct SHFILEOPSTRUCTA { align(1): @@ -309,7 +309,7 @@ align(1): PVOID hNameMappings; LPCSTR lpszProgressTitle; } -alias SHFILEOPSTRUCTA* LPSHFILEOPSTRUCTA; +alias LPSHFILEOPSTRUCTA = SHFILEOPSTRUCTA*; align(1) struct SHFILEOPSTRUCTW { align(1): @@ -326,7 +326,7 @@ align(1): PVOID hNameMappings; LPCWSTR lpszProgressTitle; } -alias SHFILEOPSTRUCTW* LPSHFILEOPSTRUCTW; +alias LPSHFILEOPSTRUCTW = SHFILEOPSTRUCTW*; struct SHFILEINFOA { HICON hIcon; @@ -352,7 +352,7 @@ align(1): long i64Size; long i64NumItems; } -alias SHQUERYRBINFO* LPSHQUERYRBINFO; +alias LPSHQUERYRBINFO = SHQUERYRBINFO*; extern (Windows) nothrow @nogc { LPWSTR* CommandLineToArgvW(LPCWSTR, int*); @@ -391,43 +391,43 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias NOTIFYICONDATAW NOTIFYICONDATA; - alias SHELLEXECUTEINFOW SHELLEXECUTEINFO; - alias SHFILEOPSTRUCTW SHFILEOPSTRUCT; - alias SHFILEINFOW SHFILEINFO; - alias DragQueryFileW DragQueryFile; - alias ExtractAssociatedIconW ExtractAssociatedIcon; - alias ExtractIconW ExtractIcon; - alias ExtractIconExW ExtractIconEx; - alias FindExecutableW FindExecutable; - alias Shell_NotifyIconW Shell_NotifyIcon; - alias ShellAboutW ShellAbout; - alias ShellExecuteW ShellExecute; - alias ShellExecuteExW ShellExecuteEx; - alias SHFileOperationW SHFileOperation; - alias SHGetFileInfoW SHGetFileInfo; - alias SHQueryRecycleBinW SHQueryRecycleBin; - alias SHEmptyRecycleBinW SHEmptyRecycleBin; + alias NOTIFYICONDATA = NOTIFYICONDATAW; + alias SHELLEXECUTEINFO = SHELLEXECUTEINFOW; + alias SHFILEOPSTRUCT = SHFILEOPSTRUCTW; + alias SHFILEINFO = SHFILEINFOW; + alias DragQueryFile = DragQueryFileW; + alias ExtractAssociatedIcon = ExtractAssociatedIconW; + alias ExtractIcon = ExtractIconW; + alias ExtractIconEx = ExtractIconExW; + alias FindExecutable = FindExecutableW; + alias Shell_NotifyIcon = Shell_NotifyIconW; + alias ShellAbout = ShellAboutW; + alias ShellExecute = ShellExecuteW; + alias ShellExecuteEx = ShellExecuteExW; + alias SHFileOperation = SHFileOperationW; + alias SHGetFileInfo = SHGetFileInfoW; + alias SHQueryRecycleBin = SHQueryRecycleBinW; + alias SHEmptyRecycleBin = SHEmptyRecycleBinW; } else { - alias NOTIFYICONDATAA NOTIFYICONDATA; - alias SHELLEXECUTEINFOA SHELLEXECUTEINFO; - alias SHFILEOPSTRUCTA SHFILEOPSTRUCT; - alias SHFILEINFOA SHFILEINFO; - alias DragQueryFileA DragQueryFile; - alias ExtractAssociatedIconA ExtractAssociatedIcon; - alias ExtractIconA ExtractIcon; - alias ExtractIconExA ExtractIconEx; - alias FindExecutableA FindExecutable; - alias Shell_NotifyIconA Shell_NotifyIcon; - alias ShellAboutA ShellAbout; - alias ShellExecuteA ShellExecute; - alias ShellExecuteExA ShellExecuteEx; - alias SHFileOperationA SHFileOperation; - alias SHGetFileInfoA SHGetFileInfo; - alias SHQueryRecycleBinA SHQueryRecycleBin; - alias SHEmptyRecycleBinA SHEmptyRecycleBin; + alias NOTIFYICONDATA = NOTIFYICONDATAA; + alias SHELLEXECUTEINFO = SHELLEXECUTEINFOA; + alias SHFILEOPSTRUCT = SHFILEOPSTRUCTA; + alias SHFILEINFO = SHFILEINFOA; + alias DragQueryFile = DragQueryFileA; + alias ExtractAssociatedIcon = ExtractAssociatedIconA; + alias ExtractIcon = ExtractIconA; + alias ExtractIconEx = ExtractIconExA; + alias FindExecutable = FindExecutableA; + alias Shell_NotifyIcon = Shell_NotifyIconA; + alias ShellAbout = ShellAboutA; + alias ShellExecute = ShellExecuteA; + alias ShellExecuteEx = ShellExecuteExA; + alias SHFileOperation = SHFileOperationA; + alias SHGetFileInfo = SHGetFileInfoA; + alias SHQueryRecycleBin = SHQueryRecycleBinA; + alias SHEmptyRecycleBin = SHEmptyRecycleBinA; } -alias NOTIFYICONDATA* PNOTIFYICONDATA; -alias SHELLEXECUTEINFO* LPSHELLEXECUTEINFO; -alias SHFILEOPSTRUCT* LPSHFILEOPSTRUCT; +alias PNOTIFYICONDATA = NOTIFYICONDATA*; +alias LPSHELLEXECUTEINFO = SHELLEXECUTEINFO*; +alias LPSHFILEOPSTRUCT = SHFILEOPSTRUCT*; diff --git a/runtime/druntime/src/core/sys/windows/shldisp.d b/runtime/druntime/src/core/sys/windows/shldisp.d index 144f90775e1..dd5549d717c 100644 --- a/runtime/druntime/src/core/sys/windows/shldisp.d +++ b/runtime/druntime/src/core/sys/windows/shldisp.d @@ -18,10 +18,10 @@ interface IAutoComplete : IUnknown { HRESULT Init(HWND, IUnknown, LPCOLESTR, LPCOLESTR); HRESULT Enable(BOOL); } -alias IAutoComplete LPAUTOCOMPLETE; +alias LPAUTOCOMPLETE = IAutoComplete; interface IAutoComplete2 : IAutoComplete { HRESULT SetOptions(DWORD); HRESULT GetOptions(DWORD*); } -alias IAutoComplete2 LPAUTOCOMPLETE2; +alias LPAUTOCOMPLETE2 = IAutoComplete2; diff --git a/runtime/druntime/src/core/sys/windows/shlobj.d b/runtime/druntime/src/core/sys/windows/shlobj.d index 0e292d4c71d..07c5c903ffe 100644 --- a/runtime/druntime/src/core/sys/windows/shlobj.d +++ b/runtime/druntime/src/core/sys/windows/shlobj.d @@ -53,13 +53,13 @@ enum BFFM_SETOKTEXT = WM_USER + 105; enum BFFM_SETEXPANDED = WM_USER + 106; version (Unicode) { - alias BFFM_SETSTATUSTEXTW BFFM_SETSTATUSTEXT; - alias BFFM_SETSELECTIONW BFFM_SETSELECTION; - alias BFFM_VALIDATEFAILEDW BFFM_VALIDATEFAILED; + alias BFFM_SETSTATUSTEXT = BFFM_SETSTATUSTEXTW; + alias BFFM_SETSELECTION = BFFM_SETSELECTIONW; + alias BFFM_VALIDATEFAILED = BFFM_VALIDATEFAILEDW; } else { - alias BFFM_SETSTATUSTEXTA BFFM_SETSTATUSTEXT; - alias BFFM_SETSELECTIONA BFFM_SETSELECTION; - alias BFFM_VALIDATEFAILEDA BFFM_VALIDATEFAILED; + alias BFFM_SETSTATUSTEXT = BFFM_SETSTATUSTEXTA; + alias BFFM_SETSELECTION = BFFM_SETSELECTIONA; + alias BFFM_VALIDATEFAILED = BFFM_VALIDATEFAILEDA; } enum DVASPECT_SHORTNAME = 2; @@ -112,11 +112,11 @@ enum SHCNF_FLUSH = 0x1000; enum SHCNF_FLUSHNOWAIT = 0x2000; version (Unicode) { - alias SHCNF_PATHW SHCNF_PATH; - alias SHCNF_PRINTERW SHCNF_PRINTER; + alias SHCNF_PATH = SHCNF_PATHW; + alias SHCNF_PRINTER = SHCNF_PRINTERW; } else { - alias SHCNF_PATHA SHCNF_PATH; - alias SHCNF_PRINTERA SHCNF_PRINTER; + alias SHCNF_PATH = SHCNF_PATHA; + alias SHCNF_PRINTER = SHCNF_PRINTERA; } enum SFGAOF : DWORD { @@ -256,15 +256,15 @@ const TCHAR[] CFSTR_INETURLW = "UniformResourceLocatorW"; version (Unicode) { - alias CFSTR_FILENAMEW CFSTR_FILENAME; - alias CFSTR_FILENAMEMAPW CFSTR_FILENAMEMAP; - alias CFSTR_FILEDESCRIPTORW CFSTR_FILEDESCRIPTOR; - alias CFSTR_INETURLW CFSTR_INETURL; + alias CFSTR_FILENAME = CFSTR_FILENAMEW; + alias CFSTR_FILENAMEMAP = CFSTR_FILENAMEMAPW; + alias CFSTR_FILEDESCRIPTOR = CFSTR_FILEDESCRIPTORW; + alias CFSTR_INETURL = CFSTR_INETURLW; } else { - alias CFSTR_FILENAMEA CFSTR_FILENAME; - alias CFSTR_FILENAMEMAPA CFSTR_FILENAMEMAP; - alias CFSTR_FILEDESCRIPTORA CFSTR_FILEDESCRIPTOR; - alias CFSTR_INETURLA CFSTR_INETURL; + alias CFSTR_FILENAME = CFSTR_FILENAMEA; + alias CFSTR_FILENAMEMAP = CFSTR_FILENAMEMAPA; + alias CFSTR_FILEDESCRIPTOR = CFSTR_FILEDESCRIPTORA; + alias CFSTR_INETURL = CFSTR_INETURLA; } const TCHAR[] CFSTR_PRINTERGROUP = "PrinterFriendlyName", @@ -291,13 +291,13 @@ enum GCS_VALIDATEW=6; enum GCS_UNICODE=4; version (Unicode) { - alias GCS_VERBW GCS_VERB; - alias GCS_HELPTEXTW GCS_HELPTEXT; - alias GCS_VALIDATEW GCS_VALIDATE; + alias GCS_VERB = GCS_VERBW; + alias GCS_HELPTEXT = GCS_HELPTEXTW; + alias GCS_VALIDATE = GCS_VALIDATEW; } else { - alias GCS_VERBA GCS_VERB; - alias GCS_HELPTEXTA GCS_HELPTEXT; - alias GCS_VALIDATEA GCS_VALIDATE; + alias GCS_VERB = GCS_VERBA; + alias GCS_HELPTEXT = GCS_HELPTEXTA; + alias GCS_VALIDATE = GCS_VALIDATEA; } const TCHAR[] @@ -386,28 +386,28 @@ enum SVGIO_ALLVIEW=2; enum UINT SV2GV_CURRENTVIEW=-1; enum UINT SV2GV_DEFAULTVIEW=-2; -alias DWORD SHGDNF; +alias SHGDNF = DWORD; struct CIDA { UINT cidl; UINT[1] aoffset; } -alias CIDA* LPIDA; +alias LPIDA = CIDA*; struct SHITEMID { USHORT cb; BYTE[1] abID; } -alias SHITEMID* LPSHITEMID; -alias const(SHITEMID)* LPCSHITEMID; +alias LPSHITEMID = SHITEMID*; +alias LPCSHITEMID = const(SHITEMID)*; struct ITEMIDLIST { SHITEMID mkid; } -alias ITEMIDLIST* LPITEMIDLIST; -alias const(ITEMIDLIST)* LPCITEMIDLIST; +alias LPITEMIDLIST = ITEMIDLIST*; +alias LPCITEMIDLIST = const(ITEMIDLIST)*; -extern (Windows) alias int function(HWND, UINT, LPARAM, LPARAM) BFFCALLBACK; +extern (Windows) alias BFFCALLBACK = int function(HWND, UINT, LPARAM, LPARAM); align (8) { struct BROWSEINFOA { @@ -420,7 +420,7 @@ struct BROWSEINFOA { LPARAM lParam; int iImage; } -alias BROWSEINFOA* PBROWSEINFOA, LPBROWSEINFOA; +alias PBROWSEINFOA = BROWSEINFOA*, LPBROWSEINFOA = BROWSEINFOA*; struct BROWSEINFOW { HWND hwndOwner; @@ -432,7 +432,7 @@ struct BROWSEINFOW { LPARAM lParam; int iImage; } -alias BROWSEINFOW* PBROWSEINFOW, LPBROWSEINFOW; +alias PBROWSEINFOW = BROWSEINFOW*, LPBROWSEINFOW = BROWSEINFOW*; } // align (8) struct CMINVOKECOMMANDINFO { @@ -446,7 +446,7 @@ struct CMINVOKECOMMANDINFO { DWORD dwHotKey; HANDLE hIcon; } -alias CMINVOKECOMMANDINFO* LPCMINVOKECOMMANDINFO; +alias LPCMINVOKECOMMANDINFO = CMINVOKECOMMANDINFO*; struct DROPFILES { DWORD pFiles; @@ -454,7 +454,7 @@ struct DROPFILES { BOOL fNC; BOOL fWide; } -alias DROPFILES* LPDROPFILES; +alias LPDROPFILES = DROPFILES*; enum SHGNO { SHGDN_NORMAL = 0, @@ -483,7 +483,7 @@ align(8) struct STRRET { char[MAX_PATH] cStr; } } -alias STRRET* LPSTRRET; +alias LPSTRRET = STRRET*; enum FD_FLAGS { FD_CLSID = 1, @@ -509,7 +509,7 @@ struct FILEDESCRIPTORA { DWORD nFileSizeLow; CHAR[MAX_PATH] cFileName = 0; } -alias FILEDESCRIPTORA* LPFILEDESCRIPTORA; +alias LPFILEDESCRIPTORA = FILEDESCRIPTORA*; struct FILEDESCRIPTORW { DWORD dwFlags; @@ -524,19 +524,19 @@ struct FILEDESCRIPTORW { DWORD nFileSizeLow; WCHAR[MAX_PATH] cFileName = 0; } -alias FILEDESCRIPTORW* LPFILEDESCRIPTORW; +alias LPFILEDESCRIPTORW = FILEDESCRIPTORW*; struct FILEGROUPDESCRIPTORA { UINT cItems; FILEDESCRIPTORA[1] fgd; } -alias FILEGROUPDESCRIPTORA* LPFILEGROUPDESCRIPTORA; +alias LPFILEGROUPDESCRIPTORA = FILEGROUPDESCRIPTORA*; struct FILEGROUPDESCRIPTORW { UINT cItems; FILEDESCRIPTORW[1] fgd; } -alias FILEGROUPDESCRIPTORW* LPFILEGROUPDESCRIPTORW; +alias LPFILEGROUPDESCRIPTORW = FILEGROUPDESCRIPTORW*; enum SLR_FLAGS { SLR_NO_UI = 1, @@ -555,7 +555,7 @@ enum SLGP_FLAGS { SLGP_RAWPATH=4 } -alias PBYTE LPVIEWSETTINGS; +alias LPVIEWSETTINGS = PBYTE; enum FOLDERFLAGS { FWF_AUTOARRANGE = 1, @@ -584,8 +584,8 @@ struct FOLDERSETTINGS { UINT ViewMode; UINT fFlags; } -alias FOLDERSETTINGS* LPFOLDERSETTINGS; -alias const(FOLDERSETTINGS)* LPCFOLDERSETTINGS; +alias LPFOLDERSETTINGS = FOLDERSETTINGS*; +alias LPCFOLDERSETTINGS = const(FOLDERSETTINGS)*; struct FVSHOWINFO { DWORD cbSize = this.sizeof; @@ -596,13 +596,13 @@ struct FVSHOWINFO { LPUNKNOWN punkRel; OLECHAR[MAX_PATH] strNewFile = 0; } -alias FVSHOWINFO* LPFVSHOWINFO; +alias LPFVSHOWINFO = FVSHOWINFO*; struct NRESARRAY { UINT cItems; NETRESOURCE[1] nr; } -alias NRESARRAY* LPNRESARRAY; +alias LPNRESARRAY = NRESARRAY*; enum { SBSC_HIDE, @@ -635,23 +635,23 @@ static if (_WIN32_IE >= 0x500) { WCHAR[80] wszFriendlyName = 0; WCHAR[2084] wszUrl = 0; } - alias EXTRASEARCH* LPEXTRASEARCH; + alias LPEXTRASEARCH = EXTRASEARCH*; - alias DWORD SHCOLSTATEF; + alias SHCOLSTATEF = DWORD; struct SHCOLUMNID { GUID fmtid; DWORD pid; } - alias SHCOLUMNID* LPSHCOLUMNID; - alias const(SHCOLUMNID)* LPCSHCOLUMNID; + alias LPSHCOLUMNID = SHCOLUMNID*; + alias LPCSHCOLUMNID = const(SHCOLUMNID)*; struct SHELLDETAILS { int fmt; int cxChar; STRRET str; } - alias SHELLDETAILS* LPSHELLDETAILS; + alias LPSHELLDETAILS = SHELLDETAILS*; struct PERSIST_FOLDER_TARGET_INFO { @@ -675,7 +675,7 @@ interface IEnumIDList : IUnknown { HRESULT Reset(); HRESULT Clone(IEnumIDList*); } -alias IEnumIDList LPENUMIDLIST; +alias LPENUMIDLIST = IEnumIDList; interface IObjMgr : IUnknown { HRESULT Append(IUnknown); @@ -687,12 +687,12 @@ interface IContextMenu : IUnknown { HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO); HRESULT GetCommandString(UINT_PTR, UINT, PUINT, LPSTR, UINT); } -alias IContextMenu LPCONTEXTMENU; +alias LPCONTEXTMENU = IContextMenu; interface IContextMenu2 : IContextMenu { HRESULT HandleMenuMsg(UINT, WPARAM, LPARAM); } -alias IContextMenu2 LPCONTEXTMENU2; +alias LPCONTEXTMENU2 = IContextMenu2; static if (_WIN32_IE >= 0x500) { align(8) { @@ -701,8 +701,8 @@ static if (_WIN32_IE >= 0x500) { ULONG dwReserved; WCHAR[MAX_PATH] wszFolder = 0; } - alias SHCOLUMNINIT* LPSHCOLUMNINIT; - alias const(SHCOLUMNINIT)* LPCSHCOLUMNINIT; + alias LPSHCOLUMNINIT = SHCOLUMNINIT*; + alias LPCSHCOLUMNINIT = const(SHCOLUMNINIT)*; struct SHCOLUMNDATA { ULONG dwFlags; @@ -711,8 +711,8 @@ static if (_WIN32_IE >= 0x500) { WCHAR *pwszExt = null; WCHAR[MAX_PATH] wszFile = 0; } - alias SHCOLUMNDATA* LPSHCOLUMNDATA; - alias const(SHCOLUMNDATA)* LPCSHCOLUMNDATA; + alias LPSHCOLUMNDATA = SHCOLUMNDATA*; + alias LPCSHCOLUMNDATA = const(SHCOLUMNDATA)*; } enum MAX_COLUMN_NAME_LEN = 80; @@ -728,8 +728,8 @@ enum MAX_COLUMN_DESC_LEN = 128; WCHAR[MAX_COLUMN_NAME_LEN] wszTitle = 0; WCHAR[MAX_COLUMN_DESC_LEN] wszDescription = 0; } - alias SHCOLUMNINFO* LPSHCOLUMNINFO; - alias const(SHCOLUMNINFO)* LPCSHCOLUMNINFO; + alias LPSHCOLUMNINFO = SHCOLUMNINFO*; + alias LPCSHCOLUMNINFO = const(SHCOLUMNINFO)*; enum SHCOLSTATE { SHCOLSTATE_TYPE_STR = 0x00000001, @@ -759,32 +759,32 @@ interface IQueryInfo : IUnknown { interface IShellExtInit : IUnknown { HRESULT Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY); } -alias IShellExtInit LPSHELLEXTINIT; +alias LPSHELLEXTINIT = IShellExtInit; interface IShellPropSheetExt : IUnknown { HRESULT AddPages(LPFNADDPROPSHEETPAGE, LPARAM); HRESULT ReplacePage(UINT, LPFNADDPROPSHEETPAGE, LPARAM); } -alias IShellPropSheetExt LPSHELLPROPSHEETEXT; +alias LPSHELLPROPSHEETEXT = IShellPropSheetExt; interface IExtractIconA : IUnknown { HRESULT GetIconLocation(UINT, LPSTR, UINT, int*, PUINT); HRESULT Extract(LPCSTR, UINT, HICON*, HICON*, UINT); } -alias IExtractIconA LPEXTRACTICONA; +alias LPEXTRACTICONA = IExtractIconA; interface IExtractIconW : IUnknown { HRESULT GetIconLocation(UINT, LPWSTR, UINT, int*, PUINT); HRESULT Extract(LPCWSTR, UINT, HICON*, HICON*, UINT); } -alias IExtractIconW LPEXTRACTICONW; +alias LPEXTRACTICONW = IExtractIconW; version (Unicode) { - alias IExtractIconW IExtractIcon; - alias LPEXTRACTICONW LPEXTRACTICON; + alias IExtractIcon = IExtractIconW; + alias LPEXTRACTICON = LPEXTRACTICONW; } else { - alias IExtractIconA IExtractIcon; - alias LPEXTRACTICONA LPEXTRACTICON; + alias IExtractIcon = IExtractIconA; + alias LPEXTRACTICON = LPEXTRACTICONA; } interface IShellLinkA : IUnknown { @@ -842,7 +842,7 @@ interface IShellFolder : IUnknown { HRESULT GetDisplayNameOf(LPCITEMIDLIST, DWORD, LPSTRRET); HRESULT SetNameOf(HWND, LPCITEMIDLIST, LPCOLESTR, DWORD, LPITEMIDLIST*); } -alias IShellFolder LPSHELLFOLDER; +alias LPSHELLFOLDER = IShellFolder; static if (_WIN32_IE >= 0x500) { @@ -852,7 +852,7 @@ interface IEnumExtraSearch: IUnknown { HRESULT Reset(); HRESULT Clone(IEnumExtraSearch*); } -alias IEnumExtraSearch LPENUMEXTRASEARCH; +alias LPENUMEXTRASEARCH = IEnumExtraSearch; interface IShellFolder2 : IShellFolder { HRESULT GetDefaultSearchGUID(GUID*); @@ -863,27 +863,27 @@ interface IShellFolder2 : IShellFolder { HRESULT GetDetailsOf(LPCITEMIDLIST, UINT, SHELLDETAILS*); HRESULT MapColumnToSCID(UINT, SHCOLUMNID*); } -alias IShellFolder2 LPSHELLFOLDER2; +alias LPSHELLFOLDER2 = IShellFolder2; } /* _WIN32_IE >= 0x500 */ interface ICopyHook : IUnknown { UINT CopyCallback(HWND, UINT, UINT, LPCSTR, DWORD, LPCSTR, DWORD); } -alias ICopyHook LPCOPYHOOK; +alias LPCOPYHOOK = ICopyHook; interface IFileViewerSite : IUnknown { HRESULT SetPinnedWindow(HWND); HRESULT GetPinnedWindow(HWND*); } -alias IFileViewerSite LPFILEVIEWERSITE; +alias LPFILEVIEWERSITE = IFileViewerSite; interface IFileViewer : IUnknown { HRESULT ShowInitialize(LPFILEVIEWERSITE); HRESULT Show(LPFVSHOWINFO); HRESULT PrintTo(LPSTR, BOOL); } -alias IFileViewer LPFILEVIEWER; +alias LPFILEVIEWER = IFileViewer; interface IFileSystemBindData : IUnknown { HRESULT SetFindData(const(WIN32_FIND_DATAW)*); @@ -894,7 +894,7 @@ interface IPersistFolder : IPersist { HRESULT GetClassID(CLSID*); HRESULT Initialize(LPCITEMIDLIST); } -alias IPersistFolder LPPERSISTFOLDER; +alias LPPERSISTFOLDER = IPersistFolder; static if (_WIN32_IE >= 0x400 || _WIN32_WINNT >= 0x500) { @@ -903,7 +903,7 @@ interface IPersistFolder2 : IPersistFolder { HRESULT Initialize(LPCITEMIDLIST); HRESULT GetCurFolder(LPITEMIDLIST*); } -alias IPersistFolder2 LPPERSISTFOLDER2; +alias LPPERSISTFOLDER2 = IPersistFolder2; }/* _WIN32_IE >= 0x400 || _WIN32_WINNT >= 0x500 */ @@ -916,12 +916,12 @@ interface IPersistFolder3 : IPersistFolder2 { HRESULT InitializeEx(IBindCtx, LPCITEMIDLIST, const(PERSIST_FOLDER_TARGET_INFO)*); HRESULT GetFolderTargetInfo(PERSIST_FOLDER_TARGET_INFO*); } -alias IPersistFolder3 LPPERSISTFOLDER3; +alias LPPERSISTFOLDER3 = IPersistFolder3; } /* _WIN32_IE >= 0x500 */ -alias IShellBrowser LPSHELLBROWSER; -alias IShellView LPSHELLVIEW; +alias LPSHELLBROWSER = IShellBrowser; +alias LPSHELLVIEW = IShellView; interface IShellBrowser : IOleWindow { HRESULT GetWindow(HWND*); @@ -966,9 +966,9 @@ interface ICommDlgBrowser : IUnknown { HRESULT OnStateChange(IShellView, ULONG); HRESULT IncludeObject(IShellView, LPCITEMIDLIST); } -alias ICommDlgBrowser LPCOMMDLGBROWSER; +alias LPCOMMDLGBROWSER = ICommDlgBrowser; -alias GUID SHELLVIEWID; +alias SHELLVIEWID = GUID; struct SV2CVW2_PARAMS { DWORD cbSize = this.sizeof; @@ -979,7 +979,7 @@ struct SV2CVW2_PARAMS { const(SHELLVIEWID)* pvid; HWND hwndView; } -alias SV2CVW2_PARAMS* LPSV2CVW2_PARAMS; +alias LPSV2CVW2_PARAMS = SV2CVW2_PARAMS*; interface IShellView2 : IShellView { HRESULT GetWindow(HWND*); @@ -1014,7 +1014,7 @@ interface IShellExecuteHookW : IUnknown { interface IShellIcon : IUnknown { HRESULT GetIconOf(LPCITEMIDLIST, UINT, PINT); } -alias IShellIcon LPSHELLICON; +alias LPSHELLICON = IShellIcon; struct SHELLFLAGSTATE { short _bf; @@ -1064,7 +1064,7 @@ struct SHELLFLAGSTATE { @property bool fHideIcons()(bool f) { _bf = cast(ushort) ((_bf & ~0xEFFF) | (f << 12)); return f; } @property ubyte fRestFlags()(ubyte f) { _bf = cast(ushort) ((_bf & ~0x1FFF) | (f << 13)); return cast(ubyte) (f & 7); } } -alias SHELLFLAGSTATE* LPSHELLFLAGSTATE; +alias LPSHELLFLAGSTATE = SHELLFLAGSTATE*; enum SSF_SHOWALLOBJECTS = 0x1; enum SSF_SHOWEXTENSIONS = 0x2; @@ -1172,7 +1172,7 @@ static if (_WIN32_WINNT >= 0x500) { return cast(ushort) (f & 0x1FFF); } } - alias SHELLSTATE* LPSHELLSTATE; + alias LPSHELLSTATE = SHELLSTATE*; } static if (_WIN32_IE >= 0x500) { @@ -1183,7 +1183,7 @@ static if (_WIN32_IE >= 0x500) { HBITMAP hbmpDragImage; COLORREF crColorKey; } - alias SHDRAGIMAGE* LPSHDRAGIMAGE; + alias LPSHDRAGIMAGE = SHDRAGIMAGE*; } interface IDragSourceHelper : IUnknown { @@ -1249,7 +1249,7 @@ static if (_WIN32_WINNT >= 0x501) { DWORD dwDescriptionId; CLSID clsid; } - alias SHDESCRIPTIONID* LPSHDESCRIPTIONID; + alias LPSHDESCRIPTIONID = SHDESCRIPTIONID*; BOOL PathResolve(LPWSTR, LPCWSTR*, UINT); HRESULT SHGetFolderPathAndSubDirA(HWND, int, HANDLE, DWORD, LPCSTR, LPSTR); @@ -1280,52 +1280,52 @@ static if (_WIN32_WINNT >= 0x500) { } version (Unicode) { - alias IShellExecuteHookW IShellExecuteHook; - alias IShellLinkW IShellLink; - alias BROWSEINFOW BROWSEINFO; - alias SHBrowseForFolderW SHBrowseForFolder; - alias SHGetDataFromIDListW SHGetDataFromIDList; - alias SHGetPathFromIDListW SHGetPathFromIDList; + alias IShellExecuteHook = IShellExecuteHookW; + alias IShellLink = IShellLinkW; + alias BROWSEINFO = BROWSEINFOW; + alias SHBrowseForFolder = SHBrowseForFolderW; + alias SHGetDataFromIDList = SHGetDataFromIDListW; + alias SHGetPathFromIDList = SHGetPathFromIDListW; static if (_WIN32_IE >= 0x400) { - alias SHGetSpecialFolderPathW SHGetSpecialFolderPath; + alias SHGetSpecialFolderPath = SHGetSpecialFolderPathW; } - alias SHGetFolderPathW SHGetFolderPath; + alias SHGetFolderPath = SHGetFolderPathW; static if (_WIN32_WINNT >= 0x500) { - alias SHGetIconOverlayIndexW SHGetIconOverlayIndex; - alias SHCreateDirectoryExW SHCreateDirectoryEx; + alias SHGetIconOverlayIndex = SHGetIconOverlayIndexW; + alias SHCreateDirectoryEx = SHCreateDirectoryExW; } static if (_WIN32_WINNT >= 0x501) { - alias SHGetFolderPathAndSubDirW SHGetFolderPathAndSubDir; + alias SHGetFolderPathAndSubDir = SHGetFolderPathAndSubDirW; } - alias FILEDESCRIPTORW FILEDESCRIPTOR; - alias LPFILEDESCRIPTORW LPFILEDESCRIPTOR; - alias FILEGROUPDESCRIPTORW FILEGROUPDESCRIPTOR; - alias LPFILEGROUPDESCRIPTORW LPFILEGROUPDESCRIPTOR; + alias FILEDESCRIPTOR = FILEDESCRIPTORW; + alias LPFILEDESCRIPTOR = LPFILEDESCRIPTORW; + alias FILEGROUPDESCRIPTOR = FILEGROUPDESCRIPTORW; + alias LPFILEGROUPDESCRIPTOR = LPFILEGROUPDESCRIPTORW; } else { - alias IShellExecuteHookA IShellExecuteHook; - alias IShellLinkA IShellLink; - alias BROWSEINFOA BROWSEINFO; - alias SHBrowseForFolderA SHBrowseForFolder; - alias SHGetDataFromIDListA SHGetDataFromIDList; - alias SHGetPathFromIDListA SHGetPathFromIDList; + alias IShellExecuteHook = IShellExecuteHookA; + alias IShellLink = IShellLinkA; + alias BROWSEINFO = BROWSEINFOA; + alias SHBrowseForFolder = SHBrowseForFolderA; + alias SHGetDataFromIDList = SHGetDataFromIDListA; + alias SHGetPathFromIDList = SHGetPathFromIDListA; static if (_WIN32_IE >= 0x400) { - alias SHGetSpecialFolderPathA SHGetSpecialFolderPath; + alias SHGetSpecialFolderPath = SHGetSpecialFolderPathA; } - alias SHGetFolderPathA SHGetFolderPath; + alias SHGetFolderPath = SHGetFolderPathA; static if (_WIN32_WINNT >= 0x500) { - alias SHGetIconOverlayIndexA SHGetIconOverlayIndex; - alias SHCreateDirectoryExA SHCreateDirectoryEx; + alias SHGetIconOverlayIndex = SHGetIconOverlayIndexA; + alias SHCreateDirectoryEx = SHCreateDirectoryExA; } static if (_WIN32_WINNT >= 0x501) { - alias SHGetFolderPathAndSubDirA SHGetFolderPathAndSubDir; + alias SHGetFolderPathAndSubDir = SHGetFolderPathAndSubDirA; } - alias FILEDESCRIPTORA FILEDESCRIPTOR; - alias LPFILEDESCRIPTORA LPFILEDESCRIPTOR; - alias FILEGROUPDESCRIPTORA FILEGROUPDESCRIPTOR; - alias LPFILEGROUPDESCRIPTORA LPFILEGROUPDESCRIPTOR; + alias FILEDESCRIPTOR = FILEDESCRIPTORA; + alias LPFILEDESCRIPTOR = LPFILEDESCRIPTORA; + alias FILEGROUPDESCRIPTOR = FILEGROUPDESCRIPTORA; + alias LPFILEGROUPDESCRIPTOR = LPFILEGROUPDESCRIPTORA; } -alias BROWSEINFO* PBROWSEINFO, LPBROWSEINFO; +alias PBROWSEINFO = BROWSEINFO*, LPBROWSEINFO = BROWSEINFO*; static if (_WIN32_WINNT >= 0x501) { interface IFolderView : IUnknown { @@ -1344,5 +1344,5 @@ static if (_WIN32_WINNT >= 0x501) { HRESULT SelectItem(int, DWORD); HRESULT SetCurrentViewMode(UINT); } - alias IFolderView LPFOLDERVIEW; + alias LPFOLDERVIEW = IFolderView; } diff --git a/runtime/druntime/src/core/sys/windows/shlwapi.d b/runtime/druntime/src/core/sys/windows/shlwapi.d index 3562003a41f..d44d6a80f80 100644 --- a/runtime/druntime/src/core/sys/windows/shlwapi.d +++ b/runtime/druntime/src/core/sys/windows/shlwapi.d @@ -91,7 +91,7 @@ enum ASSOCDATA ASSOCDATA_QUERYCLASSSTORE } -alias DWORD ASSOCF; +alias ASSOCF = DWORD; enum SHREGDEL_FLAGS { @@ -121,11 +121,11 @@ enum URLIS } alias HUSKEY = HANDLE; -alias HUSKEY* PHUSKEY; +alias PHUSKEY = HUSKEY*; extern (Windows) { - alias HRESULT function (DLLVERSIONINFO *) DLLGETVERSIONPROC; + alias DLLGETVERSIONPROC = HRESULT function (DLLVERSIONINFO *); } @@ -458,275 +458,275 @@ IStream SHOpenRegStreamA(HKEY, LPCSTR, LPCSTR, DWORD); IStream SHOpenRegStreamW(HKEY, LPCWSTR, LPCWSTR, DWORD); version (Unicode) { -alias ChrCmpIW ChrCmpI; -alias IntlStrEqNW IntlStrEqN; -alias IntlStrEqNIW IntlStrEqNI; -alias IntlStrEqWorkerW IntlStrEqWorker; -alias SHStrDupW SHStrDup; -alias StrCatW StrCat; -alias StrCatBuffW StrCatBuff; -alias StrChrW StrChr; -alias StrChrIW StrChrI; -alias StrCmpW StrCmp; -alias StrCmpIW StrCmpI; -alias StrCmpNIW StrCmpNI; -alias StrCmpNW StrCmpN; -alias StrCpyNW StrCpyN; -alias StrCpyW StrCpy; -alias StrCSpnIW StrCSpnI; -alias StrCSpnW StrCSpn; -alias StrDupW StrDup; -alias StrFormatByteSizeW StrFormatByteSize; -alias StrFormatKBSizeW StrFormatKBSize; -alias StrFromTimeIntervalW StrFromTimeInterval; -alias StrIsIntlEqualW StrIsIntlEqual; -alias StrNCatW StrNCat; -alias StrPBrkW StrPBrk; -alias StrRChrW StrRChr; -alias StrRChrIW StrRChrI; -alias StrRetToBufW StrRetToBuf; -alias StrRetToStrW StrRetToStr; -alias StrRStrIW StrRStrI; -alias StrSpnW StrSpn; -alias StrStrIW StrStrI; -alias StrStrW StrStr; -alias StrToIntW StrToInt; -alias StrToIntExW StrToIntEx; -alias StrTrimW StrTrim; -alias PathAddBackslashW PathAddBackslash; -alias PathAddExtensionW PathAddExtension; -alias PathAppendW PathAppend; -alias PathBuildRootW PathBuildRoot; -alias PathCanonicalizeW PathCanonicalize; -alias PathCombineW PathCombine; -alias PathCommonPrefixW PathCommonPrefix; -alias PathCompactPathW PathCompactPath; -alias PathCompactPathExW PathCompactPathEx; -alias PathCreateFromUrlW PathCreateFromUrl; -alias PathFileExistsW PathFileExists; -alias PathFindExtensionW PathFindExtension; -alias PathFindFileNameW PathFindFileName; -alias PathFindNextComponentW PathFindNextComponent; -alias PathFindOnPathW PathFindOnPath; -alias PathFindSuffixArrayW PathFindSuffixArray; -alias PathGetArgsW PathGetArgs; -alias PathGetCharTypeW PathGetCharType; -alias PathGetDriveNumberW PathGetDriveNumber; -alias PathIsContentTypeW PathIsContentType; -alias PathIsDirectoryEmptyW PathIsDirectoryEmpty; -alias PathIsDirectoryW PathIsDirectory; -alias PathIsFileSpecW PathIsFileSpec; -alias PathIsLFNFileSpecW PathIsLFNFileSpec; -alias PathIsNetworkPathW PathIsNetworkPath; -alias PathIsPrefixW PathIsPrefix; -alias PathIsRelativeW PathIsRelative; -alias PathIsRootW PathIsRoot; -alias PathIsSameRootW PathIsSameRoot; -alias PathIsSystemFolderW PathIsSystemFolder; -alias PathIsUNCServerShareW PathIsUNCServerShare; -alias PathIsUNCServerW PathIsUNCServer; -alias PathIsUNCW PathIsUNC; -alias PathIsURLW PathIsURL; -alias PathMakePrettyW PathMakePretty; -alias PathMakeSystemFolderW PathMakeSystemFolder; -alias PathMatchSpecW PathMatchSpec; -alias PathParseIconLocationW PathParseIconLocation; -alias PathQuoteSpacesW PathQuoteSpaces; -alias PathRelativePathToW PathRelativePathTo; -alias PathRemoveArgsW PathRemoveArgs; -alias PathRemoveBackslashW PathRemoveBackslash; -alias PathRemoveBlanksW PathRemoveBlanks; -alias PathRemoveExtensionW PathRemoveExtension; -alias PathRemoveFileSpecW PathRemoveFileSpec; -alias PathRenameExtensionW PathRenameExtension; -alias PathSearchAndQualifyW PathSearchAndQualify; -alias PathSetDlgItemPathW PathSetDlgItemPath; -alias PathSkipRootW PathSkipRoot; -alias PathStripPathW PathStripPath; -alias PathStripToRootW PathStripToRoot; -alias PathUndecorateW PathUndecorate; -alias PathUnExpandEnvStringsW PathUnExpandEnvStrings; -alias PathUnmakeSystemFolderW PathUnmakeSystemFolder; -alias PathUnquoteSpacesW PathUnquoteSpaces; -alias SHCreateStreamOnFileW SHCreateStreamOnFile; -alias SHOpenRegStreamW SHOpenRegStream; -alias SHOpenRegStream2W SHOpenRegStream2; -alias SHCopyKeyW SHCopyKey; -alias SHDeleteEmptyKeyW SHDeleteEmptyKey; -alias SHDeleteKeyW SHDeleteKey; -alias SHEnumKeyExW SHEnumKeyEx; -alias SHQueryInfoKeyW SHQueryInfoKey; -alias SHQueryValueExW SHQueryValueEx; -alias SHEnumValueW SHEnumValue; -alias SHGetValueW SHGetValue; -alias SHSetValueW SHSetValue; -alias SHDeleteValueW SHDeleteValue; -alias AssocQueryKeyW AssocQueryKey; -alias AssocQueryStringByKeyW AssocQueryStringByKey; -alias AssocQueryStringW AssocQueryString; -alias UrlApplySchemeW UrlApplyScheme; -alias UrlCanonicalizeW UrlCanonicalize; -alias UrlCombineW UrlCombine; -alias UrlCompareW UrlCompare; -alias UrlCreateFromPathW UrlCreateFromPath; -alias UrlEscapeW UrlEscape; -alias UrlGetLocationW UrlGetLocation; -alias UrlGetPartW UrlGetPart; -alias UrlHashW UrlHash; -alias UrlIsW UrlIs; -alias UrlIsFileUrlW UrlIsFileUrl; -alias UrlIsNoHistoryW UrlIsNoHistory; -alias UrlIsOpaqueW UrlIsOpaque; -alias UrlUnescapeW UrlUnescape; -alias UrlUnescapeInPlaceW UrlUnescapeInPlace; -alias SHRegCreateUSKeyW SHRegCreateUSKey; -alias SHRegDeleteEmptyUSKeyW SHRegDeleteEmptyUSKey; -alias SHRegDeleteUSValueW SHRegDeleteUSValue; -alias SHRegEnumUSKeyW SHRegEnumUSKey; -alias SHRegEnumUSValueW SHRegEnumUSValue; -alias SHRegGetBoolUSValueW SHRegGetBoolUSValue; -alias SHRegGetPathW SHRegGetPath; -alias SHRegGetUSValueW SHRegGetUSValue; -alias SHRegOpenUSKeyW SHRegOpenUSKey; -alias SHRegQueryInfoUSKeyW SHRegQueryInfoUSKey; -alias SHRegQueryUSValueW SHRegQueryUSValue; -alias SHRegSetPathW SHRegSetPath; -alias SHRegSetUSValueW SHRegSetUSValue; -alias SHRegWriteUSValueW SHRegWriteUSValue; +alias ChrCmpI = ChrCmpIW; +alias IntlStrEqN = IntlStrEqNW; +alias IntlStrEqNI = IntlStrEqNIW; +alias IntlStrEqWorker = IntlStrEqWorkerW; +alias SHStrDup = SHStrDupW; +alias StrCat = StrCatW; +alias StrCatBuff = StrCatBuffW; +alias StrChr = StrChrW; +alias StrChrI = StrChrIW; +alias StrCmp = StrCmpW; +alias StrCmpI = StrCmpIW; +alias StrCmpNI = StrCmpNIW; +alias StrCmpN = StrCmpNW; +alias StrCpyN = StrCpyNW; +alias StrCpy = StrCpyW; +alias StrCSpnI = StrCSpnIW; +alias StrCSpn = StrCSpnW; +alias StrDup = StrDupW; +alias StrFormatByteSize = StrFormatByteSizeW; +alias StrFormatKBSize = StrFormatKBSizeW; +alias StrFromTimeInterval = StrFromTimeIntervalW; +alias StrIsIntlEqual = StrIsIntlEqualW; +alias StrNCat = StrNCatW; +alias StrPBrk = StrPBrkW; +alias StrRChr = StrRChrW; +alias StrRChrI = StrRChrIW; +alias StrRetToBuf = StrRetToBufW; +alias StrRetToStr = StrRetToStrW; +alias StrRStrI = StrRStrIW; +alias StrSpn = StrSpnW; +alias StrStrI = StrStrIW; +alias StrStr = StrStrW; +alias StrToInt = StrToIntW; +alias StrToIntEx = StrToIntExW; +alias StrTrim = StrTrimW; +alias PathAddBackslash = PathAddBackslashW; +alias PathAddExtension = PathAddExtensionW; +alias PathAppend = PathAppendW; +alias PathBuildRoot = PathBuildRootW; +alias PathCanonicalize = PathCanonicalizeW; +alias PathCombine = PathCombineW; +alias PathCommonPrefix = PathCommonPrefixW; +alias PathCompactPath = PathCompactPathW; +alias PathCompactPathEx = PathCompactPathExW; +alias PathCreateFromUrl = PathCreateFromUrlW; +alias PathFileExists = PathFileExistsW; +alias PathFindExtension = PathFindExtensionW; +alias PathFindFileName = PathFindFileNameW; +alias PathFindNextComponent = PathFindNextComponentW; +alias PathFindOnPath = PathFindOnPathW; +alias PathFindSuffixArray = PathFindSuffixArrayW; +alias PathGetArgs = PathGetArgsW; +alias PathGetCharType = PathGetCharTypeW; +alias PathGetDriveNumber = PathGetDriveNumberW; +alias PathIsContentType = PathIsContentTypeW; +alias PathIsDirectoryEmpty = PathIsDirectoryEmptyW; +alias PathIsDirectory = PathIsDirectoryW; +alias PathIsFileSpec = PathIsFileSpecW; +alias PathIsLFNFileSpec = PathIsLFNFileSpecW; +alias PathIsNetworkPath = PathIsNetworkPathW; +alias PathIsPrefix = PathIsPrefixW; +alias PathIsRelative = PathIsRelativeW; +alias PathIsRoot = PathIsRootW; +alias PathIsSameRoot = PathIsSameRootW; +alias PathIsSystemFolder = PathIsSystemFolderW; +alias PathIsUNCServerShare = PathIsUNCServerShareW; +alias PathIsUNCServer = PathIsUNCServerW; +alias PathIsUNC = PathIsUNCW; +alias PathIsURL = PathIsURLW; +alias PathMakePretty = PathMakePrettyW; +alias PathMakeSystemFolder = PathMakeSystemFolderW; +alias PathMatchSpec = PathMatchSpecW; +alias PathParseIconLocation = PathParseIconLocationW; +alias PathQuoteSpaces = PathQuoteSpacesW; +alias PathRelativePathTo = PathRelativePathToW; +alias PathRemoveArgs = PathRemoveArgsW; +alias PathRemoveBackslash = PathRemoveBackslashW; +alias PathRemoveBlanks = PathRemoveBlanksW; +alias PathRemoveExtension = PathRemoveExtensionW; +alias PathRemoveFileSpec = PathRemoveFileSpecW; +alias PathRenameExtension = PathRenameExtensionW; +alias PathSearchAndQualify = PathSearchAndQualifyW; +alias PathSetDlgItemPath = PathSetDlgItemPathW; +alias PathSkipRoot = PathSkipRootW; +alias PathStripPath = PathStripPathW; +alias PathStripToRoot = PathStripToRootW; +alias PathUndecorate = PathUndecorateW; +alias PathUnExpandEnvStrings = PathUnExpandEnvStringsW; +alias PathUnmakeSystemFolder = PathUnmakeSystemFolderW; +alias PathUnquoteSpaces = PathUnquoteSpacesW; +alias SHCreateStreamOnFile = SHCreateStreamOnFileW; +alias SHOpenRegStream = SHOpenRegStreamW; +alias SHOpenRegStream2 = SHOpenRegStream2W; +alias SHCopyKey = SHCopyKeyW; +alias SHDeleteEmptyKey = SHDeleteEmptyKeyW; +alias SHDeleteKey = SHDeleteKeyW; +alias SHEnumKeyEx = SHEnumKeyExW; +alias SHQueryInfoKey = SHQueryInfoKeyW; +alias SHQueryValueEx = SHQueryValueExW; +alias SHEnumValue = SHEnumValueW; +alias SHGetValue = SHGetValueW; +alias SHSetValue = SHSetValueW; +alias SHDeleteValue = SHDeleteValueW; +alias AssocQueryKey = AssocQueryKeyW; +alias AssocQueryStringByKey = AssocQueryStringByKeyW; +alias AssocQueryString = AssocQueryStringW; +alias UrlApplyScheme = UrlApplySchemeW; +alias UrlCanonicalize = UrlCanonicalizeW; +alias UrlCombine = UrlCombineW; +alias UrlCompare = UrlCompareW; +alias UrlCreateFromPath = UrlCreateFromPathW; +alias UrlEscape = UrlEscapeW; +alias UrlGetLocation = UrlGetLocationW; +alias UrlGetPart = UrlGetPartW; +alias UrlHash = UrlHashW; +alias UrlIs = UrlIsW; +alias UrlIsFileUrl = UrlIsFileUrlW; +alias UrlIsNoHistory = UrlIsNoHistoryW; +alias UrlIsOpaque = UrlIsOpaqueW; +alias UrlUnescape = UrlUnescapeW; +alias UrlUnescapeInPlace = UrlUnescapeInPlaceW; +alias SHRegCreateUSKey = SHRegCreateUSKeyW; +alias SHRegDeleteEmptyUSKey = SHRegDeleteEmptyUSKeyW; +alias SHRegDeleteUSValue = SHRegDeleteUSValueW; +alias SHRegEnumUSKey = SHRegEnumUSKeyW; +alias SHRegEnumUSValue = SHRegEnumUSValueW; +alias SHRegGetBoolUSValue = SHRegGetBoolUSValueW; +alias SHRegGetPath = SHRegGetPathW; +alias SHRegGetUSValue = SHRegGetUSValueW; +alias SHRegOpenUSKey = SHRegOpenUSKeyW; +alias SHRegQueryInfoUSKey = SHRegQueryInfoUSKeyW; +alias SHRegQueryUSValue = SHRegQueryUSValueW; +alias SHRegSetPath = SHRegSetPathW; +alias SHRegSetUSValue = SHRegSetUSValueW; +alias SHRegWriteUSValue = SHRegWriteUSValueW; //alias wnsprintfW wnsprintf; //alias wvnsprintfW wvnsprintf; } else { -alias ChrCmpIA ChrCmpI; -alias IntlStrEqNA IntlStrEqN; -alias IntlStrEqNIA IntlStrEqNI; -alias IntlStrEqWorkerA IntlStrEqWorker; -alias SHStrDupA SHStrDup; -alias StrCatBuffA StrCatBuff; -alias StrChrA StrChr; -alias StrChrIA StrChrI; -alias StrCmpNIA StrCmpNI; -alias StrCmpNA StrCmpN; -alias StrCSpnIA StrCSpnI; -alias StrCSpnA StrCSpn; -alias StrDupA StrDup; -alias StrFormatByteSizeA StrFormatByteSize; -alias StrFormatKBSizeA StrFormatKBSize; -alias StrFromTimeIntervalA StrFromTimeInterval; -alias StrIsIntlEqualA StrIsIntlEqual; -alias StrNCatA StrNCat; -alias StrPBrkA StrPBrk; -alias StrRChrA StrRChr; -alias StrRChrIA StrRChrI; -alias StrRetToBufA StrRetToBuf; -alias StrRetToStrA StrRetToStr; -alias StrRStrIA StrRStrI; -alias StrSpnA StrSpn; -alias StrStrIA StrStrI; -alias StrStrA StrStr; -alias StrToIntA StrToInt; -alias StrToIntExA StrToIntEx; -alias StrTrimA StrTrim; -alias PathAddBackslashA PathAddBackslash; -alias PathAddExtensionA PathAddExtension; -alias PathAppendA PathAppend; -alias PathBuildRootA PathBuildRoot; -alias PathCanonicalizeA PathCanonicalize; -alias PathCombineA PathCombine; -alias PathCommonPrefixA PathCommonPrefix; -alias PathCompactPathA PathCompactPath; -alias PathCompactPathExA PathCompactPathEx; -alias PathCreateFromUrlA PathCreateFromUrl; -alias PathFileExistsA PathFileExists; -alias PathFindExtensionA PathFindExtension; -alias PathFindFileNameA PathFindFileName; -alias PathFindNextComponentA PathFindNextComponent; -alias PathFindOnPathA PathFindOnPath; -alias PathFindSuffixArrayA PathFindSuffixArray; -alias PathGetArgsA PathGetArgs; -alias PathGetCharTypeA PathGetCharType; -alias PathGetDriveNumberA PathGetDriveNumber; -alias PathIsContentTypeA PathIsContentType; -alias PathIsDirectoryEmptyA PathIsDirectoryEmpty; -alias PathIsDirectoryA PathIsDirectory; -alias PathIsFileSpecA PathIsFileSpec; -alias PathIsLFNFileSpecA PathIsLFNFileSpec; -alias PathIsNetworkPathA PathIsNetworkPath; -alias PathIsPrefixA PathIsPrefix; -alias PathIsRelativeA PathIsRelative; -alias PathIsRootA PathIsRoot; -alias PathIsSameRootA PathIsSameRoot; -alias PathIsSystemFolderA PathIsSystemFolder; -alias PathIsUNCServerShareA PathIsUNCServerShare; -alias PathIsUNCServerA PathIsUNCServer; -alias PathIsUNCA PathIsUNC; -alias PathIsURLA PathIsURL; -alias PathMakePrettyA PathMakePretty; -alias PathMakeSystemFolderA PathMakeSystemFolder; -alias PathMatchSpecA PathMatchSpec; -alias PathParseIconLocationA PathParseIconLocation; -alias PathQuoteSpacesA PathQuoteSpaces; -alias PathRelativePathToA PathRelativePathTo; -alias PathRemoveArgsA PathRemoveArgs; -alias PathRemoveBackslashA PathRemoveBackslash; -alias PathRemoveBlanksA PathRemoveBlanks; -alias PathRemoveExtensionA PathRemoveExtension; -alias PathRemoveFileSpecA PathRemoveFileSpec; -alias PathRenameExtensionA PathRenameExtension; -alias PathSearchAndQualifyA PathSearchAndQualify; -alias PathSetDlgItemPathA PathSetDlgItemPath; -alias PathSkipRootA PathSkipRoot; -alias PathStripPathA PathStripPath; -alias PathStripToRootA PathStripToRoot; -alias PathUndecorateA PathUndecorate; -alias PathUnExpandEnvStringsA PathUnExpandEnvStrings; -alias PathUnmakeSystemFolderA PathUnmakeSystemFolder; -alias PathUnquoteSpacesA PathUnquoteSpaces; -alias SHCreateStreamOnFileA SHCreateStreamOnFile; -alias SHOpenRegStreamA SHOpenRegStream; -alias SHOpenRegStream2A SHOpenRegStream2; -alias SHCopyKeyA SHCopyKey; -alias SHDeleteEmptyKeyA SHDeleteEmptyKey; -alias SHDeleteKeyA SHDeleteKey; -alias SHEnumKeyExA SHEnumKeyEx; -alias SHQueryInfoKeyA SHQueryInfoKey; -alias SHQueryValueExA SHQueryValueEx; -alias SHEnumValueA SHEnumValue; -alias SHGetValueA SHGetValue; -alias SHSetValueA SHSetValue; -alias SHDeleteValueA SHDeleteValue; -alias AssocQueryKeyA AssocQueryKey; -alias AssocQueryStringByKeyA AssocQueryStringByKey; -alias AssocQueryStringA AssocQueryString; -alias UrlApplySchemeA UrlApplyScheme; -alias UrlCanonicalizeA UrlCanonicalize; -alias UrlCombineA UrlCombine; -alias UrlCompareA UrlCompare; -alias UrlCreateFromPathA UrlCreateFromPath; -alias UrlEscapeA UrlEscape; -alias UrlGetLocationA UrlGetLocation; -alias UrlGetPartA UrlGetPart; -alias UrlHashA UrlHash; -alias UrlIsA UrlIs; -alias UrlIsNoHistoryA UrlIsNoHistory; -alias UrlIsOpaqueA UrlIsOpaque; -alias UrlUnescapeA UrlUnescape; -alias UrlUnescapeInPlaceA UrlUnescapeInPlace; -alias SHRegCreateUSKeyA SHRegCreateUSKey; -alias SHRegDeleteEmptyUSKeyA SHRegDeleteEmptyUSKey; -alias SHRegDeleteUSValueA SHRegDeleteUSValue; -alias SHRegEnumUSKeyA SHRegEnumUSKey; -alias SHRegEnumUSValueA SHRegEnumUSValue; -alias SHRegGetBoolUSValueA SHRegGetBoolUSValue; -alias SHRegGetPathA SHRegGetPath; -alias SHRegGetUSValueA SHRegGetUSValue; -alias SHRegOpenUSKeyA SHRegOpenUSKey; -alias SHRegQueryInfoUSKeyA SHRegQueryInfoUSKey; -alias SHRegQueryUSValueA SHRegQueryUSValue; -alias SHRegSetPathA SHRegSetPath; -alias SHRegSetUSValueA SHRegSetUSValue; -alias SHRegWriteUSValueA SHRegWriteUSValue; +alias ChrCmpI = ChrCmpIA; +alias IntlStrEqN = IntlStrEqNA; +alias IntlStrEqNI = IntlStrEqNIA; +alias IntlStrEqWorker = IntlStrEqWorkerA; +alias SHStrDup = SHStrDupA; +alias StrCatBuff = StrCatBuffA; +alias StrChr = StrChrA; +alias StrChrI = StrChrIA; +alias StrCmpNI = StrCmpNIA; +alias StrCmpN = StrCmpNA; +alias StrCSpnI = StrCSpnIA; +alias StrCSpn = StrCSpnA; +alias StrDup = StrDupA; +alias StrFormatByteSize = StrFormatByteSizeA; +alias StrFormatKBSize = StrFormatKBSizeA; +alias StrFromTimeInterval = StrFromTimeIntervalA; +alias StrIsIntlEqual = StrIsIntlEqualA; +alias StrNCat = StrNCatA; +alias StrPBrk = StrPBrkA; +alias StrRChr = StrRChrA; +alias StrRChrI = StrRChrIA; +alias StrRetToBuf = StrRetToBufA; +alias StrRetToStr = StrRetToStrA; +alias StrRStrI = StrRStrIA; +alias StrSpn = StrSpnA; +alias StrStrI = StrStrIA; +alias StrStr = StrStrA; +alias StrToInt = StrToIntA; +alias StrToIntEx = StrToIntExA; +alias StrTrim = StrTrimA; +alias PathAddBackslash = PathAddBackslashA; +alias PathAddExtension = PathAddExtensionA; +alias PathAppend = PathAppendA; +alias PathBuildRoot = PathBuildRootA; +alias PathCanonicalize = PathCanonicalizeA; +alias PathCombine = PathCombineA; +alias PathCommonPrefix = PathCommonPrefixA; +alias PathCompactPath = PathCompactPathA; +alias PathCompactPathEx = PathCompactPathExA; +alias PathCreateFromUrl = PathCreateFromUrlA; +alias PathFileExists = PathFileExistsA; +alias PathFindExtension = PathFindExtensionA; +alias PathFindFileName = PathFindFileNameA; +alias PathFindNextComponent = PathFindNextComponentA; +alias PathFindOnPath = PathFindOnPathA; +alias PathFindSuffixArray = PathFindSuffixArrayA; +alias PathGetArgs = PathGetArgsA; +alias PathGetCharType = PathGetCharTypeA; +alias PathGetDriveNumber = PathGetDriveNumberA; +alias PathIsContentType = PathIsContentTypeA; +alias PathIsDirectoryEmpty = PathIsDirectoryEmptyA; +alias PathIsDirectory = PathIsDirectoryA; +alias PathIsFileSpec = PathIsFileSpecA; +alias PathIsLFNFileSpec = PathIsLFNFileSpecA; +alias PathIsNetworkPath = PathIsNetworkPathA; +alias PathIsPrefix = PathIsPrefixA; +alias PathIsRelative = PathIsRelativeA; +alias PathIsRoot = PathIsRootA; +alias PathIsSameRoot = PathIsSameRootA; +alias PathIsSystemFolder = PathIsSystemFolderA; +alias PathIsUNCServerShare = PathIsUNCServerShareA; +alias PathIsUNCServer = PathIsUNCServerA; +alias PathIsUNC = PathIsUNCA; +alias PathIsURL = PathIsURLA; +alias PathMakePretty = PathMakePrettyA; +alias PathMakeSystemFolder = PathMakeSystemFolderA; +alias PathMatchSpec = PathMatchSpecA; +alias PathParseIconLocation = PathParseIconLocationA; +alias PathQuoteSpaces = PathQuoteSpacesA; +alias PathRelativePathTo = PathRelativePathToA; +alias PathRemoveArgs = PathRemoveArgsA; +alias PathRemoveBackslash = PathRemoveBackslashA; +alias PathRemoveBlanks = PathRemoveBlanksA; +alias PathRemoveExtension = PathRemoveExtensionA; +alias PathRemoveFileSpec = PathRemoveFileSpecA; +alias PathRenameExtension = PathRenameExtensionA; +alias PathSearchAndQualify = PathSearchAndQualifyA; +alias PathSetDlgItemPath = PathSetDlgItemPathA; +alias PathSkipRoot = PathSkipRootA; +alias PathStripPath = PathStripPathA; +alias PathStripToRoot = PathStripToRootA; +alias PathUndecorate = PathUndecorateA; +alias PathUnExpandEnvStrings = PathUnExpandEnvStringsA; +alias PathUnmakeSystemFolder = PathUnmakeSystemFolderA; +alias PathUnquoteSpaces = PathUnquoteSpacesA; +alias SHCreateStreamOnFile = SHCreateStreamOnFileA; +alias SHOpenRegStream = SHOpenRegStreamA; +alias SHOpenRegStream2 = SHOpenRegStream2A; +alias SHCopyKey = SHCopyKeyA; +alias SHDeleteEmptyKey = SHDeleteEmptyKeyA; +alias SHDeleteKey = SHDeleteKeyA; +alias SHEnumKeyEx = SHEnumKeyExA; +alias SHQueryInfoKey = SHQueryInfoKeyA; +alias SHQueryValueEx = SHQueryValueExA; +alias SHEnumValue = SHEnumValueA; +alias SHGetValue = SHGetValueA; +alias SHSetValue = SHSetValueA; +alias SHDeleteValue = SHDeleteValueA; +alias AssocQueryKey = AssocQueryKeyA; +alias AssocQueryStringByKey = AssocQueryStringByKeyA; +alias AssocQueryString = AssocQueryStringA; +alias UrlApplyScheme = UrlApplySchemeA; +alias UrlCanonicalize = UrlCanonicalizeA; +alias UrlCombine = UrlCombineA; +alias UrlCompare = UrlCompareA; +alias UrlCreateFromPath = UrlCreateFromPathA; +alias UrlEscape = UrlEscapeA; +alias UrlGetLocation = UrlGetLocationA; +alias UrlGetPart = UrlGetPartA; +alias UrlHash = UrlHashA; +alias UrlIs = UrlIsA; +alias UrlIsNoHistory = UrlIsNoHistoryA; +alias UrlIsOpaque = UrlIsOpaqueA; +alias UrlUnescape = UrlUnescapeA; +alias UrlUnescapeInPlace = UrlUnescapeInPlaceA; +alias SHRegCreateUSKey = SHRegCreateUSKeyA; +alias SHRegDeleteEmptyUSKey = SHRegDeleteEmptyUSKeyA; +alias SHRegDeleteUSValue = SHRegDeleteUSValueA; +alias SHRegEnumUSKey = SHRegEnumUSKeyA; +alias SHRegEnumUSValue = SHRegEnumUSValueA; +alias SHRegGetBoolUSValue = SHRegGetBoolUSValueA; +alias SHRegGetPath = SHRegGetPathA; +alias SHRegGetUSValue = SHRegGetUSValueA; +alias SHRegOpenUSKey = SHRegOpenUSKeyA; +alias SHRegQueryInfoUSKey = SHRegQueryInfoUSKeyA; +alias SHRegQueryUSValue = SHRegQueryUSValueA; +alias SHRegSetPath = SHRegSetPathA; +alias SHRegSetUSValue = SHRegSetUSValueA; +alias SHRegWriteUSValue = SHRegWriteUSValueA; //alias wnsprintfA wnsprintf; //alias wvnsprintfA wvnsprintf; } -alias StrToInt StrToLong; +alias StrToLong = StrToInt; diff --git a/runtime/druntime/src/core/sys/windows/snmp.d b/runtime/druntime/src/core/sys/windows/snmp.d index 62c81e1357e..9f7ae54544b 100644 --- a/runtime/druntime/src/core/sys/windows/snmp.d +++ b/runtime/druntime/src/core/sys/windows/snmp.d @@ -145,10 +145,10 @@ enum : DWORD { SNMP_AUTHAPI_TRIV_AUTH_FAILED, } -alias INT SNMPAPI; -alias LONG AsnInteger32; -alias ULONG AsnUnsigned32, AsnCounter32, AsnGauge32, AsnTimeticks; -alias ULARGE_INTEGER AsnCounter64; +alias SNMPAPI = INT; +alias AsnInteger32 = LONG; +alias AsnUnsigned32 = ULONG, AsnCounter32 = ULONG, AsnGauge32 = ULONG, AsnTimeticks = ULONG; +alias AsnCounter64 = ULARGE_INTEGER; align (4): @@ -158,15 +158,14 @@ align (4): UINT length; BOOL dynamic; } -alias AsnOctetString AsnBits, AsnSequence, AsnImplicitSequence, - AsnIPAddress, AsnNetworkAddress, AsnDisplayString, AsnOpaque; +alias AsnBits = AsnOctetString, AsnSequence = AsnOctetString, AsnImplicitSequence = AsnOctetString, AsnIPAddress = AsnOctetString, AsnNetworkAddress = AsnOctetString, AsnDisplayString = AsnOctetString, AsnOpaque = AsnOctetString; struct AsnObjectIdentifier { align (4): UINT idLength; UINT* ids; } -alias AsnObjectIdentifier AsnObjectName; +alias AsnObjectName = AsnObjectIdentifier; struct AsnAny { align (4): @@ -187,7 +186,7 @@ align (4): } _asnValue asnValue; } -alias AsnAny AsnObjectSyntax; +alias AsnObjectSyntax = AsnAny; struct SnmpVarBind { align (4): @@ -240,37 +239,37 @@ extern (Windows) { VOID SnmpUtilVarBindListFree(SnmpVarBindList*); } -alias SnmpUtilMemAlloc SNMP_malloc; -alias SnmpUtilMemFree SNMP_free; -alias SnmpUtilMemReAlloc SNMP_realloc; -alias SnmpUtilMemAlloc SNMP_DBG_malloc; -alias SnmpUtilMemFree SNMP_DBG_free; -alias SnmpUtilMemReAlloc SNMP_DBG_realloc; -alias SnmpUtilOidAppend SNMP_oidappend; -alias SnmpUtilOidCmp SNMP_oidcmp; -alias SnmpUtilOidCpy SNMP_oidcpy; -alias SnmpUtilOidFree SNMP_oidfree; -alias SnmpUtilOidNCmp SNMP_oidncmp; -alias SnmpUtilPrintAsnAny SNMP_printany; -alias SnmpUtilVarBindCpy SNMP_CopyVarBind; -alias SnmpUtilVarBindListCpy SNMP_CopyVarBindList; -alias SnmpUtilVarBindFree SNMP_FreeVarBind; -alias SnmpUtilVarBindListFree SNMP_FreeVarBindList; -alias ASN_IPADDRESS ASN_RFC1155_IPADDRESS; -alias ASN_COUNTER32 ASN_RFC1155_COUNTER; -alias ASN_GAUGE32 ASN_RFC1155_GAUGE; -alias ASN_TIMETICKS ASN_RFC1155_TIMETICKS; -alias ASN_OPAQUE ASN_RFC1155_OPAQUE; -alias ASN_OCTETSTRING ASN_RFC1213_DISPSTRING; -alias SNMP_PDU_GET ASN_RFC1157_GETREQUEST; -alias SNMP_PDU_GETNEXT ASN_RFC1157_GETNEXTREQUEST; -alias SNMP_PDU_RESPONSE ASN_RFC1157_GETRESPONSE; -alias SNMP_PDU_SET ASN_RFC1157_SETREQUEST; -alias SNMP_PDU_V1TRAP ASN_RFC1157_TRAP; -alias ASN_CONTEXT ASN_CONTEXTSPECIFIC; -alias ASN_PRIMITIVE ASN_PRIMATIVE; -alias SnmpVarBindList RFC1157VarBindList; -alias SnmpVarBind RFC1157VarBind; -alias AsnInteger32 AsnInteger; -alias AsnCounter32 AsnCounter; -alias AsnGauge32 AsnGauge; +alias SNMP_malloc = SnmpUtilMemAlloc; +alias SNMP_free = SnmpUtilMemFree; +alias SNMP_realloc = SnmpUtilMemReAlloc; +alias SNMP_DBG_malloc = SnmpUtilMemAlloc; +alias SNMP_DBG_free = SnmpUtilMemFree; +alias SNMP_DBG_realloc = SnmpUtilMemReAlloc; +alias SNMP_oidappend = SnmpUtilOidAppend; +alias SNMP_oidcmp = SnmpUtilOidCmp; +alias SNMP_oidcpy = SnmpUtilOidCpy; +alias SNMP_oidfree = SnmpUtilOidFree; +alias SNMP_oidncmp = SnmpUtilOidNCmp; +alias SNMP_printany = SnmpUtilPrintAsnAny; +alias SNMP_CopyVarBind = SnmpUtilVarBindCpy; +alias SNMP_CopyVarBindList = SnmpUtilVarBindListCpy; +alias SNMP_FreeVarBind = SnmpUtilVarBindFree; +alias SNMP_FreeVarBindList = SnmpUtilVarBindListFree; +alias ASN_RFC1155_IPADDRESS = ASN_IPADDRESS; +alias ASN_RFC1155_COUNTER = ASN_COUNTER32; +alias ASN_RFC1155_GAUGE = ASN_GAUGE32; +alias ASN_RFC1155_TIMETICKS = ASN_TIMETICKS; +alias ASN_RFC1155_OPAQUE = ASN_OPAQUE; +alias ASN_RFC1213_DISPSTRING = ASN_OCTETSTRING; +alias ASN_RFC1157_GETREQUEST = SNMP_PDU_GET; +alias ASN_RFC1157_GETNEXTREQUEST = SNMP_PDU_GETNEXT; +alias ASN_RFC1157_GETRESPONSE = SNMP_PDU_RESPONSE; +alias ASN_RFC1157_SETREQUEST = SNMP_PDU_SET; +alias ASN_RFC1157_TRAP = SNMP_PDU_V1TRAP; +alias ASN_CONTEXTSPECIFIC = ASN_CONTEXT; +alias ASN_PRIMATIVE = ASN_PRIMITIVE; +alias RFC1157VarBindList = SnmpVarBindList; +alias RFC1157VarBind = SnmpVarBind; +alias AsnInteger = AsnInteger32; +alias AsnCounter = AsnCounter32; +alias AsnGauge = AsnGauge32; diff --git a/runtime/druntime/src/core/sys/windows/sqltypes.d b/runtime/druntime/src/core/sys/windows/sqltypes.d index ca91f015851..81741eec0dd 100644 --- a/runtime/druntime/src/core/sys/windows/sqltypes.d +++ b/runtime/druntime/src/core/sys/windows/sqltypes.d @@ -22,22 +22,22 @@ version (ANSI) {} else version = Unicode; import core.sys.windows.windef; import core.sys.windows.basetyps; // for GUID -alias byte SCHAR, SQLSCHAR; -alias int SDWORD, SLONG, SQLINTEGER; -alias short SWORD, SSHORT, RETCODE, SQLSMALLINT; -alias ULONG UDWORD; -alias USHORT UWORD, SQLUSMALLINT; -alias double SDOUBLE, LDOUBLE; -alias float SFLOAT; -alias PVOID PTR, HENV, HDBC, HSTMT, SQLPOINTER; -alias UCHAR SQLCHAR; +alias SCHAR = byte, SQLSCHAR = byte; +alias SDWORD = int, SLONG = int, SQLINTEGER = int; +alias SWORD = short, SSHORT = short, RETCODE = short, SQLSMALLINT = short; +alias UDWORD = ULONG; +alias UWORD = USHORT, SQLUSMALLINT = USHORT; +alias SDOUBLE = double, LDOUBLE = double; +alias SFLOAT = float; +alias PTR = PVOID, HENV = PVOID, HDBC = PVOID, HSTMT = PVOID, SQLPOINTER = PVOID; +alias SQLCHAR = UCHAR; // #ifndef _WIN64 -alias UDWORD SQLUINTEGER; +alias SQLUINTEGER = UDWORD; // #endif //static if (ODBCVER >= 0x0300) { -alias HANDLE SQLHANDLE; -alias SQLHANDLE SQLHENV, SQLHDBC, SQLHSTMT, SQLHDESC; +alias SQLHANDLE = HANDLE; +alias SQLHENV = SQLHANDLE, SQLHDBC = SQLHANDLE, SQLHSTMT = SQLHANDLE, SQLHDESC = SQLHANDLE; /* } else { alias void* SQLHENV; @@ -45,29 +45,29 @@ alias void* SQLHDBC; alias void* SQLHSTMT; } */ -alias SQLSMALLINT SQLRETURN; -alias HWND SQLHWND; -alias ULONG BOOKMARK; +alias SQLRETURN = SQLSMALLINT; +alias SQLHWND = HWND; +alias BOOKMARK = ULONG; -alias SQLINTEGER SQLLEN, SQLROWOFFSET; -alias SQLUINTEGER SQLROWCOUNT, SQLULEN; -alias DWORD SQLTRANSID; -alias SQLUSMALLINT SQLSETPOSIROW; -alias wchar SQLWCHAR; +alias SQLLEN = SQLINTEGER, SQLROWOFFSET = SQLINTEGER; +alias SQLROWCOUNT = SQLUINTEGER, SQLULEN = SQLUINTEGER; +alias SQLTRANSID = DWORD; +alias SQLSETPOSIROW = SQLUSMALLINT; +alias SQLWCHAR = wchar; version (Unicode) { - alias SQLWCHAR SQLTCHAR; + alias SQLTCHAR = SQLWCHAR; } else { - alias SQLCHAR SQLTCHAR; + alias SQLTCHAR = SQLCHAR; } //static if (ODBCVER >= 0x0300) { -alias ubyte SQLDATE, SQLDECIMAL; -alias double SQLDOUBLE, SQLFLOAT; -alias ubyte SQLNUMERIC; -alias float SQLREAL; -alias ubyte SQLTIME, SQLTIMESTAMP, SQLVARCHAR; -alias long ODBCINT64, SQLBIGINT; -alias ulong SQLUBIGINT; +alias SQLDATE = ubyte, SQLDECIMAL = ubyte; +alias SQLDOUBLE = double, SQLFLOAT = double; +alias SQLNUMERIC = ubyte; +alias SQLREAL = float; +alias SQLTIME = ubyte, SQLTIMESTAMP = ubyte, SQLVARCHAR = ubyte; +alias ODBCINT64 = long, SQLBIGINT = long; +alias SQLUBIGINT = ulong; //} //Everything above this line may by used by odbcinst.d @@ -97,9 +97,9 @@ struct TIMESTAMP_STRUCT { } //static if (ODBCVER >= 0x0300) { -alias DATE_STRUCT SQL_DATE_STRUCT; -alias TIME_STRUCT SQL_TIME_STRUCT; -alias TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; +alias SQL_DATE_STRUCT = DATE_STRUCT; +alias SQL_TIME_STRUCT = TIME_STRUCT; +alias SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT; enum SQLINTERVAL { SQL_IS_YEAR = 1, @@ -149,4 +149,4 @@ struct SQL_NUMERIC_STRUCT { SQLCHAR[SQL_MAX_NUMERIC_LEN] val; } // } ODBCVER >= 0x0300 -alias GUID SQLGUID; +alias SQLGUID = GUID; diff --git a/runtime/druntime/src/core/sys/windows/sqlucode.d b/runtime/druntime/src/core/sys/windows/sqlucode.d index d20952d5b4b..b42b2838a3a 100644 --- a/runtime/druntime/src/core/sys/windows/sqlucode.d +++ b/runtime/druntime/src/core/sys/windows/sqlucode.d @@ -123,41 +123,41 @@ extern (Windows) { } version (Unicode) { - alias SQLBrowseConnectW SQLBrowseConnect; - alias SQLColAttributeW SQLColAttribute; - alias SQLColAttributesW SQLColAttributes; - alias SQLColumnPrivilegesW SQLColumnPrivileges; - alias SQLColumnsW SQLColumns; - alias SQLConnectW SQLConnect; - alias SQLDataSourcesW SQLDataSources; - alias SQLDescribeColW SQLDescribeCol; - alias SQLDriverConnectW SQLDriverConnect; - alias SQLDriversW SQLDrivers; - alias SQLErrorW SQLError; - alias SQLExecDirectW SQLExecDirect; - alias SQLForeignKeysW SQLForeignKeys; - alias SQLGetConnectAttrW SQLGetConnectAttr; - alias SQLGetConnectOptionW SQLGetConnectOption; - alias SQLGetCursorNameW SQLGetCursorName; - alias SQLGetDescFieldW SQLGetDescField; - alias SQLGetDescRecW SQLGetDescRec; - alias SQLGetDiagFieldW SQLGetDiagField; - alias SQLGetDiagRecW SQLGetDiagRec; - alias SQLGetInfoW SQLGetInfo; - alias SQLGetStmtAttrW SQLGetStmtAttr; - alias SQLGetTypeInfoW SQLGetTypeInfo; - alias SQLNativeSqlW SQLNativeSql; - alias SQLPrepareW SQLPrepare; - alias SQLPrimaryKeysW SQLPrimaryKeys; - alias SQLProcedureColumnsW SQLProcedureColumns; - alias SQLProceduresW SQLProcedures; - alias SQLSetConnectAttrW SQLSetConnectAttr; - alias SQLSetConnectOptionW SQLSetConnectOption; - alias SQLSetCursorNameW SQLSetCursorName; - alias SQLSetDescFieldW SQLSetDescField; - alias SQLSetStmtAttrW SQLSetStmtAttr; - alias SQLSpecialColumnsW SQLSpecialColumns; - alias SQLStatisticsW SQLStatistics; - alias SQLTablePrivilegesW SQLTablePrivileges; - alias SQLTablesW SQLTables; + alias SQLBrowseConnect = SQLBrowseConnectW; + alias SQLColAttribute = SQLColAttributeW; + alias SQLColAttributes = SQLColAttributesW; + alias SQLColumnPrivileges = SQLColumnPrivilegesW; + alias SQLColumns = SQLColumnsW; + alias SQLConnect = SQLConnectW; + alias SQLDataSources = SQLDataSourcesW; + alias SQLDescribeCol = SQLDescribeColW; + alias SQLDriverConnect = SQLDriverConnectW; + alias SQLDrivers = SQLDriversW; + alias SQLError = SQLErrorW; + alias SQLExecDirect = SQLExecDirectW; + alias SQLForeignKeys = SQLForeignKeysW; + alias SQLGetConnectAttr = SQLGetConnectAttrW; + alias SQLGetConnectOption = SQLGetConnectOptionW; + alias SQLGetCursorName = SQLGetCursorNameW; + alias SQLGetDescField = SQLGetDescFieldW; + alias SQLGetDescRec = SQLGetDescRecW; + alias SQLGetDiagField = SQLGetDiagFieldW; + alias SQLGetDiagRec = SQLGetDiagRecW; + alias SQLGetInfo = SQLGetInfoW; + alias SQLGetStmtAttr = SQLGetStmtAttrW; + alias SQLGetTypeInfo = SQLGetTypeInfoW; + alias SQLNativeSql = SQLNativeSqlW; + alias SQLPrepare = SQLPrepareW; + alias SQLPrimaryKeys = SQLPrimaryKeysW; + alias SQLProcedureColumns = SQLProcedureColumnsW; + alias SQLProcedures = SQLProceduresW; + alias SQLSetConnectAttr = SQLSetConnectAttrW; + alias SQLSetConnectOption = SQLSetConnectOptionW; + alias SQLSetCursorName = SQLSetCursorNameW; + alias SQLSetDescField = SQLSetDescFieldW; + alias SQLSetStmtAttr = SQLSetStmtAttrW; + alias SQLSpecialColumns = SQLSpecialColumnsW; + alias SQLStatistics = SQLStatisticsW; + alias SQLTablePrivileges = SQLTablePrivilegesW; + alias SQLTables = SQLTablesW; } diff --git a/runtime/druntime/src/core/sys/windows/sspi.d b/runtime/druntime/src/core/sys/windows/sspi.d index 3686c6f96f0..81cd6c5ea59 100644 --- a/runtime/druntime/src/core/sys/windows/sspi.d +++ b/runtime/druntime/src/core/sys/windows/sspi.d @@ -76,8 +76,8 @@ enum UNISP_NAME_A = "Microsoft Unified Security Protocol Provider"; enum UNISP_NAME_W = "Microsoft Unified Security Protocol Provider"w; enum SECBUFFER_VERSION = 0; -alias UNICODE_STRING SECURITY_STRING; -alias UNICODE_STRING* PSECURITY_STRING; +alias SECURITY_STRING = UNICODE_STRING; +alias PSECURITY_STRING = UNICODE_STRING*; extern(Windows): @@ -85,29 +85,29 @@ struct SecHandle { ULONG_PTR dwLower; ULONG_PTR dwUpper; } -alias SecHandle* PSecHandle; +alias PSecHandle = SecHandle*; struct SecBuffer { ULONG cbBuffer; ULONG BufferType; PVOID pvBuffer; } -alias SecBuffer* PSecBuffer; -alias SecHandle CredHandle; -alias PSecHandle PCredHandle; -alias SecHandle CtxtHandle; -alias PSecHandle PCtxtHandle; +alias PSecBuffer = SecBuffer*; +alias CredHandle = SecHandle; +alias PCredHandle = PSecHandle; +alias CtxtHandle = SecHandle; +alias PCtxtHandle = PSecHandle; struct SECURITY_INTEGER { uint LowPart; int HighPart; } -alias SECURITY_INTEGER TimeStamp; -alias SECURITY_INTEGER* PTimeStamp; +alias TimeStamp = SECURITY_INTEGER; +alias PTimeStamp = SECURITY_INTEGER*; struct SecBufferDesc { ULONG ulVersion; ULONG cBuffers; PSecBuffer pBuffers; } -alias SecBufferDesc* PSecBufferDesc; +alias PSecBufferDesc = SecBufferDesc*; struct SecPkgContext_StreamSizes { ULONG cbHeader; ULONG cbTrailer; @@ -115,22 +115,22 @@ struct SecPkgContext_StreamSizes { ULONG cBuffers; ULONG cbBlockSize; } -alias SecPkgContext_StreamSizes* PSecPkgContext_StreamSizes; +alias PSecPkgContext_StreamSizes = SecPkgContext_StreamSizes*; struct SecPkgContext_Sizes { ULONG cbMaxToken; ULONG cbMaxSignature; ULONG cbBlockSize; ULONG cbSecurityTrailer; } -alias SecPkgContext_Sizes* PSecPkgContext_Sizes; +alias PSecPkgContext_Sizes = SecPkgContext_Sizes*; struct SecPkgContext_AuthorityW { SEC_WCHAR* sAuthorityName; } -alias SecPkgContext_AuthorityW* PSecPkgContext_AuthorityW; +alias PSecPkgContext_AuthorityW = SecPkgContext_AuthorityW*; struct SecPkgContext_AuthorityA { SEC_CHAR* sAuthorityName; } -alias SecPkgContext_AuthorityA* PSecPkgContext_AuthorityA; +alias PSecPkgContext_AuthorityA = SecPkgContext_AuthorityA*; struct SecPkgContext_KeyInfoW { SEC_WCHAR* sSignatureAlgorithmName; SEC_WCHAR* sEncryptAlgorithmName; @@ -138,7 +138,7 @@ struct SecPkgContext_KeyInfoW { ULONG SignatureAlgorithm; ULONG EncryptAlgorithm; } -alias SecPkgContext_KeyInfoW* PSecPkgContext_KeyInfoW; +alias PSecPkgContext_KeyInfoW = SecPkgContext_KeyInfoW*; struct SecPkgContext_KeyInfoA { SEC_CHAR* sSignatureAlgorithmName; SEC_CHAR* sEncryptAlgorithmName; @@ -146,20 +146,20 @@ struct SecPkgContext_KeyInfoA { ULONG SignatureAlgorithm; ULONG EncryptAlgorithm; } -alias SecPkgContext_KeyInfoA* PSecPkgContext_KeyInfoA; +alias PSecPkgContext_KeyInfoA = SecPkgContext_KeyInfoA*; struct SecPkgContext_LifeSpan { TimeStamp tsStart; TimeStamp tsExpiry; } -alias SecPkgContext_LifeSpan* PSecPkgContext_LifeSpan; +alias PSecPkgContext_LifeSpan = SecPkgContext_LifeSpan*; struct SecPkgContext_NamesW { SEC_WCHAR* sUserName; } -alias SecPkgContext_NamesW* PSecPkgContext_NamesW; +alias PSecPkgContext_NamesW = SecPkgContext_NamesW*; struct SecPkgContext_NamesA { SEC_CHAR* sUserName; } -alias SecPkgContext_NamesA* PSecPkgContext_NamesA; +alias PSecPkgContext_NamesA = SecPkgContext_NamesA*; struct SecPkgInfoW { ULONG fCapabilities; USHORT wVersion; @@ -168,7 +168,7 @@ struct SecPkgInfoW { SEC_WCHAR* Name; SEC_WCHAR* Comment; } -alias SecPkgInfoW* PSecPkgInfoW; +alias PSecPkgInfoW = SecPkgInfoW*; struct SecPkgInfoA { ULONG fCapabilities; USHORT wVersion; @@ -177,51 +177,51 @@ struct SecPkgInfoA { SEC_CHAR* Name; SEC_CHAR* Comment; } -alias SecPkgInfoA* PSecPkgInfoA; +alias PSecPkgInfoA = SecPkgInfoA*; /* supported only in win2k+, so it should be a PSecPkgInfoW */ /* PSDK does not say it has ANSI/Unicode versions */ struct SecPkgContext_PackageInfo { PSecPkgInfoW PackageInfo; } -alias SecPkgContext_PackageInfo* PSecPkgContext_PackageInfo; +alias PSecPkgContext_PackageInfo = SecPkgContext_PackageInfo*; struct SecPkgCredentials_NamesW { SEC_WCHAR* sUserName; } -alias SecPkgCredentials_NamesW* PSecPkgCredentials_NamesW; +alias PSecPkgCredentials_NamesW = SecPkgCredentials_NamesW*; struct SecPkgCredentials_NamesA { SEC_CHAR* sUserName; } -alias SecPkgCredentials_NamesA* PSecPkgCredentials_NamesA; +alias PSecPkgCredentials_NamesA = SecPkgCredentials_NamesA*; /* TODO: missing type in SDK */ -alias void function() SEC_GET_KEY_FN; +alias SEC_GET_KEY_FN = void function(); -alias SECURITY_STATUS function(PULONG,PSecPkgInfoW*) ENUMERATE_SECURITY_PACKAGES_FN_W; -alias SECURITY_STATUS function(PULONG,PSecPkgInfoA*) ENUMERATE_SECURITY_PACKAGES_FN_A; -alias SECURITY_STATUS function(PCredHandle,ULONG,PVOID) QUERY_CREDENTIALS_ATTRIBUTES_FN_W; -alias SECURITY_STATUS function(PCredHandle,ULONG,PVOID) QUERY_CREDENTIALS_ATTRIBUTES_FN_A; -alias SECURITY_STATUS function(SEC_WCHAR*,SEC_WCHAR*,ULONG,PLUID,PVOID,SEC_GET_KEY_FN,PVOID,PCredHandle,PTimeStamp) ACQUIRE_CREDENTIALS_HANDLE_FN_W; -alias SECURITY_STATUS function(SEC_CHAR*,SEC_CHAR*,ULONG,PLUID,PVOID,SEC_GET_KEY_FN,PVOID,PCredHandle,PTimeStamp) ACQUIRE_CREDENTIALS_HANDLE_FN_A; -alias SECURITY_STATUS function(PCredHandle) FREE_CREDENTIALS_HANDLE_FN; -alias SECURITY_STATUS function(PCredHandle,PCtxtHandle,SEC_WCHAR*,ULONG,ULONG,ULONG,PSecBufferDesc,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp) INITIALIZE_SECURITY_CONTEXT_FN_W; -alias SECURITY_STATUS function(PCredHandle,PCtxtHandle,SEC_CHAR*,ULONG,ULONG,ULONG,PSecBufferDesc,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp) INITIALIZE_SECURITY_CONTEXT_FN_A; -alias SECURITY_STATUS function(PCredHandle,PCtxtHandle,PSecBufferDesc,ULONG,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp) ACCEPT_SECURITY_CONTEXT_FN; -alias SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc) COMPLETE_AUTH_TOKEN_FN; -alias SECURITY_STATUS function(PCtxtHandle) DELETE_SECURITY_CONTEXT_FN; -alias SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc) APPLY_CONTROL_TOKEN_FN_W; -alias SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc) APPLY_CONTROL_TOKEN_FN_A; -alias SECURITY_STATUS function(PCtxtHandle,ULONG,PVOID) QUERY_CONTEXT_ATTRIBUTES_FN_A; -alias SECURITY_STATUS function(PCtxtHandle,ULONG,PVOID) QUERY_CONTEXT_ATTRIBUTES_FN_W; -alias SECURITY_STATUS function(PCtxtHandle) IMPERSONATE_SECURITY_CONTEXT_FN; -alias SECURITY_STATUS function(PCtxtHandle) REVERT_SECURITY_CONTEXT_FN; -alias SECURITY_STATUS function(PCtxtHandle,ULONG,PSecBufferDesc,ULONG) MAKE_SIGNATURE_FN; -alias SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc,ULONG,PULONG) VERIFY_SIGNATURE_FN; -alias SECURITY_STATUS function(PVOID) FREE_CONTEXT_BUFFER_FN; -alias SECURITY_STATUS function(SEC_CHAR*,PSecPkgInfoA*) QUERY_SECURITY_PACKAGE_INFO_FN_A; -alias SECURITY_STATUS function(PCtxtHandle,HANDLE*) QUERY_SECURITY_CONTEXT_TOKEN_FN; -alias SECURITY_STATUS function(SEC_WCHAR*,PSecPkgInfoW*) QUERY_SECURITY_PACKAGE_INFO_FN_W; -alias SECURITY_STATUS function(PCtxtHandle,ULONG,PSecBufferDesc,ULONG) ENCRYPT_MESSAGE_FN; -alias SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc,ULONG,PULONG) DECRYPT_MESSAGE_FN; +alias ENUMERATE_SECURITY_PACKAGES_FN_W = SECURITY_STATUS function(PULONG,PSecPkgInfoW*); +alias ENUMERATE_SECURITY_PACKAGES_FN_A = SECURITY_STATUS function(PULONG,PSecPkgInfoA*); +alias QUERY_CREDENTIALS_ATTRIBUTES_FN_W = SECURITY_STATUS function(PCredHandle,ULONG,PVOID); +alias QUERY_CREDENTIALS_ATTRIBUTES_FN_A = SECURITY_STATUS function(PCredHandle,ULONG,PVOID); +alias ACQUIRE_CREDENTIALS_HANDLE_FN_W = SECURITY_STATUS function(SEC_WCHAR*,SEC_WCHAR*,ULONG,PLUID,PVOID,SEC_GET_KEY_FN,PVOID,PCredHandle,PTimeStamp); +alias ACQUIRE_CREDENTIALS_HANDLE_FN_A = SECURITY_STATUS function(SEC_CHAR*,SEC_CHAR*,ULONG,PLUID,PVOID,SEC_GET_KEY_FN,PVOID,PCredHandle,PTimeStamp); +alias FREE_CREDENTIALS_HANDLE_FN = SECURITY_STATUS function(PCredHandle); +alias INITIALIZE_SECURITY_CONTEXT_FN_W = SECURITY_STATUS function(PCredHandle,PCtxtHandle,SEC_WCHAR*,ULONG,ULONG,ULONG,PSecBufferDesc,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp); +alias INITIALIZE_SECURITY_CONTEXT_FN_A = SECURITY_STATUS function(PCredHandle,PCtxtHandle,SEC_CHAR*,ULONG,ULONG,ULONG,PSecBufferDesc,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp); +alias ACCEPT_SECURITY_CONTEXT_FN = SECURITY_STATUS function(PCredHandle,PCtxtHandle,PSecBufferDesc,ULONG,ULONG,PCtxtHandle,PSecBufferDesc,PULONG,PTimeStamp); +alias COMPLETE_AUTH_TOKEN_FN = SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc); +alias DELETE_SECURITY_CONTEXT_FN = SECURITY_STATUS function(PCtxtHandle); +alias APPLY_CONTROL_TOKEN_FN_W = SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc); +alias APPLY_CONTROL_TOKEN_FN_A = SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc); +alias QUERY_CONTEXT_ATTRIBUTES_FN_A = SECURITY_STATUS function(PCtxtHandle,ULONG,PVOID); +alias QUERY_CONTEXT_ATTRIBUTES_FN_W = SECURITY_STATUS function(PCtxtHandle,ULONG,PVOID); +alias IMPERSONATE_SECURITY_CONTEXT_FN = SECURITY_STATUS function(PCtxtHandle); +alias REVERT_SECURITY_CONTEXT_FN = SECURITY_STATUS function(PCtxtHandle); +alias MAKE_SIGNATURE_FN = SECURITY_STATUS function(PCtxtHandle,ULONG,PSecBufferDesc,ULONG); +alias VERIFY_SIGNATURE_FN = SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc,ULONG,PULONG); +alias FREE_CONTEXT_BUFFER_FN = SECURITY_STATUS function(PVOID); +alias QUERY_SECURITY_PACKAGE_INFO_FN_A = SECURITY_STATUS function(SEC_CHAR*,PSecPkgInfoA*); +alias QUERY_SECURITY_CONTEXT_TOKEN_FN = SECURITY_STATUS function(PCtxtHandle,HANDLE*); +alias QUERY_SECURITY_PACKAGE_INFO_FN_W = SECURITY_STATUS function(SEC_WCHAR*,PSecPkgInfoW*); +alias ENCRYPT_MESSAGE_FN = SECURITY_STATUS function(PCtxtHandle,ULONG,PSecBufferDesc,ULONG); +alias DECRYPT_MESSAGE_FN = SECURITY_STATUS function(PCtxtHandle,PSecBufferDesc,ULONG,PULONG); /* No, it really is FreeCredentialsHandle, see the thread beginning * http://sourceforge.net/mailarchive/message.php?msg_id=4321080 for a @@ -255,7 +255,7 @@ struct SecurityFunctionTableW{ ENCRYPT_MESSAGE_FN EncryptMessage; DECRYPT_MESSAGE_FN DecryptMessage; } -alias SecurityFunctionTableW* PSecurityFunctionTableW; +alias PSecurityFunctionTableW = SecurityFunctionTableW*; struct SecurityFunctionTableA{ uint dwVersion; ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA; @@ -285,9 +285,9 @@ struct SecurityFunctionTableA{ ENCRYPT_MESSAGE_FN EncryptMessage; DECRYPT_MESSAGE_FN DecryptMessage; } -alias SecurityFunctionTableA* PSecurityFunctionTableA; -alias PSecurityFunctionTableA function() INIT_SECURITY_INTERFACE_A; -alias PSecurityFunctionTableW function() INIT_SECURITY_INTERFACE_W; +alias PSecurityFunctionTableA = SecurityFunctionTableA*; +alias INIT_SECURITY_INTERFACE_A = PSecurityFunctionTableA function(); +alias INIT_SECURITY_INTERFACE_W = PSecurityFunctionTableW function(); SECURITY_STATUS FreeCredentialsHandle(PCredHandle); SECURITY_STATUS EnumerateSecurityPackagesA(PULONG,PSecPkgInfoA*); @@ -321,61 +321,61 @@ PSecurityFunctionTableA InitSecurityInterfaceA(); PSecurityFunctionTableW InitSecurityInterfaceW(); version (Unicode) { - alias UNISP_NAME_W UNISP_NAME; - alias SecPkgInfoW SecPkgInfo; - alias PSecPkgInfoW PSecPkgInfo; - alias SecPkgCredentials_NamesW SecPkgCredentials_Names; - alias PSecPkgCredentials_NamesW PSecPkgCredentials_Names; - alias SecPkgContext_AuthorityW SecPkgContext_Authority; - alias PSecPkgContext_AuthorityW PSecPkgContext_Authority; - alias SecPkgContext_KeyInfoW SecPkgContext_KeyInfo; - alias PSecPkgContext_KeyInfoW PSecPkgContext_KeyInfo; - alias SecPkgContext_NamesW SecPkgContext_Names; - alias PSecPkgContext_NamesW PSecPkgContext_Names; - alias SecurityFunctionTableW SecurityFunctionTable; - alias PSecurityFunctionTableW PSecurityFunctionTable; - alias AcquireCredentialsHandleW AcquireCredentialsHandle; - alias EnumerateSecurityPackagesW EnumerateSecurityPackages; - alias InitializeSecurityContextW InitializeSecurityContext; - alias QueryContextAttributesW QueryContextAttributes; - alias QueryCredentialsAttributesW QueryCredentialsAttributes; - alias QuerySecurityPackageInfoW QuerySecurityPackageInfo; - alias ApplyControlTokenW ApplyControlToken; - alias ENUMERATE_SECURITY_PACKAGES_FN_W ENUMERATE_SECURITY_PACKAGES_FN; - alias QUERY_CREDENTIALS_ATTRIBUTES_FN_W QUERY_CREDENTIALS_ATTRIBUTES_FN; - alias ACQUIRE_CREDENTIALS_HANDLE_FN_W ACQUIRE_CREDENTIALS_HANDLE_FN; - alias INITIALIZE_SECURITY_CONTEXT_FN_W INITIALIZE_SECURITY_CONTEXT_FN; - alias APPLY_CONTROL_TOKEN_FN_W APPLY_CONTROL_TOKEN_FN; - alias QUERY_CONTEXT_ATTRIBUTES_FN_W QUERY_CONTEXT_ATTRIBUTES_FN; - alias QUERY_SECURITY_PACKAGE_INFO_FN_W QUERY_SECURITY_PACKAGE_INFO_FN; - alias INIT_SECURITY_INTERFACE_W INIT_SECURITY_INTERFACE; + alias UNISP_NAME = UNISP_NAME_W; + alias SecPkgInfo = SecPkgInfoW; + alias PSecPkgInfo = PSecPkgInfoW; + alias SecPkgCredentials_Names = SecPkgCredentials_NamesW; + alias PSecPkgCredentials_Names = PSecPkgCredentials_NamesW; + alias SecPkgContext_Authority = SecPkgContext_AuthorityW; + alias PSecPkgContext_Authority = PSecPkgContext_AuthorityW; + alias SecPkgContext_KeyInfo = SecPkgContext_KeyInfoW; + alias PSecPkgContext_KeyInfo = PSecPkgContext_KeyInfoW; + alias SecPkgContext_Names = SecPkgContext_NamesW; + alias PSecPkgContext_Names = PSecPkgContext_NamesW; + alias SecurityFunctionTable = SecurityFunctionTableW; + alias PSecurityFunctionTable = PSecurityFunctionTableW; + alias AcquireCredentialsHandle = AcquireCredentialsHandleW; + alias EnumerateSecurityPackages = EnumerateSecurityPackagesW; + alias InitializeSecurityContext = InitializeSecurityContextW; + alias QueryContextAttributes = QueryContextAttributesW; + alias QueryCredentialsAttributes = QueryCredentialsAttributesW; + alias QuerySecurityPackageInfo = QuerySecurityPackageInfoW; + alias ApplyControlToken = ApplyControlTokenW; + alias ENUMERATE_SECURITY_PACKAGES_FN = ENUMERATE_SECURITY_PACKAGES_FN_W; + alias QUERY_CREDENTIALS_ATTRIBUTES_FN = QUERY_CREDENTIALS_ATTRIBUTES_FN_W; + alias ACQUIRE_CREDENTIALS_HANDLE_FN = ACQUIRE_CREDENTIALS_HANDLE_FN_W; + alias INITIALIZE_SECURITY_CONTEXT_FN = INITIALIZE_SECURITY_CONTEXT_FN_W; + alias APPLY_CONTROL_TOKEN_FN = APPLY_CONTROL_TOKEN_FN_W; + alias QUERY_CONTEXT_ATTRIBUTES_FN = QUERY_CONTEXT_ATTRIBUTES_FN_W; + alias QUERY_SECURITY_PACKAGE_INFO_FN = QUERY_SECURITY_PACKAGE_INFO_FN_W; + alias INIT_SECURITY_INTERFACE = INIT_SECURITY_INTERFACE_W; }else{ - alias UNISP_NAME_A UNISP_NAME; - alias SecPkgInfoA SecPkgInfo; - alias PSecPkgInfoA PSecPkgInfo; - alias SecPkgCredentials_NamesA SecPkgCredentials_Names; - alias PSecPkgCredentials_NamesA PSecPkgCredentials_Names; - alias SecPkgContext_AuthorityA SecPkgContext_Authority; - alias PSecPkgContext_AuthorityA PSecPkgContext_Authority; - alias SecPkgContext_KeyInfoA SecPkgContext_KeyInfo; - alias PSecPkgContext_KeyInfoA PSecPkgContext_KeyInfo; - alias SecPkgContext_NamesA SecPkgContext_Names; - alias PSecPkgContext_NamesA PSecPkgContext_Names; - alias SecurityFunctionTableA SecurityFunctionTable; - alias PSecurityFunctionTableA PSecurityFunctionTable; - alias AcquireCredentialsHandleA AcquireCredentialsHandle; - alias EnumerateSecurityPackagesA EnumerateSecurityPackages; - alias InitializeSecurityContextA InitializeSecurityContext; - alias QueryContextAttributesA QueryContextAttributes; - alias QueryCredentialsAttributesA QueryCredentialsAttributes; - alias QuerySecurityPackageInfoA QuerySecurityPackageInfo; - alias ApplyControlTokenA ApplyControlToken; - alias ENUMERATE_SECURITY_PACKAGES_FN_A ENUMERATE_SECURITY_PACKAGES_FN; - alias QUERY_CREDENTIALS_ATTRIBUTES_FN_A QUERY_CREDENTIALS_ATTRIBUTES_FN; - alias ACQUIRE_CREDENTIALS_HANDLE_FN_A ACQUIRE_CREDENTIALS_HANDLE_FN; - alias INITIALIZE_SECURITY_CONTEXT_FN_A INITIALIZE_SECURITY_CONTEXT_FN; - alias APPLY_CONTROL_TOKEN_FN_A APPLY_CONTROL_TOKEN_FN; - alias QUERY_CONTEXT_ATTRIBUTES_FN_A QUERY_CONTEXT_ATTRIBUTES_FN; - alias QUERY_SECURITY_PACKAGE_INFO_FN_A QUERY_SECURITY_PACKAGE_INFO_FN; - alias INIT_SECURITY_INTERFACE_A INIT_SECURITY_INTERFACE; + alias UNISP_NAME = UNISP_NAME_A; + alias SecPkgInfo = SecPkgInfoA; + alias PSecPkgInfo = PSecPkgInfoA; + alias SecPkgCredentials_Names = SecPkgCredentials_NamesA; + alias PSecPkgCredentials_Names = PSecPkgCredentials_NamesA; + alias SecPkgContext_Authority = SecPkgContext_AuthorityA; + alias PSecPkgContext_Authority = PSecPkgContext_AuthorityA; + alias SecPkgContext_KeyInfo = SecPkgContext_KeyInfoA; + alias PSecPkgContext_KeyInfo = PSecPkgContext_KeyInfoA; + alias SecPkgContext_Names = SecPkgContext_NamesA; + alias PSecPkgContext_Names = PSecPkgContext_NamesA; + alias SecurityFunctionTable = SecurityFunctionTableA; + alias PSecurityFunctionTable = PSecurityFunctionTableA; + alias AcquireCredentialsHandle = AcquireCredentialsHandleA; + alias EnumerateSecurityPackages = EnumerateSecurityPackagesA; + alias InitializeSecurityContext = InitializeSecurityContextA; + alias QueryContextAttributes = QueryContextAttributesA; + alias QueryCredentialsAttributes = QueryCredentialsAttributesA; + alias QuerySecurityPackageInfo = QuerySecurityPackageInfoA; + alias ApplyControlToken = ApplyControlTokenA; + alias ENUMERATE_SECURITY_PACKAGES_FN = ENUMERATE_SECURITY_PACKAGES_FN_A; + alias QUERY_CREDENTIALS_ATTRIBUTES_FN = QUERY_CREDENTIALS_ATTRIBUTES_FN_A; + alias ACQUIRE_CREDENTIALS_HANDLE_FN = ACQUIRE_CREDENTIALS_HANDLE_FN_A; + alias INITIALIZE_SECURITY_CONTEXT_FN = INITIALIZE_SECURITY_CONTEXT_FN_A; + alias APPLY_CONTROL_TOKEN_FN = APPLY_CONTROL_TOKEN_FN_A; + alias QUERY_CONTEXT_ATTRIBUTES_FN = QUERY_CONTEXT_ATTRIBUTES_FN_A; + alias QUERY_SECURITY_PACKAGE_INFO_FN = QUERY_SECURITY_PACKAGE_INFO_FN_A; + alias INIT_SECURITY_INTERFACE = INIT_SECURITY_INTERFACE_A; } diff --git a/runtime/druntime/src/core/sys/windows/stacktrace.d b/runtime/druntime/src/core/sys/windows/stacktrace.d index 8adfbea8edd..07394087639 100644 --- a/runtime/druntime/src/core/sys/windows/stacktrace.d +++ b/runtime/druntime/src/core/sys/windows/stacktrace.d @@ -27,7 +27,7 @@ debug(PRINTF) import core.stdc.stdio; extern(Windows) void RtlCaptureContext(CONTEXT* ContextRecord) @nogc; extern(Windows) DWORD GetEnvironmentVariableA(LPCSTR lpName, LPSTR pBuffer, DWORD nSize); -extern(Windows) alias USHORT function(ULONG FramesToSkip, ULONG FramesToCapture, PVOID *BackTrace, PULONG BackTraceHash) @nogc RtlCaptureStackBackTraceFunc; +extern(Windows) alias RtlCaptureStackBackTraceFunc = USHORT function(ULONG FramesToSkip, ULONG FramesToCapture, PVOID *BackTrace, PULONG BackTraceHash) @nogc; private __gshared RtlCaptureStackBackTraceFunc RtlCaptureStackBackTrace; private __gshared CRITICAL_SECTION mutex; // cannot use core.sync.mutex.Mutex unfortunately (cyclic dependency...) diff --git a/runtime/druntime/src/core/sys/windows/stdc/time.d b/runtime/druntime/src/core/sys/windows/stdc/time.d index 407b92c20a6..3146008cb9a 100644 --- a/runtime/druntime/src/core/sys/windows/stdc/time.d +++ b/runtime/druntime/src/core/sys/windows/stdc/time.d @@ -1,5 +1,5 @@ /** - * D header file for C99. + * D header file for C99/C11. * * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_time.h.html, _time.h) * @@ -39,9 +39,9 @@ struct tm } /// -alias c_long time_t; +alias time_t = c_long; /// -alias c_long clock_t; +alias clock_t = c_long; enum clock_t CLOCKS_PER_SEC = 1000; clock_t clock(); @@ -57,3 +57,36 @@ void _tzset(); // non-standard /// extern __gshared const(char)*[2] tzname; // non-standard + +// timespec functions, introduced in C11 +alias __time64_t = long; +alias __time32_t = int; + +/// 32-bit timespec struct +struct _timespec32 +{ + __time32_t tv_sec; + c_long tv_nsec; +} + +/// 64-bit timespec struct +struct _timespec64 +{ + __time64_t tv_sec; + c_long tv_nsec; +} + +/// Timespec structure, introduced in C11 +alias timespec = _timespec64; + +/// Base Value used for timespec_get +enum TIME_UTC = 1; + +/// 64-bit version of timespec_get for Windows +@system int _timespec64_get(scope _timespec64* ts, int base); + +/// 32-bit version of timespec_get for Windows +@system int _timespec32_get(scope _timespec32* ts, int base); + +/// timespec_get, introduced in C11 +alias timespec_get = _timespec64_get; diff --git a/runtime/druntime/src/core/sys/windows/subauth.d b/runtime/druntime/src/core/sys/windows/subauth.d index 8240d9f4781..c8de6d07f64 100644 --- a/runtime/druntime/src/core/sys/windows/subauth.d +++ b/runtime/druntime/src/core/sys/windows/subauth.d @@ -107,13 +107,13 @@ alias STRING* PSTRING; +/ alias SAM_HANDLE = HANDLE; -alias SAM_HANDLE* PSAM_HANDLE; +alias PSAM_HANDLE = SAM_HANDLE*; struct OLD_LARGE_INTEGER { ULONG LowPart; LONG HighPart; } -alias OLD_LARGE_INTEGER* POLD_LARGE_INTEGER; +alias POLD_LARGE_INTEGER = OLD_LARGE_INTEGER*; enum NETLOGON_LOGON_INFO_CLASS { NetlogonInteractiveInformation = 1, @@ -133,42 +133,42 @@ enum CLEAR_BLOCK_LENGTH = 8; struct CYPHER_BLOCK { CHAR[CYPHER_BLOCK_LENGTH] data = 0; } -alias CYPHER_BLOCK* PCYPHER_BLOCK; +alias PCYPHER_BLOCK = CYPHER_BLOCK*; struct CLEAR_BLOCK { CHAR[CLEAR_BLOCK_LENGTH] data = 0; } -alias CLEAR_BLOCK* PCLEAR_BLOCK; +alias PCLEAR_BLOCK = CLEAR_BLOCK*; struct LM_OWF_PASSWORD { CYPHER_BLOCK[2] data; } -alias LM_OWF_PASSWORD* PLM_OWF_PASSWORD; +alias PLM_OWF_PASSWORD = LM_OWF_PASSWORD*; struct USER_SESSION_KEY { CYPHER_BLOCK[2] data; } -alias USER_SESSION_KEY* PUSER_SESSION_KEY; +alias PUSER_SESSION_KEY = USER_SESSION_KEY*; -alias CLEAR_BLOCK LM_CHALLENGE; -alias LM_CHALLENGE* PLM_CHALLENGE; +alias LM_CHALLENGE = CLEAR_BLOCK; +alias PLM_CHALLENGE = LM_CHALLENGE*; -alias LM_OWF_PASSWORD NT_OWF_PASSWORD; -alias NT_OWF_PASSWORD* PNT_OWF_PASSWORD; -alias LM_CHALLENGE NT_CHALLENGE; -alias NT_CHALLENGE* PNT_CHALLENGE; +alias NT_OWF_PASSWORD = LM_OWF_PASSWORD; +alias PNT_OWF_PASSWORD = NT_OWF_PASSWORD*; +alias NT_CHALLENGE = LM_CHALLENGE; +alias PNT_CHALLENGE = NT_CHALLENGE*; struct LOGON_HOURS { USHORT UnitsPerWeek; PUCHAR LogonHours; } -alias LOGON_HOURS* PLOGON_HOURS; +alias PLOGON_HOURS = LOGON_HOURS*; struct SR_SECURITY_DESCRIPTOR { ULONG Length; PUCHAR SecurityDescriptor; } -alias SR_SECURITY_DESCRIPTOR* PSR_SECURITY_DESCRIPTOR; +alias PSR_SECURITY_DESCRIPTOR = SR_SECURITY_DESCRIPTOR*; align(4): struct USER_ALL_INFORMATION { @@ -206,7 +206,7 @@ struct USER_ALL_INFORMATION { BOOLEAN PasswordExpired; BOOLEAN PrivateDataSensitive; } -alias USER_ALL_INFORMATION* PUSER_ALL_INFORMATION; +alias PUSER_ALL_INFORMATION = USER_ALL_INFORMATION*; align: struct MSV1_0_VALIDATION_INFO { @@ -220,7 +220,7 @@ struct MSV1_0_VALIDATION_INFO { ULONG WhichFields; ULONG UserId; } -alias MSV1_0_VALIDATION_INFO* PMSV1_0_VALIDATION_INFO; +alias PMSV1_0_VALIDATION_INFO = MSV1_0_VALIDATION_INFO*; struct NETLOGON_LOGON_IDENTITY_INFO { UNICODE_STRING LogonDomainName; @@ -229,14 +229,14 @@ struct NETLOGON_LOGON_IDENTITY_INFO { UNICODE_STRING UserName; UNICODE_STRING Workstation; } -alias NETLOGON_LOGON_IDENTITY_INFO* PNETLOGON_LOGON_IDENTITY_INFO; +alias PNETLOGON_LOGON_IDENTITY_INFO = NETLOGON_LOGON_IDENTITY_INFO*; struct NETLOGON_INTERACTIVE_INFO { NETLOGON_LOGON_IDENTITY_INFO Identity; LM_OWF_PASSWORD LmOwfPassword; NT_OWF_PASSWORD NtOwfPassword; } -alias NETLOGON_INTERACTIVE_INFO* PNETLOGON_INTERACTIVE_INFO; +alias PNETLOGON_INTERACTIVE_INFO = NETLOGON_INTERACTIVE_INFO*; struct NETLOGON_GENERIC_INFO { NETLOGON_LOGON_IDENTITY_INFO Identity; @@ -244,7 +244,7 @@ struct NETLOGON_GENERIC_INFO { ULONG DataLength; PUCHAR LogonData; } -alias NETLOGON_GENERIC_INFO* PNETLOGON_GENERIC_INFO; +alias PNETLOGON_GENERIC_INFO = NETLOGON_GENERIC_INFO*; struct NETLOGON_NETWORK_INFO { NETLOGON_LOGON_IDENTITY_INFO Identity; @@ -252,14 +252,14 @@ struct NETLOGON_NETWORK_INFO { STRING NtChallengeResponse; STRING LmChallengeResponse; } -alias NETLOGON_NETWORK_INFO* PNETLOGON_NETWORK_INFO; +alias PNETLOGON_NETWORK_INFO = NETLOGON_NETWORK_INFO*; struct NETLOGON_SERVICE_INFO { NETLOGON_LOGON_IDENTITY_INFO Identity; LM_OWF_PASSWORD LmOwfPassword; NT_OWF_PASSWORD NtOwfPassword; } -alias NETLOGON_SERVICE_INFO* PNETLOGON_SERVICE_INFO; +alias PNETLOGON_SERVICE_INFO = NETLOGON_SERVICE_INFO*; extern (Windows) { NTSTATUS Msv1_0SubAuthenticationRoutine(NETLOGON_LOGON_INFO_CLASS,PVOID, diff --git a/runtime/druntime/src/core/sys/windows/threadaux.d b/runtime/druntime/src/core/sys/windows/threadaux.d index bfbab7e8bf0..e3c3c59c22d 100644 --- a/runtime/druntime/src/core/sys/windows/threadaux.d +++ b/runtime/druntime/src/core/sys/windows/threadaux.d @@ -52,7 +52,7 @@ struct thread_aux wchar* Buffer; } // process or thread ID, documentation says it is a HANDLE, but it's actually the ID (a DWORD) - alias size_t PTID; + alias PTID = size_t; struct _SYSTEM_PROCESS_INFORMATION { @@ -289,7 +289,7 @@ struct thread_aux } // execute function on the TLS for the given thread - alias extern(C) void function() externCVoidFunc; + alias externCVoidFunc = extern(C) void function(); static void impersonate_thread( uint id, externCVoidFunc fn ) { impersonate_thread(id, () => fn()); @@ -352,11 +352,11 @@ struct thread_aux public: // forward as few symbols as possible into the "global" name space -alias thread_aux.getTEB getTEB; -alias thread_aux.getThreadStackBottom getThreadStackBottom; -alias thread_aux.OpenThreadHandle OpenThreadHandle; -alias thread_aux.enumProcessThreads enumProcessThreads; -alias thread_aux.impersonate_thread impersonate_thread; +alias getTEB = thread_aux.getTEB; +alias getThreadStackBottom = thread_aux.getThreadStackBottom; +alias OpenThreadHandle = thread_aux.OpenThreadHandle; +alias enumProcessThreads = thread_aux.enumProcessThreads; +alias impersonate_thread = thread_aux.impersonate_thread; // get the start of the TLS memory of the thread with the given handle void* GetTlsDataAddress( HANDLE hnd ) nothrow diff --git a/runtime/druntime/src/core/sys/windows/tlhelp32.d b/runtime/druntime/src/core/sys/windows/tlhelp32.d index ecbfe38ab47..6a5d58be6e8 100644 --- a/runtime/druntime/src/core/sys/windows/tlhelp32.d +++ b/runtime/druntime/src/core/sys/windows/tlhelp32.d @@ -42,8 +42,8 @@ struct HEAPLIST32 { ULONG_PTR th32HeapID; DWORD dwFlags; } -alias HEAPLIST32* PHEAPLIST32; -alias HEAPLIST32* LPHEAPLIST32; +alias PHEAPLIST32 = HEAPLIST32*; +alias LPHEAPLIST32 = HEAPLIST32*; struct HEAPENTRY32 { SIZE_T dwSize; @@ -56,8 +56,8 @@ struct HEAPENTRY32 { DWORD th32ProcessID; ULONG_PTR th32HeapID; } -alias HEAPENTRY32* PHEAPENTRY32; -alias HEAPENTRY32* LPHEAPENTRY32; +alias PHEAPENTRY32 = HEAPENTRY32*; +alias LPHEAPENTRY32 = HEAPENTRY32*; struct PROCESSENTRY32W { DWORD dwSize; @@ -71,8 +71,8 @@ struct PROCESSENTRY32W { DWORD dwFlags; WCHAR[MAX_PATH] szExeFile = 0; } -alias PROCESSENTRY32W* PPROCESSENTRY32W; -alias PROCESSENTRY32W* LPPROCESSENTRY32W; +alias PPROCESSENTRY32W = PROCESSENTRY32W*; +alias LPPROCESSENTRY32W = PROCESSENTRY32W*; struct THREADENTRY32 { DWORD dwSize; @@ -83,8 +83,8 @@ struct THREADENTRY32 { LONG tpDeltaPri; DWORD dwFlags; } -alias THREADENTRY32* PTHREADENTRY32; -alias THREADENTRY32* LPTHREADENTRY32; +alias PTHREADENTRY32 = THREADENTRY32*; +alias LPTHREADENTRY32 = THREADENTRY32*; struct MODULEENTRY32W { DWORD dwSize; @@ -98,17 +98,17 @@ struct MODULEENTRY32W { WCHAR[MAX_MODULE_NAME32 + 1] szModule = 0; WCHAR[MAX_PATH] szExePath = 0; } -alias MODULEENTRY32W* PMODULEENTRY32W; -alias MODULEENTRY32W* LPMODULEENTRY32W; +alias PMODULEENTRY32W = MODULEENTRY32W*; +alias LPMODULEENTRY32W = MODULEENTRY32W*; version (Unicode) { - alias PROCESSENTRY32W PROCESSENTRY32; - alias PPROCESSENTRY32W PPROCESSENTRY32; - alias LPPROCESSENTRY32W LPPROCESSENTRY32; + alias PROCESSENTRY32 = PROCESSENTRY32W; + alias PPROCESSENTRY32 = PPROCESSENTRY32W; + alias LPPROCESSENTRY32 = LPPROCESSENTRY32W; - alias MODULEENTRY32W MODULEENTRY32; - alias PMODULEENTRY32W PMODULEENTRY32; - alias LPMODULEENTRY32W LPMODULEENTRY32; + alias MODULEENTRY32 = MODULEENTRY32W; + alias PMODULEENTRY32 = PMODULEENTRY32W; + alias LPMODULEENTRY32 = LPMODULEENTRY32W; } else { struct PROCESSENTRY32 { DWORD dwSize; @@ -122,8 +122,8 @@ version (Unicode) { DWORD dwFlags; CHAR[MAX_PATH] szExeFile = 0; } - alias PROCESSENTRY32* PPROCESSENTRY32; - alias PROCESSENTRY32* LPPROCESSENTRY32; + alias PPROCESSENTRY32 = PROCESSENTRY32*; + alias LPPROCESSENTRY32 = PROCESSENTRY32*; struct MODULEENTRY32 { DWORD dwSize; @@ -137,8 +137,8 @@ version (Unicode) { char[MAX_MODULE_NAME32 + 1] szModule = 0; char[MAX_PATH] szExePath = 0; } - alias MODULEENTRY32* PMODULEENTRY32; - alias MODULEENTRY32* LPMODULEENTRY32; + alias PMODULEENTRY32 = MODULEENTRY32*; + alias LPMODULEENTRY32 = MODULEENTRY32*; } @@ -158,10 +158,10 @@ extern(Windows) nothrow @nogc { } version (Unicode) { - alias Module32FirstW Module32First; - alias Module32NextW Module32Next; - alias Process32FirstW Process32First; - alias Process32NextW Process32Next; + alias Module32First = Module32FirstW; + alias Module32Next = Module32NextW; + alias Process32First = Process32FirstW; + alias Process32Next = Process32NextW; } else { extern(Windows) nothrow @nogc { BOOL Module32First(HANDLE,LPMODULEENTRY32); diff --git a/runtime/druntime/src/core/sys/windows/unknwn.d b/runtime/druntime/src/core/sys/windows/unknwn.d index 0b002792276..d2a34726484 100644 --- a/runtime/druntime/src/core/sys/windows/unknwn.d +++ b/runtime/druntime/src/core/sys/windows/unknwn.d @@ -27,13 +27,13 @@ extern (Windows) { ULONG Release(); } - alias IUnknown LPUNKNOWN; + alias LPUNKNOWN = IUnknown; interface IClassFactory : IUnknown { HRESULT CreateInstance(IUnknown UnkOuter, IID* riid, void** pvObject); HRESULT LockServer(BOOL fLock); } - alias IClassFactory LPCLASSFACTORY; + alias LPCLASSFACTORY = IClassFactory; /+ // These do not seem to be necessary (or desirable) for D. diff --git a/runtime/druntime/src/core/sys/windows/vfw.d b/runtime/druntime/src/core/sys/windows/vfw.d index 313895f4acb..8f0adf38be9 100644 --- a/runtime/druntime/src/core/sys/windows/vfw.d +++ b/runtime/druntime/src/core/sys/windows/vfw.d @@ -38,7 +38,7 @@ DWORD MKFOURCC(char ch0, char ch1, char ch2, char ch3) { enum ICVERSION = 0x0104; -alias HANDLE HIC; +alias HIC = HANDLE; enum BI_1632 = 0x32333631; @@ -656,7 +656,7 @@ struct COMPVARS { LPVOID lpState; LONG cbState; } -alias COMPVARS* PCOMPVARS; +alias PCOMPVARS = COMPVARS*; enum ICMF_COMPVARS_VALID = 0x00000001; @@ -734,7 +734,7 @@ struct DRAWDIBTIME { LONG timeBlt; LONG timeSetDIBits; } -alias DRAWDIBTIME* LPDRAWDIBTIME; +alias LPDRAWDIBTIME = DRAWDIBTIME*; extern (Windows) { BOOL DrawDibTime(HDRAWDIB hdd, LPDRAWDIBTIME lpddtime); @@ -755,9 +755,9 @@ extern (Windows) { int SrcX, int SrcY, int SrcXE, int SrcYE); } -alias DWORD FOURCC; +alias FOURCC = DWORD; -alias WORD TWOCC; +alias TWOCC = WORD; enum formtypeAVI = mmioFOURCC!('A', 'V', 'I', ' '); enum listtypeAVIHEADER = mmioFOURCC!('h', 'd', 'r', 'l'); @@ -892,7 +892,7 @@ struct AVISTREAMINFOW { DWORD dwFormatChangeCount; WCHAR[64] szName = 0; } -alias AVISTREAMINFOW* LPAVISTREAMINFOW; +alias LPAVISTREAMINFOW = AVISTREAMINFOW*; struct AVISTREAMINFOA { DWORD fccType; @@ -914,14 +914,14 @@ struct AVISTREAMINFOA { DWORD dwFormatChangeCount; char[64] szName = 0; } -alias AVISTREAMINFOA* LPAVISTREAMINFOA; +alias LPAVISTREAMINFOA = AVISTREAMINFOA*; version (Unicode) { - alias AVISTREAMINFOW AVISTREAMINFO; - alias LPAVISTREAMINFOW LPAVISTREAMINFO; + alias AVISTREAMINFO = AVISTREAMINFOW; + alias LPAVISTREAMINFO = LPAVISTREAMINFOW; } else { // Unicode - alias AVISTREAMINFOA AVISTREAMINFO; - alias LPAVISTREAMINFOA LPAVISTREAMINFO; + alias AVISTREAMINFO = AVISTREAMINFOA; + alias LPAVISTREAMINFO = LPAVISTREAMINFOA; } enum AVISTREAMINFO_DISABLED = 0x00000001; @@ -941,7 +941,7 @@ struct AVIFILEINFOW { DWORD dwEditCount; WCHAR[64] szFileType = 0; } -alias AVIFILEINFOW* LPAVIFILEINFOW; +alias LPAVIFILEINFOW = AVIFILEINFOW*; struct AVIFILEINFOA { DWORD dwMaxBytesPerSec; @@ -957,14 +957,14 @@ struct AVIFILEINFOA { DWORD dwEditCount; char[64] szFileType = 0; } -alias AVIFILEINFOA* LPAVIFILEINFOA; +alias LPAVIFILEINFOA = AVIFILEINFOA*; version (Unicode) { - alias AVIFILEINFOW AVIFILEINFO; - alias LPAVIFILEINFOW LPAVIFILEINFO; + alias AVIFILEINFO = AVIFILEINFOW; + alias LPAVIFILEINFO = LPAVIFILEINFOW; } else { // Unicode - alias AVIFILEINFOA AVIFILEINFO; - alias LPAVIFILEINFOA LPAVIFILEINFO; + alias AVIFILEINFO = AVIFILEINFOA; + alias LPAVIFILEINFO = LPAVIFILEINFOA; } enum { @@ -983,7 +983,7 @@ enum { } extern (Windows) { - alias BOOL function(int) AVISAVECALLBACK; + alias AVISAVECALLBACK = BOOL function(int); } struct AVICOMPRESSOPTIONS { @@ -999,7 +999,7 @@ struct AVICOMPRESSOPTIONS { DWORD cbParms; DWORD dwInterleaveEvery; } -alias AVICOMPRESSOPTIONS* LPAVICOMPRESSOPTIONS; +alias LPAVICOMPRESSOPTIONS = AVICOMPRESSOPTIONS*; enum { AVICOMPRESSF_INTERLEAVE = 0x00000001, @@ -1512,9 +1512,9 @@ extern (Windows) { } version (Unicode) { - alias MCIWndCreateW MCIWndCreate; + alias MCIWndCreate = MCIWndCreateW; } else { // Unicode - alias MCIWndCreateA MCIWndCreate; + alias MCIWndCreate = MCIWndCreateA; } extern(Windows) { @@ -1542,9 +1542,9 @@ enum { } version (Unicode) { - alias MCIWNDF_NOTIFYMEDIAW MCIWNDF_NOTIFYMEDIA; + alias MCIWNDF_NOTIFYMEDIA = MCIWNDF_NOTIFYMEDIAW; } else { // Unicode - alias MCIWNDF_NOTIFYMEDIAA MCIWNDF_NOTIFYMEDIA; + alias MCIWNDF_NOTIFYMEDIA = MCIWNDF_NOTIFYMEDIAA; } enum { @@ -1763,29 +1763,29 @@ enum { } version (Unicode) { - alias MCIWNDM_SENDSTRINGW MCIWNDM_SENDSTRING; - alias MCIWNDM_GETPOSITIONW MCIWNDM_GETPOSITION; - alias MCIWNDM_GETMODEW MCIWNDM_GETMODE; - alias MCIWNDM_SETTIMEFORMATW MCIWNDM_SETTIMEFORMAT; - alias MCIWNDM_GETTIMEFORMATW MCIWNDM_GETTIMEFORMAT; - alias MCIWNDM_GETFILENAMEW MCIWNDM_GETFILENAME; - alias MCIWNDM_GETDEVICEW MCIWNDM_GETDEVICE; - alias MCIWNDM_GETERRORW MCIWNDM_GETERROR; - alias MCIWNDM_NEWW MCIWNDM_NEW; - alias MCIWNDM_RETURNSTRINGW MCIWNDM_RETURNSTRING; - alias MCIWNDM_OPENW MCIWNDM_OPEN; + alias MCIWNDM_SENDSTRING = MCIWNDM_SENDSTRINGW; + alias MCIWNDM_GETPOSITION = MCIWNDM_GETPOSITIONW; + alias MCIWNDM_GETMODE = MCIWNDM_GETMODEW; + alias MCIWNDM_SETTIMEFORMAT = MCIWNDM_SETTIMEFORMATW; + alias MCIWNDM_GETTIMEFORMAT = MCIWNDM_GETTIMEFORMATW; + alias MCIWNDM_GETFILENAME = MCIWNDM_GETFILENAMEW; + alias MCIWNDM_GETDEVICE = MCIWNDM_GETDEVICEW; + alias MCIWNDM_GETERROR = MCIWNDM_GETERRORW; + alias MCIWNDM_NEW = MCIWNDM_NEWW; + alias MCIWNDM_RETURNSTRING = MCIWNDM_RETURNSTRINGW; + alias MCIWNDM_OPEN = MCIWNDM_OPENW; } else { // Unicode - alias MCIWNDM_SENDSTRINGA MCIWNDM_SENDSTRING; - alias MCIWNDM_GETPOSITIONA MCIWNDM_GETPOSITION; - alias MCIWNDM_GETMODEA MCIWNDM_GETMODE; - alias MCIWNDM_SETTIMEFORMATA MCIWNDM_SETTIMEFORMAT; - alias MCIWNDM_GETTIMEFORMATA MCIWNDM_GETTIMEFORMAT; - alias MCIWNDM_GETFILENAMEA MCIWNDM_GETFILENAME; - alias MCIWNDM_GETDEVICEA MCIWNDM_GETDEVICE; - alias MCIWNDM_GETERRORA MCIWNDM_GETERROR; - alias MCIWNDM_NEWA MCIWNDM_NEW; - alias MCIWNDM_RETURNSTRINGA MCIWNDM_RETURNSTRING; - alias MCIWNDM_OPENA MCIWNDM_OPEN; + alias MCIWNDM_SENDSTRING = MCIWNDM_SENDSTRINGA; + alias MCIWNDM_GETPOSITION = MCIWNDM_GETPOSITIONA; + alias MCIWNDM_GETMODE = MCIWNDM_GETMODEA; + alias MCIWNDM_SETTIMEFORMAT = MCIWNDM_SETTIMEFORMATA; + alias MCIWNDM_GETTIMEFORMAT = MCIWNDM_GETTIMEFORMATA; + alias MCIWNDM_GETFILENAME = MCIWNDM_GETFILENAMEA; + alias MCIWNDM_GETDEVICE = MCIWNDM_GETDEVICEA; + alias MCIWNDM_GETERROR = MCIWNDM_GETERRORA; + alias MCIWNDM_NEW = MCIWNDM_NEWA; + alias MCIWNDM_RETURNSTRING = MCIWNDM_RETURNSTRINGA; + alias MCIWNDM_OPEN = MCIWNDM_OPENA; } enum { @@ -1825,8 +1825,8 @@ enum { MCI_MODE_OPEN, } -alias HANDLE HVIDEO; -alias HVIDEO* LPHVIDEO; +alias HVIDEO = HANDLE; +alias LPHVIDEO = HVIDEO*; // Error Return Values @@ -1894,7 +1894,7 @@ struct VIDEOHDR { DWORD dwFlags; DWORD_PTR[4]dwReserved; } -alias VIDEOHDR* PVIDEOHDR, LPVIDEOHDR; +alias PVIDEOHDR = VIDEOHDR*, LPVIDEOHDR = VIDEOHDR*; enum { VHDR_DONE = 0x00000001, @@ -1915,7 +1915,7 @@ struct CHANNEL_CAPS { DWORD dwDstRectWidthMod; DWORD dwDstRectHeightMod; } -alias CHANNEL_CAPS* PCHANNEL_CAPS, LPCHANNEL_CAPS; +alias PCHANNEL_CAPS = CHANNEL_CAPS*, LPCHANNEL_CAPS = CHANNEL_CAPS*; enum { VCAPS_OVERLAY = 0x00000001, @@ -1986,11 +1986,11 @@ enum { } version (Unicode) { - alias WM_CAP_SET_CALLBACK_ERRORW WM_CAP_SET_CALLBACK_ERROR; - alias WM_CAP_SET_CALLBACK_STATUSW WM_CAP_SET_CALLBACK_STATUS; + alias WM_CAP_SET_CALLBACK_ERROR = WM_CAP_SET_CALLBACK_ERRORW; + alias WM_CAP_SET_CALLBACK_STATUS = WM_CAP_SET_CALLBACK_STATUSW; } else { // Unicode - alias WM_CAP_SET_CALLBACK_ERRORA WM_CAP_SET_CALLBACK_ERROR; - alias WM_CAP_SET_CALLBACK_STATUSA WM_CAP_SET_CALLBACK_STATUS; + alias WM_CAP_SET_CALLBACK_ERROR = WM_CAP_SET_CALLBACK_ERRORA; + alias WM_CAP_SET_CALLBACK_STATUS = WM_CAP_SET_CALLBACK_STATUSA; } enum { @@ -2010,11 +2010,11 @@ enum { } version (Unicode) { - alias WM_CAP_DRIVER_GET_NAMEW WM_CAP_DRIVER_GET_NAME; - alias WM_CAP_DRIVER_GET_VERSIONW WM_CAP_DRIVER_GET_VERSION; + alias WM_CAP_DRIVER_GET_NAME = WM_CAP_DRIVER_GET_NAMEW; + alias WM_CAP_DRIVER_GET_VERSION = WM_CAP_DRIVER_GET_VERSIONW; } else { // Unicode - alias WM_CAP_DRIVER_GET_NAMEA WM_CAP_DRIVER_GET_NAME; - alias WM_CAP_DRIVER_GET_VERSIONA WM_CAP_DRIVER_GET_VERSION; + alias WM_CAP_DRIVER_GET_NAME = WM_CAP_DRIVER_GET_NAMEA; + alias WM_CAP_DRIVER_GET_VERSION = WM_CAP_DRIVER_GET_VERSIONA; } enum { @@ -2031,15 +2031,15 @@ enum { } version (Unicode) { - alias WM_CAP_FILE_SET_CAPTURE_FILEW WM_CAP_FILE_SET_CAPTURE_FILE; - alias WM_CAP_FILE_GET_CAPTURE_FILEW WM_CAP_FILE_GET_CAPTURE_FILE; - alias WM_CAP_FILE_SAVEASW WM_CAP_FILE_SAVEAS; - alias WM_CAP_FILE_SAVEDIBW WM_CAP_FILE_SAVEDIB; + alias WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_FILE_SET_CAPTURE_FILEW; + alias WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_FILE_GET_CAPTURE_FILEW; + alias WM_CAP_FILE_SAVEAS = WM_CAP_FILE_SAVEASW; + alias WM_CAP_FILE_SAVEDIB = WM_CAP_FILE_SAVEDIBW; } else { // Unicode - alias WM_CAP_FILE_SET_CAPTURE_FILEA WM_CAP_FILE_SET_CAPTURE_FILE; - alias WM_CAP_FILE_GET_CAPTURE_FILEA WM_CAP_FILE_GET_CAPTURE_FILE; - alias WM_CAP_FILE_SAVEASA WM_CAP_FILE_SAVEAS; - alias WM_CAP_FILE_SAVEDIBA WM_CAP_FILE_SAVEDIB; + alias WM_CAP_FILE_SET_CAPTURE_FILE = WM_CAP_FILE_SET_CAPTURE_FILEA; + alias WM_CAP_FILE_GET_CAPTURE_FILE = WM_CAP_FILE_GET_CAPTURE_FILEA; + alias WM_CAP_FILE_SAVEAS = WM_CAP_FILE_SAVEASA; + alias WM_CAP_FILE_SAVEDIB = WM_CAP_FILE_SAVEDIBA; } enum { @@ -2074,11 +2074,11 @@ enum { } version (Unicode) { - alias WM_CAP_SET_MCI_DEVICEW WM_CAP_SET_MCI_DEVICE; - alias WM_CAP_GET_MCI_DEVICEW WM_CAP_GET_MCI_DEVICE; + alias WM_CAP_SET_MCI_DEVICE = WM_CAP_SET_MCI_DEVICEW; + alias WM_CAP_GET_MCI_DEVICE = WM_CAP_GET_MCI_DEVICEW; } else { // Unicode - alias WM_CAP_SET_MCI_DEVICEA WM_CAP_SET_MCI_DEVICE; - alias WM_CAP_GET_MCI_DEVICEA WM_CAP_GET_MCI_DEVICE; + alias WM_CAP_SET_MCI_DEVICE = WM_CAP_SET_MCI_DEVICEA; + alias WM_CAP_GET_MCI_DEVICE = WM_CAP_GET_MCI_DEVICEA; } enum { @@ -2095,11 +2095,11 @@ enum { } version (Unicode) { - alias WM_CAP_PAL_OPENW WM_CAP_PAL_OPEN; - alias WM_CAP_PAL_SAVEW WM_CAP_PAL_SAVE; + alias WM_CAP_PAL_OPEN = WM_CAP_PAL_OPENW; + alias WM_CAP_PAL_SAVE = WM_CAP_PAL_SAVEW; } else { // Unicode - alias WM_CAP_PAL_OPENA WM_CAP_PAL_OPEN; - alias WM_CAP_PAL_SAVEA WM_CAP_PAL_SAVE; + alias WM_CAP_PAL_OPEN = WM_CAP_PAL_OPENA; + alias WM_CAP_PAL_SAVE = WM_CAP_PAL_SAVEA; } enum { @@ -2202,7 +2202,7 @@ struct CAPDRIVERCAPS { HANDLE hVideoExtIn; HANDLE hVideoExtOut; } -alias CAPDRIVERCAPS* PCAPDRIVERCAPS, LPCAPDRIVERCAPS; +alias PCAPDRIVERCAPS = CAPDRIVERCAPS*, LPCAPDRIVERCAPS = CAPDRIVERCAPS*; struct CAPSTATUS { UINT uiImageWidth; @@ -2224,7 +2224,7 @@ struct CAPSTATUS { UINT wNumVideoAllocated; UINT wNumAudioAllocated; } -alias CAPSTATUS* PCAPSTATUS, LPCAPSTATUS; +alias PCAPSTATUS = CAPSTATUS*, LPCAPSTATUS = CAPSTATUS*; struct CAPTUREPARMS { DWORD dwRequestMicroSecPerFrame; @@ -2252,7 +2252,7 @@ struct CAPTUREPARMS { BOOL fDisableWriteCache; UINT AVStreamMaster; } -alias CAPTUREPARMS* PCAPTUREPARMS, LPCAPTUREPARMS; +alias PCAPTUREPARMS = CAPTUREPARMS*, LPCAPTUREPARMS = CAPTUREPARMS*; enum AVSTREAMMASTER_AUDIO = 0; enum AVSTREAMMASTER_NONE = 1; @@ -2262,30 +2262,30 @@ struct CAPINFOCHUNK { LPVOID lpData; LONG cbData; } -alias CAPINFOCHUNK* PCAPINFOCHUNK, LPCAPINFOCHUNK; +alias PCAPINFOCHUNK = CAPINFOCHUNK*, LPCAPINFOCHUNK = CAPINFOCHUNK*; // Callback Definitions extern (Windows) { - alias LRESULT function(HWND hWnd) CAPYIELDCALLBACK; - alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPSTATUSCALLBACKW; - alias LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz) CAPERRORCALLBACKW; - alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPSTATUSCALLBACKA; - alias LRESULT function(HWND hWnd, int nID, LPCSTR lpsz) CAPERRORCALLBACKA; + alias CAPYIELDCALLBACK = LRESULT function(HWND hWnd); + alias CAPSTATUSCALLBACKW = LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz); + alias CAPERRORCALLBACKW = LRESULT function(HWND hWnd, int nID, LPCWSTR lpsz); + alias CAPSTATUSCALLBACKA = LRESULT function(HWND hWnd, int nID, LPCSTR lpsz); + alias CAPERRORCALLBACKA = LRESULT function(HWND hWnd, int nID, LPCSTR lpsz); } version (Unicode) { - alias CAPSTATUSCALLBACKW CAPSTATUSCALLBACK; - alias CAPERRORCALLBACKW CAPERRORCALLBACK; + alias CAPSTATUSCALLBACK = CAPSTATUSCALLBACKW; + alias CAPERRORCALLBACK = CAPERRORCALLBACKW; } else { // Unicode - alias CAPSTATUSCALLBACKA CAPSTATUSCALLBACK; - alias CAPERRORCALLBACKA CAPERRORCALLBACK; + alias CAPSTATUSCALLBACK = CAPSTATUSCALLBACKA; + alias CAPERRORCALLBACK = CAPERRORCALLBACKA; } extern (Windows) { - alias LRESULT function(HWND hWnd, LPVIDEOHDR lpVHdr) CAPVIDEOCALLBACK; - alias LRESULT function(HWND hWnd, LPWAVEHDR lpWHdr) CAPWAVECALLBACK; - alias LRESULT function(HWND hWnd, int nState) CAPCONTROLCALLBACK; + alias CAPVIDEOCALLBACK = LRESULT function(HWND hWnd, LPVIDEOHDR lpVHdr); + alias CAPWAVECALLBACK = LRESULT function(HWND hWnd, LPWAVEHDR lpWHdr); + alias CAPCONTROLCALLBACK = LRESULT function(HWND hWnd, int nState); } // CapControlCallback states @@ -2300,11 +2300,11 @@ extern (Windows) { } version (Unicode) { - alias capCreateCaptureWindowW capCreateCaptureWindow; - alias capGetDriverDescriptionW capGetDriverDescription; + alias capCreateCaptureWindow = capCreateCaptureWindowW; + alias capGetDriverDescription = capGetDriverDescriptionW; } else { // Unicode - alias capCreateCaptureWindowA capCreateCaptureWindow; - alias capGetDriverDescriptionA capGetDriverDescription; + alias capCreateCaptureWindow = capCreateCaptureWindowA; + alias capGetDriverDescription = capGetDriverDescriptionA; } // New Information chunk IDs @@ -2392,9 +2392,9 @@ extern (Windows) { } version (Unicode) { - alias GetOpenFileNamePreviewW GetOpenFileNamePreview; - alias GetSaveFileNamePreviewW GetSaveFileNamePreview; + alias GetOpenFileNamePreview = GetOpenFileNamePreviewW; + alias GetSaveFileNamePreview = GetSaveFileNamePreviewW; } else { // Unicode - alias GetOpenFileNamePreviewA GetOpenFileNamePreview; - alias GetSaveFileNamePreviewA GetSaveFileNamePreview; + alias GetOpenFileNamePreview = GetOpenFileNamePreviewA; + alias GetSaveFileNamePreview = GetSaveFileNamePreviewA; } diff --git a/runtime/druntime/src/core/sys/windows/winbase.d b/runtime/druntime/src/core/sys/windows/winbase.d index 2c2905b6352..0a5a4c8a511 100644 --- a/runtime/druntime/src/core/sys/windows/winbase.d +++ b/runtime/druntime/src/core/sys/windows/winbase.d @@ -154,7 +154,7 @@ struct COMMPROP { WCHAR* wcProvChar() return { return &_wcProvChar; } } -alias COMMPROP* LPCOMMPROP; +alias LPCOMMPROP = COMMPROP*; // ---------- @@ -907,7 +907,7 @@ struct FILETIME { DWORD dwLowDateTime; DWORD dwHighDateTime; } -alias FILETIME* PFILETIME, LPFILETIME; +alias PFILETIME = FILETIME*, LPFILETIME = FILETIME*; struct BY_HANDLE_FILE_INFORMATION { DWORD dwFileAttributes; @@ -921,7 +921,7 @@ struct BY_HANDLE_FILE_INFORMATION { DWORD nFileIndexHigh; DWORD nFileIndexLow; } -alias BY_HANDLE_FILE_INFORMATION* LPBY_HANDLE_FILE_INFORMATION; +alias LPBY_HANDLE_FILE_INFORMATION = BY_HANDLE_FILE_INFORMATION*; struct DCB { DWORD DCBlength = DCB.sizeof; @@ -984,7 +984,7 @@ struct DCB { char EvtChar = 0; WORD wReserved1; } -alias DCB* LPDCB; +alias LPDCB = DCB*; struct COMMCONFIG { DWORD dwSize = COMMCONFIG.sizeof; @@ -998,7 +998,7 @@ struct COMMCONFIG { WCHAR* wcProviderData() return { return &_wcProviderData; } } -alias COMMCONFIG* LPCOMMCONFIG; +alias LPCOMMCONFIG = COMMCONFIG*; struct COMMTIMEOUTS { DWORD ReadIntervalTimeout; @@ -1007,7 +1007,7 @@ struct COMMTIMEOUTS { DWORD WriteTotalTimeoutMultiplier; DWORD WriteTotalTimeoutConstant; } -alias COMMTIMEOUTS* LPCOMMTIMEOUTS; +alias LPCOMMTIMEOUTS = COMMTIMEOUTS*; struct COMSTAT { /+ @@ -1040,7 +1040,7 @@ struct COMSTAT { DWORD cbInQue; DWORD cbOutQue; } -alias COMSTAT* LPCOMSTAT; +alias LPCOMSTAT = COMSTAT*; struct CREATE_PROCESS_DEBUG_INFO { HANDLE hFile; @@ -1054,30 +1054,30 @@ struct CREATE_PROCESS_DEBUG_INFO { LPVOID lpImageName; WORD fUnicode; } -alias CREATE_PROCESS_DEBUG_INFO* LPCREATE_PROCESS_DEBUG_INFO; +alias LPCREATE_PROCESS_DEBUG_INFO = CREATE_PROCESS_DEBUG_INFO*; struct CREATE_THREAD_DEBUG_INFO { HANDLE hThread; LPVOID lpThreadLocalBase; LPTHREAD_START_ROUTINE lpStartAddress; } -alias CREATE_THREAD_DEBUG_INFO* LPCREATE_THREAD_DEBUG_INFO; +alias LPCREATE_THREAD_DEBUG_INFO = CREATE_THREAD_DEBUG_INFO*; struct EXCEPTION_DEBUG_INFO { EXCEPTION_RECORD ExceptionRecord; DWORD dwFirstChance; } -alias EXCEPTION_DEBUG_INFO* LPEXCEPTION_DEBUG_INFO; +alias LPEXCEPTION_DEBUG_INFO = EXCEPTION_DEBUG_INFO*; struct EXIT_THREAD_DEBUG_INFO { DWORD dwExitCode; } -alias EXIT_THREAD_DEBUG_INFO* LPEXIT_THREAD_DEBUG_INFO; +alias LPEXIT_THREAD_DEBUG_INFO = EXIT_THREAD_DEBUG_INFO*; struct EXIT_PROCESS_DEBUG_INFO { DWORD dwExitCode; } -alias EXIT_PROCESS_DEBUG_INFO* LPEXIT_PROCESS_DEBUG_INFO; +alias LPEXIT_PROCESS_DEBUG_INFO = EXIT_PROCESS_DEBUG_INFO*; struct LOAD_DLL_DEBUG_INFO { HANDLE hFile; @@ -1087,25 +1087,25 @@ struct LOAD_DLL_DEBUG_INFO { LPVOID lpImageName; WORD fUnicode; } -alias LOAD_DLL_DEBUG_INFO* LPLOAD_DLL_DEBUG_INFO; +alias LPLOAD_DLL_DEBUG_INFO = LOAD_DLL_DEBUG_INFO*; struct UNLOAD_DLL_DEBUG_INFO { LPVOID lpBaseOfDll; } -alias UNLOAD_DLL_DEBUG_INFO* LPUNLOAD_DLL_DEBUG_INFO; +alias LPUNLOAD_DLL_DEBUG_INFO = UNLOAD_DLL_DEBUG_INFO*; struct OUTPUT_DEBUG_STRING_INFO { LPSTR lpDebugStringData; WORD fUnicode; WORD nDebugStringLength; } -alias OUTPUT_DEBUG_STRING_INFO* LPOUTPUT_DEBUG_STRING_INFO; +alias LPOUTPUT_DEBUG_STRING_INFO = OUTPUT_DEBUG_STRING_INFO*; struct RIP_INFO { DWORD dwError; DWORD dwType; } -alias RIP_INFO* LPRIP_INFO; +alias LPRIP_INFO = RIP_INFO*; struct DEBUG_EVENT { DWORD dwDebugEventCode; @@ -1123,7 +1123,7 @@ struct DEBUG_EVENT { RIP_INFO RipInfo; } } -alias DEBUG_EVENT* LPDEBUG_EVENT; +alias LPDEBUG_EVENT = DEBUG_EVENT*; struct OVERLAPPED { ULONG_PTR Internal; @@ -1137,7 +1137,7 @@ struct OVERLAPPED { } HANDLE hEvent; } -alias OVERLAPPED* POVERLAPPED, LPOVERLAPPED; +alias POVERLAPPED = OVERLAPPED*, LPOVERLAPPED = OVERLAPPED*; struct STARTUPINFOA { DWORD cb = STARTUPINFOA.sizeof; @@ -1159,7 +1159,7 @@ struct STARTUPINFOA { HANDLE hStdOutput; HANDLE hStdError; } -alias STARTUPINFOA* LPSTARTUPINFOA; +alias LPSTARTUPINFOA = STARTUPINFOA*; struct STARTUPINFOW { DWORD cb = STARTUPINFOW.sizeof; @@ -1181,8 +1181,8 @@ struct STARTUPINFOW { HANDLE hStdOutput; HANDLE hStdError; } -alias STARTUPINFOW STARTUPINFO_W; -alias STARTUPINFOW* LPSTARTUPINFOW, LPSTARTUPINFO_W; +alias STARTUPINFO_W = STARTUPINFOW; +alias LPSTARTUPINFOW = STARTUPINFOW*, LPSTARTUPINFO_W = STARTUPINFOW*; struct PROCESS_INFORMATION { HANDLE hProcess; @@ -1190,7 +1190,7 @@ struct PROCESS_INFORMATION { DWORD dwProcessId; DWORD dwThreadId; } -alias PROCESS_INFORMATION* PPROCESS_INFORMATION, LPPROCESS_INFORMATION; +alias PPROCESS_INFORMATION = PROCESS_INFORMATION*, LPPROCESS_INFORMATION = PROCESS_INFORMATION*; /* struct CRITICAL_SECTION_DEBUG { @@ -1216,10 +1216,10 @@ alias CRITICAL_SECTION* PCRITICAL_SECTION, LPCRITICAL_SECTION; */ alias CRITICAL_SECTION_DEBUG = RTL_CRITICAL_SECTION_DEBUG; -alias CRITICAL_SECTION_DEBUG* PCRITICAL_SECTION_DEBUG; +alias PCRITICAL_SECTION_DEBUG = CRITICAL_SECTION_DEBUG*; alias CRITICAL_SECTION = RTL_CRITICAL_SECTION; -alias CRITICAL_SECTION* PCRITICAL_SECTION, LPCRITICAL_SECTION; +alias PCRITICAL_SECTION = CRITICAL_SECTION*, LPCRITICAL_SECTION = CRITICAL_SECTION*; struct SYSTEMTIME { WORD wYear; @@ -1231,7 +1231,7 @@ struct SYSTEMTIME { WORD wSecond; WORD wMilliseconds; } -alias SYSTEMTIME* LPSYSTEMTIME; +alias LPSYSTEMTIME = SYSTEMTIME*; struct WIN32_FILE_ATTRIBUTE_DATA { DWORD dwFileAttributes; @@ -1241,7 +1241,7 @@ struct WIN32_FILE_ATTRIBUTE_DATA { DWORD nFileSizeHigh; DWORD nFileSizeLow; } -alias WIN32_FILE_ATTRIBUTE_DATA* LPWIN32_FILE_ATTRIBUTE_DATA; +alias LPWIN32_FILE_ATTRIBUTE_DATA = WIN32_FILE_ATTRIBUTE_DATA*; struct WIN32_FIND_DATAA { DWORD dwFileAttributes; @@ -1261,7 +1261,7 @@ struct WIN32_FIND_DATAA { CHAR[14] cAlternateFileName = 0; // #endif } -alias WIN32_FIND_DATAA* PWIN32_FIND_DATAA, LPWIN32_FIND_DATAA; +alias PWIN32_FIND_DATAA = WIN32_FIND_DATAA*, LPWIN32_FIND_DATAA = WIN32_FIND_DATAA*; struct WIN32_FIND_DATAW { DWORD dwFileAttributes; @@ -1281,7 +1281,7 @@ struct WIN32_FIND_DATAW { WCHAR[14] cAlternateFileName = 0; // #endif } -alias WIN32_FIND_DATAW* PWIN32_FIND_DATAW, LPWIN32_FIND_DATAW; +alias PWIN32_FIND_DATAW = WIN32_FIND_DATAW*, LPWIN32_FIND_DATAW = WIN32_FIND_DATAW*; struct WIN32_STREAM_ID { DWORD dwStreamId; @@ -1292,7 +1292,7 @@ struct WIN32_STREAM_ID { WCHAR* cStreamName() return { return &_cStreamName; } } -alias WIN32_STREAM_ID* LPWIN32_STREAM_ID; +alias LPWIN32_STREAM_ID = WIN32_STREAM_ID*; static if (_WIN32_WINNT >= 0x601) { enum FINDEX_INFO_LEVELS { @@ -1324,14 +1324,14 @@ struct HW_PROFILE_INFOA { CHAR[HW_PROFILE_GUIDLEN] szHwProfileGuid = 0; CHAR[MAX_PROFILE_LEN] szHwProfileName = 0; } -alias HW_PROFILE_INFOA* LPHW_PROFILE_INFOA; +alias LPHW_PROFILE_INFOA = HW_PROFILE_INFOA*; struct HW_PROFILE_INFOW { DWORD dwDockInfo; WCHAR[HW_PROFILE_GUIDLEN] szHwProfileGuid = 0; WCHAR[MAX_PROFILE_LEN] szHwProfileName = 0; } -alias HW_PROFILE_INFOW* LPHW_PROFILE_INFOW; +alias LPHW_PROFILE_INFOW = HW_PROFILE_INFOW*; /* ??? MSDN documents this only for Windows CE/Mobile, but it's used by * GetFileAttributesEx, which is in desktop Windows. @@ -1404,7 +1404,7 @@ struct SYSTEM_INFO { WORD wProcessorLevel; WORD wProcessorRevision; } -alias SYSTEM_INFO* LPSYSTEM_INFO; +alias LPSYSTEM_INFO = SYSTEM_INFO*; static if (_WIN32_WINNT >= 0x500) { struct SYSTEM_POWER_STATUS { @@ -1415,7 +1415,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD BatteryLifeTime; DWORD BatteryFullLifeTime; } - alias SYSTEM_POWER_STATUS* LPSYSTEM_POWER_STATUS; + alias LPSYSTEM_POWER_STATUS = SYSTEM_POWER_STATUS*; } struct TIME_ZONE_INFORMATION { @@ -1427,7 +1427,7 @@ struct TIME_ZONE_INFORMATION { SYSTEMTIME DaylightDate; LONG DaylightBias; } -alias TIME_ZONE_INFORMATION* LPTIME_ZONE_INFORMATION; +alias LPTIME_ZONE_INFORMATION = TIME_ZONE_INFORMATION*; // Does not exist in Windows headers, only MSDN // documentation (for TIME_ZONE_INFORMATION). @@ -1452,7 +1452,7 @@ struct MEMORYSTATUS { SIZE_T dwTotalVirtual; SIZE_T dwAvailVirtual; } -alias MEMORYSTATUS* LPMEMORYSTATUS; +alias LPMEMORYSTATUS = MEMORYSTATUS*; static if (_WIN32_WINNT >= 0x500) { struct MEMORYSTATUSEX { @@ -1466,7 +1466,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORDLONG ullAvailVirtual; DWORDLONG ullAvailExtendedVirtual; } - alias MEMORYSTATUSEX* LPMEMORYSTATUSEX; + alias LPMEMORYSTATUSEX = MEMORYSTATUSEX*; } struct LDT_ENTRY { @@ -1520,7 +1520,7 @@ struct LDT_ENTRY { } +/ } -alias LDT_ENTRY* PLDT_ENTRY, LPLDT_ENTRY; +alias PLDT_ENTRY = LDT_ENTRY*, LPLDT_ENTRY = LDT_ENTRY*; /* As with the other memory management functions and structures, MSDN's * Windows version info shall be taken with a cup of salt. @@ -1546,7 +1546,7 @@ struct PROCESS_HEAP_ENTRY { _Region Region; } } -alias PROCESS_HEAP_ENTRY* LPPROCESS_HEAP_ENTRY; +alias LPPROCESS_HEAP_ENTRY = PROCESS_HEAP_ENTRY*; struct OFSTRUCT { BYTE cBytes = OFSTRUCT.sizeof; @@ -1556,7 +1556,7 @@ struct OFSTRUCT { WORD Reserved2; CHAR[128] szPathName = 0; // const OFS_MAXPATHNAME = 128; } -alias OFSTRUCT* LPOFSTRUCT, POFSTRUCT; +alias LPOFSTRUCT = OFSTRUCT*, POFSTRUCT = OFSTRUCT*; /* ??? MSDN documents this only for Windows CE, but it's used by * ImageGetCertificateData, which is in desktop Windows. @@ -1569,7 +1569,7 @@ struct WIN_CERTIFICATE { BYTE* bCertificate() return { return &_bCertificate; } } -alias WIN_CERTIFICATE* LPWIN_CERTIFICATE; +alias LPWIN_CERTIFICATE = WIN_CERTIFICATE*; static if (_WIN32_WINNT >= 0x500) { enum COMPUTER_NAME_FORMAT { @@ -1597,8 +1597,8 @@ static if (_WIN32_WINNT >= 0x501) { LPCSTR lpApplicationName; HMODULE hModule; } - alias ACTCTXA* PACTCTXA; - alias const(ACTCTXA)* PCACTCTXA; + alias PACTCTXA = ACTCTXA*; + alias PCACTCTXA = const(ACTCTXA)*; struct ACTCTXW { ULONG cbSize = this.sizeof; @@ -1611,8 +1611,8 @@ static if (_WIN32_WINNT >= 0x501) { LPCWSTR lpApplicationName; HMODULE hModule; } - alias ACTCTXW* PACTCTXW; - alias const(ACTCTXW)* PCACTCTXW; + alias PACTCTXW = ACTCTXW*; + alias PCACTCTXW = const(ACTCTXW)*; struct ACTCTX_SECTION_KEYED_DATA { ULONG cbSize = this.sizeof; @@ -1626,8 +1626,8 @@ static if (_WIN32_WINNT >= 0x501) { HANDLE hActCtx; HANDLE ulAssemblyRosterIndex; } - alias ACTCTX_SECTION_KEYED_DATA* PACTCTX_SECTION_KEYED_DATA; - alias const(ACTCTX_SECTION_KEYED_DATA)* PCACTCTX_SECTION_KEYED_DATA; + alias PACTCTX_SECTION_KEYED_DATA = ACTCTX_SECTION_KEYED_DATA*; + alias PCACTCTX_SECTION_KEYED_DATA = const(ACTCTX_SECTION_KEYED_DATA)*; enum MEMORY_RESOURCE_NOTIFICATION_TYPE { LowMemoryResourceNotification, @@ -1640,7 +1640,7 @@ static if (_WIN32_WINNT >= 0x410) { /* apparently used only by SetThreadExecutionState (Win2000+) * and DDK functions (version compatibility not established) */ - alias DWORD EXECUTION_STATE; + alias EXECUTION_STATE = DWORD; } // CreateSymbolicLink, GetFileInformationByHandleEx @@ -1673,26 +1673,26 @@ static if (_WIN32_WINNT >= 0x600) { // Callbacks extern (Windows) { - alias DWORD function(LPVOID) LPTHREAD_START_ROUTINE; - alias DWORD function(LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, - DWORD, DWORD, HANDLE, HANDLE, LPVOID) LPPROGRESS_ROUTINE; - alias void function(PVOID) LPFIBER_START_ROUTINE; - - alias BOOL function(HMODULE, LPCSTR, LPCSTR, WORD, LONG_PTR) ENUMRESLANGPROCA; - alias BOOL function(HMODULE, LPCWSTR, LPCWSTR, WORD, LONG_PTR) ENUMRESLANGPROCW; - alias BOOL function(HMODULE, LPCSTR, LPSTR, LONG_PTR) ENUMRESNAMEPROCA; - alias BOOL function(HMODULE, LPCWSTR, LPWSTR, LONG_PTR) ENUMRESNAMEPROCW; - alias BOOL function(HMODULE, LPSTR, LONG_PTR) ENUMRESTYPEPROCA; - alias BOOL function(HMODULE, LPWSTR, LONG_PTR) ENUMRESTYPEPROCW; - alias void function(DWORD, DWORD, LPOVERLAPPED) LPOVERLAPPED_COMPLETION_ROUTINE; - alias LONG function(LPEXCEPTION_POINTERS) PTOP_LEVEL_EXCEPTION_FILTER; - alias PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER; - - alias void function(ULONG_PTR) PAPCFUNC; - alias void function(PVOID, DWORD, DWORD) PTIMERAPCROUTINE; + alias LPTHREAD_START_ROUTINE = DWORD function(LPVOID); + alias LPPROGRESS_ROUTINE = DWORD function(LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, LARGE_INTEGER, + DWORD, DWORD, HANDLE, HANDLE, LPVOID); + alias LPFIBER_START_ROUTINE = void function(PVOID); + + alias ENUMRESLANGPROCA = BOOL function(HMODULE, LPCSTR, LPCSTR, WORD, LONG_PTR); + alias ENUMRESLANGPROCW = BOOL function(HMODULE, LPCWSTR, LPCWSTR, WORD, LONG_PTR); + alias ENUMRESNAMEPROCA = BOOL function(HMODULE, LPCSTR, LPSTR, LONG_PTR); + alias ENUMRESNAMEPROCW = BOOL function(HMODULE, LPCWSTR, LPWSTR, LONG_PTR); + alias ENUMRESTYPEPROCA = BOOL function(HMODULE, LPSTR, LONG_PTR); + alias ENUMRESTYPEPROCW = BOOL function(HMODULE, LPWSTR, LONG_PTR); + alias LPOVERLAPPED_COMPLETION_ROUTINE = void function(DWORD, DWORD, LPOVERLAPPED); + alias PTOP_LEVEL_EXCEPTION_FILTER = LONG function(LPEXCEPTION_POINTERS); + alias LPTOP_LEVEL_EXCEPTION_FILTER = PTOP_LEVEL_EXCEPTION_FILTER; + + alias PAPCFUNC = void function(ULONG_PTR); + alias PTIMERAPCROUTINE = void function(PVOID, DWORD, DWORD); static if (_WIN32_WINNT >= 0x500) { - alias void function(PVOID, BOOLEAN) WAITORTIMERCALLBACK; + alias WAITORTIMERCALLBACK = void function(PVOID, BOOLEAN); } } @@ -1895,7 +1895,7 @@ WINBASEAPI DWORD WINAPI GetCurrentThreadId(void); */ DWORD GetCurrentThreadId(); - alias GetTickCount GetCurrentTime; + alias GetCurrentTime = GetTickCount; BOOL GetDefaultCommConfigA(LPCSTR, LPCOMMCONFIG, PDWORD); BOOL GetDefaultCommConfigW(LPCWSTR, LPCOMMCONFIG, PDWORD); @@ -2574,368 +2574,368 @@ version (LittleEndian) nothrow @nogc mixin DECLARE_AW!("STARTUPINFO"); version (Unicode) { //alias STARTUPINFOW STARTUPINFO; - alias WIN32_FIND_DATAW WIN32_FIND_DATA; - alias ENUMRESLANGPROCW ENUMRESLANGPROC; - alias ENUMRESNAMEPROCW ENUMRESNAMEPROC; - alias ENUMRESTYPEPROCW ENUMRESTYPEPROC; - alias AddAtomW AddAtom; - alias BeginUpdateResourceW BeginUpdateResource; - alias BuildCommDCBW BuildCommDCB; - alias BuildCommDCBAndTimeoutsW BuildCommDCBAndTimeouts; - alias CallNamedPipeW CallNamedPipe; - alias CommConfigDialogW CommConfigDialog; - alias CopyFileW CopyFile; - alias CopyFileExW CopyFileEx; - alias CreateDirectoryW CreateDirectory; - alias CreateDirectoryExW CreateDirectoryEx; - alias CreateEventW CreateEvent; - alias CreateFileW CreateFile; - alias CreateMailslotW CreateMailslot; - alias CreateMutexW CreateMutex; - alias CreateProcessW CreateProcess; - alias CreateSemaphoreW CreateSemaphore; - alias DeleteFileW DeleteFile; - alias EndUpdateResourceW EndUpdateResource; - alias EnumResourceLanguagesW EnumResourceLanguages; - alias EnumResourceNamesW EnumResourceNames; - alias EnumResourceTypesW EnumResourceTypes; - alias ExpandEnvironmentStringsW ExpandEnvironmentStrings; - alias FatalAppExitW FatalAppExit; - alias FindAtomW FindAtom; - alias FindFirstChangeNotificationW FindFirstChangeNotification; - alias FindFirstFileW FindFirstFile; - alias FindNextFileW FindNextFile; - alias FindResourceW FindResource; - alias FindResourceExW FindResourceEx; - alias FormatMessageW FormatMessage; - alias FreeEnvironmentStringsW FreeEnvironmentStrings; - alias GetAtomNameW GetAtomName; - alias GetCommandLineW GetCommandLine; - alias GetComputerNameW GetComputerName; - alias GetCurrentDirectoryW GetCurrentDirectory; - alias GetDefaultCommConfigW GetDefaultCommConfig; - alias GetDiskFreeSpaceW GetDiskFreeSpace; - alias GetDiskFreeSpaceExW GetDiskFreeSpaceEx; - alias GetDriveTypeW GetDriveType; - alias GetEnvironmentStringsW GetEnvironmentStrings; - alias GetEnvironmentVariableW GetEnvironmentVariable; - alias GetFileAttributesW GetFileAttributes; - alias GetFullPathNameW GetFullPathName; - alias GetLogicalDriveStringsW GetLogicalDriveStrings; - alias GetModuleFileNameW GetModuleFileName; - alias GetModuleHandleW GetModuleHandle; - alias GetNamedPipeHandleStateW GetNamedPipeHandleState; - alias GetPrivateProfileIntW GetPrivateProfileInt; - alias GetPrivateProfileSectionW GetPrivateProfileSection; - alias GetPrivateProfileSectionNamesW GetPrivateProfileSectionNames; - alias GetPrivateProfileStringW GetPrivateProfileString; - alias GetPrivateProfileStructW GetPrivateProfileStruct; - alias GetProfileIntW GetProfileInt; - alias GetProfileSectionW GetProfileSection; - alias GetProfileStringW GetProfileString; - alias GetShortPathNameW GetShortPathName; - alias GetStartupInfoW GetStartupInfo; - alias GetSystemDirectoryW GetSystemDirectory; - alias GetTempFileNameW GetTempFileName; - alias GetTempPathW GetTempPath; - alias GetUserNameW GetUserName; - alias GetVersionExW GetVersionEx; - alias GetVolumeInformationW GetVolumeInformation; - alias GetWindowsDirectoryW GetWindowsDirectory; - alias GlobalAddAtomW GlobalAddAtom; - alias GlobalFindAtomW GlobalFindAtom; - alias GlobalGetAtomNameW GlobalGetAtomName; - alias IsBadStringPtrW IsBadStringPtr; - alias LoadLibraryW LoadLibrary; - alias LoadLibraryExW LoadLibraryEx; - alias lstrcatW lstrcat; - alias lstrcmpW lstrcmp; - alias lstrcmpiW lstrcmpi; - alias lstrcpyW lstrcpy; - alias lstrcpynW lstrcpyn; - alias lstrlenW lstrlen; - alias MoveFileW MoveFile; - alias OpenEventW OpenEvent; - alias OpenMutexW OpenMutex; - alias OpenSemaphoreW OpenSemaphore; - alias OutputDebugStringW OutputDebugString; - alias RemoveDirectoryW RemoveDirectory; - alias SearchPathW SearchPath; - alias SetComputerNameW SetComputerName; - alias SetCurrentDirectoryW SetCurrentDirectory; - alias SetDefaultCommConfigW SetDefaultCommConfig; - alias SetEnvironmentVariableW SetEnvironmentVariable; - alias SetFileAttributesW SetFileAttributes; - alias SetVolumeLabelW SetVolumeLabel; - alias WaitNamedPipeW WaitNamedPipe; - alias WritePrivateProfileSectionW WritePrivateProfileSection; - alias WritePrivateProfileStringW WritePrivateProfileString; - alias WritePrivateProfileStructW WritePrivateProfileStruct; - alias WriteProfileSectionW WriteProfileSection; - alias WriteProfileStringW WriteProfileString; - alias CreateWaitableTimerW CreateWaitableTimer; - alias GetFileAttributesExW GetFileAttributesEx; - alias GetLongPathNameW GetLongPathName; - alias QueryDosDeviceW QueryDosDevice; - - alias HW_PROFILE_INFOW HW_PROFILE_INFO; - alias AccessCheckAndAuditAlarmW AccessCheckAndAuditAlarm; - alias BackupEventLogW BackupEventLog; - alias ClearEventLogW ClearEventLog; - alias CreateNamedPipeW CreateNamedPipe; - alias CreateProcessAsUserW CreateProcessAsUser; - alias DefineDosDeviceW DefineDosDevice; - alias FindFirstFileExW FindFirstFileEx; - alias GetBinaryTypeW GetBinaryType; - alias GetCompressedFileSizeW GetCompressedFileSize; - alias GetFileSecurityW GetFileSecurity; - alias LogonUserW LogonUser; - alias LookupAccountNameW LookupAccountName; - alias LookupAccountSidW LookupAccountSid; - alias LookupPrivilegeDisplayNameW LookupPrivilegeDisplayName; - alias LookupPrivilegeNameW LookupPrivilegeName; - alias LookupPrivilegeValueW LookupPrivilegeValue; - alias MoveFileExW MoveFileEx; - alias ObjectCloseAuditAlarmW ObjectCloseAuditAlarm; - alias ObjectDeleteAuditAlarmW ObjectDeleteAuditAlarm; - alias ObjectOpenAuditAlarmW ObjectOpenAuditAlarm; - alias ObjectPrivilegeAuditAlarmW ObjectPrivilegeAuditAlarm; - alias OpenBackupEventLogW OpenBackupEventLog; - alias OpenEventLogW OpenEventLog; - alias PrivilegedServiceAuditAlarmW PrivilegedServiceAuditAlarm; - alias ReadEventLogW ReadEventLog; - alias RegisterEventSourceW RegisterEventSource; - alias ReportEventW ReportEvent; - alias SetFileSecurityW SetFileSecurity; - alias UpdateResourceW UpdateResource; + alias WIN32_FIND_DATA = WIN32_FIND_DATAW; + alias ENUMRESLANGPROC = ENUMRESLANGPROCW; + alias ENUMRESNAMEPROC = ENUMRESNAMEPROCW; + alias ENUMRESTYPEPROC = ENUMRESTYPEPROCW; + alias AddAtom = AddAtomW; + alias BeginUpdateResource = BeginUpdateResourceW; + alias BuildCommDCB = BuildCommDCBW; + alias BuildCommDCBAndTimeouts = BuildCommDCBAndTimeoutsW; + alias CallNamedPipe = CallNamedPipeW; + alias CommConfigDialog = CommConfigDialogW; + alias CopyFile = CopyFileW; + alias CopyFileEx = CopyFileExW; + alias CreateDirectory = CreateDirectoryW; + alias CreateDirectoryEx = CreateDirectoryExW; + alias CreateEvent = CreateEventW; + alias CreateFile = CreateFileW; + alias CreateMailslot = CreateMailslotW; + alias CreateMutex = CreateMutexW; + alias CreateProcess = CreateProcessW; + alias CreateSemaphore = CreateSemaphoreW; + alias DeleteFile = DeleteFileW; + alias EndUpdateResource = EndUpdateResourceW; + alias EnumResourceLanguages = EnumResourceLanguagesW; + alias EnumResourceNames = EnumResourceNamesW; + alias EnumResourceTypes = EnumResourceTypesW; + alias ExpandEnvironmentStrings = ExpandEnvironmentStringsW; + alias FatalAppExit = FatalAppExitW; + alias FindAtom = FindAtomW; + alias FindFirstChangeNotification = FindFirstChangeNotificationW; + alias FindFirstFile = FindFirstFileW; + alias FindNextFile = FindNextFileW; + alias FindResource = FindResourceW; + alias FindResourceEx = FindResourceExW; + alias FormatMessage = FormatMessageW; + alias FreeEnvironmentStrings = FreeEnvironmentStringsW; + alias GetAtomName = GetAtomNameW; + alias GetCommandLine = GetCommandLineW; + alias GetComputerName = GetComputerNameW; + alias GetCurrentDirectory = GetCurrentDirectoryW; + alias GetDefaultCommConfig = GetDefaultCommConfigW; + alias GetDiskFreeSpace = GetDiskFreeSpaceW; + alias GetDiskFreeSpaceEx = GetDiskFreeSpaceExW; + alias GetDriveType = GetDriveTypeW; + alias GetEnvironmentStrings = GetEnvironmentStringsW; + alias GetEnvironmentVariable = GetEnvironmentVariableW; + alias GetFileAttributes = GetFileAttributesW; + alias GetFullPathName = GetFullPathNameW; + alias GetLogicalDriveStrings = GetLogicalDriveStringsW; + alias GetModuleFileName = GetModuleFileNameW; + alias GetModuleHandle = GetModuleHandleW; + alias GetNamedPipeHandleState = GetNamedPipeHandleStateW; + alias GetPrivateProfileInt = GetPrivateProfileIntW; + alias GetPrivateProfileSection = GetPrivateProfileSectionW; + alias GetPrivateProfileSectionNames = GetPrivateProfileSectionNamesW; + alias GetPrivateProfileString = GetPrivateProfileStringW; + alias GetPrivateProfileStruct = GetPrivateProfileStructW; + alias GetProfileInt = GetProfileIntW; + alias GetProfileSection = GetProfileSectionW; + alias GetProfileString = GetProfileStringW; + alias GetShortPathName = GetShortPathNameW; + alias GetStartupInfo = GetStartupInfoW; + alias GetSystemDirectory = GetSystemDirectoryW; + alias GetTempFileName = GetTempFileNameW; + alias GetTempPath = GetTempPathW; + alias GetUserName = GetUserNameW; + alias GetVersionEx = GetVersionExW; + alias GetVolumeInformation = GetVolumeInformationW; + alias GetWindowsDirectory = GetWindowsDirectoryW; + alias GlobalAddAtom = GlobalAddAtomW; + alias GlobalFindAtom = GlobalFindAtomW; + alias GlobalGetAtomName = GlobalGetAtomNameW; + alias IsBadStringPtr = IsBadStringPtrW; + alias LoadLibrary = LoadLibraryW; + alias LoadLibraryEx = LoadLibraryExW; + alias lstrcat = lstrcatW; + alias lstrcmp = lstrcmpW; + alias lstrcmpi = lstrcmpiW; + alias lstrcpy = lstrcpyW; + alias lstrcpyn = lstrcpynW; + alias lstrlen = lstrlenW; + alias MoveFile = MoveFileW; + alias OpenEvent = OpenEventW; + alias OpenMutex = OpenMutexW; + alias OpenSemaphore = OpenSemaphoreW; + alias OutputDebugString = OutputDebugStringW; + alias RemoveDirectory = RemoveDirectoryW; + alias SearchPath = SearchPathW; + alias SetComputerName = SetComputerNameW; + alias SetCurrentDirectory = SetCurrentDirectoryW; + alias SetDefaultCommConfig = SetDefaultCommConfigW; + alias SetEnvironmentVariable = SetEnvironmentVariableW; + alias SetFileAttributes = SetFileAttributesW; + alias SetVolumeLabel = SetVolumeLabelW; + alias WaitNamedPipe = WaitNamedPipeW; + alias WritePrivateProfileSection = WritePrivateProfileSectionW; + alias WritePrivateProfileString = WritePrivateProfileStringW; + alias WritePrivateProfileStruct = WritePrivateProfileStructW; + alias WriteProfileSection = WriteProfileSectionW; + alias WriteProfileString = WriteProfileStringW; + alias CreateWaitableTimer = CreateWaitableTimerW; + alias GetFileAttributesEx = GetFileAttributesExW; + alias GetLongPathName = GetLongPathNameW; + alias QueryDosDevice = QueryDosDeviceW; + + alias HW_PROFILE_INFO = HW_PROFILE_INFOW; + alias AccessCheckAndAuditAlarm = AccessCheckAndAuditAlarmW; + alias BackupEventLog = BackupEventLogW; + alias ClearEventLog = ClearEventLogW; + alias CreateNamedPipe = CreateNamedPipeW; + alias CreateProcessAsUser = CreateProcessAsUserW; + alias DefineDosDevice = DefineDosDeviceW; + alias FindFirstFileEx = FindFirstFileExW; + alias GetBinaryType = GetBinaryTypeW; + alias GetCompressedFileSize = GetCompressedFileSizeW; + alias GetFileSecurity = GetFileSecurityW; + alias LogonUser = LogonUserW; + alias LookupAccountName = LookupAccountNameW; + alias LookupAccountSid = LookupAccountSidW; + alias LookupPrivilegeDisplayName = LookupPrivilegeDisplayNameW; + alias LookupPrivilegeName = LookupPrivilegeNameW; + alias LookupPrivilegeValue = LookupPrivilegeValueW; + alias MoveFileEx = MoveFileExW; + alias ObjectCloseAuditAlarm = ObjectCloseAuditAlarmW; + alias ObjectDeleteAuditAlarm = ObjectDeleteAuditAlarmW; + alias ObjectOpenAuditAlarm = ObjectOpenAuditAlarmW; + alias ObjectPrivilegeAuditAlarm = ObjectPrivilegeAuditAlarmW; + alias OpenBackupEventLog = OpenBackupEventLogW; + alias OpenEventLog = OpenEventLogW; + alias PrivilegedServiceAuditAlarm = PrivilegedServiceAuditAlarmW; + alias ReadEventLog = ReadEventLogW; + alias RegisterEventSource = RegisterEventSourceW; + alias ReportEvent = ReportEventW; + alias SetFileSecurity = SetFileSecurityW; + alias UpdateResource = UpdateResourceW; static if (_WIN32_WINNT >= 0x500) { - alias CreateFileMappingW CreateFileMapping; - alias CreateHardLinkW CreateHardLink; - alias CreateJobObjectW CreateJobObject; - alias DeleteVolumeMountPointW DeleteVolumeMountPoint; - alias DnsHostnameToComputerNameW DnsHostnameToComputerName; - alias EncryptFileW EncryptFile; - alias FileEncryptionStatusW FileEncryptionStatus; - alias FindFirstVolumeW FindFirstVolume; - alias FindFirstVolumeMountPointW FindFirstVolumeMountPoint; - alias FindNextVolumeW FindNextVolume; - alias FindNextVolumeMountPointW FindNextVolumeMountPoint; - alias GetModuleHandleExW GetModuleHandleEx; - alias GetSystemWindowsDirectoryW GetSystemWindowsDirectory; - alias GetVolumeNameForVolumeMountPointW GetVolumeNameForVolumeMountPoint; - alias GetVolumePathNameW GetVolumePathName; - alias OpenFileMappingW OpenFileMapping; - alias ReplaceFileW ReplaceFile; - alias SetVolumeMountPointW SetVolumeMountPoint; - alias VerifyVersionInfoW VerifyVersionInfo; + alias CreateFileMapping = CreateFileMappingW; + alias CreateHardLink = CreateHardLinkW; + alias CreateJobObject = CreateJobObjectW; + alias DeleteVolumeMountPoint = DeleteVolumeMountPointW; + alias DnsHostnameToComputerName = DnsHostnameToComputerNameW; + alias EncryptFile = EncryptFileW; + alias FileEncryptionStatus = FileEncryptionStatusW; + alias FindFirstVolume = FindFirstVolumeW; + alias FindFirstVolumeMountPoint = FindFirstVolumeMountPointW; + alias FindNextVolume = FindNextVolumeW; + alias FindNextVolumeMountPoint = FindNextVolumeMountPointW; + alias GetModuleHandleEx = GetModuleHandleExW; + alias GetSystemWindowsDirectory = GetSystemWindowsDirectoryW; + alias GetVolumeNameForVolumeMountPoint = GetVolumeNameForVolumeMountPointW; + alias GetVolumePathName = GetVolumePathNameW; + alias OpenFileMapping = OpenFileMappingW; + alias ReplaceFile = ReplaceFileW; + alias SetVolumeMountPoint = SetVolumeMountPointW; + alias VerifyVersionInfo = VerifyVersionInfoW; } static if (_WIN32_WINNT >= 0x501) { - alias ACTCTXW ACTCTX; - alias CheckNameLegalDOS8Dot3W CheckNameLegalDOS8Dot3; - alias CreateActCtxW CreateActCtx; - alias FindActCtxSectionStringW FindActCtxSectionString; - alias GetSystemWow64DirectoryW GetSystemWow64Directory; - alias GetVolumePathNamesForVolumeNameW GetVolumePathNamesForVolumeName; - alias SetFileShortNameW SetFileShortName; + alias ACTCTX = ACTCTXW; + alias CheckNameLegalDOS8Dot3 = CheckNameLegalDOS8Dot3W; + alias CreateActCtx = CreateActCtxW; + alias FindActCtxSectionString = FindActCtxSectionStringW; + alias GetSystemWow64Directory = GetSystemWow64DirectoryW; + alias GetVolumePathNamesForVolumeName = GetVolumePathNamesForVolumeNameW; + alias SetFileShortName = SetFileShortNameW; } static if (_WIN32_WINNT >= 0x502) { - alias SetFirmwareEnvironmentVariableW SetFirmwareEnvironmentVariable; - alias SetDllDirectoryW SetDllDirectory; - alias GetDllDirectoryW GetDllDirectory; + alias SetFirmwareEnvironmentVariable = SetFirmwareEnvironmentVariableW; + alias SetDllDirectory = SetDllDirectoryW; + alias GetDllDirectory = GetDllDirectoryW; } static if (_WIN32_WINNT >= 0x600) { - alias CreateSymbolicLinkW CreateSymbolicLink; + alias CreateSymbolicLink = CreateSymbolicLinkW; } } else { //alias STARTUPINFOA STARTUPINFO; - alias WIN32_FIND_DATAA WIN32_FIND_DATA; - alias ENUMRESLANGPROCW ENUMRESLANGPROC; - alias ENUMRESNAMEPROCW ENUMRESNAMEPROC; - alias ENUMRESTYPEPROCW ENUMRESTYPEPROC; - alias AddAtomA AddAtom; - alias BeginUpdateResourceA BeginUpdateResource; - alias BuildCommDCBA BuildCommDCB; - alias BuildCommDCBAndTimeoutsA BuildCommDCBAndTimeouts; - alias CallNamedPipeA CallNamedPipe; - alias CommConfigDialogA CommConfigDialog; - alias CopyFileA CopyFile; - alias CopyFileExA CopyFileEx; - alias CreateDirectoryA CreateDirectory; - alias CreateDirectoryExA CreateDirectoryEx; - alias CreateEventA CreateEvent; - alias CreateFileA CreateFile; - alias CreateMailslotA CreateMailslot; - alias CreateMutexA CreateMutex; - alias CreateProcessA CreateProcess; - alias CreateSemaphoreA CreateSemaphore; - alias DeleteFileA DeleteFile; - alias EndUpdateResourceA EndUpdateResource; - alias EnumResourceLanguagesA EnumResourceLanguages; - alias EnumResourceNamesA EnumResourceNames; - alias EnumResourceTypesA EnumResourceTypes; - alias ExpandEnvironmentStringsA ExpandEnvironmentStrings; - alias FatalAppExitA FatalAppExit; - alias FindAtomA FindAtom; - alias FindFirstChangeNotificationA FindFirstChangeNotification; - alias FindFirstFileA FindFirstFile; - alias FindNextFileA FindNextFile; - alias FindResourceA FindResource; - alias FindResourceExA FindResourceEx; - alias FormatMessageA FormatMessage; - alias FreeEnvironmentStringsA FreeEnvironmentStrings; - alias GetAtomNameA GetAtomName; - alias GetCommandLineA GetCommandLine; - alias GetComputerNameA GetComputerName; - alias GetCurrentDirectoryA GetCurrentDirectory; - alias GetDefaultCommConfigA GetDefaultCommConfig; - alias GetDiskFreeSpaceA GetDiskFreeSpace; - alias GetDiskFreeSpaceExA GetDiskFreeSpaceEx; - alias GetDriveTypeA GetDriveType; - alias GetEnvironmentStringsA GetEnvironmentStrings; - alias GetEnvironmentVariableA GetEnvironmentVariable; - alias GetFileAttributesA GetFileAttributes; - alias GetFullPathNameA GetFullPathName; - alias GetLogicalDriveStringsA GetLogicalDriveStrings; - alias GetNamedPipeHandleStateA GetNamedPipeHandleState; - alias GetModuleHandleA GetModuleHandle; - alias GetModuleFileNameA GetModuleFileName; - alias GetPrivateProfileIntA GetPrivateProfileInt; - alias GetPrivateProfileSectionA GetPrivateProfileSection; - alias GetPrivateProfileSectionNamesA GetPrivateProfileSectionNames; - alias GetPrivateProfileStringA GetPrivateProfileString; - alias GetPrivateProfileStructA GetPrivateProfileStruct; - alias GetProfileIntA GetProfileInt; - alias GetProfileSectionA GetProfileSection; - alias GetProfileStringA GetProfileString; - alias GetShortPathNameA GetShortPathName; - alias GetStartupInfoA GetStartupInfo; - alias GetSystemDirectoryA GetSystemDirectory; - alias GetTempFileNameA GetTempFileName; - alias GetTempPathA GetTempPath; - alias GetUserNameA GetUserName; - alias GetVersionExA GetVersionEx; - alias GetVolumeInformationA GetVolumeInformation; - alias GetWindowsDirectoryA GetWindowsDirectory; - alias GlobalAddAtomA GlobalAddAtom; - alias GlobalFindAtomA GlobalFindAtom; - alias GlobalGetAtomNameA GlobalGetAtomName; - alias IsBadStringPtrA IsBadStringPtr; - alias LoadLibraryA LoadLibrary; - alias LoadLibraryExA LoadLibraryEx; - alias lstrcatA lstrcat; - alias lstrcmpA lstrcmp; - alias lstrcmpiA lstrcmpi; - alias lstrcpyA lstrcpy; - alias lstrcpynA lstrcpyn; - alias lstrlenA lstrlen; - alias MoveFileA MoveFile; - alias OpenEventA OpenEvent; - alias OpenMutexA OpenMutex; - alias OpenSemaphoreA OpenSemaphore; - alias OutputDebugStringA OutputDebugString; - alias RemoveDirectoryA RemoveDirectory; - alias SearchPathA SearchPath; - alias SetComputerNameA SetComputerName; - alias SetCurrentDirectoryA SetCurrentDirectory; - alias SetDefaultCommConfigA SetDefaultCommConfig; - alias SetEnvironmentVariableA SetEnvironmentVariable; - alias SetFileAttributesA SetFileAttributes; - alias SetVolumeLabelA SetVolumeLabel; - alias WaitNamedPipeA WaitNamedPipe; - alias WritePrivateProfileSectionA WritePrivateProfileSection; - alias WritePrivateProfileStringA WritePrivateProfileString; - alias WritePrivateProfileStructA WritePrivateProfileStruct; - alias WriteProfileSectionA WriteProfileSection; - alias WriteProfileStringA WriteProfileString; - alias CreateWaitableTimerA CreateWaitableTimer; - alias GetFileAttributesExA GetFileAttributesEx; - alias GetLongPathNameA GetLongPathName; - alias QueryDosDeviceA QueryDosDevice; - - alias HW_PROFILE_INFOA HW_PROFILE_INFO; - alias AccessCheckAndAuditAlarmA AccessCheckAndAuditAlarm; - alias BackupEventLogA BackupEventLog; - alias ClearEventLogA ClearEventLog; - alias CreateNamedPipeA CreateNamedPipe; - alias CreateProcessAsUserA CreateProcessAsUser; - alias DefineDosDeviceA DefineDosDevice; - alias FindFirstFileExA FindFirstFileEx; - alias GetBinaryTypeA GetBinaryType; - alias GetCompressedFileSizeA GetCompressedFileSize; - alias GetFileSecurityA GetFileSecurity; - alias LogonUserA LogonUser; - alias LookupAccountNameA LookupAccountName; - alias LookupAccountSidA LookupAccountSid; - alias LookupPrivilegeDisplayNameA LookupPrivilegeDisplayName; - alias LookupPrivilegeNameA LookupPrivilegeName; - alias LookupPrivilegeValueA LookupPrivilegeValue; - alias MoveFileExA MoveFileEx; - alias ObjectCloseAuditAlarmA ObjectCloseAuditAlarm; - alias ObjectDeleteAuditAlarmA ObjectDeleteAuditAlarm; - alias ObjectOpenAuditAlarmA ObjectOpenAuditAlarm; - alias ObjectPrivilegeAuditAlarmA ObjectPrivilegeAuditAlarm; - alias OpenBackupEventLogA OpenBackupEventLog; - alias OpenEventLogA OpenEventLog; - alias PrivilegedServiceAuditAlarmA PrivilegedServiceAuditAlarm; - alias ReadEventLogA ReadEventLog; - alias RegisterEventSourceA RegisterEventSource; - alias ReportEventA ReportEvent; - alias SetFileSecurityA SetFileSecurity; - alias UpdateResourceA UpdateResource; + alias WIN32_FIND_DATA = WIN32_FIND_DATAA; + alias ENUMRESLANGPROC = ENUMRESLANGPROCW; + alias ENUMRESNAMEPROC = ENUMRESNAMEPROCW; + alias ENUMRESTYPEPROC = ENUMRESTYPEPROCW; + alias AddAtom = AddAtomA; + alias BeginUpdateResource = BeginUpdateResourceA; + alias BuildCommDCB = BuildCommDCBA; + alias BuildCommDCBAndTimeouts = BuildCommDCBAndTimeoutsA; + alias CallNamedPipe = CallNamedPipeA; + alias CommConfigDialog = CommConfigDialogA; + alias CopyFile = CopyFileA; + alias CopyFileEx = CopyFileExA; + alias CreateDirectory = CreateDirectoryA; + alias CreateDirectoryEx = CreateDirectoryExA; + alias CreateEvent = CreateEventA; + alias CreateFile = CreateFileA; + alias CreateMailslot = CreateMailslotA; + alias CreateMutex = CreateMutexA; + alias CreateProcess = CreateProcessA; + alias CreateSemaphore = CreateSemaphoreA; + alias DeleteFile = DeleteFileA; + alias EndUpdateResource = EndUpdateResourceA; + alias EnumResourceLanguages = EnumResourceLanguagesA; + alias EnumResourceNames = EnumResourceNamesA; + alias EnumResourceTypes = EnumResourceTypesA; + alias ExpandEnvironmentStrings = ExpandEnvironmentStringsA; + alias FatalAppExit = FatalAppExitA; + alias FindAtom = FindAtomA; + alias FindFirstChangeNotification = FindFirstChangeNotificationA; + alias FindFirstFile = FindFirstFileA; + alias FindNextFile = FindNextFileA; + alias FindResource = FindResourceA; + alias FindResourceEx = FindResourceExA; + alias FormatMessage = FormatMessageA; + alias FreeEnvironmentStrings = FreeEnvironmentStringsA; + alias GetAtomName = GetAtomNameA; + alias GetCommandLine = GetCommandLineA; + alias GetComputerName = GetComputerNameA; + alias GetCurrentDirectory = GetCurrentDirectoryA; + alias GetDefaultCommConfig = GetDefaultCommConfigA; + alias GetDiskFreeSpace = GetDiskFreeSpaceA; + alias GetDiskFreeSpaceEx = GetDiskFreeSpaceExA; + alias GetDriveType = GetDriveTypeA; + alias GetEnvironmentStrings = GetEnvironmentStringsA; + alias GetEnvironmentVariable = GetEnvironmentVariableA; + alias GetFileAttributes = GetFileAttributesA; + alias GetFullPathName = GetFullPathNameA; + alias GetLogicalDriveStrings = GetLogicalDriveStringsA; + alias GetNamedPipeHandleState = GetNamedPipeHandleStateA; + alias GetModuleHandle = GetModuleHandleA; + alias GetModuleFileName = GetModuleFileNameA; + alias GetPrivateProfileInt = GetPrivateProfileIntA; + alias GetPrivateProfileSection = GetPrivateProfileSectionA; + alias GetPrivateProfileSectionNames = GetPrivateProfileSectionNamesA; + alias GetPrivateProfileString = GetPrivateProfileStringA; + alias GetPrivateProfileStruct = GetPrivateProfileStructA; + alias GetProfileInt = GetProfileIntA; + alias GetProfileSection = GetProfileSectionA; + alias GetProfileString = GetProfileStringA; + alias GetShortPathName = GetShortPathNameA; + alias GetStartupInfo = GetStartupInfoA; + alias GetSystemDirectory = GetSystemDirectoryA; + alias GetTempFileName = GetTempFileNameA; + alias GetTempPath = GetTempPathA; + alias GetUserName = GetUserNameA; + alias GetVersionEx = GetVersionExA; + alias GetVolumeInformation = GetVolumeInformationA; + alias GetWindowsDirectory = GetWindowsDirectoryA; + alias GlobalAddAtom = GlobalAddAtomA; + alias GlobalFindAtom = GlobalFindAtomA; + alias GlobalGetAtomName = GlobalGetAtomNameA; + alias IsBadStringPtr = IsBadStringPtrA; + alias LoadLibrary = LoadLibraryA; + alias LoadLibraryEx = LoadLibraryExA; + alias lstrcat = lstrcatA; + alias lstrcmp = lstrcmpA; + alias lstrcmpi = lstrcmpiA; + alias lstrcpy = lstrcpyA; + alias lstrcpyn = lstrcpynA; + alias lstrlen = lstrlenA; + alias MoveFile = MoveFileA; + alias OpenEvent = OpenEventA; + alias OpenMutex = OpenMutexA; + alias OpenSemaphore = OpenSemaphoreA; + alias OutputDebugString = OutputDebugStringA; + alias RemoveDirectory = RemoveDirectoryA; + alias SearchPath = SearchPathA; + alias SetComputerName = SetComputerNameA; + alias SetCurrentDirectory = SetCurrentDirectoryA; + alias SetDefaultCommConfig = SetDefaultCommConfigA; + alias SetEnvironmentVariable = SetEnvironmentVariableA; + alias SetFileAttributes = SetFileAttributesA; + alias SetVolumeLabel = SetVolumeLabelA; + alias WaitNamedPipe = WaitNamedPipeA; + alias WritePrivateProfileSection = WritePrivateProfileSectionA; + alias WritePrivateProfileString = WritePrivateProfileStringA; + alias WritePrivateProfileStruct = WritePrivateProfileStructA; + alias WriteProfileSection = WriteProfileSectionA; + alias WriteProfileString = WriteProfileStringA; + alias CreateWaitableTimer = CreateWaitableTimerA; + alias GetFileAttributesEx = GetFileAttributesExA; + alias GetLongPathName = GetLongPathNameA; + alias QueryDosDevice = QueryDosDeviceA; + + alias HW_PROFILE_INFO = HW_PROFILE_INFOA; + alias AccessCheckAndAuditAlarm = AccessCheckAndAuditAlarmA; + alias BackupEventLog = BackupEventLogA; + alias ClearEventLog = ClearEventLogA; + alias CreateNamedPipe = CreateNamedPipeA; + alias CreateProcessAsUser = CreateProcessAsUserA; + alias DefineDosDevice = DefineDosDeviceA; + alias FindFirstFileEx = FindFirstFileExA; + alias GetBinaryType = GetBinaryTypeA; + alias GetCompressedFileSize = GetCompressedFileSizeA; + alias GetFileSecurity = GetFileSecurityA; + alias LogonUser = LogonUserA; + alias LookupAccountName = LookupAccountNameA; + alias LookupAccountSid = LookupAccountSidA; + alias LookupPrivilegeDisplayName = LookupPrivilegeDisplayNameA; + alias LookupPrivilegeName = LookupPrivilegeNameA; + alias LookupPrivilegeValue = LookupPrivilegeValueA; + alias MoveFileEx = MoveFileExA; + alias ObjectCloseAuditAlarm = ObjectCloseAuditAlarmA; + alias ObjectDeleteAuditAlarm = ObjectDeleteAuditAlarmA; + alias ObjectOpenAuditAlarm = ObjectOpenAuditAlarmA; + alias ObjectPrivilegeAuditAlarm = ObjectPrivilegeAuditAlarmA; + alias OpenBackupEventLog = OpenBackupEventLogA; + alias OpenEventLog = OpenEventLogA; + alias PrivilegedServiceAuditAlarm = PrivilegedServiceAuditAlarmA; + alias ReadEventLog = ReadEventLogA; + alias RegisterEventSource = RegisterEventSourceA; + alias ReportEvent = ReportEventA; + alias SetFileSecurity = SetFileSecurityA; + alias UpdateResource = UpdateResourceA; static if (_WIN32_WINNT >= 0x500) { - alias CreateFileMappingA CreateFileMapping; - alias CreateHardLinkA CreateHardLink; - alias CreateJobObjectA CreateJobObject; - alias DeleteVolumeMountPointA DeleteVolumeMountPoint; - alias DnsHostnameToComputerNameA DnsHostnameToComputerName; - alias EncryptFileA EncryptFile; - alias FileEncryptionStatusA FileEncryptionStatus; - alias FindFirstVolumeA FindFirstVolume; - alias FindFirstVolumeMountPointA FindFirstVolumeMountPoint; - alias FindNextVolumeA FindNextVolume; - alias FindNextVolumeMountPointA FindNextVolumeMountPoint; - alias GetModuleHandleExA GetModuleHandleEx; - alias GetSystemWindowsDirectoryA GetSystemWindowsDirectory; - alias GetVolumeNameForVolumeMountPointA GetVolumeNameForVolumeMountPoint; - alias GetVolumePathNameA GetVolumePathName; - alias OpenFileMappingA OpenFileMapping; - alias ReplaceFileA ReplaceFile; - alias SetVolumeMountPointA SetVolumeMountPoint; - alias VerifyVersionInfoA VerifyVersionInfo; + alias CreateFileMapping = CreateFileMappingA; + alias CreateHardLink = CreateHardLinkA; + alias CreateJobObject = CreateJobObjectA; + alias DeleteVolumeMountPoint = DeleteVolumeMountPointA; + alias DnsHostnameToComputerName = DnsHostnameToComputerNameA; + alias EncryptFile = EncryptFileA; + alias FileEncryptionStatus = FileEncryptionStatusA; + alias FindFirstVolume = FindFirstVolumeA; + alias FindFirstVolumeMountPoint = FindFirstVolumeMountPointA; + alias FindNextVolume = FindNextVolumeA; + alias FindNextVolumeMountPoint = FindNextVolumeMountPointA; + alias GetModuleHandleEx = GetModuleHandleExA; + alias GetSystemWindowsDirectory = GetSystemWindowsDirectoryA; + alias GetVolumeNameForVolumeMountPoint = GetVolumeNameForVolumeMountPointA; + alias GetVolumePathName = GetVolumePathNameA; + alias OpenFileMapping = OpenFileMappingA; + alias ReplaceFile = ReplaceFileA; + alias SetVolumeMountPoint = SetVolumeMountPointA; + alias VerifyVersionInfo = VerifyVersionInfoA; } static if (_WIN32_WINNT >= 0x501) { - alias ACTCTXA ACTCTX; - alias CheckNameLegalDOS8Dot3A CheckNameLegalDOS8Dot3; - alias CreateActCtxA CreateActCtx; - alias FindActCtxSectionStringA FindActCtxSectionString; - alias GetSystemWow64DirectoryA GetSystemWow64Directory; - alias GetVolumePathNamesForVolumeNameA GetVolumePathNamesForVolumeName; - alias SetFileShortNameA SetFileShortName; + alias ACTCTX = ACTCTXA; + alias CheckNameLegalDOS8Dot3 = CheckNameLegalDOS8Dot3A; + alias CreateActCtx = CreateActCtxA; + alias FindActCtxSectionString = FindActCtxSectionStringA; + alias GetSystemWow64Directory = GetSystemWow64DirectoryA; + alias GetVolumePathNamesForVolumeName = GetVolumePathNamesForVolumeNameA; + alias SetFileShortName = SetFileShortNameA; } static if (_WIN32_WINNT >= 0x502) { - alias GetDllDirectoryA GetDllDirectory; - alias SetDllDirectoryA SetDllDirectory; - alias SetFirmwareEnvironmentVariableA SetFirmwareEnvironmentVariable; + alias GetDllDirectory = GetDllDirectoryA; + alias SetDllDirectory = SetDllDirectoryA; + alias SetFirmwareEnvironmentVariable = SetFirmwareEnvironmentVariableA; } static if (_WIN32_WINNT >= 0x600) { - alias CreateSymbolicLinkA CreateSymbolicLink; + alias CreateSymbolicLink = CreateSymbolicLinkA; } } -alias STARTUPINFO* LPSTARTUPINFO; -alias WIN32_FIND_DATA* LPWIN32_FIND_DATA; +alias LPSTARTUPINFO = STARTUPINFO*; +alias LPWIN32_FIND_DATA = WIN32_FIND_DATA*; -alias HW_PROFILE_INFO* LPHW_PROFILE_INFO; +alias LPHW_PROFILE_INFO = HW_PROFILE_INFO*; static if (_WIN32_WINNT >= 0x501) { - alias ACTCTX* PACTCTX, PCACTCTX; + alias PACTCTX = ACTCTX*, PCACTCTX = ACTCTX*; } diff --git a/runtime/druntime/src/core/sys/windows/winber.d b/runtime/druntime/src/core/sys/windows/winber.d index b21193896b1..55c5b0ab4ce 100644 --- a/runtime/druntime/src/core/sys/windows/winber.d +++ b/runtime/druntime/src/core/sys/windows/winber.d @@ -34,16 +34,16 @@ version (Windows): */ struct BerElement; -alias int ber_int_t, ber_slen_t; -alias uint ber_uint_t, ber_len_t, ber_tag_t; +alias ber_int_t = int, ber_slen_t = int; +alias ber_uint_t = uint, ber_len_t = uint, ber_tag_t = uint; align(4): struct BerValue { ber_len_t bv_len; char* bv_val; } -alias BerValue LDAP_BERVAL, BERVAL; -alias BerValue* PLDAP_BERVAL, PBERVAL; +alias LDAP_BERVAL = BerValue, BERVAL = BerValue; +alias PLDAP_BERVAL = BerValue*, PBERVAL = BerValue*; enum ber_tag_t LBER_ERROR = -1, diff --git a/runtime/druntime/src/core/sys/windows/wincon.d b/runtime/druntime/src/core/sys/windows/wincon.d index a00ba2e31df..0a4de9ef7bd 100644 --- a/runtime/druntime/src/core/sys/windows/wincon.d +++ b/runtime/druntime/src/core/sys/windows/wincon.d @@ -117,7 +117,7 @@ struct CHAR_INFO { } WORD Attributes; } -alias CHAR_INFO* PCHAR_INFO; +alias PCHAR_INFO = CHAR_INFO*; struct SMALL_RECT { SHORT Left; @@ -125,25 +125,25 @@ struct SMALL_RECT { SHORT Right; SHORT Bottom; } -alias SMALL_RECT* PSMALL_RECT; +alias PSMALL_RECT = SMALL_RECT*; struct CONSOLE_CURSOR_INFO { DWORD dwSize; BOOL bVisible; } -alias CONSOLE_CURSOR_INFO* PCONSOLE_CURSOR_INFO; +alias PCONSOLE_CURSOR_INFO = CONSOLE_CURSOR_INFO*; struct COORD { SHORT X; SHORT Y; } -alias COORD* PCOORD; +alias PCOORD = COORD*; struct CONSOLE_FONT_INFO { DWORD nFont; COORD dwFontSize; } -alias CONSOLE_FONT_INFO* PCONSOLE_FONT_INFO; +alias PCONSOLE_FONT_INFO = CONSOLE_FONT_INFO*; struct CONSOLE_SCREEN_BUFFER_INFO { COORD dwSize; @@ -152,9 +152,9 @@ struct CONSOLE_SCREEN_BUFFER_INFO { SMALL_RECT srWindow; COORD dwMaximumWindowSize; } -alias CONSOLE_SCREEN_BUFFER_INFO* PCONSOLE_SCREEN_BUFFER_INFO; +alias PCONSOLE_SCREEN_BUFFER_INFO = CONSOLE_SCREEN_BUFFER_INFO*; -alias extern(Windows) BOOL function(DWORD) nothrow PHANDLER_ROUTINE; +alias PHANDLER_ROUTINE = extern(Windows) BOOL function(DWORD) nothrow; struct KEY_EVENT_RECORD { BOOL bKeyDown; @@ -172,7 +172,7 @@ struct KEY_EVENT_RECORD { } DWORD dwControlKeyState; } -alias KEY_EVENT_RECORD* PKEY_EVENT_RECORD; +alias PKEY_EVENT_RECORD = KEY_EVENT_RECORD*; struct MOUSE_EVENT_RECORD { COORD dwMousePosition; @@ -180,22 +180,22 @@ struct MOUSE_EVENT_RECORD { DWORD dwControlKeyState; DWORD dwEventFlags; } -alias MOUSE_EVENT_RECORD* PMOUSE_EVENT_RECORD; +alias PMOUSE_EVENT_RECORD = MOUSE_EVENT_RECORD*; struct WINDOW_BUFFER_SIZE_RECORD { COORD dwSize; } -alias WINDOW_BUFFER_SIZE_RECORD* PWINDOW_BUFFER_SIZE_RECORD; +alias PWINDOW_BUFFER_SIZE_RECORD = WINDOW_BUFFER_SIZE_RECORD*; struct MENU_EVENT_RECORD { UINT dwCommandId; } -alias MENU_EVENT_RECORD* PMENU_EVENT_RECORD; +alias PMENU_EVENT_RECORD = MENU_EVENT_RECORD*; struct FOCUS_EVENT_RECORD { BOOL bSetFocus; } -alias FOCUS_EVENT_RECORD* PFOCUS_EVENT_RECORD; +alias PFOCUS_EVENT_RECORD = FOCUS_EVENT_RECORD*; struct INPUT_RECORD { WORD EventType; @@ -215,7 +215,7 @@ struct INPUT_RECORD { _Event Event; } } -alias INPUT_RECORD* PINPUT_RECORD; +alias PINPUT_RECORD = INPUT_RECORD*; extern (Windows) nothrow @nogc: @@ -286,31 +286,31 @@ BOOL WriteConsoleOutputCharacterA(HANDLE, LPCSTR, DWORD, COORD, PDWORD); BOOL WriteConsoleOutputCharacterW(HANDLE, LPCWSTR, DWORD, COORD, PDWORD); version (Unicode) { - alias FillConsoleOutputCharacterW FillConsoleOutputCharacter; - alias GetConsoleTitleW GetConsoleTitle; - alias PeekConsoleInputW PeekConsoleInput; - alias ReadConsoleW ReadConsole; - alias ReadConsoleInputW ReadConsoleInput; - alias ReadConsoleOutputW ReadConsoleOutput; - alias ReadConsoleOutputCharacterW ReadConsoleOutputCharacter; - alias ScrollConsoleScreenBufferW ScrollConsoleScreenBuffer; - alias SetConsoleTitleW SetConsoleTitle; - alias WriteConsoleW WriteConsole; - alias WriteConsoleInputW WriteConsoleInput; - alias WriteConsoleOutputW WriteConsoleOutput; - alias WriteConsoleOutputCharacterW WriteConsoleOutputCharacter; + alias FillConsoleOutputCharacter = FillConsoleOutputCharacterW; + alias GetConsoleTitle = GetConsoleTitleW; + alias PeekConsoleInput = PeekConsoleInputW; + alias ReadConsole = ReadConsoleW; + alias ReadConsoleInput = ReadConsoleInputW; + alias ReadConsoleOutput = ReadConsoleOutputW; + alias ReadConsoleOutputCharacter = ReadConsoleOutputCharacterW; + alias ScrollConsoleScreenBuffer = ScrollConsoleScreenBufferW; + alias SetConsoleTitle = SetConsoleTitleW; + alias WriteConsole = WriteConsoleW; + alias WriteConsoleInput = WriteConsoleInputW; + alias WriteConsoleOutput = WriteConsoleOutputW; + alias WriteConsoleOutputCharacter = WriteConsoleOutputCharacterW; } else { - alias FillConsoleOutputCharacterA FillConsoleOutputCharacter; - alias GetConsoleTitleA GetConsoleTitle; - alias PeekConsoleInputA PeekConsoleInput; - alias ReadConsoleA ReadConsole; - alias ReadConsoleInputA ReadConsoleInput; - alias ReadConsoleOutputA ReadConsoleOutput; - alias ReadConsoleOutputCharacterA ReadConsoleOutputCharacter; - alias ScrollConsoleScreenBufferA ScrollConsoleScreenBuffer; - alias SetConsoleTitleA SetConsoleTitle; - alias WriteConsoleA WriteConsole; - alias WriteConsoleInputA WriteConsoleInput; - alias WriteConsoleOutputA WriteConsoleOutput; - alias WriteConsoleOutputCharacterA WriteConsoleOutputCharacter; + alias FillConsoleOutputCharacter = FillConsoleOutputCharacterA; + alias GetConsoleTitle = GetConsoleTitleA; + alias PeekConsoleInput = PeekConsoleInputA; + alias ReadConsole = ReadConsoleA; + alias ReadConsoleInput = ReadConsoleInputA; + alias ReadConsoleOutput = ReadConsoleOutputA; + alias ReadConsoleOutputCharacter = ReadConsoleOutputCharacterA; + alias ScrollConsoleScreenBuffer = ScrollConsoleScreenBufferA; + alias SetConsoleTitle = SetConsoleTitleA; + alias WriteConsole = WriteConsoleA; + alias WriteConsoleInput = WriteConsoleInputA; + alias WriteConsoleOutput = WriteConsoleOutputA; + alias WriteConsoleOutputCharacter = WriteConsoleOutputCharacterA; } diff --git a/runtime/druntime/src/core/sys/windows/wincrypt.d b/runtime/druntime/src/core/sys/windows/wincrypt.d index f068a3a7958..ab83f006b0e 100644 --- a/runtime/druntime/src/core/sys/windows/wincrypt.d +++ b/runtime/druntime/src/core/sys/windows/wincrypt.d @@ -500,27 +500,21 @@ enum { } -alias UINT ALG_ID; -alias ULONG_PTR HCRYPTPROV, HCRYPTKEY, HCRYPTHASH; -alias PVOID HCERTSTORE, HCRYPTMSG, HCERTCHAINENGINE; +alias ALG_ID = UINT; +alias HCRYPTPROV = ULONG_PTR, HCRYPTKEY = ULONG_PTR, HCRYPTHASH = ULONG_PTR; +alias HCERTSTORE = PVOID, HCRYPTMSG = PVOID, HCERTCHAINENGINE = PVOID; struct VTableProvStruc { FARPROC FuncVerifyImage; } -alias VTableProvStruc* PVTableProvStruc; +alias PVTableProvStruc = VTableProvStruc*; struct _CRYPTOAPI_BLOB { DWORD cbData; BYTE* pbData; } -alias _CRYPTOAPI_BLOB CRYPT_INTEGER_BLOB, CRYPT_UINT_BLOB, - CRYPT_OBJID_BLOB, CERT_NAME_BLOB, CERT_RDN_VALUE_BLOB, CERT_BLOB, - CRL_BLOB, DATA_BLOB, CRYPT_DATA_BLOB, CRYPT_HASH_BLOB, - CRYPT_DIGEST_BLOB, CRYPT_DER_BLOB, CRYPT_ATTR_BLOB; -alias _CRYPTOAPI_BLOB* PCRYPT_INTEGER_BLOB, PCRYPT_UINT_BLOB, - PCRYPT_OBJID_BLOB, PCERT_NAME_BLOB, PCERT_RDN_VALUE_BLOB, PCERT_BLOB, - PCRL_BLOB, PDATA_BLOB, PCRYPT_DATA_BLOB, PCRYPT_HASH_BLOB, - PCRYPT_DIGEST_BLOB, PCRYPT_DER_BLOB, PCRYPT_ATTR_BLOB; +alias CRYPT_INTEGER_BLOB = _CRYPTOAPI_BLOB, CRYPT_UINT_BLOB = _CRYPTOAPI_BLOB, CRYPT_OBJID_BLOB = _CRYPTOAPI_BLOB, CERT_NAME_BLOB = _CRYPTOAPI_BLOB, CERT_RDN_VALUE_BLOB = _CRYPTOAPI_BLOB, CERT_BLOB = _CRYPTOAPI_BLOB, CRL_BLOB = _CRYPTOAPI_BLOB, DATA_BLOB = _CRYPTOAPI_BLOB, CRYPT_DATA_BLOB = _CRYPTOAPI_BLOB, CRYPT_HASH_BLOB = _CRYPTOAPI_BLOB, CRYPT_DIGEST_BLOB = _CRYPTOAPI_BLOB, CRYPT_DER_BLOB = _CRYPTOAPI_BLOB, CRYPT_ATTR_BLOB = _CRYPTOAPI_BLOB; +alias PCRYPT_INTEGER_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_UINT_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_OBJID_BLOB = _CRYPTOAPI_BLOB*, PCERT_NAME_BLOB = _CRYPTOAPI_BLOB*, PCERT_RDN_VALUE_BLOB = _CRYPTOAPI_BLOB*, PCERT_BLOB = _CRYPTOAPI_BLOB*, PCRL_BLOB = _CRYPTOAPI_BLOB*, PDATA_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_DATA_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_HASH_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_DIGEST_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_DER_BLOB = _CRYPTOAPI_BLOB*, PCRYPT_ATTR_BLOB = _CRYPTOAPI_BLOB*; // not described in SDK; has the same layout as HTTPSPolicyCallbackData struct SSL_EXTRA_CERT_CHAIN_POLICY_PARA { @@ -529,9 +523,8 @@ struct SSL_EXTRA_CERT_CHAIN_POLICY_PARA { DWORD fdwChecks; LPWSTR pwszServerName; } -alias SSL_EXTRA_CERT_CHAIN_POLICY_PARA HTTPSPolicyCallbackData; -alias SSL_EXTRA_CERT_CHAIN_POLICY_PARA* PSSL_EXTRA_CERT_CHAIN_POLICY_PARA, - PHTTPSPolicyCallbackData; +alias HTTPSPolicyCallbackData = SSL_EXTRA_CERT_CHAIN_POLICY_PARA; +alias PSSL_EXTRA_CERT_CHAIN_POLICY_PARA = SSL_EXTRA_CERT_CHAIN_POLICY_PARA*, PHTTPSPolicyCallbackData = SSL_EXTRA_CERT_CHAIN_POLICY_PARA*; /* #if (_WIN32_WINNT>=0x500) */ struct CERT_CHAIN_POLICY_PARA { @@ -539,7 +532,7 @@ struct CERT_CHAIN_POLICY_PARA { DWORD dwFlags; void* pvExtraPolicyPara; } -alias CERT_CHAIN_POLICY_PARA* PCERT_CHAIN_POLICY_PARA; +alias PCERT_CHAIN_POLICY_PARA = CERT_CHAIN_POLICY_PARA*; struct CERT_CHAIN_POLICY_STATUS { DWORD cbSize = CERT_CHAIN_POLICY_STATUS.sizeof; @@ -548,34 +541,34 @@ struct CERT_CHAIN_POLICY_STATUS { LONG lElementIndex; void* pvExtraPolicyStatus; } -alias CERT_CHAIN_POLICY_STATUS* PCERT_CHAIN_POLICY_STATUS; +alias PCERT_CHAIN_POLICY_STATUS = CERT_CHAIN_POLICY_STATUS*; /* #endif */ struct CRYPT_ALGORITHM_IDENTIFIER { LPSTR pszObjId; CRYPT_OBJID_BLOB Parameters; } -alias CRYPT_ALGORITHM_IDENTIFIER* PCRYPT_ALGORITHM_IDENTIFIER; +alias PCRYPT_ALGORITHM_IDENTIFIER = CRYPT_ALGORITHM_IDENTIFIER*; struct CRYPT_BIT_BLOB { DWORD cbData; BYTE* pbData; DWORD cUnusedBits; } -alias CRYPT_BIT_BLOB* PCRYPT_BIT_BLOB; +alias PCRYPT_BIT_BLOB = CRYPT_BIT_BLOB*; struct CERT_PUBLIC_KEY_INFO { CRYPT_ALGORITHM_IDENTIFIER Algorithm; CRYPT_BIT_BLOB PublicKey; } -alias CERT_PUBLIC_KEY_INFO* PCERT_PUBLIC_KEY_INFO; +alias PCERT_PUBLIC_KEY_INFO = CERT_PUBLIC_KEY_INFO*; struct CERT_EXTENSION { LPSTR pszObjId; BOOL fCritical; CRYPT_OBJID_BLOB Value; } -alias CERT_EXTENSION* PCERT_EXTENSION; +alias PCERT_EXTENSION = CERT_EXTENSION*; struct CERT_INFO { DWORD dwVersion; @@ -591,7 +584,7 @@ struct CERT_INFO { DWORD cExtension; PCERT_EXTENSION rgExtension; } -alias CERT_INFO* PCERT_INFO; +alias PCERT_INFO = CERT_INFO*; struct CERT_CONTEXT { DWORD dwCertEncodingType; @@ -600,21 +593,21 @@ struct CERT_CONTEXT { PCERT_INFO pCertInfo; HCERTSTORE hCertStore; } -alias CERT_CONTEXT* PCERT_CONTEXT; -alias const(CERT_CONTEXT)* PCCERT_CONTEXT; +alias PCERT_CONTEXT = CERT_CONTEXT*; +alias PCCERT_CONTEXT = const(CERT_CONTEXT)*; struct CTL_USAGE { DWORD cUsageIdentifier; LPSTR* rgpszUsageIdentifier; } -alias CTL_USAGE CERT_ENHKEY_USAGE; -alias CTL_USAGE* PCTRL_USAGE, PCERT_ENHKEY_USAGE; +alias CERT_ENHKEY_USAGE = CTL_USAGE; +alias PCTRL_USAGE = CTL_USAGE*, PCERT_ENHKEY_USAGE = CTL_USAGE*; struct CERT_USAGE_MATCH { DWORD dwType; CERT_ENHKEY_USAGE Usage; } -alias CERT_USAGE_MATCH* PCERT_USAGE_MATCH; +alias PCERT_USAGE_MATCH = CERT_USAGE_MATCH*; /* #if (_WIN32_WINNT>=0x500) */ struct CERT_CHAIN_PARA { @@ -627,10 +620,9 @@ struct CERT_CHAIN_PARA { DWORD dwRevocationFreshnessTime; //#endif } -alias CERT_CHAIN_PARA* PCERT_CHAIN_PARA; +alias PCERT_CHAIN_PARA = CERT_CHAIN_PARA*; -extern (Windows) alias BOOL function(PCCERT_CONTEXT, void*) - PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK; +extern (Windows) alias PFN_CERT_CHAIN_FIND_BY_ISSUER_CALLBACK = BOOL function(PCCERT_CONTEXT, void*); struct CERT_CHAIN_FIND_BY_ISSUER_PARA { DWORD cbSize = CERT_CHAIN_FIND_BY_ISSUER_PARA.sizeof; @@ -644,14 +636,14 @@ struct CERT_CHAIN_FIND_BY_ISSUER_PARA { DWORD* pdwIssuerChainIndex; DWORD* pdwIssuerElementIndex; } -alias CERT_CHAIN_FIND_BY_ISSUER_PARA* PCERT_CHAIN_FIND_BY_ISSUER_PARA; +alias PCERT_CHAIN_FIND_BY_ISSUER_PARA = CERT_CHAIN_FIND_BY_ISSUER_PARA*; /* #endif */ struct CERT_TRUST_STATUS { DWORD dwErrorStatus; DWORD dwInfoStatus; } -alias CERT_TRUST_STATUS* PCERT_TRUST_STATUS; +alias PCERT_TRUST_STATUS = CERT_TRUST_STATUS*; struct CRL_ENTRY { CRYPT_INTEGER_BLOB SerialNumber; @@ -659,7 +651,7 @@ struct CRL_ENTRY { DWORD cExtension; PCERT_EXTENSION rgExtension; } -alias CRL_ENTRY* PCRL_ENTRY; +alias PCRL_ENTRY = CRL_ENTRY*; struct CRL_INFO { DWORD dwVersion; @@ -672,7 +664,7 @@ struct CRL_INFO { DWORD cExtension; PCERT_EXTENSION rgExtension; } -alias CRL_INFO* PCRL_INFO; +alias PCRL_INFO = CRL_INFO*; struct CRL_CONTEXT { DWORD dwCertEncodingType; @@ -681,8 +673,8 @@ struct CRL_CONTEXT { PCRL_INFO pCrlInfo; HCERTSTORE hCertStore; } -alias CRL_CONTEXT* PCRL_CONTEXT; -alias const(CRL_CONTEXT)* PCCRL_CONTEXT; +alias PCRL_CONTEXT = CRL_CONTEXT*; +alias PCCRL_CONTEXT = const(CRL_CONTEXT)*; struct CERT_REVOCATION_CRL_INFO { DWORD cbSize = CERT_REVOCATION_CRL_INFO.sizeof; @@ -691,7 +683,7 @@ struct CERT_REVOCATION_CRL_INFO { PCRL_ENTRY pCrlEntry; BOOL fDeltaCrlEntry; } -alias CERT_REVOCATION_CRL_INFO* PCERT_REVOCATION_CRL_INFO; +alias PCERT_REVOCATION_CRL_INFO = CERT_REVOCATION_CRL_INFO*; struct CERT_REVOCATION_INFO { DWORD cbSize = CERT_REVOCATION_INFO.sizeof; @@ -702,7 +694,7 @@ struct CERT_REVOCATION_INFO { DWORD dwFreshnessTime; PCERT_REVOCATION_CRL_INFO pCrlInfo; } -alias CERT_REVOCATION_INFO* PCERT_REVOCATION_INFO; +alias PCERT_REVOCATION_INFO = CERT_REVOCATION_INFO*; /* #if (_WIN32_WINNT>=0x500) */ struct CERT_CHAIN_ELEMENT { @@ -713,7 +705,7 @@ struct CERT_CHAIN_ELEMENT { PCERT_ENHKEY_USAGE pIssuanceUsage; PCERT_ENHKEY_USAGE pApplicationUsage; } -alias CERT_CHAIN_ELEMENT* PCERT_CHAIN_ELEMENT; +alias PCERT_CHAIN_ELEMENT = CERT_CHAIN_ELEMENT*; /* #endif */ struct CRYPT_ATTRIBUTE { @@ -721,14 +713,14 @@ struct CRYPT_ATTRIBUTE { DWORD cValue; PCRYPT_ATTR_BLOB rgValue; } -alias CRYPT_ATTRIBUTE* PCRYPT_ATTRIBUTE; +alias PCRYPT_ATTRIBUTE = CRYPT_ATTRIBUTE*; struct CTL_ENTRY { CRYPT_DATA_BLOB SubjectIdentifier; DWORD cAttribute; PCRYPT_ATTRIBUTE rgAttribute; } -alias CTL_ENTRY* PCTL_ENTRY; +alias PCTL_ENTRY = CTL_ENTRY*; struct CTL_INFO { DWORD dwVersion; @@ -743,7 +735,7 @@ struct CTL_INFO { DWORD cExtension; PCERT_EXTENSION rgExtension; } -alias CTL_INFO* PCTL_INFO; +alias PCTL_INFO = CTL_INFO*; struct CTL_CONTEXT { DWORD dwMsgAndCertEncodingType; @@ -755,15 +747,15 @@ struct CTL_CONTEXT { BYTE* pbCtlContent; DWORD cbCtlContent; } -alias CTL_CONTEXT* PCTL_CONTEXT; -alias const(CTL_CONTEXT)* PCCTL_CONTEXT; +alias PCTL_CONTEXT = CTL_CONTEXT*; +alias PCCTL_CONTEXT = const(CTL_CONTEXT)*; struct CERT_TRUST_LIST_INFO { DWORD cbSize = CERT_TRUST_LIST_INFO.sizeof; PCTL_ENTRY pCtlEntry; PCCTL_CONTEXT pCtlContext; } -alias CERT_TRUST_LIST_INFO* PCERT_TRUST_LIST_INFO; +alias PCERT_TRUST_LIST_INFO = CERT_TRUST_LIST_INFO*; struct CERT_SIMPLE_CHAIN { DWORD cbSize = CERT_SIMPLE_CHAIN.sizeof; @@ -774,10 +766,10 @@ struct CERT_SIMPLE_CHAIN { BOOL fHasRevocationFreshnessTime; DWORD dwRevocationFreshnessTime; } -alias CERT_SIMPLE_CHAIN* PCERT_SIMPLE_CHAIN; +alias PCERT_SIMPLE_CHAIN = CERT_SIMPLE_CHAIN*; /* #if (_WIN32_WINNT>=0x500) */ -alias const(CERT_CHAIN_CONTEXT)* PCCERT_CHAIN_CONTEXT; +alias PCCERT_CHAIN_CONTEXT = const(CERT_CHAIN_CONTEXT)*; struct CERT_CHAIN_CONTEXT { DWORD cbSize = CERT_CHAIN_CONTEXT.sizeof; CERT_TRUST_STATUS TrustStatus; @@ -788,7 +780,7 @@ struct CERT_CHAIN_CONTEXT { BOOL fHasRevocationFreshnessTime; DWORD dwRevocationFreshnessTime; } -alias CERT_CHAIN_CONTEXT* PCERT_CHAIN_CONTEXT; +alias PCERT_CHAIN_CONTEXT = CERT_CHAIN_CONTEXT*; /* #endif */ struct PROV_ENUMALGS { @@ -804,7 +796,7 @@ struct PUBLICKEYSTRUC { WORD reserved; ALG_ID aiKeyAlg; } -alias PUBLICKEYSTRUC BLOBHEADER; +alias BLOBHEADER = PUBLICKEYSTRUC; struct RSAPUBKEY { DWORD magic; @@ -819,7 +811,7 @@ struct HMAC_INFO { BYTE* pbOuterString; DWORD cbOuterString; } -alias HMAC_INFO* PHMAC_INFO; +alias PHMAC_INFO = HMAC_INFO*; extern (Windows) @nogc nothrow { BOOL CertCloseStore(HCERTSTORE, DWORD); @@ -882,21 +874,21 @@ const(void)*, PCCERT_CHAIN_CONTEXT); } version (Unicode) { - alias CertNameToStrW CertNameToStr; - alias CryptAcquireContextW CryptAcquireContext; - alias CryptSignHashW CryptSignHash; - alias CryptVerifySignatureW CryptVerifySignature; - alias CryptSetProviderW CryptSetProvider; - alias CertOpenSystemStoreW CertOpenSystemStore; + alias CertNameToStr = CertNameToStrW; + alias CryptAcquireContext = CryptAcquireContextW; + alias CryptSignHash = CryptSignHashW; + alias CryptVerifySignature = CryptVerifySignatureW; + alias CryptSetProvider = CryptSetProviderW; + alias CertOpenSystemStore = CertOpenSystemStoreW; /+alias CERT_FIND_SUBJECT_STR_W CERT_FIND_SUBJECT_STR; alias CERT_FIND_ISSUER_STR_W CERT_FIND_ISSUER_STR;+/ } else { - alias CertNameToStrA CertNameToStr; - alias CryptAcquireContextA CryptAcquireContext; - alias CryptSignHashA CryptSignHash; - alias CryptVerifySignatureA CryptVerifySignature; - alias CryptSetProviderA CryptSetProvider; - alias CertOpenSystemStoreA CertOpenSystemStore; + alias CertNameToStr = CertNameToStrA; + alias CryptAcquireContext = CryptAcquireContextA; + alias CryptSignHash = CryptSignHashA; + alias CryptVerifySignature = CryptVerifySignatureA; + alias CryptSetProvider = CryptSetProviderA; + alias CertOpenSystemStore = CertOpenSystemStoreA; /+alias CERT_FIND_SUBJECT_STR_A CERT_FIND_SUBJECT_STR; alias CERT_FIND_ISSUER_STR_A CERT_FIND_ISSUER_STR;+/ } diff --git a/runtime/druntime/src/core/sys/windows/windef.d b/runtime/druntime/src/core/sys/windows/windef.d index 105be44c5b6..80f68746347 100644 --- a/runtime/druntime/src/core/sys/windows/windef.d +++ b/runtime/druntime/src/core/sys/windows/windef.d @@ -59,20 +59,20 @@ static assert (is(typeof({ test(NULL); }))); -alias ubyte BYTE; -alias ubyte* PBYTE, LPBYTE; -alias ushort USHORT, WORD, ATOM; -alias ushort* PUSHORT, PWORD, LPWORD; -alias uint ULONG, DWORD, UINT, COLORREF; -alias uint* PULONG, PDWORD, LPDWORD, PUINT, LPUINT, LPCOLORREF; -alias int WINBOOL, BOOL, INT, LONG, HFILE, HRESULT; -alias int* PWINBOOL, LPWINBOOL, PBOOL, LPBOOL, PINT, LPINT, LPLONG; -alias float FLOAT; -alias float* PFLOAT; -alias const(void)* PCVOID, LPCVOID; - -alias UINT_PTR WPARAM; -alias LONG_PTR LPARAM, LRESULT; +alias BYTE = ubyte; +alias PBYTE = ubyte*, LPBYTE = ubyte*; +alias USHORT = ushort, WORD = ushort, ATOM = ushort; +alias PUSHORT = ushort*, PWORD = ushort*, LPWORD = ushort*; +alias ULONG = uint, DWORD = uint, UINT = uint, COLORREF = uint; +alias PULONG = uint*, PDWORD = uint*, LPDWORD = uint*, PUINT = uint*, LPUINT = uint*, LPCOLORREF = uint*; +alias WINBOOL = int, BOOL = int, INT = int, LONG = int, HFILE = int, HRESULT = int; +alias PWINBOOL = int*, LPWINBOOL = int*, PBOOL = int*, LPBOOL = int*, PINT = int*, LPINT = int*, LPLONG = int*; +alias FLOAT = float; +alias PFLOAT = float*; +alias PCVOID = const(void)*, LPCVOID = const(void)*; + +alias WPARAM = UINT_PTR; +alias LPARAM = LONG_PTR, LRESULT = LONG_PTR; alias HHOOK = HANDLE; alias HGLOBAL = HANDLE; @@ -106,14 +106,14 @@ alias HWND = HANDLE; alias HWINSTA = HANDLE; alias HKL = HANDLE; alias HCURSOR = HANDLE; -alias HKEY* PHKEY; +alias PHKEY = HKEY*; static if (_WIN32_WINNT >= 0x500) { alias HTERMINAL = HANDLE; alias HWINEVENTHOOK = HANDLE; } -alias extern (Windows) INT_PTR function() nothrow FARPROC, NEARPROC, PROC; +alias FARPROC = extern (Windows) INT_PTR function() nothrow, NEARPROC = extern (Windows) INT_PTR function() nothrow, PROC = extern (Windows) INT_PTR function() nothrow; struct RECT { LONG left; @@ -121,29 +121,29 @@ struct RECT { LONG right; LONG bottom; } -alias RECT RECTL; -alias RECT* PRECT, NPRECT, LPRECT, PRECTL, LPRECTL; -alias const(RECT)* LPCRECT, LPCRECTL; +alias RECTL = RECT; +alias PRECT = RECT*, NPRECT = RECT*, LPRECT = RECT*, PRECTL = RECT*, LPRECTL = RECT*; +alias LPCRECT = const(RECT)*, LPCRECTL = const(RECT)*; struct POINT { LONG x; LONG y; } -alias POINT POINTL; -alias POINT* PPOINT, NPPOINT, LPPOINT, PPOINTL, LPPOINTL; +alias POINTL = POINT; +alias PPOINT = POINT*, NPPOINT = POINT*, LPPOINT = POINT*, PPOINTL = POINT*, LPPOINTL = POINT*; struct SIZE { LONG cx; LONG cy; } -alias SIZE SIZEL; -alias SIZE* PSIZE, LPSIZE, PSIZEL, LPSIZEL; +alias SIZEL = SIZE; +alias PSIZE = SIZE*, LPSIZE = SIZE*, PSIZEL = SIZE*, LPSIZEL = SIZE*; struct POINTS { SHORT x; SHORT y; } -alias POINTS* PPOINTS, LPPOINTS; +alias PPOINTS = POINTS*, LPPOINTS = POINTS*; enum : BOOL { FALSE = 0, diff --git a/runtime/druntime/src/core/sys/windows/winerror.d b/runtime/druntime/src/core/sys/windows/winerror.d index 865319b3c3c..6886650f080 100644 --- a/runtime/druntime/src/core/sys/windows/winerror.d +++ b/runtime/druntime/src/core/sys/windows/winerror.d @@ -15,7 +15,7 @@ version (Windows): import core.sys.windows.windef; -alias int SCODE; // was in core.sys.windows.wtypes. +alias SCODE = int; // was in core.sys.windows.wtypes. enum : uint { ERROR_SUCCESS = 0, diff --git a/runtime/druntime/src/core/sys/windows/wingdi.d b/runtime/druntime/src/core/sys/windows/wingdi.d index c7b0c8bf954..b88059aaf6e 100644 --- a/runtime/druntime/src/core/sys/windows/wingdi.d +++ b/runtime/druntime/src/core/sys/windows/wingdi.d @@ -418,7 +418,7 @@ enum { } enum ERROR = 0; -alias ERROR RGN_ERROR; +alias RGN_ERROR = ERROR; // CreateDIBitmap() enum DWORD CBM_INIT = 4; @@ -1395,7 +1395,7 @@ struct PSINJECTDATA { WORD InjectionPoint; WORD PageNumber; } -alias PSINJECTDATA* PPSINJECTDATA; +alias PPSINJECTDATA = PSINJECTDATA*; /* Constants for PSINJECTDATA.InjectionPoint field */ enum { @@ -1980,14 +1980,14 @@ struct ABC { UINT abcB; int abcC; } -alias ABC* PABC, NPABC, LPABC; +alias PABC = ABC*, NPABC = ABC*, LPABC = ABC*; struct ABCFLOAT { FLOAT abcfA; FLOAT abcfB; FLOAT abcfC; } -alias ABCFLOAT* PABCFLOAT, NPABCFLOAT, LPABCFLOAT; +alias PABCFLOAT = ABCFLOAT*, NPABCFLOAT = ABCFLOAT*, LPABCFLOAT = ABCFLOAT*; struct BITMAP { LONG bmType; @@ -1998,7 +1998,7 @@ struct BITMAP { WORD bmBitsPixel; LPVOID bmBits; } -alias BITMAP* PBITMAP, NPBITMAP, LPBITMAP; +alias PBITMAP = BITMAP*, NPBITMAP = BITMAP*, LPBITMAP = BITMAP*; struct BITMAPCOREHEADER { DWORD bcSize; @@ -2007,7 +2007,7 @@ struct BITMAPCOREHEADER { WORD bcPlanes; WORD bcBitCount; } -alias BITMAPCOREHEADER* PBITMAPCOREHEADER, LPBITMAPCOREHEADER; +alias PBITMAPCOREHEADER = BITMAPCOREHEADER*, LPBITMAPCOREHEADER = BITMAPCOREHEADER*; align(1): struct RGBTRIPLE { @@ -2015,7 +2015,7 @@ struct RGBTRIPLE { BYTE rgbtGreen; BYTE rgbtRed; } -alias RGBTRIPLE* LPRGBTRIPLE; +alias LPRGBTRIPLE = RGBTRIPLE*; align(2): struct BITMAPFILEHEADER { @@ -2026,7 +2026,7 @@ align(2): WORD bfReserved2; DWORD bfOffBits; } -alias BITMAPFILEHEADER* LPBITMAPFILEHEADER, PBITMAPFILEHEADER; +alias LPBITMAPFILEHEADER = BITMAPFILEHEADER*, PBITMAPFILEHEADER = BITMAPFILEHEADER*; align: @@ -2034,7 +2034,7 @@ struct BITMAPCOREINFO { BITMAPCOREHEADER bmciHeader; RGBTRIPLE[1] bmciColors; } -alias BITMAPCOREINFO* LPBITMAPCOREINFO, PBITMAPCOREINFO; +alias LPBITMAPCOREINFO = BITMAPCOREINFO*, PBITMAPCOREINFO = BITMAPCOREINFO*; struct BITMAPINFOHEADER { DWORD biSize; @@ -2050,7 +2050,7 @@ struct BITMAPINFOHEADER { DWORD biClrImportant; } -alias BITMAPINFOHEADER* LPBITMAPINFOHEADER, PBITMAPINFOHEADER; +alias LPBITMAPINFOHEADER = BITMAPINFOHEADER*, PBITMAPINFOHEADER = BITMAPINFOHEADER*; struct RGBQUAD { BYTE rgbBlue; @@ -2058,32 +2058,32 @@ struct RGBQUAD { BYTE rgbRed; BYTE rgbReserved; } -alias RGBQUAD* LPRGBQUAD; +alias LPRGBQUAD = RGBQUAD*; struct BITMAPINFO { BITMAPINFOHEADER bmiHeader; RGBQUAD[1] bmiColors; } -alias BITMAPINFO* PBITMAPINFO, LPBITMAPINFO; +alias PBITMAPINFO = BITMAPINFO*, LPBITMAPINFO = BITMAPINFO*; -alias int FXPT16DOT16; -alias int* LPFXPT16DOT16; -alias int FXPT2DOT30; -alias int* LPFXPT2DOT30; +alias FXPT16DOT16 = int; +alias LPFXPT16DOT16 = int*; +alias FXPT2DOT30 = int; +alias LPFXPT2DOT30 = int*; struct CIEXYZ { FXPT2DOT30 ciexyzX; FXPT2DOT30 ciexyzY; FXPT2DOT30 ciexyzZ; } -alias CIEXYZ* LPCIEXYZ; +alias LPCIEXYZ = CIEXYZ*; struct CIEXYZTRIPLE { CIEXYZ ciexyzRed; CIEXYZ ciexyzGreen; CIEXYZ ciexyzBlue; } -alias CIEXYZTRIPLE* LPCIEXYZTRIPLE; +alias LPCIEXYZTRIPLE = CIEXYZTRIPLE*; struct BITMAPV4HEADER { DWORD bV4Size; @@ -2107,7 +2107,7 @@ struct BITMAPV4HEADER { DWORD bV4GammaGreen; DWORD bV4GammaBlue; } -alias BITMAPV4HEADER* LPBITMAPV4HEADER, PBITMAPV4HEADER; +alias LPBITMAPV4HEADER = BITMAPV4HEADER*, PBITMAPV4HEADER = BITMAPV4HEADER*; struct BITMAPV5HEADER { DWORD bV5Size; @@ -2135,20 +2135,20 @@ struct BITMAPV5HEADER { DWORD bV5ProfileSize; DWORD bV5Reserved; } -alias BITMAPV5HEADER* LPBITMAPV5HEADER, PBITMAPV5HEADER; +alias LPBITMAPV5HEADER = BITMAPV5HEADER*, PBITMAPV5HEADER = BITMAPV5HEADER*; struct FONTSIGNATURE { DWORD[4] fsUsb; DWORD[2] fsCsb; } -alias FONTSIGNATURE* PFONTSIGNATURE, LPFONTSIGNATURE; +alias PFONTSIGNATURE = FONTSIGNATURE*, LPFONTSIGNATURE = FONTSIGNATURE*; struct CHARSETINFO { UINT ciCharset; UINT ciACP; FONTSIGNATURE fs; } -alias CHARSETINFO* PCHARSETINFO, NPCHARSETINFO, LPCHARSETINFO; +alias PCHARSETINFO = CHARSETINFO*, NPCHARSETINFO = CHARSETINFO*, LPCHARSETINFO = CHARSETINFO*; struct COLORADJUSTMENT { WORD caSize; @@ -2164,7 +2164,7 @@ struct COLORADJUSTMENT { SHORT caColorfulness; SHORT caRedGreenTint; } -alias COLORADJUSTMENT* PCOLORADJUSTMENT, LPCOLORADJUSTMENT; +alias PCOLORADJUSTMENT = COLORADJUSTMENT*, LPCOLORADJUSTMENT = COLORADJUSTMENT*; struct DEVMODEA { BYTE[CCHDEVICENAME] dmDeviceName; @@ -2214,7 +2214,7 @@ struct DEVMODEA { DWORD dmPanningWidth; DWORD dmPanningHeight; } -alias DEVMODEA* PDEVMODEA, NPDEVMODEA, LPDEVMODEA; +alias PDEVMODEA = DEVMODEA*, NPDEVMODEA = DEVMODEA*, LPDEVMODEA = DEVMODEA*; struct DEVMODEW { WCHAR[CCHDEVICENAME] dmDeviceName = 0; @@ -2265,7 +2265,7 @@ struct DEVMODEW { DWORD dmPanningWidth; DWORD dmPanningHeight; } -alias DEVMODEW* PDEVMODEW, NPDEVMODEW, LPDEVMODEW; +alias PDEVMODEW = DEVMODEW*, NPDEVMODEW = DEVMODEW*, LPDEVMODEW = DEVMODEW*; /* * Information about output options @@ -2274,7 +2274,7 @@ struct PSFEATURE_OUTPUT { BOOL bPageIndependent; BOOL bSetPageDevice; } -alias PSFEATURE_OUTPUT* PPSFEATURE_OUTPUT; +alias PPSFEATURE_OUTPUT = PSFEATURE_OUTPUT*; /* * Information about custom paper size @@ -2286,7 +2286,7 @@ struct PSFEATURE_CUSTPAPER { LONG lWidthOffset; LONG lHeightOffset; } -alias PSFEATURE_CUSTPAPER* PPSFEATURE_CUSTPAPER; +alias PPSFEATURE_CUSTPAPER = PSFEATURE_CUSTPAPER*; struct DIBSECTION { BITMAP dsBm; @@ -2295,7 +2295,7 @@ struct DIBSECTION { HANDLE dshSection; DWORD dsOffset; } -alias DIBSECTION* PDIBSECTION; +alias PDIBSECTION = DIBSECTION*; struct DOCINFOA { int cbSize = DOCINFOA.sizeof; @@ -2304,7 +2304,7 @@ struct DOCINFOA { LPCSTR lpszDatatype; DWORD fwType; } -alias DOCINFOA* LPDOCINFOA; +alias LPDOCINFOA = DOCINFOA*; struct DOCINFOW { int cbSize = DOCINFOW.sizeof; @@ -2313,7 +2313,7 @@ struct DOCINFOW { LPCWSTR lpszDatatype; DWORD fwType; } -alias DOCINFOW* LPDOCINFOW; +alias LPDOCINFOW = DOCINFOW*; struct PANOSE { @@ -2328,7 +2328,7 @@ struct PANOSE { BYTE bMidline; BYTE bXHeight; } -alias PANOSE* LPPANOSE; +alias LPPANOSE = PANOSE*; struct LOGFONTA { LONG lfHeight; @@ -2346,7 +2346,7 @@ struct LOGFONTA { BYTE lfPitchAndFamily; CHAR[LF_FACESIZE] lfFaceName = 0; } -alias LOGFONTA* PLOGFONTA, NPLOGFONTA, LPLOGFONTA; +alias PLOGFONTA = LOGFONTA*, NPLOGFONTA = LOGFONTA*, LPLOGFONTA = LOGFONTA*; struct LOGFONTW { LONG lfHeight; @@ -2364,7 +2364,7 @@ struct LOGFONTW { BYTE lfPitchAndFamily; WCHAR[LF_FACESIZE] lfFaceName = 0; } -alias LOGFONTW* PLOGFONTW, NPLOGFONTW, LPLOGFONTW; +alias PLOGFONTW = LOGFONTW*, NPLOGFONTW = LOGFONTW*, LPLOGFONTW = LOGFONTW*; struct EXTLOGFONTA { LOGFONTA elfLogFont; @@ -2378,7 +2378,7 @@ struct EXTLOGFONTA { DWORD elfCulture; PANOSE elfPanose; } -alias EXTLOGFONTA* PEXTLOGFONTA, NPEXTLOGFONTA, LPEXTLOGFONTA; +alias PEXTLOGFONTA = EXTLOGFONTA*, NPEXTLOGFONTA = EXTLOGFONTA*, LPEXTLOGFONTA = EXTLOGFONTA*; struct EXTLOGFONTW { LOGFONTW elfLogFont; @@ -2392,14 +2392,14 @@ struct EXTLOGFONTW { DWORD elfCulture; PANOSE elfPanose; } -alias EXTLOGFONTW* PEXTLOGFONTW, NPEXTLOGFONTW, LPEXTLOGFONTW; +alias PEXTLOGFONTW = EXTLOGFONTW*, NPEXTLOGFONTW = EXTLOGFONTW*, LPEXTLOGFONTW = EXTLOGFONTW*; struct LOGPEN { UINT lopnStyle; POINT lopnWidth; COLORREF lopnColor; } -alias LOGPEN* PLOGPEN, NPLOGPEN, LPLOGPEN; +alias PLOGPEN = LOGPEN*, NPLOGPEN = LOGPEN*, LPLOGPEN = LOGPEN*; // ---------------------- EMR ------------ @@ -2407,7 +2407,7 @@ struct EMR { DWORD iType; DWORD nSize; } -alias EMR* PEMR; +alias PEMR = EMR*; struct EMRANGLEARC { EMR emr; @@ -2416,7 +2416,7 @@ struct EMRANGLEARC { FLOAT eStartAngle; FLOAT eSweepAngle; } -alias EMRANGLEARC* PEMRANGLEARC; +alias PEMRANGLEARC = EMRANGLEARC*; struct EMRARC { EMR emr; @@ -2424,13 +2424,13 @@ struct EMRARC { POINTL ptlStart; POINTL ptlEnd; } -alias EMRARC* PEMRARC; -alias EMRARC EMRARCTO; -alias EMRARCTO* PEMRARCTO; -alias EMRARC EMRCHORD; -alias EMRCHORD* PEMRCHORD; -alias EMRARC EMRPIE; -alias EMRPIE* PEMRPIE; +alias PEMRARC = EMRARC*; +alias EMRARCTO = EMRARC; +alias PEMRARCTO = EMRARCTO*; +alias EMRCHORD = EMRARC; +alias PEMRCHORD = EMRCHORD*; +alias EMRPIE = EMRARC; +alias PEMRPIE = EMRPIE*; struct XFORM { FLOAT eM11; @@ -2440,7 +2440,7 @@ struct XFORM { FLOAT eDx; FLOAT eDy; } -alias XFORM* PXFORM, LPXFORM; +alias PXFORM = XFORM*, LPXFORM = XFORM*; struct EMRBITBLT { EMR emr; @@ -2460,32 +2460,32 @@ struct EMRBITBLT { DWORD offBitsSrc; DWORD cbBitsSrc; } -alias EMRBITBLT* PEMRBITBLT; +alias PEMRBITBLT = EMRBITBLT*; struct LOGBRUSH { UINT lbStyle; COLORREF lbColor; ULONG_PTR lbHatch; } -alias LOGBRUSH PATTERN; -alias LOGBRUSH* PLOGBRUSH, NPLOGBRUSH, LPLOGBRUSH; -alias PATTERN* PPATTERN, NPPATTERN, LPPATTERN; +alias PATTERN = LOGBRUSH; +alias PLOGBRUSH = LOGBRUSH*, NPLOGBRUSH = LOGBRUSH*, LPLOGBRUSH = LOGBRUSH*; +alias PPATTERN = PATTERN*, NPPATTERN = PATTERN*, LPPATTERN = PATTERN*; struct LOGBRUSH32 { UINT lbStyle; COLORREF lbColor; ULONG lbHatch; } -alias LOGBRUSH32* PLOGBRUSH32, NPLOGBRUSH32, LPLOGBRUSH32; +alias PLOGBRUSH32 = LOGBRUSH32*, NPLOGBRUSH32 = LOGBRUSH32*, LPLOGBRUSH32 = LOGBRUSH32*; struct EMRCREATEBRUSHINDIRECT { EMR emr; DWORD ihBrush; LOGBRUSH32 lb; } -alias EMRCREATEBRUSHINDIRECT* PEMRCREATEBRUSHINDIRECT; +alias PEMRCREATEBRUSHINDIRECT = EMRCREATEBRUSHINDIRECT*; -alias LONG LCSCSTYPE, LCSGAMUTMATCH; +alias LCSCSTYPE = LONG, LCSGAMUTMATCH = LONG; struct LOGCOLORSPACEA { DWORD lcsSignature; @@ -2499,7 +2499,7 @@ struct LOGCOLORSPACEA { DWORD lcsGammaBlue; CHAR[MAX_PATH] lcsFilename = 0; } -alias LOGCOLORSPACEA* LPLOGCOLORSPACEA; +alias LPLOGCOLORSPACEA = LOGCOLORSPACEA*; struct LOGCOLORSPACEW { DWORD lcsSignature; @@ -2513,9 +2513,9 @@ struct LOGCOLORSPACEW { DWORD lcsGammaBlue; WCHAR[MAX_PATH] lcsFilename = 0; } -alias LOGCOLORSPACEW* LPLOGCOLORSPACEW; +alias LPLOGCOLORSPACEW = LOGCOLORSPACEW*; -alias USHORT COLOR16; +alias COLOR16 = USHORT; struct TRIVERTEX { LONG x; LONG y; @@ -2524,14 +2524,14 @@ struct TRIVERTEX { COLOR16 Blue; COLOR16 Alpha; } -alias TRIVERTEX* PTRIVERTEX, LPTRIVERTEX; +alias PTRIVERTEX = TRIVERTEX*, LPTRIVERTEX = TRIVERTEX*; struct EMRGLSRECORD { EMR emr; DWORD cbData; BYTE[1] Data; } -alias EMRGLSRECORD* PEMRGLSRECORD; +alias PEMRGLSRECORD = EMRGLSRECORD*; struct EMRGLSBOUNDEDRECORD { EMR emr; @@ -2539,30 +2539,30 @@ struct EMRGLSBOUNDEDRECORD { DWORD cbData; BYTE[1] Data; } -alias EMRGLSBOUNDEDRECORD* PEMRGLSBOUNDEDRECORD; +alias PEMRGLSBOUNDEDRECORD = EMRGLSBOUNDEDRECORD*; struct EMRPIXELFORMAT { EMR emr; PIXELFORMATDESCRIPTOR pfd; } -alias EMRPIXELFORMAT* PEMRPIXELFORMAT; +alias PEMRPIXELFORMAT = EMRPIXELFORMAT*; struct EMRCREATECOLORSPACE { EMR emr; DWORD ihCS; LOGCOLORSPACEA lcs; // ANSI version } -alias EMRCREATECOLORSPACE* PEMRCREATECOLORSPACE; +alias PEMRCREATECOLORSPACE = EMRCREATECOLORSPACE*; struct EMRSETCOLORSPACE { EMR emr; DWORD ihCS; } -alias EMRSETCOLORSPACE* PEMRSETCOLORSPACE; -alias EMRSETCOLORSPACE EMRSELECTCOLORSPACE; -alias EMRSELECTCOLORSPACE* PEMRSELECTCOLORSPACE; -alias EMRSETCOLORSPACE EMRDELETECOLORSPACE; -alias EMRDELETECOLORSPACE* PEMRDELETECOLORSPACE; +alias PEMRSETCOLORSPACE = EMRSETCOLORSPACE*; +alias EMRSELECTCOLORSPACE = EMRSETCOLORSPACE; +alias PEMRSELECTCOLORSPACE = EMRSELECTCOLORSPACE*; +alias EMRDELETECOLORSPACE = EMRSETCOLORSPACE; +alias PEMRDELETECOLORSPACE = EMRDELETECOLORSPACE*; static if (_WIN32_WINNT >= 0x500) { @@ -2572,9 +2572,9 @@ static if (_WIN32_WINNT >= 0x500) { INT cbEscData; BYTE[1] EscData; } - alias EMREXTESCAPE* PEMREXTESCAPE; - alias EMREXTESCAPE EMRDRAWESCAPE; - alias EMRDRAWESCAPE* PEMRDRAWESCAPE; + alias PEMREXTESCAPE = EMREXTESCAPE*; + alias EMRDRAWESCAPE = EMREXTESCAPE; + alias PEMRDRAWESCAPE = EMRDRAWESCAPE*; struct EMRNAMEDESCAPE { EMR emr; @@ -2583,7 +2583,7 @@ static if (_WIN32_WINNT >= 0x500) { INT cbEscData; BYTE[1] EscData; } - alias EMRNAMEDESCAPE* PEMRNAMEDESCAPE; + alias PEMRNAMEDESCAPE = EMRNAMEDESCAPE*; struct EMRSETICMPROFILE { EMR emr; @@ -2592,11 +2592,11 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cbData; BYTE[1] Data; } - alias EMRSETICMPROFILE* PEMRSETICMPROFILE; - alias EMRSETICMPROFILE EMRSETICMPROFILEA; - alias EMRSETICMPROFILEA* PEMRSETICMPROFILEA; - alias EMRSETICMPROFILE EMRSETICMPROFILEW; - alias EMRSETICMPROFILEW* PEMRSETICMPROFILEW; + alias PEMRSETICMPROFILE = EMRSETICMPROFILE*; + alias EMRSETICMPROFILEA = EMRSETICMPROFILE; + alias PEMRSETICMPROFILEA = EMRSETICMPROFILEA*; + alias EMRSETICMPROFILEW = EMRSETICMPROFILE; + alias PEMRSETICMPROFILEW = EMRSETICMPROFILEW*; struct EMRCREATECOLORSPACEW { EMR emr; @@ -2606,7 +2606,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cbData; BYTE[1] Data; } - alias EMRCREATECOLORSPACEW* PEMRCREATECOLORSPACEW; + alias PEMRCREATECOLORSPACEW = EMRCREATECOLORSPACEW*; struct EMRCOLORMATCHTOTARGET { EMR emr; @@ -2616,7 +2616,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cbData; BYTE[1] Data; } - alias EMRCOLORMATCHTOTARGET* PEMRCOLORMATCHTOTARGET; + alias PEMRCOLORMATCHTOTARGET = EMRCOLORMATCHTOTARGET*; struct EMRCOLORCORRECTPALETTE { EMR emr; @@ -2625,7 +2625,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD nPalEntries; DWORD nReserved; } - alias EMRCOLORCORRECTPALETTE* PEMRCOLORCORRECTPALETTE; + alias PEMRCOLORCORRECTPALETTE = EMRCOLORCORRECTPALETTE*; struct EMRALPHABLEND { EMR emr; @@ -2647,7 +2647,7 @@ static if (_WIN32_WINNT >= 0x500) { LONG cxSrc; LONG cySrc; } - alias EMRALPHABLEND* PEMRALPHABLEND; + alias PEMRALPHABLEND = EMRALPHABLEND*; struct EMRGRADIENTFILL { EMR emr; @@ -2657,7 +2657,7 @@ static if (_WIN32_WINNT >= 0x500) { ULONG ulMode; TRIVERTEX[1] Ver; } - alias EMRGRADIENTFILL* PEMRGRADIENTFILL; + alias PEMRGRADIENTFILL = EMRGRADIENTFILL*; struct EMRTRANSPARENTBLT { EMR emr; @@ -2679,7 +2679,7 @@ static if (_WIN32_WINNT >= 0x500) { LONG cxSrc; LONG cySrc; } - alias EMRTRANSPARENTBLT* PEMRTRANSPARENTBLT; + alias PEMRTRANSPARENTBLT = EMRTRANSPARENTBLT*; } struct EMRCREATEDIBPATTERNBRUSHPT { @@ -2691,7 +2691,7 @@ struct EMRCREATEDIBPATTERNBRUSHPT { DWORD offBits; DWORD cbBits; } -alias EMRCREATEDIBPATTERNBRUSHPT* PEMRCREATEDIBPATTERNBRUSHPT; +alias PEMRCREATEDIBPATTERNBRUSHPT = EMRCREATEDIBPATTERNBRUSHPT*; struct EMRCREATEMONOBRUSH { EMR emr; @@ -2702,7 +2702,7 @@ struct EMRCREATEMONOBRUSH { DWORD offBits; DWORD cbBits; } -alias EMRCREATEMONOBRUSH* PEMRCREATEMONOBRUSH; +alias PEMRCREATEMONOBRUSH = EMRCREATEMONOBRUSH*; struct PALETTEENTRY { BYTE peRed; @@ -2710,37 +2710,37 @@ struct PALETTEENTRY { BYTE peBlue; BYTE peFlags; } -alias PALETTEENTRY* PPALETTEENTRY, LPPALETTEENTRY; +alias PPALETTEENTRY = PALETTEENTRY*, LPPALETTEENTRY = PALETTEENTRY*; struct LOGPALETTE { WORD palVersion; WORD palNumEntries; PALETTEENTRY[1] palPalEntry; } -alias LOGPALETTE* PLOGPALETTE, NPLOGPALETTE, LPLOGPALETTE; +alias PLOGPALETTE = LOGPALETTE*, NPLOGPALETTE = LOGPALETTE*, LPLOGPALETTE = LOGPALETTE*; struct EMRCREATEPALETTE { EMR emr; DWORD ihPal; LOGPALETTE lgpl; } -alias EMRCREATEPALETTE* PEMRCREATEPALETTE; +alias PEMRCREATEPALETTE = EMRCREATEPALETTE*; struct EMRCREATEPEN { EMR emr; DWORD ihPen; LOGPEN lopn; } -alias EMRCREATEPEN* PEMRCREATEPEN; +alias PEMRCREATEPEN = EMRCREATEPEN*; struct EMRELLIPSE { EMR emr; RECTL rclBox; } -alias EMRELLIPSE* PEMRELLIPSE; +alias PEMRELLIPSE = EMRELLIPSE*; -alias EMRELLIPSE EMRRECTANGLE; -alias EMRRECTANGLE* PEMRRECTANGLE; +alias EMRRECTANGLE = EMRELLIPSE; +alias PEMRRECTANGLE = EMRRECTANGLE*; struct EMREOF { EMR emr; @@ -2748,22 +2748,22 @@ struct EMREOF { DWORD offPalEntries; DWORD nSizeLast; } -alias EMREOF* PEMREOF; +alias PEMREOF = EMREOF*; struct EMREXCLUDECLIPRECT { EMR emr; RECTL rclClip; } -alias EMREXCLUDECLIPRECT* PEMREXCLUDECLIPRECT; -alias EMREXCLUDECLIPRECT EMRINTERSECTCLIPRECT; -alias EMRINTERSECTCLIPRECT* PEMRINTERSECTCLIPRECT; +alias PEMREXCLUDECLIPRECT = EMREXCLUDECLIPRECT*; +alias EMRINTERSECTCLIPRECT = EMREXCLUDECLIPRECT; +alias PEMRINTERSECTCLIPRECT = EMRINTERSECTCLIPRECT*; struct EMREXTCREATEFONTINDIRECTW { EMR emr; DWORD ihFont; EXTLOGFONTW elfw; } -alias EMREXTCREATEFONTINDIRECTW* PEMREXTCREATEFONTINDIRECTW; +alias PEMREXTCREATEFONTINDIRECTW = EMREXTCREATEFONTINDIRECTW*; struct EXTLOGPEN { UINT elpPenStyle; @@ -2774,7 +2774,7 @@ struct EXTLOGPEN { DWORD elpNumEntries; DWORD[1] elpStyleEntry; } -alias EXTLOGPEN* PEXTLOGPEN, NPEXTLOGPEN, LPEXTLOGPEN; +alias PEXTLOGPEN = EXTLOGPEN*, NPEXTLOGPEN = EXTLOGPEN*, LPEXTLOGPEN = EXTLOGPEN*; struct EXTLOGPEN32 { UINT elpPenStyle; @@ -2785,7 +2785,7 @@ struct EXTLOGPEN32 { DWORD elpNumEntries; DWORD[1] elpStyleEntry; } -alias EXTLOGPEN32* PEXTLOGPEN32, NPEXTLOGPEN32, LPEXTLOGPEN32; +alias PEXTLOGPEN32 = EXTLOGPEN32*, NPEXTLOGPEN32 = EXTLOGPEN32*, LPEXTLOGPEN32 = EXTLOGPEN32*; struct EMREXTCREATEPEN { EMR emr; @@ -2796,7 +2796,7 @@ struct EMREXTCREATEPEN { DWORD cbBits; EXTLOGPEN32 elp; } -alias EMREXTCREATEPEN* PEMREXTCREATEPEN; +alias PEMREXTCREATEPEN = EMREXTCREATEPEN*; struct EMREXTFLOODFILL { EMR emr; @@ -2804,7 +2804,7 @@ struct EMREXTFLOODFILL { COLORREF crColor; DWORD iMode; } -alias EMREXTFLOODFILL* PEMREXTFLOODFILL; +alias PEMREXTFLOODFILL = EMREXTFLOODFILL*; struct EMREXTSELECTCLIPRGN { EMR emr; @@ -2812,7 +2812,7 @@ struct EMREXTSELECTCLIPRGN { DWORD iMode; BYTE [1]RgnData; } -alias EMREXTSELECTCLIPRGN* PEMREXTSELECTCLIPRGN; +alias PEMREXTSELECTCLIPRGN = EMREXTSELECTCLIPRGN*; struct EMRTEXT { POINTL ptlReference; @@ -2822,7 +2822,7 @@ struct EMRTEXT { RECTL rcl; DWORD offDx; } -alias EMRTEXT* PEMRTEXT; +alias PEMRTEXT = EMRTEXT*; struct EMREXTTEXTOUTA { EMR emr; @@ -2832,21 +2832,21 @@ struct EMREXTTEXTOUTA { FLOAT eyScale; EMRTEXT emrtext; } -alias EMREXTTEXTOUTA* PEMREXTTEXTOUTA; -alias EMREXTTEXTOUTA EMREXTTEXTOUTW; -alias EMREXTTEXTOUTW* PEMREXTTEXTOUTW; +alias PEMREXTTEXTOUTA = EMREXTTEXTOUTA*; +alias EMREXTTEXTOUTW = EMREXTTEXTOUTA; +alias PEMREXTTEXTOUTW = EMREXTTEXTOUTW*; struct EMRFILLPATH { EMR emr; RECTL rclBounds; } -alias EMRFILLPATH* PEMRFILLPATH; +alias PEMRFILLPATH = EMRFILLPATH*; -alias EMRFILLPATH EMRSTROKEANDFILLPATH; -alias EMRSTROKEANDFILLPATH* PEMRSTROKEANDFILLPATH; +alias EMRSTROKEANDFILLPATH = EMRFILLPATH; +alias PEMRSTROKEANDFILLPATH = EMRSTROKEANDFILLPATH*; -alias EMRFILLPATH EMRSTROKEPATH; -alias EMRSTROKEPATH* PEMRSTROKEPATH; +alias EMRSTROKEPATH = EMRFILLPATH; +alias PEMRSTROKEPATH = EMRSTROKEPATH*; struct EMRFILLRGN { EMR emr; @@ -2855,7 +2855,7 @@ struct EMRFILLRGN { DWORD ihBrush; BYTE[1] RgnData; } -alias EMRFILLRGN* PEMRFILLRGN; +alias PEMRFILLRGN = EMRFILLRGN*; struct EMRFORMAT { DWORD dSignature; @@ -2863,7 +2863,7 @@ struct EMRFORMAT { DWORD cbData; DWORD offData; } -alias EMRFORMAT* PEMRFORMAT; +alias PEMRFORMAT = EMRFORMAT*; struct EMRFRAMERGN { EMR emr; @@ -2873,14 +2873,14 @@ struct EMRFRAMERGN { SIZEL szlStroke; BYTE[1] RgnData; } -alias EMRFRAMERGN* PEMRFRAMERGN; +alias PEMRFRAMERGN = EMRFRAMERGN*; struct EMRGDICOMMENT { EMR emr; DWORD cbData; BYTE[1] Data; } -alias EMRGDICOMMENT* PEMRGDICOMMENT; +alias PEMRGDICOMMENT = EMRGDICOMMENT*; struct EMRINVERTRGN { EMR emr; @@ -2888,17 +2888,17 @@ struct EMRINVERTRGN { DWORD cbRgnData; BYTE[1] RgnData; } -alias EMRINVERTRGN* PEMRINVERTRGN; -alias EMRINVERTRGN EMRPAINTRGN; -alias EMRPAINTRGN* PEMRPAINTRGN; +alias PEMRINVERTRGN = EMRINVERTRGN*; +alias EMRPAINTRGN = EMRINVERTRGN; +alias PEMRPAINTRGN = EMRPAINTRGN*; struct EMRLINETO { EMR emr; POINTL ptl; } -alias EMRLINETO* PEMRLINETO; -alias EMRLINETO EMRMOVETOEX; -alias EMRMOVETOEX* PEMRMOVETOEX; +alias PEMRLINETO = EMRLINETO*; +alias EMRMOVETOEX = EMRLINETO; +alias PEMRMOVETOEX = EMRMOVETOEX*; struct EMRMASKBLT { EMR emr; @@ -2925,20 +2925,20 @@ struct EMRMASKBLT { DWORD offBitsMask; DWORD cbBitsMask; } -alias EMRMASKBLT* PEMRMASKBLT; +alias PEMRMASKBLT = EMRMASKBLT*; struct EMRMODIFYWORLDTRANSFORM { EMR emr; XFORM xform; DWORD iMode; } -alias EMRMODIFYWORLDTRANSFORM* PEMRMODIFYWORLDTRANSFORM; +alias PEMRMODIFYWORLDTRANSFORM = EMRMODIFYWORLDTRANSFORM*; struct EMROFFSETCLIPRGN { EMR emr; POINTL ptlOffset; } -alias EMROFFSETCLIPRGN* PEMROFFSETCLIPRGN; +alias PEMROFFSETCLIPRGN = EMROFFSETCLIPRGN*; struct EMRPLGBLT { EMR emr; @@ -2963,7 +2963,7 @@ struct EMRPLGBLT { DWORD offBitsMask; DWORD cbBitsMask; } -alias EMRPLGBLT* PEMRPLGBLT; +alias PEMRPLGBLT = EMRPLGBLT*; struct EMRPOLYDRAW { EMR emr; @@ -2972,7 +2972,7 @@ struct EMRPOLYDRAW { POINTL[1] aptl; BYTE[1] abTypes; } -alias EMRPOLYDRAW* PEMRPOLYDRAW; +alias PEMRPOLYDRAW = EMRPOLYDRAW*; struct EMRPOLYDRAW16 { EMR emr; @@ -2981,7 +2981,7 @@ struct EMRPOLYDRAW16 { POINTS[1] apts; BYTE[1] abTypes; } -alias EMRPOLYDRAW16* PEMRPOLYDRAW16; +alias PEMRPOLYDRAW16 = EMRPOLYDRAW16*; struct EMRPOLYLINE { EMR emr; @@ -2989,15 +2989,15 @@ struct EMRPOLYLINE { DWORD cptl; POINTL[1] aptl; } -alias EMRPOLYLINE* PEMRPOLYLINE; -alias EMRPOLYLINE EMRPOLYBEZIER; -alias EMRPOLYBEZIER* PEMRPOLYBEZIER; -alias EMRPOLYLINE EMRPOLYGON; -alias EMRPOLYGON* PEMRPOLYGON; -alias EMRPOLYLINE EMRPOLYBEZIERTO; -alias EMRPOLYBEZIERTO* PEMRPOLYBEZIERTO; -alias EMRPOLYLINE EMRPOLYLINETO; -alias EMRPOLYLINETO* PEMRPOLYLINETO; +alias PEMRPOLYLINE = EMRPOLYLINE*; +alias EMRPOLYBEZIER = EMRPOLYLINE; +alias PEMRPOLYBEZIER = EMRPOLYBEZIER*; +alias EMRPOLYGON = EMRPOLYLINE; +alias PEMRPOLYGON = EMRPOLYGON*; +alias EMRPOLYBEZIERTO = EMRPOLYLINE; +alias PEMRPOLYBEZIERTO = EMRPOLYBEZIERTO*; +alias EMRPOLYLINETO = EMRPOLYLINE; +alias PEMRPOLYLINETO = EMRPOLYLINETO*; struct EMRPOLYLINE16 { EMR emr; @@ -3005,15 +3005,15 @@ struct EMRPOLYLINE16 { DWORD cpts; POINTS[1] apts; } -alias EMRPOLYLINE16* PEMRPOLYLINE16; -alias EMRPOLYLINE16 EMRPOLYBEZIER16; -alias EMRPOLYBEZIER16* PEMRPOLYBEZIER16; -alias EMRPOLYLINE16 EMRPOLYGON16; -alias EMRPOLYGON16* PEMRPOLYGON16; -alias EMRPOLYLINE16 EMRPOLYBEZIERTO16; -alias EMRPOLYBEZIERTO16* PEMRPOLYBEZIERTO16; -alias EMRPOLYLINE16 EMRPOLYLINETO16; -alias EMRPOLYLINETO16* PEMRPOLYLINETO16; +alias PEMRPOLYLINE16 = EMRPOLYLINE16*; +alias EMRPOLYBEZIER16 = EMRPOLYLINE16; +alias PEMRPOLYBEZIER16 = EMRPOLYBEZIER16*; +alias EMRPOLYGON16 = EMRPOLYLINE16; +alias PEMRPOLYGON16 = EMRPOLYGON16*; +alias EMRPOLYBEZIERTO16 = EMRPOLYLINE16; +alias PEMRPOLYBEZIERTO16 = EMRPOLYBEZIERTO16*; +alias EMRPOLYLINETO16 = EMRPOLYLINE16; +alias PEMRPOLYLINETO16 = EMRPOLYLINETO16*; struct EMRPOLYPOLYLINE { EMR emr; @@ -3023,9 +3023,9 @@ struct EMRPOLYPOLYLINE { DWORD[1] aPolyCounts; POINTL[1] aptl; } -alias EMRPOLYPOLYLINE* PEMRPOLYPOLYLINE; -alias EMRPOLYPOLYLINE EMRPOLYPOLYGON; -alias EMRPOLYPOLYGON* PEMRPOLYPOLYGON; +alias PEMRPOLYPOLYLINE = EMRPOLYPOLYLINE*; +alias EMRPOLYPOLYGON = EMRPOLYPOLYLINE; +alias PEMRPOLYPOLYGON = EMRPOLYPOLYGON*; struct EMRPOLYPOLYLINE16 { EMR emr; @@ -3035,9 +3035,9 @@ struct EMRPOLYPOLYLINE16 { DWORD[1] aPolyCounts; POINTS[1] apts; } -alias EMRPOLYPOLYLINE16* PEMRPOLYPOLYLINE16; -alias EMRPOLYPOLYLINE16 EMRPOLYPOLYGON16; -alias EMRPOLYPOLYGON16* PEMRPOLYPOLYGON16; +alias PEMRPOLYPOLYLINE16 = EMRPOLYPOLYLINE16*; +alias EMRPOLYPOLYGON16 = EMRPOLYPOLYLINE16; +alias PEMRPOLYPOLYGON16 = EMRPOLYPOLYGON16*; struct EMRPOLYTEXTOUTA { EMR emr; @@ -3048,29 +3048,29 @@ struct EMRPOLYTEXTOUTA { LONG cStrings; EMRTEXT[1] aemrtext; } -alias EMRPOLYTEXTOUTA* PEMRPOLYTEXTOUTA; -alias EMRPOLYTEXTOUTA EMRPOLYTEXTOUTW; -alias EMRPOLYTEXTOUTW* PEMRPOLYTEXTOUTW; +alias PEMRPOLYTEXTOUTA = EMRPOLYTEXTOUTA*; +alias EMRPOLYTEXTOUTW = EMRPOLYTEXTOUTA; +alias PEMRPOLYTEXTOUTW = EMRPOLYTEXTOUTW*; struct EMRRESIZEPALETTE { EMR emr; DWORD ihPal; DWORD cEntries; } -alias EMRRESIZEPALETTE* PEMRRESIZEPALETTE; +alias PEMRRESIZEPALETTE = EMRRESIZEPALETTE*; struct EMRRESTOREDC { EMR emr; LONG iRelative; } -alias EMRRESTOREDC* PEMRRESTOREDC; +alias PEMRRESTOREDC = EMRRESTOREDC*; struct EMRROUNDRECT { EMR emr; RECTL rclBox; SIZEL szlCorner; } -alias EMRROUNDRECT* PEMRROUNDRECT; +alias PEMRROUNDRECT = EMRROUNDRECT*; struct EMRSCALEVIEWPORTEXTEX { EMR emr; @@ -3079,43 +3079,43 @@ struct EMRSCALEVIEWPORTEXTEX { LONG yNum; LONG yDenom; } -alias EMRSCALEVIEWPORTEXTEX* PEMRSCALEVIEWPORTEXTEX; -alias EMRSCALEVIEWPORTEXTEX EMRSCALEWINDOWEXTEX; -alias EMRSCALEWINDOWEXTEX* PEMRSCALEWINDOWEXTEX; +alias PEMRSCALEVIEWPORTEXTEX = EMRSCALEVIEWPORTEXTEX*; +alias EMRSCALEWINDOWEXTEX = EMRSCALEVIEWPORTEXTEX; +alias PEMRSCALEWINDOWEXTEX = EMRSCALEWINDOWEXTEX*; struct EMRSELECTOBJECT { EMR emr; DWORD ihObject; } -alias EMRSELECTOBJECT* PEMRSELECTOBJECT; -alias EMRSELECTOBJECT EMRDELETEOBJECT; -alias EMRDELETEOBJECT* PEMRDELETEOBJECT; +alias PEMRSELECTOBJECT = EMRSELECTOBJECT*; +alias EMRDELETEOBJECT = EMRSELECTOBJECT; +alias PEMRDELETEOBJECT = EMRDELETEOBJECT*; struct EMRSELECTPALETTE { EMR emr; DWORD ihPal; } -alias EMRSELECTPALETTE* PEMRSELECTPALETTE; +alias PEMRSELECTPALETTE = EMRSELECTPALETTE*; struct EMRSETARCDIRECTION { EMR emr; DWORD iArcDirection; } -alias EMRSETARCDIRECTION* PEMRSETARCDIRECTION; +alias PEMRSETARCDIRECTION = EMRSETARCDIRECTION*; struct EMRSETTEXTCOLOR { EMR emr; COLORREF crColor; } -alias EMRSETTEXTCOLOR* PEMRSETTEXTCOLOR; -alias EMRSETTEXTCOLOR EMRSETBKCOLOR; -alias EMRSETBKCOLOR* PEMRSETBKCOLOR; +alias PEMRSETTEXTCOLOR = EMRSETTEXTCOLOR*; +alias EMRSETBKCOLOR = EMRSETTEXTCOLOR; +alias PEMRSETBKCOLOR = EMRSETBKCOLOR*; struct EMRSETCOLORADJUSTMENT { EMR emr; COLORADJUSTMENT ColorAdjustment; } -alias EMRSETCOLORADJUSTMENT* PEMRSETCOLORADJUSTMENT; +alias PEMRSETCOLORADJUSTMENT = EMRSETCOLORADJUSTMENT*; struct EMRSETDIBITSTODEVICE { EMR emr; @@ -3134,19 +3134,19 @@ struct EMRSETDIBITSTODEVICE { DWORD iStartScan; DWORD cScans; } -alias EMRSETDIBITSTODEVICE* PEMRSETDIBITSTODEVICE; +alias PEMRSETDIBITSTODEVICE = EMRSETDIBITSTODEVICE*; struct EMRSETMAPPERFLAGS { EMR emr; DWORD dwFlags; } -alias EMRSETMAPPERFLAGS* PEMRSETMAPPERFLAGS; +alias PEMRSETMAPPERFLAGS = EMRSETMAPPERFLAGS*; struct EMRSETMITERLIMIT { EMR emr; FLOAT eMiterLimit; } -alias EMRSETMITERLIMIT* PEMRSETMITERLIMIT; +alias PEMRSETMITERLIMIT = EMRSETMITERLIMIT*; struct EMRSETPALETTEENTRIES { EMR emr; @@ -3155,38 +3155,38 @@ struct EMRSETPALETTEENTRIES { DWORD cEntries; PALETTEENTRY[1] aPalEntries; } -alias EMRSETPALETTEENTRIES* PEMRSETPALETTEENTRIES; +alias PEMRSETPALETTEENTRIES = EMRSETPALETTEENTRIES*; struct EMRSETPIXELV { EMR emr; POINTL ptlPixel; COLORREF crColor; } -alias EMRSETPIXELV* PEMRSETPIXELV; +alias PEMRSETPIXELV = EMRSETPIXELV*; struct EMRSETVIEWPORTEXTEX { EMR emr; SIZEL szlExtent; } -alias EMRSETVIEWPORTEXTEX* PEMRSETVIEWPORTEXTEX; -alias EMRSETVIEWPORTEXTEX EMRSETWINDOWEXTEX; -alias EMRSETWINDOWEXTEX* PEMRSETWINDOWEXTEX; +alias PEMRSETVIEWPORTEXTEX = EMRSETVIEWPORTEXTEX*; +alias EMRSETWINDOWEXTEX = EMRSETVIEWPORTEXTEX; +alias PEMRSETWINDOWEXTEX = EMRSETWINDOWEXTEX*; struct EMRSETVIEWPORTORGEX { EMR emr; POINTL ptlOrigin; } -alias EMRSETVIEWPORTORGEX* PEMRSETVIEWPORTORGEX; -alias EMRSETVIEWPORTORGEX EMRSETWINDOWORGEX; -alias EMRSETWINDOWORGEX* PEMRSETWINDOWORGEX; -alias EMRSETVIEWPORTORGEX EMRSETBRUSHORGEX; -alias EMRSETBRUSHORGEX* PEMRSETBRUSHORGEX; +alias PEMRSETVIEWPORTORGEX = EMRSETVIEWPORTORGEX*; +alias EMRSETWINDOWORGEX = EMRSETVIEWPORTORGEX; +alias PEMRSETWINDOWORGEX = EMRSETWINDOWORGEX*; +alias EMRSETBRUSHORGEX = EMRSETVIEWPORTORGEX; +alias PEMRSETBRUSHORGEX = EMRSETBRUSHORGEX*; struct EMRSETWORLDTRANSFORM { EMR emr; XFORM xform; } -alias EMRSETWORLDTRANSFORM* PEMRSETWORLDTRANSFORM; +alias PEMRSETWORLDTRANSFORM = EMRSETWORLDTRANSFORM*; struct EMRSTRETCHBLT { EMR emr; @@ -3208,7 +3208,7 @@ struct EMRSTRETCHBLT { LONG cxSrc; LONG cySrc; } -alias EMRSTRETCHBLT* PEMRSTRETCHBLT; +alias PEMRSTRETCHBLT = EMRSTRETCHBLT*; struct EMRSTRETCHDIBITS { EMR emr; @@ -3228,53 +3228,53 @@ struct EMRSTRETCHDIBITS { LONG cxDest; LONG cyDest; } -alias EMRSTRETCHDIBITS* PEMRSTRETCHDIBITS; +alias PEMRSTRETCHDIBITS = EMRSTRETCHDIBITS*; struct EMRABORTPATH { EMR emr; } -alias EMRABORTPATH* PEMRABORTPATH; -alias EMRABORTPATH EMRBEGINPATH; -alias EMRBEGINPATH* PEMRBEGINPATH; -alias EMRABORTPATH EMRENDPATH; -alias EMRENDPATH* PEMRENDPATH; -alias EMRABORTPATH EMRCLOSEFIGURE; -alias EMRCLOSEFIGURE* PEMRCLOSEFIGURE; -alias EMRABORTPATH EMRFLATTENPATH; -alias EMRFLATTENPATH* PEMRFLATTENPATH; -alias EMRABORTPATH EMRWIDENPATH; -alias EMRWIDENPATH* PEMRWIDENPATH; -alias EMRABORTPATH EMRSETMETARGN; -alias EMRSETMETARGN* PEMRSETMETARGN; -alias EMRABORTPATH EMRSAVEDC; -alias EMRSAVEDC* PEMRSAVEDC; -alias EMRABORTPATH EMRREALIZEPALETTE; -alias EMRREALIZEPALETTE* PEMRREALIZEPALETTE; +alias PEMRABORTPATH = EMRABORTPATH*; +alias EMRBEGINPATH = EMRABORTPATH; +alias PEMRBEGINPATH = EMRBEGINPATH*; +alias EMRENDPATH = EMRABORTPATH; +alias PEMRENDPATH = EMRENDPATH*; +alias EMRCLOSEFIGURE = EMRABORTPATH; +alias PEMRCLOSEFIGURE = EMRCLOSEFIGURE*; +alias EMRFLATTENPATH = EMRABORTPATH; +alias PEMRFLATTENPATH = EMRFLATTENPATH*; +alias EMRWIDENPATH = EMRABORTPATH; +alias PEMRWIDENPATH = EMRWIDENPATH*; +alias EMRSETMETARGN = EMRABORTPATH; +alias PEMRSETMETARGN = EMRSETMETARGN*; +alias EMRSAVEDC = EMRABORTPATH; +alias PEMRSAVEDC = EMRSAVEDC*; +alias EMRREALIZEPALETTE = EMRABORTPATH; +alias PEMRREALIZEPALETTE = EMRREALIZEPALETTE*; struct EMRSELECTCLIPPATH { EMR emr; DWORD iMode; } -alias EMRSELECTCLIPPATH* PEMRSELECTCLIPPATH; -alias EMRSELECTCLIPPATH EMRSETBKMODE; -alias EMRSETBKMODE* PEMRSETBKMODE; -alias EMRSELECTCLIPPATH EMRSETMAPMODE; -alias EMRSETMAPMODE* PEMRSETMAPMODE; -alias EMRSELECTCLIPPATH EMRSETPOLYFILLMODE; -alias EMRSETPOLYFILLMODE* PEMRSETPOLYFILLMODE; -alias EMRSELECTCLIPPATH EMRSETROP2; -alias EMRSETROP2* PEMRSETROP2; -alias EMRSELECTCLIPPATH EMRSETSTRETCHBLTMODE; -alias EMRSETSTRETCHBLTMODE* PEMRSETSTRETCHBLTMODE; -alias EMRSELECTCLIPPATH EMRSETICMMODE; -alias EMRSETICMMODE* PEMRSETICMMODE; -alias EMRSELECTCLIPPATH EMRSETTEXTALIGN; -alias EMRSETTEXTALIGN* PEMRSETTEXTALIGN; -alias EMRSELECTCLIPPATH EMRENABLEICM; -alias EMRENABLEICM* PEMRENABLEICM; +alias PEMRSELECTCLIPPATH = EMRSELECTCLIPPATH*; +alias EMRSETBKMODE = EMRSELECTCLIPPATH; +alias PEMRSETBKMODE = EMRSETBKMODE*; +alias EMRSETMAPMODE = EMRSELECTCLIPPATH; +alias PEMRSETMAPMODE = EMRSETMAPMODE*; +alias EMRSETPOLYFILLMODE = EMRSELECTCLIPPATH; +alias PEMRSETPOLYFILLMODE = EMRSETPOLYFILLMODE*; +alias EMRSETROP2 = EMRSELECTCLIPPATH; +alias PEMRSETROP2 = EMRSETROP2*; +alias EMRSETSTRETCHBLTMODE = EMRSELECTCLIPPATH; +alias PEMRSETSTRETCHBLTMODE = EMRSETSTRETCHBLTMODE*; +alias EMRSETICMMODE = EMRSELECTCLIPPATH; +alias PEMRSETICMMODE = EMRSETICMMODE*; +alias EMRSETTEXTALIGN = EMRSELECTCLIPPATH; +alias PEMRSETTEXTALIGN = EMRSETTEXTALIGN*; +alias EMRENABLEICM = EMRSELECTCLIPPATH; +alias PEMRENABLEICM = EMRENABLEICM*; static if (_WIN32_WINNT >= 0x500) { - alias EMRSELECTCLIPPATH EMRSETLAYOUT; - alias EMRSETLAYOUT* PEMRSETLAYOUT; + alias EMRSETLAYOUT = EMRSELECTCLIPPATH; + alias PEMRSETLAYOUT = EMRSETLAYOUT*; } align(2): @@ -3288,8 +3288,8 @@ align(2): DWORD mtMaxRecord; WORD mtNoParameters; } -alias METAHEADER* PMETAHEADER; -alias METAHEADER* LPMETAHEADER; +alias PMETAHEADER = METAHEADER*; +alias LPMETAHEADER = METAHEADER*; align: @@ -3316,29 +3316,29 @@ struct ENHMETAHEADER { SIZEL szlMicrometers; } } -alias ENHMETAHEADER* PENHMETAHEADER, LPENHMETAHEADER; +alias PENHMETAHEADER = ENHMETAHEADER*, LPENHMETAHEADER = ENHMETAHEADER*; struct METARECORD { DWORD rdSize; WORD rdFunction; WORD[1] rdParm; } -alias METARECORD* PMETARECORD; -alias METARECORD* LPMETARECORD; +alias PMETARECORD = METARECORD*; +alias LPMETARECORD = METARECORD*; struct ENHMETARECORD { DWORD iType; DWORD nSize; DWORD[1] dParm; } -alias ENHMETARECORD* PENHMETARECORD, LPENHMETARECORD; +alias PENHMETARECORD = ENHMETARECORD*, LPENHMETARECORD = ENHMETARECORD*; // --- struct HANDLETABLE { HGDIOBJ[1] objectHandle; } -alias HANDLETABLE* PHANDLETABLE, LPHANDLETABLE; +alias PHANDLETABLE = HANDLETABLE*, LPHANDLETABLE = HANDLETABLE*; struct TEXTMETRICA { LONG tmHeight; @@ -3362,7 +3362,7 @@ struct TEXTMETRICA { BYTE tmPitchAndFamily; BYTE tmCharSet; } -alias TEXTMETRICA* PTEXTMETRICA, NPTEXTMETRICA, LPTEXTMETRICA; +alias PTEXTMETRICA = TEXTMETRICA*, NPTEXTMETRICA = TEXTMETRICA*, LPTEXTMETRICA = TEXTMETRICA*; struct TEXTMETRICW { LONG tmHeight; @@ -3386,7 +3386,7 @@ struct TEXTMETRICW { BYTE tmPitchAndFamily; BYTE tmCharSet; } -alias TEXTMETRICW* PTEXTMETRICW, NPTEXTMETRICW, LPTEXTMETRICW; +alias PTEXTMETRICW = TEXTMETRICW*, NPTEXTMETRICW = TEXTMETRICW*, LPTEXTMETRICW = TEXTMETRICW*; struct RGNDATAHEADER { DWORD dwSize; @@ -3395,13 +3395,13 @@ struct RGNDATAHEADER { DWORD nRgnSize; RECT rcBound; } -alias RGNDATAHEADER* PRGNDATAHEADER; +alias PRGNDATAHEADER = RGNDATAHEADER*; struct RGNDATA { RGNDATAHEADER rdh; char[1] Buffer = 0; } -alias RGNDATA* PRGNDATA, NPRGNDATA, LPRGNDATA; +alias PRGNDATA = RGNDATA*, NPRGNDATA = RGNDATA*, LPRGNDATA = RGNDATA*; /* for GetRandomRgn */ enum SYSRGN=4; @@ -3416,7 +3416,7 @@ struct GCP_RESULTSA { UINT nGlyphs; UINT nMaxFit; } -alias GCP_RESULTSA* LPGCP_RESULTSA; +alias LPGCP_RESULTSA = GCP_RESULTSA*; struct GCP_RESULTSW { DWORD lStructSize; @@ -3429,7 +3429,7 @@ struct GCP_RESULTSW { UINT nGlyphs; UINT nMaxFit; } -alias GCP_RESULTSW* LPGCP_RESULTSW; +alias LPGCP_RESULTSW = GCP_RESULTSW*; struct GLYPHMETRICS { UINT gmBlackBoxX; @@ -3438,14 +3438,14 @@ struct GLYPHMETRICS { short gmCellIncX; short gmCellIncY; } -alias GLYPHMETRICS* LPGLYPHMETRICS; +alias LPGLYPHMETRICS = GLYPHMETRICS*; static if (_WIN32_WINNT >= 0x500) { struct WCRANGE { WCHAR wcLow = 0; USHORT cGlyphs; } - alias WCRANGE* PWCRANGE, LPWCRANGE; + alias PWCRANGE = WCRANGE*, LPWCRANGE = WCRANGE*; struct GLYPHSET { DWORD cbThis; @@ -3454,7 +3454,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cRanges; WCRANGE[1] ranges; } - alias GLYPHSET* PGLYPHSET, LPGLYPHSET; + alias PGLYPHSET = GLYPHSET*, LPGLYPHSET = GLYPHSET*; enum DWORD GS_8BIT_INDICES = 0x00000001; } @@ -3464,7 +3464,7 @@ struct KERNINGPAIR { WORD wSecond; int iKernAmount; } -alias KERNINGPAIR* LPKERNINGPAIR; +alias LPKERNINGPAIR = KERNINGPAIR*; struct FIXED { WORD fract; @@ -3477,7 +3477,7 @@ struct MAT2 { FIXED eM21; FIXED eM22; } -alias MAT2* LPMAT2; +alias LPMAT2 = MAT2*; struct OUTLINETEXTMETRICA { UINT otmSize; @@ -3513,7 +3513,7 @@ struct OUTLINETEXTMETRICA { PSTR otmpStyleName; PSTR otmpFullName; } -alias OUTLINETEXTMETRICA* POUTLINETEXTMETRICA, NPOUTLINETEXTMETRICA, LPOUTLINETEXTMETRICA; +alias POUTLINETEXTMETRICA = OUTLINETEXTMETRICA*, NPOUTLINETEXTMETRICA = OUTLINETEXTMETRICA*, LPOUTLINETEXTMETRICA = OUTLINETEXTMETRICA*; struct OUTLINETEXTMETRICW { UINT otmSize; @@ -3549,14 +3549,14 @@ struct OUTLINETEXTMETRICW { PSTR otmpStyleName; PSTR otmpFullName; } -alias OUTLINETEXTMETRICW* POUTLINETEXTMETRICW, NPOUTLINETEXTMETRICW, LPOUTLINETEXTMETRICW; +alias POUTLINETEXTMETRICW = OUTLINETEXTMETRICW*, NPOUTLINETEXTMETRICW = OUTLINETEXTMETRICW*, LPOUTLINETEXTMETRICW = OUTLINETEXTMETRICW*; struct RASTERIZER_STATUS { short nSize; short wFlags; short nLanguageID; } -alias RASTERIZER_STATUS* LPRASTERIZER_STATUS; +alias LPRASTERIZER_STATUS = RASTERIZER_STATUS*; struct POLYTEXTA { int x; @@ -3567,7 +3567,7 @@ struct POLYTEXTA { RECT rcl; int* pdx; } -alias POLYTEXTA* PPOLYTEXTA, NPPOLYTEXTA, LPPOLYTEXTA; +alias PPOLYTEXTA = POLYTEXTA*, NPPOLYTEXTA = POLYTEXTA*, LPPOLYTEXTA = POLYTEXTA*; struct POLYTEXTW { int x; @@ -3578,7 +3578,7 @@ struct POLYTEXTW { RECT rcl; int* pdx; } -alias POLYTEXTW* PPOLYTEXTW, NPPOLYTEXTW, LPPOLYTEXTW; +alias PPOLYTEXTW = POLYTEXTW*, NPPOLYTEXTW = POLYTEXTW*, LPPOLYTEXTW = POLYTEXTW*; struct PIXELFORMATDESCRIPTOR { WORD nSize; @@ -3608,7 +3608,7 @@ struct PIXELFORMATDESCRIPTOR { DWORD dwVisibleMask; DWORD dwDamageMask; } -alias PIXELFORMATDESCRIPTOR* PPIXELFORMATDESCRIPTOR, LPPIXELFORMATDESCRIPTOR; +alias PPIXELFORMATDESCRIPTOR = PIXELFORMATDESCRIPTOR*, LPPIXELFORMATDESCRIPTOR = PIXELFORMATDESCRIPTOR*; struct METAFILEPICT { LONG mm; @@ -3616,16 +3616,16 @@ struct METAFILEPICT { LONG yExt; HMETAFILE hMF; } -alias METAFILEPICT* LPMETAFILEPICT; +alias LPMETAFILEPICT = METAFILEPICT*; struct LOCALESIGNATURE { DWORD[4] lsUsb; DWORD[2] lsCsbDefault; DWORD[2] lsCsbSupported; } -alias LOCALESIGNATURE* PLOCALESIGNATURE, LPLOCALESIGNATURE; +alias PLOCALESIGNATURE = LOCALESIGNATURE*, LPLOCALESIGNATURE = LOCALESIGNATURE*; -alias LONG LCSTYPE; /* What this for? */ +alias LCSTYPE = LONG; /* What this for? */ align(4): struct NEWTEXTMETRICA { @@ -3654,7 +3654,7 @@ struct NEWTEXTMETRICA { UINT ntmCellHeight; UINT ntmAvgWidth; } -alias NEWTEXTMETRICA* PNEWTEXTMETRICA, NPNEWTEXTMETRICA, LPNEWTEXTMETRICA; +alias PNEWTEXTMETRICA = NEWTEXTMETRICA*, NPNEWTEXTMETRICA = NEWTEXTMETRICA*, LPNEWTEXTMETRICA = NEWTEXTMETRICA*; struct NEWTEXTMETRICW { LONG tmHeight; @@ -3682,7 +3682,7 @@ struct NEWTEXTMETRICW { UINT ntmCellHeight; UINT ntmAvgWidth; } -alias NEWTEXTMETRICW* PNEWTEXTMETRICW, NPNEWTEXTMETRICW, LPNEWTEXTMETRICW; +alias PNEWTEXTMETRICW = NEWTEXTMETRICW*, NPNEWTEXTMETRICW = NEWTEXTMETRICW*, LPNEWTEXTMETRICW = NEWTEXTMETRICW*; align: struct NEWTEXTMETRICEXA { @@ -3702,21 +3702,21 @@ struct PELARRAY { LONG paYExt; BYTE paRGBs; } -alias PELARRAY* PPELARRAY, NPPELARRAY, LPPELARRAY; +alias PPELARRAY = PELARRAY*, NPPELARRAY = PELARRAY*, LPPELARRAY = PELARRAY*; struct ENUMLOGFONTA { LOGFONTA elfLogFont; BYTE[LF_FULLFACESIZE] elfFullName; BYTE[LF_FACESIZE] elfStyle; } -alias ENUMLOGFONTA* LPENUMLOGFONTA; +alias LPENUMLOGFONTA = ENUMLOGFONTA*; struct ENUMLOGFONTW { LOGFONTW elfLogFont; WCHAR[LF_FULLFACESIZE] elfFullName = 0; WCHAR[LF_FACESIZE] elfStyle = 0; } -alias ENUMLOGFONTW* LPENUMLOGFONTW; +alias LPENUMLOGFONTW = ENUMLOGFONTW*; struct ENUMLOGFONTEXA { LOGFONTA elfLogFont; @@ -3724,7 +3724,7 @@ struct ENUMLOGFONTEXA { BYTE[LF_FACESIZE] elfStyle; BYTE[LF_FACESIZE] elfScript; } -alias ENUMLOGFONTEXA* LPENUMLOGFONTEXA; +alias LPENUMLOGFONTEXA = ENUMLOGFONTEXA*; struct ENUMLOGFONTEXW { LOGFONTW elfLogFont; @@ -3732,33 +3732,33 @@ struct ENUMLOGFONTEXW { WCHAR[LF_FACESIZE] elfStyle = 0; WCHAR[LF_FACESIZE] elfScript = 0; } -alias ENUMLOGFONTEXW* LPENUMLOGFONTEXW; +alias LPENUMLOGFONTEXW = ENUMLOGFONTEXW*; struct POINTFX { FIXED x; FIXED y; } -alias POINTFX* LPPOINTFX; +alias LPPOINTFX = POINTFX*; struct TTPOLYCURVE { WORD wType; WORD cpfx; POINTFX[1] apfx; } -alias TTPOLYCURVE* LPTTPOLYCURVE; +alias LPTTPOLYCURVE = TTPOLYCURVE*; struct TTPOLYGONHEADER { DWORD cb; DWORD dwType; POINTFX pfxStart; } -alias TTPOLYGONHEADER* LPTTPOLYGONHEADER; +alias LPTTPOLYGONHEADER = TTPOLYGONHEADER*; struct POINTFLOAT { FLOAT x; FLOAT y; } -alias POINTFLOAT* PPOINTFLOAT; +alias PPOINTFLOAT = POINTFLOAT*; struct GLYPHMETRICSFLOAT { FLOAT gmfBlackBoxX; @@ -3767,7 +3767,7 @@ struct GLYPHMETRICSFLOAT { FLOAT gmfCellIncX; FLOAT gmfCellIncY; } -alias GLYPHMETRICSFLOAT* PGLYPHMETRICSFLOAT, LPGLYPHMETRICSFLOAT; +alias PGLYPHMETRICSFLOAT = GLYPHMETRICSFLOAT*, LPGLYPHMETRICSFLOAT = GLYPHMETRICSFLOAT*; struct LAYERPLANEDESCRIPTOR { WORD nSize; @@ -3795,7 +3795,7 @@ struct LAYERPLANEDESCRIPTOR { BYTE bReserved; COLORREF crTransparent; } -alias LAYERPLANEDESCRIPTOR* PLAYERPLANEDESCRIPTOR, LPLAYERPLANEDESCRIPTOR; +alias PLAYERPLANEDESCRIPTOR = LAYERPLANEDESCRIPTOR*, LPLAYERPLANEDESCRIPTOR = LAYERPLANEDESCRIPTOR*; struct BLENDFUNCTION { BYTE BlendOp; @@ -3803,7 +3803,7 @@ struct BLENDFUNCTION { BYTE SourceConstantAlpha; BYTE AlphaFormat; } -alias BLENDFUNCTION* PBLENDFUNCTION, LPBLENDFUNCTION; +alias PBLENDFUNCTION = BLENDFUNCTION*, LPBLENDFUNCTION = BLENDFUNCTION*; enum MM_MAX_NUMAXES = 16; @@ -3812,7 +3812,7 @@ struct DESIGNVECTOR { DWORD dvNumAxes; LONG[MM_MAX_NUMAXES] dvValues; } -alias DESIGNVECTOR* PDESIGNVECTOR, LPDESIGNVECTOR; +alias PDESIGNVECTOR = DESIGNVECTOR*, LPDESIGNVECTOR = DESIGNVECTOR*; enum STAMP_DESIGNVECTOR = 0x8000000 + 'd' + ('v' << 8); enum STAMP_AXESLIST = 0x8000000 + 'a' + ('l' << 8); @@ -3825,24 +3825,24 @@ enum MM_MAX_AXES_NAMELEN = 16; LONG axMaxValue; BYTE[MM_MAX_AXES_NAMELEN] axAxisName; } - alias AXISINFOA* PAXISINFOA, LPAXISINFOA; + alias PAXISINFOA = AXISINFOA*, LPAXISINFOA = AXISINFOA*; struct AXISINFOW { LONG axMinValue; LONG axMaxValue; WCHAR[MM_MAX_AXES_NAMELEN] axAxisName = 0; } - alias AXISINFOW* PAXISINFOW, LPAXISINFOW; + alias PAXISINFOW = AXISINFOW*, LPAXISINFOW = AXISINFOW*; version (Unicode) { - alias AXISINFOW AXISINFO; - alias PAXISINFOW PAXISINFO; - alias LPAXISINFOW LPAXISINFO; + alias AXISINFO = AXISINFOW; + alias PAXISINFO = PAXISINFOW; + alias LPAXISINFO = LPAXISINFOW; } else { - alias AXISINFOA AXISINFO; - alias PAXISINFOA PAXISINFO; - alias LPAXISINFOA LPAXISINFO; + alias AXISINFO = AXISINFOA; + alias PAXISINFO = PAXISINFOA; + alias LPAXISINFO = LPAXISINFOA; } struct AXESLISTA { @@ -3850,68 +3850,68 @@ enum MM_MAX_AXES_NAMELEN = 16; DWORD axlNumAxes; AXISINFOA[MM_MAX_NUMAXES] axlAxisInfo; } - alias AXESLISTA* PAXESLISTA, LPAXESLISTA; + alias PAXESLISTA = AXESLISTA*, LPAXESLISTA = AXESLISTA*; struct AXESLISTW { DWORD axlReserved; DWORD axlNumAxes; AXISINFOW[MM_MAX_NUMAXES] axlAxisInfo; } - alias AXESLISTW* PAXESLISTW, LPAXESLISTW; + alias PAXESLISTW = AXESLISTW*, LPAXESLISTW = AXESLISTW*; version (Unicode) { - alias AXESLISTW AXESLIST; - alias PAXESLISTW PAXESLIST; - alias LPAXESLISTW LPAXESLIST; + alias AXESLIST = AXESLISTW; + alias PAXESLIST = PAXESLISTW; + alias LPAXESLIST = LPAXESLISTW; } else { - alias AXESLISTA AXESLIST; - alias PAXESLISTA PAXESLIST; - alias LPAXESLISTA LPAXESLIST; + alias AXESLIST = AXESLISTA; + alias PAXESLIST = PAXESLISTA; + alias LPAXESLIST = LPAXESLISTA; } struct ENUMLOGFONTEXDVA { ENUMLOGFONTEXA elfEnumLogfontEx; DESIGNVECTOR elfDesignVector; } - alias ENUMLOGFONTEXDVA* PENUMLOGFONTEXDVA, LPENUMLOGFONTEXDVA; + alias PENUMLOGFONTEXDVA = ENUMLOGFONTEXDVA*, LPENUMLOGFONTEXDVA = ENUMLOGFONTEXDVA*; struct ENUMLOGFONTEXDVW { ENUMLOGFONTEXW elfEnumLogfontEx; DESIGNVECTOR elfDesignVector; } - alias ENUMLOGFONTEXDVW* PENUMLOGFONTEXDVW, LPENUMLOGFONTEXDVW; + alias PENUMLOGFONTEXDVW = ENUMLOGFONTEXDVW*, LPENUMLOGFONTEXDVW = ENUMLOGFONTEXDVW*; extern(Windows) nothrow @nogc { HFONT CreateFontIndirectExA(const(ENUMLOGFONTEXDVA)*); HFONT CreateFontIndirectExW(const(ENUMLOGFONTEXDVW)*); } version (Unicode) - alias CreateFontIndirectExW CreateFontIndirectEx; + alias CreateFontIndirectEx = CreateFontIndirectExW; else - alias CreateFontIndirectExA CreateFontIndirectEx; + alias CreateFontIndirectEx = CreateFontIndirectExA; struct ENUMTEXTMETRICA { NEWTEXTMETRICEXA etmNewTextMetricEx; AXESLISTA etmAxesList; } - alias ENUMTEXTMETRICA* PENUMTEXTMETRICA, LPENUMTEXTMETRICA; + alias PENUMTEXTMETRICA = ENUMTEXTMETRICA*, LPENUMTEXTMETRICA = ENUMTEXTMETRICA*; struct ENUMTEXTMETRICW { NEWTEXTMETRICEXW etmNewTextMetricEx; AXESLISTW etmAxesList; } - alias ENUMTEXTMETRICW* PENUMTEXTMETRICW, LPENUMTEXTMETRICW; + alias PENUMTEXTMETRICW = ENUMTEXTMETRICW*, LPENUMTEXTMETRICW = ENUMTEXTMETRICW*; version (Unicode) { - alias ENUMTEXTMETRICW ENUMTEXTMETRIC; - alias PENUMTEXTMETRICW PENUMTEXTMETRIC; - alias LPENUMTEXTMETRICW LPENUMTEXTMETRIC; + alias ENUMTEXTMETRIC = ENUMTEXTMETRICW; + alias PENUMTEXTMETRIC = PENUMTEXTMETRICW; + alias LPENUMTEXTMETRIC = LPENUMTEXTMETRICW; } else { - alias ENUMTEXTMETRICA ENUMTEXTMETRIC; - alias PENUMTEXTMETRICA PENUMTEXTMETRIC; - alias LPENUMTEXTMETRICA LPENUMTEXTMETRIC; + alias ENUMTEXTMETRIC = ENUMTEXTMETRICA; + alias PENUMTEXTMETRIC = PENUMTEXTMETRICA; + alias LPENUMTEXTMETRIC = LPENUMTEXTMETRICA; } } /* _WIN32_WINNT >= 0x500 */ @@ -3920,13 +3920,13 @@ struct GRADIENT_TRIANGLE { ULONG Vertex2; ULONG Vertex3; } -alias GRADIENT_TRIANGLE* PGRADIENT_TRIANGLE, LPGRADIENT_TRIANGLE; +alias PGRADIENT_TRIANGLE = GRADIENT_TRIANGLE*, LPGRADIENT_TRIANGLE = GRADIENT_TRIANGLE*; struct GRADIENT_RECT { ULONG UpperLeft; ULONG LowerRight; } -alias GRADIENT_RECT* PGRADIENT_RECT, LPGRADIENT_RECT; +alias PGRADIENT_RECT = GRADIENT_RECT*, LPGRADIENT_RECT = GRADIENT_RECT*; struct DISPLAY_DEVICEA { DWORD cb; @@ -3936,7 +3936,7 @@ struct DISPLAY_DEVICEA { CHAR[128] DeviceID = 0; CHAR[128] DeviceKey = 0; } -alias DISPLAY_DEVICEA* PDISPLAY_DEVICEA, LPDISPLAY_DEVICEA; +alias PDISPLAY_DEVICEA = DISPLAY_DEVICEA*, LPDISPLAY_DEVICEA = DISPLAY_DEVICEA*; struct DISPLAY_DEVICEW { DWORD cb; @@ -3946,7 +3946,7 @@ struct DISPLAY_DEVICEW { WCHAR[128] DeviceID = 0; WCHAR[128] DeviceKey = 0; } -alias DISPLAY_DEVICEW* PDISPLAY_DEVICEW, LPDISPLAY_DEVICEW; +alias PDISPLAY_DEVICEW = DISPLAY_DEVICEW*, LPDISPLAY_DEVICEW = DISPLAY_DEVICEW*; struct DRAWPATRECT { POINT ptPosition; @@ -3954,22 +3954,22 @@ struct DRAWPATRECT { WORD wStyle; WORD wPattern; } -alias DRAWPATRECT* PDRAWPATRECT; +alias PDRAWPATRECT = DRAWPATRECT*; // --------- // Callbacks extern (Windows) { - alias BOOL function (HDC, int) ABORTPROC; - alias int function (HDC, HANDLETABLE*, METARECORD*, int, LPARAM) MFENUMPROC; - alias int function (HDC, HANDLETABLE*, const(ENHMETARECORD)*, int, LPARAM) ENHMFENUMPROC; - alias int function (const(LOGFONTA)*, const(TEXTMETRICA)*, DWORD, LPARAM) FONTENUMPROCA, OLDFONTENUMPROCA; - alias int function (const(LOGFONTW)*, const(TEXTMETRICW)*, DWORD, LPARAM) FONTENUMPROCW, OLDFONTENUMPROCW; - alias int function (LPSTR, LPARAM) ICMENUMPROCA; - alias int function (LPWSTR, LPARAM) ICMENUMPROCW; - alias void function (LPVOID, LPARAM) GOBJENUMPROC; - alias void function (int, int, LPARAM) LINEDDAPROC; - alias UINT function (HWND, HMODULE, LPDEVMODEA, LPSTR, LPSTR, LPDEVMODEA, LPSTR, UINT) LPFNDEVMODE; - alias DWORD function (LPSTR, LPSTR, UINT, LPSTR, LPDEVMODEA) LPFNDEVCAPS; + alias ABORTPROC = BOOL function (HDC, int); + alias MFENUMPROC = int function (HDC, HANDLETABLE*, METARECORD*, int, LPARAM); + alias ENHMFENUMPROC = int function (HDC, HANDLETABLE*, const(ENHMETARECORD)*, int, LPARAM); + alias FONTENUMPROCA = int function (const(LOGFONTA)*, const(TEXTMETRICA)*, DWORD, LPARAM), OLDFONTENUMPROCA = int function (const(LOGFONTA)*, const(TEXTMETRICA)*, DWORD, LPARAM); + alias FONTENUMPROCW = int function (const(LOGFONTW)*, const(TEXTMETRICW)*, DWORD, LPARAM), OLDFONTENUMPROCW = int function (const(LOGFONTW)*, const(TEXTMETRICW)*, DWORD, LPARAM); + alias ICMENUMPROCA = int function (LPSTR, LPARAM); + alias ICMENUMPROCW = int function (LPWSTR, LPARAM); + alias GOBJENUMPROC = void function (LPVOID, LPARAM); + alias LINEDDAPROC = void function (int, int, LPARAM); + alias LPFNDEVMODE = UINT function (HWND, HMODULE, LPDEVMODEA, LPSTR, LPSTR, LPDEVMODEA, LPSTR, UINT); + alias LPFNDEVCAPS = DWORD function (LPSTR, LPSTR, UINT, LPSTR, LPDEVMODEA); } // --------- @@ -4382,7 +4382,7 @@ extern(Windows) nothrow @nogc { BOOL wglUseFontOutlinesW(HDC, DWORD, DWORD, DWORD, FLOAT, FLOAT, int, LPGLYPHMETRICSFLOAT); static if (_WIN32_WINNT >= 0x500) { - alias WGLSWAP* PWGLSWAP; + alias PWGLSWAP = WGLSWAP*; struct WGLSWAP { HDC hdc; UINT uiFlags; @@ -4417,169 +4417,169 @@ static if (_WIN32_WINNT >= 0x500) { } // extern (Windows) version (Unicode) { - alias WCHAR BCHAR; - alias DOCINFOW DOCINFO; - alias LOGFONTW LOGFONT; - - alias TEXTMETRICW TEXTMETRIC; - alias NPTEXTMETRICW NPTEXTMETRIC; - alias ICMENUMPROCW ICMENUMPROC; - alias FONTENUMPROCW FONTENUMPROC; - alias DEVMODEW DEVMODE; - - alias EXTLOGFONTW EXTLOGFONT; - alias GCP_RESULTSW GCP_RESULTS; - alias OUTLINETEXTMETRICW OUTLINETEXTMETRIC; - alias POLYTEXTW POLYTEXT; - alias LOGCOLORSPACEW LOGCOLORSPACE; - alias NEWTEXTMETRICW NEWTEXTMETRIC; - alias NEWTEXTMETRICEXW NEWTEXTMETRICEX; - alias ENUMLOGFONTW ENUMLOGFONT; - alias ENUMLOGFONTEXW ENUMLOGFONTEX; - alias DISPLAY_DEVICEW DISPLAY_DEVICE; - alias AddFontResourceW AddFontResource; - - alias CopyEnhMetaFileW CopyEnhMetaFile; - alias CopyMetaFileW CopyMetaFile; - alias CreateColorSpaceW CreateColorSpace; - alias CreateDCW CreateDC; - alias CreateEnhMetaFileW CreateEnhMetaFile; - alias CreateFontW CreateFont; - alias CreateFontIndirectW CreateFontIndirect; - alias CreateICW CreateIC; - alias CreateMetaFileW CreateMetaFile; - alias CreateScalableFontResourceW CreateScalableFontResource; - alias DeviceCapabilitiesW DeviceCapabilities; - alias EnumFontFamiliesW EnumFontFamilies; - alias EnumFontFamiliesExW EnumFontFamiliesEx; - alias EnumFontsW EnumFonts; - alias EnumICMProfilesW EnumICMProfiles; - alias ExtTextOutW ExtTextOut; - alias GetCharABCWidthsFloatW GetCharABCWidthsFloat; - alias GetCharABCWidthsW GetCharABCWidths; - alias GetCharacterPlacementW GetCharacterPlacement; - alias GetCharWidth32W GetCharWidth32; - alias GetCharWidthFloatW GetCharWidthFloat; - alias GetCharWidthW GetCharWidth; - alias GetEnhMetaFileW GetEnhMetaFile; - alias GetEnhMetaFileDescriptionW GetEnhMetaFileDescription; - alias GetGlyphOutlineW GetGlyphOutline; - alias GetICMProfileW GetICMProfile; - alias GetKerningPairsW GetKerningPairs; - alias GetLogColorSpaceW GetLogColorSpace; - alias GetMetaFileW GetMetaFile; - alias GetObjectW GetObject; - alias GetOutlineTextMetricsW GetOutlineTextMetrics; - alias GetTextExtentPointW GetTextExtentPoint; - alias GetTextExtentExPointW GetTextExtentExPoint; - alias GetTextExtentPoint32W GetTextExtentPoint32; - alias GetTextFaceW GetTextFace; - alias GetTextMetricsW GetTextMetrics; - alias PolyTextOutW PolyTextOut; - alias RemoveFontResourceW RemoveFontResource; - - alias ResetDCW ResetDC; - alias SetICMProfileW SetICMProfile; - alias StartDocW StartDoc; - alias TextOutW TextOut; - alias UpdateICMRegKeyW UpdateICMRegKey; - alias wglUseFontBitmapsW wglUseFontBitmaps; - alias wglUseFontOutlinesW wglUseFontOutlines; + alias BCHAR = WCHAR; + alias DOCINFO = DOCINFOW; + alias LOGFONT = LOGFONTW; + + alias TEXTMETRIC = TEXTMETRICW; + alias NPTEXTMETRIC = NPTEXTMETRICW; + alias ICMENUMPROC = ICMENUMPROCW; + alias FONTENUMPROC = FONTENUMPROCW; + alias DEVMODE = DEVMODEW; + + alias EXTLOGFONT = EXTLOGFONTW; + alias GCP_RESULTS = GCP_RESULTSW; + alias OUTLINETEXTMETRIC = OUTLINETEXTMETRICW; + alias POLYTEXT = POLYTEXTW; + alias LOGCOLORSPACE = LOGCOLORSPACEW; + alias NEWTEXTMETRIC = NEWTEXTMETRICW; + alias NEWTEXTMETRICEX = NEWTEXTMETRICEXW; + alias ENUMLOGFONT = ENUMLOGFONTW; + alias ENUMLOGFONTEX = ENUMLOGFONTEXW; + alias DISPLAY_DEVICE = DISPLAY_DEVICEW; + alias AddFontResource = AddFontResourceW; + + alias CopyEnhMetaFile = CopyEnhMetaFileW; + alias CopyMetaFile = CopyMetaFileW; + alias CreateColorSpace = CreateColorSpaceW; + alias CreateDC = CreateDCW; + alias CreateEnhMetaFile = CreateEnhMetaFileW; + alias CreateFont = CreateFontW; + alias CreateFontIndirect = CreateFontIndirectW; + alias CreateIC = CreateICW; + alias CreateMetaFile = CreateMetaFileW; + alias CreateScalableFontResource = CreateScalableFontResourceW; + alias DeviceCapabilities = DeviceCapabilitiesW; + alias EnumFontFamilies = EnumFontFamiliesW; + alias EnumFontFamiliesEx = EnumFontFamiliesExW; + alias EnumFonts = EnumFontsW; + alias EnumICMProfiles = EnumICMProfilesW; + alias ExtTextOut = ExtTextOutW; + alias GetCharABCWidthsFloat = GetCharABCWidthsFloatW; + alias GetCharABCWidths = GetCharABCWidthsW; + alias GetCharacterPlacement = GetCharacterPlacementW; + alias GetCharWidth32 = GetCharWidth32W; + alias GetCharWidthFloat = GetCharWidthFloatW; + alias GetCharWidth = GetCharWidthW; + alias GetEnhMetaFile = GetEnhMetaFileW; + alias GetEnhMetaFileDescription = GetEnhMetaFileDescriptionW; + alias GetGlyphOutline = GetGlyphOutlineW; + alias GetICMProfile = GetICMProfileW; + alias GetKerningPairs = GetKerningPairsW; + alias GetLogColorSpace = GetLogColorSpaceW; + alias GetMetaFile = GetMetaFileW; + alias GetObject = GetObjectW; + alias GetOutlineTextMetrics = GetOutlineTextMetricsW; + alias GetTextExtentPoint = GetTextExtentPointW; + alias GetTextExtentExPoint = GetTextExtentExPointW; + alias GetTextExtentPoint32 = GetTextExtentPoint32W; + alias GetTextFace = GetTextFaceW; + alias GetTextMetrics = GetTextMetricsW; + alias PolyTextOut = PolyTextOutW; + alias RemoveFontResource = RemoveFontResourceW; + + alias ResetDC = ResetDCW; + alias SetICMProfile = SetICMProfileW; + alias StartDoc = StartDocW; + alias TextOut = TextOutW; + alias UpdateICMRegKey = UpdateICMRegKeyW; + alias wglUseFontBitmaps = wglUseFontBitmapsW; + alias wglUseFontOutlines = wglUseFontOutlinesW; static if (_WIN32_WINNT >= 0x500) { - alias ENUMLOGFONTEXDVW ENUMLOGFONTEXDV; - alias PENUMLOGFONTEXDVW PENUMLOGFONTEXDV; - alias LPENUMLOGFONTEXDVW LPENUMLOGFONTEXDV; - alias AddFontResourceExW AddFontResourceEx; - alias RemoveFontResourceExW RemoveFontResourceEx; - alias GetGlyphIndicesW GetGlyphIndices; + alias ENUMLOGFONTEXDV = ENUMLOGFONTEXDVW; + alias PENUMLOGFONTEXDV = PENUMLOGFONTEXDVW; + alias LPENUMLOGFONTEXDV = LPENUMLOGFONTEXDVW; + alias AddFontResourceEx = AddFontResourceExW; + alias RemoveFontResourceEx = RemoveFontResourceExW; + alias GetGlyphIndices = GetGlyphIndicesW; } } else { /* non-unicode build */ - alias BYTE BCHAR; - alias DOCINFOA DOCINFO; - alias LOGFONTA LOGFONT; - alias TEXTMETRICA TEXTMETRIC; - alias NPTEXTMETRICA NPTEXTMETRIC; - alias ICMENUMPROCA ICMENUMPROC; - alias FONTENUMPROCA FONTENUMPROC; - alias DEVMODEA DEVMODE; - alias EXTLOGFONTA EXTLOGFONT; - alias GCP_RESULTSA GCP_RESULTS; - alias OUTLINETEXTMETRICA OUTLINETEXTMETRIC; - alias POLYTEXTA POLYTEXT; - alias LOGCOLORSPACEA LOGCOLORSPACE; - alias NEWTEXTMETRICA NEWTEXTMETRIC; - alias NEWTEXTMETRICEXA NEWTEXTMETRICEX; - alias ENUMLOGFONTA ENUMLOGFONT; - alias ENUMLOGFONTEXA ENUMLOGFONTEX; - alias DISPLAY_DEVICEA DISPLAY_DEVICE; - - alias AddFontResourceA AddFontResource; - alias CopyEnhMetaFileA CopyEnhMetaFile; - alias CopyMetaFileA CopyMetaFile; - alias CreateColorSpaceA CreateColorSpace; - alias CreateDCA CreateDC; - alias CreateEnhMetaFileA CreateEnhMetaFile; - alias CreateFontA CreateFont; - alias CreateFontIndirectA CreateFontIndirect; - alias CreateICA CreateIC; - alias CreateMetaFileA CreateMetaFile; - alias CreateScalableFontResourceA CreateScalableFontResource; - alias DeviceCapabilitiesA DeviceCapabilities; - alias EnumFontFamiliesA EnumFontFamilies; - alias EnumFontFamiliesExA EnumFontFamiliesEx; - alias EnumFontsA EnumFonts; - alias EnumICMProfilesA EnumICMProfiles; - alias ExtTextOutA ExtTextOut; - alias GetCharWidthFloatA GetCharWidthFloat; - alias GetCharWidthA GetCharWidth; - alias GetCharacterPlacementA GetCharacterPlacement; - alias GetCharABCWidthsA GetCharABCWidths; - alias GetCharABCWidthsFloatA GetCharABCWidthsFloat; - alias GetCharWidth32A GetCharWidth32; - alias GetEnhMetaFileA GetEnhMetaFile; - alias GetEnhMetaFileDescriptionA GetEnhMetaFileDescription; - alias GetGlyphOutlineA GetGlyphOutline; - alias GetICMProfileA GetICMProfile; - alias GetKerningPairsA GetKerningPairs; - alias GetLogColorSpaceA GetLogColorSpace; - alias GetMetaFileA GetMetaFile; - alias GetObjectA GetObject; - alias GetOutlineTextMetricsA GetOutlineTextMetrics; - alias GetTextExtentPointA GetTextExtentPoint; - alias GetTextExtentExPointA GetTextExtentExPoint; - alias GetTextExtentPoint32A GetTextExtentPoint32; - alias GetTextFaceA GetTextFace; - alias GetTextMetricsA GetTextMetrics; - alias PolyTextOutA PolyTextOut; - alias RemoveFontResourceA RemoveFontResource; - alias ResetDCA ResetDC; - alias SetICMProfileA SetICMProfile; - alias StartDocA StartDoc; - alias TextOutA TextOut; - alias UpdateICMRegKeyA UpdateICMRegKey; - alias wglUseFontBitmapsA wglUseFontBitmaps; - alias wglUseFontOutlinesA wglUseFontOutlines; + alias BCHAR = BYTE; + alias DOCINFO = DOCINFOA; + alias LOGFONT = LOGFONTA; + alias TEXTMETRIC = TEXTMETRICA; + alias NPTEXTMETRIC = NPTEXTMETRICA; + alias ICMENUMPROC = ICMENUMPROCA; + alias FONTENUMPROC = FONTENUMPROCA; + alias DEVMODE = DEVMODEA; + alias EXTLOGFONT = EXTLOGFONTA; + alias GCP_RESULTS = GCP_RESULTSA; + alias OUTLINETEXTMETRIC = OUTLINETEXTMETRICA; + alias POLYTEXT = POLYTEXTA; + alias LOGCOLORSPACE = LOGCOLORSPACEA; + alias NEWTEXTMETRIC = NEWTEXTMETRICA; + alias NEWTEXTMETRICEX = NEWTEXTMETRICEXA; + alias ENUMLOGFONT = ENUMLOGFONTA; + alias ENUMLOGFONTEX = ENUMLOGFONTEXA; + alias DISPLAY_DEVICE = DISPLAY_DEVICEA; + + alias AddFontResource = AddFontResourceA; + alias CopyEnhMetaFile = CopyEnhMetaFileA; + alias CopyMetaFile = CopyMetaFileA; + alias CreateColorSpace = CreateColorSpaceA; + alias CreateDC = CreateDCA; + alias CreateEnhMetaFile = CreateEnhMetaFileA; + alias CreateFont = CreateFontA; + alias CreateFontIndirect = CreateFontIndirectA; + alias CreateIC = CreateICA; + alias CreateMetaFile = CreateMetaFileA; + alias CreateScalableFontResource = CreateScalableFontResourceA; + alias DeviceCapabilities = DeviceCapabilitiesA; + alias EnumFontFamilies = EnumFontFamiliesA; + alias EnumFontFamiliesEx = EnumFontFamiliesExA; + alias EnumFonts = EnumFontsA; + alias EnumICMProfiles = EnumICMProfilesA; + alias ExtTextOut = ExtTextOutA; + alias GetCharWidthFloat = GetCharWidthFloatA; + alias GetCharWidth = GetCharWidthA; + alias GetCharacterPlacement = GetCharacterPlacementA; + alias GetCharABCWidths = GetCharABCWidthsA; + alias GetCharABCWidthsFloat = GetCharABCWidthsFloatA; + alias GetCharWidth32 = GetCharWidth32A; + alias GetEnhMetaFile = GetEnhMetaFileA; + alias GetEnhMetaFileDescription = GetEnhMetaFileDescriptionA; + alias GetGlyphOutline = GetGlyphOutlineA; + alias GetICMProfile = GetICMProfileA; + alias GetKerningPairs = GetKerningPairsA; + alias GetLogColorSpace = GetLogColorSpaceA; + alias GetMetaFile = GetMetaFileA; + alias GetObject = GetObjectA; + alias GetOutlineTextMetrics = GetOutlineTextMetricsA; + alias GetTextExtentPoint = GetTextExtentPointA; + alias GetTextExtentExPoint = GetTextExtentExPointA; + alias GetTextExtentPoint32 = GetTextExtentPoint32A; + alias GetTextFace = GetTextFaceA; + alias GetTextMetrics = GetTextMetricsA; + alias PolyTextOut = PolyTextOutA; + alias RemoveFontResource = RemoveFontResourceA; + alias ResetDC = ResetDCA; + alias SetICMProfile = SetICMProfileA; + alias StartDoc = StartDocA; + alias TextOut = TextOutA; + alias UpdateICMRegKey = UpdateICMRegKeyA; + alias wglUseFontBitmaps = wglUseFontBitmapsA; + alias wglUseFontOutlines = wglUseFontOutlinesA; static if (_WIN32_WINNT >= 0x500) { - alias ENUMLOGFONTEXDVA ENUMLOGFONTEXDV; - alias PENUMLOGFONTEXDVA PENUMLOGFONTEXDV; - alias LPENUMLOGFONTEXDVA LPENUMLOGFONTEXDV; - alias AddFontResourceExA AddFontResourceEx; - alias RemoveFontResourceExA RemoveFontResourceEx; - alias GetGlyphIndicesA GetGlyphIndices; + alias ENUMLOGFONTEXDV = ENUMLOGFONTEXDVA; + alias PENUMLOGFONTEXDV = PENUMLOGFONTEXDVA; + alias LPENUMLOGFONTEXDV = LPENUMLOGFONTEXDVA; + alias AddFontResourceEx = AddFontResourceExA; + alias RemoveFontResourceEx = RemoveFontResourceExA; + alias GetGlyphIndices = GetGlyphIndicesA; } } // Common to both ASCII & UNICODE -alias DOCINFO* LPDOCINFO; -alias LOGFONT* PLOGFONT, NPLOGFONT, LPLOGFONT; -alias TEXTMETRIC* PTEXTMETRIC, LPTEXTMETRIC; -alias DEVMODE* PDEVMODE, NPDEVMODE, LPDEVMODE; -alias EXTLOGFONT* PEXTLOGFONT, NPEXTLOGFONT, LPEXTLOGFONT; -alias GCP_RESULTS* LPGCP_RESULTS; -alias OUTLINETEXTMETRIC* POUTLINETEXTMETRIC, NPOUTLINETEXTMETRIC, LPOUTLINETEXTMETRIC; -alias POLYTEXT* PPOLYTEXT, NPPOLYTEXT, LPPOLYTEXT; -alias LOGCOLORSPACE* LPLOGCOLORSPACE; -alias NEWTEXTMETRIC* PNEWTEXTMETRIC, NPNEWTEXTMETRIC, LPNEWTEXTMETRIC; -alias ENUMLOGFONT* LPENUMLOGFONT; -alias ENUMLOGFONTEX* LPENUMLOGFONTEX; -alias DISPLAY_DEVICE* PDISPLAY_DEVICE, LPDISPLAY_DEVICE; +alias LPDOCINFO = DOCINFO*; +alias PLOGFONT = LOGFONT*, NPLOGFONT = LOGFONT*, LPLOGFONT = LOGFONT*; +alias PTEXTMETRIC = TEXTMETRIC*, LPTEXTMETRIC = TEXTMETRIC*; +alias PDEVMODE = DEVMODE*, NPDEVMODE = DEVMODE*, LPDEVMODE = DEVMODE*; +alias PEXTLOGFONT = EXTLOGFONT*, NPEXTLOGFONT = EXTLOGFONT*, LPEXTLOGFONT = EXTLOGFONT*; +alias LPGCP_RESULTS = GCP_RESULTS*; +alias POUTLINETEXTMETRIC = OUTLINETEXTMETRIC*, NPOUTLINETEXTMETRIC = OUTLINETEXTMETRIC*, LPOUTLINETEXTMETRIC = OUTLINETEXTMETRIC*; +alias PPOLYTEXT = POLYTEXT*, NPPOLYTEXT = POLYTEXT*, LPPOLYTEXT = POLYTEXT*; +alias LPLOGCOLORSPACE = LOGCOLORSPACE*; +alias PNEWTEXTMETRIC = NEWTEXTMETRIC*, NPNEWTEXTMETRIC = NEWTEXTMETRIC*, LPNEWTEXTMETRIC = NEWTEXTMETRIC*; +alias LPENUMLOGFONT = ENUMLOGFONT*; +alias LPENUMLOGFONTEX = ENUMLOGFONTEX*; +alias PDISPLAY_DEVICE = DISPLAY_DEVICE*, LPDISPLAY_DEVICE = DISPLAY_DEVICE*; diff --git a/runtime/druntime/src/core/sys/windows/winhttp.d b/runtime/druntime/src/core/sys/windows/winhttp.d index 1de3b9366a9..ac3e7baa83a 100644 --- a/runtime/druntime/src/core/sys/windows/winhttp.d +++ b/runtime/druntime/src/core/sys/windows/winhttp.d @@ -373,7 +373,7 @@ enum : DWORD { WINHTTP_FLAG_SECURE_PROTOCOL_TLS1) } -alias extern(Windows) int fnWINHTTP_STATUS_CALLBACK(HINTERNET hInternet, DWORD_PTR dwContext, +alias fnWINHTTP_STATUS_CALLBACK = extern(Windows) int(HINTERNET hInternet, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInformation,DWORD dwStatusInformationLength); alias WINHTTP_STATUS_CALLBACK = fnWINHTTP_STATUS_CALLBACK*; alias LPWINHTTP_STATUS_CALLBACK = WINHTTP_STATUS_CALLBACK*; diff --git a/runtime/druntime/src/core/sys/windows/wininet.d b/runtime/druntime/src/core/sys/windows/wininet.d index 790d4d01dcb..d1a47f8190c 100644 --- a/runtime/druntime/src/core/sys/windows/wininet.d +++ b/runtime/druntime/src/core/sys/windows/wininet.d @@ -746,11 +746,11 @@ alias HINTERNET = HANDLE; HANDLE h; alias h this; }*/ -alias HINTERNET* LPHINTERNET; +alias LPHINTERNET = HINTERNET*; -alias LONGLONG GROUPID; -alias WORD INTERNET_PORT; -alias WORD* LPINTERNET_PORT; +alias GROUPID = LONGLONG; +alias INTERNET_PORT = WORD; +alias LPINTERNET_PORT = WORD*; enum INTERNET_SCHEME { INTERNET_SCHEME_PARTIAL = -2, @@ -770,13 +770,13 @@ enum INTERNET_SCHEME { INTERNET_SCHEME_FIRST = INTERNET_SCHEME_FTP, INTERNET_SCHEME_LAST = INTERNET_SCHEME_RES } -alias INTERNET_SCHEME* LPINTERNET_SCHEME; +alias LPINTERNET_SCHEME = INTERNET_SCHEME*; struct INTERNET_ASYNC_RESULT { DWORD_PTR dwResult; DWORD dwError; } -alias INTERNET_ASYNC_RESULT* LPINTERNET_ASYNC_RESULT; +alias LPINTERNET_ASYNC_RESULT = INTERNET_ASYNC_RESULT*; struct INTERNET_DIAGNOSTIC_SOCKET_INFO { DWORD_PTR Socket; @@ -784,20 +784,20 @@ struct INTERNET_DIAGNOSTIC_SOCKET_INFO { DWORD DestPort; DWORD Flags; } -alias INTERNET_DIAGNOSTIC_SOCKET_INFO* LPINTERNET_DIAGNOSTIC_SOCKET_INFO; +alias LPINTERNET_DIAGNOSTIC_SOCKET_INFO = INTERNET_DIAGNOSTIC_SOCKET_INFO*; struct INTERNET_PREFETCH_STATUS { DWORD dwStatus; DWORD dwSize; } -alias INTERNET_PREFETCH_STATUS* LPINTERNET_PREFETCH_STATUS; +alias LPINTERNET_PREFETCH_STATUS = INTERNET_PREFETCH_STATUS*; struct INTERNET_PROXY_INFO { DWORD dwAccessType; LPCTSTR lpszProxy; LPCTSTR lpszProxyBypass; } -alias INTERNET_PROXY_INFO* LPINTERNET_PROXY_INFO; +alias LPINTERNET_PROXY_INFO = INTERNET_PROXY_INFO*; struct INTERNET_PER_CONN_OPTIONA { DWORD dwOption; @@ -807,7 +807,7 @@ struct INTERNET_PER_CONN_OPTIONA { FILETIME ftValue; } } -alias INTERNET_PER_CONN_OPTIONA* LPINTERNET_PER_CONN_OPTIONA; +alias LPINTERNET_PER_CONN_OPTIONA = INTERNET_PER_CONN_OPTIONA*; struct INTERNET_PER_CONN_OPTIONW { DWORD dwOption; @@ -817,7 +817,7 @@ struct INTERNET_PER_CONN_OPTIONW { FILETIME ftValue; } } -alias INTERNET_PER_CONN_OPTIONW* LPINTERNET_PER_CONN_OPTIONW; +alias LPINTERNET_PER_CONN_OPTIONW = INTERNET_PER_CONN_OPTIONW*; struct INTERNET_PER_CONN_OPTION_LISTA { DWORD dwSize; @@ -826,7 +826,7 @@ struct INTERNET_PER_CONN_OPTION_LISTA { DWORD dwOptionError; LPINTERNET_PER_CONN_OPTIONA pOptions; } -alias INTERNET_PER_CONN_OPTION_LISTA* LPINTERNET_PER_CONN_OPTION_LISTA; +alias LPINTERNET_PER_CONN_OPTION_LISTA = INTERNET_PER_CONN_OPTION_LISTA*; struct INTERNET_PER_CONN_OPTION_LISTW { DWORD dwSize; @@ -835,7 +835,7 @@ struct INTERNET_PER_CONN_OPTION_LISTW { DWORD dwOptionError; LPINTERNET_PER_CONN_OPTIONW pOptions; } -alias INTERNET_PER_CONN_OPTION_LISTW* LPINTERNET_PER_CONN_OPTION_LISTW; +alias LPINTERNET_PER_CONN_OPTION_LISTW = INTERNET_PER_CONN_OPTION_LISTW*; enum { INTERNET_PER_CONN_FLAGS = 1, @@ -871,7 +871,7 @@ struct INTERNET_VERSION_INFO { DWORD dwMajorVersion; DWORD dwMinorVersion; } -alias INTERNET_VERSION_INFO* LPINTERNET_VERSION_INFO; +alias LPINTERNET_VERSION_INFO = INTERNET_VERSION_INFO*; struct URL_COMPONENTSA { DWORD dwStructSize = URL_COMPONENTSA.sizeof; @@ -890,7 +890,7 @@ struct URL_COMPONENTSA { LPSTR lpszExtraInfo; DWORD dwExtraInfoLength; } -alias URL_COMPONENTSA* LPURL_COMPONENTSA; +alias LPURL_COMPONENTSA = URL_COMPONENTSA*; struct URL_COMPONENTSW { DWORD dwStructSize = URL_COMPONENTSW.sizeof; @@ -909,7 +909,7 @@ struct URL_COMPONENTSW { LPWSTR lpszExtraInfo; DWORD dwExtraInfoLength; } -alias URL_COMPONENTSW* LPURL_COMPONENTSW; +alias LPURL_COMPONENTSW = URL_COMPONENTSW*; struct INTERNET_CERTIFICATE_INFO { FILETIME ftExpiry; @@ -921,11 +921,10 @@ struct INTERNET_CERTIFICATE_INFO { LPTSTR lpszEncryptionAlgName; DWORD dwKeySize; } -alias INTERNET_CERTIFICATE_INFO* LPINTERNET_CERTIFICATE_INFO; +alias LPINTERNET_CERTIFICATE_INFO = INTERNET_CERTIFICATE_INFO*; -extern (Windows) alias void function(HINTERNET, DWORD_PTR, DWORD, PVOID, DWORD) - INTERNET_STATUS_CALLBACK; -alias INTERNET_STATUS_CALLBACK* LPINTERNET_STATUS_CALLBACK; +extern (Windows) alias INTERNET_STATUS_CALLBACK = void function(HINTERNET, DWORD_PTR, DWORD, PVOID, DWORD); +alias LPINTERNET_STATUS_CALLBACK = INTERNET_STATUS_CALLBACK*; enum INTERNET_INVALID_STATUS_CALLBACK = cast(INTERNET_STATUS_CALLBACK) -1; @@ -938,7 +937,7 @@ struct GOPHER_FIND_DATAA { FILETIME LastModificationTime; CHAR[MAX_GOPHER_LOCATOR_LENGTH+1] Locator = 0; } -alias GOPHER_FIND_DATAA* LPGOPHER_FIND_DATAA; +alias LPGOPHER_FIND_DATAA = GOPHER_FIND_DATAA*; struct GOPHER_FIND_DATAW { WCHAR[MAX_GOPHER_DISPLAY_TEXT+1] DisplayString = 0; @@ -948,49 +947,49 @@ struct GOPHER_FIND_DATAW { FILETIME LastModificationTime; WCHAR[MAX_GOPHER_LOCATOR_LENGTH+1] Locator = 0; } -alias GOPHER_FIND_DATAW* LPGOPHER_FIND_DATAW; +alias LPGOPHER_FIND_DATAW = GOPHER_FIND_DATAW*; struct GOPHER_ADMIN_ATTRIBUTE_TYPE { LPCTSTR Comment; LPCTSTR EmailAddress; } -alias GOPHER_ADMIN_ATTRIBUTE_TYPE* LPGOPHER_ADMIN_ATTRIBUTE_TYPE; +alias LPGOPHER_ADMIN_ATTRIBUTE_TYPE = GOPHER_ADMIN_ATTRIBUTE_TYPE*; struct GOPHER_MOD_DATE_ATTRIBUTE_TYPE { FILETIME DateAndTime; } -alias GOPHER_MOD_DATE_ATTRIBUTE_TYPE* LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE; +alias LPGOPHER_MOD_DATE_ATTRIBUTE_TYPE = GOPHER_MOD_DATE_ATTRIBUTE_TYPE*; struct GOPHER_TTL_ATTRIBUTE_TYPE { DWORD Ttl; } -alias GOPHER_TTL_ATTRIBUTE_TYPE* LPGOPHER_TTL_ATTRIBUTE_TYPE; +alias LPGOPHER_TTL_ATTRIBUTE_TYPE = GOPHER_TTL_ATTRIBUTE_TYPE*; struct GOPHER_SCORE_ATTRIBUTE_TYPE { INT Score; } -alias GOPHER_SCORE_ATTRIBUTE_TYPE* LPGOPHER_SCORE_ATTRIBUTE_TYPE; +alias LPGOPHER_SCORE_ATTRIBUTE_TYPE = GOPHER_SCORE_ATTRIBUTE_TYPE*; struct GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE { INT LowerBound; INT UpperBound; } -alias GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE* LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE; +alias LPGOPHER_SCORE_RANGE_ATTRIBUTE_TYPE = GOPHER_SCORE_RANGE_ATTRIBUTE_TYPE*; struct GOPHER_SITE_ATTRIBUTE_TYPE { LPCTSTR Site; } -alias GOPHER_SITE_ATTRIBUTE_TYPE* LPGOPHER_SITE_ATTRIBUTE_TYPE; +alias LPGOPHER_SITE_ATTRIBUTE_TYPE = GOPHER_SITE_ATTRIBUTE_TYPE*; struct GOPHER_ORGANIZATION_ATTRIBUTE_TYPE { LPCTSTR Organization; } -alias GOPHER_ORGANIZATION_ATTRIBUTE_TYPE* LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE; +alias LPGOPHER_ORGANIZATION_ATTRIBUTE_TYPE = GOPHER_ORGANIZATION_ATTRIBUTE_TYPE*; struct GOPHER_LOCATION_ATTRIBUTE_TYPE { LPCTSTR Location; } -alias GOPHER_LOCATION_ATTRIBUTE_TYPE* LPGOPHER_LOCATION_ATTRIBUTE_TYPE; +alias LPGOPHER_LOCATION_ATTRIBUTE_TYPE = GOPHER_LOCATION_ATTRIBUTE_TYPE*; struct GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE { INT DegreesNorth; @@ -1000,52 +999,51 @@ struct GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE { INT MinutesEast; INT SecondsEast; } -alias GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE* - LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE; +alias LPGOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE = GOPHER_GEOGRAPHICAL_LOCATION_ATTRIBUTE_TYPE*; struct GOPHER_TIMEZONE_ATTRIBUTE_TYPE { INT Zone; } -alias GOPHER_TIMEZONE_ATTRIBUTE_TYPE* LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE; +alias LPGOPHER_TIMEZONE_ATTRIBUTE_TYPE = GOPHER_TIMEZONE_ATTRIBUTE_TYPE*; struct GOPHER_PROVIDER_ATTRIBUTE_TYPE { LPCTSTR Provider; } -alias GOPHER_PROVIDER_ATTRIBUTE_TYPE* LPGOPHER_PROVIDER_ATTRIBUTE_TYPE; +alias LPGOPHER_PROVIDER_ATTRIBUTE_TYPE = GOPHER_PROVIDER_ATTRIBUTE_TYPE*; struct GOPHER_VERSION_ATTRIBUTE_TYPE { LPCTSTR Version; } -alias GOPHER_VERSION_ATTRIBUTE_TYPE* LPGOPHER_VERSION_ATTRIBUTE_TYPE; +alias LPGOPHER_VERSION_ATTRIBUTE_TYPE = GOPHER_VERSION_ATTRIBUTE_TYPE*; struct GOPHER_ABSTRACT_ATTRIBUTE_TYPE { LPCTSTR ShortAbstract; LPCTSTR AbstractFile; } -alias GOPHER_ABSTRACT_ATTRIBUTE_TYPE* LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE; +alias LPGOPHER_ABSTRACT_ATTRIBUTE_TYPE = GOPHER_ABSTRACT_ATTRIBUTE_TYPE*; struct GOPHER_VIEW_ATTRIBUTE_TYPE { LPCTSTR ContentType; LPCTSTR Language; DWORD Size; } -alias GOPHER_VIEW_ATTRIBUTE_TYPE* LPGOPHER_VIEW_ATTRIBUTE_TYPE; +alias LPGOPHER_VIEW_ATTRIBUTE_TYPE = GOPHER_VIEW_ATTRIBUTE_TYPE*; struct GOPHER_VERONICA_ATTRIBUTE_TYPE { BOOL TreeWalk; } -alias GOPHER_VERONICA_ATTRIBUTE_TYPE* LPGOPHER_VERONICA_ATTRIBUTE_TYPE; +alias LPGOPHER_VERONICA_ATTRIBUTE_TYPE = GOPHER_VERONICA_ATTRIBUTE_TYPE*; struct GOPHER_ASK_ATTRIBUTE_TYPE { LPCTSTR QuestionType; LPCTSTR QuestionText; } -alias GOPHER_ASK_ATTRIBUTE_TYPE* LPGOPHER_ASK_ATTRIBUTE_TYPE; +alias LPGOPHER_ASK_ATTRIBUTE_TYPE = GOPHER_ASK_ATTRIBUTE_TYPE*; struct GOPHER_UNKNOWN_ATTRIBUTE_TYPE { LPCTSTR Text; } -alias GOPHER_UNKNOWN_ATTRIBUTE_TYPE* LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE; +alias LPGOPHER_UNKNOWN_ATTRIBUTE_TYPE = GOPHER_UNKNOWN_ATTRIBUTE_TYPE*; struct GOPHER_ATTRIBUTE_TYPE { DWORD CategoryId; @@ -1070,11 +1068,10 @@ struct GOPHER_ATTRIBUTE_TYPE { GOPHER_UNKNOWN_ATTRIBUTE_TYPE Unknown; } /+AttributeType;+/ } -alias GOPHER_ATTRIBUTE_TYPE* LPGOPHER_ATTRIBUTE_TYPE; +alias LPGOPHER_ATTRIBUTE_TYPE = GOPHER_ATTRIBUTE_TYPE*; extern (Windows) -alias BOOL function(LPGOPHER_ATTRIBUTE_TYPE, DWORD) - GOPHER_ATTRIBUTE_ENUMERATOR; +alias GOPHER_ATTRIBUTE_ENUMERATOR = BOOL function(LPGOPHER_ATTRIBUTE_TYPE, DWORD); struct INTERNET_CACHE_ENTRY_INFOA { DWORD dwStructSize = INTERNET_CACHE_ENTRY_INFOA.sizeof; @@ -1094,7 +1091,7 @@ struct INTERNET_CACHE_ENTRY_INFOA { LPSTR lpszFileExtension; DWORD dwReserved; } -alias INTERNET_CACHE_ENTRY_INFOA* LPINTERNET_CACHE_ENTRY_INFOA; +alias LPINTERNET_CACHE_ENTRY_INFOA = INTERNET_CACHE_ENTRY_INFOA*; struct INTERNET_CACHE_ENTRY_INFOW { DWORD dwStructSize = INTERNET_CACHE_ENTRY_INFOW.sizeof; @@ -1114,7 +1111,7 @@ struct INTERNET_CACHE_ENTRY_INFOW { LPWSTR lpszFileExtension; DWORD dwReserved; } -alias INTERNET_CACHE_ENTRY_INFOW* LPINTERNET_CACHE_ENTRY_INFOW; +alias LPINTERNET_CACHE_ENTRY_INFOW = INTERNET_CACHE_ENTRY_INFOW*; struct INTERNET_BUFFERSA { DWORD dwStructSize = INTERNET_BUFFERSA.sizeof; @@ -1128,7 +1125,7 @@ struct INTERNET_BUFFERSA { DWORD dwOffsetLow; DWORD dwOffsetHigh; } -alias INTERNET_BUFFERSA* LPINTERNET_BUFFERSA; +alias LPINTERNET_BUFFERSA = INTERNET_BUFFERSA*; struct INTERNET_BUFFERSW { DWORD dwStructSize = INTERNET_BUFFERSW.sizeof; @@ -1142,7 +1139,7 @@ struct INTERNET_BUFFERSW { DWORD dwOffsetLow; DWORD dwOffsetHigh; } -alias INTERNET_BUFFERSW* LPINTERNET_BUFFERSW; +alias LPINTERNET_BUFFERSW = INTERNET_BUFFERSW*; enum size_t GROUP_OWNER_STORAGE_SIZE = 4, @@ -1157,7 +1154,7 @@ struct INTERNET_CACHE_GROUP_INFOA { DWORD[GROUP_OWNER_STORAGE_SIZE] dwOwnerStorage; CHAR[GROUPNAME_MAX_LENGTH] szGroupName = 0; } -alias INTERNET_CACHE_GROUP_INFOA* LPINTERNET_CACHE_GROUP_INFOA; +alias LPINTERNET_CACHE_GROUP_INFOA = INTERNET_CACHE_GROUP_INFOA*; struct INTERNET_CACHE_GROUP_INFOW { DWORD dwGroupSize; @@ -1168,7 +1165,7 @@ struct INTERNET_CACHE_GROUP_INFOW { DWORD[GROUP_OWNER_STORAGE_SIZE] dwOwnerStorage; WCHAR[GROUPNAME_MAX_LENGTH] szGroupName = 0; } -alias INTERNET_CACHE_GROUP_INFOW* LPINTERNET_CACHE_GROUP_INFOW; +alias LPINTERNET_CACHE_GROUP_INFOW = INTERNET_CACHE_GROUP_INFOW*; extern (Windows) { BOOL InternetTimeFromSystemTime(SYSTEMTIME*, DWORD, LPSTR, DWORD); @@ -1331,129 +1328,129 @@ extern (Windows) { } version (Unicode) { - alias INTERNET_PER_CONN_OPTIONW INTERNET_PER_CONN_OPTION; - alias LPINTERNET_PER_CONN_OPTIONW LPINTERNET_PER_CONN_OPTION; - alias INTERNET_PER_CONN_OPTION_LISTW INTERNET_PER_CONN_OPTION_LIST; - alias LPINTERNET_PER_CONN_OPTION_LISTW LPINTERNET_PER_CONN_OPTION_LIST; - alias URL_COMPONENTSW URL_COMPONENTS; - alias LPURL_COMPONENTSW LPURL_COMPONENTS; - alias GOPHER_FIND_DATAW GOPHER_FIND_DATA; - alias LPGOPHER_FIND_DATAW LPGOPHER_FIND_DATA; - alias INTERNET_CACHE_ENTRY_INFOW INTERNET_CACHE_ENTRY_INFO; - alias LPINTERNET_CACHE_ENTRY_INFOW LPINTERNET_CACHE_ENTRY_INFO; - alias INTERNET_BUFFERSW INTERNET_BUFFERS; - alias INTERNET_CACHE_GROUP_INFOW INTERNET_CACHE_GROUP_INFO; - alias LPINTERNET_CACHE_GROUP_INFOW LPINTERNET_CACHE_GROUP_INFO; - alias InternetCrackUrlW InternetCrackUrl; - alias InternetCreateUrlW InternetCreateUrl; - alias InternetCanonicalizeUrlW InternetCanonicalizeUrl; - alias InternetCheckConnectionW InternetCheckConnection; - alias InternetCombineUrlW InternetCombineUrl; - alias InternetOpenW InternetOpen; - alias InternetConnectW InternetConnect; - alias InternetOpenUrlW InternetOpenUrl; - alias InternetFindNextFileW InternetFindNextFile; - alias InternetQueryOptionW InternetQueryOption; - alias InternetSetOptionW InternetSetOption; - alias InternetSetOptionExW InternetSetOptionEx; - alias InternetGetLastResponseInfoW InternetGetLastResponseInfo; - alias InternetReadFileExW InternetReadFileEx; - alias FtpFindFirstFileW FtpFindFirstFile; - alias FtpGetFileW FtpGetFile; - alias FtpPutFileW FtpPutFile; - alias FtpDeleteFileW FtpDeleteFile; - alias FtpRenameFileW FtpRenameFile; - alias FtpOpenFileW FtpOpenFile; - alias FtpCreateDirectoryW FtpCreateDirectory; - alias FtpRemoveDirectoryW FtpRemoveDirectory; - alias FtpSetCurrentDirectoryW FtpSetCurrentDirectory; - alias FtpGetCurrentDirectoryW FtpGetCurrentDirectory; - alias FtpCommandW FtpCommand; - alias GopherGetLocatorTypeW GopherGetLocatorType; - alias GopherCreateLocatorW GopherCreateLocator; - alias GopherFindFirstFileW GopherFindFirstFile; - alias GopherOpenFileW GopherOpenFile; - alias GopherGetAttributeW GopherGetAttribute; - alias HttpSendRequestW HttpSendRequest; - alias HttpOpenRequestW HttpOpenRequest; - alias HttpAddRequestHeadersW HttpAddRequestHeaders; - alias HttpQueryInfoW HttpQueryInfo; - alias InternetSetCookieW InternetSetCookie; - alias InternetGetCookieW InternetGetCookie; - alias CreateUrlCacheEntryW CreateUrlCacheEntry; - alias RetrieveUrlCacheEntryStreamW RetrieveUrlCacheEntryStream; - alias FindNextUrlCacheEntryW FindNextUrlCacheEntry; - alias CommitUrlCacheEntryW CommitUrlCacheEntry; - alias GetUrlCacheEntryInfoW GetUrlCacheEntryInfo; - alias SetUrlCacheEntryInfoW SetUrlCacheEntryInfo; - alias FindFirstUrlCacheEntryW FindFirstUrlCacheEntry; - alias RetrieveUrlCacheEntryFileW RetrieveUrlCacheEntryFile; - alias HttpSendRequestExW HttpSendRequestEx; - alias HttpEndRequestW HttpEndRequest; - alias GetUrlCacheGroupAttributeW GetUrlCacheGroupAttribute; - alias SetUrlCacheGroupAttributeW SetUrlCacheGroupAttribute; + alias INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONW; + alias LPINTERNET_PER_CONN_OPTION = LPINTERNET_PER_CONN_OPTIONW; + alias INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTW; + alias LPINTERNET_PER_CONN_OPTION_LIST = LPINTERNET_PER_CONN_OPTION_LISTW; + alias URL_COMPONENTS = URL_COMPONENTSW; + alias LPURL_COMPONENTS = LPURL_COMPONENTSW; + alias GOPHER_FIND_DATA = GOPHER_FIND_DATAW; + alias LPGOPHER_FIND_DATA = LPGOPHER_FIND_DATAW; + alias INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOW; + alias LPINTERNET_CACHE_ENTRY_INFO = LPINTERNET_CACHE_ENTRY_INFOW; + alias INTERNET_BUFFERS = INTERNET_BUFFERSW; + alias INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOW; + alias LPINTERNET_CACHE_GROUP_INFO = LPINTERNET_CACHE_GROUP_INFOW; + alias InternetCrackUrl = InternetCrackUrlW; + alias InternetCreateUrl = InternetCreateUrlW; + alias InternetCanonicalizeUrl = InternetCanonicalizeUrlW; + alias InternetCheckConnection = InternetCheckConnectionW; + alias InternetCombineUrl = InternetCombineUrlW; + alias InternetOpen = InternetOpenW; + alias InternetConnect = InternetConnectW; + alias InternetOpenUrl = InternetOpenUrlW; + alias InternetFindNextFile = InternetFindNextFileW; + alias InternetQueryOption = InternetQueryOptionW; + alias InternetSetOption = InternetSetOptionW; + alias InternetSetOptionEx = InternetSetOptionExW; + alias InternetGetLastResponseInfo = InternetGetLastResponseInfoW; + alias InternetReadFileEx = InternetReadFileExW; + alias FtpFindFirstFile = FtpFindFirstFileW; + alias FtpGetFile = FtpGetFileW; + alias FtpPutFile = FtpPutFileW; + alias FtpDeleteFile = FtpDeleteFileW; + alias FtpRenameFile = FtpRenameFileW; + alias FtpOpenFile = FtpOpenFileW; + alias FtpCreateDirectory = FtpCreateDirectoryW; + alias FtpRemoveDirectory = FtpRemoveDirectoryW; + alias FtpSetCurrentDirectory = FtpSetCurrentDirectoryW; + alias FtpGetCurrentDirectory = FtpGetCurrentDirectoryW; + alias FtpCommand = FtpCommandW; + alias GopherGetLocatorType = GopherGetLocatorTypeW; + alias GopherCreateLocator = GopherCreateLocatorW; + alias GopherFindFirstFile = GopherFindFirstFileW; + alias GopherOpenFile = GopherOpenFileW; + alias GopherGetAttribute = GopherGetAttributeW; + alias HttpSendRequest = HttpSendRequestW; + alias HttpOpenRequest = HttpOpenRequestW; + alias HttpAddRequestHeaders = HttpAddRequestHeadersW; + alias HttpQueryInfo = HttpQueryInfoW; + alias InternetSetCookie = InternetSetCookieW; + alias InternetGetCookie = InternetGetCookieW; + alias CreateUrlCacheEntry = CreateUrlCacheEntryW; + alias RetrieveUrlCacheEntryStream = RetrieveUrlCacheEntryStreamW; + alias FindNextUrlCacheEntry = FindNextUrlCacheEntryW; + alias CommitUrlCacheEntry = CommitUrlCacheEntryW; + alias GetUrlCacheEntryInfo = GetUrlCacheEntryInfoW; + alias SetUrlCacheEntryInfo = SetUrlCacheEntryInfoW; + alias FindFirstUrlCacheEntry = FindFirstUrlCacheEntryW; + alias RetrieveUrlCacheEntryFile = RetrieveUrlCacheEntryFileW; + alias HttpSendRequestEx = HttpSendRequestExW; + alias HttpEndRequest = HttpEndRequestW; + alias GetUrlCacheGroupAttribute = GetUrlCacheGroupAttributeW; + alias SetUrlCacheGroupAttribute = SetUrlCacheGroupAttributeW; } else { - alias INTERNET_PER_CONN_OPTIONA INTERNET_PER_CONN_OPTION; - alias LPINTERNET_PER_CONN_OPTIONA LPINTERNET_PER_CONN_OPTION; - alias INTERNET_PER_CONN_OPTION_LISTA INTERNET_PER_CONN_OPTION_LIST; - alias LPINTERNET_PER_CONN_OPTION_LISTA LPINTERNET_PER_CONN_OPTION_LIST; - alias URL_COMPONENTSA URL_COMPONENTS; - alias LPURL_COMPONENTSA LPURL_COMPONENTS; - alias GOPHER_FIND_DATAA GOPHER_FIND_DATA; - alias LPGOPHER_FIND_DATAA LPGOPHER_FIND_DATA; - alias INTERNET_CACHE_ENTRY_INFOA INTERNET_CACHE_ENTRY_INFO; - alias LPINTERNET_CACHE_ENTRY_INFOA LPINTERNET_CACHE_ENTRY_INFO; - alias INTERNET_BUFFERSA INTERNET_BUFFERS; - alias INTERNET_CACHE_GROUP_INFOA INTERNET_CACHE_GROUP_INFO; - alias LPINTERNET_CACHE_GROUP_INFOA LPINTERNET_CACHE_GROUP_INFO; - alias GopherGetAttributeA GopherGetAttribute; - alias InternetCrackUrlA InternetCrackUrl; - alias InternetCreateUrlA InternetCreateUrl; - alias InternetCanonicalizeUrlA InternetCanonicalizeUrl; - alias InternetCheckConnectionA InternetCheckConnection; - alias InternetCombineUrlA InternetCombineUrl; - alias InternetOpenA InternetOpen; - alias InternetConnectA InternetConnect; - alias InternetOpenUrlA InternetOpenUrl; - alias InternetFindNextFileA InternetFindNextFile; - alias InternetQueryOptionA InternetQueryOption; - alias InternetSetOptionA InternetSetOption; - alias InternetSetOptionExA InternetSetOptionEx; - alias InternetGetLastResponseInfoA InternetGetLastResponseInfo; - alias InternetReadFileExA InternetReadFileEx; - alias FtpFindFirstFileA FtpFindFirstFile; - alias FtpGetFileA FtpGetFile; - alias FtpPutFileA FtpPutFile; - alias FtpDeleteFileA FtpDeleteFile; - alias FtpRenameFileA FtpRenameFile; - alias FtpOpenFileA FtpOpenFile; - alias FtpCreateDirectoryA FtpCreateDirectory; - alias FtpRemoveDirectoryA FtpRemoveDirectory; - alias FtpSetCurrentDirectoryA FtpSetCurrentDirectory; - alias FtpGetCurrentDirectoryA FtpGetCurrentDirectory; - alias FtpCommandA FtpCommand; - alias GopherGetLocatorTypeA GopherGetLocatorType; - alias GopherCreateLocatorA GopherCreateLocator; - alias GopherFindFirstFileA GopherFindFirstFile; - alias GopherOpenFileA GopherOpenFile; - alias HttpSendRequestA HttpSendRequest; - alias HttpOpenRequestA HttpOpenRequest; - alias HttpAddRequestHeadersA HttpAddRequestHeaders; - alias HttpQueryInfoA HttpQueryInfo; - alias InternetSetCookieA InternetSetCookie; - alias InternetGetCookieA InternetGetCookie; - alias CreateUrlCacheEntryA CreateUrlCacheEntry; - alias RetrieveUrlCacheEntryStreamA RetrieveUrlCacheEntryStream; - alias FindNextUrlCacheEntryA FindNextUrlCacheEntry; - alias CommitUrlCacheEntryA CommitUrlCacheEntry; - alias GetUrlCacheEntryInfoA GetUrlCacheEntryInfo; - alias SetUrlCacheEntryInfoA SetUrlCacheEntryInfo; - alias FindFirstUrlCacheEntryA FindFirstUrlCacheEntry; - alias RetrieveUrlCacheEntryFileA RetrieveUrlCacheEntryFile; - alias HttpSendRequestExA HttpSendRequestEx; - alias HttpEndRequestA HttpEndRequest; - alias GetUrlCacheGroupAttributeA GetUrlCacheGroupAttribute; - alias SetUrlCacheGroupAttributeA SetUrlCacheGroupAttribute; -} - -alias INTERNET_BUFFERS* LPINTERNET_BUFFERS; + alias INTERNET_PER_CONN_OPTION = INTERNET_PER_CONN_OPTIONA; + alias LPINTERNET_PER_CONN_OPTION = LPINTERNET_PER_CONN_OPTIONA; + alias INTERNET_PER_CONN_OPTION_LIST = INTERNET_PER_CONN_OPTION_LISTA; + alias LPINTERNET_PER_CONN_OPTION_LIST = LPINTERNET_PER_CONN_OPTION_LISTA; + alias URL_COMPONENTS = URL_COMPONENTSA; + alias LPURL_COMPONENTS = LPURL_COMPONENTSA; + alias GOPHER_FIND_DATA = GOPHER_FIND_DATAA; + alias LPGOPHER_FIND_DATA = LPGOPHER_FIND_DATAA; + alias INTERNET_CACHE_ENTRY_INFO = INTERNET_CACHE_ENTRY_INFOA; + alias LPINTERNET_CACHE_ENTRY_INFO = LPINTERNET_CACHE_ENTRY_INFOA; + alias INTERNET_BUFFERS = INTERNET_BUFFERSA; + alias INTERNET_CACHE_GROUP_INFO = INTERNET_CACHE_GROUP_INFOA; + alias LPINTERNET_CACHE_GROUP_INFO = LPINTERNET_CACHE_GROUP_INFOA; + alias GopherGetAttribute = GopherGetAttributeA; + alias InternetCrackUrl = InternetCrackUrlA; + alias InternetCreateUrl = InternetCreateUrlA; + alias InternetCanonicalizeUrl = InternetCanonicalizeUrlA; + alias InternetCheckConnection = InternetCheckConnectionA; + alias InternetCombineUrl = InternetCombineUrlA; + alias InternetOpen = InternetOpenA; + alias InternetConnect = InternetConnectA; + alias InternetOpenUrl = InternetOpenUrlA; + alias InternetFindNextFile = InternetFindNextFileA; + alias InternetQueryOption = InternetQueryOptionA; + alias InternetSetOption = InternetSetOptionA; + alias InternetSetOptionEx = InternetSetOptionExA; + alias InternetGetLastResponseInfo = InternetGetLastResponseInfoA; + alias InternetReadFileEx = InternetReadFileExA; + alias FtpFindFirstFile = FtpFindFirstFileA; + alias FtpGetFile = FtpGetFileA; + alias FtpPutFile = FtpPutFileA; + alias FtpDeleteFile = FtpDeleteFileA; + alias FtpRenameFile = FtpRenameFileA; + alias FtpOpenFile = FtpOpenFileA; + alias FtpCreateDirectory = FtpCreateDirectoryA; + alias FtpRemoveDirectory = FtpRemoveDirectoryA; + alias FtpSetCurrentDirectory = FtpSetCurrentDirectoryA; + alias FtpGetCurrentDirectory = FtpGetCurrentDirectoryA; + alias FtpCommand = FtpCommandA; + alias GopherGetLocatorType = GopherGetLocatorTypeA; + alias GopherCreateLocator = GopherCreateLocatorA; + alias GopherFindFirstFile = GopherFindFirstFileA; + alias GopherOpenFile = GopherOpenFileA; + alias HttpSendRequest = HttpSendRequestA; + alias HttpOpenRequest = HttpOpenRequestA; + alias HttpAddRequestHeaders = HttpAddRequestHeadersA; + alias HttpQueryInfo = HttpQueryInfoA; + alias InternetSetCookie = InternetSetCookieA; + alias InternetGetCookie = InternetGetCookieA; + alias CreateUrlCacheEntry = CreateUrlCacheEntryA; + alias RetrieveUrlCacheEntryStream = RetrieveUrlCacheEntryStreamA; + alias FindNextUrlCacheEntry = FindNextUrlCacheEntryA; + alias CommitUrlCacheEntry = CommitUrlCacheEntryA; + alias GetUrlCacheEntryInfo = GetUrlCacheEntryInfoA; + alias SetUrlCacheEntryInfo = SetUrlCacheEntryInfoA; + alias FindFirstUrlCacheEntry = FindFirstUrlCacheEntryA; + alias RetrieveUrlCacheEntryFile = RetrieveUrlCacheEntryFileA; + alias HttpSendRequestEx = HttpSendRequestExA; + alias HttpEndRequest = HttpEndRequestA; + alias GetUrlCacheGroupAttribute = GetUrlCacheGroupAttributeA; + alias SetUrlCacheGroupAttribute = SetUrlCacheGroupAttributeA; +} + +alias LPINTERNET_BUFFERS = INTERNET_BUFFERS*; diff --git a/runtime/druntime/src/core/sys/windows/winioctl.d b/runtime/druntime/src/core/sys/windows/winioctl.d index f9db05d9d6c..087b3351ba4 100644 --- a/runtime/druntime/src/core/sys/windows/winioctl.d +++ b/runtime/druntime/src/core/sys/windows/winioctl.d @@ -19,7 +19,7 @@ enum size_t HISTOGRAM_BUCKET_SIZE = HISTOGRAM_BUCKET.sizeof, DISK_HISTOGRAM_SIZE = DISK_HISTOGRAM.sizeof; -alias DWORD DEVICE_TYPE; +alias DEVICE_TYPE = DWORD; enum : DEVICE_TYPE { FILE_DEVICE_BEEP = 1, @@ -233,8 +233,8 @@ enum { DISK_BINNING } -alias WORD BAD_TRACK_NUMBER; -alias WORD* PBAD_TRACK_NUMBER; +alias BAD_TRACK_NUMBER = WORD; +alias PBAD_TRACK_NUMBER = WORD*; enum BIN_TYPES { RequestSize, RequestLocation @@ -244,13 +244,13 @@ struct BIN_RANGE { LARGE_INTEGER StartValue; LARGE_INTEGER Length; } -alias BIN_RANGE* PBIN_RANGE; +alias PBIN_RANGE = BIN_RANGE*; struct BIN_COUNT { BIN_RANGE BinRange; DWORD BinCount; } -alias BIN_COUNT* PBIN_COUNT; +alias PBIN_COUNT = BIN_COUNT*; struct BIN_RESULTS { DWORD NumberOfBins; @@ -258,7 +258,7 @@ struct BIN_RESULTS { BIN_COUNT* BinCounts() return { return &_BinCounts; } } -alias BIN_RESULTS* PBIN_RESULTS; +alias PBIN_RESULTS = BIN_RESULTS*; enum PARTITION_STYLE { PARTITION_STYLE_MBR, @@ -270,12 +270,12 @@ struct CREATE_DISK_GPT { GUID DiskId; DWORD MaxPartitionCount; } -alias CREATE_DISK_GPT* PCREATE_DISK_GPT; +alias PCREATE_DISK_GPT = CREATE_DISK_GPT*; struct CREATE_DISK_MBR { DWORD Signature; } -alias CREATE_DISK_MBR* PCREATE_DISK_MBR; +alias PCREATE_DISK_MBR = CREATE_DISK_MBR*; struct CREATE_DISK { PARTITION_STYLE PartitionStyle; @@ -284,7 +284,7 @@ struct CREATE_DISK { CREATE_DISK_GPT Gpt; } } -alias CREATE_DISK* PCREATE_DISK; +alias PCREATE_DISK = CREATE_DISK*; enum DISK_CACHE_RETENTION_PRIORITY { EqualPriority, @@ -314,7 +314,7 @@ struct DISK_CACHE_INFORMATION { _BlockPrefetch BlockPrefetch; } } -alias DISK_CACHE_INFORMATION* PDISK_CACHE_INFORMATION; +alias PDISK_CACHE_INFORMATION = DISK_CACHE_INFORMATION*; enum DETECTION_TYPE { DetectNone, @@ -329,7 +329,7 @@ struct DISK_INT13_INFO { WORD MaxHeads; WORD NumberDrives; } -alias DISK_INT13_INFO* PDISK_INT13_INFO; +alias PDISK_INT13_INFO = DISK_INT13_INFO*; struct DISK_EX_INT13_INFO { WORD ExBufferSize; @@ -341,7 +341,7 @@ struct DISK_EX_INT13_INFO { WORD ExSectorSize; WORD ExReserved; } -alias DISK_EX_INT13_INFO* PDISK_EX_INT13_INFO; +alias PDISK_EX_INT13_INFO = DISK_EX_INT13_INFO*; struct DISK_DETECTION_INFO { DWORD SizeOfDetectInfo; @@ -349,7 +349,7 @@ struct DISK_DETECTION_INFO { DISK_INT13_INFO Int13; DISK_EX_INT13_INFO ExInt13; } -alias DISK_DETECTION_INFO* PDISK_DETECTION_INFO; +alias PDISK_DETECTION_INFO = DISK_DETECTION_INFO*; enum MEDIA_TYPE { Unknown, @@ -379,7 +379,7 @@ enum MEDIA_TYPE { F3_240M_512, F3_32M_512 } -alias MEDIA_TYPE* PMEDIA_TYPE; +alias PMEDIA_TYPE = MEDIA_TYPE*; struct DISK_GEOMETRY { LARGE_INTEGER Cylinders; @@ -388,7 +388,7 @@ struct DISK_GEOMETRY { DWORD SectorsPerTrack; DWORD BytesPerSector; } -alias DISK_GEOMETRY* PDISK_GEOMETRY; +alias PDISK_GEOMETRY = DISK_GEOMETRY*; struct DISK_GEOMETRY_EX { DISK_GEOMETRY Geometry; @@ -397,13 +397,13 @@ struct DISK_GEOMETRY_EX { BYTE* Data() return { return &_Data; } } -alias DISK_GEOMETRY_EX* PDISK_GEOMETRY_EX; +alias PDISK_GEOMETRY_EX = DISK_GEOMETRY_EX*; struct DISK_GROW_PARTITION { DWORD PartitionNumber; LARGE_INTEGER BytesToGrow; } -alias DISK_GROW_PARTITION* PDISK_GROW_PARTITION; +alias PDISK_GROW_PARTITION = DISK_GROW_PARTITION*; struct DISK_PARTITION_INFO { DWORD SizeOfPartitionInfo; @@ -417,7 +417,7 @@ struct DISK_PARTITION_INFO { //} Gpt; } } -alias DISK_PARTITION_INFO* PDISK_PARTITION_INFO; +alias PDISK_PARTITION_INFO = DISK_PARTITION_INFO*; struct DISK_PERFORMANCE { LARGE_INTEGER BytesRead; @@ -428,7 +428,7 @@ struct DISK_PERFORMANCE { DWORD WriteCount; DWORD QueueDepth; } -alias DISK_PERFORMANCE* PDISK_PERFORMANCE; +alias PDISK_PERFORMANCE = DISK_PERFORMANCE*; struct DISK_RECORD { LARGE_INTEGER ByteOffset; @@ -439,21 +439,21 @@ struct DISK_RECORD { BYTE DeviceNumber; BOOLEAN ReadRequest; } -alias DISK_RECORD* PDISK_RECORD; +alias PDISK_RECORD = DISK_RECORD*; struct DISK_LOGGING { BYTE Function; PVOID BufferAddress; DWORD BufferSize; } -alias DISK_LOGGING* PDISK_LOGGING; +alias PDISK_LOGGING = DISK_LOGGING*; struct DISKQUOTA_USER_INFORMATION { LONGLONG QuotaUsed; LONGLONG QuotaThreshold; LONGLONG QuotaLimit; } -alias DISKQUOTA_USER_INFORMATION* PDISKQUOTA_USER_INFORMATION; +alias PDISKQUOTA_USER_INFORMATION = DISKQUOTA_USER_INFORMATION*; struct FORMAT_PARAMETERS { MEDIA_TYPE MediaType; @@ -462,7 +462,7 @@ struct FORMAT_PARAMETERS { DWORD StartHeadNumber; DWORD EndHeadNumber; } -alias FORMAT_PARAMETERS* PFORMAT_PARAMETERS; +alias PFORMAT_PARAMETERS = FORMAT_PARAMETERS*; struct FORMAT_EX_PARAMETERS { MEDIA_TYPE MediaType; @@ -476,7 +476,7 @@ struct FORMAT_EX_PARAMETERS { WORD* SectorNumber() return { return &_SectorNumber; } } -alias FORMAT_EX_PARAMETERS* PFORMAT_EX_PARAMETERS; +alias PFORMAT_EX_PARAMETERS = FORMAT_EX_PARAMETERS*; struct GET_LENGTH_INFORMATION { LARGE_INTEGER Length; @@ -486,7 +486,7 @@ struct HISTOGRAM_BUCKET { DWORD Reads; DWORD Writes; } -alias HISTOGRAM_BUCKET* PHISTOGRAM_BUCKET; +alias PHISTOGRAM_BUCKET = HISTOGRAM_BUCKET*; struct DISK_HISTOGRAM { LARGE_INTEGER DiskSize; @@ -501,14 +501,14 @@ struct DISK_HISTOGRAM { DWORD WriteCount; PHISTOGRAM_BUCKET Histogram; } -alias DISK_HISTOGRAM* PDISK_HISTOGRAM; +alias PDISK_HISTOGRAM = DISK_HISTOGRAM*; struct DISK_EXTENT { DWORD DiskNumber; LARGE_INTEGER StartingOffset; LARGE_INTEGER ExtentLength; } -alias DISK_EXTENT* PDISK_EXTENT; +alias PDISK_EXTENT = DISK_EXTENT*; struct VOLUME_DISK_EXTENTS { DWORD NumberOfDiskExtents; @@ -516,7 +516,7 @@ struct VOLUME_DISK_EXTENTS { DISK_EXTENT* Extents() return { return &_Extents; } } -alias VOLUME_DISK_EXTENTS* PVOLUME_DISK_EXTENTS; +alias PVOLUME_DISK_EXTENTS = VOLUME_DISK_EXTENTS*; struct PARTITION_INFORMATION { LARGE_INTEGER StartingOffset; @@ -528,7 +528,7 @@ struct PARTITION_INFORMATION { BOOLEAN RecognizedPartition; BOOLEAN RewritePartition; } -alias PARTITION_INFORMATION* PPARTITION_INFORMATION; +alias PPARTITION_INFORMATION = PARTITION_INFORMATION*; struct DRIVE_LAYOUT_INFORMATION { DWORD PartitionCount; @@ -537,7 +537,7 @@ struct DRIVE_LAYOUT_INFORMATION { PARTITION_INFORMATION* PartitionEntry() return { return &_PartitionEntry; } } -alias DRIVE_LAYOUT_INFORMATION* PDRIVE_LAYOUT_INFORMATION; +alias PDRIVE_LAYOUT_INFORMATION = DRIVE_LAYOUT_INFORMATION*; struct DRIVE_LAYOUT_INFORMATION_GPT { GUID DiskId; @@ -545,12 +545,12 @@ struct DRIVE_LAYOUT_INFORMATION_GPT { LARGE_INTEGER UsableLength; ULONG MaxPartitionCount; } -alias DRIVE_LAYOUT_INFORMATION_GPT* PDRIVE_LAYOUT_INFORMATION_GPT; +alias PDRIVE_LAYOUT_INFORMATION_GPT = DRIVE_LAYOUT_INFORMATION_GPT*; struct DRIVE_LAYOUT_INFORMATION_MBR { ULONG Signature; } -alias DRIVE_LAYOUT_INFORMATION_MBR* PDRIVE_LAYOUT_INFORMATION_MBR; +alias PDRIVE_LAYOUT_INFORMATION_MBR = DRIVE_LAYOUT_INFORMATION_MBR*; struct PARTITION_INFORMATION_MBR { BYTE PartitionType; @@ -589,7 +589,7 @@ struct DRIVE_LAYOUT_INFORMATION_EX { PARTITION_INFORMATION_EX* PartitionEntry() return { return &_PartitionEntry; } } -alias DRIVE_LAYOUT_INFORMATION_EX* PDRIVE_LAYOUT_INFORMATION_EX; +alias PDRIVE_LAYOUT_INFORMATION_EX = DRIVE_LAYOUT_INFORMATION_EX*; struct MOVE_FILE_DATA { HANDLE FileHandle; @@ -597,7 +597,7 @@ struct MOVE_FILE_DATA { LARGE_INTEGER StartingLcn; DWORD ClusterCount; } -alias MOVE_FILE_DATA* PMOVE_FILE_DATA; +alias PMOVE_FILE_DATA = MOVE_FILE_DATA*; struct PERF_BIN { DWORD NumberOfBins; @@ -606,12 +606,12 @@ struct PERF_BIN { BIN_RANGE* BinsRanges() return { return &_BinsRanges; } } -alias PERF_BIN* PPERF_BIN; +alias PPERF_BIN = PERF_BIN*; struct PREVENT_MEDIA_REMOVAL { BOOLEAN PreventMediaRemoval; } -alias PREVENT_MEDIA_REMOVAL* PPREVENT_MEDIA_REMOVAL; +alias PPREVENT_MEDIA_REMOVAL = PREVENT_MEDIA_REMOVAL*; struct RETRIEVAL_POINTERS_BUFFER { DWORD ExtentCount; @@ -625,7 +625,7 @@ struct RETRIEVAL_POINTERS_BUFFER { Extent* Extents() return { return &_Extents; } } -alias RETRIEVAL_POINTERS_BUFFER* PRETRIEVAL_POINTERS_BUFFER; +alias PRETRIEVAL_POINTERS_BUFFER = RETRIEVAL_POINTERS_BUFFER*; struct REASSIGN_BLOCKS { WORD Reserved; @@ -634,28 +634,28 @@ struct REASSIGN_BLOCKS { DWORD* BlockNumber() return { return &_BlockNumber; } } -alias REASSIGN_BLOCKS* PREASSIGN_BLOCKS; +alias PREASSIGN_BLOCKS = REASSIGN_BLOCKS*; struct SET_PARTITION_INFORMATION { BYTE PartitionType; } -alias SET_PARTITION_INFORMATION* PSET_PARTITION_INFORMATION; +alias PSET_PARTITION_INFORMATION = SET_PARTITION_INFORMATION*; struct STARTING_LCN_INPUT_BUFFER { LARGE_INTEGER StartingLcn; } -alias STARTING_LCN_INPUT_BUFFER* PSTARTING_LCN_INPUT_BUFFER; +alias PSTARTING_LCN_INPUT_BUFFER = STARTING_LCN_INPUT_BUFFER*; struct STARTING_VCN_INPUT_BUFFER { LARGE_INTEGER StartingVcn; } -alias STARTING_VCN_INPUT_BUFFER* PSTARTING_VCN_INPUT_BUFFER; +alias PSTARTING_VCN_INPUT_BUFFER = STARTING_VCN_INPUT_BUFFER*; struct VERIFY_INFORMATION { LARGE_INTEGER StartingOffset; DWORD Length; } -alias VERIFY_INFORMATION* PVERIFY_INFORMATION; +alias PVERIFY_INFORMATION = VERIFY_INFORMATION*; struct VOLUME_BITMAP_BUFFER { LARGE_INTEGER StartingLcn; @@ -664,7 +664,7 @@ struct VOLUME_BITMAP_BUFFER { BYTE* Buffer() return { return &_Buffer; } } -alias VOLUME_BITMAP_BUFFER* PVOLUME_BITMAP_BUFFER; +alias PVOLUME_BITMAP_BUFFER = VOLUME_BITMAP_BUFFER*; struct NTFS_VOLUME_DATA_BUFFER { LARGE_INTEGER VolumeSerialNumber; @@ -682,7 +682,7 @@ struct NTFS_VOLUME_DATA_BUFFER { LARGE_INTEGER MftZoneStart; LARGE_INTEGER MftZoneEnd; } -alias NTFS_VOLUME_DATA_BUFFER* PNTFS_VOLUME_DATA_BUFFER; +alias PNTFS_VOLUME_DATA_BUFFER = NTFS_VOLUME_DATA_BUFFER*; bool IsRecognizedPartition(BYTE t) { diff --git a/runtime/druntime/src/core/sys/windows/winldap.d b/runtime/druntime/src/core/sys/windows/winldap.d index bcdb2b33a75..c927ddea168 100644 --- a/runtime/druntime/src/core/sys/windows/winldap.d +++ b/runtime/druntime/src/core/sys/windows/winldap.d @@ -297,7 +297,7 @@ struct LDAP { PCHAR ld_matched; PCHAR ld_error; } -alias LDAP* PLDAP; +alias PLDAP = LDAP*; // should be opaque structure struct LDAPMessage { @@ -308,13 +308,13 @@ struct LDAPMessage { LDAPMessage* lm_next; ULONG lm_time; } -alias LDAPMessage* PLDAPMessage; +alias PLDAPMessage = LDAPMessage*; struct LDAP_TIMEVAL { LONG tv_sec; LONG tv_usec; } -alias LDAP_TIMEVAL* PLDAP_TIMEVAL; +alias PLDAP_TIMEVAL = LDAP_TIMEVAL*; struct LDAPAPIInfoA { int ldapai_info_version; @@ -324,7 +324,7 @@ struct LDAPAPIInfoA { char* ldapai_vendor_name; int ldapai_vendor_version; } -alias LDAPAPIInfoA* PLDAPAPIInfoA; +alias PLDAPAPIInfoA = LDAPAPIInfoA*; struct LDAPAPIInfoW { int ldapai_info_version; @@ -334,35 +334,35 @@ struct LDAPAPIInfoW { PWCHAR ldapai_vendor_name; int ldapai_vendor_version; } -alias LDAPAPIInfoW* PLDAPAPIInfoW; +alias PLDAPAPIInfoW = LDAPAPIInfoW*; struct LDAPAPIFeatureInfoA { int ldapaif_info_version; char* ldapaif_name; int ldapaif_version; } -alias LDAPAPIFeatureInfoA* PLDAPAPIFeatureInfoA; +alias PLDAPAPIFeatureInfoA = LDAPAPIFeatureInfoA*; struct LDAPAPIFeatureInfoW { int ldapaif_info_version; PWCHAR ldapaif_name; int ldapaif_version; } -alias LDAPAPIFeatureInfoW* PLDAPAPIFeatureInfoW; +alias PLDAPAPIFeatureInfoW = LDAPAPIFeatureInfoW*; struct LDAPControlA { PCHAR ldctl_oid; BerValue ldctl_value; BOOLEAN ldctl_iscritical; } -alias LDAPControlA* PLDAPControlA; +alias PLDAPControlA = LDAPControlA*; struct LDAPControlW { PWCHAR ldctl_oid; BerValue ldctl_value; BOOLEAN ldctl_iscritical; } -alias LDAPControlW* PLDAPControlW; +alias PLDAPControlW = LDAPControlW*; /* Do we really need these? In MinGW, LDAPModA/W have only mod_op, mod_type * and mod_vals, and macros are used to simulate anonymous unions in those @@ -389,7 +389,7 @@ struct LDAPModA { BerValue** mod_bvalues; } } -alias LDAPModA* PLDAPModA; +alias PLDAPModA = LDAPModA*; struct LDAPModW { ULONG mod_op; @@ -402,39 +402,39 @@ struct LDAPModW { BerValue** mod_bvalues; } } -alias LDAPModW* PLDAPModW; +alias PLDAPModW = LDAPModW*; /* Opaque structure * http://msdn.microsoft.com/library/en-us/ldap/ldap/ldapsearch.asp */ struct LDAPSearch; -alias LDAPSearch* PLDAPSearch; +alias PLDAPSearch = LDAPSearch*; struct LDAPSortKeyA { PCHAR sk_attrtype; PCHAR sk_matchruleoid; BOOLEAN sk_reverseorder; } -alias LDAPSortKeyA* PLDAPSortKeyA; +alias PLDAPSortKeyA = LDAPSortKeyA*; struct LDAPSortKeyW { PWCHAR sk_attrtype; PWCHAR sk_matchruleoid; BOOLEAN sk_reverseorder; } -alias LDAPSortKeyW* PLDAPSortKeyW; +alias PLDAPSortKeyW = LDAPSortKeyW*; /* MinGW defines these as immediate function typedefs, which don't translate * well into D. */ extern (C) { - alias ULONG function(PLDAP, PLDAP, PWCHAR, PCHAR, ULONG, PVOID, PVOID, - PLDAP*) QUERYFORCONNECTION; - alias BOOLEAN function(PLDAP, PLDAP, PWCHAR, PCHAR, PLDAP, ULONG, PVOID, - PVOID, ULONG) NOTIFYOFNEWCONNECTION; - alias ULONG function(PLDAP, PLDAP) DEREFERENCECONNECTION; - alias BOOLEAN function(PLDAP, PSecPkgContext_IssuerListInfoEx, - PCCERT_CONTEXT*) QUERYCLIENTCERT; + alias QUERYFORCONNECTION = ULONG function(PLDAP, PLDAP, PWCHAR, PCHAR, ULONG, PVOID, PVOID, + PLDAP*); + alias NOTIFYOFNEWCONNECTION = BOOLEAN function(PLDAP, PLDAP, PWCHAR, PCHAR, PLDAP, ULONG, PVOID, + PVOID, ULONG); + alias DEREFERENCECONNECTION = ULONG function(PLDAP, PLDAP); + alias QUERYCLIENTCERT = BOOLEAN function(PLDAP, PSecPkgContext_IssuerListInfoEx, + PCCERT_CONTEXT*); } struct LDAP_REFERRAL_CALLBACK { @@ -443,7 +443,7 @@ struct LDAP_REFERRAL_CALLBACK { NOTIFYOFNEWCONNECTION* NotifyRoutine; DEREFERENCECONNECTION* DereferenceRoutine; } -alias LDAP_REFERRAL_CALLBACK* PLDAP_REFERRAL_CALLBACK; +alias PLDAP_REFERRAL_CALLBACK = LDAP_REFERRAL_CALLBACK*; struct LDAPVLVInfo { int ldvlv_version; @@ -689,173 +689,173 @@ extern (C) { } version (Unicode) { - alias LDAPControlW LDAPControl; - alias PLDAPControlW PLDAPControl; - alias LDAPModW LDAPMod; - alias LDAPModW PLDAPMod; - alias LDAPSortKeyW LDAPSortKey; - alias PLDAPSortKeyW PLDAPSortKey; - alias LDAPAPIInfoW LDAPAPIInfo; - alias PLDAPAPIInfoW PLDAPAPIInfo; - alias LDAPAPIFeatureInfoW LDAPAPIFeatureInfo; - alias PLDAPAPIFeatureInfoW PLDAPAPIFeatureInfo; - alias cldap_openW cldap_open; - alias ldap_openW ldap_open; - alias ldap_simple_bindW ldap_simple_bind; - alias ldap_simple_bind_sW ldap_simple_bind_s; - alias ldap_sasl_bindW ldap_sasl_bind; - alias ldap_sasl_bind_sW ldap_sasl_bind_s; - alias ldap_initW ldap_init; - alias ldap_sslinitW ldap_sslinit; - alias ldap_get_optionW ldap_get_option; - alias ldap_set_optionW ldap_set_option; - alias ldap_start_tls_sW ldap_start_tls_s; - alias ldap_addW ldap_add; - alias ldap_add_extW ldap_add_ext; - alias ldap_add_sW ldap_add_s; - alias ldap_add_ext_sW ldap_add_ext_s; - alias ldap_compareW ldap_compare; - alias ldap_compare_extW ldap_compare_ext; - alias ldap_compare_sW ldap_compare_s; - alias ldap_compare_ext_sW ldap_compare_ext_s; - alias ldap_deleteW ldap_delete; - alias ldap_delete_extW ldap_delete_ext; - alias ldap_delete_sW ldap_delete_s; - alias ldap_delete_ext_sW ldap_delete_ext_s; - alias ldap_extended_operation_sW ldap_extended_operation_s; - alias ldap_extended_operationW ldap_extended_operation; - alias ldap_modifyW ldap_modify; - alias ldap_modify_extW ldap_modify_ext; - alias ldap_modify_sW ldap_modify_s; - alias ldap_modify_ext_sW ldap_modify_ext_s; - alias ldap_check_filterW ldap_check_filter; - alias ldap_count_valuesW ldap_count_values; - alias ldap_create_page_controlW ldap_create_page_control; - alias ldap_create_sort_controlW ldap_create_sort_control; - alias ldap_create_vlv_controlW ldap_create_vlv_control; - alias ldap_encode_sort_controlW ldap_encode_sort_control; - alias ldap_escape_filter_elementW ldap_escape_filter_element; - alias ldap_first_attributeW ldap_first_attribute; - alias ldap_next_attributeW ldap_next_attribute; - alias ldap_get_valuesW ldap_get_values; - alias ldap_get_values_lenW ldap_get_values_len; - alias ldap_parse_extended_resultW ldap_parse_extended_result; - alias ldap_parse_page_controlW ldap_parse_page_control; - alias ldap_parse_referenceW ldap_parse_reference; - alias ldap_parse_resultW ldap_parse_result; - alias ldap_parse_sort_controlW ldap_parse_sort_control; - alias ldap_parse_vlv_controlW ldap_parse_vlv_control; - alias ldap_searchW ldap_search; - alias ldap_search_sW ldap_search_s; - alias ldap_search_stW ldap_search_st; - alias ldap_search_extW ldap_search_ext; - alias ldap_search_ext_sW ldap_search_ext_s; - alias ldap_search_init_pageW ldap_search_init_page; - alias ldap_err2stringW ldap_err2string; - alias ldap_control_freeW ldap_control_free; - alias ldap_controls_freeW ldap_controls_free; - alias ldap_free_controlsW ldap_free_controls; - alias ldap_memfreeW ldap_memfree; - alias ldap_value_freeW ldap_value_free; - alias ldap_dn2ufnW ldap_dn2ufn; - alias ldap_ufn2dnW ldap_ufn2dn; - alias ldap_explode_dnW ldap_explode_dn; - alias ldap_get_dnW ldap_get_dn; - alias ldap_rename_extW ldap_rename; - alias ldap_rename_ext_sW ldap_rename_s; - alias ldap_rename_extW ldap_rename_ext; - alias ldap_rename_ext_sW ldap_rename_ext_s; + alias LDAPControl = LDAPControlW; + alias PLDAPControl = PLDAPControlW; + alias LDAPMod = LDAPModW; + alias PLDAPMod = LDAPModW; + alias LDAPSortKey = LDAPSortKeyW; + alias PLDAPSortKey = PLDAPSortKeyW; + alias LDAPAPIInfo = LDAPAPIInfoW; + alias PLDAPAPIInfo = PLDAPAPIInfoW; + alias LDAPAPIFeatureInfo = LDAPAPIFeatureInfoW; + alias PLDAPAPIFeatureInfo = PLDAPAPIFeatureInfoW; + alias cldap_open = cldap_openW; + alias ldap_open = ldap_openW; + alias ldap_simple_bind = ldap_simple_bindW; + alias ldap_simple_bind_s = ldap_simple_bind_sW; + alias ldap_sasl_bind = ldap_sasl_bindW; + alias ldap_sasl_bind_s = ldap_sasl_bind_sW; + alias ldap_init = ldap_initW; + alias ldap_sslinit = ldap_sslinitW; + alias ldap_get_option = ldap_get_optionW; + alias ldap_set_option = ldap_set_optionW; + alias ldap_start_tls_s = ldap_start_tls_sW; + alias ldap_add = ldap_addW; + alias ldap_add_ext = ldap_add_extW; + alias ldap_add_s = ldap_add_sW; + alias ldap_add_ext_s = ldap_add_ext_sW; + alias ldap_compare = ldap_compareW; + alias ldap_compare_ext = ldap_compare_extW; + alias ldap_compare_s = ldap_compare_sW; + alias ldap_compare_ext_s = ldap_compare_ext_sW; + alias ldap_delete = ldap_deleteW; + alias ldap_delete_ext = ldap_delete_extW; + alias ldap_delete_s = ldap_delete_sW; + alias ldap_delete_ext_s = ldap_delete_ext_sW; + alias ldap_extended_operation_s = ldap_extended_operation_sW; + alias ldap_extended_operation = ldap_extended_operationW; + alias ldap_modify = ldap_modifyW; + alias ldap_modify_ext = ldap_modify_extW; + alias ldap_modify_s = ldap_modify_sW; + alias ldap_modify_ext_s = ldap_modify_ext_sW; + alias ldap_check_filter = ldap_check_filterW; + alias ldap_count_values = ldap_count_valuesW; + alias ldap_create_page_control = ldap_create_page_controlW; + alias ldap_create_sort_control = ldap_create_sort_controlW; + alias ldap_create_vlv_control = ldap_create_vlv_controlW; + alias ldap_encode_sort_control = ldap_encode_sort_controlW; + alias ldap_escape_filter_element = ldap_escape_filter_elementW; + alias ldap_first_attribute = ldap_first_attributeW; + alias ldap_next_attribute = ldap_next_attributeW; + alias ldap_get_values = ldap_get_valuesW; + alias ldap_get_values_len = ldap_get_values_lenW; + alias ldap_parse_extended_result = ldap_parse_extended_resultW; + alias ldap_parse_page_control = ldap_parse_page_controlW; + alias ldap_parse_reference = ldap_parse_referenceW; + alias ldap_parse_result = ldap_parse_resultW; + alias ldap_parse_sort_control = ldap_parse_sort_controlW; + alias ldap_parse_vlv_control = ldap_parse_vlv_controlW; + alias ldap_search = ldap_searchW; + alias ldap_search_s = ldap_search_sW; + alias ldap_search_st = ldap_search_stW; + alias ldap_search_ext = ldap_search_extW; + alias ldap_search_ext_s = ldap_search_ext_sW; + alias ldap_search_init_page = ldap_search_init_pageW; + alias ldap_err2string = ldap_err2stringW; + alias ldap_control_free = ldap_control_freeW; + alias ldap_controls_free = ldap_controls_freeW; + alias ldap_free_controls = ldap_free_controlsW; + alias ldap_memfree = ldap_memfreeW; + alias ldap_value_free = ldap_value_freeW; + alias ldap_dn2ufn = ldap_dn2ufnW; + alias ldap_ufn2dn = ldap_ufn2dnW; + alias ldap_explode_dn = ldap_explode_dnW; + alias ldap_get_dn = ldap_get_dnW; + alias ldap_rename = ldap_rename_extW; + alias ldap_rename_s = ldap_rename_ext_sW; + alias ldap_rename_ext = ldap_rename_extW; + alias ldap_rename_ext_s = ldap_rename_ext_sW; deprecated { - alias ldap_bindW ldap_bind; - alias ldap_bind_sW ldap_bind_s; - alias ldap_modrdnW ldap_modrdn; - alias ldap_modrdn_sW ldap_modrdn_s; - alias ldap_modrdn2W ldap_modrdn2; - alias ldap_modrdn2_sW ldap_modrdn2_s; + alias ldap_bind = ldap_bindW; + alias ldap_bind_s = ldap_bind_sW; + alias ldap_modrdn = ldap_modrdnW; + alias ldap_modrdn_s = ldap_modrdn_sW; + alias ldap_modrdn2 = ldap_modrdn2W; + alias ldap_modrdn2_s = ldap_modrdn2_sW; } } else { - alias LDAPControlA LDAPControl; - alias PLDAPControlA PLDAPControl; - alias LDAPModA LDAPMod; - alias LDAPModA PLDAPMod; - alias LDAPSortKeyA LDAPSortKey; - alias PLDAPSortKeyA PLDAPSortKey; - alias LDAPAPIInfoA LDAPAPIInfo; - alias PLDAPAPIInfoA PLDAPAPIInfo; - alias LDAPAPIFeatureInfoA LDAPAPIFeatureInfo; - alias PLDAPAPIFeatureInfoA PLDAPAPIFeatureInfo; - alias cldap_openA cldap_open; - alias ldap_openA ldap_open; - alias ldap_simple_bindA ldap_simple_bind; - alias ldap_simple_bind_sA ldap_simple_bind_s; - alias ldap_sasl_bindA ldap_sasl_bind; - alias ldap_sasl_bind_sA ldap_sasl_bind_s; - alias ldap_initA ldap_init; - alias ldap_sslinitA ldap_sslinit; - alias ldap_get_optionA ldap_get_option; - alias ldap_set_optionA ldap_set_option; - alias ldap_start_tls_sA ldap_start_tls_s; - alias ldap_addA ldap_add; - alias ldap_add_extA ldap_add_ext; - alias ldap_add_sA ldap_add_s; - alias ldap_add_ext_sA ldap_add_ext_s; - alias ldap_compareA ldap_compare; - alias ldap_compare_extA ldap_compare_ext; - alias ldap_compare_sA ldap_compare_s; - alias ldap_compare_ext_sA ldap_compare_ext_s; - alias ldap_deleteA ldap_delete; - alias ldap_delete_extA ldap_delete_ext; - alias ldap_delete_sA ldap_delete_s; - alias ldap_delete_ext_sA ldap_delete_ext_s; - alias ldap_extended_operation_sA ldap_extended_operation_s; - alias ldap_extended_operationA ldap_extended_operation; - alias ldap_modifyA ldap_modify; - alias ldap_modify_extA ldap_modify_ext; - alias ldap_modify_sA ldap_modify_s; - alias ldap_modify_ext_sA ldap_modify_ext_s; - alias ldap_check_filterA ldap_check_filter; - alias ldap_count_valuesA ldap_count_values; - alias ldap_create_page_controlA ldap_create_page_control; - alias ldap_create_sort_controlA ldap_create_sort_control; - alias ldap_create_vlv_controlA ldap_create_vlv_control; - alias ldap_encode_sort_controlA ldap_encode_sort_control; - alias ldap_escape_filter_elementA ldap_escape_filter_element; - alias ldap_first_attributeA ldap_first_attribute; - alias ldap_next_attributeA ldap_next_attribute; - alias ldap_get_valuesA ldap_get_values; - alias ldap_get_values_lenA ldap_get_values_len; - alias ldap_parse_extended_resultA ldap_parse_extended_result; - alias ldap_parse_page_controlA ldap_parse_page_control; - alias ldap_parse_referenceA ldap_parse_reference; - alias ldap_parse_resultA ldap_parse_result; - alias ldap_parse_sort_controlA ldap_parse_sort_control; - alias ldap_parse_vlv_controlA ldap_parse_vlv_control; - alias ldap_searchA ldap_search; - alias ldap_search_sA ldap_search_s; - alias ldap_search_stA ldap_search_st; - alias ldap_search_extA ldap_search_ext; - alias ldap_search_ext_sA ldap_search_ext_s; - alias ldap_search_init_pageA ldap_search_init_page; - alias ldap_err2stringA ldap_err2string; - alias ldap_control_freeA ldap_control_free; - alias ldap_controls_freeA ldap_controls_free; - alias ldap_free_controlsA ldap_free_controls; - alias ldap_memfreeA ldap_memfree; - alias ldap_value_freeA ldap_value_free; - alias ldap_dn2ufnA ldap_dn2ufn; - alias ldap_ufn2dnA ldap_ufn2dn; - alias ldap_explode_dnA ldap_explode_dn; - alias ldap_get_dnA ldap_get_dn; - alias ldap_rename_extA ldap_rename; - alias ldap_rename_ext_sA ldap_rename_s; - alias ldap_rename_extA ldap_rename_ext; - alias ldap_rename_ext_sA ldap_rename_ext_s; + alias LDAPControl = LDAPControlA; + alias PLDAPControl = PLDAPControlA; + alias LDAPMod = LDAPModA; + alias PLDAPMod = LDAPModA; + alias LDAPSortKey = LDAPSortKeyA; + alias PLDAPSortKey = PLDAPSortKeyA; + alias LDAPAPIInfo = LDAPAPIInfoA; + alias PLDAPAPIInfo = PLDAPAPIInfoA; + alias LDAPAPIFeatureInfo = LDAPAPIFeatureInfoA; + alias PLDAPAPIFeatureInfo = PLDAPAPIFeatureInfoA; + alias cldap_open = cldap_openA; + alias ldap_open = ldap_openA; + alias ldap_simple_bind = ldap_simple_bindA; + alias ldap_simple_bind_s = ldap_simple_bind_sA; + alias ldap_sasl_bind = ldap_sasl_bindA; + alias ldap_sasl_bind_s = ldap_sasl_bind_sA; + alias ldap_init = ldap_initA; + alias ldap_sslinit = ldap_sslinitA; + alias ldap_get_option = ldap_get_optionA; + alias ldap_set_option = ldap_set_optionA; + alias ldap_start_tls_s = ldap_start_tls_sA; + alias ldap_add = ldap_addA; + alias ldap_add_ext = ldap_add_extA; + alias ldap_add_s = ldap_add_sA; + alias ldap_add_ext_s = ldap_add_ext_sA; + alias ldap_compare = ldap_compareA; + alias ldap_compare_ext = ldap_compare_extA; + alias ldap_compare_s = ldap_compare_sA; + alias ldap_compare_ext_s = ldap_compare_ext_sA; + alias ldap_delete = ldap_deleteA; + alias ldap_delete_ext = ldap_delete_extA; + alias ldap_delete_s = ldap_delete_sA; + alias ldap_delete_ext_s = ldap_delete_ext_sA; + alias ldap_extended_operation_s = ldap_extended_operation_sA; + alias ldap_extended_operation = ldap_extended_operationA; + alias ldap_modify = ldap_modifyA; + alias ldap_modify_ext = ldap_modify_extA; + alias ldap_modify_s = ldap_modify_sA; + alias ldap_modify_ext_s = ldap_modify_ext_sA; + alias ldap_check_filter = ldap_check_filterA; + alias ldap_count_values = ldap_count_valuesA; + alias ldap_create_page_control = ldap_create_page_controlA; + alias ldap_create_sort_control = ldap_create_sort_controlA; + alias ldap_create_vlv_control = ldap_create_vlv_controlA; + alias ldap_encode_sort_control = ldap_encode_sort_controlA; + alias ldap_escape_filter_element = ldap_escape_filter_elementA; + alias ldap_first_attribute = ldap_first_attributeA; + alias ldap_next_attribute = ldap_next_attributeA; + alias ldap_get_values = ldap_get_valuesA; + alias ldap_get_values_len = ldap_get_values_lenA; + alias ldap_parse_extended_result = ldap_parse_extended_resultA; + alias ldap_parse_page_control = ldap_parse_page_controlA; + alias ldap_parse_reference = ldap_parse_referenceA; + alias ldap_parse_result = ldap_parse_resultA; + alias ldap_parse_sort_control = ldap_parse_sort_controlA; + alias ldap_parse_vlv_control = ldap_parse_vlv_controlA; + alias ldap_search = ldap_searchA; + alias ldap_search_s = ldap_search_sA; + alias ldap_search_st = ldap_search_stA; + alias ldap_search_ext = ldap_search_extA; + alias ldap_search_ext_s = ldap_search_ext_sA; + alias ldap_search_init_page = ldap_search_init_pageA; + alias ldap_err2string = ldap_err2stringA; + alias ldap_control_free = ldap_control_freeA; + alias ldap_controls_free = ldap_controls_freeA; + alias ldap_free_controls = ldap_free_controlsA; + alias ldap_memfree = ldap_memfreeA; + alias ldap_value_free = ldap_value_freeA; + alias ldap_dn2ufn = ldap_dn2ufnA; + alias ldap_ufn2dn = ldap_ufn2dnA; + alias ldap_explode_dn = ldap_explode_dnA; + alias ldap_get_dn = ldap_get_dnA; + alias ldap_rename = ldap_rename_extA; + alias ldap_rename_s = ldap_rename_ext_sA; + alias ldap_rename_ext = ldap_rename_extA; + alias ldap_rename_ext_s = ldap_rename_ext_sA; deprecated { - alias ldap_bindA ldap_bind; - alias ldap_bind_sA ldap_bind_s; - alias ldap_modrdnA ldap_modrdn; - alias ldap_modrdn_sA ldap_modrdn_s; - alias ldap_modrdn2A ldap_modrdn2; - alias ldap_modrdn2_sA ldap_modrdn2_s; + alias ldap_bind = ldap_bindA; + alias ldap_bind_s = ldap_bind_sA; + alias ldap_modrdn = ldap_modrdnA; + alias ldap_modrdn_s = ldap_modrdn_sA; + alias ldap_modrdn2 = ldap_modrdn2A; + alias ldap_modrdn2_s = ldap_modrdn2_sA; } } diff --git a/runtime/druntime/src/core/sys/windows/winnetwk.d b/runtime/druntime/src/core/sys/windows/winnetwk.d index 568c2e89e4f..e85df4c9ff0 100644 --- a/runtime/druntime/src/core/sys/windows/winnetwk.d +++ b/runtime/druntime/src/core/sys/windows/winnetwk.d @@ -209,7 +209,7 @@ struct NETRESOURCEA { LPSTR lpComment; LPSTR lpProvider; } -alias NETRESOURCEA* LPNETRESOURCEA; +alias LPNETRESOURCEA = NETRESOURCEA*; struct NETRESOURCEW { DWORD dwScope; @@ -221,7 +221,7 @@ struct NETRESOURCEW { LPWSTR lpComment ; LPWSTR lpProvider; } -alias NETRESOURCEW* LPNETRESOURCEW; +alias LPNETRESOURCEW = NETRESOURCEW*; struct CONNECTDLGSTRUCTA { DWORD cbStructure; @@ -230,7 +230,7 @@ struct CONNECTDLGSTRUCTA { DWORD dwFlags; DWORD dwDevNum; } -alias CONNECTDLGSTRUCTA* LPCONNECTDLGSTRUCTA; +alias LPCONNECTDLGSTRUCTA = CONNECTDLGSTRUCTA*; struct CONNECTDLGSTRUCTW { DWORD cbStructure; @@ -239,7 +239,7 @@ struct CONNECTDLGSTRUCTW { DWORD dwFlags; DWORD dwDevNum; } -alias CONNECTDLGSTRUCTW* LPCONNECTDLGSTRUCTW; +alias LPCONNECTDLGSTRUCTW = CONNECTDLGSTRUCTW*; struct DISCDLGSTRUCTA { DWORD cbStructure; @@ -248,7 +248,7 @@ struct DISCDLGSTRUCTA { LPSTR lpRemoteName; DWORD dwFlags; } -alias DISCDLGSTRUCTA* LPDISCDLGSTRUCTA; +alias LPDISCDLGSTRUCTA = DISCDLGSTRUCTA*; struct DISCDLGSTRUCTW { DWORD cbStructure; @@ -257,31 +257,31 @@ struct DISCDLGSTRUCTW { LPWSTR lpRemoteName; DWORD dwFlags; } -alias DISCDLGSTRUCTW* LPDISCDLGSTRUCTW; +alias LPDISCDLGSTRUCTW = DISCDLGSTRUCTW*; struct UNIVERSAL_NAME_INFOA { LPSTR lpUniversalName; } -alias UNIVERSAL_NAME_INFOA* LPUNIVERSAL_NAME_INFOA; +alias LPUNIVERSAL_NAME_INFOA = UNIVERSAL_NAME_INFOA*; struct UNIVERSAL_NAME_INFOW { LPWSTR lpUniversalName; } -alias UNIVERSAL_NAME_INFOW* LPUNIVERSAL_NAME_INFOW; +alias LPUNIVERSAL_NAME_INFOW = UNIVERSAL_NAME_INFOW*; struct REMOTE_NAME_INFOA { LPSTR lpUniversalName; LPSTR lpConnectionName; LPSTR lpRemainingPath; } -alias REMOTE_NAME_INFOA* LPREMOTE_NAME_INFOA; +alias LPREMOTE_NAME_INFOA = REMOTE_NAME_INFOA*; struct REMOTE_NAME_INFOW { LPWSTR lpUniversalName; LPWSTR lpConnectionName; LPWSTR lpRemainingPath; } -alias REMOTE_NAME_INFOW* LPREMOTE_NAME_INFOW; +alias LPREMOTE_NAME_INFOW = REMOTE_NAME_INFOW*; struct NETINFOSTRUCT { DWORD cbStructure; @@ -293,17 +293,15 @@ struct NETINFOSTRUCT { DWORD dwPrinters; DWORD dwDrives; } -alias NETINFOSTRUCT* LPNETINFOSTRUCT; +alias LPNETINFOSTRUCT = NETINFOSTRUCT*; extern (Windows) { - alias UINT function(LPCSTR, LPSTR, UINT) PFNGETPROFILEPATHA; - alias UINT function(LPCWSTR, LPWSTR, UINT) PFNGETPROFILEPATHW; - alias UINT function(LPCSTR, LPCSTR, DWORD) PFNRECONCILEPROFILEA; - alias UINT function(LPCWSTR, LPCWSTR, DWORD) PFNRECONCILEPROFILEW; - alias BOOL function(HWND, LPCSTR, LPCSTR, LPCSTR, DWORD) - PFNPROCESSPOLICIESA; - alias BOOL function(HWND, LPCWSTR, LPCWSTR, LPCWSTR, DWORD) - PFNPROCESSPOLICIESW; + alias PFNGETPROFILEPATHA = UINT function(LPCSTR, LPSTR, UINT); + alias PFNGETPROFILEPATHW = UINT function(LPCWSTR, LPWSTR, UINT); + alias PFNRECONCILEPROFILEA = UINT function(LPCSTR, LPCSTR, DWORD); + alias PFNRECONCILEPROFILEW = UINT function(LPCWSTR, LPCWSTR, DWORD); + alias PFNPROCESSPOLICIESA = BOOL function(HWND, LPCSTR, LPCSTR, LPCSTR, DWORD); + alias PFNPROCESSPOLICIESW = BOOL function(HWND, LPCWSTR, LPCWSTR, LPCWSTR, DWORD); } struct NETCONNECTINFOSTRUCT { @@ -313,7 +311,7 @@ struct NETCONNECTINFOSTRUCT { DWORD dwDelay; DWORD dwOptDataSize; } -alias NETCONNECTINFOSTRUCT* LPNETCONNECTINFOSTRUCT; +alias LPNETCONNECTINFOSTRUCT = NETCONNECTINFOSTRUCT*; extern (Windows) nothrow @nogc { DWORD WNetAddConnection2A(LPNETRESOURCEA, LPCSTR, LPCSTR, DWORD); @@ -370,71 +368,71 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias PFNGETPROFILEPATHW PFNGETPROFILEPATH; - alias PFNRECONCILEPROFILEW PFNRECONCILEPROFILE; - alias PFNPROCESSPOLICIESW PFNPROCESSPOLICIES; - alias NETRESOURCEW NETRESOURCE; - alias CONNECTDLGSTRUCTW CONNECTDLGSTRUCT; - alias DISCDLGSTRUCTW DISCDLGSTRUCT; - alias REMOTE_NAME_INFOW REMOTE_NAME_INFO; - alias UNIVERSAL_NAME_INFOW UNIVERSAL_NAME_INFO; - alias WNetAddConnection2W WNetAddConnection2; - alias WNetAddConnection3W WNetAddConnection3; - alias WNetCancelConnection2W WNetCancelConnection2; - alias WNetGetConnectionW WNetGetConnection; - alias WNetUseConnectionW WNetUseConnection; - alias WNetSetConnectionW WNetSetConnection; - alias WNetConnectionDialog1W WNetConnectionDialog1; - alias WNetDisconnectDialog1W WNetDisconnectDialog1; - alias WNetOpenEnumW WNetOpenEnum; - alias WNetEnumResourceW WNetEnumResource; - alias WNetGetUniversalNameW WNetGetUniversalName; - alias WNetGetUserW WNetGetUser; - alias WNetGetProviderNameW WNetGetProviderName; - alias WNetGetNetworkInformationW WNetGetNetworkInformation; - alias WNetGetResourceInformationW WNetGetResourceInformation; - alias WNetGetResourceParentW WNetGetResourceParent; - alias WNetGetLastErrorW WNetGetLastError; - alias MultinetGetConnectionPerformanceW MultinetGetConnectionPerformance; + alias PFNGETPROFILEPATH = PFNGETPROFILEPATHW; + alias PFNRECONCILEPROFILE = PFNRECONCILEPROFILEW; + alias PFNPROCESSPOLICIES = PFNPROCESSPOLICIESW; + alias NETRESOURCE = NETRESOURCEW; + alias CONNECTDLGSTRUCT = CONNECTDLGSTRUCTW; + alias DISCDLGSTRUCT = DISCDLGSTRUCTW; + alias REMOTE_NAME_INFO = REMOTE_NAME_INFOW; + alias UNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFOW; + alias WNetAddConnection2 = WNetAddConnection2W; + alias WNetAddConnection3 = WNetAddConnection3W; + alias WNetCancelConnection2 = WNetCancelConnection2W; + alias WNetGetConnection = WNetGetConnectionW; + alias WNetUseConnection = WNetUseConnectionW; + alias WNetSetConnection = WNetSetConnectionW; + alias WNetConnectionDialog1 = WNetConnectionDialog1W; + alias WNetDisconnectDialog1 = WNetDisconnectDialog1W; + alias WNetOpenEnum = WNetOpenEnumW; + alias WNetEnumResource = WNetEnumResourceW; + alias WNetGetUniversalName = WNetGetUniversalNameW; + alias WNetGetUser = WNetGetUserW; + alias WNetGetProviderName = WNetGetProviderNameW; + alias WNetGetNetworkInformation = WNetGetNetworkInformationW; + alias WNetGetResourceInformation = WNetGetResourceInformationW; + alias WNetGetResourceParent = WNetGetResourceParentW; + alias WNetGetLastError = WNetGetLastErrorW; + alias MultinetGetConnectionPerformance = MultinetGetConnectionPerformanceW; deprecated { - alias WNetAddConnectionW WNetAddConnection; - alias WNetCancelConnectionW WNetCancelConnection; + alias WNetAddConnection = WNetAddConnectionW; + alias WNetCancelConnection = WNetCancelConnectionW; } } else { - alias PFNGETPROFILEPATHA PFNGETPROFILEPATH; - alias PFNRECONCILEPROFILEA PFNRECONCILEPROFILE; - alias PFNPROCESSPOLICIESA PFNPROCESSPOLICIES; - alias NETRESOURCEA NETRESOURCE; - alias CONNECTDLGSTRUCTA CONNECTDLGSTRUCT; - alias DISCDLGSTRUCTA DISCDLGSTRUCT; - alias REMOTE_NAME_INFOA REMOTE_NAME_INFO; - alias UNIVERSAL_NAME_INFOA UNIVERSAL_NAME_INFO; - alias WNetAddConnection2A WNetAddConnection2; - alias WNetAddConnection3A WNetAddConnection3; - alias WNetCancelConnection2A WNetCancelConnection2; - alias WNetGetConnectionA WNetGetConnection; - alias WNetUseConnectionA WNetUseConnection; - alias WNetSetConnectionA WNetSetConnection; - alias WNetConnectionDialog1A WNetConnectionDialog1; - alias WNetDisconnectDialog1A WNetDisconnectDialog1; - alias WNetOpenEnumA WNetOpenEnum; - alias WNetEnumResourceA WNetEnumResource; - alias WNetGetUniversalNameA WNetGetUniversalName; - alias WNetGetUserA WNetGetUser; - alias WNetGetProviderNameA WNetGetProviderName; - alias WNetGetNetworkInformationA WNetGetNetworkInformation; - alias WNetGetResourceInformationA WNetGetResourceInformation; - alias WNetGetResourceParentA WNetGetResourceParent; - alias WNetGetLastErrorA WNetGetLastError; - alias MultinetGetConnectionPerformanceA MultinetGetConnectionPerformance; + alias PFNGETPROFILEPATH = PFNGETPROFILEPATHA; + alias PFNRECONCILEPROFILE = PFNRECONCILEPROFILEA; + alias PFNPROCESSPOLICIES = PFNPROCESSPOLICIESA; + alias NETRESOURCE = NETRESOURCEA; + alias CONNECTDLGSTRUCT = CONNECTDLGSTRUCTA; + alias DISCDLGSTRUCT = DISCDLGSTRUCTA; + alias REMOTE_NAME_INFO = REMOTE_NAME_INFOA; + alias UNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFOA; + alias WNetAddConnection2 = WNetAddConnection2A; + alias WNetAddConnection3 = WNetAddConnection3A; + alias WNetCancelConnection2 = WNetCancelConnection2A; + alias WNetGetConnection = WNetGetConnectionA; + alias WNetUseConnection = WNetUseConnectionA; + alias WNetSetConnection = WNetSetConnectionA; + alias WNetConnectionDialog1 = WNetConnectionDialog1A; + alias WNetDisconnectDialog1 = WNetDisconnectDialog1A; + alias WNetOpenEnum = WNetOpenEnumA; + alias WNetEnumResource = WNetEnumResourceA; + alias WNetGetUniversalName = WNetGetUniversalNameA; + alias WNetGetUser = WNetGetUserA; + alias WNetGetProviderName = WNetGetProviderNameA; + alias WNetGetNetworkInformation = WNetGetNetworkInformationA; + alias WNetGetResourceInformation = WNetGetResourceInformationA; + alias WNetGetResourceParent = WNetGetResourceParentA; + alias WNetGetLastError = WNetGetLastErrorA; + alias MultinetGetConnectionPerformance = MultinetGetConnectionPerformanceA; deprecated { - alias WNetAddConnectionA WNetAddConnection; - alias WNetCancelConnectionA WNetCancelConnection; + alias WNetAddConnection = WNetAddConnectionA; + alias WNetCancelConnection = WNetCancelConnectionA; } } -alias NETRESOURCE* LPNETRESOURCE; -alias CONNECTDLGSTRUCT* LPCONNECTDLGSTRUCT; -alias DISCDLGSTRUCT* LPDISCDLGSTRUCT; -alias REMOTE_NAME_INFO* LPREMOTE_NAME_INFO; -alias UNIVERSAL_NAME_INFO* LPUNIVERSAL_NAME_INFO; +alias LPNETRESOURCE = NETRESOURCE*; +alias LPCONNECTDLGSTRUCT = CONNECTDLGSTRUCT*; +alias LPDISCDLGSTRUCT = DISCDLGSTRUCT*; +alias LPREMOTE_NAME_INFO = REMOTE_NAME_INFO*; +alias LPUNIVERSAL_NAME_INFO = UNIVERSAL_NAME_INFO*; diff --git a/runtime/druntime/src/core/sys/windows/winnls.d b/runtime/druntime/src/core/sys/windows/winnls.d index f2b5409102b..f55ce4f9069 100644 --- a/runtime/druntime/src/core/sys/windows/winnls.d +++ b/runtime/druntime/src/core/sys/windows/winnls.d @@ -15,7 +15,7 @@ pragma(lib, "kernel32"); import core.sys.windows.basetsd, core.sys.windows.w32api, core.sys.windows.winbase, core.sys.windows.windef; -alias DWORD LCTYPE, CALTYPE, CALID, LGRPID, GEOID, GEOTYPE, GEOCLASS; +alias LCTYPE = DWORD, CALTYPE = DWORD, CALID = DWORD, LGRPID = DWORD, GEOID = DWORD, GEOTYPE = DWORD, GEOCLASS = DWORD; enum size_t MAX_DEFAULTCHAR = 2, @@ -496,31 +496,27 @@ enum DWORD WC_NO_BEST_FIT_CHARS = 1024; } // (_WIN32_WINNT >= 0x500) extern (Windows) { - alias BOOL function(LPSTR) CALINFO_ENUMPROCA; - alias BOOL function(LPWSTR) CALINFO_ENUMPROCW; - alias BOOL function(LPSTR, CALID) CALINFO_ENUMPROCEXA; - alias BOOL function(LPWSTR, CALID) CALINFO_ENUMPROCEXW; - alias BOOL function(LGRPID, LPSTR, LPSTR, DWORD, LONG_PTR) - LANGUAGEGROUP_ENUMPROCA; - alias BOOL function(LGRPID, LPWSTR, LPWSTR, DWORD, LONG_PTR) - LANGUAGEGROUP_ENUMPROCW; - alias BOOL function(LGRPID, LCID, LPSTR, LONG_PTR) - LANGGROUPLOCALE_ENUMPROCA; - alias BOOL function(LGRPID, LCID, LPWSTR, LONG_PTR) - LANGGROUPLOCALE_ENUMPROCW; - alias BOOL function(LPWSTR, LONG_PTR) UILANGUAGE_ENUMPROCW; - alias BOOL function(LPSTR, LONG_PTR) UILANGUAGE_ENUMPROCA; - alias BOOL function(LPSTR) LOCALE_ENUMPROCA; - alias BOOL function(LPWSTR) LOCALE_ENUMPROCW; - alias BOOL function(LPSTR) CODEPAGE_ENUMPROCA; - alias BOOL function(LPWSTR) CODEPAGE_ENUMPROCW; - alias BOOL function(LPSTR) DATEFMT_ENUMPROCA; - alias BOOL function(LPWSTR) DATEFMT_ENUMPROCW; - alias BOOL function(LPSTR, CALID) DATEFMT_ENUMPROCEXA; - alias BOOL function(LPWSTR, CALID) DATEFMT_ENUMPROCEXW; - alias BOOL function(LPSTR) TIMEFMT_ENUMPROCA; - alias BOOL function(LPWSTR) TIMEFMT_ENUMPROCW; - alias BOOL function(GEOID) GEO_ENUMPROC; + alias CALINFO_ENUMPROCA = BOOL function(LPSTR); + alias CALINFO_ENUMPROCW = BOOL function(LPWSTR); + alias CALINFO_ENUMPROCEXA = BOOL function(LPSTR, CALID); + alias CALINFO_ENUMPROCEXW = BOOL function(LPWSTR, CALID); + alias LANGUAGEGROUP_ENUMPROCA = BOOL function(LGRPID, LPSTR, LPSTR, DWORD, LONG_PTR); + alias LANGUAGEGROUP_ENUMPROCW = BOOL function(LGRPID, LPWSTR, LPWSTR, DWORD, LONG_PTR); + alias LANGGROUPLOCALE_ENUMPROCA = BOOL function(LGRPID, LCID, LPSTR, LONG_PTR); + alias LANGGROUPLOCALE_ENUMPROCW = BOOL function(LGRPID, LCID, LPWSTR, LONG_PTR); + alias UILANGUAGE_ENUMPROCW = BOOL function(LPWSTR, LONG_PTR); + alias UILANGUAGE_ENUMPROCA = BOOL function(LPSTR, LONG_PTR); + alias LOCALE_ENUMPROCA = BOOL function(LPSTR); + alias LOCALE_ENUMPROCW = BOOL function(LPWSTR); + alias CODEPAGE_ENUMPROCA = BOOL function(LPSTR); + alias CODEPAGE_ENUMPROCW = BOOL function(LPWSTR); + alias DATEFMT_ENUMPROCA = BOOL function(LPSTR); + alias DATEFMT_ENUMPROCW = BOOL function(LPWSTR); + alias DATEFMT_ENUMPROCEXA = BOOL function(LPSTR, CALID); + alias DATEFMT_ENUMPROCEXW = BOOL function(LPWSTR, CALID); + alias TIMEFMT_ENUMPROCA = BOOL function(LPSTR); + alias TIMEFMT_ENUMPROCW = BOOL function(LPWSTR); + alias GEO_ENUMPROC = BOOL function(GEOID); } enum NLS_FUNCTION { @@ -551,7 +547,7 @@ struct CPINFO { BYTE[MAX_DEFAULTCHAR] DefaultChar; BYTE[MAX_LEADBYTES] LeadByte; } -alias CPINFO* LPCPINFO; +alias LPCPINFO = CPINFO*; struct CPINFOEXA { UINT MaxCharSize; @@ -561,7 +557,7 @@ struct CPINFOEXA { UINT CodePage; CHAR[MAX_PATH] CodePageName = 0; } -alias CPINFOEXA* LPCPINFOEXA; +alias LPCPINFOEXA = CPINFOEXA*; struct CPINFOEXW { UINT MaxCharSize; @@ -571,7 +567,7 @@ struct CPINFOEXW { UINT CodePage; WCHAR[MAX_PATH] CodePageName = 0; } -alias CPINFOEXW* LPCPINFOEXW; +alias LPCPINFOEXW = CPINFOEXW*; struct CURRENCYFMTA { UINT NumDigits; @@ -583,7 +579,7 @@ struct CURRENCYFMTA { UINT PositiveOrder; LPSTR lpCurrencySymbol; } -alias CURRENCYFMTA* LPCURRENCYFMTA; +alias LPCURRENCYFMTA = CURRENCYFMTA*; struct CURRENCYFMTW { UINT NumDigits; @@ -595,14 +591,14 @@ struct CURRENCYFMTW { UINT PositiveOrder; LPWSTR lpCurrencySymbol; } -alias CURRENCYFMTW* LPCURRENCYFMTW; +alias LPCURRENCYFMTW = CURRENCYFMTW*; struct NLSVERSIONINFO { DWORD dwNLSVersionInfoSize; DWORD dwNLSVersion; DWORD dwDefinedVersion; } -alias NLSVERSIONINFO* LPNLSVERSIONINFO; +alias LPNLSVERSIONINFO = NLSVERSIONINFO*; struct NUMBERFMTA { UINT NumDigits; @@ -612,7 +608,7 @@ struct NUMBERFMTA { LPSTR lpThousandSep; UINT NegativeOrder; } -alias NUMBERFMTA* LPNUMBERFMTA; +alias LPNUMBERFMTA = NUMBERFMTA*; struct NUMBERFMTW { UINT NumDigits; @@ -622,7 +618,7 @@ struct NUMBERFMTW { LPWSTR lpThousandSep; UINT NegativeOrder; } -alias NUMBERFMTW* LPNUMBERFMTW; +alias LPNUMBERFMTW = NUMBERFMTW*; extern (Windows) nothrow @nogc { int CompareStringA(LCID, DWORD, LPCSTR, int, LPCSTR, int); @@ -716,96 +712,96 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias CALINFO_ENUMPROCW CALINFO_ENUMPROC; - alias CALINFO_ENUMPROCEXW CALINFO_ENUMPROCEX; - alias LOCALE_ENUMPROCW LOCALE_ENUMPROC; - alias CODEPAGE_ENUMPROCW CODEPAGE_ENUMPROC; - alias DATEFMT_ENUMPROCW DATEFMT_ENUMPROC; - alias DATEFMT_ENUMPROCEXW DATEFMT_ENUMPROCEX; - alias TIMEFMT_ENUMPROCW TIMEFMT_ENUMPROC; - alias LANGUAGEGROUP_ENUMPROCW LANGUAGEGROUP_ENUMPROC; - alias LANGGROUPLOCALE_ENUMPROCW LANGGROUPLOCALE_ENUMPROC; - alias UILANGUAGE_ENUMPROCW UILANGUAGE_ENUMPROC; - alias CPINFOEXW CPINFOEX; - alias LPCPINFOEXW LPCPINFOEX; - alias CURRENCYFMTW CURRENCYFMT; - alias LPCURRENCYFMTW LPCURRENCYFMT; - alias NUMBERFMTW NUMBERFMT; - alias LPNUMBERFMTW LPNUMBERFMT; - alias CompareStringW CompareString; - alias EnumCalendarInfoW EnumCalendarInfo; - alias EnumSystemCodePagesW EnumSystemCodePages; - alias EnumSystemLocalesW EnumSystemLocales; - alias EnumTimeFormatsW EnumTimeFormats; - alias FoldStringW FoldString; - alias GetCalendarInfoW GetCalendarInfo; - alias GetCPInfoExW GetCPInfoEx; - alias GetCurrencyFormatW GetCurrencyFormat; - alias GetDateFormatW GetDateFormat; - alias GetGeoInfoW GetGeoInfo; - alias GetLocaleInfoW GetLocaleInfo; - alias GetNumberFormatW GetNumberFormat; - alias GetStringTypeExW GetStringTypeEx; - alias GetTimeFormatW GetTimeFormat; - alias LCMapStringW LCMapString; - alias SetCalendarInfoW SetCalendarInfo; - alias SetLocaleInfoW SetLocaleInfo; + alias CALINFO_ENUMPROC = CALINFO_ENUMPROCW; + alias CALINFO_ENUMPROCEX = CALINFO_ENUMPROCEXW; + alias LOCALE_ENUMPROC = LOCALE_ENUMPROCW; + alias CODEPAGE_ENUMPROC = CODEPAGE_ENUMPROCW; + alias DATEFMT_ENUMPROC = DATEFMT_ENUMPROCW; + alias DATEFMT_ENUMPROCEX = DATEFMT_ENUMPROCEXW; + alias TIMEFMT_ENUMPROC = TIMEFMT_ENUMPROCW; + alias LANGUAGEGROUP_ENUMPROC = LANGUAGEGROUP_ENUMPROCW; + alias LANGGROUPLOCALE_ENUMPROC = LANGGROUPLOCALE_ENUMPROCW; + alias UILANGUAGE_ENUMPROC = UILANGUAGE_ENUMPROCW; + alias CPINFOEX = CPINFOEXW; + alias LPCPINFOEX = LPCPINFOEXW; + alias CURRENCYFMT = CURRENCYFMTW; + alias LPCURRENCYFMT = LPCURRENCYFMTW; + alias NUMBERFMT = NUMBERFMTW; + alias LPNUMBERFMT = LPNUMBERFMTW; + alias CompareString = CompareStringW; + alias EnumCalendarInfo = EnumCalendarInfoW; + alias EnumSystemCodePages = EnumSystemCodePagesW; + alias EnumSystemLocales = EnumSystemLocalesW; + alias EnumTimeFormats = EnumTimeFormatsW; + alias FoldString = FoldStringW; + alias GetCalendarInfo = GetCalendarInfoW; + alias GetCPInfoEx = GetCPInfoExW; + alias GetCurrencyFormat = GetCurrencyFormatW; + alias GetDateFormat = GetDateFormatW; + alias GetGeoInfo = GetGeoInfoW; + alias GetLocaleInfo = GetLocaleInfoW; + alias GetNumberFormat = GetNumberFormatW; + alias GetStringTypeEx = GetStringTypeExW; + alias GetTimeFormat = GetTimeFormatW; + alias LCMapString = LCMapStringW; + alias SetCalendarInfo = SetCalendarInfoW; + alias SetLocaleInfo = SetLocaleInfoW; static if (_WIN32_WINNT >= 0x410) { - alias EnumCalendarInfoExW EnumCalendarInfoEx; - alias EnumDateFormatsExW EnumDateFormatsEx; + alias EnumCalendarInfoEx = EnumCalendarInfoExW; + alias EnumDateFormatsEx = EnumDateFormatsExW; } static if (_WIN32_WINNT >= 0x500) { - alias EnumSystemLanguageGroupsW EnumSystemLanguageGroups; - alias EnumLanguageGroupLocalesW EnumLanguageGroupLocales; - alias EnumUILanguagesW EnumUILanguages; + alias EnumSystemLanguageGroups = EnumSystemLanguageGroupsW; + alias EnumLanguageGroupLocales = EnumLanguageGroupLocalesW; + alias EnumUILanguages = EnumUILanguagesW; } } else { - alias CALINFO_ENUMPROCA CALINFO_ENUMPROC; - alias CALINFO_ENUMPROCEXA CALINFO_ENUMPROCEX; - alias LOCALE_ENUMPROCA LOCALE_ENUMPROC; - alias CODEPAGE_ENUMPROCA CODEPAGE_ENUMPROC; - alias DATEFMT_ENUMPROCA DATEFMT_ENUMPROC; - alias DATEFMT_ENUMPROCEXA DATEFMT_ENUMPROCEX; - alias TIMEFMT_ENUMPROCA TIMEFMT_ENUMPROC; - alias LANGUAGEGROUP_ENUMPROCA LANGUAGEGROUP_ENUMPROC; - alias LANGGROUPLOCALE_ENUMPROCA LANGGROUPLOCALE_ENUMPROC; - alias UILANGUAGE_ENUMPROCA UILANGUAGE_ENUMPROC; - alias CPINFOEXA CPINFOEX; - alias LPCPINFOEXA LPCPINFOEX; - alias CURRENCYFMTA CURRENCYFMT; - alias LPCURRENCYFMTA LPCURRENCYFMT; - alias NUMBERFMTA NUMBERFMT; - alias LPNUMBERFMTA LPNUMBERFMT; - alias CompareStringA CompareString; - alias EnumCalendarInfoA EnumCalendarInfo; - alias EnumSystemCodePagesA EnumSystemCodePages; - alias EnumSystemLocalesA EnumSystemLocales; - alias EnumTimeFormatsA EnumTimeFormats; - alias FoldStringA FoldString; - alias GetCalendarInfoA GetCalendarInfo; - alias GetCPInfoExA GetCPInfoEx; - alias GetCurrencyFormatA GetCurrencyFormat; - alias GetDateFormatA GetDateFormat; - alias GetGeoInfoA GetGeoInfo; - alias GetLocaleInfoA GetLocaleInfo; - alias GetNumberFormatA GetNumberFormat; - alias GetStringTypeExA GetStringTypeEx; - alias GetTimeFormatA GetTimeFormat; - alias LCMapStringA LCMapString; - alias SetCalendarInfoA SetCalendarInfo; - alias SetLocaleInfoA SetLocaleInfo; + alias CALINFO_ENUMPROC = CALINFO_ENUMPROCA; + alias CALINFO_ENUMPROCEX = CALINFO_ENUMPROCEXA; + alias LOCALE_ENUMPROC = LOCALE_ENUMPROCA; + alias CODEPAGE_ENUMPROC = CODEPAGE_ENUMPROCA; + alias DATEFMT_ENUMPROC = DATEFMT_ENUMPROCA; + alias DATEFMT_ENUMPROCEX = DATEFMT_ENUMPROCEXA; + alias TIMEFMT_ENUMPROC = TIMEFMT_ENUMPROCA; + alias LANGUAGEGROUP_ENUMPROC = LANGUAGEGROUP_ENUMPROCA; + alias LANGGROUPLOCALE_ENUMPROC = LANGGROUPLOCALE_ENUMPROCA; + alias UILANGUAGE_ENUMPROC = UILANGUAGE_ENUMPROCA; + alias CPINFOEX = CPINFOEXA; + alias LPCPINFOEX = LPCPINFOEXA; + alias CURRENCYFMT = CURRENCYFMTA; + alias LPCURRENCYFMT = LPCURRENCYFMTA; + alias NUMBERFMT = NUMBERFMTA; + alias LPNUMBERFMT = LPNUMBERFMTA; + alias CompareString = CompareStringA; + alias EnumCalendarInfo = EnumCalendarInfoA; + alias EnumSystemCodePages = EnumSystemCodePagesA; + alias EnumSystemLocales = EnumSystemLocalesA; + alias EnumTimeFormats = EnumTimeFormatsA; + alias FoldString = FoldStringA; + alias GetCalendarInfo = GetCalendarInfoA; + alias GetCPInfoEx = GetCPInfoExA; + alias GetCurrencyFormat = GetCurrencyFormatA; + alias GetDateFormat = GetDateFormatA; + alias GetGeoInfo = GetGeoInfoA; + alias GetLocaleInfo = GetLocaleInfoA; + alias GetNumberFormat = GetNumberFormatA; + alias GetStringTypeEx = GetStringTypeExA; + alias GetTimeFormat = GetTimeFormatA; + alias LCMapString = LCMapStringA; + alias SetCalendarInfo = SetCalendarInfoA; + alias SetLocaleInfo = SetLocaleInfoA; static if (_WIN32_WINNT >= 0x410) { - alias EnumCalendarInfoExA EnumCalendarInfoEx; - alias EnumDateFormatsExA EnumDateFormatsEx; + alias EnumCalendarInfoEx = EnumCalendarInfoExA; + alias EnumDateFormatsEx = EnumDateFormatsExA; } static if (_WIN32_WINNT >= 0x500) { - alias EnumSystemLanguageGroupsA EnumSystemLanguageGroups; - alias EnumLanguageGroupLocalesA EnumLanguageGroupLocales; - alias EnumUILanguagesA EnumUILanguages; + alias EnumSystemLanguageGroups = EnumSystemLanguageGroupsA; + alias EnumLanguageGroupLocales = EnumLanguageGroupLocalesA; + alias EnumUILanguages = EnumUILanguagesA; } } diff --git a/runtime/druntime/src/core/sys/windows/winnt.d b/runtime/druntime/src/core/sys/windows/winnt.d index f93ae1e36b6..6c6b000df21 100644 --- a/runtime/druntime/src/core/sys/windows/winnt.d +++ b/runtime/druntime/src/core/sys/windows/winnt.d @@ -19,48 +19,48 @@ The following macros are unneeded for D: FIELD_OFFSET(t,f), CONTAINING_RECORD(address, type, field) */ -alias void VOID; -alias char CHAR, CCHAR; -alias wchar WCHAR; -alias bool BOOLEAN; -alias byte FCHAR; -alias ubyte UCHAR; -alias short SHORT; -alias ushort LANGID, FSHORT; -alias uint LCID, FLONG, ACCESS_MASK; -alias long LONGLONG, USN; -alias ulong DWORDLONG, ULONGLONG; - -alias void* PVOID, LPVOID; -alias char* PSZ, PCHAR, PCCHAR, LPCH, PCH, LPSTR, PSTR; -alias wchar* PWCHAR, LPWCH, PWCH, LPWSTR, PWSTR; -alias bool* PBOOLEAN; -alias ubyte* PUCHAR; -alias short* PSHORT; -alias int* PLONG; -alias uint* PLCID, PACCESS_MASK; -alias long* PLONGLONG; -alias ulong* PDWORDLONG, PULONGLONG; +alias VOID = void; +alias CHAR = char, CCHAR = char; +alias WCHAR = wchar; +alias BOOLEAN = bool; +alias FCHAR = byte; +alias UCHAR = ubyte; +alias SHORT = short; +alias LANGID = ushort, FSHORT = ushort; +alias LCID = uint, FLONG = uint, ACCESS_MASK = uint; +alias LONGLONG = long, USN = long; +alias DWORDLONG = ulong, ULONGLONG = ulong; + +alias PVOID = void*, LPVOID = void*; +alias PSZ = char*, PCHAR = char*, PCCHAR = char*, LPCH = char*, PCH = char*, LPSTR = char*, PSTR = char*; +alias PWCHAR = wchar*, LPWCH = wchar*, PWCH = wchar*, LPWSTR = wchar*, PWSTR = wchar*; +alias PBOOLEAN = bool*; +alias PUCHAR = ubyte*; +alias PSHORT = short*; +alias PLONG = int*; +alias PLCID = uint*, PACCESS_MASK = uint*; +alias PLONGLONG = long*; +alias PDWORDLONG = ulong*, PULONGLONG = ulong*; // FIXME(MinGW) for __WIN64 -alias void* PVOID64; +alias PVOID64 = void*; // const versions -alias const(char)* PCCH, LPCCH, PCSTR, LPCSTR; -alias const(wchar)* LPCWCH, PCWCH, LPCWSTR, PCWSTR; +alias PCCH = const(char)*, LPCCH = const(char)*, PCSTR = const(char)*, LPCSTR = const(char)*; +alias LPCWCH = const(wchar)*, PCWCH = const(wchar)*, LPCWSTR = const(wchar)*, PCWSTR = const(wchar)*; -alias PSTR* PZPSTR; -alias PWSTR* PZPWSTR; +alias PZPSTR = PSTR*; +alias PZPWSTR = PWSTR*; version (Unicode) { - alias WCHAR TCHAR, _TCHAR; + alias TCHAR = WCHAR, _TCHAR = WCHAR; } else { - alias CHAR TCHAR, _TCHAR; + alias TCHAR = CHAR, _TCHAR = CHAR; } -alias TCHAR TBYTE; -alias TCHAR* PTCH , PTBYTE, LPTCH , PTSTR , LPTSTR , LP, PTCHAR; -alias const(TCHAR)* PCTCH, LPCTCH, PCTSTR, LPCTSTR ; +alias TBYTE = TCHAR; +alias PTCH = TCHAR*, PTBYTE = TCHAR*, LPTCH = TCHAR*, PTSTR = TCHAR*, LPTSTR = TCHAR*, LP = TCHAR*, PTCHAR = TCHAR*; +alias PCTCH = const(TCHAR)*, LPCTCH = const(TCHAR)*, PCTSTR = const(TCHAR)*, LPCTSTR = const(TCHAR)*; enum char ANSI_NULL = '\0'; enum wchar UNICODE_NULL = '\0'; @@ -1670,10 +1670,10 @@ enum SECURITY_IMPERSONATION_LEVEL { SecurityImpersonation, SecurityDelegation } -alias SECURITY_IMPERSONATION_LEVEL* PSECURITY_IMPERSONATION_LEVEL; +alias PSECURITY_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL*; -alias BOOLEAN SECURITY_CONTEXT_TRACKING_MODE; -alias BOOLEAN* PSECURITY_CONTEXT_TRACKING_MODE; +alias SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN; +alias PSECURITY_CONTEXT_TRACKING_MODE = BOOLEAN*; enum size_t SECURITY_DESCRIPTOR_MIN_LENGTH = 20; @@ -1979,42 +1979,42 @@ struct GENERIC_MAPPING { ACCESS_MASK GenericExecute; ACCESS_MASK GenericAll; } -alias GENERIC_MAPPING* PGENERIC_MAPPING; +alias PGENERIC_MAPPING = GENERIC_MAPPING*; struct ACE_HEADER { BYTE AceType; BYTE AceFlags; WORD AceSize; } -alias ACE_HEADER* PACE_HEADER; +alias PACE_HEADER = ACE_HEADER*; struct ACCESS_ALLOWED_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } -alias ACCESS_ALLOWED_ACE* PACCESS_ALLOWED_ACE; +alias PACCESS_ALLOWED_ACE = ACCESS_ALLOWED_ACE*; struct ACCESS_DENIED_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } -alias ACCESS_DENIED_ACE* PACCESS_DENIED_ACE; +alias PACCESS_DENIED_ACE = ACCESS_DENIED_ACE*; struct SYSTEM_AUDIT_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } -alias SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; +alias PSYSTEM_AUDIT_ACE = SYSTEM_AUDIT_ACE *; struct SYSTEM_ALARM_ACE { ACE_HEADER Header; ACCESS_MASK Mask; DWORD SidStart; } -alias SYSTEM_ALARM_ACE* PSYSTEM_ALARM_ACE; +alias PSYSTEM_ALARM_ACE = SYSTEM_ALARM_ACE*; struct ACCESS_ALLOWED_OBJECT_ACE { ACE_HEADER Header; @@ -2024,7 +2024,7 @@ struct ACCESS_ALLOWED_OBJECT_ACE { GUID InheritedObjectType; DWORD SidStart; } -alias ACCESS_ALLOWED_OBJECT_ACE* PACCESS_ALLOWED_OBJECT_ACE; +alias PACCESS_ALLOWED_OBJECT_ACE = ACCESS_ALLOWED_OBJECT_ACE*; struct ACCESS_DENIED_OBJECT_ACE { ACE_HEADER Header; @@ -2034,7 +2034,7 @@ struct ACCESS_DENIED_OBJECT_ACE { GUID InheritedObjectType; DWORD SidStart; } -alias ACCESS_DENIED_OBJECT_ACE* PACCESS_DENIED_OBJECT_ACE; +alias PACCESS_DENIED_OBJECT_ACE = ACCESS_DENIED_OBJECT_ACE*; struct SYSTEM_AUDIT_OBJECT_ACE { ACE_HEADER Header; @@ -2044,7 +2044,7 @@ struct SYSTEM_AUDIT_OBJECT_ACE { GUID InheritedObjectType; DWORD SidStart; } -alias SYSTEM_AUDIT_OBJECT_ACE* PSYSTEM_AUDIT_OBJECT_ACE; +alias PSYSTEM_AUDIT_OBJECT_ACE = SYSTEM_AUDIT_OBJECT_ACE*; struct SYSTEM_ALARM_OBJECT_ACE { ACE_HEADER Header; @@ -2054,7 +2054,7 @@ struct SYSTEM_ALARM_OBJECT_ACE { GUID InheritedObjectType; DWORD SidStart; } -alias SYSTEM_ALARM_OBJECT_ACE* PSYSTEM_ALARM_OBJECT_ACE; +alias PSYSTEM_ALARM_OBJECT_ACE = SYSTEM_ALARM_OBJECT_ACE*; struct ACL { BYTE AclRevision; @@ -2063,7 +2063,7 @@ struct ACL { WORD AceCount; WORD Sbz2; } -alias ACL* PACL; +alias PACL = ACL*; struct ACL_REVISION_INFORMATION { DWORD AclRevision; @@ -2159,7 +2159,7 @@ enum INITIAL_FPCSR = 0x027f; ULONGLONG Low; LONGLONG High; } - alias M128A* PM128A; + alias PM128A = M128A*; struct XMM_SAVE_AREA32 { @@ -2180,7 +2180,7 @@ enum INITIAL_FPCSR = 0x027f; M128A[16] XmmRegisters; BYTE[96] Reserved4; } - alias XMM_SAVE_AREA32 PXMM_SAVE_AREA32; + alias PXMM_SAVE_AREA32 = XMM_SAVE_AREA32; enum LEGACY_SAVE_AREA_LENGTH = XMM_SAVE_AREA32.sizeof; align(16) struct CONTEXT @@ -2308,7 +2308,7 @@ enum LEGACY_SAVE_AREA_LENGTH = XMM_SAVE_AREA32.sizeof; // Versions for PowerPC, Alpha, SHX, and MIPS removed. } -alias CONTEXT* PCONTEXT, LPCONTEXT; +alias PCONTEXT = CONTEXT*, LPCONTEXT = CONTEXT*; struct EXCEPTION_RECORD { DWORD ExceptionCode; @@ -2318,13 +2318,13 @@ struct EXCEPTION_RECORD { DWORD NumberParameters; ULONG_PTR[EXCEPTION_MAXIMUM_PARAMETERS] ExceptionInformation; } -alias EXCEPTION_RECORD* PEXCEPTION_RECORD, LPEXCEPTION_RECORD; +alias PEXCEPTION_RECORD = EXCEPTION_RECORD*, LPEXCEPTION_RECORD = EXCEPTION_RECORD*; struct EXCEPTION_POINTERS { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT ContextRecord; } -alias EXCEPTION_POINTERS* PEXCEPTION_POINTERS, LPEXCEPTION_POINTERS; +alias PEXCEPTION_POINTERS = EXCEPTION_POINTERS*, LPEXCEPTION_POINTERS = EXCEPTION_POINTERS*; union LARGE_INTEGER { struct { @@ -2333,7 +2333,7 @@ union LARGE_INTEGER { } long QuadPart; } -alias LARGE_INTEGER* PLARGE_INTEGER; +alias PLARGE_INTEGER = LARGE_INTEGER*; union ULARGE_INTEGER { struct { @@ -2342,10 +2342,10 @@ union ULARGE_INTEGER { } ulong QuadPart; } -alias ULARGE_INTEGER* PULARGE_INTEGER; +alias PULARGE_INTEGER = ULARGE_INTEGER*; -alias LARGE_INTEGER LUID; -alias LUID* PLUID; +alias LUID = LARGE_INTEGER; +alias PLUID = LUID*; enum LUID SYSTEM_LUID = { QuadPart:999 }; @@ -2353,7 +2353,7 @@ align(4) struct LUID_AND_ATTRIBUTES { LUID Luid; DWORD Attributes; } -alias LUID_AND_ATTRIBUTES* PLUID_AND_ATTRIBUTES; +alias PLUID_AND_ATTRIBUTES = LUID_AND_ATTRIBUTES*; align(4) struct PRIVILEGE_SET { DWORD PrivilegeCount; @@ -2362,14 +2362,14 @@ align(4) struct PRIVILEGE_SET { LUID_AND_ATTRIBUTES* Privilege() return { return &_Privilege; } } -alias PRIVILEGE_SET* PPRIVILEGE_SET; +alias PPRIVILEGE_SET = PRIVILEGE_SET*; struct SECURITY_ATTRIBUTES { DWORD nLength; LPVOID lpSecurityDescriptor; BOOL bInheritHandle; } -alias SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES; +alias PSECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES*, LPSECURITY_ATTRIBUTES = SECURITY_ATTRIBUTES*; struct SECURITY_QUALITY_OF_SERVICE { DWORD Length; @@ -2377,9 +2377,9 @@ struct SECURITY_QUALITY_OF_SERVICE { SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; BOOLEAN EffectiveOnly; } -alias SECURITY_QUALITY_OF_SERVICE* PSECURITY_QUALITY_OF_SERVICE; +alias PSECURITY_QUALITY_OF_SERVICE = SECURITY_QUALITY_OF_SERVICE*; -alias PVOID PACCESS_TOKEN; +alias PACCESS_TOKEN = PVOID; struct SE_IMPERSONATION_STATE { PACCESS_TOKEN Token; @@ -2387,14 +2387,14 @@ struct SE_IMPERSONATION_STATE { BOOLEAN EffectiveOnly; SECURITY_IMPERSONATION_LEVEL Level; } -alias SE_IMPERSONATION_STATE* PSE_IMPERSONATION_STATE; +alias PSE_IMPERSONATION_STATE = SE_IMPERSONATION_STATE*; struct SID_IDENTIFIER_AUTHORITY { BYTE[6] Value; } -alias SID_IDENTIFIER_AUTHORITY* PSID_IDENTIFIER_AUTHORITY, LPSID_IDENTIFIER_AUTHORITY; +alias PSID_IDENTIFIER_AUTHORITY = SID_IDENTIFIER_AUTHORITY*, LPSID_IDENTIFIER_AUTHORITY = SID_IDENTIFIER_AUTHORITY*; -alias PVOID PSID; +alias PSID = PVOID; struct SID { BYTE Revision; @@ -2404,19 +2404,19 @@ struct SID { DWORD* SubAuthority() return { return &_SubAuthority; } } -alias SID* PISID; +alias PISID = SID*; struct SID_AND_ATTRIBUTES { PSID Sid; DWORD Attributes; } -alias SID_AND_ATTRIBUTES* PSID_AND_ATTRIBUTES; +alias PSID_AND_ATTRIBUTES = SID_AND_ATTRIBUTES*; struct TOKEN_SOURCE { CHAR[TOKEN_SOURCE_LENGTH] SourceName = 0; LUID SourceIdentifier; } -alias TOKEN_SOURCE* PTOKEN_SOURCE; +alias PTOKEN_SOURCE = TOKEN_SOURCE*; struct TOKEN_CONTROL { LUID TokenId; @@ -2424,12 +2424,12 @@ struct TOKEN_CONTROL { LUID ModifiedId; TOKEN_SOURCE TokenSource; } -alias TOKEN_CONTROL* PTOKEN_CONTROL; +alias PTOKEN_CONTROL = TOKEN_CONTROL*; struct TOKEN_DEFAULT_DACL { PACL DefaultDacl; } -alias TOKEN_DEFAULT_DACL* PTOKEN_DEFAULT_DACL; +alias PTOKEN_DEFAULT_DACL = TOKEN_DEFAULT_DACL*; struct TOKEN_GROUPS { DWORD GroupCount; @@ -2437,18 +2437,18 @@ struct TOKEN_GROUPS { SID_AND_ATTRIBUTES* Groups() return { return &_Groups; } } -alias TOKEN_GROUPS* PTOKEN_GROUPS, LPTOKEN_GROUPS; +alias PTOKEN_GROUPS = TOKEN_GROUPS*, LPTOKEN_GROUPS = TOKEN_GROUPS*; struct TOKEN_OWNER { PSID Owner; } -alias TOKEN_OWNER* PTOKEN_OWNER; +alias PTOKEN_OWNER = TOKEN_OWNER*; enum SECURITY_MAX_SID_SIZE = 68; struct TOKEN_PRIMARY_GROUP { PSID PrimaryGroup; } -alias TOKEN_PRIMARY_GROUP* PTOKEN_PRIMARY_GROUP; +alias PTOKEN_PRIMARY_GROUP = TOKEN_PRIMARY_GROUP*; struct TOKEN_PRIVILEGES { DWORD PrivilegeCount; @@ -2456,13 +2456,13 @@ struct TOKEN_PRIVILEGES { LUID_AND_ATTRIBUTES* Privileges() return { return &_Privileges; } } -alias TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES, LPTOKEN_PRIVILEGES; +alias PTOKEN_PRIVILEGES = TOKEN_PRIVILEGES*, LPTOKEN_PRIVILEGES = TOKEN_PRIVILEGES*; enum TOKEN_TYPE { TokenPrimary = 1, TokenImpersonation } -alias TOKEN_TYPE* PTOKEN_TYPE; +alias PTOKEN_TYPE = TOKEN_TYPE*; struct TOKEN_STATISTICS { LUID TokenId; @@ -2476,21 +2476,21 @@ struct TOKEN_STATISTICS { DWORD PrivilegeCount; LUID ModifiedId; } -alias TOKEN_STATISTICS* PTOKEN_STATISTICS; +alias PTOKEN_STATISTICS = TOKEN_STATISTICS*; struct TOKEN_USER { SID_AND_ATTRIBUTES User; } -alias TOKEN_USER* PTOKEN_USER; +alias PTOKEN_USER = TOKEN_USER*; struct TOKEN_MANDATORY_LABEL { SID_AND_ATTRIBUTES Label; } alias PTOKEN_MANDATORY_LABEL = TOKEN_MANDATORY_LABEL*; -alias DWORD SECURITY_INFORMATION; -alias SECURITY_INFORMATION* PSECURITY_INFORMATION; -alias WORD SECURITY_DESCRIPTOR_CONTROL; -alias SECURITY_DESCRIPTOR_CONTROL* PSECURITY_DESCRIPTOR_CONTROL; +alias SECURITY_INFORMATION = DWORD; +alias PSECURITY_INFORMATION = SECURITY_INFORMATION*; +alias SECURITY_DESCRIPTOR_CONTROL = WORD; +alias PSECURITY_DESCRIPTOR_CONTROL = SECURITY_DESCRIPTOR_CONTROL*; struct SECURITY_DESCRIPTOR { BYTE Revision; @@ -2501,7 +2501,7 @@ struct SECURITY_DESCRIPTOR { PACL Sacl; PACL Dacl; } -alias SECURITY_DESCRIPTOR* PSECURITY_DESCRIPTOR, PISECURITY_DESCRIPTOR; +alias PSECURITY_DESCRIPTOR = SECURITY_DESCRIPTOR*, PISECURITY_DESCRIPTOR = SECURITY_DESCRIPTOR*; enum TOKEN_ELEVATION_TYPE { TokenElevationTypeDefault = 1, TokenElevationTypeFull, @@ -2571,7 +2571,7 @@ enum SID_NAME_USE { SidTypeUnknown, SidTypeComputer } -alias SID_NAME_USE* PSID_NAME_USE; +alias PSID_NAME_USE = SID_NAME_USE*; enum WELL_KNOWN_SID_TYPE { WinNullSid = 0, @@ -2678,7 +2678,7 @@ struct QUOTA_LIMITS { SIZE_T PagefileLimit; LARGE_INTEGER TimeLimit; } -alias QUOTA_LIMITS* PQUOTA_LIMITS; +alias PQUOTA_LIMITS = QUOTA_LIMITS*; struct IO_COUNTERS { ULONGLONG ReadOperationCount; @@ -2688,7 +2688,7 @@ struct IO_COUNTERS { ULONGLONG WriteTransferCount; ULONGLONG OtherTransferCount; } -alias IO_COUNTERS* PIO_COUNTERS; +alias PIO_COUNTERS = IO_COUNTERS*; struct FILE_NOTIFY_INFORMATION { DWORD NextEntryOffset; @@ -2698,13 +2698,13 @@ struct FILE_NOTIFY_INFORMATION { WCHAR* FileName() return { return &_FileName; } } -alias FILE_NOTIFY_INFORMATION* PFILE_NOTIFY_INFORMATION; +alias PFILE_NOTIFY_INFORMATION = FILE_NOTIFY_INFORMATION*; struct TAPE_ERASE { DWORD Type; BOOLEAN Immediate; } -alias TAPE_ERASE* PTAPE_ERASE; +alias PTAPE_ERASE = TAPE_ERASE*; struct TAPE_GET_DRIVE_PARAMETERS { BOOLEAN ECC; @@ -2719,7 +2719,7 @@ struct TAPE_GET_DRIVE_PARAMETERS { DWORD FeaturesHigh; DWORD EOTWarningZoneSize; } -alias TAPE_GET_DRIVE_PARAMETERS* PTAPE_GET_DRIVE_PARAMETERS; +alias PTAPE_GET_DRIVE_PARAMETERS = TAPE_GET_DRIVE_PARAMETERS*; struct TAPE_GET_MEDIA_PARAMETERS { LARGE_INTEGER Capacity; @@ -2728,7 +2728,7 @@ struct TAPE_GET_MEDIA_PARAMETERS { DWORD PartitionCount; BOOLEAN WriteProtected; } -alias TAPE_GET_MEDIA_PARAMETERS* PTAPE_GET_MEDIA_PARAMETERS; +alias PTAPE_GET_MEDIA_PARAMETERS = TAPE_GET_MEDIA_PARAMETERS*; struct TAPE_GET_POSITION { ULONG Type; @@ -2736,13 +2736,13 @@ struct TAPE_GET_POSITION { ULONG OffsetLow; ULONG OffsetHigh; } -alias TAPE_GET_POSITION* PTAPE_GET_POSITION; +alias PTAPE_GET_POSITION = TAPE_GET_POSITION*; struct TAPE_PREPARE { DWORD Operation; BOOLEAN Immediate; } -alias TAPE_PREPARE* PTAPE_PREPARE; +alias PTAPE_PREPARE = TAPE_PREPARE*; struct TAPE_SET_DRIVE_PARAMETERS { BOOLEAN ECC; @@ -2751,12 +2751,12 @@ struct TAPE_SET_DRIVE_PARAMETERS { BOOLEAN ReportSetmarks; ULONG EOTWarningZoneSize; } -alias TAPE_SET_DRIVE_PARAMETERS* PTAPE_SET_DRIVE_PARAMETERS; +alias PTAPE_SET_DRIVE_PARAMETERS = TAPE_SET_DRIVE_PARAMETERS*; struct TAPE_SET_MEDIA_PARAMETERS { ULONG BlockSize; } -alias TAPE_SET_MEDIA_PARAMETERS* PTAPE_SET_MEDIA_PARAMETERS; +alias PTAPE_SET_MEDIA_PARAMETERS = TAPE_SET_MEDIA_PARAMETERS*; struct TAPE_SET_POSITION { DWORD Method; @@ -2764,21 +2764,21 @@ struct TAPE_SET_POSITION { LARGE_INTEGER Offset; BOOLEAN Immediate; } -alias TAPE_SET_POSITION* PTAPE_SET_POSITION; +alias PTAPE_SET_POSITION = TAPE_SET_POSITION*; struct TAPE_WRITE_MARKS { DWORD Type; DWORD Count; BOOLEAN Immediate; } -alias TAPE_WRITE_MARKS* PTAPE_WRITE_MARKS; +alias PTAPE_WRITE_MARKS = TAPE_WRITE_MARKS*; struct TAPE_CREATE_PARTITION { DWORD Method; DWORD Count; DWORD Size; } -alias TAPE_CREATE_PARTITION* PTAPE_CREATE_PARTITION; +alias PTAPE_CREATE_PARTITION = TAPE_CREATE_PARTITION*; struct MEMORY_BASIC_INFORMATION { PVOID BaseAddress; @@ -2789,7 +2789,7 @@ struct MEMORY_BASIC_INFORMATION { DWORD Protect; DWORD Type; } -alias MEMORY_BASIC_INFORMATION* PMEMORY_BASIC_INFORMATION; +alias PMEMORY_BASIC_INFORMATION = MEMORY_BASIC_INFORMATION*; struct MESSAGE_RESOURCE_ENTRY { WORD Length; @@ -2798,14 +2798,14 @@ struct MESSAGE_RESOURCE_ENTRY { BYTE* Text() return { return &_Text; } } -alias MESSAGE_RESOURCE_ENTRY* PMESSAGE_RESOURCE_ENTRY; +alias PMESSAGE_RESOURCE_ENTRY = MESSAGE_RESOURCE_ENTRY*; struct MESSAGE_RESOURCE_BLOCK { DWORD LowId; DWORD HighId; DWORD OffsetToEntries; } -alias MESSAGE_RESOURCE_BLOCK* PMESSAGE_RESOURCE_BLOCK; +alias PMESSAGE_RESOURCE_BLOCK = MESSAGE_RESOURCE_BLOCK*; struct MESSAGE_RESOURCE_DATA { DWORD NumberOfBlocks; @@ -2813,14 +2813,14 @@ struct MESSAGE_RESOURCE_DATA { MESSAGE_RESOURCE_BLOCK* Blocks() return { return &_Blocks; } } -alias MESSAGE_RESOURCE_DATA* PMESSAGE_RESOURCE_DATA; +alias PMESSAGE_RESOURCE_DATA = MESSAGE_RESOURCE_DATA*; struct LIST_ENTRY { LIST_ENTRY* Flink; LIST_ENTRY* Blink; } -alias LIST_ENTRY* PLIST_ENTRY; -alias LIST_ENTRY _LIST_ENTRY; +alias PLIST_ENTRY = LIST_ENTRY*; +alias _LIST_ENTRY = LIST_ENTRY; struct SINGLE_LIST_ENTRY { SINGLE_LIST_ENTRY* Next; @@ -2832,9 +2832,9 @@ version (Win64) { SLIST_ENTRY* Next; } } else { - alias SINGLE_LIST_ENTRY SLIST_ENTRY; + alias SLIST_ENTRY = SINGLE_LIST_ENTRY; } -alias SINGLE_LIST_ENTRY* PSINGLE_LIST_ENTRY, PSLIST_ENTRY; +alias PSINGLE_LIST_ENTRY = SINGLE_LIST_ENTRY*, PSLIST_ENTRY = SINGLE_LIST_ENTRY*; union SLIST_HEADER { ULONGLONG Alignment; @@ -2844,7 +2844,7 @@ union SLIST_HEADER { WORD Sequence; } } -alias SLIST_HEADER* PSLIST_HEADER; +alias PSLIST_HEADER = SLIST_HEADER*; struct RTL_CRITICAL_SECTION_DEBUG { WORD Type; @@ -2855,8 +2855,8 @@ struct RTL_CRITICAL_SECTION_DEBUG { DWORD ContentionCount; DWORD[2] Spare; } -alias RTL_CRITICAL_SECTION_DEBUG* PRTL_CRITICAL_SECTION_DEBUG; -alias RTL_CRITICAL_SECTION_DEBUG _RTL_CRITICAL_SECTION_DEBUG; +alias PRTL_CRITICAL_SECTION_DEBUG = RTL_CRITICAL_SECTION_DEBUG*; +alias _RTL_CRITICAL_SECTION_DEBUG = RTL_CRITICAL_SECTION_DEBUG; struct RTL_CRITICAL_SECTION { PRTL_CRITICAL_SECTION_DEBUG DebugInfo; @@ -2867,8 +2867,8 @@ struct RTL_CRITICAL_SECTION { ULONG_PTR SpinCount; alias Reserved = SpinCount; } -alias RTL_CRITICAL_SECTION* PRTL_CRITICAL_SECTION; -alias RTL_CRITICAL_SECTION _RTL_CRITICAL_SECTION; +alias PRTL_CRITICAL_SECTION = RTL_CRITICAL_SECTION*; +alias _RTL_CRITICAL_SECTION = RTL_CRITICAL_SECTION; struct EVENTLOGRECORD { DWORD Length; @@ -2888,7 +2888,7 @@ struct EVENTLOGRECORD { DWORD DataLength; DWORD DataOffset; } -alias EVENTLOGRECORD* PEVENTLOGRECORD; +alias PEVENTLOGRECORD = EVENTLOGRECORD*; struct OSVERSIONINFOA { DWORD dwOSVersionInfoSize = OSVERSIONINFOA.sizeof; @@ -2898,7 +2898,7 @@ struct OSVERSIONINFOA { DWORD dwPlatformId; CHAR[128] szCSDVersion = 0; } -alias OSVERSIONINFOA* POSVERSIONINFOA, LPOSVERSIONINFOA; +alias POSVERSIONINFOA = OSVERSIONINFOA*, LPOSVERSIONINFOA = OSVERSIONINFOA*; struct OSVERSIONINFOW { DWORD dwOSVersionInfoSize = OSVERSIONINFOW.sizeof; @@ -2908,7 +2908,7 @@ struct OSVERSIONINFOW { DWORD dwPlatformId; WCHAR[128] szCSDVersion = 0; } -alias OSVERSIONINFOW* POSVERSIONINFOW, LPOSVERSIONINFOW; +alias POSVERSIONINFOW = OSVERSIONINFOW*, LPOSVERSIONINFOW = OSVERSIONINFOW*; struct OSVERSIONINFOEXA { DWORD dwOSVersionInfoSize; @@ -2923,7 +2923,7 @@ struct OSVERSIONINFOEXA { BYTE wProductType; BYTE wReserved; } -alias OSVERSIONINFOEXA* POSVERSIONINFOEXA, LPOSVERSIONINFOEXA; +alias POSVERSIONINFOEXA = OSVERSIONINFOEXA*, LPOSVERSIONINFOEXA = OSVERSIONINFOEXA*; struct OSVERSIONINFOEXW { DWORD dwOSVersionInfoSize; @@ -2938,7 +2938,7 @@ struct OSVERSIONINFOEXW { BYTE wProductType; BYTE wReserved; } -alias OSVERSIONINFOEXW* POSVERSIONINFOEXW, LPOSVERSIONINFOEXW; +alias POSVERSIONINFOEXW = OSVERSIONINFOEXW*, LPOSVERSIONINFOEXW = OSVERSIONINFOEXW*; align(2) struct IMAGE_VXD_HEADER { WORD e32_magic; @@ -2993,7 +2993,7 @@ align(2) struct IMAGE_VXD_HEADER { WORD e32_devid; WORD e32_ddkver; } -alias IMAGE_VXD_HEADER* PIMAGE_VXD_HEADER; +alias PIMAGE_VXD_HEADER = IMAGE_VXD_HEADER*; align(4): struct IMAGE_FILE_HEADER { @@ -3005,14 +3005,14 @@ struct IMAGE_FILE_HEADER { WORD SizeOfOptionalHeader; WORD Characteristics; } -alias IMAGE_FILE_HEADER* PIMAGE_FILE_HEADER; +alias PIMAGE_FILE_HEADER = IMAGE_FILE_HEADER*; // const IMAGE_SIZEOF_FILE_HEADER = IMAGE_FILE_HEADER.sizeof; struct IMAGE_DATA_DIRECTORY { DWORD VirtualAddress; DWORD Size; } -alias IMAGE_DATA_DIRECTORY* PIMAGE_DATA_DIRECTORY; +alias PIMAGE_DATA_DIRECTORY = IMAGE_DATA_DIRECTORY*; struct IMAGE_OPTIONAL_HEADER32 { WORD Magic; @@ -3047,7 +3047,7 @@ struct IMAGE_OPTIONAL_HEADER32 { DWORD NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] DataDirectory; } -alias IMAGE_OPTIONAL_HEADER32* PIMAGE_OPTIONAL_HEADER32; +alias PIMAGE_OPTIONAL_HEADER32 = IMAGE_OPTIONAL_HEADER32*; struct IMAGE_OPTIONAL_HEADER64 { WORD Magic; @@ -3081,7 +3081,7 @@ struct IMAGE_OPTIONAL_HEADER64 { DWORD NumberOfRvaAndSizes; IMAGE_DATA_DIRECTORY[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] DataDirectory; } -alias IMAGE_OPTIONAL_HEADER64* PIMAGE_OPTIONAL_HEADER64; +alias PIMAGE_OPTIONAL_HEADER64 = IMAGE_OPTIONAL_HEADER64*; struct IMAGE_ROM_OPTIONAL_HEADER { WORD Magic; @@ -3098,7 +3098,7 @@ struct IMAGE_ROM_OPTIONAL_HEADER { DWORD[4] CprMask; DWORD GpValue; } -alias IMAGE_ROM_OPTIONAL_HEADER* PIMAGE_ROM_OPTIONAL_HEADER; +alias PIMAGE_ROM_OPTIONAL_HEADER = IMAGE_ROM_OPTIONAL_HEADER*; align(2): struct IMAGE_DOS_HEADER { @@ -3122,7 +3122,7 @@ struct IMAGE_DOS_HEADER { WORD[10] e_res2; LONG e_lfanew; } -alias IMAGE_DOS_HEADER* PIMAGE_DOS_HEADER; +alias PIMAGE_DOS_HEADER = IMAGE_DOS_HEADER*; struct IMAGE_OS2_HEADER { WORD ne_magic; @@ -3156,27 +3156,27 @@ struct IMAGE_OS2_HEADER { WORD ne_swaparea; WORD ne_expver; } -alias IMAGE_OS2_HEADER* PIMAGE_OS2_HEADER; +alias PIMAGE_OS2_HEADER = IMAGE_OS2_HEADER*; align(4) struct IMAGE_NT_HEADERS32 { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER32 OptionalHeader; } -alias IMAGE_NT_HEADERS32* PIMAGE_NT_HEADERS32; +alias PIMAGE_NT_HEADERS32 = IMAGE_NT_HEADERS32*; align(4) struct IMAGE_NT_HEADERS64 { DWORD Signature; IMAGE_FILE_HEADER FileHeader; IMAGE_OPTIONAL_HEADER64 OptionalHeader; } -alias IMAGE_NT_HEADERS64* PIMAGE_NT_HEADERS64; +alias PIMAGE_NT_HEADERS64 = IMAGE_NT_HEADERS64*; struct IMAGE_ROM_HEADERS { IMAGE_FILE_HEADER FileHeader; IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; } -alias IMAGE_ROM_HEADERS* PIMAGE_ROM_HEADERS; +alias PIMAGE_ROM_HEADERS = IMAGE_ROM_HEADERS*; struct IMAGE_SECTION_HEADER { BYTE[IMAGE_SIZEOF_SHORT_NAME] Name; @@ -3194,7 +3194,7 @@ struct IMAGE_SECTION_HEADER { WORD NumberOfLinenumbers; DWORD Characteristics; } -alias IMAGE_SECTION_HEADER* PIMAGE_SECTION_HEADER; +alias PIMAGE_SECTION_HEADER = IMAGE_SECTION_HEADER*; struct IMAGE_SYMBOL { union _N { @@ -3213,7 +3213,7 @@ struct IMAGE_SYMBOL { BYTE StorageClass; BYTE NumberOfAuxSymbols; } -alias IMAGE_SYMBOL* PIMAGE_SYMBOL; +alias PIMAGE_SYMBOL = IMAGE_SYMBOL*; union IMAGE_AUX_SYMBOL { struct _Sym { @@ -3256,7 +3256,7 @@ union IMAGE_AUX_SYMBOL { } _Section Section; } -alias IMAGE_AUX_SYMBOL* PIMAGE_AUX_SYMBOL; +alias PIMAGE_AUX_SYMBOL = IMAGE_AUX_SYMBOL*; struct IMAGE_COFF_SYMBOLS_HEADER { DWORD NumberOfSymbols; @@ -3268,7 +3268,7 @@ struct IMAGE_COFF_SYMBOLS_HEADER { DWORD RvaToFirstByteOfData; DWORD RvaToLastByteOfData; } -alias IMAGE_COFF_SYMBOLS_HEADER* PIMAGE_COFF_SYMBOLS_HEADER; +alias PIMAGE_COFF_SYMBOLS_HEADER = IMAGE_COFF_SYMBOLS_HEADER*; struct IMAGE_RELOCATION { union { @@ -3278,13 +3278,13 @@ struct IMAGE_RELOCATION { DWORD SymbolTableIndex; WORD Type; } -alias IMAGE_RELOCATION* PIMAGE_RELOCATION; +alias PIMAGE_RELOCATION = IMAGE_RELOCATION*; align(4) struct IMAGE_BASE_RELOCATION { DWORD VirtualAddress; DWORD SizeOfBlock; } -alias IMAGE_BASE_RELOCATION* PIMAGE_BASE_RELOCATION; +alias PIMAGE_BASE_RELOCATION = IMAGE_BASE_RELOCATION*; align(2) struct IMAGE_LINENUMBER { union _Type { @@ -3294,7 +3294,7 @@ align(2) struct IMAGE_LINENUMBER { _Type Type; WORD Linenumber; } -alias IMAGE_LINENUMBER* PIMAGE_LINENUMBER; +alias PIMAGE_LINENUMBER = IMAGE_LINENUMBER*; align(4): struct IMAGE_ARCHIVE_MEMBER_HEADER { @@ -3306,7 +3306,7 @@ struct IMAGE_ARCHIVE_MEMBER_HEADER { BYTE[10] Size; BYTE[2] EndHeader; } -alias IMAGE_ARCHIVE_MEMBER_HEADER* PIMAGE_ARCHIVE_MEMBER_HEADER; +alias PIMAGE_ARCHIVE_MEMBER_HEADER = IMAGE_ARCHIVE_MEMBER_HEADER*; struct IMAGE_EXPORT_DIRECTORY { DWORD Characteristics; @@ -3321,7 +3321,7 @@ struct IMAGE_EXPORT_DIRECTORY { DWORD AddressOfNames; DWORD AddressOfNameOrdinals; } -alias IMAGE_EXPORT_DIRECTORY* PIMAGE_EXPORT_DIRECTORY; +alias PIMAGE_EXPORT_DIRECTORY = IMAGE_EXPORT_DIRECTORY*; struct IMAGE_IMPORT_BY_NAME { WORD Hint; @@ -3329,7 +3329,7 @@ struct IMAGE_IMPORT_BY_NAME { BYTE* Name() return { return &_Name; } } -alias IMAGE_IMPORT_BY_NAME* PIMAGE_IMPORT_BY_NAME; +alias PIMAGE_IMPORT_BY_NAME = IMAGE_IMPORT_BY_NAME*; struct IMAGE_THUNK_DATA32 { union _u1 { @@ -3340,7 +3340,7 @@ struct IMAGE_THUNK_DATA32 { } _u1 u1; } -alias IMAGE_THUNK_DATA32* PIMAGE_THUNK_DATA32; +alias PIMAGE_THUNK_DATA32 = IMAGE_THUNK_DATA32*; struct IMAGE_THUNK_DATA64 { union _u1 { @@ -3351,7 +3351,7 @@ struct IMAGE_THUNK_DATA64 { } _u1 u1; } -alias IMAGE_THUNK_DATA64* PIMAGE_THUNK_DATA64; +alias PIMAGE_THUNK_DATA64 = IMAGE_THUNK_DATA64*; struct IMAGE_IMPORT_DESCRIPTOR { union { @@ -3363,21 +3363,21 @@ struct IMAGE_IMPORT_DESCRIPTOR { DWORD Name; DWORD FirstThunk; } -alias IMAGE_IMPORT_DESCRIPTOR* PIMAGE_IMPORT_DESCRIPTOR; +alias PIMAGE_IMPORT_DESCRIPTOR = IMAGE_IMPORT_DESCRIPTOR*; struct IMAGE_BOUND_IMPORT_DESCRIPTOR { DWORD TimeDateStamp; WORD OffsetModuleName; WORD NumberOfModuleForwarderRefs; } -alias IMAGE_BOUND_IMPORT_DESCRIPTOR* PIMAGE_BOUND_IMPORT_DESCRIPTOR; +alias PIMAGE_BOUND_IMPORT_DESCRIPTOR = IMAGE_BOUND_IMPORT_DESCRIPTOR*; struct IMAGE_BOUND_FORWARDER_REF { DWORD TimeDateStamp; WORD OffsetModuleName; WORD Reserved; } -alias IMAGE_BOUND_FORWARDER_REF* PIMAGE_BOUND_FORWARDER_REF; +alias PIMAGE_BOUND_FORWARDER_REF = IMAGE_BOUND_FORWARDER_REF*; struct IMAGE_TLS_DIRECTORY32 { DWORD StartAddressOfRawData; @@ -3387,7 +3387,7 @@ struct IMAGE_TLS_DIRECTORY32 { DWORD SizeOfZeroFill; DWORD Characteristics; } -alias IMAGE_TLS_DIRECTORY32* PIMAGE_TLS_DIRECTORY32; +alias PIMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY32*; struct IMAGE_TLS_DIRECTORY64 { ULONGLONG StartAddressOfRawData; @@ -3397,7 +3397,7 @@ struct IMAGE_TLS_DIRECTORY64 { DWORD SizeOfZeroFill; DWORD Characteristics; } -alias IMAGE_TLS_DIRECTORY64* PIMAGE_TLS_DIRECTORY64; +alias PIMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY64*; struct IMAGE_RESOURCE_DIRECTORY { DWORD Characteristics; @@ -3407,7 +3407,7 @@ struct IMAGE_RESOURCE_DIRECTORY { WORD NumberOfNamedEntries; WORD NumberOfIdEntries; } -alias IMAGE_RESOURCE_DIRECTORY* PIMAGE_RESOURCE_DIRECTORY; +alias PIMAGE_RESOURCE_DIRECTORY = IMAGE_RESOURCE_DIRECTORY*; struct IMAGE_RESOURCE_DIRECTORY_ENTRY { union { @@ -3447,7 +3447,7 @@ struct IMAGE_RESOURCE_DIRECTORY_ENTRY { OffsetToData = (OffsetToData & 0x7FFFFFFF) | (d << 31); return d; } } -alias IMAGE_RESOURCE_DIRECTORY_ENTRY* PIMAGE_RESOURCE_DIRECTORY_ENTRY; +alias PIMAGE_RESOURCE_DIRECTORY_ENTRY = IMAGE_RESOURCE_DIRECTORY_ENTRY*; struct IMAGE_RESOURCE_DIRECTORY_STRING { WORD Length; @@ -3455,7 +3455,7 @@ struct IMAGE_RESOURCE_DIRECTORY_STRING { CHAR* NameString() return { return &_NameString; } } -alias IMAGE_RESOURCE_DIRECTORY_STRING* PIMAGE_RESOURCE_DIRECTORY_STRING; +alias PIMAGE_RESOURCE_DIRECTORY_STRING = IMAGE_RESOURCE_DIRECTORY_STRING*; struct IMAGE_RESOURCE_DIR_STRING_U { WORD Length; @@ -3463,7 +3463,7 @@ struct IMAGE_RESOURCE_DIR_STRING_U { WCHAR* NameString() return { return &_NameString; } } -alias IMAGE_RESOURCE_DIR_STRING_U* PIMAGE_RESOURCE_DIR_STRING_U; +alias PIMAGE_RESOURCE_DIR_STRING_U = IMAGE_RESOURCE_DIR_STRING_U*; struct IMAGE_RESOURCE_DATA_ENTRY { DWORD OffsetToData; @@ -3471,7 +3471,7 @@ struct IMAGE_RESOURCE_DATA_ENTRY { DWORD CodePage; DWORD Reserved; } -alias IMAGE_RESOURCE_DATA_ENTRY* PIMAGE_RESOURCE_DATA_ENTRY; +alias PIMAGE_RESOURCE_DATA_ENTRY = IMAGE_RESOURCE_DATA_ENTRY*; struct IMAGE_LOAD_CONFIG_DIRECTORY32 { DWORD Characteristics; @@ -3489,7 +3489,7 @@ struct IMAGE_LOAD_CONFIG_DIRECTORY32 { DWORD ProcessHeapFlags; DWORD[4] Reserved; } -alias IMAGE_LOAD_CONFIG_DIRECTORY32* PIMAGE_LOAD_CONFIG_DIRECTORY32; +alias PIMAGE_LOAD_CONFIG_DIRECTORY32 = IMAGE_LOAD_CONFIG_DIRECTORY32*; struct IMAGE_LOAD_CONFIG_DIRECTORY64 { DWORD Characteristics; @@ -3511,14 +3511,14 @@ struct IMAGE_LOAD_CONFIG_DIRECTORY64 { ULONGLONG EditList; DWORD[2] Reserved; } -alias IMAGE_LOAD_CONFIG_DIRECTORY64* PIMAGE_LOAD_CONFIG_DIRECTORY64; +alias PIMAGE_LOAD_CONFIG_DIRECTORY64 = IMAGE_LOAD_CONFIG_DIRECTORY64*; version (Win64) { - alias IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; + alias IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY64; } else { - alias IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; + alias IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY32; } -alias IMAGE_LOAD_CONFIG_DIRECTORY* PIMAGE_LOAD_CONFIG_DIRECTORY; +alias PIMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY*; // Note versions for Alpha, Alpha64, ARM removed. struct IMAGE_RUNTIME_FUNCTION_ENTRY { @@ -3529,7 +3529,7 @@ struct IMAGE_RUNTIME_FUNCTION_ENTRY { DWORD UnwindData; } } -alias IMAGE_RUNTIME_FUNCTION_ENTRY* PIMAGE_RUNTIME_FUNCTION_ENTRY; +alias PIMAGE_RUNTIME_FUNCTION_ENTRY = IMAGE_RUNTIME_FUNCTION_ENTRY*; struct IMAGE_CE_RUNTIME_FUNCTION_ENTRY { uint FuncStart; @@ -3558,7 +3558,7 @@ struct IMAGE_CE_RUNTIME_FUNCTION_ENTRY { _bf = (_bf & ~0x80000000) | (e << 31); return e; } } -alias IMAGE_CE_RUNTIME_FUNCTION_ENTRY* PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; +alias PIMAGE_CE_RUNTIME_FUNCTION_ENTRY = IMAGE_CE_RUNTIME_FUNCTION_ENTRY*; struct IMAGE_DEBUG_DIRECTORY { DWORD Characteristics; @@ -3570,7 +3570,7 @@ struct IMAGE_DEBUG_DIRECTORY { DWORD AddressOfRawData; DWORD PointerToRawData; } -alias IMAGE_DEBUG_DIRECTORY* PIMAGE_DEBUG_DIRECTORY; +alias PIMAGE_DEBUG_DIRECTORY = IMAGE_DEBUG_DIRECTORY*; struct FPO_DATA { DWORD ulOffStart; @@ -3606,7 +3606,7 @@ struct FPO_DATA { return cast(ubyte)(c & 0x03); } } -alias FPO_DATA* PFPO_DATA; +alias PFPO_DATA = FPO_DATA*; struct IMAGE_DEBUG_MISC { DWORD DataType; @@ -3617,14 +3617,14 @@ struct IMAGE_DEBUG_MISC { BYTE* Data() return { return &_Data; } } -alias IMAGE_DEBUG_MISC* PIMAGE_DEBUG_MISC; +alias PIMAGE_DEBUG_MISC = IMAGE_DEBUG_MISC*; struct IMAGE_FUNCTION_ENTRY { DWORD StartingAddress; DWORD EndingAddress; DWORD EndOfPrologue; } -alias IMAGE_FUNCTION_ENTRY* PIMAGE_FUNCTION_ENTRY; +alias PIMAGE_FUNCTION_ENTRY = IMAGE_FUNCTION_ENTRY*; struct IMAGE_FUNCTION_ENTRY64 { ULONGLONG StartingAddress; @@ -3634,7 +3634,7 @@ struct IMAGE_FUNCTION_ENTRY64 { ULONGLONG UnwindInfoAddress; } } -alias IMAGE_FUNCTION_ENTRY64* PIMAGE_FUNCTION_ENTRY64; +alias PIMAGE_FUNCTION_ENTRY64 = IMAGE_FUNCTION_ENTRY64*; struct IMAGE_SEPARATE_DEBUG_HEADER { WORD Signature; @@ -3651,7 +3651,7 @@ struct IMAGE_SEPARATE_DEBUG_HEADER { DWORD SectionAlignment; DWORD[2] Reserved; } -alias IMAGE_SEPARATE_DEBUG_HEADER* PIMAGE_SEPARATE_DEBUG_HEADER; +alias PIMAGE_SEPARATE_DEBUG_HEADER = IMAGE_SEPARATE_DEBUG_HEADER*; enum SERVICE_NODE_TYPE { DriverType = SERVICE_KERNEL_DRIVER, @@ -3676,11 +3676,11 @@ enum SERVICE_ERROR_TYPE { SevereError = SERVICE_ERROR_SEVERE, CriticalError = SERVICE_ERROR_CRITICAL } -alias SERVICE_ERROR_TYPE _CM_ERROR_CONTROL_TYPE; +alias _CM_ERROR_CONTROL_TYPE = SERVICE_ERROR_TYPE; //DAC: According to MSJ, 'UnderTheHood', May 1996, this // structure is not documented in any official Microsoft header file. -alias void EXCEPTION_REGISTRATION_RECORD; +alias EXCEPTION_REGISTRATION_RECORD = void; align: struct NT_TIB { @@ -3695,7 +3695,7 @@ struct NT_TIB { PVOID ArbitraryUserPointer; NT_TIB *Self; } -alias NT_TIB* PNT_TIB; +alias PNT_TIB = NT_TIB*; struct REPARSE_DATA_BUFFER { DWORD ReparseTag; @@ -3732,7 +3732,7 @@ struct REPARSE_DATA_BUFFER { _MountPointReparseBuffer MountPointReparseBuffer; } } -alias REPARSE_DATA_BUFFER *PREPARSE_DATA_BUFFER; +alias PREPARSE_DATA_BUFFER = REPARSE_DATA_BUFFER *; struct REPARSE_GUID_DATA_BUFFER { DWORD ReparseTag; @@ -3746,7 +3746,7 @@ struct REPARSE_GUID_DATA_BUFFER { } _GenericReparseBuffer GenericReparseBuffer; } -alias REPARSE_GUID_DATA_BUFFER* PREPARSE_GUID_DATA_BUFFER; +alias PREPARSE_GUID_DATA_BUFFER = REPARSE_GUID_DATA_BUFFER*; enum size_t REPARSE_DATA_BUFFER_HEADER_SIZE = REPARSE_DATA_BUFFER.GenericReparseBuffer.offsetof, @@ -3758,13 +3758,13 @@ struct REPARSE_POINT_INFORMATION { WORD ReparseDataLength; WORD UnparsedNameLength; } -alias REPARSE_POINT_INFORMATION* PREPARSE_POINT_INFORMATION; +alias PREPARSE_POINT_INFORMATION = REPARSE_POINT_INFORMATION*; union FILE_SEGMENT_ELEMENT { PVOID64 Buffer; ULONGLONG Alignment; } -alias FILE_SEGMENT_ELEMENT* PFILE_SEGMENT_ELEMENT; +alias PFILE_SEGMENT_ELEMENT = FILE_SEGMENT_ELEMENT*; // JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants enum DWORD @@ -3842,7 +3842,7 @@ struct JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { DWORD ActiveProcesses; DWORD TotalTerminatedProcesses; } -alias JOBOBJECT_BASIC_ACCOUNTING_INFORMATION* PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; +alias PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = JOBOBJECT_BASIC_ACCOUNTING_INFORMATION*; struct JOBOBJECT_BASIC_LIMIT_INFORMATION { LARGE_INTEGER PerProcessUserTimeLimit; @@ -3855,7 +3855,7 @@ struct JOBOBJECT_BASIC_LIMIT_INFORMATION { DWORD PriorityClass; DWORD SchedulingClass; } -alias JOBOBJECT_BASIC_LIMIT_INFORMATION* PJOBOBJECT_BASIC_LIMIT_INFORMATION; +alias PJOBOBJECT_BASIC_LIMIT_INFORMATION = JOBOBJECT_BASIC_LIMIT_INFORMATION*; struct JOBOBJECT_BASIC_PROCESS_ID_LIST { DWORD NumberOfAssignedProcesses; @@ -3864,12 +3864,12 @@ struct JOBOBJECT_BASIC_PROCESS_ID_LIST { ULONG_PTR* ProcessIdList() return { return &_ProcessIdList; } } -alias JOBOBJECT_BASIC_PROCESS_ID_LIST* PJOBOBJECT_BASIC_PROCESS_ID_LIST; +alias PJOBOBJECT_BASIC_PROCESS_ID_LIST = JOBOBJECT_BASIC_PROCESS_ID_LIST*; struct JOBOBJECT_BASIC_UI_RESTRICTIONS { DWORD UIRestrictionsClass; } -alias JOBOBJECT_BASIC_UI_RESTRICTIONS* PJOBOBJECT_BASIC_UI_RESTRICTIONS; +alias PJOBOBJECT_BASIC_UI_RESTRICTIONS = JOBOBJECT_BASIC_UI_RESTRICTIONS*; struct JOBOBJECT_SECURITY_LIMIT_INFORMATION { DWORD SecurityLimitFlags; @@ -3878,24 +3878,24 @@ struct JOBOBJECT_SECURITY_LIMIT_INFORMATION { PTOKEN_PRIVILEGES PrivilegesToDelete; PTOKEN_GROUPS RestrictedSids; } -alias JOBOBJECT_SECURITY_LIMIT_INFORMATION* PJOBOBJECT_SECURITY_LIMIT_INFORMATION; +alias PJOBOBJECT_SECURITY_LIMIT_INFORMATION = JOBOBJECT_SECURITY_LIMIT_INFORMATION*; struct JOBOBJECT_END_OF_JOB_TIME_INFORMATION { DWORD EndOfJobTimeAction; } -alias JOBOBJECT_END_OF_JOB_TIME_INFORMATION* PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; +alias PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = JOBOBJECT_END_OF_JOB_TIME_INFORMATION*; struct JOBOBJECT_ASSOCIATE_COMPLETION_PORT { PVOID CompletionKey; HANDLE CompletionPort; } -alias JOBOBJECT_ASSOCIATE_COMPLETION_PORT* PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; +alias PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = JOBOBJECT_ASSOCIATE_COMPLETION_PORT*; struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; IO_COUNTERS IoInfo; } -alias JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; +alias PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION = JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION *; struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; @@ -3905,12 +3905,12 @@ struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { SIZE_T PeakProcessMemoryUsed; SIZE_T PeakJobMemoryUsed; } -alias JOBOBJECT_EXTENDED_LIMIT_INFORMATION* PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; +alias PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = JOBOBJECT_EXTENDED_LIMIT_INFORMATION*; struct JOBOBJECT_JOBSET_INFORMATION { DWORD MemberLevel; } -alias JOBOBJECT_JOBSET_INFORMATION* PJOBOBJECT_JOBSET_INFORMATION; +alias PJOBOBJECT_JOBSET_INFORMATION = JOBOBJECT_JOBSET_INFORMATION*; // MinGW: Making these defines conditional on _WIN32_WINNT will break ddk includes //static if (_WIN32_WINNT >= 0x500) { @@ -3926,7 +3926,7 @@ enum LATENCY_TIME { LT_DONT_CARE, LT_LOWEST_LATENCY } -alias LATENCY_TIME* PLATENCY_TIME; +alias PLATENCY_TIME = LATENCY_TIME*; enum SYSTEM_POWER_STATE { PowerSystemUnspecified, @@ -3938,7 +3938,7 @@ enum SYSTEM_POWER_STATE { PowerSystemShutdown, PowerSystemMaximum } -alias SYSTEM_POWER_STATE* PSYSTEM_POWER_STATE; +alias PSYSTEM_POWER_STATE = SYSTEM_POWER_STATE*; enum POWER_SYSTEM_MAXIMUM = SYSTEM_POWER_STATE.PowerSystemMaximum; @@ -3952,7 +3952,7 @@ enum POWER_ACTION { PowerActionShutdownOff, PowerActionWarmEject } -alias POWER_ACTION* PPOWER_ACTION; +alias PPOWER_ACTION = POWER_ACTION*; static if (_WIN32_WINNT >= 0x600) { enum SYSTEM_POWER_CONDITION { @@ -3961,7 +3961,7 @@ static if (_WIN32_WINNT >= 0x600) { PoHot, PoConditionMaximum } - alias SYSTEM_POWER_CONDITION* PSYSTEM_POWER_CONDITION; + alias PSYSTEM_POWER_CONDITION = SYSTEM_POWER_CONDITION*; } enum DEVICE_POWER_STATE { @@ -3972,21 +3972,21 @@ enum DEVICE_POWER_STATE { PowerDeviceD3, PowerDeviceMaximum } -alias DEVICE_POWER_STATE* PDEVICE_POWER_STATE; +alias PDEVICE_POWER_STATE = DEVICE_POWER_STATE*; align(4): struct BATTERY_REPORTING_SCALE { DWORD Granularity; DWORD Capacity; } -alias BATTERY_REPORTING_SCALE* PBATTERY_REPORTING_SCALE; +alias PBATTERY_REPORTING_SCALE = BATTERY_REPORTING_SCALE*; struct POWER_ACTION_POLICY { POWER_ACTION Action; ULONG Flags; ULONG EventCode; } -alias POWER_ACTION_POLICY* PPOWER_ACTION_POLICY; +alias PPOWER_ACTION_POLICY = POWER_ACTION_POLICY*; // POWER_ACTION_POLICY.Flags constants enum ULONG @@ -4027,7 +4027,7 @@ struct SYSTEM_POWER_LEVEL { POWER_ACTION_POLICY PowerPolicy; SYSTEM_POWER_STATE MinSystemState; } -alias SYSTEM_POWER_LEVEL* PSYSTEM_POWER_LEVEL; +alias PSYSTEM_POWER_LEVEL = SYSTEM_POWER_LEVEL*; struct SYSTEM_POWER_POLICY { ULONG Revision; @@ -4059,7 +4059,7 @@ struct SYSTEM_POWER_POLICY { UCHAR MinThrottle; POWER_ACTION_POLICY OverThrottled; } -alias SYSTEM_POWER_POLICY* PSYSTEM_POWER_POLICY; +alias PSYSTEM_POWER_POLICY = SYSTEM_POWER_POLICY*; struct SYSTEM_POWER_CAPABILITIES { BOOLEAN PowerButtonPresent; @@ -4091,7 +4091,7 @@ struct SYSTEM_POWER_CAPABILITIES { SYSTEM_POWER_STATE MinDeviceWakeState; SYSTEM_POWER_STATE DefaultLowLatencyWake; } -alias SYSTEM_POWER_CAPABILITIES* PSYSTEM_POWER_CAPABILITIES; +alias PSYSTEM_POWER_CAPABILITIES = SYSTEM_POWER_CAPABILITIES*; struct SYSTEM_BATTERY_STATE { BOOLEAN AcOnLine; @@ -4106,7 +4106,7 @@ struct SYSTEM_BATTERY_STATE { ULONG DefaultAlert1; ULONG DefaultAlert2; } -alias SYSTEM_BATTERY_STATE* PSYSTEM_BATTERY_STATE; +alias PSYSTEM_BATTERY_STATE = SYSTEM_BATTERY_STATE*; enum POWER_INFORMATION_LEVEL { SystemPowerPolicyAc, @@ -4141,7 +4141,7 @@ struct SYSTEM_POWER_INFORMATION { ULONG TimeRemaining; UCHAR CoolingMode; } -alias SYSTEM_POWER_INFORMATION* PSYSTEM_POWER_INFORMATION; +alias PSYSTEM_POWER_INFORMATION = SYSTEM_POWER_INFORMATION*; //#endif struct PROCESSOR_POWER_POLICY_INFO { @@ -4164,7 +4164,7 @@ struct PROCESSOR_POWER_POLICY_INFO { ULONG Reserved : 30; +/ } -alias PROCESSOR_POWER_POLICY_INFO* PPROCESSOR_POWER_POLICY_INFO; +alias PPROCESSOR_POWER_POLICY_INFO = PROCESSOR_POWER_POLICY_INFO*; struct PROCESSOR_POWER_POLICY { ULONG Revision; @@ -4174,7 +4174,7 @@ struct PROCESSOR_POWER_POLICY { ULONG PolicyCount; PROCESSOR_POWER_POLICY_INFO[3] Policy; } -alias PROCESSOR_POWER_POLICY* PPROCESSOR_POWER_POLICY; +alias PPROCESSOR_POWER_POLICY = PROCESSOR_POWER_POLICY*; struct ADMINISTRATOR_POWER_POLICY { SYSTEM_POWER_STATE MinSleep; @@ -4184,16 +4184,16 @@ struct ADMINISTRATOR_POWER_POLICY { ULONG MinSpindownTimeout; ULONG MaxSpindownTimeout; } -alias ADMINISTRATOR_POWER_POLICY* PADMINISTRATOR_POWER_POLICY; +alias PADMINISTRATOR_POWER_POLICY = ADMINISTRATOR_POWER_POLICY*; //}//#endif /* _WIN32_WINNT >= 0x500 */ extern (Windows) { - alias void function(PVOID, DWORD, PVOID) PIMAGE_TLS_CALLBACK; + alias PIMAGE_TLS_CALLBACK = void function(PVOID, DWORD, PVOID); static if (_WIN32_WINNT >= 0x500) { - alias LONG function(PEXCEPTION_POINTERS) PVECTORED_EXCEPTION_HANDLER; - alias void function(PVOID, BOOLEAN) WAITORTIMERCALLBACKFUNC; + alias PVECTORED_EXCEPTION_HANDLER = LONG function(PEXCEPTION_POINTERS); + alias WAITORTIMERCALLBACKFUNC = void function(PVOID, BOOLEAN); } } @@ -4229,10 +4229,8 @@ static if (_WIN32_WINNT >= 0x501) { PCWSTR lpAssemblyPolicyPath; PCWSTR lpAssemblyDirectoryName; } - alias ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION* - PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; - alias const(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION)* - PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; + alias PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION*; + alias PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION = const(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION)*; struct ACTIVATION_CONTEXT_DETAILED_INFORMATION { DWORD dwFlags; @@ -4248,17 +4246,15 @@ static if (_WIN32_WINNT >= 0x501) { PCWSTR lpRootConfigurationPath; PCWSTR lpAppDirPath; } - alias ACTIVATION_CONTEXT_DETAILED_INFORMATION* - PACTIVATION_CONTEXT_DETAILED_INFORMATION; - alias const(ACTIVATION_CONTEXT_DETAILED_INFORMATION)* - PCACTIVATION_CONTEXT_DETAILED_INFORMATION; + alias PACTIVATION_CONTEXT_DETAILED_INFORMATION = ACTIVATION_CONTEXT_DETAILED_INFORMATION*; + alias PCACTIVATION_CONTEXT_DETAILED_INFORMATION = const(ACTIVATION_CONTEXT_DETAILED_INFORMATION)*; struct ACTIVATION_CONTEXT_QUERY_INDEX { ULONG ulAssemblyIndex; ULONG ulFileIndexInAssembly; } - alias ACTIVATION_CONTEXT_QUERY_INDEX* PACTIVATION_CONTEXT_QUERY_INDEX; - alias const(ACTIVATION_CONTEXT_QUERY_INDEX)* PCACTIVATION_CONTEXT_QUERY_INDEX; + alias PACTIVATION_CONTEXT_QUERY_INDEX = ACTIVATION_CONTEXT_QUERY_INDEX*; + alias PCACTIVATION_CONTEXT_QUERY_INDEX = const(ACTIVATION_CONTEXT_QUERY_INDEX)*; struct ASSEMBLY_FILE_DETAILED_INFORMATION { DWORD ulFlags; @@ -4267,22 +4263,20 @@ static if (_WIN32_WINNT >= 0x501) { PCWSTR lpFileName; PCWSTR lpFilePath; } - alias ASSEMBLY_FILE_DETAILED_INFORMATION* - PASSEMBLY_FILE_DETAILED_INFORMATION; - alias const(ASSEMBLY_FILE_DETAILED_INFORMATION)* - PCASSEMBLY_FILE_DETAILED_INFORMATION; + alias PASSEMBLY_FILE_DETAILED_INFORMATION = ASSEMBLY_FILE_DETAILED_INFORMATION*; + alias PCASSEMBLY_FILE_DETAILED_INFORMATION = const(ASSEMBLY_FILE_DETAILED_INFORMATION)*; } version (Unicode) { - alias OSVERSIONINFOW OSVERSIONINFO; - alias OSVERSIONINFOEXW OSVERSIONINFOEX; + alias OSVERSIONINFO = OSVERSIONINFOW; + alias OSVERSIONINFOEX = OSVERSIONINFOEXW; } else { - alias OSVERSIONINFOA OSVERSIONINFO; - alias OSVERSIONINFOEXA OSVERSIONINFOEX; + alias OSVERSIONINFO = OSVERSIONINFOA; + alias OSVERSIONINFOEX = OSVERSIONINFOEXA; } -alias OSVERSIONINFO* POSVERSIONINFO, LPOSVERSIONINFO; -alias OSVERSIONINFOEX* POSVERSIONINFOEX, LPOSVERSIONINFOEX; +alias POSVERSIONINFO = OSVERSIONINFO*, LPOSVERSIONINFO = OSVERSIONINFO*; +alias POSVERSIONINFOEX = OSVERSIONINFOEX*, LPOSVERSIONINFOEX = OSVERSIONINFOEX*; static if (_WIN32_WINNT >= 0x500) { @@ -4292,29 +4286,29 @@ static if (_WIN32_WINNT >= 0x500) { version (Win64) { enum WORD IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR64_MAGIC; - alias IMAGE_ORDINAL_FLAG64 IMAGE_ORDINAL_FLAG; - alias IMAGE_SNAP_BY_ORDINAL64 IMAGE_SNAP_BY_ORDINAL; - alias IMAGE_ORDINAL64 IMAGE_ORDINAL; - alias IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; - alias IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; - alias IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; - alias IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; + alias IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG64; + alias IMAGE_SNAP_BY_ORDINAL = IMAGE_SNAP_BY_ORDINAL64; + alias IMAGE_ORDINAL = IMAGE_ORDINAL64; + alias IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64; + alias IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64; + alias IMAGE_THUNK_DATA = IMAGE_THUNK_DATA64; + alias IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY64; } else { enum WORD IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR32_MAGIC; - alias IMAGE_ORDINAL_FLAG32 IMAGE_ORDINAL_FLAG; - alias IMAGE_ORDINAL32 IMAGE_ORDINAL; - alias IMAGE_SNAP_BY_ORDINAL32 IMAGE_SNAP_BY_ORDINAL; - alias IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; - alias IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; - alias IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; - alias IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; + alias IMAGE_ORDINAL_FLAG = IMAGE_ORDINAL_FLAG32; + alias IMAGE_ORDINAL = IMAGE_ORDINAL32; + alias IMAGE_SNAP_BY_ORDINAL = IMAGE_SNAP_BY_ORDINAL32; + alias IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32; + alias IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32; + alias IMAGE_THUNK_DATA = IMAGE_THUNK_DATA32; + alias IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY32; } -alias IMAGE_OPTIONAL_HEADER* PIMAGE_OPTIONAL_HEADER; -alias IMAGE_NT_HEADERS* PIMAGE_NT_HEADERS; -alias IMAGE_THUNK_DATA* PIMAGE_THUNK_DATA; -alias IMAGE_TLS_DIRECTORY* PIMAGE_TLS_DIRECTORY; +alias PIMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER*; +alias PIMAGE_NT_HEADERS = IMAGE_NT_HEADERS*; +alias PIMAGE_THUNK_DATA = IMAGE_THUNK_DATA*; +alias PIMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY*; // TODO: MinGW implements these in assembly. How to translate? PVOID GetCurrentFiber(); diff --git a/runtime/druntime/src/core/sys/windows/winperf.d b/runtime/druntime/src/core/sys/windows/winperf.d index 77638c88af5..111dcb2bae1 100644 --- a/runtime/druntime/src/core/sys/windows/winperf.d +++ b/runtime/druntime/src/core/sys/windows/winperf.d @@ -97,7 +97,7 @@ struct PERF_DATA_BLOCK { DWORD SystemNameLength; DWORD SystemNameOffset; } -alias PERF_DATA_BLOCK * PPERF_DATA_BLOCK; +alias PPERF_DATA_BLOCK = PERF_DATA_BLOCK *; struct PERF_OBJECT_TYPE { DWORD TotalByteLength; @@ -123,7 +123,7 @@ version (Win64) { LARGE_INTEGER PerfTime; LARGE_INTEGER PerfFreq; } -alias PERF_OBJECT_TYPE * PPERF_OBJECT_TYPE; +alias PPERF_OBJECT_TYPE = PERF_OBJECT_TYPE *; struct PERF_COUNTER_DEFINITION { DWORD ByteLength; @@ -145,7 +145,7 @@ version (Win64) { DWORD CounterSize; DWORD CounterOffset; } -alias PERF_COUNTER_DEFINITION * PPERF_COUNTER_DEFINITION; +alias PPERF_COUNTER_DEFINITION = PERF_COUNTER_DEFINITION *; struct PERF_INSTANCE_DEFINITION { DWORD ByteLength; @@ -155,14 +155,14 @@ struct PERF_INSTANCE_DEFINITION { DWORD NameOffset; DWORD NameLength; } -alias PERF_INSTANCE_DEFINITION * PPERF_INSTANCE_DEFINITION; +alias PPERF_INSTANCE_DEFINITION = PERF_INSTANCE_DEFINITION *; struct PERF_COUNTER_BLOCK { DWORD ByteLength; } -alias PERF_COUNTER_BLOCK * PPERF_COUNTER_BLOCK; +alias PPERF_COUNTER_BLOCK = PERF_COUNTER_BLOCK *; extern (Windows): -alias DWORD function (LPWSTR) PM_OPEN_PROC; -alias DWORD function (LPWSTR,PVOID*,PDWORD,PDWORD) PM_COLLECT_PROC; -alias DWORD function () PM_CLOSE_PROC; +alias PM_OPEN_PROC = DWORD function (LPWSTR); +alias PM_COLLECT_PROC = DWORD function (LPWSTR,PVOID*,PDWORD,PDWORD); +alias PM_CLOSE_PROC = DWORD function (); diff --git a/runtime/druntime/src/core/sys/windows/winreg.d b/runtime/druntime/src/core/sys/windows/winreg.d index 6bffe88f251..d1add92c6df 100644 --- a/runtime/druntime/src/core/sys/windows/winreg.d +++ b/runtime/druntime/src/core/sys/windows/winreg.d @@ -60,7 +60,7 @@ enum DWORD REG_NOTIFY_CHANGE_LAST_SET = 4, REG_NOTIFY_CHANGE_SECURITY = 8; -alias ACCESS_MASK REGSAM; +alias REGSAM = ACCESS_MASK; struct VALENTA { LPSTR ve_valuename; @@ -68,7 +68,7 @@ struct VALENTA { DWORD_PTR ve_valueptr; DWORD ve_type; } -alias VALENTA* PVALENTA; +alias PVALENTA = VALENTA*; struct VALENTW { LPWSTR ve_valuename; @@ -76,7 +76,7 @@ struct VALENTW { DWORD_PTR ve_valueptr; DWORD ve_type; } -alias VALENTW* PVALENTW; +alias PVALENTW = VALENTW*; // RRF - Registry Routine Flags (for RegGetValue) static if (_WIN32_WINNT >= 0x600) { @@ -184,72 +184,72 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias VALENTW VALENT; - alias RegConnectRegistryW RegConnectRegistry; - alias RegCreateKeyExW RegCreateKeyEx; - alias RegDeleteKeyW RegDeleteKey; - alias RegDeleteValueW RegDeleteValue; - alias RegEnumKeyExW RegEnumKeyEx; - alias RegEnumValueW RegEnumValue; - alias RegLoadKeyW RegLoadKey; - alias RegOpenKeyExW RegOpenKeyEx; - alias RegQueryInfoKeyW RegQueryInfoKey; - alias RegQueryMultipleValuesW RegQueryMultipleValues; - alias RegQueryValueExW RegQueryValueEx; - alias RegReplaceKeyW RegReplaceKey; - alias RegSaveKeyW RegSaveKey; - alias RegSetValueExW RegSetValueEx; - alias RegUnLoadKeyW RegUnLoadKey; - - alias AbortSystemShutdownW AbortSystemShutdown; - alias InitiateSystemShutdownW InitiateSystemShutdown; - alias RegRestoreKeyW RegRestoreKey; + alias VALENT = VALENTW; + alias RegConnectRegistry = RegConnectRegistryW; + alias RegCreateKeyEx = RegCreateKeyExW; + alias RegDeleteKey = RegDeleteKeyW; + alias RegDeleteValue = RegDeleteValueW; + alias RegEnumKeyEx = RegEnumKeyExW; + alias RegEnumValue = RegEnumValueW; + alias RegLoadKey = RegLoadKeyW; + alias RegOpenKeyEx = RegOpenKeyExW; + alias RegQueryInfoKey = RegQueryInfoKeyW; + alias RegQueryMultipleValues = RegQueryMultipleValuesW; + alias RegQueryValueEx = RegQueryValueExW; + alias RegReplaceKey = RegReplaceKeyW; + alias RegSaveKey = RegSaveKeyW; + alias RegSetValueEx = RegSetValueExW; + alias RegUnLoadKey = RegUnLoadKeyW; + + alias AbortSystemShutdown = AbortSystemShutdownW; + alias InitiateSystemShutdown = InitiateSystemShutdownW; + alias RegRestoreKey = RegRestoreKeyW; static if (_WIN32_WINNT >= 0x501) { - alias RegSaveKeyExA RegSaveKeyEx; + alias RegSaveKeyEx = RegSaveKeyExA; } static if (_WIN32_WINNT >= 0x600) { - alias RegGetValueW RegGetValue; + alias RegGetValue = RegGetValueW; } //deprecated { - alias RegCreateKeyW RegCreateKey; - alias RegEnumKeyW RegEnumKey; - alias RegOpenKeyW RegOpenKey; - alias RegQueryValueW RegQueryValue; - alias RegSetValueW RegSetValue; + alias RegCreateKey = RegCreateKeyW; + alias RegEnumKey = RegEnumKeyW; + alias RegOpenKey = RegOpenKeyW; + alias RegQueryValue = RegQueryValueW; + alias RegSetValue = RegSetValueW; //} } else { - alias VALENTA VALENT; - alias RegConnectRegistryA RegConnectRegistry; - alias RegCreateKeyExA RegCreateKeyEx; - alias RegDeleteKeyA RegDeleteKey; - alias RegDeleteValueA RegDeleteValue; - alias RegEnumKeyExA RegEnumKeyEx; - alias RegEnumValueA RegEnumValue; - alias RegLoadKeyA RegLoadKey; - alias RegOpenKeyExA RegOpenKeyEx; - alias RegQueryInfoKeyA RegQueryInfoKey; - alias RegQueryMultipleValuesA RegQueryMultipleValues; - alias RegQueryValueExA RegQueryValueEx; - alias RegReplaceKeyA RegReplaceKey; - alias RegSaveKeyA RegSaveKey; - alias RegSetValueExA RegSetValueEx; - alias RegUnLoadKeyA RegUnLoadKey; - alias AbortSystemShutdownA AbortSystemShutdown; - alias InitiateSystemShutdownA InitiateSystemShutdown; - alias RegRestoreKeyW RegRestoreKey; + alias VALENT = VALENTA; + alias RegConnectRegistry = RegConnectRegistryA; + alias RegCreateKeyEx = RegCreateKeyExA; + alias RegDeleteKey = RegDeleteKeyA; + alias RegDeleteValue = RegDeleteValueA; + alias RegEnumKeyEx = RegEnumKeyExA; + alias RegEnumValue = RegEnumValueA; + alias RegLoadKey = RegLoadKeyA; + alias RegOpenKeyEx = RegOpenKeyExA; + alias RegQueryInfoKey = RegQueryInfoKeyA; + alias RegQueryMultipleValues = RegQueryMultipleValuesA; + alias RegQueryValueEx = RegQueryValueExA; + alias RegReplaceKey = RegReplaceKeyA; + alias RegSaveKey = RegSaveKeyA; + alias RegSetValueEx = RegSetValueExA; + alias RegUnLoadKey = RegUnLoadKeyA; + alias AbortSystemShutdown = AbortSystemShutdownA; + alias InitiateSystemShutdown = InitiateSystemShutdownA; + alias RegRestoreKey = RegRestoreKeyW; static if (_WIN32_WINNT >= 0x501) { - alias RegSaveKeyExA RegSaveKeyEx; + alias RegSaveKeyEx = RegSaveKeyExA; } static if (_WIN32_WINNT >= 0x600) { - alias RegGetValueA RegGetValue; + alias RegGetValue = RegGetValueA; } //deprecated { - alias RegCreateKeyA RegCreateKey; - alias RegEnumKeyA RegEnumKey; - alias RegOpenKeyA RegOpenKey; - alias RegQueryValueA RegQueryValue; - alias RegSetValueA RegSetValue; + alias RegCreateKey = RegCreateKeyA; + alias RegEnumKey = RegEnumKeyA; + alias RegOpenKey = RegOpenKeyA; + alias RegQueryValue = RegQueryValueA; + alias RegSetValue = RegSetValueA; //} } -alias VALENT* PVALENT; +alias PVALENT = VALENT*; diff --git a/runtime/druntime/src/core/sys/windows/winsock2.d b/runtime/druntime/src/core/sys/windows/winsock2.d index 626f79e89c5..c2cc1864e1d 100644 --- a/runtime/druntime/src/core/sys/windows/winsock2.d +++ b/runtime/druntime/src/core/sys/windows/winsock2.d @@ -653,8 +653,8 @@ struct sockaddr short sa_family; ubyte[14] sa_data; } -alias sockaddr SOCKADDR; -alias SOCKADDR* PSOCKADDR, LPSOCKADDR; +alias SOCKADDR = sockaddr; +alias PSOCKADDR = SOCKADDR*, LPSOCKADDR = SOCKADDR*; struct sockaddr_storage { @@ -663,8 +663,8 @@ struct sockaddr_storage long __ss_align; char[112] __ss_pad2 = void; } -alias sockaddr_storage SOCKADDR_STORAGE; -alias SOCKADDR_STORAGE* PSOCKADDR_STORAGE; +alias SOCKADDR_STORAGE = sockaddr_storage; +alias PSOCKADDR_STORAGE = SOCKADDR_STORAGE*; struct sockaddr_in { @@ -673,8 +673,8 @@ struct sockaddr_in in_addr sin_addr; ubyte[8] sin_zero; } -alias sockaddr_in SOCKADDR_IN; -alias SOCKADDR_IN* PSOCKADDR_IN, LPSOCKADDR_IN; +alias SOCKADDR_IN = sockaddr_in; +alias PSOCKADDR_IN = SOCKADDR_IN*, LPSOCKADDR_IN = SOCKADDR_IN*; struct sockaddr_in6 diff --git a/runtime/druntime/src/core/sys/windows/winspool.d b/runtime/druntime/src/core/sys/windows/winspool.d index 12942fb7712..2827efef103 100644 --- a/runtime/druntime/src/core/sys/windows/winspool.d +++ b/runtime/druntime/src/core/sys/windows/winspool.d @@ -251,23 +251,23 @@ struct ADDJOB_INFO_1A { LPSTR Path; DWORD JobId; } -alias ADDJOB_INFO_1A* PADDJOB_INFO_1A, LPADDJOB_INFO_1A; +alias PADDJOB_INFO_1A = ADDJOB_INFO_1A*, LPADDJOB_INFO_1A = ADDJOB_INFO_1A*; struct ADDJOB_INFO_1W { LPWSTR Path; DWORD JobId; } -alias ADDJOB_INFO_1W* PADDJOB_INFO_1W, LPADDJOB_INFO_1W; +alias PADDJOB_INFO_1W = ADDJOB_INFO_1W*, LPADDJOB_INFO_1W = ADDJOB_INFO_1W*; struct DATATYPES_INFO_1A { LPSTR pName; } -alias DATATYPES_INFO_1A* PDATATYPES_INFO_1A, LPDATATYPES_INFO_1A; +alias PDATATYPES_INFO_1A = DATATYPES_INFO_1A*, LPDATATYPES_INFO_1A = DATATYPES_INFO_1A*; struct DATATYPES_INFO_1W { LPWSTR pName; } -alias DATATYPES_INFO_1W* PDATATYPES_INFO_1W, LPDATATYPES_INFO_1W; +alias PDATATYPES_INFO_1W = DATATYPES_INFO_1W*, LPDATATYPES_INFO_1W = DATATYPES_INFO_1W*; struct JOB_INFO_1A { DWORD JobId; @@ -284,7 +284,7 @@ struct JOB_INFO_1A { DWORD PagesPrinted; SYSTEMTIME Submitted; } -alias JOB_INFO_1A* PJOB_INFO_1A, LPJOB_INFO_1A; +alias PJOB_INFO_1A = JOB_INFO_1A*, LPJOB_INFO_1A = JOB_INFO_1A*; struct JOB_INFO_1W { DWORD JobId; @@ -301,7 +301,7 @@ struct JOB_INFO_1W { DWORD PagesPrinted; SYSTEMTIME Submitted; } -alias JOB_INFO_1W* PJOB_INFO_1W, LPJOB_INFO_1W; +alias PJOB_INFO_1W = JOB_INFO_1W*, LPJOB_INFO_1W = JOB_INFO_1W*; struct JOB_INFO_2A { DWORD JobId; @@ -328,7 +328,7 @@ struct JOB_INFO_2A { DWORD Time; DWORD PagesPrinted; } -alias JOB_INFO_2A* PJOB_INFO_2A, LPJOB_INFO_2A; +alias PJOB_INFO_2A = JOB_INFO_2A*, LPJOB_INFO_2A = JOB_INFO_2A*; struct JOB_INFO_2W { DWORD JobId; @@ -355,21 +355,21 @@ struct JOB_INFO_2W { DWORD Time; DWORD PagesPrinted; } -alias JOB_INFO_2W* PJOB_INFO_2W, LPJOB_INFO_2W; +alias PJOB_INFO_2W = JOB_INFO_2W*, LPJOB_INFO_2W = JOB_INFO_2W*; struct DOC_INFO_1A { LPSTR pDocName; LPSTR pOutputFile; LPSTR pDatatype; } -alias DOC_INFO_1A* PDOC_INFO_1A, LPDOC_INFO_1A; +alias PDOC_INFO_1A = DOC_INFO_1A*, LPDOC_INFO_1A = DOC_INFO_1A*; struct DOC_INFO_1W { LPWSTR pDocName; LPWSTR pOutputFile; LPWSTR pDatatype; } -alias DOC_INFO_1W* PDOC_INFO_1W, LPDOC_INFO_1W; +alias PDOC_INFO_1W = DOC_INFO_1W*, LPDOC_INFO_1W = DOC_INFO_1W*; struct DOC_INFO_2A { LPSTR pDocName; @@ -378,7 +378,7 @@ struct DOC_INFO_2A { DWORD dwMode; DWORD JobId; } -alias DOC_INFO_2A* PDOC_INFO_2A, LPDOC_INFO_2A; +alias PDOC_INFO_2A = DOC_INFO_2A*, LPDOC_INFO_2A = DOC_INFO_2A*; struct DOC_INFO_2W { LPWSTR pDocName; @@ -387,17 +387,17 @@ struct DOC_INFO_2W { DWORD dwMode; DWORD JobId; } -alias DOC_INFO_2W* PDOC_INFO_2W, LPDOC_INFO_2W; +alias PDOC_INFO_2W = DOC_INFO_2W*, LPDOC_INFO_2W = DOC_INFO_2W*; struct DRIVER_INFO_1A { LPSTR pName; } -alias DRIVER_INFO_1A* PDRIVER_INFO_1A, LPDRIVER_INFO_1A; +alias PDRIVER_INFO_1A = DRIVER_INFO_1A*, LPDRIVER_INFO_1A = DRIVER_INFO_1A*; struct DRIVER_INFO_1W { LPWSTR pName; } -alias DRIVER_INFO_1W* PDRIVER_INFO_1W, LPDRIVER_INFO_1W; +alias PDRIVER_INFO_1W = DRIVER_INFO_1W*, LPDRIVER_INFO_1W = DRIVER_INFO_1W*; struct DRIVER_INFO_2A { DWORD cVersion; @@ -407,7 +407,7 @@ struct DRIVER_INFO_2A { LPSTR pDataFile; LPSTR pConfigFile; } -alias DRIVER_INFO_2A* PDRIVER_INFO_2A, LPDRIVER_INFO_2A; +alias PDRIVER_INFO_2A = DRIVER_INFO_2A*, LPDRIVER_INFO_2A = DRIVER_INFO_2A*; struct DRIVER_INFO_2W { DWORD cVersion; @@ -417,7 +417,7 @@ struct DRIVER_INFO_2W { LPWSTR pDataFile; LPWSTR pConfigFile; } -alias DRIVER_INFO_2W* PDRIVER_INFO_2W, LPDRIVER_INFO_2W; +alias PDRIVER_INFO_2W = DRIVER_INFO_2W*, LPDRIVER_INFO_2W = DRIVER_INFO_2W*; struct DRIVER_INFO_3A { DWORD cVersion; @@ -431,7 +431,7 @@ struct DRIVER_INFO_3A { LPSTR pMonitorName; LPSTR pDefaultDataType; } -alias DRIVER_INFO_3A* PDRIVER_INFO_3A, LPDRIVER_INFO_3A; +alias PDRIVER_INFO_3A = DRIVER_INFO_3A*, LPDRIVER_INFO_3A = DRIVER_INFO_3A*; struct DRIVER_INFO_3W { DWORD cVersion; @@ -445,41 +445,41 @@ struct DRIVER_INFO_3W { LPWSTR pMonitorName; LPWSTR pDefaultDataType; } -alias DRIVER_INFO_3W* PDRIVER_INFO_3W, LPDRIVER_INFO_3W; +alias PDRIVER_INFO_3W = DRIVER_INFO_3W*, LPDRIVER_INFO_3W = DRIVER_INFO_3W*; struct MONITOR_INFO_1A { LPSTR pName; } -alias MONITOR_INFO_1A* PMONITOR_INFO_1A, LPMONITOR_INFO_1A; +alias PMONITOR_INFO_1A = MONITOR_INFO_1A*, LPMONITOR_INFO_1A = MONITOR_INFO_1A*; struct MONITOR_INFO_1W { LPWSTR pName; } -alias MONITOR_INFO_1W* PMONITOR_INFO_1W, LPMONITOR_INFO_1W; +alias PMONITOR_INFO_1W = MONITOR_INFO_1W*, LPMONITOR_INFO_1W = MONITOR_INFO_1W*; struct PORT_INFO_1A { LPSTR pName; } -alias PORT_INFO_1A* PPORT_INFO_1A, LPPORT_INFO_1A; +alias PPORT_INFO_1A = PORT_INFO_1A*, LPPORT_INFO_1A = PORT_INFO_1A*; struct PORT_INFO_1W { LPWSTR pName; } -alias PORT_INFO_1W* PPORT_INFO_1W, LPPORT_INFO_1W; +alias PPORT_INFO_1W = PORT_INFO_1W*, LPPORT_INFO_1W = PORT_INFO_1W*; struct MONITOR_INFO_2A { LPSTR pName; LPSTR pEnvironment; LPSTR pDLLName; } -alias MONITOR_INFO_2A* PMONITOR_INFO_2A, LPMONITOR_INFO_2A; +alias PMONITOR_INFO_2A = MONITOR_INFO_2A*, LPMONITOR_INFO_2A = MONITOR_INFO_2A*; struct MONITOR_INFO_2W { LPWSTR pName; LPWSTR pEnvironment; LPWSTR pDLLName; } -alias MONITOR_INFO_2W* PMONITOR_INFO_2W, LPMONITOR_INFO_2W; +alias PMONITOR_INFO_2W = MONITOR_INFO_2W*, LPMONITOR_INFO_2W = MONITOR_INFO_2W*; struct PORT_INFO_2A { LPSTR pPortName; @@ -488,7 +488,7 @@ struct PORT_INFO_2A { DWORD fPortType; DWORD Reserved; } -alias PORT_INFO_2A* PPORT_INFO_2A, LPPORT_INFO_2A; +alias PPORT_INFO_2A = PORT_INFO_2A*, LPPORT_INFO_2A = PORT_INFO_2A*; struct PORT_INFO_2W { LPWSTR pPortName; @@ -497,21 +497,21 @@ struct PORT_INFO_2W { DWORD fPortType; DWORD Reserved; } -alias PORT_INFO_2W* PPORT_INFO_2W, LPPORT_INFO_2W; +alias PPORT_INFO_2W = PORT_INFO_2W*, LPPORT_INFO_2W = PORT_INFO_2W*; struct PORT_INFO_3A { DWORD dwStatus; LPSTR pszStatus; DWORD dwSeverity; } -alias PORT_INFO_3A* PPORT_INFO_3A, LPPORT_INFO_3A; +alias PPORT_INFO_3A = PORT_INFO_3A*, LPPORT_INFO_3A = PORT_INFO_3A*; struct PORT_INFO_3W { DWORD dwStatus; LPWSTR pszStatus; DWORD dwSeverity; } -alias PORT_INFO_3W* PPORT_INFO_3W, LPPORT_INFO_3W; +alias PPORT_INFO_3W = PORT_INFO_3W*, LPPORT_INFO_3W = PORT_INFO_3W*; struct PRINTER_INFO_1A { DWORD Flags; @@ -519,7 +519,7 @@ struct PRINTER_INFO_1A { LPSTR pName; LPSTR pComment; } -alias PRINTER_INFO_1A* PPRINTER_INFO_1A, LPPRINTER_INFO_1A; +alias PPRINTER_INFO_1A = PRINTER_INFO_1A*, LPPRINTER_INFO_1A = PRINTER_INFO_1A*; struct PRINTER_INFO_1W { DWORD Flags; @@ -527,7 +527,7 @@ struct PRINTER_INFO_1W { LPWSTR pName; LPWSTR pComment; } -alias PRINTER_INFO_1W* PPRINTER_INFO_1W, LPPRINTER_INFO_1W; +alias PPRINTER_INFO_1W = PRINTER_INFO_1W*, LPPRINTER_INFO_1W = PRINTER_INFO_1W*; struct PRINTER_INFO_2A { LPSTR pServerName; @@ -552,7 +552,7 @@ struct PRINTER_INFO_2A { DWORD cJobs; DWORD AveragePPM; } -alias PRINTER_INFO_2A* PPRINTER_INFO_2A, LPPRINTER_INFO_2A; +alias PPRINTER_INFO_2A = PRINTER_INFO_2A*, LPPRINTER_INFO_2A = PRINTER_INFO_2A*; struct PRINTER_INFO_2W { LPWSTR pServerName; @@ -577,26 +577,26 @@ struct PRINTER_INFO_2W { DWORD cJobs; DWORD AveragePPM; } -alias PRINTER_INFO_2W* PPRINTER_INFO_2W, LPPRINTER_INFO_2W; +alias PPRINTER_INFO_2W = PRINTER_INFO_2W*, LPPRINTER_INFO_2W = PRINTER_INFO_2W*; struct PRINTER_INFO_3 { PSECURITY_DESCRIPTOR pSecurityDescriptor; } -alias PRINTER_INFO_3* PPRINTER_INFO_3, LPPRINTER_INFO_3; +alias PPRINTER_INFO_3 = PRINTER_INFO_3*, LPPRINTER_INFO_3 = PRINTER_INFO_3*; struct PRINTER_INFO_4A { LPSTR pPrinterName; LPSTR pServerName; DWORD Attributes; } -alias PRINTER_INFO_4A* PPRINTER_INFO_4A, LPPRINTER_INFO_4A; +alias PPRINTER_INFO_4A = PRINTER_INFO_4A*, LPPRINTER_INFO_4A = PRINTER_INFO_4A*; struct PRINTER_INFO_4W { LPWSTR pPrinterName; LPWSTR pServerName; DWORD Attributes; } -alias PRINTER_INFO_4W* PPRINTER_INFO_4W, LPPRINTER_INFO_4W; +alias PPRINTER_INFO_4W = PRINTER_INFO_4W*, LPPRINTER_INFO_4W = PRINTER_INFO_4W*; struct PRINTER_INFO_5A { LPSTR pPrinterName; @@ -605,7 +605,7 @@ struct PRINTER_INFO_5A { DWORD DeviceNotSelectedTimeout; DWORD TransmissionRetryTimeout; } -alias PRINTER_INFO_5A* PPRINTER_INFO_5A, LPPRINTER_INFO_5A; +alias PPRINTER_INFO_5A = PRINTER_INFO_5A*, LPPRINTER_INFO_5A = PRINTER_INFO_5A*; struct PRINTER_INFO_5W { LPWSTR pPrinterName; @@ -614,22 +614,22 @@ struct PRINTER_INFO_5W { DWORD DeviceNotSelectedTimeout; DWORD TransmissionRetryTimeout; } -alias PRINTER_INFO_5W* PPRINTER_INFO_5W, LPPRINTER_INFO_5W; +alias PPRINTER_INFO_5W = PRINTER_INFO_5W*, LPPRINTER_INFO_5W = PRINTER_INFO_5W*; struct PRINTER_INFO_6 { DWORD dwStatus; } -alias PRINTER_INFO_6* PPRINTER_INFO_6, LPPRINTER_INFO_6; +alias PPRINTER_INFO_6 = PRINTER_INFO_6*, LPPRINTER_INFO_6 = PRINTER_INFO_6*; struct PRINTPROCESSOR_INFO_1A { LPSTR pName; } -alias PRINTPROCESSOR_INFO_1A* PPRINTPROCESSOR_INFO_1A, LPPRINTPROCESSOR_INFO_1A; +alias PPRINTPROCESSOR_INFO_1A = PRINTPROCESSOR_INFO_1A*, LPPRINTPROCESSOR_INFO_1A = PRINTPROCESSOR_INFO_1A*; struct PRINTPROCESSOR_INFO_1W { LPWSTR pName; } -alias PRINTPROCESSOR_INFO_1W* PPRINTPROCESSOR_INFO_1W, LPPRINTPROCESSOR_INFO_1W; +alias PPRINTPROCESSOR_INFO_1W = PRINTPROCESSOR_INFO_1W*, LPPRINTPROCESSOR_INFO_1W = PRINTPROCESSOR_INFO_1W*; struct PRINTER_NOTIFY_INFO_DATA { WORD Type; @@ -646,7 +646,7 @@ struct PRINTER_NOTIFY_INFO_DATA { } _NotifyData NotifyData; } -alias PRINTER_NOTIFY_INFO_DATA* PPRINTER_NOTIFY_INFO_DATA, LPPRINTER_NOTIFY_INFO_DATA; +alias PPRINTER_NOTIFY_INFO_DATA = PRINTER_NOTIFY_INFO_DATA*, LPPRINTER_NOTIFY_INFO_DATA = PRINTER_NOTIFY_INFO_DATA*; struct PRINTER_NOTIFY_INFO { DWORD Version; @@ -654,7 +654,7 @@ struct PRINTER_NOTIFY_INFO { DWORD Count; PRINTER_NOTIFY_INFO_DATA[1] aData; } -alias PRINTER_NOTIFY_INFO* PPRINTER_NOTIFY_INFO, LPPRINTER_NOTIFY_INFO; +alias PPRINTER_NOTIFY_INFO = PRINTER_NOTIFY_INFO*, LPPRINTER_NOTIFY_INFO = PRINTER_NOTIFY_INFO*; struct FORM_INFO_1A { DWORD Flags; @@ -662,7 +662,7 @@ struct FORM_INFO_1A { SIZEL Size; RECTL ImageableArea; } -alias FORM_INFO_1A* PFORM_INFO_1A, LPFORM_INFO_1A; +alias PFORM_INFO_1A = FORM_INFO_1A*, LPFORM_INFO_1A = FORM_INFO_1A*; struct FORM_INFO_1W { DWORD Flags; @@ -670,21 +670,21 @@ struct FORM_INFO_1W { SIZEL Size; RECTL ImageableArea; } -alias FORM_INFO_1W* PFORM_INFO_1W, LPFORM_INFO_1W; +alias PFORM_INFO_1W = FORM_INFO_1W*, LPFORM_INFO_1W = FORM_INFO_1W*; struct PRINTER_DEFAULTSA { LPSTR pDatatype; LPDEVMODE pDevMode; ACCESS_MASK DesiredAccess; } -alias PRINTER_DEFAULTSA* PPRINTER_DEFAULTSA, LPPRINTER_DEFAULTSA; +alias PPRINTER_DEFAULTSA = PRINTER_DEFAULTSA*, LPPRINTER_DEFAULTSA = PRINTER_DEFAULTSA*; struct PRINTER_DEFAULTSW { LPWSTR pDatatype; LPDEVMODE pDevMode; ACCESS_MASK DesiredAccess; } -alias PRINTER_DEFAULTSW* PPRINTER_DEFAULTSW, LPPRINTER_DEFAULTSW; +alias PPRINTER_DEFAULTSW = PRINTER_DEFAULTSW*, LPPRINTER_DEFAULTSW = PRINTER_DEFAULTSW*; extern (Windows): BOOL AbortPrinter(HANDLE); @@ -800,165 +800,165 @@ BOOL WritePrinter(HANDLE, PVOID, DWORD, PDWORD); version (Unicode) { -alias JOB_INFO_1W JOB_INFO_1; -alias JOB_INFO_2W JOB_INFO_2; -alias ADDJOB_INFO_1W ADDJOB_INFO_1; -alias DATATYPES_INFO_1W DATATYPES_INFO_1; -alias MONITOR_INFO_1W MONITOR_INFO_1; -alias MONITOR_INFO_2W MONITOR_INFO_2; -alias DOC_INFO_1W DOC_INFO_1; -alias DOC_INFO_2W DOC_INFO_2; -alias PORT_INFO_1W PORT_INFO_1; -alias PORT_INFO_2W PORT_INFO_2; -alias PORT_INFO_3W PORT_INFO_3; -alias DRIVER_INFO_2W DRIVER_INFO_2; -alias PRINTER_INFO_1W PRINTER_INFO_1; -alias PRINTER_INFO_2W PRINTER_INFO_2; -alias PRINTER_INFO_4W PRINTER_INFO_4; -alias PRINTER_INFO_5W PRINTER_INFO_5; -alias PRINTPROCESSOR_INFO_1W PRINTPROCESSOR_INFO_1; -alias FORM_INFO_1W FORM_INFO_1; -alias PRINTER_DEFAULTSW PRINTER_DEFAULTS; - -alias AddFormW AddForm; -alias AddJobW AddJob; -alias AddMonitorW AddMonitor; -alias AddPortW AddPort; -alias AddPrinterW AddPrinter; -alias AddPrinterConnectionW AddPrinterConnection; -alias AddPrinterDriverW AddPrinterDriver; -alias AddPrintProcessorW AddPrintProcessor; -alias AddPrintProvidorW AddPrintProvidor; -alias AdvancedDocumentPropertiesW AdvancedDocumentProperties; -alias ConfigurePortW ConfigurePort; -alias DeleteFormW DeleteForm; -alias DeleteMonitorW DeleteMonitor; -alias DeletePortW DeletePort; -alias DeletePrinterConnectionW DeletePrinterConnection; -alias DeletePrinterDataW DeletePrinterData; -alias DeletePrinterDriverW DeletePrinterDriver; -alias DeletePrintProcessorW DeletePrintProcessor; -alias DeletePrintProvidorW DeletePrintProvidor; -alias DocumentPropertiesW DocumentProperties; -alias EnumFormsW EnumForms; -alias EnumJobsW EnumJobs; -alias EnumMonitorsW EnumMonitors; -alias EnumPortsW EnumPorts; -alias EnumPrinterDataW EnumPrinterData; -alias EnumPrinterDriversW EnumPrinterDrivers; -alias EnumPrintersW EnumPrinters; -alias EnumPrintProcessorDatatypesW EnumPrintProcessorDatatypes; -alias EnumPrintProcessorsW EnumPrintProcessors; +alias JOB_INFO_1 = JOB_INFO_1W; +alias JOB_INFO_2 = JOB_INFO_2W; +alias ADDJOB_INFO_1 = ADDJOB_INFO_1W; +alias DATATYPES_INFO_1 = DATATYPES_INFO_1W; +alias MONITOR_INFO_1 = MONITOR_INFO_1W; +alias MONITOR_INFO_2 = MONITOR_INFO_2W; +alias DOC_INFO_1 = DOC_INFO_1W; +alias DOC_INFO_2 = DOC_INFO_2W; +alias PORT_INFO_1 = PORT_INFO_1W; +alias PORT_INFO_2 = PORT_INFO_2W; +alias PORT_INFO_3 = PORT_INFO_3W; +alias DRIVER_INFO_2 = DRIVER_INFO_2W; +alias PRINTER_INFO_1 = PRINTER_INFO_1W; +alias PRINTER_INFO_2 = PRINTER_INFO_2W; +alias PRINTER_INFO_4 = PRINTER_INFO_4W; +alias PRINTER_INFO_5 = PRINTER_INFO_5W; +alias PRINTPROCESSOR_INFO_1 = PRINTPROCESSOR_INFO_1W; +alias FORM_INFO_1 = FORM_INFO_1W; +alias PRINTER_DEFAULTS = PRINTER_DEFAULTSW; + +alias AddForm = AddFormW; +alias AddJob = AddJobW; +alias AddMonitor = AddMonitorW; +alias AddPort = AddPortW; +alias AddPrinter = AddPrinterW; +alias AddPrinterConnection = AddPrinterConnectionW; +alias AddPrinterDriver = AddPrinterDriverW; +alias AddPrintProcessor = AddPrintProcessorW; +alias AddPrintProvidor = AddPrintProvidorW; +alias AdvancedDocumentProperties = AdvancedDocumentPropertiesW; +alias ConfigurePort = ConfigurePortW; +alias DeleteForm = DeleteFormW; +alias DeleteMonitor = DeleteMonitorW; +alias DeletePort = DeletePortW; +alias DeletePrinterConnection = DeletePrinterConnectionW; +alias DeletePrinterData = DeletePrinterDataW; +alias DeletePrinterDriver = DeletePrinterDriverW; +alias DeletePrintProcessor = DeletePrintProcessorW; +alias DeletePrintProvidor = DeletePrintProvidorW; +alias DocumentProperties = DocumentPropertiesW; +alias EnumForms = EnumFormsW; +alias EnumJobs = EnumJobsW; +alias EnumMonitors = EnumMonitorsW; +alias EnumPorts = EnumPortsW; +alias EnumPrinterData = EnumPrinterDataW; +alias EnumPrinterDrivers = EnumPrinterDriversW; +alias EnumPrinters = EnumPrintersW; +alias EnumPrintProcessorDatatypes = EnumPrintProcessorDatatypesW; +alias EnumPrintProcessors = EnumPrintProcessorsW; static if (_WIN32_WINNT >= 0x500) { -alias GetDefaultPrinterW GetDefaultPrinter; -} - -alias GetFormW GetForm; -alias GetJobW GetJob; -alias GetPrinterW GetPrinter; -alias GetPrinterDataW GetPrinterData; -alias GetPrinterDriverW GetPrinterDriver; -alias GetPrinterDriverDirectoryW GetPrinterDriverDirectory; -alias GetPrintProcessorDirectoryW GetPrintProcessorDirectory; -alias OpenPrinterW OpenPrinter; -alias PrinterMessageBoxW PrinterMessageBox; -alias ResetPrinterW ResetPrinter; -alias SetFormW SetForm; -alias SetJobW SetJob; -alias SetPrinterW SetPrinter; -alias SetPrinterDataW SetPrinterData; -alias StartDocPrinterW StartDocPrinter; +alias GetDefaultPrinter = GetDefaultPrinterW; +} + +alias GetForm = GetFormW; +alias GetJob = GetJobW; +alias GetPrinter = GetPrinterW; +alias GetPrinterData = GetPrinterDataW; +alias GetPrinterDriver = GetPrinterDriverW; +alias GetPrinterDriverDirectory = GetPrinterDriverDirectoryW; +alias GetPrintProcessorDirectory = GetPrintProcessorDirectoryW; +alias OpenPrinter = OpenPrinterW; +alias PrinterMessageBox = PrinterMessageBoxW; +alias ResetPrinter = ResetPrinterW; +alias SetForm = SetFormW; +alias SetJob = SetJobW; +alias SetPrinter = SetPrinterW; +alias SetPrinterData = SetPrinterDataW; +alias StartDocPrinter = StartDocPrinterW; } else { -alias JOB_INFO_1A JOB_INFO_1; -alias JOB_INFO_2A JOB_INFO_2; -alias ADDJOB_INFO_1A ADDJOB_INFO_1; -alias DATATYPES_INFO_1A DATATYPES_INFO_1; -alias MONITOR_INFO_1A MONITOR_INFO_1; -alias MONITOR_INFO_2A MONITOR_INFO_2; -alias DOC_INFO_1A DOC_INFO_1; -alias DOC_INFO_2A DOC_INFO_2; -alias PORT_INFO_1A PORT_INFO_1; -alias PORT_INFO_2A PORT_INFO_2; -alias PORT_INFO_3A PORT_INFO_3; -alias DRIVER_INFO_2A DRIVER_INFO_2; -alias PRINTER_INFO_1A PRINTER_INFO_1; -alias PRINTER_INFO_2A PRINTER_INFO_2; -alias PRINTER_INFO_4A PRINTER_INFO_4; -alias PRINTER_INFO_5A PRINTER_INFO_5; -alias PRINTPROCESSOR_INFO_1A PRINTPROCESSOR_INFO_1; -alias FORM_INFO_1A FORM_INFO_1; -alias PRINTER_DEFAULTSA PRINTER_DEFAULTS; - -alias AddFormA AddForm; -alias AddJobA AddJob; -alias AddMonitorA AddMonitor; -alias AddPortA AddPort; -alias AddPrinterA AddPrinter; -alias AddPrinterConnectionA AddPrinterConnection; -alias AddPrinterDriverA AddPrinterDriver; -alias AddPrintProcessorA AddPrintProcessor; -alias AddPrintProvidorA AddPrintProvidor; -alias AdvancedDocumentPropertiesA AdvancedDocumentProperties; -alias ConfigurePortA ConfigurePort; -alias DeleteFormA DeleteForm; -alias DeleteMonitorA DeleteMonitor; -alias DeletePortA DeletePort; -alias DeletePrinterConnectionA DeletePrinterConnection; -alias DeletePrinterDataA DeletePrinterData; -alias DeletePrinterDriverA DeletePrinterDriver; -alias DeletePrintProcessorA DeletePrintProcessor; -alias DeletePrintProvidorA DeletePrintProvidor; -alias DocumentPropertiesA DocumentProperties; -alias EnumFormsA EnumForms; -alias EnumJobsA EnumJobs; -alias EnumMonitorsA EnumMonitors; -alias EnumPortsA EnumPorts; -alias EnumPrinterDataA EnumPrinterData; -alias EnumPrinterDriversA EnumPrinterDrivers; -alias EnumPrintersA EnumPrinters; -alias EnumPrintProcessorDatatypesA EnumPrintProcessorDatatypes; -alias EnumPrintProcessorsA EnumPrintProcessors; +alias JOB_INFO_1 = JOB_INFO_1A; +alias JOB_INFO_2 = JOB_INFO_2A; +alias ADDJOB_INFO_1 = ADDJOB_INFO_1A; +alias DATATYPES_INFO_1 = DATATYPES_INFO_1A; +alias MONITOR_INFO_1 = MONITOR_INFO_1A; +alias MONITOR_INFO_2 = MONITOR_INFO_2A; +alias DOC_INFO_1 = DOC_INFO_1A; +alias DOC_INFO_2 = DOC_INFO_2A; +alias PORT_INFO_1 = PORT_INFO_1A; +alias PORT_INFO_2 = PORT_INFO_2A; +alias PORT_INFO_3 = PORT_INFO_3A; +alias DRIVER_INFO_2 = DRIVER_INFO_2A; +alias PRINTER_INFO_1 = PRINTER_INFO_1A; +alias PRINTER_INFO_2 = PRINTER_INFO_2A; +alias PRINTER_INFO_4 = PRINTER_INFO_4A; +alias PRINTER_INFO_5 = PRINTER_INFO_5A; +alias PRINTPROCESSOR_INFO_1 = PRINTPROCESSOR_INFO_1A; +alias FORM_INFO_1 = FORM_INFO_1A; +alias PRINTER_DEFAULTS = PRINTER_DEFAULTSA; + +alias AddForm = AddFormA; +alias AddJob = AddJobA; +alias AddMonitor = AddMonitorA; +alias AddPort = AddPortA; +alias AddPrinter = AddPrinterA; +alias AddPrinterConnection = AddPrinterConnectionA; +alias AddPrinterDriver = AddPrinterDriverA; +alias AddPrintProcessor = AddPrintProcessorA; +alias AddPrintProvidor = AddPrintProvidorA; +alias AdvancedDocumentProperties = AdvancedDocumentPropertiesA; +alias ConfigurePort = ConfigurePortA; +alias DeleteForm = DeleteFormA; +alias DeleteMonitor = DeleteMonitorA; +alias DeletePort = DeletePortA; +alias DeletePrinterConnection = DeletePrinterConnectionA; +alias DeletePrinterData = DeletePrinterDataA; +alias DeletePrinterDriver = DeletePrinterDriverA; +alias DeletePrintProcessor = DeletePrintProcessorA; +alias DeletePrintProvidor = DeletePrintProvidorA; +alias DocumentProperties = DocumentPropertiesA; +alias EnumForms = EnumFormsA; +alias EnumJobs = EnumJobsA; +alias EnumMonitors = EnumMonitorsA; +alias EnumPorts = EnumPortsA; +alias EnumPrinterData = EnumPrinterDataA; +alias EnumPrinterDrivers = EnumPrinterDriversA; +alias EnumPrinters = EnumPrintersA; +alias EnumPrintProcessorDatatypes = EnumPrintProcessorDatatypesA; +alias EnumPrintProcessors = EnumPrintProcessorsA; static if (_WIN32_WINNT >= 0x500) { -alias GetDefaultPrinterA GetDefaultPrinter; -} - -alias GetFormA GetForm; -alias GetJobA GetJob; -alias GetPrinterA GetPrinter; -alias GetPrinterDataA GetPrinterData; -alias GetPrinterDriverA GetPrinterDriver; -alias GetPrinterDriverDirectoryA GetPrinterDriverDirectory; -alias GetPrintProcessorDirectoryA GetPrintProcessorDirectory; -alias OpenPrinterA OpenPrinter; -alias PrinterMessageBoxA PrinterMessageBox; -alias ResetPrinterA ResetPrinter; -alias SetFormA SetForm; -alias SetJobA SetJob; -alias SetPrinterA SetPrinter; -alias SetPrinterDataA SetPrinterData; -alias StartDocPrinterA StartDocPrinter; -} - -alias JOB_INFO_1* PJOB_INFO_1, LPJOB_INFO_1; -alias JOB_INFO_2* PJOB_INFO_2, LPJOB_INFO_2; -alias ADDJOB_INFO_1* PADDJOB_INFO_1, LPADDJOB_INFO_1; -alias DATATYPES_INFO_1* PDATATYPES_INFO_1, LPDATATYPES_INFO_1; -alias MONITOR_INFO_1* PMONITOR_INFO_1, LPMONITOR_INFO_1; -alias MONITOR_INFO_2* PMONITOR_INFO_2, LPMONITOR_INFO_2; -alias DOC_INFO_1* PDOC_INFO_1, LPDOC_INFO_1; -alias DOC_INFO_2* PDOC_INFO_2, LPDOC_INFO_2; -alias PORT_INFO_1* PPORT_INFO_1, LPPORT_INFO_1; -alias PORT_INFO_2* PPORT_INFO_2, LPPORT_INFO_2; -alias PORT_INFO_3* PPORT_INFO_3, LPPORT_INFO_3; -alias DRIVER_INFO_2* PDRIVER_INFO_2, LPDRIVER_INFO_2; -alias PRINTER_INFO_1* PPRINTER_INFO_1, LPPRINTER_INFO_1; -alias PRINTER_INFO_2* PPRINTER_INFO_2, LPPRINTER_INFO_2; -alias PRINTER_INFO_4* PPRINTER_INFO_4, LPPRINTER_INFO_4; -alias PRINTER_INFO_5* PPRINTER_INFO_5, LPPRINTER_INFO_5; -alias PRINTPROCESSOR_INFO_1* PPRINTPROCESSOR_INFO_1, LPPRINTPROCESSOR_INFO_1; -alias FORM_INFO_1* PFORM_INFO_1, LPFORM_INFO_1; -alias PRINTER_DEFAULTS* PPRINTER_DEFAULTS, LPPRINTER_DEFAULTS; +alias GetDefaultPrinter = GetDefaultPrinterA; +} + +alias GetForm = GetFormA; +alias GetJob = GetJobA; +alias GetPrinter = GetPrinterA; +alias GetPrinterData = GetPrinterDataA; +alias GetPrinterDriver = GetPrinterDriverA; +alias GetPrinterDriverDirectory = GetPrinterDriverDirectoryA; +alias GetPrintProcessorDirectory = GetPrintProcessorDirectoryA; +alias OpenPrinter = OpenPrinterA; +alias PrinterMessageBox = PrinterMessageBoxA; +alias ResetPrinter = ResetPrinterA; +alias SetForm = SetFormA; +alias SetJob = SetJobA; +alias SetPrinter = SetPrinterA; +alias SetPrinterData = SetPrinterDataA; +alias StartDocPrinter = StartDocPrinterA; +} + +alias PJOB_INFO_1 = JOB_INFO_1*, LPJOB_INFO_1 = JOB_INFO_1*; +alias PJOB_INFO_2 = JOB_INFO_2*, LPJOB_INFO_2 = JOB_INFO_2*; +alias PADDJOB_INFO_1 = ADDJOB_INFO_1*, LPADDJOB_INFO_1 = ADDJOB_INFO_1*; +alias PDATATYPES_INFO_1 = DATATYPES_INFO_1*, LPDATATYPES_INFO_1 = DATATYPES_INFO_1*; +alias PMONITOR_INFO_1 = MONITOR_INFO_1*, LPMONITOR_INFO_1 = MONITOR_INFO_1*; +alias PMONITOR_INFO_2 = MONITOR_INFO_2*, LPMONITOR_INFO_2 = MONITOR_INFO_2*; +alias PDOC_INFO_1 = DOC_INFO_1*, LPDOC_INFO_1 = DOC_INFO_1*; +alias PDOC_INFO_2 = DOC_INFO_2*, LPDOC_INFO_2 = DOC_INFO_2*; +alias PPORT_INFO_1 = PORT_INFO_1*, LPPORT_INFO_1 = PORT_INFO_1*; +alias PPORT_INFO_2 = PORT_INFO_2*, LPPORT_INFO_2 = PORT_INFO_2*; +alias PPORT_INFO_3 = PORT_INFO_3*, LPPORT_INFO_3 = PORT_INFO_3*; +alias PDRIVER_INFO_2 = DRIVER_INFO_2*, LPDRIVER_INFO_2 = DRIVER_INFO_2*; +alias PPRINTER_INFO_1 = PRINTER_INFO_1*, LPPRINTER_INFO_1 = PRINTER_INFO_1*; +alias PPRINTER_INFO_2 = PRINTER_INFO_2*, LPPRINTER_INFO_2 = PRINTER_INFO_2*; +alias PPRINTER_INFO_4 = PRINTER_INFO_4*, LPPRINTER_INFO_4 = PRINTER_INFO_4*; +alias PPRINTER_INFO_5 = PRINTER_INFO_5*, LPPRINTER_INFO_5 = PRINTER_INFO_5*; +alias PPRINTPROCESSOR_INFO_1 = PRINTPROCESSOR_INFO_1*, LPPRINTPROCESSOR_INFO_1 = PRINTPROCESSOR_INFO_1*; +alias PFORM_INFO_1 = FORM_INFO_1*, LPFORM_INFO_1 = FORM_INFO_1*; +alias PPRINTER_DEFAULTS = PRINTER_DEFAULTS*, LPPRINTER_DEFAULTS = PRINTER_DEFAULTS*; diff --git a/runtime/druntime/src/core/sys/windows/winsvc.d b/runtime/druntime/src/core/sys/windows/winsvc.d index a34cd258205..248bd2a0a9b 100644 --- a/runtime/druntime/src/core/sys/windows/winsvc.d +++ b/runtime/druntime/src/core/sys/windows/winsvc.d @@ -111,21 +111,21 @@ struct SERVICE_STATUS { DWORD dwCheckPoint; DWORD dwWaitHint; } -alias SERVICE_STATUS* LPSERVICE_STATUS; +alias LPSERVICE_STATUS = SERVICE_STATUS*; struct ENUM_SERVICE_STATUSA { LPSTR lpServiceName; LPSTR lpDisplayName; SERVICE_STATUS ServiceStatus; } -alias ENUM_SERVICE_STATUSA* LPENUM_SERVICE_STATUSA; +alias LPENUM_SERVICE_STATUSA = ENUM_SERVICE_STATUSA*; struct ENUM_SERVICE_STATUSW { LPWSTR lpServiceName; LPWSTR lpDisplayName; SERVICE_STATUS ServiceStatus; } -alias ENUM_SERVICE_STATUSW* LPENUM_SERVICE_STATUSW; +alias LPENUM_SERVICE_STATUSW = ENUM_SERVICE_STATUSW*; struct QUERY_SERVICE_CONFIGA { DWORD dwServiceType; @@ -138,7 +138,7 @@ struct QUERY_SERVICE_CONFIGA { LPSTR lpServiceStartName; LPSTR lpDisplayName; } -alias QUERY_SERVICE_CONFIGA* LPQUERY_SERVICE_CONFIGA; +alias LPQUERY_SERVICE_CONFIGA = QUERY_SERVICE_CONFIGA*; struct QUERY_SERVICE_CONFIGW { DWORD dwServiceType; @@ -151,47 +151,47 @@ struct QUERY_SERVICE_CONFIGW { LPWSTR lpServiceStartName; LPWSTR lpDisplayName; } -alias QUERY_SERVICE_CONFIGW* LPQUERY_SERVICE_CONFIGW; +alias LPQUERY_SERVICE_CONFIGW = QUERY_SERVICE_CONFIGW*; struct QUERY_SERVICE_LOCK_STATUSA { DWORD fIsLocked; LPSTR lpLockOwner; DWORD dwLockDuration; } -alias QUERY_SERVICE_LOCK_STATUSA* LPQUERY_SERVICE_LOCK_STATUSA; +alias LPQUERY_SERVICE_LOCK_STATUSA = QUERY_SERVICE_LOCK_STATUSA*; struct QUERY_SERVICE_LOCK_STATUSW { DWORD fIsLocked; LPWSTR lpLockOwner; DWORD dwLockDuration; } -alias QUERY_SERVICE_LOCK_STATUSW* LPQUERY_SERVICE_LOCK_STATUSW; +alias LPQUERY_SERVICE_LOCK_STATUSW = QUERY_SERVICE_LOCK_STATUSW*; extern (Windows) { - alias void function(DWORD, LPSTR*) LPSERVICE_MAIN_FUNCTIONA; - alias void function(DWORD, LPWSTR*) LPSERVICE_MAIN_FUNCTIONW; + alias LPSERVICE_MAIN_FUNCTIONA = void function(DWORD, LPSTR*); + alias LPSERVICE_MAIN_FUNCTIONW = void function(DWORD, LPWSTR*); } struct SERVICE_TABLE_ENTRYA { LPSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONA lpServiceProc; } -alias SERVICE_TABLE_ENTRYA* LPSERVICE_TABLE_ENTRYA; +alias LPSERVICE_TABLE_ENTRYA = SERVICE_TABLE_ENTRYA*; struct SERVICE_TABLE_ENTRYW { LPWSTR lpServiceName; LPSERVICE_MAIN_FUNCTIONW lpServiceProc; } -alias SERVICE_TABLE_ENTRYW* LPSERVICE_TABLE_ENTRYW; +alias LPSERVICE_TABLE_ENTRYW = SERVICE_TABLE_ENTRYW*; alias SC_HANDLE = HANDLE; -alias SC_HANDLE* LPSC_HANDLE; -alias void* SC_LOCK; +alias LPSC_HANDLE = SC_HANDLE*; +alias SC_LOCK = void*; alias SERVICE_STATUS_HANDLE = HANDLE; extern (Windows) { - alias void function(DWORD) LPHANDLER_FUNCTION; - alias DWORD function(DWORD, DWORD, LPVOID, LPVOID) LPHANDLER_FUNCTION_EX; + alias LPHANDLER_FUNCTION = void function(DWORD); + alias LPHANDLER_FUNCTION_EX = DWORD function(DWORD, DWORD, LPVOID, LPVOID); } static if (_WIN32_WINNT >= 0x500) { @@ -206,7 +206,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD dwProcessId; DWORD dwServiceFlags; } - alias SERVICE_STATUS_PROCESS* LPSERVICE_STATUS_PROCESS; + alias LPSERVICE_STATUS_PROCESS = SERVICE_STATUS_PROCESS*; enum SC_STATUS_TYPE { SC_STATUS_PROCESS_INFO = 0 @@ -221,24 +221,24 @@ static if (_WIN32_WINNT >= 0x500) { LPSTR lpDisplayName; SERVICE_STATUS_PROCESS ServiceStatusProcess; } - alias ENUM_SERVICE_STATUS_PROCESSA* LPENUM_SERVICE_STATUS_PROCESSA; + alias LPENUM_SERVICE_STATUS_PROCESSA = ENUM_SERVICE_STATUS_PROCESSA*; struct ENUM_SERVICE_STATUS_PROCESSW { LPWSTR lpServiceName; LPWSTR lpDisplayName; SERVICE_STATUS_PROCESS ServiceStatusProcess; } - alias ENUM_SERVICE_STATUS_PROCESSW* LPENUM_SERVICE_STATUS_PROCESSW; + alias LPENUM_SERVICE_STATUS_PROCESSW = ENUM_SERVICE_STATUS_PROCESSW*; struct SERVICE_DESCRIPTIONA { LPSTR lpDescription; } - alias SERVICE_DESCRIPTIONA* LPSERVICE_DESCRIPTIONA; + alias LPSERVICE_DESCRIPTIONA = SERVICE_DESCRIPTIONA*; struct SERVICE_DESCRIPTIONW { LPWSTR lpDescription; } - alias SERVICE_DESCRIPTIONW* LPSERVICE_DESCRIPTIONW; + alias LPSERVICE_DESCRIPTIONW = SERVICE_DESCRIPTIONW*; enum SC_ACTION_TYPE { SC_ACTION_NONE, @@ -251,7 +251,7 @@ static if (_WIN32_WINNT >= 0x500) { SC_ACTION_TYPE Type; DWORD Delay; } - alias SC_ACTION* LPSC_ACTION; + alias LPSC_ACTION = SC_ACTION*; struct SERVICE_FAILURE_ACTIONSA { DWORD dwResetPeriod; @@ -260,7 +260,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cActions; SC_ACTION* lpsaActions; } - alias SERVICE_FAILURE_ACTIONSA* LPSERVICE_FAILURE_ACTIONSA; + alias LPSERVICE_FAILURE_ACTIONSA = SERVICE_FAILURE_ACTIONSA*; struct SERVICE_FAILURE_ACTIONSW { DWORD dwResetPeriod; @@ -269,7 +269,7 @@ static if (_WIN32_WINNT >= 0x500) { DWORD cActions; SC_ACTION* lpsaActions; } - alias SERVICE_FAILURE_ACTIONSW* LPSERVICE_FAILURE_ACTIONSW; + alias LPSERVICE_FAILURE_ACTIONSW = SERVICE_FAILURE_ACTIONSW*; } extern (Windows) nothrow @nogc { @@ -348,80 +348,80 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias ENUM_SERVICE_STATUSW ENUM_SERVICE_STATUS; - alias QUERY_SERVICE_CONFIGW QUERY_SERVICE_CONFIG; - alias QUERY_SERVICE_LOCK_STATUSW QUERY_SERVICE_LOCK_STATUS; - alias LPSERVICE_MAIN_FUNCTIONW LPSERVICE_MAIN_FUNCTION; - alias SERVICE_TABLE_ENTRYW SERVICE_TABLE_ENTRY; - alias ChangeServiceConfigW ChangeServiceConfig; - alias CreateServiceW CreateService; - alias EnumDependentServicesW EnumDependentServices; - alias EnumServicesStatusW EnumServicesStatus; - alias GetServiceDisplayNameW GetServiceDisplayName; - alias GetServiceKeyNameW GetServiceKeyName; - alias OpenSCManagerW OpenSCManager; - alias OpenServiceW OpenService; - alias QueryServiceConfigW QueryServiceConfig; - alias QueryServiceLockStatusW QueryServiceLockStatus; - alias RegisterServiceCtrlHandlerW RegisterServiceCtrlHandler; - alias StartServiceW StartService; - alias StartServiceCtrlDispatcherW StartServiceCtrlDispatcher; + alias ENUM_SERVICE_STATUS = ENUM_SERVICE_STATUSW; + alias QUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIGW; + alias QUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUSW; + alias LPSERVICE_MAIN_FUNCTION = LPSERVICE_MAIN_FUNCTIONW; + alias SERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRYW; + alias ChangeServiceConfig = ChangeServiceConfigW; + alias CreateService = CreateServiceW; + alias EnumDependentServices = EnumDependentServicesW; + alias EnumServicesStatus = EnumServicesStatusW; + alias GetServiceDisplayName = GetServiceDisplayNameW; + alias GetServiceKeyName = GetServiceKeyNameW; + alias OpenSCManager = OpenSCManagerW; + alias OpenService = OpenServiceW; + alias QueryServiceConfig = QueryServiceConfigW; + alias QueryServiceLockStatus = QueryServiceLockStatusW; + alias RegisterServiceCtrlHandler = RegisterServiceCtrlHandlerW; + alias StartService = StartServiceW; + alias StartServiceCtrlDispatcher = StartServiceCtrlDispatcherW; static if (_WIN32_WINNT >= 0x500) { - alias ENUM_SERVICE_STATUS_PROCESSW ENUM_SERVICE_STATUS_PROCESS; - alias SERVICE_DESCRIPTIONW SERVICE_DESCRIPTION; - alias SERVICE_FAILURE_ACTIONSW SERVICE_FAILURE_ACTIONS; - alias EnumServicesStatusExW EnumServicesStatusEx; - alias QueryServiceConfig2W QueryServiceConfig2; - alias RegisterServiceCtrlHandlerExW RegisterServiceCtrlHandlerEx; + alias ENUM_SERVICE_STATUS_PROCESS = ENUM_SERVICE_STATUS_PROCESSW; + alias SERVICE_DESCRIPTION = SERVICE_DESCRIPTIONW; + alias SERVICE_FAILURE_ACTIONS = SERVICE_FAILURE_ACTIONSW; + alias EnumServicesStatusEx = EnumServicesStatusExW; + alias QueryServiceConfig2 = QueryServiceConfig2W; + alias RegisterServiceCtrlHandlerEx = RegisterServiceCtrlHandlerExW; } static if (_WIN32_WINNT >= 0x501) { - alias ChangeServiceConfig2W ChangeServiceConfig2; + alias ChangeServiceConfig2 = ChangeServiceConfig2W; } } else { - alias ENUM_SERVICE_STATUSA ENUM_SERVICE_STATUS; - alias QUERY_SERVICE_CONFIGA QUERY_SERVICE_CONFIG; - alias QUERY_SERVICE_LOCK_STATUSA QUERY_SERVICE_LOCK_STATUS; - alias LPSERVICE_MAIN_FUNCTIONA LPSERVICE_MAIN_FUNCTION; - alias SERVICE_TABLE_ENTRYA SERVICE_TABLE_ENTRY; - alias ChangeServiceConfigA ChangeServiceConfig; - alias CreateServiceA CreateService; - alias EnumDependentServicesA EnumDependentServices; - alias EnumServicesStatusA EnumServicesStatus; - alias GetServiceDisplayNameA GetServiceDisplayName; - alias GetServiceKeyNameA GetServiceKeyName; - alias OpenSCManagerA OpenSCManager; - alias OpenServiceA OpenService; - alias QueryServiceConfigA QueryServiceConfig; - alias QueryServiceLockStatusA QueryServiceLockStatus; - alias RegisterServiceCtrlHandlerA RegisterServiceCtrlHandler; - alias StartServiceA StartService; - alias StartServiceCtrlDispatcherA StartServiceCtrlDispatcher; + alias ENUM_SERVICE_STATUS = ENUM_SERVICE_STATUSA; + alias QUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIGA; + alias QUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUSA; + alias LPSERVICE_MAIN_FUNCTION = LPSERVICE_MAIN_FUNCTIONA; + alias SERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRYA; + alias ChangeServiceConfig = ChangeServiceConfigA; + alias CreateService = CreateServiceA; + alias EnumDependentServices = EnumDependentServicesA; + alias EnumServicesStatus = EnumServicesStatusA; + alias GetServiceDisplayName = GetServiceDisplayNameA; + alias GetServiceKeyName = GetServiceKeyNameA; + alias OpenSCManager = OpenSCManagerA; + alias OpenService = OpenServiceA; + alias QueryServiceConfig = QueryServiceConfigA; + alias QueryServiceLockStatus = QueryServiceLockStatusA; + alias RegisterServiceCtrlHandler = RegisterServiceCtrlHandlerA; + alias StartService = StartServiceA; + alias StartServiceCtrlDispatcher = StartServiceCtrlDispatcherA; static if (_WIN32_WINNT >= 0x500) { - alias ENUM_SERVICE_STATUS_PROCESSA ENUM_SERVICE_STATUS_PROCESS; - alias SERVICE_DESCRIPTIONA SERVICE_DESCRIPTION; - alias SERVICE_FAILURE_ACTIONSA SERVICE_FAILURE_ACTIONS; - alias EnumServicesStatusExA EnumServicesStatusEx; - alias QueryServiceConfig2A QueryServiceConfig2; - alias RegisterServiceCtrlHandlerExA RegisterServiceCtrlHandlerEx; + alias ENUM_SERVICE_STATUS_PROCESS = ENUM_SERVICE_STATUS_PROCESSA; + alias SERVICE_DESCRIPTION = SERVICE_DESCRIPTIONA; + alias SERVICE_FAILURE_ACTIONS = SERVICE_FAILURE_ACTIONSA; + alias EnumServicesStatusEx = EnumServicesStatusExA; + alias QueryServiceConfig2 = QueryServiceConfig2A; + alias RegisterServiceCtrlHandlerEx = RegisterServiceCtrlHandlerExA; } static if (_WIN32_WINNT >= 0x501) { - alias ChangeServiceConfig2A ChangeServiceConfig2; + alias ChangeServiceConfig2 = ChangeServiceConfig2A; } } -alias ENUM_SERVICE_STATUS* LPENUM_SERVICE_STATUS; -alias QUERY_SERVICE_CONFIG* LPQUERY_SERVICE_CONFIG; -alias QUERY_SERVICE_LOCK_STATUS* LPQUERY_SERVICE_LOCK_STATUS; -alias SERVICE_TABLE_ENTRY* LPSERVICE_TABLE_ENTRY; +alias LPENUM_SERVICE_STATUS = ENUM_SERVICE_STATUS*; +alias LPQUERY_SERVICE_CONFIG = QUERY_SERVICE_CONFIG*; +alias LPQUERY_SERVICE_LOCK_STATUS = QUERY_SERVICE_LOCK_STATUS*; +alias LPSERVICE_TABLE_ENTRY = SERVICE_TABLE_ENTRY*; static if (_WIN32_WINNT >= 0x500) { - alias ENUM_SERVICE_STATUS_PROCESS* LPENUM_SERVICE_STATUS_PROCESS; - alias SERVICE_DESCRIPTION* LPSERVICE_DESCRIPTION; - alias SERVICE_FAILURE_ACTIONS* LPSERVICE_FAILURE_ACTIONS; + alias LPENUM_SERVICE_STATUS_PROCESS = ENUM_SERVICE_STATUS_PROCESS*; + alias LPSERVICE_DESCRIPTION = SERVICE_DESCRIPTION*; + alias LPSERVICE_FAILURE_ACTIONS = SERVICE_FAILURE_ACTIONS*; } diff --git a/runtime/druntime/src/core/sys/windows/winuser.d b/runtime/druntime/src/core/sys/windows/winuser.d index 4a92be8ef86..9d8c26440ed 100644 --- a/runtime/druntime/src/core/sys/windows/winuser.d +++ b/runtime/druntime/src/core/sys/windows/winuser.d @@ -721,13 +721,13 @@ enum GCL_MENUNAME = -8; enum GCL_STYLE = -26; enum GCL_WNDPROC = -24; -alias GCL_HICONSM GCLP_HICONSM; -alias GCL_HICON GCLP_HICON; -alias GCL_HCURSOR GCLP_HCURSOR; -alias GCL_HBRBACKGROUND GCLP_HBRBACKGROUND; -alias GCL_HMODULE GCLP_HMODULE; -alias GCL_MENUNAME GCLP_MENUNAME; -alias GCL_WNDPROC GCLP_WNDPROC; +alias GCLP_HICONSM = GCL_HICONSM; +alias GCLP_HICON = GCL_HICON; +alias GCLP_HCURSOR = GCL_HCURSOR; +alias GCLP_HBRBACKGROUND = GCL_HBRBACKGROUND; +alias GCLP_HMODULE = GCL_HMODULE; +alias GCLP_MENUNAME = GCL_MENUNAME; +alias GCLP_WNDPROC = GCL_WNDPROC; enum { IDC_ARROW = MAKEINTRESOURCE_T!(32512), @@ -2468,31 +2468,31 @@ enum { // Callbacks // --------- extern (Windows) nothrow { - alias INT_PTR function(HWND, UINT, WPARAM, LPARAM) DLGPROC; - alias void function(HWND, UINT, UINT_PTR, DWORD) TIMERPROC; - alias BOOL function(HDC, LPARAM, int) GRAYSTRINGPROC; - alias LRESULT function(int, WPARAM, LPARAM) HOOKPROC; - alias BOOL function(HWND, LPCSTR, HANDLE) PROPENUMPROCA; - alias BOOL function(HWND, LPCWSTR, HANDLE) PROPENUMPROCW; - alias BOOL function(HWND, LPSTR, HANDLE, ULONG_PTR) PROPENUMPROCEXA; - alias BOOL function(HWND, LPWSTR, HANDLE, ULONG_PTR) PROPENUMPROCEXW; - alias int function(LPSTR, int, int, int) EDITWORDBREAKPROCA; - alias int function(LPWSTR, int, int, int) EDITWORDBREAKPROCW; - alias LRESULT function(HWND, UINT, WPARAM, LPARAM) WNDPROC; - alias BOOL function(HDC, LPARAM, WPARAM, int, int) DRAWSTATEPROC; - alias BOOL function(HWND, LPARAM) WNDENUMPROC; - alias BOOL function(HWND, LPARAM) ENUMWINDOWSPROC; - alias void function(LPHELPINFO) MSGBOXCALLBACK; - - alias BOOL function(HMONITOR, HDC, LPRECT, LPARAM) MONITORENUMPROC; - alias BOOL function(LPSTR, LPARAM) NAMEENUMPROCA; - alias BOOL function(LPWSTR, LPARAM) NAMEENUMPROCW; - alias void function(HWND, UINT, ULONG_PTR, LRESULT) SENDASYNCPROC; - - alias NAMEENUMPROCA DESKTOPENUMPROCA; - alias NAMEENUMPROCW DESKTOPENUMPROCW; - alias NAMEENUMPROCA WINSTAENUMPROCA; - alias NAMEENUMPROCW WINSTAENUMPROCW; + alias DLGPROC = INT_PTR function(HWND, UINT, WPARAM, LPARAM); + alias TIMERPROC = void function(HWND, UINT, UINT_PTR, DWORD); + alias GRAYSTRINGPROC = BOOL function(HDC, LPARAM, int); + alias HOOKPROC = LRESULT function(int, WPARAM, LPARAM); + alias PROPENUMPROCA = BOOL function(HWND, LPCSTR, HANDLE); + alias PROPENUMPROCW = BOOL function(HWND, LPCWSTR, HANDLE); + alias PROPENUMPROCEXA = BOOL function(HWND, LPSTR, HANDLE, ULONG_PTR); + alias PROPENUMPROCEXW = BOOL function(HWND, LPWSTR, HANDLE, ULONG_PTR); + alias EDITWORDBREAKPROCA = int function(LPSTR, int, int, int); + alias EDITWORDBREAKPROCW = int function(LPWSTR, int, int, int); + alias WNDPROC = LRESULT function(HWND, UINT, WPARAM, LPARAM); + alias DRAWSTATEPROC = BOOL function(HDC, LPARAM, WPARAM, int, int); + alias WNDENUMPROC = BOOL function(HWND, LPARAM); + alias ENUMWINDOWSPROC = BOOL function(HWND, LPARAM); + alias MSGBOXCALLBACK = void function(LPHELPINFO); + + alias MONITORENUMPROC = BOOL function(HMONITOR, HDC, LPRECT, LPARAM); + alias NAMEENUMPROCA = BOOL function(LPSTR, LPARAM); + alias NAMEENUMPROCW = BOOL function(LPWSTR, LPARAM); + alias SENDASYNCPROC = void function(HWND, UINT, ULONG_PTR, LRESULT); + + alias DESKTOPENUMPROCA = NAMEENUMPROCA; + alias DESKTOPENUMPROCW = NAMEENUMPROCW; + alias WINSTAENUMPROCA = NAMEENUMPROCA; + alias WINSTAENUMPROCW = NAMEENUMPROCW; } alias HDWP = HANDLE; @@ -2505,27 +2505,27 @@ struct MENUGETOBJECTINFO { PVOID riid; PVOID pvObj; } -alias MENUGETOBJECTINFO* PMENUGETOBJECTINFO; +alias PMENUGETOBJECTINFO = MENUGETOBJECTINFO*; struct ACCEL { BYTE fVirt; WORD key; WORD cmd; } -alias ACCEL* LPACCEL; +alias LPACCEL = ACCEL*; struct ACCESSTIMEOUT { UINT cbSize = ACCESSTIMEOUT.sizeof; DWORD dwFlags; DWORD iTimeOutMSec; } -alias ACCESSTIMEOUT* LPACCESSTIMEOUT; +alias LPACCESSTIMEOUT = ACCESSTIMEOUT*; struct ANIMATIONINFO { UINT cbSize = ANIMATIONINFO.sizeof; int iMinAnimate; } -alias ANIMATIONINFO* LPANIMATIONINFO; +alias LPANIMATIONINFO = ANIMATIONINFO*; struct CREATESTRUCTA { LPVOID lpCreateParams; @@ -2541,7 +2541,7 @@ struct CREATESTRUCTA { LPCSTR lpszClass; DWORD dwExStyle; } -alias CREATESTRUCTA* LPCREATESTRUCTA; +alias LPCREATESTRUCTA = CREATESTRUCTA*; struct CREATESTRUCTW { LPVOID lpCreateParams; @@ -2557,25 +2557,25 @@ struct CREATESTRUCTW { LPCWSTR lpszClass; DWORD dwExStyle; } -alias CREATESTRUCTW* LPCREATESTRUCTW; +alias LPCREATESTRUCTW = CREATESTRUCTW*; struct CBT_CREATEWNDA { LPCREATESTRUCTA lpcs; HWND hwndInsertAfter; } -alias CBT_CREATEWNDA* LPCBT_CREATEWNDA; +alias LPCBT_CREATEWNDA = CBT_CREATEWNDA*; struct CBT_CREATEWNDW { LPCREATESTRUCTW lpcs; HWND hwndInsertAfter; } -alias CBT_CREATEWNDW* LPCBT_CREATEWNDW; +alias LPCBT_CREATEWNDW = CBT_CREATEWNDW*; struct CBTACTIVATESTRUCT { BOOL fMouse; HWND hWndActive; } -alias CBTACTIVATESTRUCT* LPCBTACTIVATESTRUCT; +alias LPCBTACTIVATESTRUCT = CBTACTIVATESTRUCT*; static if (_WIN32_WINNT >= 0x501) { @@ -2584,7 +2584,7 @@ struct WTSSESSION_NOTIFICATION DWORD cbSize; DWORD dwSessionId; } -alias WTSSESSION_NOTIFICATION* PWTSSESSION_NOTIFICATION; +alias PWTSSESSION_NOTIFICATION = WTSSESSION_NOTIFICATION*; } @@ -2592,7 +2592,7 @@ struct CLIENTCREATESTRUCT { HANDLE hWindowMenu; UINT idFirstChild; } -alias CLIENTCREATESTRUCT* LPCLIENTCREATESTRUCT; +alias LPCLIENTCREATESTRUCT = CLIENTCREATESTRUCT*; struct COMPAREITEMSTRUCT { UINT CtlType; @@ -2604,14 +2604,14 @@ struct COMPAREITEMSTRUCT { ULONG_PTR itemData2; DWORD dwLocaleId; } -alias COMPAREITEMSTRUCT* LPCOMPAREITEMSTRUCT; +alias LPCOMPAREITEMSTRUCT = COMPAREITEMSTRUCT*; struct COPYDATASTRUCT { ULONG_PTR dwData; DWORD cbData; PVOID lpData; } -alias COPYDATASTRUCT* PCOPYDATASTRUCT; +alias PCOPYDATASTRUCT = COPYDATASTRUCT*; struct CURSORSHAPE { int xHotSpot; @@ -2622,7 +2622,7 @@ struct CURSORSHAPE { BYTE Planes; BYTE BitsPixel; } -alias CURSORSHAPE* LPCURSORSHAPE; +alias LPCURSORSHAPE = CURSORSHAPE*; struct CWPRETSTRUCT { LRESULT lResult; @@ -2638,7 +2638,7 @@ struct CWPSTRUCT { UINT message; HWND hwnd; } -alias CWPSTRUCT* PCWPSTRUCT; +alias PCWPSTRUCT = CWPSTRUCT*; struct DEBUGHOOKINFO { DWORD idThread; @@ -2647,7 +2647,7 @@ struct DEBUGHOOKINFO { WPARAM wParam; int code; } -alias DEBUGHOOKINFO* PDEBUGHOOKINFO, LPDEBUGHOOKINFO; +alias PDEBUGHOOKINFO = DEBUGHOOKINFO*, LPDEBUGHOOKINFO = DEBUGHOOKINFO*; struct DELETEITEMSTRUCT { UINT CtlType; @@ -2656,7 +2656,7 @@ struct DELETEITEMSTRUCT { HWND hwndItem; ULONG_PTR itemData; } -alias DELETEITEMSTRUCT* PDELETEITEMSTRUCT, LPDELETEITEMSTRUCT; +alias PDELETEITEMSTRUCT = DELETEITEMSTRUCT*, LPDELETEITEMSTRUCT = DELETEITEMSTRUCT*; align(2): struct DLGITEMTEMPLATE { @@ -2668,7 +2668,7 @@ struct DLGITEMTEMPLATE { short cy; WORD id; } -alias DLGITEMTEMPLATE* LPDLGITEMTEMPLATE; +alias LPDLGITEMTEMPLATE = DLGITEMTEMPLATE*; struct DLGTEMPLATE { DWORD style; @@ -2679,8 +2679,8 @@ struct DLGTEMPLATE { short cx; short cy; } -alias DLGTEMPLATE* LPDLGTEMPLATE, LPDLGTEMPLATEA, LPDLGTEMPLATEW; -alias const(DLGTEMPLATE)* LPCDLGTEMPLATE, LPCDLGTEMPLATEA, LPCDLGTEMPLATEW; +alias LPDLGTEMPLATE = DLGTEMPLATE*, LPDLGTEMPLATEA = DLGTEMPLATE*, LPDLGTEMPLATEW = DLGTEMPLATE*; +alias LPCDLGTEMPLATE = const(DLGTEMPLATE)*, LPCDLGTEMPLATEA = const(DLGTEMPLATE)*, LPCDLGTEMPLATEW = const(DLGTEMPLATE)*; align: @@ -2695,7 +2695,7 @@ struct DRAWITEMSTRUCT { RECT rcItem; ULONG_PTR itemData; } -alias DRAWITEMSTRUCT* LPDRAWITEMSTRUCT, PDRAWITEMSTRUCT; +alias LPDRAWITEMSTRUCT = DRAWITEMSTRUCT*, PDRAWITEMSTRUCT = DRAWITEMSTRUCT*; struct DRAWTEXTPARAMS { UINT cbSize = DRAWTEXTPARAMS.sizeof; @@ -2704,7 +2704,7 @@ struct DRAWTEXTPARAMS { int iRightMargin; UINT uiLengthDrawn; } -alias DRAWTEXTPARAMS* LPDRAWTEXTPARAMS; +alias LPDRAWTEXTPARAMS = DRAWTEXTPARAMS*; struct PAINTSTRUCT { HDC hdc; @@ -2714,7 +2714,7 @@ struct PAINTSTRUCT { BOOL fIncUpdate; BYTE[32] rgbReserved; } -alias PAINTSTRUCT* PPAINTSTRUCT, NPPAINTSTRUCT, LPPAINTSTRUCT; +alias PPAINTSTRUCT = PAINTSTRUCT*, NPPAINTSTRUCT = PAINTSTRUCT*, LPPAINTSTRUCT = PAINTSTRUCT*; struct MSG { HWND hwnd; @@ -2724,7 +2724,7 @@ struct MSG { DWORD time; POINT pt; } -alias MSG* NPMSG, LPMSG, PMSG; +alias NPMSG = MSG*, LPMSG = MSG*, PMSG = MSG*; struct ICONINFO { BOOL fIcon; @@ -2733,14 +2733,14 @@ struct ICONINFO { HBITMAP hbmMask; HBITMAP hbmColor; } -alias ICONINFO* PICONINFO; +alias PICONINFO = ICONINFO*; struct NMHDR { HWND hwndFrom; UINT_PTR idFrom; UINT code; } -alias NMHDR* LPNMHDR; +alias LPNMHDR = NMHDR*; struct WNDCLASSA { UINT style; @@ -2754,7 +2754,7 @@ struct WNDCLASSA { LPCSTR lpszMenuName; LPCSTR lpszClassName; } -alias WNDCLASSA* NPWNDCLASSA, LPWNDCLASSA, PWNDCLASSA; +alias NPWNDCLASSA = WNDCLASSA*, LPWNDCLASSA = WNDCLASSA*, PWNDCLASSA = WNDCLASSA*; struct WNDCLASSW { UINT style; @@ -2768,7 +2768,7 @@ struct WNDCLASSW { LPCWSTR lpszMenuName; LPCWSTR lpszClassName; } -alias WNDCLASSW* NPWNDCLASSW, LPWNDCLASSW, PWNDCLASSW; +alias NPWNDCLASSW = WNDCLASSW*, LPWNDCLASSW = WNDCLASSW*, PWNDCLASSW = WNDCLASSW*; struct WNDCLASSEXA { UINT cbSize = WNDCLASSEXA.sizeof; @@ -2784,7 +2784,7 @@ struct WNDCLASSEXA { LPCSTR lpszClassName; HICON hIconSm; } -alias WNDCLASSEXA* NPWNDCLASSEXA, LPWNDCLASSEXA, PWNDCLASSEXA; +alias NPWNDCLASSEXA = WNDCLASSEXA*, LPWNDCLASSEXA = WNDCLASSEXA*, PWNDCLASSEXA = WNDCLASSEXA*; struct WNDCLASSEXW { UINT cbSize = WNDCLASSEXW.sizeof; @@ -2800,7 +2800,7 @@ struct WNDCLASSEXW { LPCWSTR lpszClassName; HICON hIconSm; } -alias WNDCLASSEXW* LPWNDCLASSEXW, PWNDCLASSEXW; +alias LPWNDCLASSEXW = WNDCLASSEXW*, PWNDCLASSEXW = WNDCLASSEXW*; struct MENUITEMINFOA { UINT cbSize = MENUITEMINFOA.sizeof; @@ -2816,8 +2816,8 @@ struct MENUITEMINFOA { UINT cch; HBITMAP hbmpItem; } -alias MENUITEMINFOA* LPMENUITEMINFOA; -alias const(MENUITEMINFOA)* LPCMENUITEMINFOA; +alias LPMENUITEMINFOA = MENUITEMINFOA*; +alias LPCMENUITEMINFOA = const(MENUITEMINFOA)*; struct MENUITEMINFOW { UINT cbSize = MENUITEMINFOW.sizeof; @@ -2833,8 +2833,8 @@ struct MENUITEMINFOW { UINT cch; HBITMAP hbmpItem; } -alias MENUITEMINFOW* LPMENUITEMINFOW; -alias const(MENUITEMINFOW)* LPCMENUITEMINFOW; +alias LPMENUITEMINFOW = MENUITEMINFOW*; +alias LPCMENUITEMINFOW = const(MENUITEMINFOW)*; struct SCROLLINFO { UINT cbSize = this.sizeof; @@ -2845,8 +2845,8 @@ struct SCROLLINFO { int nPos; int nTrackPos; } -alias SCROLLINFO* LPSCROLLINFO; -alias const(SCROLLINFO)* LPCSCROLLINFO; +alias LPSCROLLINFO = SCROLLINFO*; +alias LPCSCROLLINFO = const(SCROLLINFO)*; struct WINDOWPLACEMENT { UINT length; @@ -2856,7 +2856,7 @@ struct WINDOWPLACEMENT { POINT ptMaxPosition; RECT rcNormalPosition; } -alias WINDOWPLACEMENT* LPWINDOWPLACEMENT, PWINDOWPLACEMENT; +alias LPWINDOWPLACEMENT = WINDOWPLACEMENT*, PWINDOWPLACEMENT = WINDOWPLACEMENT*; struct MENUITEMTEMPLATEHEADER { WORD versionNumber; @@ -2869,9 +2869,9 @@ struct MENUITEMTEMPLATE { WCHAR[1] mtString = 0; } -alias void MENUTEMPLATE, MENUTEMPLATEA, MENUTEMPLATEW; +alias MENUTEMPLATE = void, MENUTEMPLATEA = void, MENUTEMPLATEW = void; -alias MENUTEMPLATE* LPMENUTEMPLATEA, LPMENUTEMPLATEW, LPMENUTEMPLATE; +alias LPMENUTEMPLATEA = MENUTEMPLATE*, LPMENUTEMPLATEW = MENUTEMPLATE*, LPMENUTEMPLATE = MENUTEMPLATE*; struct HELPINFO { UINT cbSize = this.sizeof; @@ -2881,7 +2881,7 @@ struct HELPINFO { DWORD_PTR dwContextId; POINT MousePos; } -alias HELPINFO* LPHELPINFO; +alias LPHELPINFO = HELPINFO*; struct MSGBOXPARAMSA { UINT cbSize = this.sizeof; @@ -2895,7 +2895,7 @@ struct MSGBOXPARAMSA { MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } -alias MSGBOXPARAMSA* PMSGBOXPARAMSA, LPMSGBOXPARAMSA; +alias PMSGBOXPARAMSA = MSGBOXPARAMSA*, LPMSGBOXPARAMSA = MSGBOXPARAMSA*; struct MSGBOXPARAMSW { UINT cbSize = this.sizeof; @@ -2909,7 +2909,7 @@ struct MSGBOXPARAMSW { MSGBOXCALLBACK lpfnMsgBoxCallback; DWORD dwLanguageId; } -alias MSGBOXPARAMSW* PMSGBOXPARAMSW, LPMSGBOXPARAMSW; +alias PMSGBOXPARAMSW = MSGBOXPARAMSW*, LPMSGBOXPARAMSW = MSGBOXPARAMSW*; struct USEROBJECTFLAGS { BOOL fInherit; @@ -2931,14 +2931,14 @@ struct HIGHCONTRASTA { DWORD dwFlags; LPSTR lpszDefaultScheme; } -alias HIGHCONTRASTA* LPHIGHCONTRASTA; +alias LPHIGHCONTRASTA = HIGHCONTRASTA*; struct HIGHCONTRASTW { UINT cbSize = this.sizeof; DWORD dwFlags; LPWSTR lpszDefaultScheme; } -alias HIGHCONTRASTW* LPHIGHCONTRASTW; +alias LPHIGHCONTRASTW = HIGHCONTRASTW*; struct ICONMETRICSA { UINT cbSize = this.sizeof; @@ -2947,7 +2947,7 @@ struct ICONMETRICSA { int iTitleWrap; LOGFONTA lfFont; } -alias ICONMETRICSA* LPICONMETRICSA; +alias LPICONMETRICSA = ICONMETRICSA*; struct ICONMETRICSW { UINT cbSize = this.sizeof; @@ -2956,7 +2956,7 @@ struct ICONMETRICSW { int iTitleWrap; LOGFONTW lfFont; } -alias ICONMETRICSW* LPICONMETRICSW; +alias LPICONMETRICSW = ICONMETRICSW*; struct MINIMIZEDMETRICS { UINT cbSize = this.sizeof; @@ -2965,7 +2965,7 @@ struct MINIMIZEDMETRICS { int iVertGap; int iArrange; } -alias MINIMIZEDMETRICS* LPMINIMIZEDMETRICS; +alias LPMINIMIZEDMETRICS = MINIMIZEDMETRICS*; struct MOUSEKEYS { UINT cbSize = this.sizeof; @@ -2976,7 +2976,7 @@ struct MOUSEKEYS { DWORD dwReserved1; DWORD dwReserved2; } -alias MOUSEKEYS* LPMOUSEKEYS; +alias LPMOUSEKEYS = MOUSEKEYS*; struct NONCLIENTMETRICSA { UINT cbSize = this.sizeof; @@ -2995,7 +2995,7 @@ struct NONCLIENTMETRICSA { LOGFONTA lfStatusFont; LOGFONTA lfMessageFont; } -alias NONCLIENTMETRICSA* LPNONCLIENTMETRICSA; +alias LPNONCLIENTMETRICSA = NONCLIENTMETRICSA*; struct NONCLIENTMETRICSW { UINT cbSize = this.sizeof; @@ -3014,7 +3014,7 @@ struct NONCLIENTMETRICSW { LOGFONTW lfStatusFont; LOGFONTW lfMessageFont; } -alias NONCLIENTMETRICSW* LPNONCLIENTMETRICSW; +alias LPNONCLIENTMETRICSW = NONCLIENTMETRICSW*; struct SERIALKEYSA { UINT cbSize = this.sizeof; @@ -3025,7 +3025,7 @@ struct SERIALKEYSA { UINT iPortState; UINT iActive; } -alias SERIALKEYSA* LPSERIALKEYSA; +alias LPSERIALKEYSA = SERIALKEYSA*; struct SERIALKEYSW { UINT cbSize = this.sizeof; @@ -3036,7 +3036,7 @@ struct SERIALKEYSW { UINT iPortState; UINT iActive; } -alias SERIALKEYSW* LPSERIALKEYSW; +alias LPSERIALKEYSW = SERIALKEYSW*; struct SOUNDSENTRYA { UINT cbSize = this.sizeof; @@ -3052,7 +3052,7 @@ struct SOUNDSENTRYA { LPSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } -alias SOUNDSENTRYA* LPSOUNDSENTRYA; +alias LPSOUNDSENTRYA = SOUNDSENTRYA*; struct SOUNDSENTRYW { UINT cbSize = this.sizeof; @@ -3068,13 +3068,13 @@ struct SOUNDSENTRYW { LPWSTR lpszWindowsEffectDLL; DWORD iWindowsEffectOrdinal; } -alias SOUNDSENTRYW* LPSOUNDSENTRYW; +alias LPSOUNDSENTRYW = SOUNDSENTRYW*; struct STICKYKEYS { DWORD cbSize = this.sizeof; DWORD dwFlags; } -alias STICKYKEYS* LPSTICKYKEYS; +alias LPSTICKYKEYS = STICKYKEYS*; struct TOGGLEKEYS { DWORD cbSize = this.sizeof; @@ -3087,7 +3087,7 @@ struct MOUSEHOOKSTRUCT { UINT wHitTestCode; ULONG_PTR dwExtraInfo; } -alias MOUSEHOOKSTRUCT* LPMOUSEHOOKSTRUCT, PMOUSEHOOKSTRUCT; +alias LPMOUSEHOOKSTRUCT = MOUSEHOOKSTRUCT*, PMOUSEHOOKSTRUCT = MOUSEHOOKSTRUCT*; struct TRACKMOUSEEVENT { DWORD cbSize = this.sizeof; @@ -3095,13 +3095,13 @@ struct TRACKMOUSEEVENT { HWND hwndTrack; DWORD dwHoverTime; } -alias TRACKMOUSEEVENT* LPTRACKMOUSEEVENT; +alias LPTRACKMOUSEEVENT = TRACKMOUSEEVENT*; struct TPMPARAMS { UINT cbSize = this.sizeof; RECT rcExclude; } -alias TPMPARAMS* LPTPMPARAMS; +alias LPTPMPARAMS = TPMPARAMS*; struct EVENTMSG { UINT message; @@ -3110,7 +3110,7 @@ struct EVENTMSG { DWORD time; HWND hwnd; } -alias EVENTMSG* PEVENTMSGMSG, LPEVENTMSGMSG, PEVENTMSG, LPEVENTMSG; +alias PEVENTMSGMSG = EVENTMSG*, LPEVENTMSGMSG = EVENTMSG*, PEVENTMSG = EVENTMSG*, LPEVENTMSG = EVENTMSG*; struct WINDOWPOS { HWND hwnd; @@ -3121,13 +3121,13 @@ struct WINDOWPOS { int cy; UINT flags; } -alias WINDOWPOS* PWINDOWPOS, LPWINDOWPOS; +alias PWINDOWPOS = WINDOWPOS*, LPWINDOWPOS = WINDOWPOS*; struct NCCALCSIZE_PARAMS { RECT[3] rgrc; PWINDOWPOS lppos; } -alias NCCALCSIZE_PARAMS* LPNCCALCSIZE_PARAMS; +alias LPNCCALCSIZE_PARAMS = NCCALCSIZE_PARAMS*; struct MDICREATESTRUCTA { LPCSTR szClass; @@ -3140,7 +3140,7 @@ struct MDICREATESTRUCTA { DWORD style; LPARAM lParam; } -alias MDICREATESTRUCTA* LPMDICREATESTRUCTA; +alias LPMDICREATESTRUCTA = MDICREATESTRUCTA*; struct MDICREATESTRUCTW { LPCWSTR szClass; @@ -3153,7 +3153,7 @@ struct MDICREATESTRUCTW { DWORD style; LPARAM lParam; } -alias MDICREATESTRUCTW* LPMDICREATESTRUCTW; +alias LPMDICREATESTRUCTW = MDICREATESTRUCTW*; struct MINMAXINFO { POINT ptReserved; @@ -3162,14 +3162,14 @@ struct MINMAXINFO { POINT ptMinTrackSize; POINT ptMaxTrackSize; } -alias MINMAXINFO* PMINMAXINFO, LPMINMAXINFO; +alias PMINMAXINFO = MINMAXINFO*, LPMINMAXINFO = MINMAXINFO*; struct MDINEXTMENU { HMENU hmenuIn; HMENU hmenuNext; HWND hwndNext; } -alias MDINEXTMENU* PMDINEXTMENU, LPMDINEXTMENU; +alias PMDINEXTMENU = MDINEXTMENU*, LPMDINEXTMENU = MDINEXTMENU*; struct MEASUREITEMSTRUCT { UINT CtlType; @@ -3179,7 +3179,7 @@ struct MEASUREITEMSTRUCT { UINT itemHeight; ULONG_PTR itemData; } -alias MEASUREITEMSTRUCT* PMEASUREITEMSTRUCT, LPMEASUREITEMSTRUCT; +alias PMEASUREITEMSTRUCT = MEASUREITEMSTRUCT*, LPMEASUREITEMSTRUCT = MEASUREITEMSTRUCT*; struct DROPSTRUCT { HWND hwndSource; @@ -3189,23 +3189,23 @@ struct DROPSTRUCT { POINT ptDrop; DWORD dwControlData; } -alias DROPSTRUCT* PDROPSTRUCT, LPDROPSTRUCT; +alias PDROPSTRUCT = DROPSTRUCT*, LPDROPSTRUCT = DROPSTRUCT*; -alias DWORD HELPPOLY; +alias HELPPOLY = DWORD; struct MULTIKEYHELPA { DWORD mkSize; CHAR mkKeylist = 0; CHAR[1] szKeyphrase = 0; } -alias MULTIKEYHELPA* PMULTIKEYHELPA, LPMULTIKEYHELPA; +alias PMULTIKEYHELPA = MULTIKEYHELPA*, LPMULTIKEYHELPA = MULTIKEYHELPA*; struct MULTIKEYHELPW { DWORD mkSize; WCHAR mkKeylist = 0; WCHAR[1] szKeyphrase = 0; } -alias MULTIKEYHELPW* PMULTIKEYHELPW, LPMULTIKEYHELPW; +alias PMULTIKEYHELPW = MULTIKEYHELPW*, LPMULTIKEYHELPW = MULTIKEYHELPW*; struct HELPWININFOA { int wStructSize; @@ -3216,7 +3216,7 @@ struct HELPWININFOA { int wMax; CHAR[2] rgchMember = 0; } -alias HELPWININFOA* PHELPWININFOA, LPHELPWININFOA; +alias PHELPWININFOA = HELPWININFOA*, LPHELPWININFOA = HELPWININFOA*; struct HELPWININFOW { int wStructSize; @@ -3227,13 +3227,13 @@ struct HELPWININFOW { int wMax; WCHAR[2] rgchMember = 0; } -alias HELPWININFOW* PHELPWININFOW, LPHELPWININFOW; +alias PHELPWININFOW = HELPWININFOW*, LPHELPWININFOW = HELPWININFOW*; struct STYLESTRUCT { DWORD styleOld; DWORD styleNew; } -alias STYLESTRUCT* LPSTYLESTRUCT; +alias LPSTYLESTRUCT = STYLESTRUCT*; struct ALTTABINFO { DWORD cbSize = this.sizeof; @@ -3246,7 +3246,7 @@ struct ALTTABINFO { int cyItem; POINT ptStart; } -alias ALTTABINFO* PALTTABINFO, LPALTTABINFO; +alias PALTTABINFO = ALTTABINFO*, LPALTTABINFO = ALTTABINFO*; struct COMBOBOXINFO { DWORD cbSize = this.sizeof; @@ -3257,7 +3257,7 @@ struct COMBOBOXINFO { HWND hwndItem; HWND hwndList; } -alias COMBOBOXINFO* PCOMBOBOXINFO, LPCOMBOBOXINFO; +alias PCOMBOBOXINFO = COMBOBOXINFO*, LPCOMBOBOXINFO = COMBOBOXINFO*; struct CURSORINFO { DWORD cbSize = this.sizeof; @@ -3265,7 +3265,7 @@ struct CURSORINFO { HCURSOR hCursor; POINT ptScreenPos; } -alias CURSORINFO* PCURSORINFO, LPCURSORINFO; +alias PCURSORINFO = CURSORINFO*, LPCURSORINFO = CURSORINFO*; struct MENUBARINFO { DWORD cbSize = this.sizeof; @@ -3280,7 +3280,7 @@ struct MENUBARINFO { bool fBarFocused()(bool b) { bf_ = cast(byte) ((bf_ & 0xFE) | b); return b; } bool fFocused()(bool b) { bf_ = cast(byte) (b ? (bf_ | 2) : bf_ & 0xFD); return b; } } -alias MENUBARINFO* PMENUBARINFO; +alias PMENUBARINFO = MENUBARINFO*; struct MENUINFO { DWORD cbSize = this.sizeof; @@ -3291,8 +3291,8 @@ struct MENUINFO { DWORD dwContextHelpID; ULONG_PTR dwMenuData; } -alias MENUINFO* LPMENUINFO; -alias const(MENUINFO)* LPCMENUINFO; +alias LPMENUINFO = MENUINFO*; +alias LPCMENUINFO = const(MENUINFO)*; enum CCHILDREN_SCROLLBAR = 5; @@ -3306,7 +3306,7 @@ struct SCROLLBARINFO { int reserved; DWORD[CCHILDREN_SCROLLBAR+1] rgstate; } -alias SCROLLBARINFO* PSCROLLBARINFO, LPSCROLLBARINFO; +alias PSCROLLBARINFO = SCROLLBARINFO*, LPSCROLLBARINFO = SCROLLBARINFO*; enum CCHILDREN_TITLEBAR = 5; @@ -3322,13 +3322,13 @@ struct WINDOWINFO { ATOM atomWindowType; WORD wCreatorVersion; } -alias WINDOWINFO* PWINDOWINFO, LPWINDOWINFO; +alias PWINDOWINFO = WINDOWINFO*, LPWINDOWINFO = WINDOWINFO*; struct LASTINPUTINFO { UINT cbSize = this.sizeof; DWORD dwTime; } -alias LASTINPUTINFO* PLASTINPUTINFO; +alias PLASTINPUTINFO = LASTINPUTINFO*; struct MONITORINFO { DWORD cbSize = this.sizeof; @@ -3336,7 +3336,7 @@ struct MONITORINFO { RECT rcWork; DWORD dwFlags; } -alias MONITORINFO* LPMONITORINFO; +alias LPMONITORINFO = MONITORINFO*; enum CCHDEVICENAME = 32; @@ -3347,7 +3347,7 @@ struct MONITORINFOEXA { DWORD dwFlags; CHAR[CCHDEVICENAME] szDevice = 0; } -alias MONITORINFOEXA* LPMONITORINFOEXA; +alias LPMONITORINFOEXA = MONITORINFOEXA*; struct MONITORINFOEXW { DWORD cbSize = MONITORINFOEXW.sizeof; @@ -3356,7 +3356,7 @@ struct MONITORINFOEXW { DWORD dwFlags; WCHAR[CCHDEVICENAME] szDevice = 0; } -alias MONITORINFOEXW* LPMONITORINFOEXW; +alias LPMONITORINFOEXW = MONITORINFOEXW*; struct KBDLLHOOKSTRUCT { DWORD vkCode; @@ -3365,7 +3365,7 @@ struct KBDLLHOOKSTRUCT { DWORD time; ULONG_PTR dwExtraInfo; } -alias KBDLLHOOKSTRUCT* LPKBDLLHOOKSTRUCT, PKBDLLHOOKSTRUCT; +alias LPKBDLLHOOKSTRUCT = KBDLLHOOKSTRUCT*, PKBDLLHOOKSTRUCT = KBDLLHOOKSTRUCT*; struct MSLLHOOKSTRUCT { POINT pt; @@ -3374,7 +3374,7 @@ struct MSLLHOOKSTRUCT { DWORD time; ULONG_PTR dwExtraInfo; } -alias MSLLHOOKSTRUCT* PMSLLHOOKSTRUCT; +alias PMSLLHOOKSTRUCT = MSLLHOOKSTRUCT*; struct MOUSEINPUT { LONG dx; @@ -3384,7 +3384,7 @@ struct MOUSEINPUT { DWORD time; ULONG_PTR dwExtraInfo; } -alias MOUSEINPUT* PMOUSEINPUT; +alias PMOUSEINPUT = MOUSEINPUT*; struct KEYBDINPUT { WORD wVk; @@ -3393,14 +3393,14 @@ struct KEYBDINPUT { DWORD time; ULONG_PTR dwExtraInfo; } -alias KEYBDINPUT* PKEYBDINPUT; +alias PKEYBDINPUT = KEYBDINPUT*; struct HARDWAREINPUT { DWORD uMsg; WORD wParamL; WORD wParamH; } -alias HARDWAREINPUT* PHARDWAREINPUT; +alias PHARDWAREINPUT = HARDWAREINPUT*; struct INPUT { DWORD type; @@ -3410,7 +3410,7 @@ struct INPUT { HARDWAREINPUT hi; } } -alias INPUT* PINPUT, LPINPUT; +alias PINPUT = INPUT*, LPINPUT = INPUT*; static if (_WIN32_WINNT >= 0x501) { align(4) struct BSMINFO { @@ -3419,9 +3419,9 @@ static if (_WIN32_WINNT >= 0x501) { HWND hwnd; align(4) LUID luid; } - alias BSMINFO* PBSMINFO; + alias PBSMINFO = BSMINFO*; - alias HANDLE HRAWINPUT; + alias HRAWINPUT = HANDLE; struct RAWINPUTHEADER { DWORD dwType; @@ -3429,7 +3429,7 @@ align(4) LUID luid; HANDLE hDevice; WPARAM wParam; } - alias RAWINPUTHEADER* PRAWINPUTHEADER; + alias PRAWINPUTHEADER = RAWINPUTHEADER*; struct RAWMOUSE { USHORT usFlags; @@ -3445,7 +3445,7 @@ align(4) LUID luid; LONG lLastY; ULONG ulExtraInformation; } - alias RAWMOUSE* PRAWMOUSE, LPRAWMOUSE; + alias PRAWMOUSE = RAWMOUSE*, LPRAWMOUSE = RAWMOUSE*; struct RAWKEYBOARD { USHORT MakeCode; @@ -3455,14 +3455,14 @@ align(4) LUID luid; UINT Message; ULONG ExtraInformation; } - alias RAWKEYBOARD* PRAWKEYBOARD, LPRAWKEYBOARD; + alias PRAWKEYBOARD = RAWKEYBOARD*, LPRAWKEYBOARD = RAWKEYBOARD*; struct RAWHID { DWORD dwSizeHid; DWORD dwCount; BYTE bRawData; } - alias RAWHID* PRAWHID, LPRAWHID; + alias PRAWHID = RAWHID*, LPRAWHID = RAWHID*; struct RAWINPUT { RAWINPUTHEADER header; @@ -3473,7 +3473,7 @@ align(4) LUID luid; } _data data; } - alias RAWINPUT* PRAWINPUT, LPRAWINPUT; + alias PRAWINPUT = RAWINPUT*, LPRAWINPUT = RAWINPUT*; struct RAWINPUTDEVICE { USHORT usUsagePage; @@ -3481,14 +3481,14 @@ align(4) LUID luid; DWORD dwFlags; HWND hwndTarget; } - alias RAWINPUTDEVICE* PRAWINPUTDEVICE, LPRAWINPUTDEVICE; - alias const(RAWINPUTDEVICE)* PCRAWINPUTDEVICE; + alias PRAWINPUTDEVICE = RAWINPUTDEVICE*, LPRAWINPUTDEVICE = RAWINPUTDEVICE*; + alias PCRAWINPUTDEVICE = const(RAWINPUTDEVICE)*; struct RAWINPUTDEVICELIST { HANDLE hDevice; DWORD dwType; } - alias RAWINPUTDEVICELIST* PRAWINPUTDEVICELIST; + alias PRAWINPUTDEVICELIST = RAWINPUTDEVICELIST*; struct RID_DEVICE_INFO_MOUSE { DWORD dwId; @@ -3525,20 +3525,20 @@ align(4) LUID luid; } }// (_WIN32_WINNT >= 0x501) -alias CharToOemA AnsiToOem; -alias OemToCharA OemToAnsi; -alias CharToOemBuffA AnsiToOemBuff; -alias OemToCharBuffA OemToAnsiBuff; -alias CharUpperA AnsiUpper; -alias CharUpperBuffA AnsiUpperBuff; -alias CharLowerA AnsiLower; -alias CharLowerBuffA AnsiLowerBuff; -alias CharNextA AnsiNext; -alias CharPrevA AnsiPrev; - -alias MAKELONG MAKEWPARAM; -alias MAKELONG MAKELPARAM; -alias MAKELONG MAKELRESULT; +alias AnsiToOem = CharToOemA; +alias OemToAnsi = OemToCharA; +alias AnsiToOemBuff = CharToOemBuffA; +alias OemToAnsiBuff = OemToCharBuffA; +alias AnsiUpper = CharUpperA; +alias AnsiUpperBuff = CharUpperBuffA; +alias AnsiLower = CharLowerA; +alias AnsiLowerBuff = CharLowerBuffA; +alias AnsiNext = CharNextA; +alias AnsiPrev = CharPrevA; + +alias MAKEWPARAM = MAKELONG; +alias MAKELPARAM = MAKELONG; +alias MAKELRESULT = MAKELONG; void POINTSTOPOINT()(out POINT p, LONG ps) { p.x = LOWORD(ps); @@ -3717,7 +3717,7 @@ nothrow @nogc { return ExitWindowsEx(EWX_LOGOFF, 0); } } -alias GetWindow GetNextWindow; +alias GetNextWindow = GetWindow; extern (Windows) nothrow @nogc: LRESULT DispatchMessageA(const(MSG)*); @@ -4155,7 +4155,7 @@ extern (C) { // These shouldn't be necessary for D. -alias char* va_list_; +alias va_list_ = char*; int wvsprintfA(LPSTR, LPCSTR, va_list_ arglist); int wvsprintfW(LPWSTR, LPCWSTR, va_list_ arglist); @@ -4181,7 +4181,7 @@ struct TITLEBARINFO { RECT rcTitleBar; DWORD[CCHILDREN_TITLEBAR+1] rgstate; } -alias TITLEBARINFO* PTITLEBARINFO, LPTITLEBARINFO; +alias PTITLEBARINFO = TITLEBARINFO*, LPTITLEBARINFO = TITLEBARINFO*; static if (_WIN32_WINNT >= 0x501) { // *** correct? struct FLASHWINFO { @@ -4191,7 +4191,7 @@ static if (_WIN32_WINNT >= 0x501) { // *** correct? UINT uCount; DWORD dwTimeout; } - alias FLASHWINFO* PFLASHWINFO; + alias PFLASHWINFO = FLASHWINFO*; } enum DWORD ASFW_ANY = -1; @@ -4210,7 +4210,7 @@ struct MOUSEMOVEPOINT { DWORD time; ULONG_PTR dwExtraInfo; } -alias MOUSEMOVEPOINT* PMOUSEMOVEPOINT, LPMOUSEMOVEPOINT; +alias PMOUSEMOVEPOINT = MOUSEMOVEPOINT*, LPMOUSEMOVEPOINT = MOUSEMOVEPOINT*; enum { MIM_MAXHEIGHT = 1, @@ -4413,9 +4413,9 @@ struct GUITHREADINFO { HWND hwndCaret; RECT rcCaret; } -alias GUITHREADINFO* PGUITHREADINFO, LPGUITHREADINFO; +alias PGUITHREADINFO = GUITHREADINFO*, LPGUITHREADINFO = GUITHREADINFO*; extern (Windows) { - alias void function(HWINEVENTHOOK, DWORD, HWND, LONG, LONG, DWORD, DWORD) WINEVENTPROC; + alias WINEVENTPROC = void function(HWINEVENTHOOK, DWORD, HWND, LONG, LONG, DWORD, DWORD); } // *** line 4680 of MinGW 4.0 int BroadcastSystemMessageA(DWORD, LPDWORD, UINT, WPARAM, LPARAM); @@ -4486,375 +4486,375 @@ version (Win64) { LONG_PTR SetWindowLongPtrA(HWND, int, LONG_PTR); LONG_PTR SetWindowLongPtrW(HWND, int, LONG_PTR); } else { - alias GetClassLongA GetClassLongPtrA; - alias GetClassLongW GetClassLongPtrW; - alias SetClassLongA SetClassLongPtrA; - alias SetClassLongW SetClassLongPtrW; - alias GetWindowLongA GetWindowLongPtrA; - alias GetWindowLongW GetWindowLongPtrW; - alias SetWindowLongA SetWindowLongPtrA; - alias SetWindowLongW SetWindowLongPtrW; + alias GetClassLongPtrA = GetClassLongA; + alias GetClassLongPtrW = GetClassLongW; + alias SetClassLongPtrA = SetClassLongA; + alias SetClassLongPtrW = SetClassLongW; + alias GetWindowLongPtrA = GetWindowLongA; + alias GetWindowLongPtrW = GetWindowLongW; + alias SetWindowLongPtrA = SetWindowLongA; + alias SetWindowLongPtrW = SetWindowLongW; } // ----- // Aliases for Unicode or Ansi version (Unicode) { - alias EDITWORDBREAKPROCW EDITWORDBREAKPROC; - alias PROPENUMPROCW PROPENUMPROC; - alias PROPENUMPROCEXW PROPENUMPROCEX; - alias DESKTOPENUMPROCW DESKTOPENUMPROC; - alias WINSTAENUMPROCW WINSTAENUMPROC; - alias MAKEINTRESOURCEW MAKEINTRESOURCE; - - alias WNDCLASSW WNDCLASS; - alias WNDCLASSEXW WNDCLASSEX; - alias MENUITEMINFOW MENUITEMINFO; - alias LPCMENUITEMINFOW LPCMENUITEMINFO; - alias MSGBOXPARAMSW MSGBOXPARAMS; - alias HIGHCONTRASTW HIGHCONTRAST; - alias SERIALKEYSW SERIALKEYS; - alias SOUNDSENTRYW SOUNDSENTRY; - alias CREATESTRUCTW CREATESTRUCT; - alias CBT_CREATEWNDW CBT_CREATEWND; - alias MDICREATESTRUCTW MDICREATESTRUCT; - alias MULTIKEYHELPW MULTIKEYHELP; - alias MONITORINFOEXW MONITORINFOEX; - alias ICONMETRICSW ICONMETRICS; - alias NONCLIENTMETRICSW NONCLIENTMETRICS; - - alias AppendMenuW AppendMenu; - alias BroadcastSystemMessageW BroadcastSystemMessage; + alias EDITWORDBREAKPROC = EDITWORDBREAKPROCW; + alias PROPENUMPROC = PROPENUMPROCW; + alias PROPENUMPROCEX = PROPENUMPROCEXW; + alias DESKTOPENUMPROC = DESKTOPENUMPROCW; + alias WINSTAENUMPROC = WINSTAENUMPROCW; + alias MAKEINTRESOURCE = MAKEINTRESOURCEW; + + alias WNDCLASS = WNDCLASSW; + alias WNDCLASSEX = WNDCLASSEXW; + alias MENUITEMINFO = MENUITEMINFOW; + alias LPCMENUITEMINFO = LPCMENUITEMINFOW; + alias MSGBOXPARAMS = MSGBOXPARAMSW; + alias HIGHCONTRAST = HIGHCONTRASTW; + alias SERIALKEYS = SERIALKEYSW; + alias SOUNDSENTRY = SOUNDSENTRYW; + alias CREATESTRUCT = CREATESTRUCTW; + alias CBT_CREATEWND = CBT_CREATEWNDW; + alias MDICREATESTRUCT = MDICREATESTRUCTW; + alias MULTIKEYHELP = MULTIKEYHELPW; + alias MONITORINFOEX = MONITORINFOEXW; + alias ICONMETRICS = ICONMETRICSW; + alias NONCLIENTMETRICS = NONCLIENTMETRICSW; + + alias AppendMenu = AppendMenuW; + alias BroadcastSystemMessage = BroadcastSystemMessageW; static if (_WIN32_WINNT >= 0x501) { - alias BroadcastSystemMessageExW BroadcastSystemMessageEx; + alias BroadcastSystemMessageEx = BroadcastSystemMessageExW; } - alias CallMsgFilterW CallMsgFilter; - alias CallWindowProcW CallWindowProc; - alias ChangeMenuW ChangeMenu; - alias CharLowerW CharLower; - alias CharLowerBuffW CharLowerBuff; - alias CharNextW CharNext; - alias CharNextExW CharNextEx; - alias CharPrevW CharPrev; - alias CharPrevExW CharPrevEx; - alias CharToOemW CharToOem; - alias CharToOemBuffW CharToOemBuff; - alias CharUpperW CharUpper; - alias CharUpperBuffW CharUpperBuff; - alias CopyAcceleratorTableW CopyAcceleratorTable; - alias CreateAcceleratorTableW CreateAcceleratorTable; - alias CreateDialogW CreateDialog; - alias CreateDialogIndirectW CreateDialogIndirect; - alias CreateDialogIndirectParamW CreateDialogIndirectParam; - alias CreateDialogParamW CreateDialogParam; - alias CreateMDIWindowW CreateMDIWindow; - alias CreateWindowW CreateWindow; - alias CreateWindowExW CreateWindowEx; - alias CreateWindowStationW CreateWindowStation; - alias DefDlgProcW DefDlgProc; - alias DefFrameProcW DefFrameProc; - alias DefMDIChildProcW DefMDIChildProc; - alias DefWindowProcW DefWindowProc; - alias DialogBoxW DialogBox; - alias DialogBoxIndirectW DialogBoxIndirect; - alias DialogBoxIndirectParamW DialogBoxIndirectParam; - alias DialogBoxParamW DialogBoxParam; - alias DispatchMessageW DispatchMessage; - alias DlgDirListW DlgDirList; - alias DlgDirListComboBoxW DlgDirListComboBox; - alias DlgDirSelectComboBoxExW DlgDirSelectComboBoxEx; - alias DlgDirSelectExW DlgDirSelectEx; - alias DrawStateW DrawState; - alias DrawTextW DrawText; - alias DrawTextExW DrawTextEx; - alias EnumDesktopsW EnumDesktops; - alias EnumPropsW EnumProps; - alias EnumPropsExW EnumPropsEx; - alias EnumWindowStationsW EnumWindowStations; - alias FindWindowW FindWindow; - alias FindWindowExW FindWindowEx; - alias GetClassInfoW GetClassInfo; - alias GetClassInfoExW GetClassInfoEx; - alias GetClassLongW GetClassLong; - alias GetClassLongPtrW GetClassLongPtr; - alias GetClassNameW GetClassName; - alias GetClipboardFormatNameW GetClipboardFormatName; - alias GetDlgItemTextW GetDlgItemText; - alias GetKeyboardLayoutNameW GetKeyboardLayoutName; - alias GetKeyNameTextW GetKeyNameText; - alias GetMenuItemInfoW GetMenuItemInfo; - alias GetMenuStringW GetMenuString; - alias GetMessageW GetMessage; - alias GetMonitorInfoW GetMonitorInfo; - alias GetPropW GetProp; + alias CallMsgFilter = CallMsgFilterW; + alias CallWindowProc = CallWindowProcW; + alias ChangeMenu = ChangeMenuW; + alias CharLower = CharLowerW; + alias CharLowerBuff = CharLowerBuffW; + alias CharNext = CharNextW; + alias CharNextEx = CharNextExW; + alias CharPrev = CharPrevW; + alias CharPrevEx = CharPrevExW; + alias CharToOem = CharToOemW; + alias CharToOemBuff = CharToOemBuffW; + alias CharUpper = CharUpperW; + alias CharUpperBuff = CharUpperBuffW; + alias CopyAcceleratorTable = CopyAcceleratorTableW; + alias CreateAcceleratorTable = CreateAcceleratorTableW; + alias CreateDialog = CreateDialogW; + alias CreateDialogIndirect = CreateDialogIndirectW; + alias CreateDialogIndirectParam = CreateDialogIndirectParamW; + alias CreateDialogParam = CreateDialogParamW; + alias CreateMDIWindow = CreateMDIWindowW; + alias CreateWindow = CreateWindowW; + alias CreateWindowEx = CreateWindowExW; + alias CreateWindowStation = CreateWindowStationW; + alias DefDlgProc = DefDlgProcW; + alias DefFrameProc = DefFrameProcW; + alias DefMDIChildProc = DefMDIChildProcW; + alias DefWindowProc = DefWindowProcW; + alias DialogBox = DialogBoxW; + alias DialogBoxIndirect = DialogBoxIndirectW; + alias DialogBoxIndirectParam = DialogBoxIndirectParamW; + alias DialogBoxParam = DialogBoxParamW; + alias DispatchMessage = DispatchMessageW; + alias DlgDirList = DlgDirListW; + alias DlgDirListComboBox = DlgDirListComboBoxW; + alias DlgDirSelectComboBoxEx = DlgDirSelectComboBoxExW; + alias DlgDirSelectEx = DlgDirSelectExW; + alias DrawState = DrawStateW; + alias DrawText = DrawTextW; + alias DrawTextEx = DrawTextExW; + alias EnumDesktops = EnumDesktopsW; + alias EnumProps = EnumPropsW; + alias EnumPropsEx = EnumPropsExW; + alias EnumWindowStations = EnumWindowStationsW; + alias FindWindow = FindWindowW; + alias FindWindowEx = FindWindowExW; + alias GetClassInfo = GetClassInfoW; + alias GetClassInfoEx = GetClassInfoExW; + alias GetClassLong = GetClassLongW; + alias GetClassLongPtr = GetClassLongPtrW; + alias GetClassName = GetClassNameW; + alias GetClipboardFormatName = GetClipboardFormatNameW; + alias GetDlgItemText = GetDlgItemTextW; + alias GetKeyboardLayoutName = GetKeyboardLayoutNameW; + alias GetKeyNameText = GetKeyNameTextW; + alias GetMenuItemInfo = GetMenuItemInfoW; + alias GetMenuString = GetMenuStringW; + alias GetMessage = GetMessageW; + alias GetMonitorInfo = GetMonitorInfoW; + alias GetProp = GetPropW; static if (_WIN32_WINNT >= 0x501) { - alias GetRawInputDeviceInfoW GetRawInputDeviceInfo; + alias GetRawInputDeviceInfo = GetRawInputDeviceInfoW; } - alias GetTabbedTextExtentW GetTabbedTextExtent; - alias GetUserObjectInformationW GetUserObjectInformation; - alias GetWindowLongW GetWindowLong; - alias GetWindowLongPtrW GetWindowLongPtr; - alias GetWindowTextW GetWindowText; - alias GetWindowTextLengthW GetWindowTextLength; - alias GetAltTabInfoW GetAltTabInfo; - alias GetWindowModuleFileNameW GetWindowModuleFileName; - alias GrayStringW GrayString; - alias InsertMenuW InsertMenu; - alias InsertMenuItemW InsertMenuItem; - alias IsCharAlphaW IsCharAlpha; - alias IsCharAlphaNumericW IsCharAlphaNumeric; - alias IsCharLowerW IsCharLower; - alias IsCharUpperW IsCharUpper; - alias IsDialogMessageW IsDialogMessage; - alias LoadAcceleratorsW LoadAccelerators; - alias LoadBitmapW LoadBitmap; - alias LoadCursorW LoadCursor; - alias LoadCursorFromFileW LoadCursorFromFile; - alias LoadIconW LoadIcon; - alias LoadImageW LoadImage; - alias LoadKeyboardLayoutW LoadKeyboardLayout; - alias LoadMenuW LoadMenu; - alias LoadMenuIndirectW LoadMenuIndirect; - alias LoadStringW LoadString; - alias MapVirtualKeyW MapVirtualKey; - alias MapVirtualKeyExW MapVirtualKeyEx; - alias MessageBoxW MessageBox; - alias MessageBoxExW MessageBoxEx; - alias MessageBoxIndirectW MessageBoxIndirect; - alias ModifyMenuW ModifyMenu; - alias OemToCharW OemToChar; - alias OemToCharBuffW OemToCharBuff; - alias OpenDesktopW OpenDesktop; - alias OpenWindowStationW OpenWindowStation; - alias PeekMessageW PeekMessage; - alias PostMessageW PostMessage; - alias PostThreadMessageW PostThreadMessage; - alias RealGetWindowClassW RealGetWindowClass; - alias RegisterClassW RegisterClass; - alias RegisterClassExW RegisterClassEx; - alias RegisterClipboardFormatW RegisterClipboardFormat; - alias RegisterDeviceNotificationW RegisterDeviceNotification; - alias RegisterWindowMessageW RegisterWindowMessage; - alias RemovePropW RemoveProp; - alias SendDlgItemMessageW SendDlgItemMessage; - alias SendMessageW SendMessage; - alias SendMessageCallbackW SendMessageCallback; - alias SendMessageTimeoutW SendMessageTimeout; - alias SendNotifyMessageW SendNotifyMessage; - alias SetClassLongW SetClassLong; - alias SetClassLongPtrW SetClassLongPtr; - alias SetDlgItemTextW SetDlgItemText; - alias SetMenuItemInfoW SetMenuItemInfo; - alias SetPropW SetProp; - alias SetUserObjectInformationW SetUserObjectInformation; - alias SetWindowLongW SetWindowLong; - alias SetWindowLongPtrW SetWindowLongPtr; - alias SetWindowsHookW SetWindowsHook; - alias SetWindowsHookExW SetWindowsHookEx; - alias SetWindowTextW SetWindowText; - alias SystemParametersInfoW SystemParametersInfo; - alias TabbedTextOutW TabbedTextOut; - alias TranslateAcceleratorW TranslateAccelerator; - alias UnregisterClassW UnregisterClass; - alias VkKeyScanW VkKeyScan; - alias VkKeyScanExW VkKeyScanEx; - alias WinHelpW WinHelp; - alias wsprintfW wsprintf; - alias wvsprintfW wvsprintf; - - alias ChangeDisplaySettingsW ChangeDisplaySettings; - alias ChangeDisplaySettingsExW ChangeDisplaySettingsEx; - alias CreateDesktopW CreateDesktop; - alias EnumDisplaySettingsW EnumDisplaySettings; - alias EnumDisplaySettingsExW EnumDisplaySettingsEx; - alias EnumDisplayDevicesW EnumDisplayDevices; + alias GetTabbedTextExtent = GetTabbedTextExtentW; + alias GetUserObjectInformation = GetUserObjectInformationW; + alias GetWindowLong = GetWindowLongW; + alias GetWindowLongPtr = GetWindowLongPtrW; + alias GetWindowText = GetWindowTextW; + alias GetWindowTextLength = GetWindowTextLengthW; + alias GetAltTabInfo = GetAltTabInfoW; + alias GetWindowModuleFileName = GetWindowModuleFileNameW; + alias GrayString = GrayStringW; + alias InsertMenu = InsertMenuW; + alias InsertMenuItem = InsertMenuItemW; + alias IsCharAlpha = IsCharAlphaW; + alias IsCharAlphaNumeric = IsCharAlphaNumericW; + alias IsCharLower = IsCharLowerW; + alias IsCharUpper = IsCharUpperW; + alias IsDialogMessage = IsDialogMessageW; + alias LoadAccelerators = LoadAcceleratorsW; + alias LoadBitmap = LoadBitmapW; + alias LoadCursor = LoadCursorW; + alias LoadCursorFromFile = LoadCursorFromFileW; + alias LoadIcon = LoadIconW; + alias LoadImage = LoadImageW; + alias LoadKeyboardLayout = LoadKeyboardLayoutW; + alias LoadMenu = LoadMenuW; + alias LoadMenuIndirect = LoadMenuIndirectW; + alias LoadString = LoadStringW; + alias MapVirtualKey = MapVirtualKeyW; + alias MapVirtualKeyEx = MapVirtualKeyExW; + alias MessageBox = MessageBoxW; + alias MessageBoxEx = MessageBoxExW; + alias MessageBoxIndirect = MessageBoxIndirectW; + alias ModifyMenu = ModifyMenuW; + alias OemToChar = OemToCharW; + alias OemToCharBuff = OemToCharBuffW; + alias OpenDesktop = OpenDesktopW; + alias OpenWindowStation = OpenWindowStationW; + alias PeekMessage = PeekMessageW; + alias PostMessage = PostMessageW; + alias PostThreadMessage = PostThreadMessageW; + alias RealGetWindowClass = RealGetWindowClassW; + alias RegisterClass = RegisterClassW; + alias RegisterClassEx = RegisterClassExW; + alias RegisterClipboardFormat = RegisterClipboardFormatW; + alias RegisterDeviceNotification = RegisterDeviceNotificationW; + alias RegisterWindowMessage = RegisterWindowMessageW; + alias RemoveProp = RemovePropW; + alias SendDlgItemMessage = SendDlgItemMessageW; + alias SendMessage = SendMessageW; + alias SendMessageCallback = SendMessageCallbackW; + alias SendMessageTimeout = SendMessageTimeoutW; + alias SendNotifyMessage = SendNotifyMessageW; + alias SetClassLong = SetClassLongW; + alias SetClassLongPtr = SetClassLongPtrW; + alias SetDlgItemText = SetDlgItemTextW; + alias SetMenuItemInfo = SetMenuItemInfoW; + alias SetProp = SetPropW; + alias SetUserObjectInformation = SetUserObjectInformationW; + alias SetWindowLong = SetWindowLongW; + alias SetWindowLongPtr = SetWindowLongPtrW; + alias SetWindowsHook = SetWindowsHookW; + alias SetWindowsHookEx = SetWindowsHookExW; + alias SetWindowText = SetWindowTextW; + alias SystemParametersInfo = SystemParametersInfoW; + alias TabbedTextOut = TabbedTextOutW; + alias TranslateAccelerator = TranslateAcceleratorW; + alias UnregisterClass = UnregisterClassW; + alias VkKeyScan = VkKeyScanW; + alias VkKeyScanEx = VkKeyScanExW; + alias WinHelp = WinHelpW; + alias wsprintf = wsprintfW; + alias wvsprintf = wvsprintfW; + + alias ChangeDisplaySettings = ChangeDisplaySettingsW; + alias ChangeDisplaySettingsEx = ChangeDisplaySettingsExW; + alias CreateDesktop = CreateDesktopW; + alias EnumDisplaySettings = EnumDisplaySettingsW; + alias EnumDisplaySettingsEx = EnumDisplaySettingsExW; + alias EnumDisplayDevices = EnumDisplayDevicesW; } else { // ANSI - alias EDITWORDBREAKPROCA EDITWORDBREAKPROC; - alias PROPENUMPROCA PROPENUMPROC; - alias PROPENUMPROCEXA PROPENUMPROCEX; - alias DESKTOPENUMPROCA DESKTOPENUMPROC; - alias WINSTAENUMPROCA WINSTAENUMPROC; - alias MAKEINTRESOURCEA MAKEINTRESOURCE; - - alias WNDCLASSA WNDCLASS; - alias WNDCLASSEXA WNDCLASSEX; - alias MENUITEMINFOA MENUITEMINFO; - alias LPCMENUITEMINFOA LPCMENUITEMINFO; - alias MSGBOXPARAMSA MSGBOXPARAMS; - alias HIGHCONTRASTA HIGHCONTRAST; - alias SERIALKEYSA SERIALKEYS; - alias SOUNDSENTRYA SOUNDSENTRY; - alias CREATESTRUCTA CREATESTRUCT; - alias CBT_CREATEWNDA CBT_CREATEWND; - alias MDICREATESTRUCTA MDICREATESTRUCT; - alias MULTIKEYHELPA MULTIKEYHELP; - alias MONITORINFOEXA MONITORINFOEX; - alias ICONMETRICSA ICONMETRICS; - alias NONCLIENTMETRICSA NONCLIENTMETRICS; - - alias AppendMenuA AppendMenu; - alias BroadcastSystemMessageA BroadcastSystemMessage; + alias EDITWORDBREAKPROC = EDITWORDBREAKPROCA; + alias PROPENUMPROC = PROPENUMPROCA; + alias PROPENUMPROCEX = PROPENUMPROCEXA; + alias DESKTOPENUMPROC = DESKTOPENUMPROCA; + alias WINSTAENUMPROC = WINSTAENUMPROCA; + alias MAKEINTRESOURCE = MAKEINTRESOURCEA; + + alias WNDCLASS = WNDCLASSA; + alias WNDCLASSEX = WNDCLASSEXA; + alias MENUITEMINFO = MENUITEMINFOA; + alias LPCMENUITEMINFO = LPCMENUITEMINFOA; + alias MSGBOXPARAMS = MSGBOXPARAMSA; + alias HIGHCONTRAST = HIGHCONTRASTA; + alias SERIALKEYS = SERIALKEYSA; + alias SOUNDSENTRY = SOUNDSENTRYA; + alias CREATESTRUCT = CREATESTRUCTA; + alias CBT_CREATEWND = CBT_CREATEWNDA; + alias MDICREATESTRUCT = MDICREATESTRUCTA; + alias MULTIKEYHELP = MULTIKEYHELPA; + alias MONITORINFOEX = MONITORINFOEXA; + alias ICONMETRICS = ICONMETRICSA; + alias NONCLIENTMETRICS = NONCLIENTMETRICSA; + + alias AppendMenu = AppendMenuA; + alias BroadcastSystemMessage = BroadcastSystemMessageA; static if (_WIN32_WINNT >= 0x501) { - alias BroadcastSystemMessageExA BroadcastSystemMessageEx; + alias BroadcastSystemMessageEx = BroadcastSystemMessageExA; } - alias CallMsgFilterA CallMsgFilter; - alias CallWindowProcA CallWindowProc; - alias ChangeMenuA ChangeMenu; - alias CharLowerA CharLower; - alias CharLowerBuffA CharLowerBuff; - alias CharNextA CharNext; - alias CharNextExA CharNextEx; - alias CharPrevA CharPrev; - alias CharPrevExA CharPrevEx; - alias CharToOemA CharToOem; - alias CharToOemBuffA CharToOemBuff; - alias CharUpperA CharUpper; - alias CharUpperBuffA CharUpperBuff; - alias CopyAcceleratorTableA CopyAcceleratorTable; - alias CreateAcceleratorTableA CreateAcceleratorTable; - alias CreateDialogA CreateDialog; - alias CreateDialogIndirectA CreateDialogIndirect; - alias CreateDialogIndirectParamA CreateDialogIndirectParam; - alias CreateDialogParamA CreateDialogParam; - alias CreateMDIWindowA CreateMDIWindow; - alias CreateWindowA CreateWindow; - alias CreateWindowExA CreateWindowEx; - alias CreateWindowStationA CreateWindowStation; - alias DefDlgProcA DefDlgProc; - alias DefFrameProcA DefFrameProc; - alias DefMDIChildProcA DefMDIChildProc; - alias DefWindowProcA DefWindowProc; - alias DialogBoxA DialogBox; - alias DialogBoxIndirectA DialogBoxIndirect; - alias DialogBoxIndirectParamA DialogBoxIndirectParam; - alias DialogBoxParamA DialogBoxParam; - alias DispatchMessageA DispatchMessage; - alias DlgDirListA DlgDirList; - alias DlgDirListComboBoxA DlgDirListComboBox; - alias DlgDirSelectComboBoxExA DlgDirSelectComboBoxEx; - alias DlgDirSelectExA DlgDirSelectEx; - alias DrawStateA DrawState; - alias DrawTextA DrawText; - alias DrawTextExA DrawTextEx; - alias EnumDesktopsA EnumDesktops; - alias EnumPropsA EnumProps; - alias EnumPropsExA EnumPropsEx; - alias EnumWindowStationsA EnumWindowStations; - alias FindWindowA FindWindow; - alias FindWindowExA FindWindowEx; - alias GetClassInfoA GetClassInfo; - alias GetClassInfoExA GetClassInfoEx; - alias GetClassLongA GetClassLong; - alias GetClassLongPtrA GetClassLongPtr; - alias GetClassNameA GetClassName; - alias GetClipboardFormatNameA GetClipboardFormatName; - alias GetDlgItemTextA GetDlgItemText; - alias GetKeyboardLayoutNameA GetKeyboardLayoutName; - alias GetKeyNameTextA GetKeyNameText; - alias GetMenuItemInfoA GetMenuItemInfo; - alias GetMenuStringA GetMenuString; - alias GetMessageA GetMessage; - alias GetMonitorInfoA GetMonitorInfo; - alias GetPropA GetProp; + alias CallMsgFilter = CallMsgFilterA; + alias CallWindowProc = CallWindowProcA; + alias ChangeMenu = ChangeMenuA; + alias CharLower = CharLowerA; + alias CharLowerBuff = CharLowerBuffA; + alias CharNext = CharNextA; + alias CharNextEx = CharNextExA; + alias CharPrev = CharPrevA; + alias CharPrevEx = CharPrevExA; + alias CharToOem = CharToOemA; + alias CharToOemBuff = CharToOemBuffA; + alias CharUpper = CharUpperA; + alias CharUpperBuff = CharUpperBuffA; + alias CopyAcceleratorTable = CopyAcceleratorTableA; + alias CreateAcceleratorTable = CreateAcceleratorTableA; + alias CreateDialog = CreateDialogA; + alias CreateDialogIndirect = CreateDialogIndirectA; + alias CreateDialogIndirectParam = CreateDialogIndirectParamA; + alias CreateDialogParam = CreateDialogParamA; + alias CreateMDIWindow = CreateMDIWindowA; + alias CreateWindow = CreateWindowA; + alias CreateWindowEx = CreateWindowExA; + alias CreateWindowStation = CreateWindowStationA; + alias DefDlgProc = DefDlgProcA; + alias DefFrameProc = DefFrameProcA; + alias DefMDIChildProc = DefMDIChildProcA; + alias DefWindowProc = DefWindowProcA; + alias DialogBox = DialogBoxA; + alias DialogBoxIndirect = DialogBoxIndirectA; + alias DialogBoxIndirectParam = DialogBoxIndirectParamA; + alias DialogBoxParam = DialogBoxParamA; + alias DispatchMessage = DispatchMessageA; + alias DlgDirList = DlgDirListA; + alias DlgDirListComboBox = DlgDirListComboBoxA; + alias DlgDirSelectComboBoxEx = DlgDirSelectComboBoxExA; + alias DlgDirSelectEx = DlgDirSelectExA; + alias DrawState = DrawStateA; + alias DrawText = DrawTextA; + alias DrawTextEx = DrawTextExA; + alias EnumDesktops = EnumDesktopsA; + alias EnumProps = EnumPropsA; + alias EnumPropsEx = EnumPropsExA; + alias EnumWindowStations = EnumWindowStationsA; + alias FindWindow = FindWindowA; + alias FindWindowEx = FindWindowExA; + alias GetClassInfo = GetClassInfoA; + alias GetClassInfoEx = GetClassInfoExA; + alias GetClassLong = GetClassLongA; + alias GetClassLongPtr = GetClassLongPtrA; + alias GetClassName = GetClassNameA; + alias GetClipboardFormatName = GetClipboardFormatNameA; + alias GetDlgItemText = GetDlgItemTextA; + alias GetKeyboardLayoutName = GetKeyboardLayoutNameA; + alias GetKeyNameText = GetKeyNameTextA; + alias GetMenuItemInfo = GetMenuItemInfoA; + alias GetMenuString = GetMenuStringA; + alias GetMessage = GetMessageA; + alias GetMonitorInfo = GetMonitorInfoA; + alias GetProp = GetPropA; static if (_WIN32_WINNT >= 0x501) { - alias GetRawInputDeviceInfoA GetRawInputDeviceInfo; + alias GetRawInputDeviceInfo = GetRawInputDeviceInfoA; } - alias GetTabbedTextExtentA GetTabbedTextExtent; - alias GetUserObjectInformationA GetUserObjectInformation; - alias GetWindowLongA GetWindowLong; - alias GetWindowLongPtrA GetWindowLongPtr; - alias GetWindowTextA GetWindowText; - alias GetWindowTextLengthA GetWindowTextLength; - alias GetAltTabInfoA GetAltTabInfo; - alias GetWindowModuleFileNameA GetWindowModuleFileName; - alias GrayStringA GrayString; - alias InsertMenuA InsertMenu; - alias InsertMenuItemA InsertMenuItem; - alias IsCharAlphaA IsCharAlpha; - alias IsCharAlphaNumericA IsCharAlphaNumeric; - alias IsCharLowerA IsCharLower; - alias IsCharUpperA IsCharUpper; - alias IsDialogMessageA IsDialogMessage; - alias LoadAcceleratorsA LoadAccelerators; - alias LoadBitmapA LoadBitmap; - alias LoadCursorA LoadCursor; - alias LoadIconA LoadIcon; - alias LoadCursorFromFileA LoadCursorFromFile; - alias LoadImageA LoadImage; - alias LoadKeyboardLayoutA LoadKeyboardLayout; - alias LoadMenuA LoadMenu; - alias LoadMenuIndirectA LoadMenuIndirect; - alias LoadStringA LoadString; - alias MapVirtualKeyA MapVirtualKey; - alias MapVirtualKeyExA MapVirtualKeyEx; - alias MessageBoxA MessageBox; - alias MessageBoxExA MessageBoxEx; - alias MessageBoxIndirectA MessageBoxIndirect; - alias ModifyMenuA ModifyMenu; - alias OemToCharA OemToChar; - alias OemToCharBuffA OemToCharBuff; - alias OpenDesktopA OpenDesktop; - alias OpenWindowStationA OpenWindowStation; - alias PeekMessageA PeekMessage; - alias PostMessageA PostMessage; - alias PostThreadMessageA PostThreadMessage; - alias RealGetWindowClassA RealGetWindowClass; - alias RegisterClassA RegisterClass; - alias RegisterClassExA RegisterClassEx; - alias RegisterClipboardFormatA RegisterClipboardFormat; - alias RegisterDeviceNotificationA RegisterDeviceNotification; - alias RegisterWindowMessageA RegisterWindowMessage; - alias RemovePropA RemoveProp; - alias SendDlgItemMessageA SendDlgItemMessage; - alias SendMessageA SendMessage; - alias SendMessageCallbackA SendMessageCallback; - alias SendMessageTimeoutA SendMessageTimeout; - alias SendNotifyMessageA SendNotifyMessage; - alias SetClassLongA SetClassLong; - alias SetClassLongPtrA SetClassLongPtr; - alias SetDlgItemTextA SetDlgItemText; - alias SetMenuItemInfoA SetMenuItemInfo; - alias SetPropA SetProp; - alias SetUserObjectInformationA SetUserObjectInformation; - alias SetWindowLongA SetWindowLong; - alias SetWindowLongPtrA SetWindowLongPtr; - alias SetWindowsHookA SetWindowsHook; - alias SetWindowsHookExA SetWindowsHookEx; - alias SetWindowTextA SetWindowText; - alias SystemParametersInfoA SystemParametersInfo; - alias TabbedTextOutA TabbedTextOut; - alias TranslateAcceleratorA TranslateAccelerator; - alias UnregisterClassA UnregisterClass; - alias VkKeyScanA VkKeyScan; - alias VkKeyScanExA VkKeyScanEx; - alias WinHelpA WinHelp; - alias wsprintfA wsprintf; - alias wvsprintfA wvsprintf; - - alias ChangeDisplaySettingsA ChangeDisplaySettings; - alias ChangeDisplaySettingsExA ChangeDisplaySettingsEx; - alias CreateDesktopA CreateDesktop; - alias EnumDisplaySettingsA EnumDisplaySettings; - alias EnumDisplaySettingsExA EnumDisplaySettingsEx; - alias EnumDisplayDevicesA EnumDisplayDevices; -} - -alias WNDCLASS* LPWNDCLASS, PWNDCLASS; -alias WNDCLASSEX* LPWNDCLASSEX, PWNDCLASSEX; -alias MENUITEMINFO* LPMENUITEMINFO; -alias MSGBOXPARAMS* PMSGBOXPARAMS, LPMSGBOXPARAMS; -alias HIGHCONTRAST* LPHIGHCONTRAST; -alias SERIALKEYS* LPSERIALKEYS; -alias SOUNDSENTRY* LPSOUNDSENTRY; -alias CREATESTRUCT* LPCREATESTRUCT; -alias CBT_CREATEWND* LPCBT_CREATEWND; -alias MDICREATESTRUCT* LPMDICREATESTRUCT; -alias MULTIKEYHELP* PMULTIKEYHELP, LPMULTIKEYHELP; -alias MONITORINFOEX* LPMONITORINFOEX; -alias ICONMETRICS* LPICONMETRICS; -alias NONCLIENTMETRICS* LPNONCLIENTMETRICS; + alias GetTabbedTextExtent = GetTabbedTextExtentA; + alias GetUserObjectInformation = GetUserObjectInformationA; + alias GetWindowLong = GetWindowLongA; + alias GetWindowLongPtr = GetWindowLongPtrA; + alias GetWindowText = GetWindowTextA; + alias GetWindowTextLength = GetWindowTextLengthA; + alias GetAltTabInfo = GetAltTabInfoA; + alias GetWindowModuleFileName = GetWindowModuleFileNameA; + alias GrayString = GrayStringA; + alias InsertMenu = InsertMenuA; + alias InsertMenuItem = InsertMenuItemA; + alias IsCharAlpha = IsCharAlphaA; + alias IsCharAlphaNumeric = IsCharAlphaNumericA; + alias IsCharLower = IsCharLowerA; + alias IsCharUpper = IsCharUpperA; + alias IsDialogMessage = IsDialogMessageA; + alias LoadAccelerators = LoadAcceleratorsA; + alias LoadBitmap = LoadBitmapA; + alias LoadCursor = LoadCursorA; + alias LoadIcon = LoadIconA; + alias LoadCursorFromFile = LoadCursorFromFileA; + alias LoadImage = LoadImageA; + alias LoadKeyboardLayout = LoadKeyboardLayoutA; + alias LoadMenu = LoadMenuA; + alias LoadMenuIndirect = LoadMenuIndirectA; + alias LoadString = LoadStringA; + alias MapVirtualKey = MapVirtualKeyA; + alias MapVirtualKeyEx = MapVirtualKeyExA; + alias MessageBox = MessageBoxA; + alias MessageBoxEx = MessageBoxExA; + alias MessageBoxIndirect = MessageBoxIndirectA; + alias ModifyMenu = ModifyMenuA; + alias OemToChar = OemToCharA; + alias OemToCharBuff = OemToCharBuffA; + alias OpenDesktop = OpenDesktopA; + alias OpenWindowStation = OpenWindowStationA; + alias PeekMessage = PeekMessageA; + alias PostMessage = PostMessageA; + alias PostThreadMessage = PostThreadMessageA; + alias RealGetWindowClass = RealGetWindowClassA; + alias RegisterClass = RegisterClassA; + alias RegisterClassEx = RegisterClassExA; + alias RegisterClipboardFormat = RegisterClipboardFormatA; + alias RegisterDeviceNotification = RegisterDeviceNotificationA; + alias RegisterWindowMessage = RegisterWindowMessageA; + alias RemoveProp = RemovePropA; + alias SendDlgItemMessage = SendDlgItemMessageA; + alias SendMessage = SendMessageA; + alias SendMessageCallback = SendMessageCallbackA; + alias SendMessageTimeout = SendMessageTimeoutA; + alias SendNotifyMessage = SendNotifyMessageA; + alias SetClassLong = SetClassLongA; + alias SetClassLongPtr = SetClassLongPtrA; + alias SetDlgItemText = SetDlgItemTextA; + alias SetMenuItemInfo = SetMenuItemInfoA; + alias SetProp = SetPropA; + alias SetUserObjectInformation = SetUserObjectInformationA; + alias SetWindowLong = SetWindowLongA; + alias SetWindowLongPtr = SetWindowLongPtrA; + alias SetWindowsHook = SetWindowsHookA; + alias SetWindowsHookEx = SetWindowsHookExA; + alias SetWindowText = SetWindowTextA; + alias SystemParametersInfo = SystemParametersInfoA; + alias TabbedTextOut = TabbedTextOutA; + alias TranslateAccelerator = TranslateAcceleratorA; + alias UnregisterClass = UnregisterClassA; + alias VkKeyScan = VkKeyScanA; + alias VkKeyScanEx = VkKeyScanExA; + alias WinHelp = WinHelpA; + alias wsprintf = wsprintfA; + alias wvsprintf = wvsprintfA; + + alias ChangeDisplaySettings = ChangeDisplaySettingsA; + alias ChangeDisplaySettingsEx = ChangeDisplaySettingsExA; + alias CreateDesktop = CreateDesktopA; + alias EnumDisplaySettings = EnumDisplaySettingsA; + alias EnumDisplaySettingsEx = EnumDisplaySettingsExA; + alias EnumDisplayDevices = EnumDisplayDevicesA; +} + +alias LPWNDCLASS = WNDCLASS*, PWNDCLASS = WNDCLASS*; +alias LPWNDCLASSEX = WNDCLASSEX*, PWNDCLASSEX = WNDCLASSEX*; +alias LPMENUITEMINFO = MENUITEMINFO*; +alias PMSGBOXPARAMS = MSGBOXPARAMS*, LPMSGBOXPARAMS = MSGBOXPARAMS*; +alias LPHIGHCONTRAST = HIGHCONTRAST*; +alias LPSERIALKEYS = SERIALKEYS*; +alias LPSOUNDSENTRY = SOUNDSENTRY*; +alias LPCREATESTRUCT = CREATESTRUCT*; +alias LPCBT_CREATEWND = CBT_CREATEWND*; +alias LPMDICREATESTRUCT = MDICREATESTRUCT*; +alias PMULTIKEYHELP = MULTIKEYHELP*, LPMULTIKEYHELP = MULTIKEYHELP*; +alias LPMONITORINFOEX = MONITORINFOEX*; +alias LPICONMETRICS = ICONMETRICS*; +alias LPNONCLIENTMETRICS = NONCLIENTMETRICS*; static if (_WIN32_WINNT >= 0x501) { enum PW_CLIENTONLY = 0x00000001; diff --git a/runtime/druntime/src/core/sys/windows/winver.d b/runtime/druntime/src/core/sys/windows/winver.d index 646891b1be9..5ef0864c440 100644 --- a/runtime/druntime/src/core/sys/windows/winver.d +++ b/runtime/druntime/src/core/sys/windows/winver.d @@ -159,21 +159,21 @@ extern (Windows) nothrow @nogc { } version (Unicode) { - alias VerFindFileW VerFindFile; - alias VerQueryValueW VerQueryValue; - alias VerInstallFileW VerInstallFile; - alias GetFileVersionInfoSizeW GetFileVersionInfoSize; - alias GetFileVersionInfoW GetFileVersionInfo; - alias VerLanguageNameW VerLanguageName; - alias VerQueryValueW VerQueryValue; + alias VerFindFile = VerFindFileW; + alias VerQueryValue = VerQueryValueW; + alias VerInstallFile = VerInstallFileW; + alias GetFileVersionInfoSize = GetFileVersionInfoSizeW; + alias GetFileVersionInfo = GetFileVersionInfoW; + alias VerLanguageName = VerLanguageNameW; + alias VerQueryValue = VerQueryValueW; } else { - alias VerQueryValueA VerQueryValue; - alias VerFindFileA VerFindFile; - alias VerInstallFileA VerInstallFile; - alias GetFileVersionInfoSizeA GetFileVersionInfoSize; - alias GetFileVersionInfoA GetFileVersionInfo; - alias VerLanguageNameA VerLanguageName; - alias VerQueryValueA VerQueryValue; + alias VerQueryValue = VerQueryValueA; + alias VerFindFile = VerFindFileA; + alias VerInstallFile = VerInstallFileA; + alias GetFileVersionInfoSize = GetFileVersionInfoSizeA; + alias GetFileVersionInfo = GetFileVersionInfoA; + alias VerLanguageName = VerLanguageNameA; + alias VerQueryValue = VerQueryValueA; } alias VERSIONHELPERAPI = BOOL; diff --git a/runtime/druntime/src/core/sys/windows/wtsapi32.d b/runtime/druntime/src/core/sys/windows/wtsapi32.d index 4db697a6501..c398c630f35 100644 --- a/runtime/druntime/src/core/sys/windows/wtsapi32.d +++ b/runtime/druntime/src/core/sys/windows/wtsapi32.d @@ -51,19 +51,19 @@ enum WTS_CONNECTSTATE_CLASS { struct WTS_SERVER_INFOW { LPWSTR pServerName; } -alias WTS_SERVER_INFOW* PWTS_SERVER_INFOW; +alias PWTS_SERVER_INFOW = WTS_SERVER_INFOW*; struct WTS_SERVER_INFOA { LPSTR pServerName; } -alias WTS_SERVER_INFOA* PWTS_SERVER_INFOA; +alias PWTS_SERVER_INFOA = WTS_SERVER_INFOA*; version (Unicode) { - alias WTS_SERVER_INFOW WTS_SERVER_INFO; - alias PWTS_SERVER_INFOW PWTS_SERVER_INFO; + alias WTS_SERVER_INFO = WTS_SERVER_INFOW; + alias PWTS_SERVER_INFO = PWTS_SERVER_INFOW; } else { - alias WTS_SERVER_INFOA WTS_SERVER_INFO; - alias PWTS_SERVER_INFOA PWTS_SERVER_INFO; + alias WTS_SERVER_INFO = WTS_SERVER_INFOA; + alias PWTS_SERVER_INFO = PWTS_SERVER_INFOA; } struct WTS_SESSION_INFOW { @@ -71,21 +71,21 @@ struct WTS_SESSION_INFOW { LPWSTR pWinStationName; WTS_CONNECTSTATE_CLASS State; } -alias WTS_SESSION_INFOW* PWTS_SESSION_INFOW; +alias PWTS_SESSION_INFOW = WTS_SESSION_INFOW*; struct WTS_SESSION_INFOA { DWORD SessionId; LPSTR pWinStationName; WTS_CONNECTSTATE_CLASS State; } -alias WTS_SESSION_INFOA* PWTS_SESSION_INFOA; +alias PWTS_SESSION_INFOA = WTS_SESSION_INFOA*; version (Unicode) { - alias WTS_SESSION_INFOW WTS_SESSION_INFO; - alias PWTS_SESSION_INFOW PWTS_SESSION_INFO; + alias WTS_SESSION_INFO = WTS_SESSION_INFOW; + alias PWTS_SESSION_INFO = PWTS_SESSION_INFOW; } else { - alias WTS_SESSION_INFOA WTS_SESSION_INFO; - alias PWTS_SESSION_INFOA PWTS_SESSION_INFO; + alias WTS_SESSION_INFO = WTS_SESSION_INFOA; + alias PWTS_SESSION_INFO = PWTS_SESSION_INFOA; } struct WTS_PROCESS_INFOW { @@ -94,7 +94,7 @@ struct WTS_PROCESS_INFOW { LPWSTR pProcessName; PSID pUserSid; } -alias WTS_PROCESS_INFOW* PWTS_PROCESS_INFOW; +alias PWTS_PROCESS_INFOW = WTS_PROCESS_INFOW*; struct WTS_PROCESS_INFOA { DWORD SessionId; @@ -102,14 +102,14 @@ struct WTS_PROCESS_INFOA { LPSTR pProcessName; PSID pUserSid; } -alias WTS_PROCESS_INFOA* PWTS_PROCESS_INFOA; +alias PWTS_PROCESS_INFOA = WTS_PROCESS_INFOA*; version (Unicode) { - alias WTS_PROCESS_INFOW WTS_PROCESS_INFO; - alias PWTS_PROCESS_INFOW PWTS_PROCESS_INFO; + alias WTS_PROCESS_INFO = WTS_PROCESS_INFOW; + alias PWTS_PROCESS_INFO = PWTS_PROCESS_INFOW; } else { - alias WTS_PROCESS_INFOA WTS_PROCESS_INFO; - alias PWTS_PROCESS_INFOA PWTS_PROCESS_INFO; + alias WTS_PROCESS_INFO = WTS_PROCESS_INFOA; + alias PWTS_PROCESS_INFO = PWTS_PROCESS_INFOA; } enum { @@ -150,14 +150,14 @@ struct WTS_CLIENT_ADDRESS { DWORD AddressFamily; BYTE[20] Address; } -alias WTS_CLIENT_ADDRESS* PWTS_CLIENT_ADDRESS; +alias PWTS_CLIENT_ADDRESS = WTS_CLIENT_ADDRESS*; struct WTS_CLIENT_DISPLAY { DWORD HorizontalResolution; DWORD VerticalResolution; DWORD ColorDepth; } -alias WTS_CLIENT_DISPLAY* PWTS_CLIENT_DISPLAY; +alias PWTS_CLIENT_DISPLAY = WTS_CLIENT_DISPLAY*; enum WTS_CONFIG_CLASS { WTSUserConfigInitialProgram, @@ -202,23 +202,23 @@ enum WTS_VIRTUAL_CLASS { } version (Unicode) { - alias WTSEnumerateServersW WTSEnumerateServers; - alias WTSOpenServerW WTSOpenServer; - alias WTSEnumerateSessionsW WTSEnumerateSessions; - alias WTSEnumerateProcessesW WTSEnumerateProcesses; - alias WTSQuerySessionInformationW WTSQuerySessionInformation; - alias WTSQueryUserConfigW WTSQueryUserConfig; - alias WTSSetUserConfigW WTSSetUserConfig; - alias WTSSendMessageW WTSSendMessage; + alias WTSEnumerateServers = WTSEnumerateServersW; + alias WTSOpenServer = WTSOpenServerW; + alias WTSEnumerateSessions = WTSEnumerateSessionsW; + alias WTSEnumerateProcesses = WTSEnumerateProcessesW; + alias WTSQuerySessionInformation = WTSQuerySessionInformationW; + alias WTSQueryUserConfig = WTSQueryUserConfigW; + alias WTSSetUserConfig = WTSSetUserConfigW; + alias WTSSendMessage = WTSSendMessageW; } else { - alias WTSEnumerateServersA WTSEnumerateServers; - alias WTSOpenServerA WTSOpenServer; - alias WTSEnumerateSessionsA WTSEnumerateSessions; - alias WTSEnumerateProcessesA WTSEnumerateProcesses; - alias WTSQuerySessionInformationA WTSQuerySessionInformation; - alias WTSQueryUserConfigA WTSQueryUserConfig; - alias WTSSetUserConfigA WTSSetUserConfig; - alias WTSSendMessageA WTSSendMessage; + alias WTSEnumerateServers = WTSEnumerateServersA; + alias WTSOpenServer = WTSOpenServerA; + alias WTSEnumerateSessions = WTSEnumerateSessionsA; + alias WTSEnumerateProcesses = WTSEnumerateProcessesA; + alias WTSQuerySessionInformation = WTSQuerySessionInformationA; + alias WTSQueryUserConfig = WTSQueryUserConfigA; + alias WTSSetUserConfig = WTSSetUserConfigA; + alias WTSSendMessage = WTSSendMessageA; } extern(Windows) { @@ -293,7 +293,7 @@ static if (_WIN32_WINNT >= 0x600) { USHORT OutBufLength; WCHAR[MAX_PATH + 1] DeviceId = 0; } - alias WTSCLIENTW* PWTSCLIENTW; + alias PWTSCLIENTW = WTSCLIENTW*; struct WTSCLIENTA { CHAR[CLIENTNAME_LENGTH + 1] ClientName = 0; @@ -316,14 +316,14 @@ static if (_WIN32_WINNT >= 0x600) { USHORT OutBufLength; CHAR[MAX_PATH + 1] DeviceId = 0; } - alias WTSCLIENTA* PWTSCLIENTA; + alias PWTSCLIENTA = WTSCLIENTA*; version (Unicode) { - alias WTSCLIENTW WTSCLIENT; - alias PWTSCLIENTW PWTSCLIENT; + alias WTSCLIENT = WTSCLIENTW; + alias PWTSCLIENT = PWTSCLIENTW; } else { - alias WTSCLIENTA WTSCLIENT; - alias PWTSCLIENTA PWTSCLIENT; + alias WTSCLIENT = WTSCLIENTA; + alias PWTSCLIENT = PWTSCLIENTA; } struct WTSINFOW { @@ -344,7 +344,7 @@ static if (_WIN32_WINNT >= 0x600) { LARGE_INTEGER LogonTime; LARGE_INTEGER CurrentTime; } - alias WTSINFOW* PWTSINFOW; + alias PWTSINFOW = WTSINFOW*; struct WTSINFOA { WTS_CONNECTSTATE_CLASS State; @@ -364,14 +364,14 @@ static if (_WIN32_WINNT >= 0x600) { LARGE_INTEGER LogonTime; LARGE_INTEGER CurrentTime; } - alias WTSINFOA* PWTSINFOA; + alias PWTSINFOA = WTSINFOA*; version (Unicode) { - alias WTSINFOW WTSINFO; - alias PWTSINFOW PWTSINFO; + alias WTSINFO = WTSINFOW; + alias PWTSINFO = PWTSINFOW; } else { - alias WTSINFOA WTSINFO; - alias PWTSINFOA PWTSINFO; + alias WTSINFO = WTSINFOA; + alias PWTSINFO = PWTSINFOA; } extern(Windows) { @@ -410,11 +410,11 @@ static if (_WIN32_WINNT >= 0x600) { ); version (Unicode) { - alias WTSStartRemoteControlSessionW WTSStartRemoteControlSession; - alias WTSConnectSessionW WTSConnectSession; + alias WTSStartRemoteControlSession = WTSStartRemoteControlSessionW; + alias WTSConnectSession = WTSConnectSessionW; } else { - alias WTSStartRemoteControlSessionA WTSStartRemoteControlSession; - alias WTSConnectSessionA WTSConnectSession; + alias WTSStartRemoteControlSession = WTSStartRemoteControlSessionA; + alias WTSConnectSession = WTSConnectSessionA; } WINBOOL WTSStopRemoteControlSession( diff --git a/runtime/druntime/src/core/sys/windows/wtypes.d b/runtime/druntime/src/core/sys/windows/wtypes.d index 881f05a650c..c2dd6f6452a 100644 --- a/runtime/druntime/src/core/sys/windows/wtypes.d +++ b/runtime/druntime/src/core/sys/windows/wtypes.d @@ -13,7 +13,7 @@ import core.sys.windows.rpc, core.sys.windows.rpcndr; import core.sys.windows.windef; import core.sys.windows.uuid; // for GUID_NULL -alias GUID_NULL IID_NULL, CLSID_NULL; +alias IID_NULL = GUID_NULL, CLSID_NULL = GUID_NULL; enum ROTFLAGS_REGISTRATIONKEEPSALIVE = 0x01; enum ROTFLAGS_ALLOWANYCLIENT = 0x02; @@ -23,7 +23,7 @@ struct BLOB { ULONG cbSize; BYTE* pBlobData; } -alias BLOB* PBLOB, LPBLOB; +alias PBLOB = BLOB*, LPBLOB = BLOB*; enum DVASPECT { DVASPECT_CONTENT = 1, @@ -82,19 +82,19 @@ struct FLAGGED_WORD_BLOB { ushort[1] asData; } -alias WCHAR OLECHAR; -alias LPWSTR LPOLESTR; -alias LPCWSTR LPCOLESTR; +alias OLECHAR = WCHAR; +alias LPOLESTR = LPWSTR; +alias LPCOLESTR = LPCWSTR; -alias ushort VARTYPE; -alias short VARIANT_BOOL; -alias VARIANT_BOOL _VARIANT_BOOL; +alias VARTYPE = ushort; +alias VARIANT_BOOL = short; +alias _VARIANT_BOOL = VARIANT_BOOL; enum VARIANT_BOOL VARIANT_TRUE = -1; // 0xffff; enum VARIANT_BOOL VARIANT_FALSE = 0; -alias OLECHAR* BSTR; -alias FLAGGED_WORD_BLOB* wireBSTR; -alias BSTR* LPBSTR; +alias BSTR = OLECHAR*; +alias wireBSTR = FLAGGED_WORD_BLOB*; +alias LPBSTR = BSTR*; //alias LONG SCODE; // also in winerror alias HCONTEXT = HANDLE; alias HMETAFILEPICT = HANDLE; @@ -107,12 +107,12 @@ union CY { LONGLONG int64; } -alias double DATE; +alias DATE = double; struct BSTRBLOB { ULONG cbSize; PBYTE pData; } -alias BSTRBLOB* LPBSTRBLOB; +alias LPBSTRBLOB = BSTRBLOB*; // Used only in the PROPVARIANT structure // According to the 2003 SDK, this should be in propidl.h, not here. @@ -209,7 +209,7 @@ struct HYPER_SIZEDARR { hyper* pData; } -alias double DOUBLE; +alias DOUBLE = double; struct DECIMAL { diff --git a/runtime/druntime/src/core/thread/context.d b/runtime/druntime/src/core/thread/context.d index 74530003394..2260d621cec 100644 --- a/runtime/druntime/src/core/thread/context.d +++ b/runtime/druntime/src/core/thread/context.d @@ -14,6 +14,7 @@ module core.thread.context; // LDC: Unconditionally change ABI to support sanitizers version (LDC) version = SupportSanitizers_ABI; +/// struct StackContext { void* bstack, tstack; diff --git a/runtime/druntime/src/core/thread/fiber/package.d b/runtime/druntime/src/core/thread/fiber/package.d index a592ed6c004..c2c0ecdc249 100644 --- a/runtime/druntime/src/core/thread/fiber/package.d +++ b/runtime/druntime/src/core/thread/fiber/package.d @@ -1303,7 +1303,16 @@ protected: { push( 0x00000000_00000000 ); // Return address of fiber_entryPoint call push( cast(size_t) &fiber_entryPoint ); // RIP - push( cast(size_t) m_ctxt.bstack ); // RBP + version (OSX) + { + // backtrace() needs this to be null to terminate + // the stack walk on macOS x86_64 + push( 0x00000000_00000000 ); // RBP + } + else + { + push( cast(size_t) m_ctxt.bstack ); // RBP + } push( 0x00000000_00000000 ); // RBX push( 0x00000000_00000000 ); // R12 push( 0x00000000_00000000 ); // R13 diff --git a/runtime/druntime/src/core/thread/osthread.d b/runtime/druntime/src/core/thread/osthread.d index 73e5adb4d9b..507c5e1d31d 100644 --- a/runtime/druntime/src/core/thread/osthread.d +++ b/runtime/druntime/src/core/thread/osthread.d @@ -726,7 +726,9 @@ class Thread : ThreadBase auto local = atomicLoad(mixin("cache." ~ which)); if (local != local.min) return local; // There will be benign races - cache = loadPriorities; + auto loaded = loadPriorities; + static foreach (i, _; loaded.tupleof) + atomicStore(cache.tupleof[i], loaded.tupleof[i]); return atomicLoad(mixin("cache." ~ which)); } @@ -1513,7 +1515,7 @@ in (fn) enum int j = 13 + i; // source register asm pure nothrow @nogc { - "stw "~regname~j.stringof~", %0" : "=m" (regs[i]); + ("stw "~regname~j.stringof~", %0") : "=m" (regs[i]); } }} sp = cast(void*)®s[0]; @@ -1530,7 +1532,7 @@ in (fn) enum int j = 13 + i; // source register asm pure nothrow @nogc { - "std "~regname~j.stringof~", %0" : "=m" (regs[i]); + ("std "~regname~j.stringof~", %0") : "=m" (regs[i]); } }} sp = cast(void*)®s[0]; @@ -1758,6 +1760,27 @@ in (fn) static assert(false, "Architecture not supported."); } } + else version (AArch64) + { + // Callee-save registers, x19-x28 according to AAPCS64, section + // 5.1.1. Include x29 fp because it optionally can be a callee + // saved reg + size_t[11] regs = void; + // store the registers in pairs + asm pure nothrow @nogc + { + /* + stp x19, x20, regs[0]; + stp x21, x22, regs[2]; + stp x23, x24, regs[4]; + stp x25, x26, regs[6]; + stp x27, x28, regs[8]; + str x29, regs[10]; + mov [sp], sp; + */ + } + assert(0, "implement AArch64 inline assembler for callWithStackShell()"); // TODO AArch64 + } else { static assert(false, "Architecture not supported."); @@ -1853,6 +1876,11 @@ private extern(D) void* getStackTop() nothrow @nogc asm pure nothrow @nogc { naked; mov EAX, ESP; ret; } else version (D_InlineAsm_X86_64) asm pure nothrow @nogc { naked; mov RAX, RSP; ret; } + else version (AArch64) + //asm pure nothrow @nogc { naked; mov x0, SP; ret; } // TODO AArch64 + { + return null; + } else version (GNU) return __builtin_frame_address(0); else @@ -2691,7 +2719,9 @@ version (Windows) void append( Throwable t ) { - obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); + obj.filterCaughtThrowable(t); + if (t !is null) + obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); } version (D_InlineAsm_X86) @@ -2867,7 +2897,9 @@ else version (Posix) void append( Throwable t ) { - obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); + obj.filterCaughtThrowable(t); + if (t !is null) + obj.m_unhandled = Throwable.chainTogether(obj.m_unhandled, t); } try { @@ -3097,43 +3129,38 @@ private version (CRuntime_Microsoft) extern(C) extern __gshared ubyte msvcUsesUCRT; // from rt/msvc.d + extern(C) extern __gshared void* __ImageBase; // symbol at the beginning of module, added by linker + enum HMODULE runtimeModule = &__ImageBase; /// set during termination of a DLL on Windows, i.e. while executing DllMain(DLL_PROCESS_DETACH) public __gshared bool thread_DLLProcessDetaching; - __gshared HMODULE ll_dllModule; __gshared ThreadID ll_dllMonitorThread; - int ll_countLowLevelThreadsWithDLLUnloadCallback() nothrow + int ll_countLowLevelThreadsWithDLLUnloadCallback(HMODULE hMod) nothrow { lowlevelLock.lock_nothrow(); scope(exit) lowlevelLock.unlock_nothrow(); int cnt = 0; foreach (i; 0 .. ll_nThreads) - if (ll_pThreads[i].cbDllUnload) + if (ll_pThreads[i].cbDllUnload && ll_pThreads[i].hMod == hMod) cnt++; return cnt; } - bool ll_dllHasExternalReferences() nothrow + bool ll_dllHasExternalReferences(HMODULE hMod) nothrow { - int internalReferences = msvcUsesUCRT ? 1 + ll_countLowLevelThreadsWithDLLUnloadCallback() : 1; - int refcnt = dll_getRefCount(ll_dllModule); + int unloadCallbacks = ll_countLowLevelThreadsWithDLLUnloadCallback(hMod); + int internalReferences = hMod != runtimeModule ? unloadCallbacks + : (ll_dllMonitorThread ? 1 : 0) + (msvcUsesUCRT ? unloadCallbacks : 0); + int refcnt = dll_getRefCount(hMod); return refcnt > internalReferences; } - private void monitorDLLRefCnt() nothrow + void notifyUnloadLowLevelThreads(HMODULE hMod) nothrow { - // this thread keeps the DLL alive until all external references are gone - while (ll_dllHasExternalReferences()) - { - Thread.sleep(100.msecs); - } - - // the current thread will be terminated below - ll_removeThread(GetCurrentThreadId()); - + HMODULE toFree; for (;;) { ThreadID tid; @@ -3143,36 +3170,70 @@ private scope(exit) lowlevelLock.unlock_nothrow(); foreach (i; 0 .. ll_nThreads) - if (ll_pThreads[i].cbDllUnload) + if (ll_pThreads[i].cbDllUnload && ll_pThreads[i].hMod == hMod) { + if (!toFree) + toFree = ll_getModuleHandle(hMod, true); // keep the module alive until the callback returns cbDllUnload = ll_pThreads[i].cbDllUnload; - tid = ll_pThreads[0].tid; + tid = ll_pThreads[i].tid; + break; } } if (!cbDllUnload) break; - cbDllUnload(); + cbDllUnload(); // must wait for thread termination assert(!findLowLevelThread(tid)); } + if (toFree) + FreeLibrary(toFree); + } + + private void monitorDLLRefCnt() nothrow + { + // this thread keeps the DLL alive until all external references are gone + // (including those from DLLs using druntime in a shared DLL) + while (ll_dllHasExternalReferences(runtimeModule)) + { + // find and unload module that only has internal references left + HMODULE hMod; + { + lowlevelLock.lock_nothrow(); + scope(exit) lowlevelLock.unlock_nothrow(); + + foreach (i; 0 .. ll_nThreads) + if (ll_pThreads[i].cbDllUnload && ll_pThreads[i].hMod != runtimeModule) + if (!ll_dllHasExternalReferences(ll_pThreads[i].hMod)) + { + hMod = ll_pThreads[i].hMod; + break; + } + } + if (hMod) + notifyUnloadLowLevelThreads(hMod); + else + Thread.sleep(100.msecs); + } + + notifyUnloadLowLevelThreads(runtimeModule); + + // the current thread will be terminated without cleanup within the thread + ll_removeThread(GetCurrentThreadId()); - FreeLibraryAndExitThread(ll_dllModule, 0); + FreeLibraryAndExitThread(runtimeModule, 0); } - int ll_getDLLRefCount() nothrow @nogc + HMODULE ll_getModuleHandle(void* funcptr, bool addref = false) nothrow @nogc { - if (!ll_dllModule && - !GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, - cast(const(wchar)*) &ll_getDLLRefCount, &ll_dllModule)) - return -1; - return dll_getRefCount(ll_dllModule); + HMODULE hmod; + DWORD refflag = addref ? 0 : GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT; + if (!GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | refflag, + cast(const(wchar)*) funcptr, &hmod)) + return null; + return hmod; } bool ll_startDLLUnloadThread() nothrow @nogc { - int refcnt = ll_getDLLRefCount(); - if (refcnt < 0) - return false; // not a dynamically loaded DLL - if (ll_dllMonitorThread !is ThreadID.init) return true; @@ -3180,13 +3241,10 @@ private // to avoid the DLL being unloaded while the thread is still running. Mimick this behavior here for all // runtimes not doing this bool needRef = !msvcUsesUCRT; - if (needRef) - { - HMODULE hmod; - GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, cast(const(wchar)*) &ll_getDLLRefCount, &hmod); - } + ll_getModuleHandle(runtimeModule, true); + // the monitor thread must be a low-level thread so the runtime does not attach to it ll_dllMonitorThread = createLowLevelThread(() { monitorDLLRefCnt(); }); return ll_dllMonitorThread != ThreadID.init; } @@ -3210,8 +3268,15 @@ private ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, void delegate() nothrow cbDllUnload = null) nothrow @nogc { - void delegate() nothrow* context = cast(void delegate() nothrow*)malloc(dg.sizeof); - *context = dg; + static struct Context + { + void delegate() nothrow dg; + version (Windows) + HMODULE cbMod; + } + auto context = cast(Context*)malloc(Context.sizeof); + scope(exit) free(context); + context.dg = dg; ThreadID tid; version (Windows) @@ -3219,14 +3284,30 @@ ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, // the thread won't start until after the DLL is unloaded if (thread_DLLProcessDetaching) return ThreadID.init; + context.cbMod = cbDllUnload ? ll_getModuleHandle(cbDllUnload.funcptr) : null; + if (context.cbMod) + { + int refcnt = dll_getRefCount(context.cbMod); + if (refcnt < 0) + { + // not a dynamically loaded DLL, so never unloaded + cbDllUnload = null; + context.cbMod = null; + } + if (refcnt == 0) + return ThreadID.init; // createLowLevelThread called while DLL is unloading + } static extern (Windows) uint thread_lowlevelEntry(void* ctx) nothrow { - auto dg = *cast(void delegate() nothrow*)ctx; + auto context = *cast(Context*)ctx; free(ctx); - dg(); + context.dg(); + ll_removeThread(GetCurrentThreadId()); + if (context.cbMod && context.cbMod != runtimeModule) + FreeLibrary(context.cbMod); return 0; } @@ -3242,11 +3323,20 @@ ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, ll_nThreads++; ll_pThreads = cast(ll_ThreadData*)realloc(ll_pThreads, ll_ThreadData.sizeof * ll_nThreads); + ll_pThreads[ll_nThreads - 1] = ll_ThreadData.init; version (Windows) { ll_pThreads[ll_nThreads - 1].tid = tid; - ll_pThreads[ll_nThreads - 1].cbDllUnload = cbDllUnload; + // ignore callback if not a dynamically loaded DLL + if (cbDllUnload) + { + ll_pThreads[ll_nThreads - 1].cbDllUnload = cbDllUnload; + ll_pThreads[ll_nThreads - 1].hMod = context.cbMod; + if (context.cbMod != runtimeModule) + ll_getModuleHandle(context.cbMod, true); // increment ref count + } + if (ResumeThread(hThread) == -1) onThreadError("Error resuming thread"); CloseHandle(hThread); @@ -3258,10 +3348,10 @@ ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, { static extern (C) void* thread_lowlevelEntry(void* ctx) nothrow { - auto dg = *cast(void delegate() nothrow*)ctx; + auto context = *cast(Context*)ctx; free(ctx); - dg(); + context.dg(); ll_removeThread(pthread_self()); return null; } @@ -3277,11 +3367,12 @@ ThreadID createLowLevelThread(void delegate() nothrow dg, uint stacksize = 0, return ThreadID.init; if ((rc = pthread_create(&tid, &attr, &thread_lowlevelEntry, context)) != 0) return ThreadID.init; - if ((rc = pthread_attr_destroy(&attr)) != 0) - return ThreadID.init; + rc = pthread_attr_destroy(&attr); + assert(rc == 0); ll_pThreads[ll_nThreads - 1].tid = tid; } + context = null; // free'd in thread return tid; } diff --git a/runtime/druntime/src/core/thread/package.d b/runtime/druntime/src/core/thread/package.d index 19654955fa9..a54442b3f13 100644 --- a/runtime/druntime/src/core/thread/package.d +++ b/runtime/druntime/src/core/thread/package.d @@ -22,45 +22,36 @@ public import core.thread.context; // this test is here to avoid a cyclic dependency between // core.thread and core.atomic -unittest +@system unittest { import core.atomic; - // Use heap memory to ensure an optimizing - // compiler doesn't put things in registers. - uint* x = new uint(); - bool* f = new bool(); - uint* r = new uint(); + shared uint x; + shared bool f; + shared uint r; auto thr = new Thread(() { - version (LDC) // don't optimize to a single load with -O + while (!atomicLoad(f)) { - while (!atomicLoad(*f)) {} - } - else - { - while (!*f) - { - } } - atomicFence(); + atomicFence(); // make sure load+store below happens after waiting for f - *r = *x; + cast() r = cast() x; }); - thr.start(); + thr.start(); // new thread will wait until f is set - *x = 42; + cast() x = 42; - atomicFence(); + atomicFence(); // make sure x is set before setting f - *f = true; + cast() f = true; atomicFence(); thr.join(); - assert(*r == 42); + assert(cast() r == 42); } diff --git a/runtime/druntime/src/core/thread/threadbase.d b/runtime/druntime/src/core/thread/threadbase.d index 8a46ca02c8b..719818b036a 100644 --- a/runtime/druntime/src/core/thread/threadbase.d +++ b/runtime/druntime/src/core/thread/threadbase.d @@ -195,6 +195,25 @@ class ThreadBase */ abstract Throwable join(bool rethrow = true); + /** + * Filter any exceptions that escaped the thread entry point. + * This enables a 'grave digger' approach to exceptions. + * + * By default this method will call the global handler in core.exception. + * + * Overriding this method allows a per-thread behavior. + * + * Params: + * thrown = The thrown exception, may be null after returned. + */ + void filterCaughtThrowable(ref Throwable thrown) @system nothrow + { + import core.exception : filterThreadThrowableHandler; + if (thrown is null) + return; + else if (auto handler = filterThreadThrowableHandler()) + handler(thrown); + } /////////////////////////////////////////////////////////////////////////// // General Properties @@ -861,6 +880,11 @@ package ThreadT thread_attachThis_tpl(ThreadT)() * Deregisters the calling thread from use with the runtime. If this routine * is called for a thread which is not registered, the result is undefined. * + * Once the thread is removed from the runtime, it must not use the GC because + * it does not participate in the Stop-The-World mechanisms. With the default + * GC, that has a global lock, this might not cause races, but in GCs with + * regional locks, it definitely can cause races. + * * NOTE: This routine does not run thread-local static destructors when called. * If full functionality as a D thread is desired, the following function * must be called before thread_detachThis, particularly if the thread is @@ -868,6 +892,10 @@ package ThreadT thread_attachThis_tpl(ThreadT)() * * $(D extern(C) void rt_moduleTlsDtor();) * + * This also does not call the GC thread cleanup routine. After running + * module dtors, it is recommended to call + * $(D gc_getProxy().cleanupThread(Thread.getThis());) + * * See_Also: * $(REF thread_attachThis, core,thread,osthread) */ @@ -882,12 +910,22 @@ extern (C) void thread_detachThis() nothrow @nogc * Deregisters the given thread from use with the runtime. If this routine * is called for a thread which is not registered, the result is undefined. * + * Once the thread is removed from the runtime, it must not use the GC because + * it does not participate in the Stop-The-World mechanisms. With the default + * GC, that has a global lock, this might not cause races, but in GCs with + * regional locks, it definitely can cause races. + * * NOTE: This routine does not run thread-local static destructors when called. * If full functionality as a D thread is desired, the following function - * must be called by the detached thread, particularly if the thread is - * being detached at some indeterminate time before program termination: + * must be called by the detached thread before calling this function, + * particularly if the thread is being detached at some indeterminate + * time before program termination: * * $(D extern(C) void rt_moduleTlsDtor();) + * + * This also does not call the GC thread cleanup routine. After running + * module dtors, it is recommended to call (from the thread itself) + * $(D gc_getProxy().cleanupThread(Thread.getThis());) */ extern (C) void thread_detachByAddr(ThreadID addr) { diff --git a/runtime/druntime/src/core/thread/types.d b/runtime/druntime/src/core/thread/types.d index 7d1a5fe7b4c..e630c39668e 100644 --- a/runtime/druntime/src/core/thread/types.d +++ b/runtime/druntime/src/core/thread/types.d @@ -29,7 +29,10 @@ struct ll_ThreadData { ThreadID tid; version (Windows) + { void delegate() nothrow cbDllUnload; + void* hMod; // HMODULE containing the unload callback + } } version (GNU) @@ -47,12 +50,13 @@ else version (LDC) // core.thread.fiber. enum isStackGrowingDown = true; } -else +else version (DigitalMars) { - version (X86) enum isStackGrowingDown = true; - else version (X86_64) enum isStackGrowingDown = true; - else static assert(0, "It is undefined how the stack grows on this architecture."); + // All dmd targets grow down + enum isStackGrowingDown = true; } +else + static assert(0, "It is undefined how the stack grows on this architecture."); package { diff --git a/runtime/druntime/src/core/time.d b/runtime/druntime/src/core/time.d index 8189e67f8af..beb6963486c 100644 --- a/runtime/druntime/src/core/time.d +++ b/runtime/druntime/src/core/time.d @@ -112,7 +112,7 @@ struct mach_timebase_info_data_t uint denom; } -alias mach_timebase_info_data_t* mach_timebase_info_t; +alias mach_timebase_info_t = mach_timebase_info_data_t*; kern_return_t mach_timebase_info(mach_timebase_info_t); @@ -1561,8 +1561,8 @@ public: static assert(!is(typeof(d.split("hnsecs", "seconds", "msecs")()))); static assert(!is(typeof(d.split("seconds", "hnecs", "msecs")()))); static assert(!is(typeof(d.split("seconds", "msecs", "msecs")()))); - alias AliasSeq!("nsecs", "hnsecs", "usecs", "msecs", "seconds", - "minutes", "hours", "days", "weeks") timeStrs; + alias timeStrs = AliasSeq!("nsecs", "hnsecs", "usecs", "msecs", "seconds", + "minutes", "hours", "days", "weeks"); foreach (i, str; timeStrs[1 .. $]) static assert(!is(typeof(d.split!(timeStrs[i - 1], str)()))); diff --git a/runtime/druntime/src/core/vararg.d b/runtime/druntime/src/core/vararg.d index e6dd47d06d3..a283f1a2039 100644 --- a/runtime/druntime/src/core/vararg.d +++ b/runtime/druntime/src/core/vararg.d @@ -106,8 +106,8 @@ void va_arg()(ref va_list ap, TypeInfo ti, void* parmn) } else version (AAPCS64) { - static import core.internal.vararg.aarch64; - core.internal.vararg.aarch64.va_arg(ap, ti, parmn); + static import core.internal.vararg.aapcs64; + core.internal.vararg.aapcs64.va_arg(ap, ti, parmn); } else version (ARM_Any) { diff --git a/runtime/druntime/src/etc/linux/memoryerror.d b/runtime/druntime/src/etc/linux/memoryerror.d index b97bb7948f0..5b372e7f477 100644 --- a/runtime/druntime/src/etc/linux/memoryerror.d +++ b/runtime/druntime/src/etc/linux/memoryerror.d @@ -9,6 +9,7 @@ */ module etc.linux.memoryerror; +public import core.exception : InvalidPointerError, NullPointerError; version (linux) { @@ -95,73 +96,6 @@ version (MemoryErrorSupported) return !sigaction(SIGSEGV, oldptr, null); } - /** - * Thrown on POSIX systems when a SIGSEGV signal is received. - */ - class InvalidPointerError : Error - { - this(string file = __FILE__, size_t line = __LINE__, Throwable next = null) nothrow - { - super("", file, line, next); - } - - this(Throwable next, string file = __FILE__, size_t line = __LINE__) nothrow - { - super("", file, line, next); - } - } - - /** - * Thrown on null pointer dereferences. - */ - class NullPointerError : InvalidPointerError - { - this(string file = __FILE__, size_t line = __LINE__, Throwable next = null) nothrow - { - super(file, line, next); - } - - this(Throwable next, string file = __FILE__, size_t line = __LINE__) nothrow - { - super(file, line, next); - } - } - - unittest - { - int* getNull() { return null; } - - assert(registerMemoryErrorHandler()); - - bool b; - - try - { - *getNull() = 42; - } - catch (NullPointerError) - { - b = true; - } - - assert(b); - - b = false; - - try - { - *getNull() = 42; - } - catch (InvalidPointerError) - { - b = true; - } - - assert(b); - - assert(deregisterMemoryErrorHandler()); - } - // Signal handler space. private: diff --git a/runtime/druntime/src/etc/valgrind/valgrind.d b/runtime/druntime/src/etc/valgrind/valgrind.d index 21829fc23bf..3b70e75be0e 100644 --- a/runtime/druntime/src/etc/valgrind/valgrind.d +++ b/runtime/druntime/src/etc/valgrind/valgrind.d @@ -3,7 +3,7 @@ /// and compile with `-debug=VALGRIND` to access the declarations below. module etc.valgrind.valgrind; -version (StdDdoc) +version (CoreDdoc) { /// Mark the memory covered by `mem` as unaddressable. void makeMemNoAccess (const(void)[] mem) nothrow @nogc; diff --git a/runtime/druntime/src/importc.h b/runtime/druntime/src/importc.h index fadea91066b..d4b8379e678 100644 --- a/runtime/druntime/src/importc.h +++ b/runtime/druntime/src/importc.h @@ -140,6 +140,13 @@ typedef unsigned long long __uint64_t; #define __volatile volatile #define __sync_synchronize() #define __sync_swap(A, B) 1 + +// For whatever reason, sys/cdefs.h has to be included first even though +// it doesn't undef __sym_compat. But without #including sys/cdefs.h first and +// then undefing __sym_compat, the normal __sym_compat gets used. +#include "sys/cdefs.h" +#undef __sym_compat +#define __sym_compat(sym, impl, verid) #endif #if _MSC_VER @@ -153,10 +160,9 @@ typedef unsigned long long __uint64_t; #define _stdcall __stdcall #define _declspec __declspec -// This header disables the Windows API Annotations macros -// Need to include sal.h to get the pragma once to prevent macro redefinition. -#include "sal.h" -#include "no_sal2.h" +// disable the Microsoft Source Code Annotation macros in "sal.h" +#define _USE_DECLSPECS_FOR_SAL 0 +#define _USE_ATTRIBUTES_FOR_SAL 0 #endif /**************************** diff --git a/runtime/druntime/src/object.d b/runtime/druntime/src/object.d index 49d380108b4..568d45875ff 100644 --- a/runtime/druntime/src/object.d +++ b/runtime/druntime/src/object.d @@ -102,7 +102,7 @@ version (LDC) // note: there's a copy for importC in __importc_builtins.di version (ARM) public import core.stdc.stdarg : __va_list; else version (AArch64) - public import core.internal.vararg.aarch64 : __va_list; + public import core.internal.vararg.aapcs64 : __va_list; } } @@ -127,7 +127,8 @@ else version (X86_64) else version (AArch64) { // Apple uses a trivial varargs implementation - version (OSX) {} + version (DigitalMars) version = WithArgTypes; // is this needed? + else version (OSX) {} else version (iOS) {} else version (TVOS) {} else version (WatchOS) {} @@ -547,11 +548,15 @@ unittest // https://issues.dlang.org/show_bug.cgi?id=23291 @system unittest { + import core.atomic : atomicLoad; + static shared class C { bool opEquals(const(shared(C)) rhs) const shared { return true;}} const(C) c = new C(); const(C)[] a = [c]; const(C)[] b = [c]; - assert(a[0] == b[0]); + // Call the shared-aware overload directly to avoid `==` introducing + // additional shared reads during lowering. + assert(atomicLoad(a[0]).opEquals(atomicLoad(b[0]))); } private extern(C) void _d_setSameMutex(shared Object ownee, shared Object owner) nothrow; @@ -570,6 +575,8 @@ void setSameMutex(shared Object ownee, shared Object owner) @system unittest { + import core.atomic : atomicLoad; + shared Object obj1 = new Object; synchronized class C { @@ -581,7 +588,7 @@ void setSameMutex(shared Object ownee, shared Object owner) assert(obj1.__monitor != obj2.__monitor); assert(obj1.__monitor is null); - setSameMutex(obj1, obj2); + setSameMutex(atomicLoad(obj1), atomicLoad(obj2)); assert(obj1.__monitor == obj2.__monitor); assert(obj1.__monitor !is null); } @@ -3897,7 +3904,7 @@ private size_t getArrayHash(const scope TypeInfo element, const scope void* ptr, return hash; } -/// Provide the .dup array property. +/// Provide the .dup array property, which creates a duplicate. @property auto dup(T)(T[] a) if (!is(const(T) : T)) { @@ -3929,7 +3936,7 @@ private size_t getArrayHash(const scope TypeInfo element, const scope void* ptr, } -/// Provide the .idup array property. +/// Provide the .idup array property, which creates an immutable duplicate. @property immutable(T)[] idup(T)(T[] a) { import core.internal.array.duplication : _dup; diff --git a/runtime/druntime/src/rt/alloca.d b/runtime/druntime/src/rt/alloca.d index 108379919d6..0d41c08768c 100644 --- a/runtime/druntime/src/rt/alloca.d +++ b/runtime/druntime/src/rt/alloca.d @@ -200,6 +200,11 @@ extern (C) void* __alloca(int nbytes) } } } + else version (AArch64) + { + import core.stdc.stdlib : malloc; + return malloc(nbytes); // TODO AArch64 + } else static assert(0); } diff --git a/runtime/druntime/src/rt/cmath2.d b/runtime/druntime/src/rt/cmath2.d index ac8dae51455..5d51788122f 100644 --- a/runtime/druntime/src/rt/cmath2.d +++ b/runtime/druntime/src/rt/cmath2.d @@ -1,17 +1,14 @@ /** - * Runtime support for complex arithmetic code generation (for Posix). + * Runtime support for Intel x87 complex arithmetic code generation (for Posix). * * Copyright: Copyright Digital Mars 2001 - 2011. - * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + * License: Distributed under the Boost Software License, Version 1.0. + * See accompanying file LICENSE or copy at + * $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Authors: Walter Bright, Sean Kelly * Source: $(DRUNTIMESRC rt/_cmath2.d) */ -/* Copyright Digital Mars 2001 - 2011. - * 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 rt.cmath2; version (LDC) {} else: @@ -22,6 +19,13 @@ debug import core.stdc.stdio : printf; extern (C): +version (D_InlineAsm_X86) + version = X87; +version (D_InlineAsm_X86_64) + version = X87; + +version (X87): + /**************************** * Multiply two complex floating point numbers, x and y. * Input: diff --git a/runtime/druntime/src/rt/cover.d b/runtime/druntime/src/rt/cover.d index 0b1902104ce..86723cfb4bd 100644 --- a/runtime/druntime/src/rt/cover.d +++ b/runtime/druntime/src/rt/cover.d @@ -313,7 +313,7 @@ shared static ~this() fprintf(flst, "%.*s is %d%% covered\n", cast(int)c.filename.length, c.filename.ptr, percent); if (percent < c.minPercent) { - fprintf(stderr, "Error: %.*s is %d%% covered, less than required %d%%\n", + fprintf(cast()stderr, "Error: %.*s is %d%% covered, less than required %d%%\n", cast(int)c.filename.length, c.filename.ptr, percent, c.minPercent); exit(EXIT_FAILURE); } diff --git a/runtime/druntime/src/rt/critical_.d b/runtime/druntime/src/rt/critical_.d index 594b0c2eae6..12c06021ae8 100644 --- a/runtime/druntime/src/rt/critical_.d +++ b/runtime/druntime/src/rt/critical_.d @@ -21,14 +21,14 @@ import rt.monitor_, core.atomic; extern (C) void _d_critical_init() @nogc nothrow { initMutex(cast(Mutex*)&gcs.mtx); - head = &gcs; + atomicStore(head, &gcs); } extern (C) void _d_critical_term() @nogc nothrow { // This function is only ever called by the runtime shutdown code // and therefore is single threaded so the following cast is fine. - auto h = cast()head; + auto h = cast(D_CRITICAL_SECTION*) atomicLoad(head); for (auto p = h; p; p = p.next) destroyMutex(cast(Mutex*)&p.mtx); } @@ -82,8 +82,8 @@ void ensureMutex(shared(D_CRITICAL_SECTION)* cs) if (atomicLoad!(MemoryOrder.raw)(cs.next) is null) { initMutex(cast(Mutex*)&cs.mtx); - auto ohead = head; - head = cs; + auto ohead = atomicLoad(head); + atomicStore(head, cs); atomicStore!(MemoryOrder.rel)(cs.next, ohead); } unlockMutex(cast(Mutex*)&gcs.mtx); diff --git a/runtime/druntime/src/rt/deh_win32.d b/runtime/druntime/src/rt/deh_win32.d index 46e222cd07b..4f9aeb2e69a 100644 --- a/runtime/druntime/src/rt/deh_win32.d +++ b/runtime/druntime/src/rt/deh_win32.d @@ -158,7 +158,7 @@ struct CONTEXT { BYTE[MAXIMUM_SUPPORTED_EXTENSION] ExtendedRegisters; } -alias CONTEXT* PCONTEXT, LPCONTEXT; +alias PCONTEXT = CONTEXT*, LPCONTEXT = CONTEXT*; struct EXCEPTION_RECORD { DWORD ExceptionCode; @@ -168,13 +168,13 @@ struct EXCEPTION_RECORD { DWORD NumberParameters; ULONG_PTR[EXCEPTION_MAXIMUM_PARAMETERS] ExceptionInformation; } -alias EXCEPTION_RECORD* PEXCEPTION_RECORD, LPEXCEPTION_RECORD; +alias PEXCEPTION_RECORD = EXCEPTION_RECORD*, LPEXCEPTION_RECORD = EXCEPTION_RECORD*; struct EXCEPTION_POINTERS { PEXCEPTION_RECORD ExceptionRecord; PCONTEXT ContextRecord; } -alias EXCEPTION_POINTERS* PEXCEPTION_POINTERS, LPEXCEPTION_POINTERS; +alias PEXCEPTION_POINTERS = EXCEPTION_POINTERS*, LPEXCEPTION_POINTERS = EXCEPTION_POINTERS*; enum EXCEPTION_UNWIND = 6; // Flag to indicate if the system is unwinding /+ Values used by Microsoft for Itanium and Win64 are: @@ -293,11 +293,11 @@ each function which uses exceptions. extern(C) { alias - EXCEPTION_DISPOSITION function ( + LanguageSpecificHandler = EXCEPTION_DISPOSITION function ( EXCEPTION_RECORD *exceptionRecord, DEstablisherFrame *frame, CONTEXT *context, - void *dispatcherContext) LanguageSpecificHandler; + void *dispatcherContext); } @@ -576,7 +576,7 @@ EXCEPTION_DISPOSITION _d_framehandler( // Jump to catch block. Does not return. { uint catch_esp; - alias void function() fp_t; // generic function pointer + alias fp_t = void function(); // generic function pointer fp_t catch_addr = cast(fp_t)(pcb.code); catch_esp = regebp - handlerTable.espoffset - fp_t.sizeof; asm diff --git a/runtime/druntime/src/rt/deh_win64_posix.d b/runtime/druntime/src/rt/deh_win64_posix.d index b5bcdc63215..7aaf362fca9 100644 --- a/runtime/druntime/src/rt/deh_win64_posix.d +++ b/runtime/druntime/src/rt/deh_win64_posix.d @@ -57,7 +57,7 @@ extern (C) void _d_createTrace(Throwable o, void* context); } -alias int function() fp_t; // function pointer in ambient memory model +alias fp_t = int function(); // function pointer in ambient memory model // DHandlerInfo table is generated by except_gentables() in eh.c @@ -131,6 +131,15 @@ version (LDC) {} else: void terminate() { + version (AArch64) + { + asm + { + naked; + op 0xD440_0000; // INSTR.hlt https://www.scs.stanford.edu/~zyedidia/arm64/hlt.html + } + } + else asm { hlt ; @@ -262,6 +271,10 @@ extern (C) void _d_throwc(Throwable h) { mov regebp,RBP ; } + else version (AArch64) + { + assert(0); // TODO AArch64 + } else static assert(0); @@ -427,6 +440,10 @@ extern (C) void _d_throwc(Throwable h) mov RSP,RAX ; // reset stack ret ; // jump to catch block } + else version (AArch64) + { + assert(0); // TODO AArch64 + } else static assert(0); } @@ -476,6 +493,10 @@ extern (C) void _d_throwc(Throwable h) pop RBX ; add RSP,8 ; } + else version (AArch64) + { + assert(0); // TODO AArch64 + } else static assert(0); } @@ -505,6 +526,10 @@ extern (C) void _d_throwc(Throwable h) pop RBX ; add RSP,8 ; } + else version (AArch64) + { + assert(0); // TODO AArch64 + } else static assert(0); } diff --git a/runtime/druntime/src/rt/dmain2.d b/runtime/druntime/src/rt/dmain2.d index a669c7fb29e..156b0764906 100644 --- a/runtime/druntime/src/rt/dmain2.d +++ b/runtime/druntime/src/rt/dmain2.d @@ -44,6 +44,9 @@ else version (Posix) import core.stdc.string : strlen; } +version (DigitalMars) version (AArch64) + version = UseMalloc; // cuz alloca() is not implemented yet + // not sure why we can't define this in one place, but this is to keep this // module from importing core.runtime. struct UnitTestResult @@ -89,7 +92,7 @@ extern (C) string[] rt_args() // be fine to leave it as __gshared. extern (C) __gshared bool rt_trapExceptions = true; -alias void delegate(Throwable) ExceptionHandler; +alias ExceptionHandler = void delegate(Throwable); /** * Keep track of how often rt_init/rt_term were called. @@ -184,7 +187,7 @@ bool isRuntimeInitialized() @nogc nothrow { /********************************************** * Trace handler */ -alias Throwable.TraceInfo function(void* ptr) TraceHandler; +alias TraceHandler = Throwable.TraceInfo function(void* ptr); private __gshared TraceHandler traceHandler = null; private __gshared Throwable.TraceDeallocator traceDeallocator = null; @@ -255,7 +258,7 @@ extern (C) CArgs rt_cArgs() @nogc } /// Type of the D main() function (`_Dmain`). -private alias extern(C) int function(char[][] args) MainFunc; +private alias MainFunc = extern(C) int function(char[][] args); /** * Sets up the D char[][] command-line args, initializes druntime, @@ -284,14 +287,30 @@ extern (C) int _d_run_main(int argc, char** argv, MainFunc mainFunc) // assert(wargc == argc); /* argc can be broken by Unicode arguments */ // Allocate args[] on the stack - use wargc - char[][] args = (cast(char[]*) alloca(wargc * (char[]).sizeof))[0 .. wargc]; + version (UseMalloc) + { + char[][] args = (cast(char[]*) malloc(wargc * (char[]).sizeof))[0 .. wargc]; + if (wargc) + assert(args.ptr); + scope (exit) free(args.ptr); + } + else + char[][] args = (cast(char[]*) alloca(wargc * (char[]).sizeof))[0 .. wargc]; // This is required because WideCharToMultiByte requires int as input. assert(wCommandLineLength <= cast(size_t) int.max, "Wide char command line length must not exceed int.max"); immutable size_t totalArgsLength = WideCharToMultiByte(CP_UTF8, 0, wCommandLine, cast(int)wCommandLineLength, null, 0, null, null); { - char* totalArgsBuff = cast(char*) alloca(totalArgsLength); + version (UseMalloc) + { + char* totalArgsBuff = cast(char*) malloc(totalArgsLength); + if (totalArgsLength) + assert(totalArgsBuff); + scope (exit) free(totalArgsBuff); + } + else + char* totalArgsBuff = cast(char*) alloca(totalArgsLength); size_t j = 0; foreach (i; 0 .. wargc) { @@ -313,7 +332,15 @@ extern (C) int _d_run_main(int argc, char** argv, MainFunc mainFunc) else version (Posix) { // Allocate args[] on the stack - char[][] args = (cast(char[]*) alloca(argc * (char[]).sizeof))[0 .. argc]; + version (UseMalloc) + { + char[][] args = (cast(char[]*) malloc(argc * (char[]).sizeof))[0 .. argc]; + if (argc) + assert(args.ptr); + scope (exit) free(args.ptr); + } + else + char[][] args = (cast(char[]*) alloca(argc * (char[]).sizeof))[0 .. argc]; size_t totalArgsLength = 0; foreach (i, ref arg; args) @@ -439,7 +466,17 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF */ { _d_args = cast(string[]) args; - auto buff = cast(char[]*) alloca(args.length * (char[]).sizeof + totalArgsLength); + + auto length = args.length * (char[]).sizeof + totalArgsLength; + version (UseMalloc) + { + auto buff = cast(char[]*) malloc(length); + if (length) + assert(buff); + //scope (exit) buff; + } + else + auto buff = cast(char[]*) alloca(length); char[][] argsCopy = buff[0 .. args.length]; auto argBuff = cast(char*) (buff + args.length); @@ -520,9 +557,9 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF if (utResult.summarize) { if (utResult.passed == 0) - .fprintf(.stderr, "No unittests run\n"); + .fprintf(cast().stderr, "No unittests run\n"); else - .fprintf(.stderr, "%d modules passed unittests\n", + .fprintf(cast().stderr, "%d modules passed unittests\n", cast(int)utResult.passed); } if (utResult.runMain) @@ -533,7 +570,7 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF else { if (utResult.summarize) - .fprintf(.stderr, "%d/%d modules FAILED unittests\n", + .fprintf(cast().stderr, "%d/%d modules FAILED unittests\n", cast(int)(utResult.executed - utResult.passed), cast(int)utResult.executed); result = EXIT_FAILURE; @@ -554,9 +591,9 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF tryExec(&runAll); // Issue 10344: flush stdout and return nonzero on failure - if (.fflush(.stdout) != 0) + if (.fflush(cast().stdout) != 0) { - .fprintf(.stderr, "Failed to flush stdout: %s\n", .strerror(.errno)); + .fprintf(cast().stderr, "Failed to flush stdout: %s\n", .strerror(.errno)); if (result == 0) { result = EXIT_FAILURE; @@ -633,7 +670,7 @@ extern (C) void _d_print_throwable(Throwable t) // ensure the exception is shown at the beginning of the line, while also // checking whether stderr is a valid file - int written = fprintf(stderr, "\n"); + int written = fprintf(cast()stderr, "\n"); if (written <= 0) { WSink buf; @@ -649,7 +686,7 @@ extern (C) void _d_print_throwable(Throwable t) // by loading it dynamically as needed if (auto user32 = LoadLibraryW("user32.dll")) { - alias typeof(&MessageBoxW) PMessageBoxW; + alias PMessageBoxW = typeof(&MessageBoxW) ; if (auto pMessageBoxW = cast(PMessageBoxW) GetProcAddress(user32, "MessageBoxW")) pMessageBoxW(null, buf.get(), caption.get(), MB_ICONERROR); FreeLibrary(user32); @@ -659,7 +696,7 @@ extern (C) void _d_print_throwable(Throwable t) } return; } - auto hStdErr = windowsHandle(fileno(stderr)); + auto hStdErr = windowsHandle(fileno(cast()stderr)); CONSOLE_SCREEN_BUFFER_INFO sbi = void; const isConsole = GetConsoleScreenBufferInfo(hStdErr, &sbi) != 0; if (isConsole) @@ -687,7 +724,7 @@ extern (C) void _d_print_throwable(Throwable t) void sink(in char[] buf) scope nothrow { - fwrite(buf.ptr, char.sizeof, buf.length, stderr); + fwrite(buf.ptr, char.sizeof, buf.length, cast()stderr); } formatThrowable(t, &sink); } diff --git a/runtime/druntime/src/rt/dwarfeh.d b/runtime/druntime/src/rt/dwarfeh.d index 31671c23e9e..cffa57c03da 100644 --- a/runtime/druntime/src/rt/dwarfeh.d +++ b/runtime/druntime/src/rt/dwarfeh.d @@ -367,8 +367,8 @@ extern(C) void _d_throw_exception(Throwable o) * since otherwise everything is enclosed by a top-level * try/catch. */ - fprintf(stderr, "%s:%d: uncaught exception reached top of stack\n", __FILE__.ptr, __LINE__); - fprintf(stderr, "This might happen if you're missing a top level catch in your fiber or signal handler\n"); + fprintf(cast()stderr, "%s:%d: uncaught exception reached top of stack\n", __FILE__.ptr, __LINE__); + fprintf(cast()stderr, "This might happen if you're missing a top level catch in your fiber or signal handler\n"); /** As _d_print_throwable() itself may throw multiple times when calling core.demangle, and with the uncaught exception still on the EH stack, this doesn't bode well with core.demangle's error recovery. @@ -604,7 +604,7 @@ extern (C) _Unwind_Reason_Code _d_eh_personality_common(_Unwind_Action actions, final switch (result) { case LsdaResult.notFound: - fprintf(stderr, "not found\n"); + fprintf(cast()stderr, "not found\n"); terminate(__LINE__); assert(0); @@ -613,7 +613,7 @@ extern (C) _Unwind_Reason_Code _d_eh_personality_common(_Unwind_Action actions, assert(0); case LsdaResult.corrupt: - fprintf(stderr, "LSDA is corrupt\n"); + fprintf(cast()stderr, "LSDA is corrupt\n"); terminate(__LINE__); assert(0); @@ -959,7 +959,7 @@ LsdaResult scanLSDA(const(ubyte)* lsda, _Unwind_Ptr ip, _Unwind_Exception_Class auto h = actionTableLookup(exceptionObject, cast(uint)ActionRecordPtr, pActionTable, tt, TType, exceptionClass, lsda); if (h < 0) { - fprintf(stderr, "negative handler\n"); + fprintf(cast()stderr, "negative handler\n"); return false; } @@ -1031,7 +1031,7 @@ LsdaResult scanLSDA(const(ubyte)* lsda, _Unwind_Ptr ip, _Unwind_Exception_Class { if (p == pActionTable) break; - fprintf(stderr, "no Call Site Table\n"); + fprintf(cast()stderr, "no Call Site Table\n"); return LsdaResult.corrupt; } @@ -1078,7 +1078,7 @@ LsdaResult scanLSDA(const(ubyte)* lsda, _Unwind_Ptr ip, _Unwind_Exception_Class auto h = actionTableLookup(exceptionObject, cast(uint)ActionRecordPtr, pActionTable, tt, TType, exceptionClass, lsda); if (h < 0) { - fprintf(stderr, "negative handler\n"); + fprintf(cast()stderr, "negative handler\n"); return LsdaResult.corrupt; } if (h == 0) @@ -1165,7 +1165,7 @@ int actionTableLookup(_Unwind_Exception* exceptionObject, uint actionRecordPtr, } if (TypeFilter <= 0) // should never happen with DMD generated tables { - fprintf(stderr, "TypeFilter = %d\n", cast(int)TypeFilter); + fprintf(cast()stderr, "TypeFilter = %d\n", cast(int)TypeFilter); return -1; // corrupt } @@ -1187,7 +1187,7 @@ int actionTableLookup(_Unwind_Exception* exceptionObject, uint actionRecordPtr, else goto case DW_EH_PE_udata4; default: - fprintf(stderr, "TType = x%x\n", TType); + fprintf(cast()stderr, "TType = x%x\n", TType); return -1; // corrupt } if (!entry) // the 'catch all' type diff --git a/runtime/druntime/src/rt/lifetime.d b/runtime/druntime/src/rt/lifetime.d index 5092e52d06f..6e94d1ff1e5 100644 --- a/runtime/druntime/src/rt/lifetime.d +++ b/runtime/druntime/src/rt/lifetime.d @@ -36,7 +36,7 @@ extern(C) { private { - alias bool function(Object) CollectHandler; + alias CollectHandler = bool function(Object); __gshared CollectHandler collectHandler = null; extern (C) void _d_monitordelete(Object h, bool det); @@ -193,7 +193,7 @@ extern (C) void _d_delinterface(void** p) // used for deletion -private extern (D) alias void function (Object) fp_t; +private extern (D) alias fp_t = void function (Object); /** diff --git a/runtime/druntime/src/rt/llmath.d b/runtime/druntime/src/rt/llmath.d index 9f9eb71c9d5..39a71a7d1ac 100644 --- a/runtime/druntime/src/rt/llmath.d +++ b/runtime/druntime/src/rt/llmath.d @@ -190,6 +190,8 @@ quo1: // Quotient is 1 } else version (D_InlineAsm_X86_64) assert(0); + else version (AArch64) + assert(0); else static assert(0); } @@ -358,6 +360,8 @@ quo1: // Quotient is 1 } else version (D_InlineAsm_X86_64) assert(0); + else version (AArch64) + assert(0); else static assert(0); } @@ -435,6 +439,8 @@ L12: jmp __ULDIV2__ ; } else version (D_InlineAsm_X86_64) assert(0); + else version (AArch64) + assert(0); else static assert(0); } @@ -494,6 +500,8 @@ L12: jmp __ULDIV__ ; } else version (D_InlineAsm_X86_64) assert(0); + else version (AArch64) + assert(0); else static assert(0); } diff --git a/runtime/druntime/src/rt/memset.d b/runtime/druntime/src/rt/memset.d index 4c345afaf61..ae6eb454abf 100644 --- a/runtime/druntime/src/rt/memset.d +++ b/runtime/druntime/src/rt/memset.d @@ -1,23 +1,16 @@ /** * Contains a memset implementation used by compiler-generated code. * - * Copyright: Copyright Digital Mars 2004 - 2010. - * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + * Copyright: Copyright Digital Mars 2004 - 2026 + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0) * Authors: Walter Bright * Source: $(DRUNTIMESRC rt/_memset.d) */ -/* Copyright Digital Mars 2004 - 2010. - * 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 rt.memset; version (LDC) {} else: -import rt.util.utility : d_cdouble, d_creal; - extern (C) { // Functions from the C library. @@ -72,6 +65,8 @@ long *_memset64(long *p, long value, size_t count) return pstart; } +struct d_cdouble { double re, im; } + d_cdouble *_memset128(d_cdouble *p, d_cdouble value, size_t count) { d_cdouble *pstart = p; @@ -102,6 +97,8 @@ real *_memset80(real *p, real value, size_t count) return pstart; } +struct d_creal { real re, im; } + d_creal *_memset160(d_creal *p, d_creal value, size_t count) { d_creal *pstart = p; diff --git a/runtime/druntime/src/rt/minfo.d b/runtime/druntime/src/rt/minfo.d index 6f096744127..a70aabbeb64 100644 --- a/runtime/druntime/src/rt/minfo.d +++ b/runtime/druntime/src/rt/minfo.d @@ -183,7 +183,7 @@ struct ModuleGroup { case "deprecate": // Option deprecated in 2.101, remove in 2.111 - fprintf(stderr, "`--DRT-oncycle=deprecate` is no longer supported, using `abort` instead\n"); + fprintf(cast()stderr, "`--DRT-oncycle=deprecate` is no longer supported, using `abort` instead\n"); break; case "abort": onCycle = abort; @@ -375,7 +375,7 @@ struct ModuleGroup case print: // print the message buildCycleMessage(idx, midx, (string x) { - fprintf(stderr, "%.*s", cast(int) x.length, x.ptr); + fprintf(cast()stderr, "%.*s", cast(int) x.length, x.ptr); }); // continue on as if this is correct. break; @@ -520,7 +520,7 @@ struct ModuleGroup !doSort(MItlsctor | MItlsdtor, _tlsctors)) { // print a warning - fprintf(stderr, "Deprecation 16211 warning:\n" + fprintf(cast()stderr, "Deprecation 16211 warning:\n" ~ "A cycle has been detected in your program that was undetected prior to DMD\n" ~ "2.072. This program will continue, but will not operate when using DMD 2.074\n" ~ "to compile. Use runtime option --DRT-oncycle=print to see the cycle details.\n"); diff --git a/runtime/druntime/src/rt/monitor_.d b/runtime/druntime/src/rt/monitor_.d index 1d4ed2ea8fc..b63707ee959 100644 --- a/runtime/druntime/src/rt/monitor_.d +++ b/runtime/druntime/src/rt/monitor_.d @@ -36,14 +36,14 @@ else // may not be safe or desirable. Thus, devt is only valid if impl is // null. -extern (C) void _d_setSameMutex(shared Object ownee, shared Object owner) nothrow +extern (C) void _d_setSameMutex(shared Object ownee, shared Object owner) @trusted nothrow in { assert(ownee.__monitor is null); } do { - auto m = ensureMonitor(cast(Object) owner); + auto m = ensureMonitor(cast(Object) cast(void*) owner); if (m.impl is null) { atomicOp!"+="(m.refs, size_t(1)); @@ -238,19 +238,19 @@ private: __gshared Mutex gmtx; -@property ref shared(Monitor*) monitor(return scope Object h) pure nothrow @nogc +shared(Monitor*)* monitorPtr(return scope Object h) pure nothrow @nogc @trusted { - return *cast(shared Monitor**)&h.__monitor; + return cast(shared(Monitor*)*) &h.__monitor; } shared(Monitor)* getMonitor(Object h) pure @nogc { - return atomicLoad!(MemoryOrder.acq)(h.monitor); + return atomicLoad!(MemoryOrder.acq)(*monitorPtr(h)); } void setMonitor(Object h, shared(Monitor)* m) pure @nogc { - atomicStore!(MemoryOrder.rel)(h.monitor, m); + atomicStore!(MemoryOrder.rel)(*monitorPtr(h), m); } shared(Monitor)* ensureMonitor(Object h) diff --git a/runtime/druntime/src/rt/profilegc.d b/runtime/druntime/src/rt/profilegc.d index e7d4f03e53a..dd12995f422 100644 --- a/runtime/druntime/src/rt/profilegc.d +++ b/runtime/druntime/src/rt/profilegc.d @@ -151,7 +151,7 @@ shared static ~this() { qsort(counts.ptr, counts.length, Result.sizeof, &Result.qsort_cmp); - FILE* fp = logfilename == "\0" ? stdout : fopen((logfilename).ptr, "w"); + FILE* fp = logfilename == "\0" ? cast()stdout : fopen((logfilename).ptr, "w"); if (fp) { fprintf(fp, "bytes allocated, allocations, type, function, file:line\n"); @@ -167,7 +167,7 @@ shared static ~this() else { const err = errno; - fprintf(stderr, "cannot write profilegc log file '%.*s' (errno=%d)", + fprintf(cast()stderr, "cannot write profilegc log file '%.*s' (errno=%d)", cast(int) logfilename.length, logfilename.ptr, cast(int) err); diff --git a/runtime/druntime/src/rt/sections.d b/runtime/druntime/src/rt/sections.d index 90bb112b9df..770343540b5 100644 --- a/runtime/druntime/src/rt/sections.d +++ b/runtime/druntime/src/rt/sections.d @@ -50,9 +50,11 @@ else version (Darwin) version (LDC) public import rt.sections_elf_shared; else version (X86_64) - public import rt.sections_osx_x86_64; + public import rt.sections_osx_64; else version (X86) public import rt.sections_osx_x86; + else version (AArch64) + public import rt.sections_osx_64; else static assert(0, "unimplemented"); } diff --git a/runtime/druntime/src/rt/sections_elf_shared.d b/runtime/druntime/src/rt/sections_elf_shared.d index 30b9eed7450..585c451a1be 100644 --- a/runtime/druntime/src/rt/sections_elf_shared.d +++ b/runtime/druntime/src/rt/sections_elf_shared.d @@ -112,7 +112,7 @@ else debug (PRINTF) import core.stdc.stdio : printf; -alias DSO SectionGroup; +alias SectionGroup = DSO; struct DSO { static int opApply(scope int delegate(ref DSO) dg) diff --git a/runtime/druntime/src/rt/sections_osx_x86_64.d b/runtime/druntime/src/rt/sections_osx_64.d similarity index 95% rename from runtime/druntime/src/rt/sections_osx_x86_64.d rename to runtime/druntime/src/rt/sections_osx_64.d index b9039595817..ad2a71d0ddb 100644 --- a/runtime/druntime/src/rt/sections_osx_x86_64.d +++ b/runtime/druntime/src/rt/sections_osx_64.d @@ -7,9 +7,9 @@ * $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0). * (See accompanying file LICENSE) * Authors: Walter Bright, Sean Kelly, Martin Nowak, Jacob Carlborg - * Source: $(DRUNTIMESRC rt/_sections_osx_x86_64.d) + * Source: $(DRUNTIMESRC rt/_sections_osx_64.d) */ -module rt.sections_osx_x86_64; +module rt.sections_osx_64; version (LDC) { /* implemented in rt.sections_elf_shared */ } else: @@ -23,7 +23,12 @@ else version (WatchOS) version = Darwin; version (Darwin): -version (X86_64): + +version (X86_64) + version = X86_64_or_AArch64; +else version (AArch64) + version = X86_64_or_AArch64; +version (X86_64_or_AArch64): // debug = PRINTF; diff --git a/runtime/druntime/src/rt/sections_win64.d b/runtime/druntime/src/rt/sections_win64.d index c12a87a2d7e..78e60cb83ad 100644 --- a/runtime/druntime/src/rt/sections_win64.d +++ b/runtime/druntime/src/rt/sections_win64.d @@ -415,8 +415,8 @@ extern (C) void gc_setProxy(void* p); void gc_clrProxy(); - alias void function(void*) gcSetFn; - alias void function() gcClrFn; + alias gcSetFn = void function(void*); + alias gcClrFn = void function(); } version (LDC) version (Shared) version = LDC_Shared; diff --git a/runtime/druntime/src/rt/tlsgc.d b/runtime/druntime/src/rt/tlsgc.d index 2b21d1e0e15..3aea706c45e 100644 --- a/runtime/druntime/src/rt/tlsgc.d +++ b/runtime/druntime/src/rt/tlsgc.d @@ -52,7 +52,7 @@ void destroy(void* data) nothrow @nogc .free(data); } -alias void delegate(void* pstart, void* pend) nothrow ScanDg; +alias ScanDg = void delegate(void* pstart, void* pend) nothrow; /** * GC scan hook, called FOR each thread. Can be used to scan diff --git a/runtime/druntime/src/rt/trace.d b/runtime/druntime/src/rt/trace.d index 18ef2306d06..18a37b7a1df 100644 --- a/runtime/druntime/src/rt/trace.d +++ b/runtime/druntime/src/rt/trace.d @@ -93,7 +93,7 @@ void updateFileName(ref char[] filename, string name) assert(0, "Memory allocation failed"); } -alias long timer_t; +alias timer_t = long; ///////////////////////////////////// // @@ -527,7 +527,7 @@ shared static ~this() trace_merge(&groot); // Report results - FILE* fplog = trace_logfilename.length == 0 ? stdout : + FILE* fplog = trace_logfilename.length == 0 ? cast()stdout : fopen(trace_logfilename.ptr, "w"); if (fplog) { @@ -545,10 +545,10 @@ shared static ~this() psymbols = null; } else - fprintf(stderr, "cannot write '%s'", trace_logfilename.ptr); + fprintf(cast()stderr, "cannot write '%s'", trace_logfilename.ptr); // Output function link order - FILE* fpdef = trace_deffilename.length == 0 ? stdout : + FILE* fpdef = trace_deffilename.length == 0 ? cast()stdout : fopen(trace_deffilename.ptr, "w"); if (fpdef) { @@ -557,7 +557,7 @@ shared static ~this() fclose(fpdef); } else - fprintf(stderr, "cannot write '%s'", trace_deffilename.ptr); + fprintf(cast()stderr, "cannot write '%s'", trace_deffilename.ptr); } } diff --git a/runtime/druntime/src/rt/util/typeinfo.d b/runtime/druntime/src/rt/util/typeinfo.d index 9c5af477cbb..f0093c8547a 100644 --- a/runtime/druntime/src/rt/util/typeinfo.d +++ b/runtime/druntime/src/rt/util/typeinfo.d @@ -39,9 +39,8 @@ pragma(inline, true) private int cmp3(T)(const T f1, const T f2) if (isComplex!T) { - if (int result = cmp3(f1.re, f2.re)) - return result; - return cmp3(f1.im, f2.im); + int result; + return (result = cmp3(f1.re, f2.re)) != 0 ? result : cmp3(f1.im, f2.im); } unittest diff --git a/runtime/druntime/test/exceptions/Makefile b/runtime/druntime/test/exceptions/Makefile index 3f6f8070a6d..e9d8e3e075f 100644 --- a/runtime/druntime/test/exceptions/Makefile +++ b/runtime/druntime/test/exceptions/Makefile @@ -22,7 +22,7 @@ SED:=sed GDB:=gdb ifeq ($(OS),linux) - TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle + TESTS+=line_trace line_trace_21656 long_backtrace_trunc rt_trap_exceptions cpp_demangle linux_memory_error_handler # registerMemoryAssertHandler requires glibc ifndef IS_MUSL TESTS+=memoryerror_null_read memoryerror_null_write memoryerror_null_call memoryerror_stackoverflow @@ -120,6 +120,7 @@ $(ROOT)/memoryerror_null_write.done: stderr_exp="segmentation fault: null pointe $(ROOT)/memoryerror_null_call.done: stderr_exp="segmentation fault: null pointer read/write operation" $(ROOT)/memoryerror_null_call.done: stderr_exp2="uncaught exception reached top of stack" $(ROOT)/memoryerror_stackoverflow.done: stderr_exp="segmentation fault: call stack overflow" +$(ROOT)/linux_memory_error_handler.done: stderr_exp="success." $(ROOT)/%.done: $(ROOT)/%$(DOTEXE) @echo Testing $* @@ -173,3 +174,7 @@ $(ROOT)/rt_trap_exceptions_drt$(DOTEXE): extra_dflags += -g $(ROOT)/refcounted$(DOTEXE): extra_dflags+=-dip1008 $(ROOT)/cpp_demangle$(DOTEXE): extra_ldflags.d+=$(line_trace_dflags) $(ROOT)/cpp_demangle$(DOTEXE): extra_ldlibs.d+=-L-lstdc++ +$(ROOT)/memoryerror_null_read$(DOTEXE): extra_dflags += -check=nullderef=off +$(ROOT)/memoryerror_null_write$(DOTEXE): extra_dflags += -check=nullderef=off +$(ROOT)/memoryerror_null_call$(DOTEXE): extra_dflags += -check=nullderef=off +$(ROOT)/linux_memory_error_handler$(DOTEXE): extra_dflags += -check=nullderef=off diff --git a/runtime/druntime/test/exceptions/src/linux_memory_error_handler.d b/runtime/druntime/test/exceptions/src/linux_memory_error_handler.d new file mode 100644 index 00000000000..64a78ed971b --- /dev/null +++ b/runtime/druntime/test/exceptions/src/linux_memory_error_handler.d @@ -0,0 +1,43 @@ +import etc.linux.memoryerror; +import core.stdc.stdio : fprintf, stderr; + +void main() +{ + static if (is(registerMemoryErrorHandler)) + { + int* getNull() { + return null; + } + + assert(registerMemoryErrorHandler()); + + bool b; + + try + { + *getNull() = 42; + } + catch (NullPointerError) + { + b = true; + } + + assert(b); + + b = false; + + try + { + *getNull() = 42; + } + catch (InvalidPointerError) + { + b = true; + } + + assert(b); + + assert(deregisterMemoryErrorHandler()); + } + fprintf(stderr, "success.\n"); +} diff --git a/runtime/druntime/test/importc_compare/src/importc_compare.d b/runtime/druntime/test/importc_compare/src/importc_compare.d index 54081a23f15..bf3fd14172d 100644 --- a/runtime/druntime/test/importc_compare/src/importc_compare.d +++ b/runtime/druntime/test/importc_compare/src/importc_compare.d @@ -29,6 +29,8 @@ immutable string[] growingTypes = [ // warnings for now. immutable ErrorFilter[] knownProblems = [ ErrorFilter("core.stdc.config.c_long_double", "", "Windows", 32, ""), + ErrorFilter("core.stdc.config.c_complex_real", "", "Windows", 32, ""), // complex real is two long doubles so same for x86 Windows + ErrorFilter("core.stdc.config.__c_complex_real", "", "Windows", 32, ""), ErrorFilter("core.stdc.fenv.fenv_t", "", "FreeBSD", 0, ""), ErrorFilter("core.stdc.locale.lconv", "", "Apple", 0, "https://issues.dlang.org/show_bug.cgi?id=24652"), ErrorFilter("core.stdc.locale.lconv", "", "FreeBSD", 0, "https://issues.dlang.org/show_bug.cgi?id=24652"), diff --git a/runtime/druntime/test/shared/Makefile b/runtime/druntime/test/shared/Makefile index 5b19d5a29a8..f0bba9295e5 100644 --- a/runtime/druntime/test/shared/Makefile +++ b/runtime/druntime/test/shared/Makefile @@ -73,7 +73,8 @@ $(OBJDIR)/dll_gc_proxy_teardown_nounload$(DOTEXE): dll_gc_proxy_teardown.d $(LINK.d) $< $(extra_sources) $(extra_ldlibs.d) $(LDLIBS.d) $(OUTPUT_OPTION.d) $(ROOT)/dllgc$(DOTEXE): $(ROOT)/dllgc$(DOTDLL) -$(ROOT)/dllgc$(DOTDLL): private extra_dflags += -version=DLL -od=$(ROOT)/dll +$(ROOT)/dllgc$(DOTDLL): private extra_dflags += -version=DLL -od=$(ROOT)/dll -L/PDB:$(ROOT)/dllgc_dll.pdb +$(ROOT)/dynamiccast$(DOTDLL): private extra_dflags += -L/PDB:$(ROOT)/dynamiccast_dll.pdb endif # Windows $(ROOT)/dynamiccast.done: $(ROOT)/%.done: $(ROOT)/%$(DOTEXE) $(ROOT)/%$(DOTDLL) diff --git a/runtime/druntime/test/shared/src/dllgc.d b/runtime/druntime/test/shared/src/dllgc.d index 928e1479cc4..de060abd490 100644 --- a/runtime/druntime/test/shared/src/dllgc.d +++ b/runtime/druntime/test/shared/src/dllgc.d @@ -42,9 +42,9 @@ version(DLL) static ~this() { - // creating thread in shutdown should fail when statically linked + // creating thread in shutdown should fail (term no longer available) auto tsk = new Task; - assert((tsk.tid != ThreadID.init) == isSharedDRuntime()); + assert(tsk.tid == ThreadID.init); } } else diff --git a/runtime/druntime/test/thread/Makefile b/runtime/druntime/test/thread/Makefile index 07fb08617c9..88d95cb39fc 100644 --- a/runtime/druntime/test/thread/Makefile +++ b/runtime/druntime/test/thread/Makefile @@ -3,7 +3,7 @@ ifdef IN_LDC include ../../../../dmd/osmodel.mak endif -TESTS := tlsgc_sections test_import tlsstack +TESTS := tlsgc_sections test_import tlsstack filterthrownglobal filterthrownmethod # join_detach is currently disabled #TESTS += join_detach diff --git a/runtime/druntime/test/thread/src/filterthrownglobal.d b/runtime/druntime/test/thread/src/filterthrownglobal.d new file mode 100644 index 00000000000..5b9fa02481e --- /dev/null +++ b/runtime/druntime/test/thread/src/filterthrownglobal.d @@ -0,0 +1,31 @@ +import core.exception; +import core.thread; + +__gshared bool caught; + +void main() +{ + filterThreadThrowableHandler = (ref Throwable t) { + if (auto t2 = cast(AssertError) t) + { + if (t2.message != "Hey!") + return; + } + else + return; + + caught = true; + t = null; + }; + + Thread t = new Thread(&entry); + t.start(); + t.join(); + + assert(caught); +} + +void entry() +{ + throw new AssertError("Hey!"); +} diff --git a/runtime/druntime/test/thread/src/filterthrownmethod.d b/runtime/druntime/test/thread/src/filterthrownmethod.d new file mode 100644 index 00000000000..8cb43b8236d --- /dev/null +++ b/runtime/druntime/test/thread/src/filterthrownmethod.d @@ -0,0 +1,41 @@ +import core.exception; +import core.thread; + +__gshared bool caught; + +void main() +{ + Thread t = new MyThread(&entry); + t.start(); + t.join(); + + assert(caught); +} + +class MyThread : Thread +{ + this( void function() fn, size_t sz = 0 ) @safe pure nothrow @nogc + { + super(fn, sz); + } + + override void filterCaughtThrowable(ref Throwable t) @system nothrow + { + if (auto t2 = cast(AssertError) t) + { + if (t2.message == "Hey!") + { + caught = true; + t = null; + return; + } + } + + super.filterCaughtThrowable(t); + } +} + +void entry() +{ + throw new AssertError("Hey!"); +} diff --git a/runtime/phobos b/runtime/phobos index 43871eaacab..8b674885290 160000 --- a/runtime/phobos +++ b/runtime/phobos @@ -1 +1 @@ -Subproject commit 43871eaacabd629fbd7b0bde5b868e727ff0b314 +Subproject commit 8b6748852900bcdbad50c0a3412df479b477d2c4 diff --git a/tests/codegen/in_place_construct.d b/tests/codegen/in_place_construct.d index 610c1341cc3..d334105ec28 100644 --- a/tests/codegen/in_place_construct.d +++ b/tests/codegen/in_place_construct.d @@ -36,25 +36,53 @@ S returnRValue() S returnNRVO() { // make sure NRVO zero-initializes the sret pointee directly - // CHECK: call void @llvm.memset.{{.*}}(ptr{{.*}}, i8 0, + // CHECK: call void @llvm.memset.{{.*}}(ptr{{.*}} %.sret_arg, i8 0, const S r; return r; } -// CHECK-LABEL: define{{.*}} @{{.*}}_D18in_place_construct15withOutContractFZSQBo1S -S withOutContract() +// CHECK-LABEL: define{{.*}} @{{.*}}_D18in_place_construct19RVO_withOutContractFZSQBs1S +S RVO_withOutContract() +out { assert(__result.c == 3); } +do +{ + // make sure the literal is emitted directly into the sret pointee + // CHECK-NEXT: %1 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 0 + // CHECK-NEXT: store i64 1, ptr %1 + // CHECK-NEXT: %2 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 1 + // CHECK-NEXT: store i64 2, ptr %2 + // CHECK-NEXT: %3 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 2 + // CHECK-NEXT: store i64 3, ptr %3 + // CHECK-NEXT: %4 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 3 + // CHECK-NEXT: store i64 4, ptr %4 + return S(1, 2, 3, 4); + + // make sure `__result` inside the out contract is just an alias to the sret pointee + // CHECK: %5 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 2 + // CHECK-NEXT: %6 = load {{.*}}ptr %5 + // CHECK-NEXT: icmp eq i64 %6, 3 +} + +// CHECK-LABEL: define{{.*}} @{{.*}}_D18in_place_construct20NRVO_withOutContractFZSQBt1S +S NRVO_withOutContract() out { assert(__result.a == 0); } do { + // __result is a ref + // CHECK-NEXT: %result = alloca ptr + // make sure NRVO zero-initializes the sret pointee directly - // CHECK: call void @llvm.memset.{{.*}}(ptr{{.*}}, i8 0, + // CHECK-NEXT: call void @llvm.memset.{{.*}}(ptr{{.*}} %.sret_arg, i8 0, const S r; return r; - // make sure `__result` inside the out contract is just an alias to the sret pointee - // CHECK: %{{1|2}} = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %.sret_arg, i32 0, i32 0 - // CHECK: %{{2|3}} = load {{.*}}ptr %{{1|2}} - // CHECK: %{{3|4}} = icmp eq i64 %{{2|3}}, 0 + // make sure the __result ref is initialized with the sret pointer + // CHECK-NEXT: store ptr %.sret_arg, ptr %result + + // CHECK: %1 = load ptr, ptr %result + // CHECK-NEXT: %2 = getelementptr inbounds {{.*}}%in_place_construct.S, ptr %1, i32 0, i32 0 + // CHECK-NEXT: %3 = load {{.*}}ptr %2 + // CHECK-NEXT: icmp eq i64 %3, 0 } // CHECK-LABEL: define{{.*}} @{{.*}}_D18in_place_construct7structsFZv @@ -87,7 +115,8 @@ void structs() // CHECK-SAME: ptr{{.*}} %c const c = returnNRVO(); - withOutContract(); + RVO_withOutContract(); + NRVO_withOutContract(); } // CHECK-LABEL: define{{.*}} @{{.*}}_D18in_place_construct12staticArraysFZv diff --git a/tests/dmd/compilable/alias_param_qual.d b/tests/dmd/compilable/alias_param_qual.d new file mode 100644 index 00000000000..ac902e7d2c8 --- /dev/null +++ b/tests/dmd/compilable/alias_param_qual.d @@ -0,0 +1,7 @@ +alias t(alias a) = a; + +static assert(is(t!(const Object) == const Object)); +static assert(is(t!(shared(Object)) == shared Object)); +static assert(is(t!(immutable S) == immutable(S))); + +struct S {} diff --git a/tests/dmd/compilable/autoreflambda.d b/tests/dmd/compilable/autoreflambda.d new file mode 100644 index 00000000000..a20b273fc09 --- /dev/null +++ b/tests/dmd/compilable/autoreflambda.d @@ -0,0 +1 @@ +alias f = (auto ref int x) {}; diff --git a/tests/dmd/compilable/b12001.d b/tests/dmd/compilable/b12001.d index f67c8957514..c3ef089627e 100644 --- a/tests/dmd/compilable/b12001.d +++ b/tests/dmd/compilable/b12001.d @@ -6,4 +6,8 @@ void main() static assert(!__traits(isSame, bool*, bool[])); static assert(!__traits(isSame, float, double)); + + // https://github.com/dlang/dmd/issues/22442 + static assert(!__traits(isSame, int, const int)); + static assert(!__traits(isSame, Object, const Object)); } diff --git a/tests/dmd/compilable/ctod.i b/tests/dmd/compilable/ctod.i index d1529de47d7..b41a3b7bfd1 100644 --- a/tests/dmd/compilable/ctod.i +++ b/tests/dmd/compilable/ctod.i @@ -53,6 +53,11 @@ extern (C) Callback cb = void; } extern __gshared int[cast(ULONG)3] arr; + alias NOPE1 = void; + void mylib_hello1(); + alias NOPE2 = int; + int mylib_hello2(); + void mylib_hello3(void*); /+enum int __DATE__ = 1+/; /+enum int __TIME__ = 1+/; /+enum int __TIMESTAMP__ = 1+/; @@ -131,3 +136,11 @@ int arr[(ULONG) 3]; #define DEF 123 #define SQL_DRIVER_STMT_ATTR_BASE 0x00004000 // 32-bit #define ABC 64 + +typedef void NOPE1; +void mylib_hello1(void); + +typedef int NOPE2; +int mylib_hello2(void); + +void mylib_hello3(void*); diff --git a/tests/dmd/compilable/dbitfield.d b/tests/dmd/compilable/dbitfield.d index 7187c37410e..74717061546 100644 --- a/tests/dmd/compilable/dbitfield.d +++ b/tests/dmd/compilable/dbitfield.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* */ /***************************************************/ diff --git a/tests/dmd/compilable/depmsg.d b/tests/dmd/compilable/depmsg.d index 2c29e05a588..ed90a62c720 100644 --- a/tests/dmd/compilable/depmsg.d +++ b/tests/dmd/compilable/depmsg.d @@ -2,19 +2,32 @@ REQUIRED_ARGS: -verrors=simple -dw TEST_OUTPUT: --- -compilable/depmsg.d(39): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! -compilable/depmsg.d(39): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! -compilable/depmsg.d(40): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! -compilable/depmsg.d(40): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! -compilable/depmsg.d(41): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! -compilable/depmsg.d(41): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! -compilable/depmsg.d(42): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! -compilable/depmsg.d(42): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! -compilable/depmsg.d(43): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! -compilable/depmsg.d(43): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! -compilable/depmsg.d(45): Deprecation: alias `depmsg.main.Inner.G` is deprecated - With message! -compilable/depmsg.d(46): Deprecation: variable `depmsg.main.Inner.H` is deprecated - With message! -compilable/depmsg.d(47): Deprecation: class `depmsg.main.Inner.I()` is deprecated - With message! +compilable/depmsg.d(52): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! +compilable/depmsg.d(39): `A` is declared here +compilable/depmsg.d(52): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! +compilable/depmsg.d(39): `A` is declared here +compilable/depmsg.d(53): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! +compilable/depmsg.d(40): `B` is declared here +compilable/depmsg.d(53): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! +compilable/depmsg.d(40): `B` is declared here +compilable/depmsg.d(54): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! +compilable/depmsg.d(41): `C` is declared here +compilable/depmsg.d(54): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! +compilable/depmsg.d(41): `C` is declared here +compilable/depmsg.d(55): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! +compilable/depmsg.d(42): `D` is declared here +compilable/depmsg.d(55): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! +compilable/depmsg.d(42): `D` is declared here +compilable/depmsg.d(56): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! +compilable/depmsg.d(43): `E` is declared here +compilable/depmsg.d(56): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! +compilable/depmsg.d(43): `E` is declared here +compilable/depmsg.d(58): Deprecation: alias `depmsg.main.Inner.G` is deprecated - With message! +compilable/depmsg.d(45): `G` is declared here +compilable/depmsg.d(59): Deprecation: variable `depmsg.main.Inner.H` is deprecated - With message! +compilable/depmsg.d(46): `H` is declared here +compilable/depmsg.d(60): Deprecation: class `depmsg.main.Inner.I()` is deprecated - With message! +compilable/depmsg.d(47): `I()` is declared here --- */ void main() diff --git a/tests/dmd/compilable/deprecationlimit.d b/tests/dmd/compilable/deprecationlimit.d index 2b7d45c393f..f749d7ff32b 100644 --- a/tests/dmd/compilable/deprecationlimit.d +++ b/tests/dmd/compilable/deprecationlimit.d @@ -2,9 +2,12 @@ REQUIRED_ARGS: -verrors=simple -verrors=3 TEST_OUTPUT: --- -compilable/deprecationlimit.d(18): Deprecation: function `deprecationlimit.f` is deprecated -compilable/deprecationlimit.d(19): Deprecation: function `deprecationlimit.f` is deprecated -compilable/deprecationlimit.d(20): Deprecation: function `deprecationlimit.f` is deprecated +compilable/deprecationlimit.d(21): Deprecation: function `deprecationlimit.f` is deprecated +compilable/deprecationlimit.d(15): `f` is declared here +compilable/deprecationlimit.d(22): Deprecation: function `deprecationlimit.f` is deprecated +compilable/deprecationlimit.d(15): `f` is declared here +compilable/deprecationlimit.d(23): Deprecation: function `deprecationlimit.f` is deprecated +compilable/deprecationlimit.d(15): `f` is declared here 1 deprecation warning omitted, use `-verrors=0` to show all --- */ diff --git a/tests/dmd/compilable/diag20916.d b/tests/dmd/compilable/diag20916.d index aa30c94fcf3..a8321320076 100644 --- a/tests/dmd/compilable/diag20916.d +++ b/tests/dmd/compilable/diag20916.d @@ -6,12 +6,15 @@ compilable/diag20916.d(32): Deprecation: `alias fb this` is deprecated compilable/diag20916.d(37): instantiated from here: `jump2!(Foo)` compilable/diag20916.d(42): instantiated from here: `jump1!(Foo)` compilable/diag20916.d(32): Deprecation: function `diag20916.FooBar.toString` is deprecated +compilable/diag20916.d(3): `toString` is declared here compilable/diag20916.d(37): instantiated from here: `jump2!(Foo)` compilable/diag20916.d(42): instantiated from here: `jump1!(Foo)` compilable/diag20916.d(32): Deprecation: template `diag20916.Bar.toString()() const` is deprecated +compilable/diag20916.d(15): `toString()() const` is declared here compilable/diag20916.d(37): instantiated from here: `jump2!(Bar)` compilable/diag20916.d(43): instantiated from here: `jump1!(Bar)` compilable/diag20916.d(21): Deprecation: variable `diag20916.Something.something` is deprecated +compilable/diag20916.d(28): `something` is declared here compilable/diag20916.d(24): instantiated from here: `nestedCheck!(Something)` --- */ diff --git a/tests/dmd/compilable/dotvar_ref_return.d b/tests/dmd/compilable/dotvar_ref_return.d new file mode 100644 index 00000000000..881368e2a21 --- /dev/null +++ b/tests/dmd/compilable/dotvar_ref_return.d @@ -0,0 +1,11 @@ +// REQUIRED_ARGS: -inline + +struct Foo +{ + int x; + int foo() + { + ref get() { return x; } + return get(); + } +} diff --git a/tests/dmd/compilable/extra-files/vcg-ast.d.cg b/tests/dmd/compilable/extra-files/vcg-ast.d.cg index 196fdc2a588..8bf24b3a97b 100644 --- a/tests/dmd/compilable/extra-files/vcg-ast.d.cg +++ b/tests/dmd/compilable/extra-files/vcg-ast.d.cg @@ -61,7 +61,7 @@ class C : Object } __require(); this.__invariant(); - __result = 2; + __result = 2 , __result; goto __returnLabel; __returnLabel: this.__invariant(); diff --git a/tests/dmd/compilable/fastdfa.d b/tests/dmd/compilable/fastdfa.d new file mode 100644 index 00000000000..23d6b3daf6a --- /dev/null +++ b/tests/dmd/compilable/fastdfa.d @@ -0,0 +1,1123 @@ +/* + * REQUIRED_ARGS: -preview=fastdfa + */ + +void typeNextIterate(Type t) +{ + Type ts; + + { + Type ta = new Type; + Type* pt; + + for (pt = &ts; *pt != t; pt = &(cast(TypeNext)*pt).next) // no error + { + } + + *pt = ta; + } +} + +void test8() +{ + bool b; + bool* pb = &b; + + assert(b == false); + *pb = true; + assert(b == true); + *pb = false; + assert(b == false); +} + +void uninitWithFuncCheck() +{ + struct Foo + { + bool isB; + + void initThis(bool b) + { + this.isB = b; + } + } + + Foo foo = void; + foo.initThis = false; // ok, we can't know if a method will initialize +} + +string apUninitWrite(void* ap) +{ + string result = void; + auto p1 = cast(size_t*) &result; + + *p1 = *cast(size_t*) ap; // no error its a write after all + return result; +} + +void pointerArithmeticObj() +{ + ubyte[4] storage; + + ubyte* ptr = &storage[1]; + ptr++; +} + +void pickPtr(bool condition) +{ + int i1, i2; + int* ptr = condition ? &i1 : &i2; +} + +@safe: + +bool isNull1(int* ptr) +{ + return ptr is null; +} + +void isNull2() +{ + int* ptr; + + if (ptr !is null) + { + int v = *ptr; // Will not error due to the null test + } + else + { + } +} + +bool truthinessYes() +{ + return true; +} + +bool truthinessNo() +{ + return false; +} + +int* nullable1(int* ptr) +{ + int* ret; + + if (truthinessYes()) + { + } + else + { + ret = ptr; + } + + int v = *ret; // no error, cannot know state of ret + return ret; +} + +void nullable2a(S2* head, S2* previous) +{ + S2* start; + + { + S2* current; + + if (start is null) + { + previous = head; + start = previous; + current = start.next; + } + else + { + current = start.next; + } + + previous = current.next; // should not error + } +} + +void nullable2b(S2* start, S2* head, S2* previous) +{ + { + S2* current; + + if (start is null) + { + previous = head; + start = previous; + current = start.next; + } + else + { + current = start.next; + } + + previous = current.next; // should not error + } +} + +void nullable3(S2** nextParent, S2* r) +{ + if (*nextParent is null) + *nextParent = r; // should not error +} + +void nullable4(int* temp) @trusted +{ + int buffer; + + if (temp is null) + temp = &buffer; + + int v = *temp; // should not error +} + +void truthiness1() +{ + bool a = true; + assert(a != false); + assert(a == !false); + + bool b = !a, c = a != false, d = a == false; +} + +struct S1 +{ + int* field; +} + +struct S2 +{ + S2* next; + S2* another; +} + +void trackS1(S1 s) +{ + bool b = s.field !is null; +} + +void branchCheck() +{ + bool val; + + if (false) + { + val = true; + } +} + +void loopy() +{ + int j; + + Loop: foreach (i; 0 .. 10) + { + j += i * j; + + if (j > 5) + continue; + else if (j > 6) + break; + } +} + +void loopy2() +{ + Loop: do + { + + } + while (false); +} + +void loopy3() +{ + ReadLoopConsole: for (;;) + { + } +} + +void loopy4() +{ + Loop1: foreach (i; 0 .. 10) + { + break Loop1; + } + + Loop2: foreach (i; 0 .. 10) + { + continue Loop2; + } +} + +void loopy5() +{ + Loop: foreach (i; 0 .. 4) + { + switch (i) + { + case 0: + break; + + case 1: + continue; + + case 2: + continue Loop; + + default: + break Loop; + } + } +} + +void loopy8() +{ + int* ptr = new int; + bool b = ptr !is null; + + foreach (i; 0 .. 2) + { + assert(b); // outdated consequences + ptr = null; // error + } +} + +void loopy9(int[] input) +{ + bool result; + + foreach (val; input) + { + if (val == 1) + result = true; + } + + assert(result); +} + +void loop10(bool match, uint[] testCases) +{ + foreach (tc; testCases) + { + bool failure; + if (!match) + failure = true; + assert(!failure); + } +} + +void loopy11() +{ + static struct Tup(T...) + { + T field; + alias field this; + } + + auto t1 = Tup!(int, string)(10, "hi :)"); + int i; + + foreach (e; t1) + { + static if (is(typeof(e) == int)) + { + assert(i == 0); + } + else static if (is(typeof(e) == string)) + { + assert(i == 1); + } + + i++; + } +} + +void nodeFind() +{ + static struct Node + { + Node* next; + + static Node* previous; + } + + Node* start = Node.previous; + Node* current; + + if (start is null) + { + start = Node.previous; + current = start.next; + } + else + current = start.next; + + Node.previous = current.next; +} + +void referenceThat() @trusted +{ + int[2] val; + int* ptr = &val[1]; +} + +void logicalAnd(bool b, int* ptr) +{ + bool a = true; + + if (a && b && ptr !is null) + { + } +} + +void logicalOr(bool b, int* ptr) +{ + bool a = true; + + if ((a && b) || ptr !is null) + { + int val = *ptr; + } +} + +void rotateForChildren(void** parent) +{ + if (*parent is null) + return; +} + +void removeValue(S2* valueNode) +{ + if (valueNode.another !is null) + valueNode.next.next = valueNode.next; + + if (valueNode.next.next is valueNode) + valueNode.next.next = valueNode.another; + else + valueNode.next.another = valueNode.another; +} + +void goingByRef1(ref int* ptr) +{ + ptr = new int; +} + +void goingByRef2(ref int* ptr) +{ + if (ptr is null) + ptr = new int; +} + +void goingByRef3(ref int* ptr) +{ + if (*ptr == 3) + ptr = new int; +} + +void aaWrite1() +{ + string[string] env; + env["MYVAR1"] = "first"; + env["MYVAR2"] = "second"; + + assert(env["MYVAR1"] == "first"); +} + +void aaWrite2() +{ + struct Wrapper + { + string[string] env; + } + + Wrapper* wrapper = new Wrapper; + + wrapper.env["MYVAR1"] = "first"; + wrapper.env["MYVAR2"] = "second"; +} + +void lengthChange() +{ + int[] test; + test.length = 10; + assert(test.length == 10); + assert(test.ptr != null); + + test.length = 1; + assert(test.length == 1); + assert(test.ptr != null); + + test = test[5 .. 5]; + + test.length = 0; + assert(test.length == 0); + assert(test.ptr != null); +} + +void callLaterEffect1() @system +{ + static struct Thing + { + int* data; + + ~this() + { + (*data)++; + } + } + + int val; + scope (exit) + assert(val == 1); + + Thing thing = Thing(&val); +} + +void callLaterEffect2() @system +{ + static struct Thing + { + int* data; + + ~this() + { + (*data)++; + } + } + + int val; + Thing thing = Thing(&val); + + val = 0; + assert(val == 1); +} + +void callByRefEffect() @system +{ + static void effect(Args...)(auto ref Args args) + { + args[0] = -1; + } + + int val; + effect(val); + assert(val == 1); +} + +struct SkippableType +{ + bool a, b, c, d; +} + +bool skipItIf(SkippableType* i, SkippableType** o) +{ + *o = i; + return true; +} + +void skippedNot(SkippableType* token) @system +{ + SkippableType* storage; + + if (token.a || token.b || skipItIf(token, &storage) && (storage.a + || storage.b) || (token.c || token.d)) + { + } +} + +void indexAA() +{ + struct MyStruct + { + int x; + } + + int[MyStruct] td; + td[MyStruct(10)] = 4; + assert(td[MyStruct(10)] == 4); + assert(MyStruct(20) !in td); + assert(td[MyStruct(10)] == 4); +} + +void dupMatch() +{ + static ubyte[] copy(ubyte[] input) + { + return input; + } + + struct Escape + { + ubyte[] array; + } + + ubyte[] reference = new ubyte[20]; + ubyte[] another = copy(reference); + Escape escape = Escape(another[0 .. 0]); + + assert(reference[] == another[]); +} + +void classCall() @trusted +{ + class C + { + this(int* val) + { + *val = 1; + } + + void method() @safe + { + } + } + + int anInt; + C c = new C(&anInt); + + assert(anInt == 2); + c.method; +} + +void unknownLoopIterationCount() +{ + bool[] res; + + while (auto value = truthinessYes()) + res ~= value; + + assert(res == [1, 2, 3]); +} + +struct OrAndIndirect +{ + OrAndIndirect* left_, right_; + int val; + + OrAndIndirect* left() + { + return left_; + } + + OrAndIndirect* right() + { + return right_; + } + + OrAndIndirect* orAndIndirect(OrAndIndirect* w) + { + OrAndIndirect* wl = w.left; + OrAndIndirect* wr = w.right; + + if ((wl is null || wl.val == 0) && (wr is null || wr.val == 0)) + { + } + else + { + if (wr is null || wr.val == 0) + { + wl.val = 0; + } + } + + return null; + } +} + +void gateUpgrade(bool gate) +{ + int* ptr; + + if (gate) + { + ptr = new int; + } + + if (gate) + { + assert(ptr !is null); // no error + } +} + +void checkCompare(string input) +{ + if (input == "^^") + return; + char c = input[0]; +} + +void incrementEffect() +{ + int[] array; + assert(array.length++ == 0); + assert(array.length == 1); +} + +void unknownArrayLiteralCall() @trusted +{ + int toCall(int* ptr) + { + return *ptr; + } + + int val; + int[] literal = [toCall(&val)]; + assert(val == 0); +} + +void branchKill(bool b) +{ + assert(!b); + + if (b) + { + int* ptr; + int val = *ptr; // no error branch dead + } +} + +void switchMakeKnown(int v, int[] slice) +{ + switch (v) + { + case 0: + slice = []; + break; + default: + break; + } + + if (slice.length > 0 && slice[1] == 2) + return; +} + +void nullCompareDerefNot() +{ + static int* source; + + while (true) + { + int* ptr; + + while (true) + { + } + + ptr = source; + + if (ptr == null) + break; + + switch (*ptr) // no error + { + default: + break; + } + } +} + +void sliceAssignNull(string[] dst) +{ + dst[] = null; + dst[0] = null; +} + +void gateCheckBadAssert1(bool gate) +{ + if (gate) + assert(!gate); // no error its basically assert(0); +} + +void gateCheckBadAssert2(bool gate) +{ + if (!gate) + assert(gate); // no error its basically assert(0); +} + +bool isEqualWithGuard(int* value, int* expected) +{ + if (value is null && expected is null) + return true; + + return *value == *expected; +} + +void orIfUnknown(bool b) @system +{ + Object o; + + if (b || (o = Object.factory("object.Object")) !is null) + { + } + + if (string s = o.toString) + { + } +} + +void gatedIfVRP(bool gate) +{ + int i; + + if (gate) + i = 3; + + assert(i == 3); // ok +} + +void orUnknownNonNull(int* ptr) +{ + if (!ptr || *ptr == 2) + { + } +} + +void sliceLength(int[] slice) +{ + assert(slice.length == 3); // ok + assert(slice.length == 2); // error +} + +struct Complex_f +{ + float re, im; + + static Complex_f sqrtc(ref Complex_f z) + { + if (z.re >= 0) + { + } + return Complex_f.init; + } +} + +void loopConditionGreaterThan(int v) +{ + int val; + + foreach (i; 0 .. 10) + { + if (v > 2) + assert(val > 0); + else + val++; + v++; + } +} + +void paArgInterval(int another) +{ + assert(1 <= another && another <= 5); + assert(another == 3); +} + +void checkNullOr(int* val2) +{ + int* val; + if ((val = val2) is null || *val) + { + } +} + +void checkNumAssignCall() +{ + int func() + { + return 3; + } + + int c = 0; + c = func(); + assert(c != -1); + assert(c == '2'); +} + +void checkPostfixPA() +{ + int i = 0; + assert(++i == 1); + assert(i++ == 1); +} + +void checkGreaterThanNoInfer() +{ + bool inferable(string s) + { + return s.length < 3 || s[2] == 'e'; + } + + assert(inferable(null)); +} + +void checkEqualAssignInt(string str) +{ + int i; + + i = (str == "hello"); + assert(i == 1); +} + +int* checkPtrFromStructNoEffect() +{ + // Make sure no effect can come from a field via a pointer. + + static struct PtrFromStruct + { + static PtrFromStruct* global; + int field; + } + + PtrFromStruct* ptrFromStruct() + { + return PtrFromStruct.global; + } + + if (auto p = ptrFromStruct()) + return &p.field; + return null; +} + +void initDefault() +{ + bool b; + bool got = b; +} + +void seeEffectOnObject1(bool condition) +{ + bool* a = new bool(true), b = new bool(true); + bool got = *(condition ? a : b); + assert(!got); // would be nice to error, but won't due to indirection +} + +void seeEffectOnObject2(bool condition) +{ + bool* a = new bool(false), b = new bool(false); + bool got = *(condition ? a : b); + assert(got); // would be nice to error, but won't due to indirection +} + +void checkLengthDeref(int[] slice) +{ + static bool expectNonNull(ref int[] arr) + { + int v = arr[0]; + return true; + } + + if (slice.length && expectNonNull(slice)) + { + } +} + +void uninitMsgPut1() +{ + static void uninitMsgSinkPut(ref char[] buf, string text) + { + } + + char[1024] buf = void; + char[] sink = buf; // cast + + uninitMsgSinkPut(sink, "ok"); // mutates buf + + char[1024] result = buf; // ok +} + +void uninitMsgPut2() +{ + static void uninitMsgSinkPut(ref char[] buf, string text) + { + } + + char[1024] buf = void; + char[] sink = buf[]; // slice + + uninitMsgSinkPut(sink, "ok"); // mutates buf + + char[1024] result = buf; // ok +} + +void loopInLoopCount() +{ + int count; + auto sample = [99]; + + foreach (j; sample) + { + if (j == 0) + { + } + else if (j == 99) + ++count; + } + + assert(9 < count); +} + +struct Ternary +{ + private ubyte value = 6; + + static Ternary make(ubyte b) + { + Ternary r = void; + r.value = b; // no error + return r; // no error + } +} + +class TypeNext +{ + Type next; +} + +class Type +{ + +} + +void uninitStackPtrOf() +{ + char[4] buf; + auto ptr = buf.ptr; + + if (ptr is buf.ptr) + { + } + else + { + bool b; + assert(b); // ok, branch not taken + } +} + +struct BigFoo +{ + ubyte[256] buf; + + static BigFoo getUninitBigFoo() + { + BigFoo ret = void; + return ret; // no error + } +} + +void initOverBranches(bool gate) +{ + int value = void; + + for (;;) + { + if (gate) + value = 1; + else + value = 2; + + if (value > 0) + break; + } +} + +void uninitTestConditionAndDoLoop(bool b) { + size_t bufStart = void; + if (b) + { + bufStart = 39; + do + { + } while (true); + } + else + { + bufStart = 39; + do + { + } while (true); + } + + const minw = bufStart; +} + +void checkFloatInit1_1(bool condition) +{ + float v; + float t = v; // ok, not a math op + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +void checkFloatInit2_1(bool condition) +{ + float v = float.init; + float t = v; // ok + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +void checkFloatInit3_1(bool condition) +{ + float v = 0; + float t = v; // ok + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +void readFromUninit2() +{ + struct Foo + { + int val; + } + + Foo foo = void; + foo.val = 2; // ok, partial initialization +} + +void checkFloatInit2_2(bool condition) +{ + float v = float.init; + float t = v * 2; // ok + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +void checkFloatInit3_2(bool condition) +{ + float v = 0; + float t = v * 2; // ok + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +void checkFloatInit4(float[] array) { + foreach(e; array) { + float t = e * 2; // no error + } +} + +void checkFloatInit5() { + float thing = 2; + + if (float var = thing) { + float t = var * 2; + } +} diff --git a/tests/dmd/compilable/fix20425.c b/tests/dmd/compilable/fix20425.c new file mode 100644 index 00000000000..0d87ec637f8 --- /dev/null +++ b/tests/dmd/compilable/fix20425.c @@ -0,0 +1,11 @@ +// DISABLED: win32 win64 + +#include + +void foo() { + double *a; + double _Complex *b; + double _Complex zden; + double c, d; + zden = c > d? b[0]: a[0]; +} diff --git a/tests/dmd/compilable/fix22153.c b/tests/dmd/compilable/fix22153.c new file mode 100644 index 00000000000..cf423cdba93 --- /dev/null +++ b/tests/dmd/compilable/fix22153.c @@ -0,0 +1,17 @@ +// REQUIRED_ARGS: -lib + +// https://github.com/dlang/dmd/issues/22153 + + +static void static_fun(); + +void (*funcptr)() = &static_fun; + +void lib_fun() +{ + static_fun(); +} + +static void static_fun() +{ +} diff --git a/tests/dmd/compilable/ftimetrace.d b/tests/dmd/compilable/ftimetrace.d index d2eb936ffa7..e4fdd237dd0 100644 --- a/tests/dmd/compilable/ftimetrace.d +++ b/tests/dmd/compilable/ftimetrace.d @@ -1,5 +1,5 @@ /** -REQUIRED_ARGS: -ftime-trace -ftime-trace-file=- -ftime-trace-granularity=0 +REQUIRED_ARGS: -ftime-trace -ftime-trace-file=- -ftime-trace-granularity=0 -preview=fastdfa TRANSFORM_OUTPUT: sanitize_timetrace TEST_OUTPUT: --- @@ -11,6 +11,10 @@ Codegen: function uses, object.uses Codegen: module object, object Ctfe: add(4, 8), add(4, 8) Ctfe: call add, object.add(4, 8) +DFA: add, object.add +DFA: fun, object.fun +DFA: id, object.id!int.id +DFA: uses, object.uses Generate IR, object Import object.object, object.object Optimize, $r:.*ftimetrace_0\.o(bj)?$ diff --git a/tests/dmd/compilable/imports/defines.c b/tests/dmd/compilable/imports/defines.c index 420679a4fcc..a805627db67 100644 --- a/tests/dmd/compilable/imports/defines.c +++ b/tests/dmd/compilable/imports/defines.c @@ -63,3 +63,9 @@ int pr16199c() #define NEGATIVE_U64 -4LLU #define NEGATIVE_F32 -5.0f #define NEGATIVE_F64 -6.0 + +// https://github.com/dlang/dmd/pull/22347 - bare function-like macro calls +#define DOUBLE(x) ((x) * 2) +#define BARE_CALL DOUBLE(5) // bare function-like macro call (no outer parens) +#define PAREN_CALL (DOUBLE(5)) // parenthesized call (already works) +#define WRAPPER(x) DOUBLE(x) // function-like macro calling another macro diff --git a/tests/dmd/compilable/issue17167.sh b/tests/dmd/compilable/issue17167.sh index 3b94feb0a7b..688be6d42c3 100755 --- a/tests/dmd/compilable/issue17167.sh +++ b/tests/dmd/compilable/issue17167.sh @@ -4,6 +4,13 @@ # Test that file paths larger than 248 characters can be used # Test CRLF and mixed line ending handling in D lexer. +probe_dir=$(dirname "${OUTPUT_BASE}") +name_max=$(getconf NAME_MAX "${probe_dir}" 2>/dev/null || echo 255) +if [ "${name_max}" -lt 249 ]; then + echo "Skipping ${TEST_NAME}.sh: NAME_MAX=${name_max} < 249, cannot test Windows long-path threshold." >&2 + exit 0 +fi + test_dir=${OUTPUT_BASE}/uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu mkdir -p "$test_dir" diff --git a/tests/dmd/compilable/issue19163.d b/tests/dmd/compilable/issue19163.d new file mode 100644 index 00000000000..26c1c449328 --- /dev/null +++ b/tests/dmd/compilable/issue19163.d @@ -0,0 +1,20 @@ +struct NameAttribute +{ + int delegate() foo; +} + +static NameAttribute getNamedAttribute(alias S)() +{ + return __traits(getAttributes, S)[0]; +} + +struct TestStruct +{ + @NameAttribute({ return 42; }) int a; +} + +void test() +{ + TestStruct m; + enum nameAttr = getNamedAttribute!(m.a); +} diff --git a/tests/dmd/compilable/issue21997.d b/tests/dmd/compilable/issue21997.d new file mode 100644 index 00000000000..238c9d7ac2c --- /dev/null +++ b/tests/dmd/compilable/issue21997.d @@ -0,0 +1,10 @@ +extern(C++) struct S +{ + static void link(alias MO)(){} + __gshared int i; +} + +void main() +{ + S.link!(S.i); +} diff --git a/tests/dmd/compilable/issue22254.d b/tests/dmd/compilable/issue22254.d new file mode 100644 index 00000000000..94025c18da8 --- /dev/null +++ b/tests/dmd/compilable/issue22254.d @@ -0,0 +1,6 @@ +// https://github.com/dlang/dmd/issues/22254 + +void main() +{ + assert(assert(0, ""), ""); +} diff --git a/tests/dmd/compilable/issue22397.d b/tests/dmd/compilable/issue22397.d new file mode 100644 index 00000000000..5e2c54c6bf5 --- /dev/null +++ b/tests/dmd/compilable/issue22397.d @@ -0,0 +1,14 @@ +// REQUIRED_ARGS: +/* +TEST_OUTPUT: +--- +--- +*/ +void main() +{ + enum var = true; + @var string[] list = ["A", "B", "C"]; + + // Also test explicitly with @(value) syntax + @(1) int[] list2 = [1, 2, 3]; +} diff --git a/tests/dmd/compilable/issue22448.d b/tests/dmd/compilable/issue22448.d new file mode 100644 index 00000000000..6fa23f80dbe --- /dev/null +++ b/tests/dmd/compilable/issue22448.d @@ -0,0 +1,8 @@ +// PERMUTE_ARGS: -O + +void sliceAssign() +{ + enum size_t len = 2_147_483_648UL; + char* src, dst; + dst[0 .. len] = src[0 .. len]; +} diff --git a/tests/dmd/compilable/issue22769.d b/tests/dmd/compilable/issue22769.d new file mode 100644 index 00000000000..986fee38b95 --- /dev/null +++ b/tests/dmd/compilable/issue22769.d @@ -0,0 +1,19 @@ +// https://github.com/dlang/dmd/issues/22769 + +int foo()() => 0; + +void bar() +{ + cast(void) i"$(foo)"; +} + +struct OutBuffer +{ + void opOpAssign(string op, T...)(T args) {} +} + +void qux() +{ + OutBuffer buf; + buf ~= i"$(foo)"; +} diff --git a/tests/dmd/compilable/new_xdtor.d b/tests/dmd/compilable/new_xdtor.d new file mode 100644 index 00000000000..e757a9fd637 --- /dev/null +++ b/tests/dmd/compilable/new_xdtor.d @@ -0,0 +1,10 @@ +// https://github.com/dlang/dmd/issues/22609 +struct S +{ + private ~this() {} +} + +void f() +{ + auto x = new S; +} diff --git a/tests/dmd/compilable/pragmainline2.d b/tests/dmd/compilable/pragmainline2.d index 4381f3c1597..8a2e89f4508 100644 --- a/tests/dmd/compilable/pragmainline2.d +++ b/tests/dmd/compilable/pragmainline2.d @@ -103,6 +103,79 @@ bool test_toUByte() struct S { int x; } S sval; ubarr = toUbyte(sval); - return true; + return true; } static assert(test_toUByte()); + +// https://github.com/dlang/dmd/issues/20246 +void test_split() +{ + // bitop.Split64 only used for 32-bit process + import core.bitop; + ulong v = 1L << 42; + int x = bsr(v); + int y = bsf(v); +} + +void test_newaa() +{ + // inlining of newaa.pure_keyEqual, newaa.compat_key, newaa.pure_hashOf + // must be disabled for nested structs + struct UnsafeElement + { + int i; + static bool b; + ~this(){ + int[] arr; + void* p = arr.ptr + 1; // unsafe + } + } + UnsafeElement[int] aa1; + int[UnsafeElement] aa2; + aa1[1] = UnsafeElement(); + assert(0 !in aa1); + assert(aa1 == aa1); + assert(UnsafeElement() !in aa2); + aa2[UnsafeElement()] = 1; + + // test inlining of hashOf(Interface) + static interface Iface + { + void foo(); + } + Iface[int] aa3; + int[Iface] aa4; +} + +void test_stdatomic() +{ + import core.stdc.stdatomic; + + // check inlining for the unittests of core.stdc.stdatomic + atomic_flag flag; + atomic_flag_test_and_set_explicit_impl(&flag, memory_order.memory_order_seq_cst); + atomic_flag_clear_explicit_impl(&flag, memory_order.memory_order_seq_cst); + + atomic_signal_fence_impl(memory_order.memory_order_seq_cst); + atomic_thread_fence_impl(memory_order.memory_order_seq_cst); + + shared(int) val; + atomic_store_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + + atomic_load_explicit_impl(&val, memory_order.memory_order_seq_cst); + + atomic_fetch_and_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + atomic_exchange_explicit_impl(&val, 2, memory_order.memory_order_seq_cst); + + int expected = 2; + atomic_compare_exchange_strong_explicit_impl(&val, &expected, 1, memory_order.memory_order_seq_cst, memory_order.memory_order_seq_cst); + + expected = 1; + atomic_compare_exchange_weak_explicit_impl(&val, &expected, 2, memory_order.memory_order_seq_cst, memory_order.memory_order_seq_cst); + + atomic_fetch_add_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + atomic_fetch_sub_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + atomic_fetch_or_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + atomic_fetch_xor_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); + atomic_fetch_and_explicit_impl(&val, 3, memory_order.memory_order_seq_cst); +} diff --git a/tests/dmd/compilable/pragmamangle1.d b/tests/dmd/compilable/pragmamangle1.d index ca9bc7e80c4..729afd21293 100644 --- a/tests/dmd/compilable/pragmamangle1.d +++ b/tests/dmd/compilable/pragmamangle1.d @@ -3,8 +3,9 @@ module pragmamangle; version (Posix): // Itanium C++ ABI only -string ctfe_function() { return "mangle_" ~ "ctfe_" ~ "function"; } -immutable string const_variable = "mangle_const"; +string ctfe(string s) { return "mangle_" ~ "ctfe_" ~ s; } +immutable string const_function = "mangle_const_function"; +immutable string const_variable = "mangle_const_variable"; // This mangle string doesn't propagate to tests that use type_symbol. pragma(mangle, "Q_should_mangle_string_propagate") @@ -23,17 +24,17 @@ static assert(test_pokeattr1.mangleof == "mangle_attribute"); /* 2a. For variables and functions there must be one AssignExpression and it * must evaluate at compile time to a string literal */ -pragma(mangle, ctfe_function) void test_fun2a1(); +pragma(mangle, ctfe("function")) void test_fun2a1(); static assert(test_fun2a1.mangleof == "mangle_ctfe_function"); -pragma(mangle, const_variable) void test_fun2a2(); -static assert(test_fun2a2.mangleof == "mangle_const"); +pragma(mangle, const_function) void test_fun2a2(); +static assert(test_fun2a2.mangleof == "mangle_const_function"); -pragma(mangle, ctfe_function) int test_var2a1; -static assert(test_var2a1.mangleof == "mangle_ctfe_function"); +pragma(mangle, ctfe("variable")) int test_var2a1; +static assert(test_var2a1.mangleof == "mangle_ctfe_variable"); pragma(mangle, const_variable) int test_var2a2; -static assert(test_var2a2.mangleof == "mangle_const"); +static assert(test_var2a2.mangleof == "mangle_const_variable"); /* 2b. For aggregates there may be one or two AssignExpressions, one of which * must evaluate at compile time to a string literal and one which must diff --git a/tests/dmd/compilable/pragmamangle2.d b/tests/dmd/compilable/pragmamangle2.d index e1e6e7a28bc..a3ac71a0834 100644 --- a/tests/dmd/compilable/pragmamangle2.d +++ b/tests/dmd/compilable/pragmamangle2.d @@ -3,8 +3,9 @@ module pragmamangle; version (Posix): // Itanium C++ ABI only -string ctfe_function() { return "mangle_" ~ "ctfe_" ~ "function"; } -immutable string const_variable = "mangle_const"; +string ctfe(string s) { return "mangle_" ~ "ctfe_" ~ s; } +immutable string const_function = "mangle_const_function"; +immutable string const_variable = "mangle_const_variable"; // This mangle string doesn't propagate to tests that use type_symbol. pragma(mangle, "Q_should_mangle_string_propagate") @@ -25,17 +26,17 @@ void pragma_statement_test() /* 2a. For variables and functions there must be one AssignExpression and it * must evaluate at compile time to a string literal */ - pragma(mangle, ctfe_function) void test_fun2a1(); + pragma(mangle, ctfe("function")) void test_fun2a1(); static assert(test_fun2a1.mangleof == "mangle_ctfe_function"); - pragma(mangle, const_variable) void test_fun2a2(); - static assert(test_fun2a2.mangleof == "mangle_const"); + pragma(mangle, const_function) void test_fun2a2(); + static assert(test_fun2a2.mangleof == "mangle_const_function"); - pragma(mangle, ctfe_function) static int test_var2a1; - static assert(test_var2a1.mangleof == "mangle_ctfe_function"); + pragma(mangle, ctfe("variable")) int test_var2a1; + static assert(test_var2a1.mangleof == "mangle_ctfe_variable"); - pragma(mangle, const_variable) static int test_var2a2; - static assert(test_var2a2.mangleof == "mangle_const"); + pragma(mangle, const_variable) int test_var2a2; + static assert(test_var2a2.mangleof == "mangle_const_variable"); /* 2b. For aggregates there may be one or two AssignExpressions, one of which * must evaluate at compile time to a string literal and one which must diff --git a/tests/dmd/compilable/previewhelp.d b/tests/dmd/compilable/previewhelp.d index 10a780c5667..94a01ced14b 100644 --- a/tests/dmd/compilable/previewhelp.d +++ b/tests/dmd/compilable/previewhelp.d @@ -19,5 +19,6 @@ Upcoming language changes listed by -preview=name: =inclusiveincontracts 'in' contracts of overridden methods must be a superset of parent contract (https://dlang.org/changelog/2.095.0.html#inclusive-incontracts) =fixImmutableConv disallow `void[]` data from holding immutable data (https://dlang.org/changelog/2.101.0.html#dmd.fix-immutable-conv, https://issues.dlang.org/show_bug.cgi?id=17148) =systemVariables disable access to variables marked '@system' from @safe code (https://dlang.org/spec/attribute.html#system-variables) + =fastdfa Fast dataflow analysis engine, experimental ---- */ diff --git a/tests/dmd/compilable/safer_cfile.c b/tests/dmd/compilable/safer_cfile.c new file mode 100644 index 00000000000..3ad9f94b114 --- /dev/null +++ b/tests/dmd/compilable/safer_cfile.c @@ -0,0 +1,7 @@ +// https://github.com/dlang/dmd/issues/22453 +// -preview=safer should ignore C files +// REQUIRED_ARGS: -preview=safer +int f(int *p) +{ + return p[1]; +} diff --git a/tests/dmd/compilable/struct_allMembers.d b/tests/dmd/compilable/struct_allMembers.d new file mode 100644 index 00000000000..0304e944aab --- /dev/null +++ b/tests/dmd/compilable/struct_allMembers.d @@ -0,0 +1,14 @@ +/* +TEST_OUTPUT: +--- +S2: AliasSeq!("__dtor", "__xdtor", "opAssign") +S3: AliasSeq!("field", "__xdtor", "opAssign") +--- +*/ + +// allMembers should include __xdtor +pragma(msg, "S2: ", __traits(allMembers, S2)); +pragma(msg, "S3: ", __traits(allMembers, S3)); + +static struct S2 { ~this() {} } +static struct S3 { S2 field; } diff --git a/tests/dmd/compilable/test18127.d b/tests/dmd/compilable/test18127.d index 35e6bdc5b17..3d6b454a2be 100644 --- a/tests/dmd/compilable/test18127.d +++ b/tests/dmd/compilable/test18127.d @@ -1,4 +1,5 @@ // https://github.com/dlang/dmd/issues/18127 +// EXTRA_FILES: imports/imp18127a.c imports/imp18127b.c import imports.imp18127a; import imports.imp18127b; diff --git a/tests/dmd/compilable/test19905.d b/tests/dmd/compilable/test19905.d new file mode 100644 index 00000000000..f8c1757c865 --- /dev/null +++ b/tests/dmd/compilable/test19905.d @@ -0,0 +1,29 @@ +// https://github.com/dlang/dmd/issues/19905 +// Type list (tuple) not expanded in delegate during IFTI + +alias AliasSeq(TList...) = TList; + +struct S +{ + void m() {} +} + +void fun1(R)(R delegate(AliasSeq!S) dg) {} +void fun2(R)(R delegate(AliasSeq!(S, S)) dg) {} +void fun3(R)(R delegate(AliasSeq!(S, S, S)) dg) {} +void fun0(R)(R delegate(AliasSeq!()) dg) {} + +void main() +{ + // Explicit template argument always worked + fun1!void((a) { a.m(); }); + fun2!void((a, b) { a.m(); b.m(); }); + fun3!void((a, b, c) { a.m(); b.m(); c.m(); }); + fun0!void(() {}); + + // IFTI with tuple expansion - was broken, now fixed + fun1((a) { a.m(); }); + fun2((a, b) { a.m(); b.m(); }); + fun3((a, b, c) { a.m(); b.m(); c.m(); }); + fun0(() {}); +} diff --git a/tests/dmd/compilable/test20499.d b/tests/dmd/compilable/test20499.d index 9e9e1d27128..3263aed66b6 100644 --- a/tests/dmd/compilable/test20499.d +++ b/tests/dmd/compilable/test20499.d @@ -1,2 +1,3 @@ // https://github.com/dlang/dmd/issues/20499 +// EXTRA_FILES: imports/imp20499.c import imports.imp20499; diff --git a/tests/dmd/compilable/test21299d.d b/tests/dmd/compilable/test21299d.d index 67ec60a582b..a622ae7fd62 100644 --- a/tests/dmd/compilable/test21299d.d +++ b/tests/dmd/compilable/test21299d.d @@ -22,6 +22,7 @@ class Task { void removeTerminationHook(void delegate() hook) { - moveToEnd([], hook); + void delegate()[] array = [() {}]; + moveToEnd(array, hook); } } diff --git a/tests/dmd/compilable/test21495.d b/tests/dmd/compilable/test21495.d new file mode 100644 index 00000000000..954bfa9e951 --- /dev/null +++ b/tests/dmd/compilable/test21495.d @@ -0,0 +1,15 @@ +// https://github.com/dlang/dmd/issues/21495 +extern (C++) +{ + enum string[string] meta = [ + "hellos": "worlds" + ]; + + struct metas + { + static foreach (key, value; meta) + { + mixin("enum string " ~ key ~ " = `" ~ value ~ "`;"); + } + } +} diff --git a/tests/dmd/compilable/test21839.d b/tests/dmd/compilable/test21839.d new file mode 100644 index 00000000000..9fad4aee9ff --- /dev/null +++ b/tests/dmd/compilable/test21839.d @@ -0,0 +1,10 @@ +// https://github.com/dlang/dmd/issues/21839 +// ICE with void[N].init passed to template function + +void tf(U)(U) {} + +void test() +{ + tf(void[16].init); + tf(void[8].init); +} diff --git a/tests/dmd/compilable/test22048.c b/tests/dmd/compilable/test22048.c new file mode 100644 index 00000000000..2453df3ffd3 --- /dev/null +++ b/tests/dmd/compilable/test22048.c @@ -0,0 +1,9 @@ +/* +TEST_OUTPUT: +--- +--- +*/ + +#ifdef _MSCVER +#include +#endif diff --git a/tests/dmd/compilable/test22381.d b/tests/dmd/compilable/test22381.d new file mode 100644 index 00000000000..517f8ab6dee --- /dev/null +++ b/tests/dmd/compilable/test22381.d @@ -0,0 +1,17 @@ +/* +DISABLED: osx LDC +REQUIRED_ARGS: -vasm +TEST_OUTPUT: +--- +_D9test223814maskFPtZv: +0000: $r:[0-9A-F ]*$and word ptr [$r:[A-Z]*$],0FFFEh +0005: C3 ret +--- +*/ + +// https://github.com/dlang/dmd/issues/22381 + +void mask(ushort* p) +{ + *p &= 0xfffe; +} diff --git a/tests/dmd/compilable/test22383.d b/tests/dmd/compilable/test22383.d new file mode 100644 index 00000000000..8106ab18391 --- /dev/null +++ b/tests/dmd/compilable/test22383.d @@ -0,0 +1,12 @@ +struct T22383 +{ + int a = 4; + int b : 16; + int c : 8; + int d : 4; + int e : 2; + int f : 1; + int g : 1; + int h = 8; +} +static assert(T22383.init == T22383(4,0,0,0,0,0,0,8)); diff --git a/tests/dmd/compilable/test22752.d b/tests/dmd/compilable/test22752.d new file mode 100644 index 00000000000..6dc880550b4 --- /dev/null +++ b/tests/dmd/compilable/test22752.d @@ -0,0 +1,23 @@ +/* +REQUIRED_ARGS: +PERMUTE_ARGS: +*/ + +struct S +{ + int isnot; + int[] arguments; +} + +struct Array(T) +{ + static if (is(const(T) : T)) + { + void insert() + { + static assert (is(const(T) : T)); + } + } +} + +alias A = Array!S; diff --git a/tests/dmd/compilable/test22916.d b/tests/dmd/compilable/test22916.d index 9f779fd07da..363a8e5d426 100644 --- a/tests/dmd/compilable/test22916.d +++ b/tests/dmd/compilable/test22916.d @@ -25,7 +25,8 @@ char* g; void test23862() { - scope char** _errors; + char* source; + scope char** _errors = &source; g = front_p(_errors); // should pass g = front_r(_errors); // should pass } diff --git a/tests/dmd/compilable/test8717.d b/tests/dmd/compilable/test8717.d index 26a2866c682..455d72c14cc 100644 --- a/tests/dmd/compilable/test8717.d +++ b/tests/dmd/compilable/test8717.d @@ -60,4 +60,6 @@ static if(SPT.init.sii != 1) { static assert(0); } static if(SPT.sf() != 1) { static assert(0); } static if(SPT.init.f() != 1) { static assert(0); } -void main() { } +// https://github.com/dlang/dmd/issues/22699 +struct S{ int[8] e; } +static assert(S().e[0..4] == S.init.e[0..4]); diff --git a/tests/dmd/compilable/test9701.d b/tests/dmd/compilable/test9701.d index 81b56bdb658..39fd4da9981 100644 --- a/tests/dmd/compilable/test9701.d +++ b/tests/dmd/compilable/test9701.d @@ -3,8 +3,10 @@ /* TEST_OUTPUT: --- -compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value7` is deprecated -compilable/test9701.d(69): Deprecation: enum member `test9701.Enum.value8` is deprecated - message +compilable/test9701.d(71): Deprecation: enum member `test9701.Enum.value7` is deprecated +compilable/test9701.d(36): `value7` is declared here +compilable/test9701.d(71): Deprecation: enum member `test9701.Enum.value8` is deprecated - message +compilable/test9701.d(37): `value8` is declared here --- */ diff --git a/tests/dmd/compilable/test_isOverlapped.d b/tests/dmd/compilable/test_isOverlapped.d new file mode 100644 index 00000000000..a32eb2df334 --- /dev/null +++ b/tests/dmd/compilable/test_isOverlapped.d @@ -0,0 +1,181 @@ +// REQUIRED_ARGS: + +struct S1 +{ + int a; + union + { + int x; + float y; + } + int b; +} + +// Anonymous union fields are overlapped +static assert(__traits(isOverlapped, S1.x)); +static assert(__traits(isOverlapped, S1.y)); +// Regular fields are not overlapped +static assert(!__traits(isOverlapped, S1.a)); +static assert(!__traits(isOverlapped, S1.b)); + +// Named union as a field type +struct S2 +{ + union U + { + int x; + float y; + } + U u; +} +// The instance 'u' itself is not overlapped (it's a regular field) +static assert(!__traits(isOverlapped, S2.u)); +static assert(__traits(isOverlapped, S2.U.x)); +static assert(__traits(isOverlapped, S2.U.y)); + +// Named union accessed directly - its fields are overlapped +union NamedUnion +{ + int x; + float y; +} +static assert(__traits(isOverlapped, NamedUnion.x)); +static assert(__traits(isOverlapped, NamedUnion.y)); + +// Anonymous struct (not a union) - fields are NOT overlapped +struct S3 +{ + struct + { + int x; + float y; + } +} +static assert(!__traits(isOverlapped, S3.x)); +static assert(!__traits(isOverlapped, S3.y)); + +// Named union with nested anonymous union +struct S4 +{ + union Outer + { + int x; // This IS overlapped (it's in a named union) + // Anonymous union nested inside the named union Outer + union + { + int nested1; + float nested2; + } + } + Outer outer; +} +static assert(!__traits(isOverlapped, S4.outer)); // regular field, not overlapped +static assert(__traits(isOverlapped, S4.Outer.nested1)); // in union (both named and anonymous) +static assert(__traits(isOverlapped, S4.Outer.nested2)); // in union (both named and anonymous) +static assert(__traits(isOverlapped, S4.Outer.x)); // in named union - NOW true! + +// Class with anonymous union +class C1 +{ + union + { + int x; + float y; + } +} +static assert(__traits(isOverlapped, C1.x)); +static assert(__traits(isOverlapped, C1.y)); + +// Non-field arguments should return false (not error) +static assert(!__traits(isOverlapped, S1)); // aggregate type +static assert(!__traits(isOverlapped, int)); // type +static assert(!__traits(isOverlapped, 42)); // literal value + +// Deeply nested anonymous unions within anonymous structs +struct S5 +{ + union + { + int x; + struct + { + union + { + int y; + float z; + } + } + } +} +static assert(__traits(isOverlapped, S5.x)); // outer anonymous union +static assert(__traits(isOverlapped, S5.y)); // inner anonymous union +static assert(__traits(isOverlapped, S5.z)); // inner anonymous union + +// Union as top-level type +union TopLevelUnion1 +{ + int a; + float b; + struct + { + int c; + int d; + } +} +static assert(__traits(isOverlapped, TopLevelUnion1.a)); +static assert(__traits(isOverlapped, TopLevelUnion1.b)); +static assert(__traits(isOverlapped, TopLevelUnion1.c)); +static assert(!__traits(isOverlapped, TopLevelUnion1.d)); + +union TopLevelUnion2 +{ + int a; + double b; + struct + { + int c; + int d; // Now d is overlapped with b + } +} +static assert(__traits(isOverlapped, TopLevelUnion2.a)); +static assert(__traits(isOverlapped, TopLevelUnion2.b)); +static assert(__traits(isOverlapped, TopLevelUnion2.c)); +static assert(__traits(isOverlapped, TopLevelUnion2.d)); + +// Bug #22621 +struct Bug22621 +{ + struct D + { + void* ptr; + } + + union + { + struct + { + D d; + } + uint b; + } +} +static assert(__traits(isOverlapped, Bug22621.b)); +// Bug #22621: DMD correctly detects that d is overlapped, but the destructor +// logic doesn't properly handle it - it calls d's destructor even when only b was initialized +static assert(__traits(isOverlapped, Bug22621.d)); // Correctly detected! + +// Struct with both overlapped and non-overlapped fields +struct S6 +{ + int regular1; + union + { + int overlapped1; + float overlapped2; + } + int regular2; +} +static assert(!__traits(isOverlapped, S6.regular1)); +static assert(__traits(isOverlapped, S6.overlapped1)); +static assert(__traits(isOverlapped, S6.overlapped2)); +static assert(!__traits(isOverlapped, S6.regular2)); diff --git a/tests/dmd/compilable/test_nosharedaccess_ctor_nested_new.d b/tests/dmd/compilable/test_nosharedaccess_ctor_nested_new.d new file mode 100644 index 00000000000..3b28e232912 --- /dev/null +++ b/tests/dmd/compilable/test_nosharedaccess_ctor_nested_new.d @@ -0,0 +1,13 @@ +// REQUIRED_ARGS: -preview=nosharedaccess + +class Outer +{ + class Inner + { + } + + shared this() + { + auto i = new shared Inner; + } +} diff --git a/tests/dmd/compilable/test_nosharedaccess_shared_struct_literal.d b/tests/dmd/compilable/test_nosharedaccess_shared_struct_literal.d new file mode 100644 index 00000000000..4bb99010b84 --- /dev/null +++ b/tests/dmd/compilable/test_nosharedaccess_shared_struct_literal.d @@ -0,0 +1,15 @@ +// REQUIRED_ARGS: -preview=nosharedaccess + +import core.atomic; + +struct List +{ + size_t gen; + List* next; +} + +void main() +{ + shared(List) head; + assert(cas(&head, shared(List)(0, null), shared(List)(1, cast(List*)1))); +} diff --git a/tests/dmd/compilable/testcomplex.c b/tests/dmd/compilable/testcomplex.c new file mode 100644 index 00000000000..2be4cfd3e47 --- /dev/null +++ b/tests/dmd/compilable/testcomplex.c @@ -0,0 +1,13 @@ +#include + +void foo(_Complex double z) +{ + return; +} + + +int main() +{ + double z; + foo(z); +} diff --git a/tests/dmd/compilable/testdefines.d b/tests/dmd/compilable/testdefines.d index 58eefb7256a..ba193d2fdad 100644 --- a/tests/dmd/compilable/testdefines.d +++ b/tests/dmd/compilable/testdefines.d @@ -39,3 +39,9 @@ static assert(is(typeof(NEGATIVE_I64) == long)); static assert(is(typeof(NEGATIVE_U64) == ulong)); static assert(is(typeof(NEGATIVE_F32) == float)); static assert(is(typeof(NEGATIVE_F64) == double)); + +// https://github.com/dlang/dmd/pull/22347 - bare function-like macro calls +static assert(DOUBLE(5) == 10); +static assert(BARE_CALL == 10); // bare call now works +static assert(PAREN_CALL == 10); // parenthesized already worked +static assert(WRAPPER(3) == 6); // function-like macro calling another macro diff --git a/tests/dmd/compilable/traits.d b/tests/dmd/compilable/traits.d index 09538b1dd4b..025a82c9795 100644 --- a/tests/dmd/compilable/traits.d +++ b/tests/dmd/compilable/traits.d @@ -169,6 +169,7 @@ class C1 {} static assert( __traits(isCopyable, S1)); static assert( __traits(isCopyable, S2)); static assert(!__traits(isCopyable, S3)); +static assert(!__traits(isCopyable, S3[1])); static assert(!__traits(isCopyable, S4)); static assert(__traits(isCopyable, C1)); static assert(__traits(isCopyable, int)); diff --git a/tests/dmd/compilable/vgc3.d b/tests/dmd/compilable/vgc3.d index efdc5cd5eb3..6e587530d33 100644 --- a/tests/dmd/compilable/vgc3.d +++ b/tests/dmd/compilable/vgc3.d @@ -44,8 +44,12 @@ void testCall() /* TEST_OUTPUT: --- -compilable/vgc3.d(51): vgc: using closure causes GC allocation -compilable/vgc3.d(63): vgc: using closure causes GC allocation +compilable/vgc3.d(55): vgc: using closure causes GC allocation +compilable/vgc3.d(58): vgc: function `bar` closes over variable `x` +compilable/vgc3.d(57): vgc: `x` declared here +compilable/vgc3.d(67): vgc: using closure causes GC allocation +compilable/vgc3.d(70): vgc: function `bar` closes over variable `x` +compilable/vgc3.d(69): vgc: `x` declared here --- */ auto testClosure1() diff --git a/tests/dmd/compilable/warn3882.d b/tests/dmd/compilable/warn3882.d index 9017921e747..14ae3c64f68 100644 --- a/tests/dmd/compilable/warn3882.d +++ b/tests/dmd/compilable/warn3882.d @@ -108,6 +108,7 @@ void testCkeckedInt() bool overflow; assert(mulu(cast(long)3, cast(uint)4, overflow) == 12); + assert(mulu(cast(ulong)3, cast(uint)4, overflow) == 12); assert(testCheckedUnsigned!uint(3,4) == 12); assert(testCheckedUnsigned!ulong(3,4) == 12); diff --git a/tests/dmd/compilable/zerosize2.d b/tests/dmd/compilable/zerosize2.d new file mode 100644 index 00000000000..8f418dc4f44 --- /dev/null +++ b/tests/dmd/compilable/zerosize2.d @@ -0,0 +1,178 @@ +// Test zero sized fields where TargetC.contributesToAlignment +extern(D) +{ + struct D0 { } + struct D1 { byte : 0; } + struct D2 { short : 0; } + struct D3 { int : 0; } + struct D4 { long : 0; } + struct D5 { byte[0] f; } + struct D6 { short[0] f; } + struct D7 { int[0] f; } + struct D8 { long[0] f; } + struct D9 { int : 0; short[0] f; } + align(16) + { + struct D10 { } + struct D11 { byte : 0; } + struct D12 { short : 0; } + struct D13 { int : 0; } + struct D14 { long : 0; } + struct D15 { byte[0] f; } + struct D16 { short[0] f; } + struct D17 { int[0] f; } + struct D18 { long[0] f; } + struct D19 { int : 0; short[0] f; } + } +} + +extern(C) +{ + struct C0 { } + struct C1 { byte : 0; } + struct C2 { short : 0; } + struct C3 { int : 0; } + struct C4 { long : 0; } + struct C5 { byte[0] f; } + struct C6 { short[0] f; } + struct C7 { int[0] f; } + struct C8 { long[0] f; } + struct C9 { int : 0; short[0] f; } + align(16) + { + struct C10 { } + struct C11 { byte : 0; } + struct C12 { short : 0; } + struct C13 { int : 0; } + struct C14 { long : 0; } + struct C15 { byte[0] f; } + struct C16 { short[0] f; } + struct C17 { int[0] f; } + struct C18 { long[0] f; } + struct C19 { int : 0; short[0] f; } + } +} + +version (Posix): + +// Anonymous bitfields don't contribute to alignment. +version (X86_64) +{ + // Empty + static assert(D0.sizeof == 1 && D0.alignof == 1); + static assert(D10.sizeof == 16 && D10.alignof == 16); + + // Zero width bitfields + static assert(D1.sizeof == 1 && D1.alignof == 1); + static assert(D2.sizeof == 1 && D2.alignof == 1); + static assert(D3.sizeof == 1 && D3.alignof == 1); + static assert(D4.sizeof == 1 && D4.alignof == 1); + static assert(D11.sizeof == 16 && D11.alignof == 16); + static assert(D12.sizeof == 16 && D12.alignof == 16); + static assert(D13.sizeof == 16 && D13.alignof == 16); + static assert(D14.sizeof == 16 && D14.alignof == 16); + + // Zero sized arrays + static assert(D5.sizeof == 1 && D5.alignof == 1); + static assert(D6.sizeof == 2 && D6.alignof == 2); + static assert(D7.sizeof == 4 && D7.alignof == 4); + static assert(D8.sizeof == 8 && D8.alignof == 8); + static assert(D15.sizeof == 16 && D15.alignof == 16); + static assert(D16.sizeof == 16 && D16.alignof == 16); + static assert(D17.sizeof == 16 && D17.alignof == 16); + static assert(D18.sizeof == 16 && D18.alignof == 16); + + // Mixed zero sized bitfields and arrays + static assert(D9.sizeof == 2 && D9.alignof == 2); + static assert(D19.sizeof == 16 && D19.alignof == 16); + + // Empty + static assert(C0.sizeof == 0 && C0.alignof == 1); + static assert(C10.sizeof == 0 && C10.alignof == 16); + + // Zero width bitfields + static assert(C1.sizeof == 0 && C1.alignof == 1); + static assert(C2.sizeof == 0 && C2.alignof == 1); + static assert(C3.sizeof == 0 && C3.alignof == 1); + static assert(C4.sizeof == 0 && C4.alignof == 1); + static assert(C11.sizeof == 0 && C11.alignof == 16); + static assert(C12.sizeof == 0 && C12.alignof == 16); + static assert(C13.sizeof == 0 && C13.alignof == 16); + static assert(C14.sizeof == 0 && C14.alignof == 16); + + // Zero sized arrays + static assert(C5.sizeof == 0 && C5.alignof == 1); + static assert(C6.sizeof == 0 && C6.alignof == 2); + static assert(C7.sizeof == 0 && C7.alignof == 4); + static assert(C8.sizeof == 0 && C8.alignof == 8); + static assert(C15.sizeof == 0 && C15.alignof == 16); + static assert(C16.sizeof == 0 && C16.alignof == 16); + static assert(C17.sizeof == 0 && C17.alignof == 16); + static assert(C18.sizeof == 0 && C18.alignof == 16); + + // Mixed zero sized bitfields and arrays + static assert(C9.sizeof == 0 && C9.alignof == 2); + static assert(C19.sizeof == 0 && C19.alignof == 16); +} + +// Anonymous bitfields *do* contribute to alignment. +version (AArch64) +{ + // Empty + static assert(D0.sizeof == 1 && D0.alignof == 1); + static assert(D10.sizeof == 16 && D10.alignof == 16); + + // Zero width bitfields + static assert(D1.sizeof == 1 && D1.alignof == 1); + static assert(D2.sizeof == 2 && D2.alignof == 2); + static assert(D3.sizeof == 4 && D3.alignof == 4); + static assert(D4.sizeof == 8 && D4.alignof == 8); + static assert(D11.sizeof == 16 && D11.alignof == 16); + static assert(D12.sizeof == 16 && D12.alignof == 16); + static assert(D13.sizeof == 16 && D13.alignof == 16); + static assert(D14.sizeof == 16 && D14.alignof == 16); + + // Zero sized arrays + static assert(D5.sizeof == 1 && D5.alignof == 1); + static assert(D6.sizeof == 2 && D6.alignof == 2); + static assert(D7.sizeof == 3 && D7.alignof == 4); + static assert(D8.sizeof == 4 && D8.alignof == 8); + static assert(D15.sizeof == 16 && D15.alignof == 16); + static assert(D16.sizeof == 16 && D16.alignof == 16); + static assert(D17.sizeof == 16 && D17.alignof == 16); + static assert(D18.sizeof == 16 && D18.alignof == 16); + + // Mixed zero sized bitfields and arrays + static assert(D9.sizeof == 4 && D9.alignof == 4); + static assert(D19.sizeof == 16 && D19.alignof == 16); + + /// extern(C): + + // Empty + static assert(C0.sizeof == 0 && C0.alignof == 1); + static assert(C10.sizeof == 0 && C10.alignof == 16); + + // Zero width bitfields + static assert(C1.sizeof == 0 && C1.alignof == 1); + static assert(C2.sizeof == 0 && C2.alignof == 2); + static assert(C3.sizeof == 0 && C3.alignof == 4); + static assert(C4.sizeof == 0 && C4.alignof == 8); + static assert(C11.sizeof == 0 && C11.alignof == 16); + static assert(C12.sizeof == 0 && C12.alignof == 16); + static assert(C13.sizeof == 0 && C13.alignof == 16); + static assert(C14.sizeof == 0 && C14.alignof == 16); + + // Zero sized arrays + static assert(C5.sizeof == 0 && C5.alignof == 1); + static assert(C6.sizeof == 0 && C6.alignof == 2); + static assert(C7.sizeof == 0 && C7.alignof == 4); + static assert(C8.sizeof == 0 && C8.alignof == 8); + static assert(C15.sizeof == 0 && C15.alignof == 16); + static assert(C16.sizeof == 0 && C16.alignof == 16); + static assert(C17.sizeof == 0 && C17.alignof == 16); + static assert(C18.sizeof == 0 && C18.alignof == 16); + + // Mixed zero sized bitfields and arrays + static assert(C9.sizeof == 0 && C9.alignof == 4); + static assert(C19.sizeof == 0 && C19.alignof == 16); +} diff --git a/tests/dmd/dshell/cpp_header_gen.d b/tests/dmd/dshell/cpp_header_gen.d index dcf8681451a..d458199ac0e 100644 --- a/tests/dmd/dshell/cpp_header_gen.d +++ b/tests/dmd/dshell/cpp_header_gen.d @@ -15,7 +15,8 @@ int main() Vars.set("CPP_OBJ", "$OUTPUT_BASE/cpp$OBJ"); Vars.set("HEADER_EXE", "$OUTPUT_BASE/test$EXE"); - run("$DMD -m$MODEL -c -lib -of=$LIB -HC=verbose -HCf=$OUTPUT_BASE/library.h $SOURCE_DIR/library.d"); + // This particular test passes a null pointer from c++ and gets "dereferenced" in D, and will trigger null dereference check to error. + run("$DMD -m$MODEL -c -lib -of=$LIB -check=nullderef=off -HC=verbose -HCf=$OUTPUT_BASE/library.h $SOURCE_DIR/library.d"); // Dump header if any of the following step fails scope (failure) diff --git a/tests/dmd/dshell/dwarf.d b/tests/dmd/dshell/dwarf.d index 0b0e4fa6881..f89523b1f1f 100755 --- a/tests/dmd/dshell/dwarf.d +++ b/tests/dmd/dshell/dwarf.d @@ -31,8 +31,15 @@ int main() else immutable slash = "/"; + // Some systems are configured for binutils to output localized strings. + // Specify LANG=C to disable localization as we test for fixed strings in the output. + // https://www.gnu.org/software/gettext/manual/html_node/The-LANGUAGE-variable.html + // As an example (assuming binutils is compiled with localization), run + // LANG=ja_JP LANGUAGE=ja_JP objdump -H + // to see translated output in action. + auto sysObjdump = executeShell("objdump --version", ["LANG": "C"]); + // If the Unix system doesn't have objdump, disable the tests - auto sysObjdump = executeShell("objdump --version"); if (sysObjdump.status) return DISABLED; @@ -93,7 +100,8 @@ int main() auto objdump = exe ~ ".objdump"; auto objdump_file = File(objdump, "w"); - run("objdump -W " ~ exe, objdump_file); + // Also disable localization here. + run("objdump -W " ~ exe, objdump_file, stderr, ["LANG": "C"]); objdump_file.close(); auto llvmDwarfdump = executeShell("llvm-dwarfdump --version"); diff --git a/tests/dmd/dshell/issue20444_SOURCE_DATE_EPOCH.d b/tests/dmd/dshell/issue20444_SOURCE_DATE_EPOCH.d index ba8765065cb..1a4da3e855b 100644 --- a/tests/dmd/dshell/issue20444_SOURCE_DATE_EPOCH.d +++ b/tests/dmd/dshell/issue20444_SOURCE_DATE_EPOCH.d @@ -10,7 +10,6 @@ void main () { string[string] env = [ "SOURCE_DATE_EPOCH": "704124840", - "TZ": "UTC", "LC_ALL": "C", ]; diff --git a/tests/dmd/fail_compilation/array_literal_assign.d b/tests/dmd/fail_compilation/array_literal_assign.d new file mode 100644 index 00000000000..f10b5d63c12 --- /dev/null +++ b/tests/dmd/fail_compilation/array_literal_assign.d @@ -0,0 +1,22 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/array_literal_assign.d(13): Error: discarded assignment to indexed array literal +fail_compilation/array_literal_assign.d(15): Error: discarded assignment to indexed array literal +fail_compilation/array_literal_assign.d(16): Error: discarded assignment to indexed array literal +fail_compilation/array_literal_assign.d(17): Error: discarded assignment to indexed array literal +--- +*/ + +void main() +{ + [1, 2, 3][2] = 4; + enum e = [1, 2]; + e[0]++; + ++e[0]; + e[0] += 1; + + ref x = (e[0] = 4); // OK + x++; + assert(x == 5); +} diff --git a/tests/dmd/fail_compilation/b23686.d b/tests/dmd/fail_compilation/b23686.d index 5838f5c8e10..680c91a1009 100644 --- a/tests/dmd/fail_compilation/b23686.d +++ b/tests/dmd/fail_compilation/b23686.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/b23686.d(107): Error: undefined identifier `eFN1`, did you mean template `eFN0()()`? +fail_compilation/b23686.d-mixin-107(107): Error: undefined identifier `eFN1`, did you mean template `eFN0()()`? fail_compilation/b23686.d(107): Error: `mixin(_error_)` does not give a valid type fail_compilation/b23686.d(115): while looking for match for `eload!(int, 1)` fail_compilation/b23686.d-mixin-121(121): Error: undefined identifier `FNwtf` diff --git a/tests/dmd/fail_compilation/biterrors.d b/tests/dmd/fail_compilation/biterrors.d index 9515039a721..91a067295a0 100644 --- a/tests/dmd/fail_compilation/biterrors.d +++ b/tests/dmd/fail_compilation/biterrors.d @@ -1,7 +1,6 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- -fail_compilation/biterrors.d(103): Error: initializer not allowed for bitfield declaration fail_compilation/biterrors.d(104): Error: storage class not allowed for bitfield declaration --- */ diff --git a/tests/dmd/fail_compilation/biterrors2.d b/tests/dmd/fail_compilation/biterrors2.d index 85554931d13..2c240b53d1a 100644 --- a/tests/dmd/fail_compilation/biterrors2.d +++ b/tests/dmd/fail_compilation/biterrors2.d @@ -1,9 +1,15 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* REQUIRED_ARGS: -verrors=context * TEST_OUTPUT: --- fail_compilation/biterrors2.d(100): Error: variable `biterrors2.a` - bitfield must be member of struct, union, or class -fail_compilation/biterrors2.d(104): Error: bitfield `b` has zero width -fail_compilation/biterrors2.d(105): Error: bitfield type `float` is not an integer type +int a : 2; + ^ +fail_compilation/biterrors2.d(104): Error: bitfield `b` cannot have zero width + int b:0; + ^ +fail_compilation/biterrors2.d(105): Error: bitfield `c` cannot be of non-integral type `float` + float c:3; + ^ --- */ diff --git a/tests/dmd/fail_compilation/biterrors3.d b/tests/dmd/fail_compilation/biterrors3.d index e956fc2f6eb..6fbf16f9238 100644 --- a/tests/dmd/fail_compilation/biterrors3.d +++ b/tests/dmd/fail_compilation/biterrors3.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- fail_compilation/biterrors3.d(103): Error: storage class not allowed for bitfield declaration diff --git a/tests/dmd/fail_compilation/biterrors4.d b/tests/dmd/fail_compilation/biterrors4.d index 53b5cdc232f..5457ad53c5c 100644 --- a/tests/dmd/fail_compilation/biterrors4.d +++ b/tests/dmd/fail_compilation/biterrors4.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- fail_compilation/biterrors4.d(109): Error: cannot take address of bitfield `s.a` diff --git a/tests/dmd/fail_compilation/biterrors5.d b/tests/dmd/fail_compilation/biterrors5.d index e17516b8f89..3e661799b8c 100644 --- a/tests/dmd/fail_compilation/biterrors5.d +++ b/tests/dmd/fail_compilation/biterrors5.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- fail_compilation/biterrors5.d(25): Error: bitfield symbol expected not struct `biterrors5.S` diff --git a/tests/dmd/fail_compilation/biterrors6.d b/tests/dmd/fail_compilation/biterrors6.d new file mode 100644 index 00000000000..d10c1e1b213 --- /dev/null +++ b/tests/dmd/fail_compilation/biterrors6.d @@ -0,0 +1,24 @@ +/* REQUIRED_ARGS: -verrors=context + * TEST_OUTPUT: +--- +fail_compilation/biterrors6.d(20): Error: anonymous bitfield cannot be of non-integral type `noreturn` + noreturn : -1; + ^ +fail_compilation/biterrors6.d(21): Error: anonymous bitfield has negative width `-1` + int : -1; + ^ +fail_compilation/biterrors6.d(22): Error: bitfield `n` cannot be of non-integral type `noreturn` + noreturn n : -500; + ^ +fail_compilation/biterrors6.d(23): Error: bitfield `i` has negative width `-500` + int i : -500; + ^ +--- +*/ +struct S +{ + noreturn : -1; + int : -1; + noreturn n : -500; + int i : -500; +} diff --git a/tests/dmd/fail_compilation/biterrors7.d b/tests/dmd/fail_compilation/biterrors7.d new file mode 100644 index 00000000000..2ecb91530d4 --- /dev/null +++ b/tests/dmd/fail_compilation/biterrors7.d @@ -0,0 +1,15 @@ +/* REQUIRED_ARGS: -verrors=context + * TEST_OUTPUT: +--- +fail_compilation/biterrors7.d(14): Error: struct `biterrors7.S` cannot have anonymous field with same struct type + S : S(); + ^ +fail_compilation/biterrors7.d(14): Error: anonymous bitfield cannot be of non-integral type `S` + S : S(); + ^ +--- +*/ +struct S +{ + S : S(); +} diff --git a/tests/dmd/fail_compilation/bitfields2.c b/tests/dmd/fail_compilation/bitfields2.c index e9f644ba468..3f6977b23ac 100644 --- a/tests/dmd/fail_compilation/bitfields2.c +++ b/tests/dmd/fail_compilation/bitfields2.c @@ -1,8 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/bitfields2.c(103): Error: bitfield type `float` is not an integer type +fail_compilation/bitfields2.c(103): Error: bitfield `a` cannot be of non-integral type `float` fail_compilation/bitfields2.c(104): Error: bitfield width `3.0` is not an integer constant -fail_compilation/bitfields2.c(105): Error: bitfield `c` has zero width +fail_compilation/bitfields2.c(105): Error: bitfield `c` cannot have zero width fail_compilation/bitfields2.c(106): Error: width `60` of bitfield `d` does not fit in type `int` --- */ diff --git a/tests/dmd/fail_compilation/bitintro.d b/tests/dmd/fail_compilation/bitintro.d index d58c3ea56ff..c91621c7220 100644 --- a/tests/dmd/fail_compilation/bitintro.d +++ b/tests/dmd/fail_compilation/bitintro.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* */ struct S diff --git a/tests/dmd/fail_compilation/cast_system.d b/tests/dmd/fail_compilation/cast_system.d new file mode 100644 index 00000000000..c8f5fd65869 --- /dev/null +++ b/tests/dmd/fail_compilation/cast_system.d @@ -0,0 +1,37 @@ +/* +REQUIRED_ARGS: -preview=systemVariables +TEST_OUTPUT: +--- +fail_compilation/cast_system.d(31): Error: cast from `int[1]` to `UniqueInt` is not allowed in a `@safe` function +fail_compilation/cast_system.d(31): Target element type has unsafe bit patterns +--- +*/ + +struct UniqueInt +{ + @system int n; + + this(int n) @safe + { + this.n = n; + } + + @disable this(ref inout UniqueInt) inout; + + ~this() @trusted + { + this.n = 0; + } +} + +void main() @safe +{ + auto s = cast(UniqueInt) 7; // OK, calls ctor + int[1] a; + s = cast(UniqueInt) a; // doesn't call ctor +} + +void ok() @safe +{ + auto b = cast(bool) 7; // OK +} diff --git a/tests/dmd/fail_compilation/cdeprecated.i b/tests/dmd/fail_compilation/cdeprecated.i index 75ce2acbe6e..afad04453b2 100644 --- a/tests/dmd/fail_compilation/cdeprecated.i +++ b/tests/dmd/fail_compilation/cdeprecated.i @@ -1,10 +1,14 @@ /* REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/cdeprecated.i(18): Deprecation: function `cdeprecated.mars` is deprecated -fail_compilation/cdeprecated.i(19): Deprecation: function `cdeprecated.jupiter` is deprecated - jumping jupiter -fail_compilation/cdeprecated.i(20): Deprecation: function `cdeprecated.saturn` is deprecated -fail_compilation/cdeprecated.i(21): Deprecation: function `cdeprecated.neptune` is deprecated - spinning neptune +fail_compilation/cdeprecated.i(22): Deprecation: function `cdeprecated.mars` is deprecated +fail_compilation/cdeprecated.i(14): `mars` is declared here +fail_compilation/cdeprecated.i(23): Deprecation: function `cdeprecated.jupiter` is deprecated - jumping jupiter +fail_compilation/cdeprecated.i(15): `jupiter` is declared here +fail_compilation/cdeprecated.i(24): Deprecation: function `cdeprecated.saturn` is deprecated +fail_compilation/cdeprecated.i(16): `saturn` is declared here +fail_compilation/cdeprecated.i(25): Deprecation: function `cdeprecated.neptune` is deprecated - spinning neptune +fail_compilation/cdeprecated.i(17): `neptune` is declared here --- */ __declspec(deprecated) int mars(); diff --git a/tests/dmd/fail_compilation/covariant_override.d b/tests/dmd/fail_compilation/covariant_override.d index 7738770775d..9ee5342ba0b 100644 --- a/tests/dmd/fail_compilation/covariant_override.d +++ b/tests/dmd/fail_compilation/covariant_override.d @@ -3,9 +3,11 @@ https://issues.dlang.org/show_bug.cgi?id=21538 TEST_OUTPUT: --- -fail_compilation/covariant_override.d(23): Error: function `@safe void covariant_override.CI.f(void delegate() @safe dg)` does not override any function, did you mean to override `@safe void covariant_override.I.f(void delegate() @system dg)`? -fail_compilation/covariant_override.d(34): Error: function `@safe void covariant_override.CA.f(void delegate() @safe dg)` does not override any function, did you mean to override `@safe void covariant_override.A.f(void delegate() @system dg)`? -fail_compilation/covariant_override.d(20): Error: class `covariant_override.CI` interface function `void f(void delegate() @system dg) @safe` is not implemented +fail_compilation/covariant_override.d(25): Error: function `@safe void covariant_override.CI.f(void delegate() @safe dg)` does not override any function +fail_compilation/covariant_override.d(19): did you mean to override `@safe void covariant_override.I.f(void delegate() @system dg)`? +fail_compilation/covariant_override.d(36): Error: function `@safe void covariant_override.CA.f(void delegate() @safe dg)` does not override any function +fail_compilation/covariant_override.d(30): did you mean to override `@safe void covariant_override.A.f(void delegate() @system dg)`? +fail_compilation/covariant_override.d(22): Error: class `covariant_override.CI` interface function `void f(void delegate() @system dg) @safe` is not implemented --- ++/ diff --git a/tests/dmd/fail_compilation/dbitfields.d b/tests/dmd/fail_compilation/dbitfields.d index 0dd1a0bf96e..5d135b7bf4c 100644 --- a/tests/dmd/fail_compilation/dbitfields.d +++ b/tests/dmd/fail_compilation/dbitfields.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- fail_compilation/dbitfields.d(118): Error: reinterpretation through overlapped field `e` is not allowed in CTFE diff --git a/tests/dmd/fail_compilation/dep_d1_ops.d b/tests/dmd/fail_compilation/dep_d1_ops.d index 83e700632a8..2b51051a00d 100644 --- a/tests/dmd/fail_compilation/dep_d1_ops.d +++ b/tests/dmd/fail_compilation/dep_d1_ops.d @@ -5,23 +5,23 @@ TEST_OUTPUT: fail_compilation/dep_d1_ops.d(281): Error: operator `+` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "+")(int rhs) {}` fail_compilation/dep_d1_ops.d(282): Error: operator `+` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "+")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "+")(int lhs) {}` fail_compilation/dep_d1_ops.d(283): Error: operator `-` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "-")(int rhs) {}` fail_compilation/dep_d1_ops.d(284): Error: operator `-` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "-")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "-")(int lhs) {}` fail_compilation/dep_d1_ops.d(285): Error: operator `*` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "*")(int rhs) {}` fail_compilation/dep_d1_ops.d(286): Error: operator `*` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "*")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "*")(int lhs) {}` fail_compilation/dep_d1_ops.d(287): Error: operator `/` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "/")(int rhs) {}` fail_compilation/dep_d1_ops.d(288): Error: operator `/` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "/")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "/")(int lhs) {}` fail_compilation/dep_d1_ops.d(289): Error: operator `%` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "%")(int rhs) {}` fail_compilation/dep_d1_ops.d(290): Error: operator `%` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "%")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "%")(int lhs) {}` fail_compilation/dep_d1_ops.d(292): Error: operator `&` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "&")(int rhs) {}` fail_compilation/dep_d1_ops.d(293): Error: operator `|` is not defined for type `S` @@ -31,19 +31,19 @@ fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `a fail_compilation/dep_d1_ops.d(296): Error: operator `<<` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "<<")(int rhs) {}` fail_compilation/dep_d1_ops.d(297): Error: operator `<<` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "<<")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "<<")(int lhs) {}` fail_compilation/dep_d1_ops.d(298): Error: operator `>>` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : ">>")(int rhs) {}` fail_compilation/dep_d1_ops.d(299): Error: operator `>>` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : ">>")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : ">>")(int lhs) {}` fail_compilation/dep_d1_ops.d(300): Error: operator `>>>` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : ">>>")(int rhs) {}` fail_compilation/dep_d1_ops.d(301): Error: operator `>>>` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : ">>>")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : ">>>")(int lhs) {}` fail_compilation/dep_d1_ops.d(303): Error: operator `~` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "~")(int rhs) {}` fail_compilation/dep_d1_ops.d(304): Error: operator `~` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "~")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "~")(int lhs) {}` fail_compilation/dep_d1_ops.d(306): Error: operator `+` is not defined for `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opUnary(string op : "+")() {}` fail_compilation/dep_d1_ops.d(307): Error: operator `-` is not defined for `S` @@ -59,7 +59,7 @@ fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `a fail_compilation/dep_d1_ops.d(313): Error: operator `in` is not defined for type `S` fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinary(string op : "in")(int rhs) {}` fail_compilation/dep_d1_ops.d(314): Error: operator `in` is not defined for type `S` -fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int rhs) {}` +fail_compilation/dep_d1_ops.d(174): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int lhs) {}` fail_compilation/dep_d1_ops.d(316): Error: operator `+=` not supported for `s` of type `S` fail_compilation/dep_d1_ops.d(174): perhaps implement `auto opOpAssign(string op : "+")(int) {}` fail_compilation/dep_d1_ops.d(317): Error: operator `-=` not supported for `s` of type `S` @@ -87,23 +87,23 @@ fail_compilation/dep_d1_ops.d(174): perhaps implement `auto opOpAssign(st fail_compilation/dep_d1_ops.d(331): Error: operator `+` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "+")(int rhs) {}` fail_compilation/dep_d1_ops.d(332): Error: operator `+` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "+")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "+")(int lhs) {}` fail_compilation/dep_d1_ops.d(333): Error: operator `-` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "-")(int rhs) {}` fail_compilation/dep_d1_ops.d(334): Error: operator `-` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "-")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "-")(int lhs) {}` fail_compilation/dep_d1_ops.d(335): Error: operator `*` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "*")(int rhs) {}` fail_compilation/dep_d1_ops.d(336): Error: operator `*` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "*")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "*")(int lhs) {}` fail_compilation/dep_d1_ops.d(337): Error: operator `/` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "/")(int rhs) {}` fail_compilation/dep_d1_ops.d(338): Error: operator `/` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "/")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "/")(int lhs) {}` fail_compilation/dep_d1_ops.d(339): Error: operator `%` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "%")(int rhs) {}` fail_compilation/dep_d1_ops.d(340): Error: operator `%` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "%")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "%")(int lhs) {}` fail_compilation/dep_d1_ops.d(342): Error: operator `&` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "&")(int rhs) {}` fail_compilation/dep_d1_ops.d(343): Error: operator `|` is not defined for type `dep_d1_ops.C` @@ -113,19 +113,19 @@ fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `a fail_compilation/dep_d1_ops.d(346): Error: operator `<<` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "<<")(int rhs) {}` fail_compilation/dep_d1_ops.d(347): Error: operator `<<` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "<<")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "<<")(int lhs) {}` fail_compilation/dep_d1_ops.d(348): Error: operator `>>` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : ">>")(int rhs) {}` fail_compilation/dep_d1_ops.d(349): Error: operator `>>` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : ">>")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : ">>")(int lhs) {}` fail_compilation/dep_d1_ops.d(350): Error: operator `>>>` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : ">>>")(int rhs) {}` fail_compilation/dep_d1_ops.d(351): Error: operator `>>>` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : ">>>")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : ">>>")(int lhs) {}` fail_compilation/dep_d1_ops.d(353): Error: operator `~` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "~")(int rhs) {}` fail_compilation/dep_d1_ops.d(354): Error: operator `~` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "~")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "~")(int lhs) {}` fail_compilation/dep_d1_ops.d(356): Error: operator `+` is not defined for `C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opUnary(string op : "+")() {}` fail_compilation/dep_d1_ops.d(357): Error: operator `-` is not defined for `C` @@ -141,7 +141,7 @@ fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `a fail_compilation/dep_d1_ops.d(363): Error: operator `in` is not defined for type `dep_d1_ops.C` fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinary(string op : "in")(int rhs) {}` fail_compilation/dep_d1_ops.d(364): Error: operator `in` is not defined for type `dep_d1_ops.C` -fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int rhs) {}` +fail_compilation/dep_d1_ops.d(225): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int lhs) {}` fail_compilation/dep_d1_ops.d(366): Error: operator `+=` not supported for `c` of type `C` fail_compilation/dep_d1_ops.d(225): perhaps implement `auto opOpAssign(string op : "+")(int) {}` fail_compilation/dep_d1_ops.d(367): Error: operator `-=` not supported for `c` of type `C` diff --git a/tests/dmd/fail_compilation/depmsg.d b/tests/dmd/fail_compilation/depmsg.d index b0c2b2e6a8e..01437d1f735 100644 --- a/tests/dmd/fail_compilation/depmsg.d +++ b/tests/dmd/fail_compilation/depmsg.d @@ -2,19 +2,32 @@ /* TEST_OUTPUT: --- -fail_compilation/depmsg.d(40): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! -fail_compilation/depmsg.d(40): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! -fail_compilation/depmsg.d(41): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! -fail_compilation/depmsg.d(41): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! -fail_compilation/depmsg.d(42): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! -fail_compilation/depmsg.d(42): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! -fail_compilation/depmsg.d(43): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! -fail_compilation/depmsg.d(43): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! -fail_compilation/depmsg.d(44): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! -fail_compilation/depmsg.d(44): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! -fail_compilation/depmsg.d(46): Deprecation: alias `depmsg.main.Inner.G` is deprecated - With message! -fail_compilation/depmsg.d(47): Deprecation: variable `depmsg.main.Inner.H` is deprecated - With message! -fail_compilation/depmsg.d(48): Deprecation: class `depmsg.main.Inner.I()` is deprecated - With message! +fail_compilation/depmsg.d(53): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! +fail_compilation/depmsg.d(40): `A` is declared here +fail_compilation/depmsg.d(53): Deprecation: struct `depmsg.main.Inner.A` is deprecated - With message! +fail_compilation/depmsg.d(40): `A` is declared here +fail_compilation/depmsg.d(54): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! +fail_compilation/depmsg.d(41): `B` is declared here +fail_compilation/depmsg.d(54): Deprecation: class `depmsg.main.Inner.B` is deprecated - With message! +fail_compilation/depmsg.d(41): `B` is declared here +fail_compilation/depmsg.d(55): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! +fail_compilation/depmsg.d(42): `C` is declared here +fail_compilation/depmsg.d(55): Deprecation: interface `depmsg.main.Inner.C` is deprecated - With message! +fail_compilation/depmsg.d(42): `C` is declared here +fail_compilation/depmsg.d(56): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! +fail_compilation/depmsg.d(43): `D` is declared here +fail_compilation/depmsg.d(56): Deprecation: union `depmsg.main.Inner.D` is deprecated - With message! +fail_compilation/depmsg.d(43): `D` is declared here +fail_compilation/depmsg.d(57): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! +fail_compilation/depmsg.d(44): `E` is declared here +fail_compilation/depmsg.d(57): Deprecation: enum `depmsg.main.Inner.E` is deprecated - With message! +fail_compilation/depmsg.d(44): `E` is declared here +fail_compilation/depmsg.d(59): Deprecation: alias `depmsg.main.Inner.G` is deprecated - With message! +fail_compilation/depmsg.d(46): `G` is declared here +fail_compilation/depmsg.d(60): Deprecation: variable `depmsg.main.Inner.H` is deprecated - With message! +fail_compilation/depmsg.d(47): `H` is declared here +fail_compilation/depmsg.d(61): Deprecation: class `depmsg.main.Inner.I()` is deprecated - With message! +fail_compilation/depmsg.d(48): `I()` is declared here --- */ @@ -52,13 +65,20 @@ void main() /* TEST_OUTPUT: --- -fail_compilation/depmsg.d(94): Deprecation: function `depmsg.test12954.Foo.bar1` is deprecated - [C] Use Foo.bar42 instead -fail_compilation/depmsg.d(95): Deprecation: function `depmsg.test12954.Foo.bar2` is deprecated - [E] Use Foo.bar42 instead -fail_compilation/depmsg.d(96): Deprecation: function `depmsg.test12954.Foo.bar3` is deprecated - [S] Use Foo.bar42 instead -fail_compilation/depmsg.d(97): Deprecation: function `depmsg.test12954.Foo.bar4` is deprecated - [F] Use Foo.bar42 instead -fail_compilation/depmsg.d(98): Deprecation: variable `depmsg.test12954.Foo.v2` is deprecated - Forward reference -fail_compilation/depmsg.d(105): Deprecation: class `depmsg.test12954.Obsolete` is deprecated -fail_compilation/depmsg.d(105): Deprecation: function `depmsg.test12954.Obsolete.obs` is deprecated - Function is obsolete +fail_compilation/depmsg.d(114): Deprecation: function `depmsg.test12954.Foo.bar1` is deprecated - [C] Use Foo.bar42 instead +fail_compilation/depmsg.d(98): `bar1` is declared here +fail_compilation/depmsg.d(115): Deprecation: function `depmsg.test12954.Foo.bar2` is deprecated - [E] Use Foo.bar42 instead +fail_compilation/depmsg.d(101): `bar2` is declared here +fail_compilation/depmsg.d(116): Deprecation: function `depmsg.test12954.Foo.bar3` is deprecated - [S] Use Foo.bar42 instead +fail_compilation/depmsg.d(104): `bar3` is declared here +fail_compilation/depmsg.d(117): Deprecation: function `depmsg.test12954.Foo.bar4` is deprecated - [F] Use Foo.bar42 instead +fail_compilation/depmsg.d(107): `bar4` is declared here +fail_compilation/depmsg.d(118): Deprecation: variable `depmsg.test12954.Foo.v2` is deprecated - Forward reference +fail_compilation/depmsg.d(109): `v2` is declared here +fail_compilation/depmsg.d(125): Deprecation: class `depmsg.test12954.Obsolete` is deprecated +fail_compilation/depmsg.d(120): `Obsolete` is declared here +fail_compilation/depmsg.d(125): Deprecation: function `depmsg.test12954.Obsolete.obs` is deprecated - Function is obsolete +fail_compilation/depmsg.d(122): `obs` is declared here --- */ void test12954() diff --git a/tests/dmd/fail_compilation/depmsg15814.d b/tests/dmd/fail_compilation/depmsg15814.d index 613576c256f..19f49a24714 100644 --- a/tests/dmd/fail_compilation/depmsg15814.d +++ b/tests/dmd/fail_compilation/depmsg15814.d @@ -2,7 +2,8 @@ /* TEST_OUTPUT: --- -fail_compilation/depmsg15814.d(9): Deprecation: function `depmsg15814.get15814` is deprecated - bug15814 +fail_compilation/depmsg15814.d(10): Deprecation: function `depmsg15814.get15814` is deprecated - bug15814 +fail_compilation/depmsg15814.d(9): `get15814` is declared here --- */ deprecated("bug15814") int get15814() { return 0; } diff --git a/tests/dmd/fail_compilation/depmsg15815.d b/tests/dmd/fail_compilation/depmsg15815.d index 0b19687ad52..f98d4f255bb 100644 --- a/tests/dmd/fail_compilation/depmsg15815.d +++ b/tests/dmd/fail_compilation/depmsg15815.d @@ -2,7 +2,8 @@ /* TEST_OUTPUT: --- -fail_compilation/depmsg15815.d(23): Deprecation: template `depmsg15815.Alias(T)` is deprecated - message +fail_compilation/depmsg15815.d(24): Deprecation: template `depmsg15815.Alias(T)` is deprecated - message +fail_compilation/depmsg15815.d(18): `Alias(T)` is declared here Foo --- */ diff --git a/tests/dmd/fail_compilation/deprecatedImports.d b/tests/dmd/fail_compilation/deprecatedImports.d index bd68a9d4e3c..b50e2981f10 100644 --- a/tests/dmd/fail_compilation/deprecatedImports.d +++ b/tests/dmd/fail_compilation/deprecatedImports.d @@ -4,13 +4,20 @@ EXTRA_FILES: imports/deprecatedImporta.d imports/deprecatedImportb.d TEST_OUTPUT: ---- -fail_compilation/deprecatedImports.d(19): Deprecation: alias `deprecatedImporta.foo` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(21): Deprecation: alias `deprecatedImporta.bar` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(23): Deprecation: alias `deprecatedImporta.AliasSeq` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(27): Deprecation: alias `deprecatedImporta.S` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(29): Deprecation: alias `deprecatedImporta.C` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(31): Deprecation: alias `deprecatedImporta.I` is deprecated - Please import deprecatedImportb directly! -fail_compilation/deprecatedImports.d(25): Deprecation: alias `deprecatedImporta.E` is deprecated - Please import deprecatedImportb directly! +fail_compilation/deprecatedImports.d(26): Deprecation: alias `deprecatedImporta.foo` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `foo` is declared here +fail_compilation/deprecatedImports.d(28): Deprecation: alias `deprecatedImporta.bar` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `bar` is declared here +fail_compilation/deprecatedImports.d(30): Deprecation: alias `deprecatedImporta.AliasSeq` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `AliasSeq` is declared here +fail_compilation/deprecatedImports.d(34): Deprecation: alias `deprecatedImporta.S` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `S` is declared here +fail_compilation/deprecatedImports.d(36): Deprecation: alias `deprecatedImporta.C` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `C` is declared here +fail_compilation/deprecatedImports.d(38): Deprecation: alias `deprecatedImporta.I` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `I` is declared here +fail_compilation/deprecatedImports.d(32): Deprecation: alias `deprecatedImporta.E` is deprecated - Please import deprecatedImportb directly! +fail_compilation/imports/deprecatedImporta.d(2): `E` is declared here ---- */ diff --git a/tests/dmd/fail_compilation/deprecatedTemplates.d b/tests/dmd/fail_compilation/deprecatedTemplates.d index d9054798661..e735c9004f7 100644 --- a/tests/dmd/fail_compilation/deprecatedTemplates.d +++ b/tests/dmd/fail_compilation/deprecatedTemplates.d @@ -4,8 +4,11 @@ REQUIRED_ARGS: -de TEST_OUTPUT: ---- fail_compilation/deprecatedTemplates.d(103): Deprecation: template `deprecatedTemplates.AliasSeq(V...)` is deprecated +fail_compilation/deprecatedTemplates.d(101): `AliasSeq(V...)` is declared here fail_compilation/deprecatedTemplates.d(107): Deprecation: struct `deprecatedTemplates.S1(V...)` is deprecated +fail_compilation/deprecatedTemplates.d(105): `S1(V...)` is declared here fail_compilation/deprecatedTemplates.d(115): Deprecation: template `deprecatedTemplates.C(V...)` is deprecated +fail_compilation/deprecatedTemplates.d(109): `C(V...)` is declared here ---- */ #line 100 @@ -30,6 +33,7 @@ alias D = C!(); TEST_OUTPUT: ---- fail_compilation/deprecatedTemplates.d(202): Deprecation: template `deprecatedTemplates.AliasSeqMsg(V...)` is deprecated - Reason +fail_compilation/deprecatedTemplates.d(200): `AliasSeqMsg(V...)` is declared here ---- */ #line 200 diff --git a/tests/dmd/fail_compilation/deprecations.d b/tests/dmd/fail_compilation/deprecations.d index 19adab7e3ac..85ca0b83a40 100644 --- a/tests/dmd/fail_compilation/deprecations.d +++ b/tests/dmd/fail_compilation/deprecations.d @@ -2,12 +2,15 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/deprecations.d(43): Deprecation: struct `deprecations.S` is deprecated -fail_compilation/deprecations.d(64): instantiated from here: `otherPar!()` -fail_compilation/deprecations.d(55): Deprecation: struct `deprecations.S` is deprecated -fail_compilation/deprecations.d(65): instantiated from here: `otherVar!()` -fail_compilation/deprecations.d(55): Deprecation: struct `deprecations.S` is deprecated -fail_compilation/deprecations.d(65): instantiated from here: `otherVar!()` +fail_compilation/deprecations.d(46): Deprecation: struct `deprecations.S` is deprecated +fail_compilation/deprecations.d(19): `S` is declared here +fail_compilation/deprecations.d(67): instantiated from here: `otherPar!()` +fail_compilation/deprecations.d(58): Deprecation: struct `deprecations.S` is deprecated +fail_compilation/deprecations.d(19): `S` is declared here +fail_compilation/deprecations.d(68): instantiated from here: `otherVar!()` +fail_compilation/deprecations.d(58): Deprecation: struct `deprecations.S` is deprecated +fail_compilation/deprecations.d(19): `S` is declared here +fail_compilation/deprecations.d(68): instantiated from here: `otherVar!()` --- https://issues.dlang.org/show_bug.cgi?id=20474 diff --git a/tests/dmd/fail_compilation/diag14235.d b/tests/dmd/fail_compilation/diag14235.d index 8c563ba44c9..51ffa47a186 100644 --- a/tests/dmd/fail_compilation/diag14235.d +++ b/tests/dmd/fail_compilation/diag14235.d @@ -2,9 +2,10 @@ EXTRA_FILES: imports/a14235.d TEST_OUTPUT: --- -fail_compilation/diag14235.d(12): Error: undefined identifier `Undefined` in module `imports.a14235` -fail_compilation/diag14235.d(13): Error: undefined identifier `Something` in module `imports.a14235`, did you mean struct `SomeThing(T...)`? -fail_compilation/diag14235.d(14): Error: `SomeClass` isn't a template +fail_compilation/diag14235.d(13): Error: undefined identifier `Undefined` in module `imports.a14235` +fail_compilation/diag14235.d(14): Error: undefined identifier `Something` in module `imports.a14235`, did you mean struct `SomeThing(T...)`? +fail_compilation/imports/a14235.d(3): `imports.a14235.SomeThing(T...)` located here +fail_compilation/diag14235.d(15): Error: `SomeClass` isn't a template --- */ diff --git a/tests/dmd/fail_compilation/diag14875.d b/tests/dmd/fail_compilation/diag14875.d index a4d4abe9e19..b6ef8c77e4e 100644 --- a/tests/dmd/fail_compilation/diag14875.d +++ b/tests/dmd/fail_compilation/diag14875.d @@ -6,7 +6,8 @@ deprecated immutable int depVar = 10; /* TEST_OUTPUT: --- -fail_compilation/diag14875.d(16): Deprecation: class `diag14875.Dep` is deprecated +fail_compilation/diag14875.d(17): Deprecation: class `diag14875.Dep` is deprecated +fail_compilation/diag14875.d(3): `Dep` is declared here 1: Dep 2: Dep 3: Dep @@ -36,16 +37,20 @@ template Baz(T) /* TEST_OUTPUT: --- -fail_compilation/diag14875.d(52): Deprecation: class `diag14875.Dep` is deprecated -fail_compilation/diag14875.d(56): Deprecation: variable `diag14875.depVar` is deprecated -fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` +fail_compilation/diag14875.d(57): Deprecation: class `diag14875.Dep` is deprecated +fail_compilation/diag14875.d(3): `Dep` is declared here +fail_compilation/diag14875.d(61): Deprecation: variable `diag14875.depVar` is deprecated +fail_compilation/diag14875.d(4): `depVar` is declared here +fail_compilation/diag14875.d(57): instantiated from here: `Voo!(Dep)` 4: Dep -fail_compilation/diag14875.d(63): Deprecation: variable `diag14875.depVar` is deprecated -fail_compilation/diag14875.d(59): instantiated from here: `Var!(Dep)` -fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` -fail_compilation/diag14875.d(64): Deprecation: template `diag14875.Vaz(T)` is deprecated -fail_compilation/diag14875.d(59): instantiated from here: `Var!(Dep)` -fail_compilation/diag14875.d(52): instantiated from here: `Voo!(Dep)` +fail_compilation/diag14875.d(68): Deprecation: variable `diag14875.depVar` is deprecated +fail_compilation/diag14875.d(4): `depVar` is declared here +fail_compilation/diag14875.d(64): instantiated from here: `Var!(Dep)` +fail_compilation/diag14875.d(57): instantiated from here: `Voo!(Dep)` +fail_compilation/diag14875.d(69): Deprecation: template `diag14875.Vaz(T)` is deprecated +fail_compilation/diag14875.d(71): `Vaz(T)` is declared here +fail_compilation/diag14875.d(64): instantiated from here: `Var!(Dep)` +fail_compilation/diag14875.d(57): instantiated from here: `Voo!(Dep)` --- */ @@ -72,7 +77,7 @@ deprecated template Vaz(T) /* TEST_OUTPUT: --- -fail_compilation/diag14875.d(80): Error: static assert: `0` is false +fail_compilation/diag14875.d(85): Error: static assert: `0` is false --- */ void main() diff --git a/tests/dmd/fail_compilation/diag14876.d b/tests/dmd/fail_compilation/diag14876.d index 4beea959001..9579467eaf7 100644 --- a/tests/dmd/fail_compilation/diag14876.d +++ b/tests/dmd/fail_compilation/diag14876.d @@ -1,14 +1,21 @@ /* TEST_OUTPUT: --- -fail_compilation/diag14876.d(17): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(18): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(19): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(20): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(21): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(22): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(23): Deprecation: class `diag14876.Dep` is deprecated -fail_compilation/diag14876.d(23): Error: can only slice type sequences, not `diag14876.Dep` +fail_compilation/diag14876.d(24): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(25): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(26): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(27): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(28): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(29): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(30): Deprecation: class `diag14876.Dep` is deprecated +fail_compilation/diag14876.d(22): `Dep` is declared here +fail_compilation/diag14876.d(30): Error: can only slice type sequences, not `diag14876.Dep` --- */ diff --git a/tests/dmd/fail_compilation/diag16499.d b/tests/dmd/fail_compilation/diag16499.d index f3757954d4a..34de73523b0 100644 --- a/tests/dmd/fail_compilation/diag16499.d +++ b/tests/dmd/fail_compilation/diag16499.d @@ -2,9 +2,9 @@ TEST_OUTPUT: --- fail_compilation/diag16499.d(24): Error: operator `in` is not defined for type `A` -fail_compilation/diag16499.d(11): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int rhs) {}` +fail_compilation/diag16499.d(11): perhaps overload the operator with `auto opBinaryRight(string op : "in")(int lhs) {}` fail_compilation/diag16499.d(26): Error: operator `in` is not defined for type `B` -fail_compilation/diag16499.d(12): perhaps overload the operator with `auto opBinaryRight(string op : "in")(double rhs) {}` +fail_compilation/diag16499.d(12): perhaps overload the operator with `auto opBinaryRight(string op : "in")(double lhs) {}` --- */ diff --git a/tests/dmd/fail_compilation/diag21167.d b/tests/dmd/fail_compilation/diag21167.d new file mode 100644 index 00000000000..f400a194e8c --- /dev/null +++ b/tests/dmd/fail_compilation/diag21167.d @@ -0,0 +1,21 @@ +/* +TEST_OUTPUT: +--- +fail_compilation\diag21167.d(15): Error: function `f` is not callable using argument types `(int, string, int)` +fail_compilation\diag21167.d(17): cannot pass argument `"foo"` of type `string` to parameter `int __param_1` +fail_compilation\diag21167.d(11): `diag21167.f(int __param_0, int __param_1, int __param_2)` declared here +--- +*/ +// https://github.com/dlang/dmd/issues/21167 + +void f(int, int, int){} + +void main() +{ + f( + 1, + "foo", + 3 + ); + +} diff --git a/tests/dmd/fail_compilation/diag21381.d b/tests/dmd/fail_compilation/diag21381.d new file mode 100644 index 00000000000..1a36ec584a5 --- /dev/null +++ b/tests/dmd/fail_compilation/diag21381.d @@ -0,0 +1,15 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/diag21381.d(15): Error: undefined identifier `xyx`, did you mean struct `xyz`? +--- +*/ +// https://github.com/dlang/dmd/issues/21381 + +enum plusOne(int x) = x + 1; +struct xyz{} + +alias PlusOne = + plusOne + ! + xyx; diff --git a/tests/dmd/fail_compilation/diag21413.d b/tests/dmd/fail_compilation/diag21413.d new file mode 100644 index 00000000000..9f7c8e9e0ff --- /dev/null +++ b/tests/dmd/fail_compilation/diag21413.d @@ -0,0 +1,15 @@ +/* +TEST_OUTPUT: +--- +fail_compilation\diag21413.d(13): Error: undefined identifier `Potato` +--- +*/ +// https://github.com/dlang/dmd/issues/21413 + +void main() +{ + throw + new + Potato + (); +} diff --git a/tests/dmd/fail_compilation/diag23295.d b/tests/dmd/fail_compilation/diag23295.d index 4f996b6dae2..f40da8a7818 100644 --- a/tests/dmd/fail_compilation/diag23295.d +++ b/tests/dmd/fail_compilation/diag23295.d @@ -3,10 +3,10 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- fail_compilation/diag23295.d(21): Error: assigning scope variable `x` to non-scope parameter `y` calling `foo` is not allowed in a `@safe` function -fail_compilation/diag23295.d(32): which is assigned to non-scope parameter `z` -fail_compilation/diag23295.d(34): which is not `scope` because of `f = & z` +fail_compilation/diag23295.d(32): `y` is assigned to non-scope parameter `z` +fail_compilation/diag23295.d(34): `z` is not `scope` because of `f = & z` fail_compilation/diag23295.d(24): Error: assigning scope variable `ex` to non-scope parameter `e` calling `thro` is not allowed in a `@safe` function -fail_compilation/diag23295.d(39): which is not `scope` because of `throw e` +fail_compilation/diag23295.d(39): `e` is not `scope` because of `throw e` --- */ diff --git a/tests/dmd/fail_compilation/diag9191.d b/tests/dmd/fail_compilation/diag9191.d index 889d1fada2b..7bb129d5949 100644 --- a/tests/dmd/fail_compilation/diag9191.d +++ b/tests/dmd/fail_compilation/diag9191.d @@ -1,10 +1,13 @@ /* TEST_OUTPUT: --- -fail_compilation/diag9191.d(16): Error: function `void diag9191.C1.aaa()` does not override any function, did you mean to override `void diag9191.B1.aa()`? -fail_compilation/diag9191.d(22): Error: function `diag9191.C2.aaa` does not override any function -fail_compilation/diag9191.d(33): Error: function `void diag9191.C3.foo()` does not override any function, did you mean to override `void diag9191.B2._foo()`? -fail_compilation/diag9191.d(38): Error: function `void diag9191.C4.toStringa()` does not override any function, did you mean to override `string object.Object.toString()`? +fail_compilation/diag9191.d(19): Error: function `void diag9191.C1.aaa()` does not override any function +fail_compilation/diag9191.d(15): did you mean to override `void diag9191.B1.aa()`? +fail_compilation/diag9191.d(25): Error: function `diag9191.C2.aaa` does not override any function +fail_compilation/diag9191.d(36): Error: function `void diag9191.C3.foo()` does not override any function +fail_compilation/diag9191.d(31): did you mean to override `void diag9191.B2._foo()`? +fail_compilation/diag9191.d(41): Error: function `void diag9191.C4.toStringa()` does not override any function +$p:/object.d$($n$): did you mean to override `string object.Object.toString()`? --- */ diff --git a/tests/dmd/fail_compilation/edition_switch.d b/tests/dmd/fail_compilation/edition_switch.d new file mode 100644 index 00000000000..48695f620ba --- /dev/null +++ b/tests/dmd/fail_compilation/edition_switch.d @@ -0,0 +1,10 @@ +/* +REQUIRED_ARGS: -edition=2024 +TEST_OUTPUT: +--- +fail_compilation/edition_switch.d(10): Error: usage of identifer `body` as a keyword is obsolete. Use `do` instead. +--- +*/ + +void test() +in { } body { } diff --git a/tests/dmd/fail_compilation/fail18093.d b/tests/dmd/fail_compilation/fail18093.d index 4eb3663afc6..ea14c442910 100644 --- a/tests/dmd/fail_compilation/fail18093.d +++ b/tests/dmd/fail_compilation/fail18093.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/fail18093.d(19): Error: function `void fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen).visit()` does not override any function, did you mean to override `extern (C++) void fail18093.ParseTimeVisitor!(ASTCodegen).ParseTimeVisitor.visit()`? -fail_compilation/fail18093.d(24): Error: mixin `fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen)` error instantiating -fail_compilation/fail18093.d(27): Error: template instance `fail18093.GenericTransitiveVisitor!(ASTCodegen)` error instantiating +fail_compilation/fail18093.d(20): Error: function `void fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen).visit()` does not override any function +fail_compilation/fail18093.d(16): did you mean to override `extern (C++) void fail18093.ParseTimeVisitor!(ASTCodegen).ParseTimeVisitor.visit()`? +fail_compilation/fail18093.d(25): Error: mixin `fail18093.GenericTransitiveVisitor!(ASTCodegen).GenericTransitiveVisitor.ParseVisitMethods!(ASTCodegen)` error instantiating +fail_compilation/fail18093.d(28): Error: template instance `fail18093.GenericTransitiveVisitor!(ASTCodegen)` error instantiating --- * https://issues.dlang.org/show_bug.cgi?id=18093 */ diff --git a/tests/dmd/fail_compilation/fail19202.d b/tests/dmd/fail_compilation/fail19202.d index f19bc181f41..a5b773fc065 100644 --- a/tests/dmd/fail_compilation/fail19202.d +++ b/tests/dmd/fail_compilation/fail19202.d @@ -2,7 +2,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail19202.d(11): Deprecation: variable `fail19202.X!().X` is deprecated +fail_compilation/fail19202.d(12): Deprecation: variable `fail19202.X!().X` is deprecated +fail_compilation/fail19202.d(17): `X` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail199.d b/tests/dmd/fail_compilation/fail199.d index 9cb14b801c9..ab57b3401d0 100644 --- a/tests/dmd/fail_compilation/fail199.d +++ b/tests/dmd/fail_compilation/fail199.d @@ -2,8 +2,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail199.d(20): Deprecation: class `fail199.DepClass` is deprecated -fail_compilation/fail199.d(20): Deprecation: class `fail199.DepClass` is deprecated +fail_compilation/fail199.d(22): Deprecation: class `fail199.DepClass` is deprecated +fail_compilation/fail199.d(14): `DepClass` is declared here +fail_compilation/fail199.d(22): Deprecation: class `fail199.DepClass` is deprecated +fail_compilation/fail199.d(14): `DepClass` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail200.d b/tests/dmd/fail_compilation/fail200.d index 9d804a916b3..07ea04371f9 100644 --- a/tests/dmd/fail_compilation/fail200.d +++ b/tests/dmd/fail_compilation/fail200.d @@ -2,8 +2,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail200.d(17): Deprecation: interface `fail200.DepClass` is deprecated -fail_compilation/fail200.d(17): Deprecation: interface `fail200.DepClass` is deprecated +fail_compilation/fail200.d(19): Deprecation: interface `fail200.DepClass` is deprecated +fail_compilation/fail200.d(14): `DepClass` is declared here +fail_compilation/fail200.d(19): Deprecation: interface `fail200.DepClass` is deprecated +fail_compilation/fail200.d(14): `DepClass` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail20779.d b/tests/dmd/fail_compilation/fail20779.d index 945803d53f1..7b3b07af1ee 100644 --- a/tests/dmd/fail_compilation/fail20779.d +++ b/tests/dmd/fail_compilation/fail20779.d @@ -3,7 +3,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail20779.d(12): Error: struct `fail20779.X` cannot have field `x` with same struct type +fail_compilation/fail20779.d(14): Error: struct `fail20779.X` cannot have field `x` with same struct type --- */ diff --git a/tests/dmd/fail_compilation/fail21830.d b/tests/dmd/fail_compilation/fail21830.d index 2e0f84b7777..dda0140aad4 100644 --- a/tests/dmd/fail_compilation/fail21830.d +++ b/tests/dmd/fail_compilation/fail21830.d @@ -2,8 +2,11 @@ TEST_OUTPUT: --- fail_compilation/fail21830.d(24): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type +fail_compilation/fail21830.d(2): `OldS21830` is declared here fail_compilation/fail21830.d(24): Deprecation: template `fail21830.test21830(T)(T t) if (is(T == OldS21830))` is deprecated - Deprecated template +fail_compilation/fail21830.d(16): `test21830(T)(T t) if (is(T == OldS21830))` is declared here fail_compilation/fail21830.d(24): Deprecation: struct `fail21830.OldS21830` is deprecated - Deprecated type +fail_compilation/fail21830.d(2): `OldS21830` is declared here --- */ #line 1 diff --git a/tests/dmd/fail_compilation/fail21831.d b/tests/dmd/fail_compilation/fail21831.d index 39551332e93..642c6d3f49f 100644 --- a/tests/dmd/fail_compilation/fail21831.d +++ b/tests/dmd/fail_compilation/fail21831.d @@ -2,8 +2,11 @@ TEST_OUTPUT: --- fail_compilation/fail21831.d(19): Deprecation: struct `fail21831.S21831` is deprecated - Deprecated type +fail_compilation/fail21831.d(2): `S21831` is declared here fail_compilation/fail21831.d(19): Deprecation: template `fail21831.test21831(T)(T t) if (__traits(isDeprecated, T))` is deprecated - Deprecated template +fail_compilation/fail21831.d(11): `test21831(T)(T t) if (__traits(isDeprecated, T))` is declared here fail_compilation/fail21831.d(19): Deprecation: struct `fail21831.S21831` is deprecated - Deprecated type +fail_compilation/fail21831.d(2): `S21831` is declared here --- */ #line 1 diff --git a/tests/dmd/fail_compilation/fail21832.d b/tests/dmd/fail_compilation/fail21832.d index 98f3df71a15..690dbdae8de 100644 --- a/tests/dmd/fail_compilation/fail21832.d +++ b/tests/dmd/fail_compilation/fail21832.d @@ -4,7 +4,9 @@ TEST_OUTPUT: --- fail_compilation/fail21832.d(4): Deprecation: function `imports.imp21832.fun` is deprecated +fail_compilation/imports/imp21832.d(16): `fun` is declared here fail_compilation/fail21832.d(10): Deprecation: template `imports.imp21832.tpl()(char a)` is deprecated +fail_compilation/imports/imp21832.d(20): `tpl()(char a)` is declared here --- */ #line 1 diff --git a/tests/dmd/fail_compilation/fail222.d b/tests/dmd/fail_compilation/fail222.d index e196b253065..e1df9d846d8 100644 --- a/tests/dmd/fail_compilation/fail222.d +++ b/tests/dmd/fail_compilation/fail222.d @@ -2,7 +2,7 @@ TEST_OUTPUT: --- fail_compilation/fail222.d(11): Error: template `fail222.getMixin(TArg..., int i = 0)()` template sequence parameter must be the last one -fail_compilation/fail222.d(18): Error: template instance `getMixin!()` does not match template declaration `getMixin(TArg..., int i = 0)()` +fail_compilation/fail222.d(18): Error: template instance `getMixin!()` does not match template declaration `getMixin(TArg..., int i = 0)` fail_compilation/fail222.d(21): Error: template instance `fail222.Thing!()` error instantiating fail_compilation/fail222.d(23): Error: template `fail222.fooBar(A..., B...)()` template sequence parameter must be the last one --- diff --git a/tests/dmd/fail_compilation/fail22351.d b/tests/dmd/fail_compilation/fail22351.d index 405ab557d75..44242a83386 100644 --- a/tests/dmd/fail_compilation/fail22351.d +++ b/tests/dmd/fail_compilation/fail22351.d @@ -2,9 +2,10 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/fail22351.d(18): Deprecation: overriding `extern(C++)` function `fail22351.C22351.func(int*)` with `const` qualified function `fail22351.Fail22351.func(const(int*))` is deprecated -fail_compilation/fail22351.d(18): Either remove `override`, or adjust the `const` qualifiers of the overriding function parameters -fail_compilation/fail22351.d(19): Error: function `extern (C++) void fail22351.Fail22351.func(const(int*)**)` does not override any function, did you mean to override `extern (C++) void fail22351.C22351.func(int*)`? +fail_compilation/fail22351.d(19): Deprecation: overriding `extern(C++)` function `fail22351.C22351.func(int*)` with `const` qualified function `fail22351.Fail22351.func(const(int*))` is deprecated +fail_compilation/fail22351.d(19): Either remove `override`, or adjust the `const` qualifiers of the overriding function parameters +fail_compilation/fail22351.d(20): Error: function `extern (C++) void fail22351.Fail22351.func(const(int*)**)` does not override any function +fail_compilation/fail22351.d(13): did you mean to override `extern (C++) void fail22351.C22351.func(int*)`? --- */ extern(C++) class C22351 diff --git a/tests/dmd/fail_compilation/fail22384.d b/tests/dmd/fail_compilation/fail22384.d new file mode 100644 index 00000000000..71881f41930 --- /dev/null +++ b/tests/dmd/fail_compilation/fail22384.d @@ -0,0 +1,51 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/fail22384.d(36): Error: bitfield `z` cannot have zero width +fail_compilation/fail22384.d(40): Error: bitfield `f` cannot be of non-integral type `float` +fail_compilation/fail22384.d(41): Error: bitfield `f2` cannot be of non-integral type `float` +fail_compilation/fail22384.d(42): Error: bitfield `f3` cannot be of non-integral type `float` +fail_compilation/fail22384.d(43): Error: bitfield `f4` cannot be of non-integral type `float` +fail_compilation/fail22384.d(48): Error: anonymous bitfield cannot have default initializer +fail_compilation/fail22384.d(25): Error: default initializer `4294967295u` is not representable as bitfield type `uint:4` +fail_compilation/fail22384.d(25): bitfield `d` default initializer must be a value between `0..15` +fail_compilation/fail22384.d(30): Error: default initializer `E.B` is not representable as bitfield type `int:2` +fail_compilation/fail22384.d(30): bitfield `b` default initializer must be a value between `-2..1` +fail_compilation/fail22384.d(34): Error: default initializer `4` is not representable as bitfield type `int:3` +fail_compilation/fail22384.d(34): bitfield `x` default initializer must be a value between `-4..3` +fail_compilation/fail22384.d(35): Error: default initializer `65` is not representable as bitfield type `int:7` +fail_compilation/fail22384.d(35): bitfield `y` default initializer must be a value between `-64..63` +fail_compilation/fail22384.d(47): Error: cannot implicitly convert expression `4.2F` of type `float` to `int` +fail_compilation/fail22384.d(49): Error: default initializer `65` is not representable as bitfield type `int:7` +fail_compilation/fail22384.d(49): bitfield `j` default initializer must be a value between `-64..63` +fail_compilation/fail22384.d(50): Error: cannot implicitly convert expression `42` of type `int` to `bool` +--- +*/ +struct S { + uint d : 4 = -1; +} + +enum E : int { A = 1, B = 2 } +struct EFail { + E b : 2 = E.B; +} + +struct IFail { + int x : 3 = 4; + int y : 7 = 65; + int z : 0 = 1; +} + +struct FloatFail { + float f : 0; + float f2 : 7; + float f3 : 7 = 4; + float f4 : 7 = 4.2f; +} + +struct InitFail { + int i : 7 = 4.2f; + ubyte : 8 = 4.2f; + int j : 7 = 'A'; + bool b : 7 = 42; +} diff --git a/tests/dmd/fail_compilation/fail23822.d b/tests/dmd/fail_compilation/fail23822.d index 5cdd1fe0503..57e6bc035aa 100644 --- a/tests/dmd/fail_compilation/fail23822.d +++ b/tests/dmd/fail_compilation/fail23822.d @@ -5,7 +5,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail23822.d(21): Deprecation: alias `fail23822.S.value` is deprecated +fail_compilation/fail23822.d(22): Deprecation: alias `fail23822.S.value` is deprecated +fail_compilation/fail23822.d(17): `value` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail23826.d b/tests/dmd/fail_compilation/fail23826.d index 3db243a3ce8..d66f941fdcb 100644 --- a/tests/dmd/fail_compilation/fail23826.d +++ b/tests/dmd/fail_compilation/fail23826.d @@ -5,7 +5,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail23826.d(23): Deprecation: alias `fail23826.S.value` is deprecated +fail_compilation/fail23826.d(24): Deprecation: alias `fail23826.S.value` is deprecated +fail_compilation/fail23826.d(17): `value` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail24208.d b/tests/dmd/fail_compilation/fail24208.d index c39676a2858..a196d710f18 100644 --- a/tests/dmd/fail_compilation/fail24208.d +++ b/tests/dmd/fail_compilation/fail24208.d @@ -3,7 +3,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- fail_compilation/fail24208.d(19): Error: assigning reference to local variable `n` to non-scope parameter `p` calling `escape` is not allowed in a `@safe` function -fail_compilation/fail24208.d(15): which is not `scope` because of `escaped = p` +fail_compilation/fail24208.d(15): `p` is not `scope` because of `escaped = p` --- +/ void test() @safe diff --git a/tests/dmd/fail_compilation/fail243.d b/tests/dmd/fail_compilation/fail243.d index d9852ffc471..46cfa52ee42 100644 --- a/tests/dmd/fail_compilation/fail243.d +++ b/tests/dmd/fail_compilation/fail243.d @@ -2,11 +2,16 @@ /* TEST_OUTPUT: --- -fail_compilation/fail243.d(23): Deprecation: class `fail243.DepClass` is deprecated -fail_compilation/fail243.d(24): Deprecation: struct `fail243.DepStruct` is deprecated -fail_compilation/fail243.d(25): Deprecation: union `fail243.DepUnion` is deprecated -fail_compilation/fail243.d(26): Deprecation: enum `fail243.DepEnum` is deprecated -fail_compilation/fail243.d(27): Deprecation: alias `fail243.DepAlias` is deprecated +fail_compilation/fail243.d(28): Deprecation: class `fail243.DepClass` is deprecated +fail_compilation/fail243.d(20): `DepClass` is declared here +fail_compilation/fail243.d(29): Deprecation: struct `fail243.DepStruct` is deprecated +fail_compilation/fail243.d(21): `DepStruct` is declared here +fail_compilation/fail243.d(30): Deprecation: union `fail243.DepUnion` is deprecated +fail_compilation/fail243.d(22): `DepUnion` is declared here +fail_compilation/fail243.d(31): Deprecation: enum `fail243.DepEnum` is deprecated +fail_compilation/fail243.d(23): `DepEnum` is declared here +fail_compilation/fail243.d(32): Deprecation: alias `fail243.DepAlias` is deprecated +fail_compilation/fail243.d(24): `DepAlias` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail244.d b/tests/dmd/fail_compilation/fail244.d index 757eb2bdbb1..a9bb36549f5 100644 --- a/tests/dmd/fail_compilation/fail244.d +++ b/tests/dmd/fail_compilation/fail244.d @@ -2,16 +2,26 @@ /* TEST_OUTPUT: --- -fail_compilation/fail244.d(27): Deprecation: variable `fail244.StructWithDeps.value` is deprecated -fail_compilation/fail244.d(28): Deprecation: variable `fail244.StructWithDeps.value` is deprecated -fail_compilation/fail244.d(29): Deprecation: variable `fail244.StructWithDeps.value` is deprecated -fail_compilation/fail244.d(30): Deprecation: variable `fail244.StructWithDeps.value` is deprecated -fail_compilation/fail244.d(32): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated -fail_compilation/fail244.d(33): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated -fail_compilation/fail244.d(34): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated -fail_compilation/fail244.d(35): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated -fail_compilation/fail244.d(36): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated -fail_compilation/fail244.d(37): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(37): Deprecation: variable `fail244.StructWithDeps.value` is deprecated +fail_compilation/fail244.d(32): `value` is declared here +fail_compilation/fail244.d(38): Deprecation: variable `fail244.StructWithDeps.value` is deprecated +fail_compilation/fail244.d(32): `value` is declared here +fail_compilation/fail244.d(39): Deprecation: variable `fail244.StructWithDeps.value` is deprecated +fail_compilation/fail244.d(32): `value` is declared here +fail_compilation/fail244.d(40): Deprecation: variable `fail244.StructWithDeps.value` is deprecated +fail_compilation/fail244.d(32): `value` is declared here +fail_compilation/fail244.d(42): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here +fail_compilation/fail244.d(43): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here +fail_compilation/fail244.d(44): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here +fail_compilation/fail244.d(45): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here +fail_compilation/fail244.d(46): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here +fail_compilation/fail244.d(47): Deprecation: variable `fail244.StructWithDeps.staticValue` is deprecated +fail_compilation/fail244.d(33): `staticValue` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail245.d b/tests/dmd/fail_compilation/fail245.d index 927f9413205..90b6f7c47fb 100644 --- a/tests/dmd/fail_compilation/fail245.d +++ b/tests/dmd/fail_compilation/fail245.d @@ -2,16 +2,26 @@ /* TEST_OUTPUT: --- -fail_compilation/fail245.d(27): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated -fail_compilation/fail245.d(28): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated -fail_compilation/fail245.d(29): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated -fail_compilation/fail245.d(30): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated -fail_compilation/fail245.d(32): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated -fail_compilation/fail245.d(33): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated -fail_compilation/fail245.d(34): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated -fail_compilation/fail245.d(35): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated -fail_compilation/fail245.d(36): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated -fail_compilation/fail245.d(37): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(37): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated +fail_compilation/fail245.d(32): `value` is declared here +fail_compilation/fail245.d(38): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated +fail_compilation/fail245.d(32): `value` is declared here +fail_compilation/fail245.d(39): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated +fail_compilation/fail245.d(32): `value` is declared here +fail_compilation/fail245.d(40): Deprecation: variable `fail245.ClassWithDeps.value` is deprecated +fail_compilation/fail245.d(32): `value` is declared here +fail_compilation/fail245.d(42): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here +fail_compilation/fail245.d(43): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here +fail_compilation/fail245.d(44): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here +fail_compilation/fail245.d(45): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here +fail_compilation/fail245.d(46): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here +fail_compilation/fail245.d(47): Deprecation: variable `fail245.ClassWithDeps.staticValue` is deprecated +fail_compilation/fail245.d(33): `staticValue` is declared here --- */ diff --git a/tests/dmd/fail_compilation/fail262.d b/tests/dmd/fail_compilation/fail262.d index 7c92c7c1826..7a7355931bb 100644 --- a/tests/dmd/fail_compilation/fail262.d +++ b/tests/dmd/fail_compilation/fail262.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail262.d(23): Error: function `const void fail262.B.f()` does not override any function, did you mean to override `shared const void fail262.A.f()`? +fail_compilation/fail262.d(24): Error: function `const void fail262.B.f()` does not override any function +fail_compilation/fail262.d(16): did you mean to override `shared const void fail262.A.f()`? --- */ diff --git a/tests/dmd/fail_compilation/fail4206.d b/tests/dmd/fail_compilation/fail4206.d index b9c1671d781..4db260bc89c 100644 --- a/tests/dmd/fail_compilation/fail4206.d +++ b/tests/dmd/fail_compilation/fail4206.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail4206.d(9): Error: initializer must be an expression, not `s` +fail_compilation/fail4206.d(10): Error: initializer must be an expression, not `s` +fail_compilation/fail4206.d(10): perhaps use `s()` to construct a value of the type --- */ diff --git a/tests/dmd/fail_compilation/fail4544.d b/tests/dmd/fail_compilation/fail4544.d index 1cb0292cc8c..4a99565a47e 100644 --- a/tests/dmd/fail_compilation/fail4544.d +++ b/tests/dmd/fail_compilation/fail4544.d @@ -1,11 +1,11 @@ /* TEST_OUTPUT: --- -fail_compilation/fail4544.d(15): Error: character constant has multiple characters +fail_compilation/fail4544.d(15): Error: character constant has multiple characters - did you mean "asd"? fail_compilation/fail4544.d(16): Error: `0x` isn't a valid integer literal, use `0x0` instead fail_compilation/fail4544.d(16): Error: variable name expected after type `int`, not `0` fail_compilation/fail4544.d(17): Error: unterminated character constant -fail_compilation/fail4544.d(18): Error: character constant has multiple characters +fail_compilation/fail4544.d(18): Error: character constant has multiple characters - did you mean "asdasdsa"? --- */ diff --git a/tests/dmd/fail_compilation/fail50.d b/tests/dmd/fail_compilation/fail50.d index c6aa178bdaa..ebdac471c3e 100644 --- a/tests/dmd/fail_compilation/fail50.d +++ b/tests/dmd/fail_compilation/fail50.d @@ -2,10 +2,10 @@ TEST_OUTPUT: --- fail_compilation/fail50.d(12): Error: taking the address of non-static variable `a` requires an instance of `Marko` -fail_compilation/fail50.d(12): Error: variable `a` cannot be read at compile time --- */ + struct Marko { int a; diff --git a/tests/dmd/fail_compilation/fail6497.d b/tests/dmd/fail_compilation/fail6497.d index 0fd1ff2f4ee..60499f9df84 100644 --- a/tests/dmd/fail_compilation/fail6497.d +++ b/tests/dmd/fail_compilation/fail6497.d @@ -1,9 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/fail6497.d(13): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function -fail_compilation/fail6497.d(13): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function -fail_compilation/fail6497.d(19): Error: taking the address of local variable `i` is not allowed in a `@safe` function +fail_compilation/fail6497.d(14): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function +fail_compilation/fail6497.d(14): Error: taking the address of stack-allocated local variable `n` is not allowed in a `@safe` function +fail_compilation/fail6497.d(20): Error: taking the address of local variable `i` is not allowed in a `@safe` function +fail_compilation/fail6497.d(28): Error: taking the address of local variable `i` is not allowed in a `@safe` function --- */ @@ -18,3 +19,12 @@ void f() @safe ref i = *new int; auto b = &i; } + +const(int)* ptr; + +int g() @safe +out (i) +{ + ptr = &i; +} +do { return 0; } diff --git a/tests/dmd/fail_compilation/fail8262.d b/tests/dmd/fail_compilation/fail8262.d index 2df1bca4fe3..aeb5ad226d0 100644 --- a/tests/dmd/fail_compilation/fail8262.d +++ b/tests/dmd/fail_compilation/fail8262.d @@ -1,8 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8262.d(32): Error: initializer must be an expression, not `Tuple8262!1` -fail_compilation/fail8262.d(27): Error: template instance `fail8262.T8262!(Tuple8262!1)` error instantiating -fail_compilation/fail8262.d(19): Error: cannot implicitly convert expression `S(0)` of type `S` to `int` +fail_compilation/fail8262.d(33): Error: initializer must be an expression, not `Tuple8262!1` +fail_compilation/fail8262.d(33): perhaps use `Tuple8262!1()` to construct a value of the type +fail_compilation/fail8262.d(28): Error: template instance `fail8262.T8262!(Tuple8262!1)` error instantiating +fail_compilation/fail8262.d(20): Error: cannot implicitly convert expression `S(0)` of type `S` to `int` --- * https://issues.dlang.org/show_bug.cgi?id=8262 */ diff --git a/tests/dmd/fail_compilation/fail8631.d b/tests/dmd/fail_compilation/fail8631.d index 4f5b0763d48..175553fdc6c 100644 --- a/tests/dmd/fail_compilation/fail8631.d +++ b/tests/dmd/fail_compilation/fail8631.d @@ -1,7 +1,8 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8631.d(14): Error: function `shared const int fail8631.D.foo()` does not override any function, did you mean to override `immutable int fail8631.B.foo()`? +fail_compilation/fail8631.d(15): Error: function `shared const int fail8631.D.foo()` does not override any function +fail_compilation/fail8631.d(10): did you mean to override `immutable int fail8631.B.foo()`? --- */ diff --git a/tests/dmd/fail_compilation/fail8691.d b/tests/dmd/fail_compilation/fail8691.d index 8e46023d3bd..043039911ff 100644 --- a/tests/dmd/fail_compilation/fail8691.d +++ b/tests/dmd/fail_compilation/fail8691.d @@ -1,7 +1,7 @@ /* TEST_OUTPUT: --- -fail_compilation/fail8691.d(7): Error: struct `fail8691.Foo` cannot have field `f` with static array of same struct type +fail_compilation/fail8691.d(9): Error: struct `fail8691.Foo` cannot have field `f` with static array of same struct type --- */ struct Foo diff --git a/tests/dmd/fail_compilation/fail_pretty_errors.d b/tests/dmd/fail_compilation/fail_pretty_errors.d index ebd36a7cc1d..8c31433253d 100644 --- a/tests/dmd/fail_compilation/fail_pretty_errors.d +++ b/tests/dmd/fail_compilation/fail_pretty_errors.d @@ -2,23 +2,25 @@ REQUIRED_ARGS: -verrors=context TEST_OUTPUT: --- -fail_compilation/fail_pretty_errors.d(29): Error: undefined identifier `a` +fail_compilation/fail_pretty_errors.d(31): Error: undefined identifier `a` a = 1; ^ -fail_compilation/fail_pretty_errors.d-mixin-34(34): Error: undefined identifier `b` +fail_compilation/fail_pretty_errors.d-mixin-36(36): Error: undefined identifier `b` b = 1; ^ -fail_compilation/fail_pretty_errors.d(39): Error: cannot implicitly convert expression `5` of type `int` to `string` +fail_compilation/fail_pretty_errors.d(41): Error: cannot implicitly convert expression `5` of type `int` to `string` string x = 5; ^ -fail_compilation/fail_pretty_errors.d(44): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating +fail_compilation/fail_pretty_errors.d(46): Error: mixin `fail_pretty_errors.testMixin2.mixinTemplate!()` error instantiating mixin mixinTemplate; ^ -fail_compilation/fail_pretty_errors.d(50): Error: invalid array operation `"" + ""` (possible missing []) +fail_compilation/fail_pretty_errors.d(52): Error: invalid array operation `"" + ""` (possible missing []) auto x = ""+""; ^ -fail_compilation/fail_pretty_errors.d(50): did you mean to concatenate (`"" ~ ""`) instead ? -fail_compilation/fail_pretty_errors.d(53): Error: cannot implicitly convert expression `1111` of type `int` to `byte` +fail_compilation/fail_pretty_errors.d(52): did you mean to concatenate (`"" ~ ""`) instead ? + auto x = ""+""; + ^ +fail_compilation/fail_pretty_errors.d(55): Error: cannot implicitly convert expression `1111` of type `int` to `byte` byte ɑ = 1111; ^ --- diff --git a/tests/dmd/fail_compilation/fastdfa.d b/tests/dmd/fail_compilation/fastdfa.d new file mode 100644 index 00000000000..b6c166bffbd --- /dev/null +++ b/tests/dmd/fail_compilation/fastdfa.d @@ -0,0 +1,366 @@ +/* + * REQUIRED_ARGS: -preview=fastdfa + * TEST_OUTPUT: +--- +fail_compilation/fastdfa.d(63): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(78): Error: Argument is expected to be non-null but was null +fail_compilation/fastdfa.d(71): For parameter `ptr` in argument 0 +fail_compilation/fastdfa.d(96): Error: Dereference on null variable `ptr` +fail_compilation/fastdfa.d(94): Error: Dereference on null variable `ptr` +fail_compilation/fastdfa.d(104): Error: Variable `ptr` was required to be non-null and has become null +fail_compilation/fastdfa.d(125): Error: Variable `ptr` was required to be non-null and has become null +fail_compilation/fastdfa.d(140): Error: Dereference on null variable `ptr` +fail_compilation/fastdfa.d(162): Error: Dereference on null variable `ptr` +fail_compilation/fastdfa.d(179): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(185): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(194): Error: Dereference on null variable `ptr` +fail_compilation/fastdfa.d(209): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(217): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(219): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(226): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(233): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(237): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(239): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(249): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(250): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(264): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(273): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(289): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(295): Error: Expression reads from an uninitialized variable, it must be written to at least once before reading +fail_compilation/fastdfa.d(294): For variable `val1` +fail_compilation/fastdfa.d(298): Error: Expression reads from an uninitialized variable, it must be written to at least once before reading +fail_compilation/fastdfa.d(294): For variable `val1` +fail_compilation/fastdfa.d(305): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(312): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(348): Error: Assert can be proven to be false +fail_compilation/fastdfa.d(355): Error: Expression reads a default initialized variable that is a floating point type +fail_compilation/fastdfa.d(355): It will have the value of Not Any Number(nan), it will be propagated with mathematical operations +fail_compilation/fastdfa.d(354): For variable `v` +fail_compilation/fastdfa.d(354): Initialize to float.nan or 0 explicitly to disable this error +fail_compilation/fastdfa.d(365): Error: Expression reads from an uninitialized variable, it must be written to at least once before reading +fail_compilation/fastdfa.d(364): For variable `v` +--- + */ + +@safe: + +void conditionalAssert() +{ + int a; + int b; + + int c; + + if (c) + { + a = 9; + } + else + { + b = 22; + } + + assert(c); // Error: c is false +} + +bool truthinessNo() +{ + return false; +} + +int nonnull1(int* ptr) +{ + return *ptr; +} + +void nonnullCall() +{ + nonnull1(null); // error +} + +void theSitchFinally() +{ + { + goto Label; + } + + { + Label: + } + + int* ptr; + + scope (exit) + int vS = *ptr; // error + + int vMid = *ptr; // error + truthinessNo; +} + +void loopy6() +{ + int* ptr = new int; + + foreach (i; 0 .. 2) // error + { + int val = *ptr; + ptr = null; // error + } +} + +void loopy7() +{ + int* ptr = new int; + + foreach (i; 0 .. 2) + { + if (ptr !is null) + int val1 = *ptr; // ok + + ptr = null; + } + + ptr = new int; + + foreach (i; 0 .. 2) // error + { + if (ptr !is null) + int val1 = *ptr; // ok + + int val2 = *ptr; // error + ptr = null; + } +} + +void nested1() +{ + static void nested2() + { + int* ptr; + int v = *ptr; // error + } + + int* ptr; + + void nested3() + { + int v = *ptr; + } + + nested2; + nested3; +} + +void theSitch(int arg) +{ + bool passedBy; + + switch (arg) + { + case 0: + int* ptr; + int v = *ptr; // error + goto default; + + case 1: + return; + + default: + if (passedBy) + goto case 1; + passedBy = true; + goto case 0; + } +} + +void assertNoCompare() +{ + int val; + assert(val); // Error: val is 0 +} + +void vectorExp() +{ + string[] stack; + assert(stack.length == 1); // Error: stack is null +} + +int nullSet(int* ptr, bool gate) +{ + if (ptr !is null) + { + if (gate) + ptr = null; + return *ptr; // error could be null + } + + return -1; +} + +void gateDowngrade(bool gate, int* ptr) +{ + if (gate) + { + ptr = null; + } + + if (gate) + { + assert(ptr !is null); // error + } +} + +void basicVRP() +{ + int a = 2, b = 3; + assert(a == a); // ok + assert(a == b); // error + assert(a != b); // ok + assert(a != a); // error +} + +void checkVRPUpper() +{ + ulong i = ulong.max; + + assert(i == 2); // error + assert(i == ulong(long.max) + 2); // ok +} + +void paNegate() +{ + int val = 2; + assert(val == 3); // error + assert(val == 2); // no error + + val = -val; + assert(val == 3); // error + assert(val == -2); // no error + assert(val == 9); // error +} + +void paAdd() +{ + int val = 2; + + val = val + 2; + val += 1; + + assert(val == 3); // error + assert(val == 4); // error + assert(val == 5); // no error +} + + +void paBitwise() +{ + int a = 2, b = 3, c; + + c = a * b; + + int d = c & 2; + + assert(c == 6); // no error + assert(d == 6); // error + assert(d == 2); // no error +} + +void paSliceLengthAppend() +{ + string text = "hello"; + text ~= " world"; + + assert(text.length == 5); // error + assert(text.length == 11); // no error +} + +void checkPtrExact() { + int* a = new int; + int* b = a; + + if (a is b) { + // ok + } else { + bool c; + assert(c); // should not error + } + + assert(a is b); // no error + assert(a !is b); // error +} + +void readFromUninit1() @trusted +{ + int val1 = void; + int val2 = val1; // error + + int* ptr = &val1; + int val3 = *ptr; // error +} + +void seeEffectViaObject1(bool condition) @trusted +{ + bool a = true, b = true; + bool got = *(condition ? &a : &b); + assert(!got); // error +} + +void seeEffectViaObject2(bool condition) @trusted +{ + bool a = false, b = false; + bool got = *(condition ? &a : &b); + assert(got); // error +} + +void valueLoop1() +{ + int* obj = new int, oldObj = obj; + + foreach (i; 0 .. 0) + { + obj = new int; + } + + // only true branch taken + if (obj is oldObj) + { + } + else + { + bool b; + assert(b); // ok + } + + obj = oldObj; + + foreach (i; 0 .. 10) + { + obj = new int; + } + + // both branches must be taken + if (obj is oldObj) + { + } + else + { + bool b; + assert(b); // error: cannot know state of obj after loop (null) + } +} + +void checkFloatInit1_2(bool condition) +{ + float v; + float t = v * 2; // error math op + + if (condition) + v = 2; + + float u = v * 2; // no error +} + +float uninitFloat() { + float v = void; + return v * 2; // error +} diff --git a/tests/dmd/fail_compilation/fix18057.c b/tests/dmd/fail_compilation/fix18057.c new file mode 100644 index 00000000000..9f73164703d --- /dev/null +++ b/tests/dmd/fail_compilation/fix18057.c @@ -0,0 +1,15 @@ +/* TEST_OUTPUT: +--- +fail_compilation/fix18057.c(105): Error: redefinition of `x` with different type: `int` vs `char` +--- + */ + +// https://issues.dlang.org/show_bug.cgi?id=22316 + +#line 100 + +int x; +extern int x; +typedef int INT; +extern INT x; +extern char x; diff --git a/tests/dmd/fail_compilation/getMember_private.d b/tests/dmd/fail_compilation/getMember_private.d new file mode 100644 index 00000000000..647e6098e3b --- /dev/null +++ b/tests/dmd/fail_compilation/getMember_private.d @@ -0,0 +1,26 @@ +/* +EXTRA_FILES: imports/fail5385.d +TEST_OUTPUT: +--- +fail_compilation/getMember_private.d(17): Error: accessing member `x` is not allowed in a `@safe` function +fail_compilation/getMember_private.d(19): Error: accessing member `privX` is not allowed in a `@safe` function +--- +*/ + +import imports.a10169, imports.fail5385; + +B b; + +void f() @safe +{ + // instance field + __traits(getMember, b, "x")++; + // static field + __traits(getMember, C, "privX")++; +} + +void g() @system // OK +{ + __traits(getMember, b, "x")++; + __traits(getMember, C, "privX")++; +} diff --git a/tests/dmd/fail_compilation/ice11822.d b/tests/dmd/fail_compilation/ice11822.d index a673a6b2dda..632571feb30 100644 --- a/tests/dmd/fail_compilation/ice11822.d +++ b/tests/dmd/fail_compilation/ice11822.d @@ -4,10 +4,11 @@ /* TEST_OUTPUT: --- -fail_compilation/ice11822.d(33): Deprecation: function `ice11822.d` is deprecated -fail_compilation/ice11822.d(16): instantiated from here: `__lambda_L33_C15!int` -fail_compilation/ice11822.d(22): instantiated from here: `S!(__lambda_L33_C15)` -fail_compilation/ice11822.d(33): instantiated from here: `g!((n) => d(i))` +fail_compilation/ice11822.d(34): Deprecation: function `ice11822.d` is deprecated +fail_compilation/ice11822.d(26): `d` is declared here +fail_compilation/ice11822.d(17): instantiated from here: `__lambda_L34_C15!int` +fail_compilation/ice11822.d(23): instantiated from here: `S!(__lambda_L34_C15)` +fail_compilation/ice11822.d(34): instantiated from here: `g!((n) => d(i))` --- */ diff --git a/tests/dmd/fail_compilation/ice11850.d b/tests/dmd/fail_compilation/ice11850.d index 510fe0aae82..6e88ff95f53 100644 --- a/tests/dmd/fail_compilation/ice11850.d +++ b/tests/dmd/fail_compilation/ice11850.d @@ -1,8 +1,8 @@ /* -EXTRA_FILES: imports/a11850.d TEST_OUTPUT: --- fail_compilation/ice11850.d(15): Error: incompatible types for `(a) < ([0])`: `uint[]` and `int[]` +fail_compilation/imports/a11850.d(23): instantiated from here: `__lambda_L15_C13!(uint[])` fail_compilation/imports/a11850.d(9): instantiated from here: `FilterResult!(__lambda_L15_C13, uint[][])` fail_compilation/ice11850.d(15): instantiated from here: `filter!(uint[][])` --- diff --git a/tests/dmd/fail_compilation/ice11919.d b/tests/dmd/fail_compilation/ice11919.d index e6b4f708846..43190203914 100644 --- a/tests/dmd/fail_compilation/ice11919.d +++ b/tests/dmd/fail_compilation/ice11919.d @@ -2,10 +2,11 @@ EXTRA_FILES: imports/a11919.d TEST_OUTPUT: --- -fail_compilation/ice11919.d(18): Error: initializer must be an expression, not `foo` +fail_compilation/ice11919.d(19): Error: initializer must be an expression, not `foo` +fail_compilation/imports/a11919.d(16): used in initialization here fail_compilation/imports/a11919.d(4): Error: template instance `a11919.doBar!(Foo).doBar.zoo!(t)` error instantiating fail_compilation/imports/a11919.d(11): instantiated from here: `doBar!(Foo)` -fail_compilation/ice11919.d(26): instantiated from here: `doBar!(Bar)` +fail_compilation/ice11919.d(27): instantiated from here: `doBar!(Bar)` --- */ diff --git a/tests/dmd/fail_compilation/issue22147.d b/tests/dmd/fail_compilation/issue22147.d new file mode 100644 index 00000000000..77c49678927 --- /dev/null +++ b/tests/dmd/fail_compilation/issue22147.d @@ -0,0 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/issue22147.d(15): Error: operator `/` is not defined for type `T` +fail_compilation/issue22147.d(9): perhaps overload the operator with `auto opBinaryRight(string op : "/")(int lhs) {}` +--- +*/ + +struct T +{ +} + +void test() +{ + auto result = 10 / T(); // int / T requires opBinaryRight on T +} diff --git a/tests/dmd/fail_compilation/issue22394.d b/tests/dmd/fail_compilation/issue22394.d new file mode 100644 index 00000000000..cc37adf72ee --- /dev/null +++ b/tests/dmd/fail_compilation/issue22394.d @@ -0,0 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/issue22394.d(11): Error: incompatible types for `(a) + (1)`: `string` and `int` +fail_compilation/issue22394.d(15): instantiated from here: `__lambda_L11_C1!string` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=22394 + +alias l = a => a + 1; + +void f() +{ + l(""); +} diff --git a/tests/dmd/fail_compilation/obsolete_body.d b/tests/dmd/fail_compilation/obsolete_body.d index 86d8bbc5d32..d4296359281 100644 --- a/tests/dmd/fail_compilation/obsolete_body.d +++ b/tests/dmd/fail_compilation/obsolete_body.d @@ -2,10 +2,12 @@ TEST_OUTPUT: --- fail_compilation/obsolete_body.d(11): Error: usage of identifer `body` as a keyword is obsolete. Use `do` instead. +fail_compilation/obsolete_body.d(13): Error: use `alias i32 = ...;` syntax instead of `alias ... i32;` --- */ -@__edition_latest_do_not_use -module m; +module m 2024; void test() in { } body { } + +alias int i32; diff --git a/tests/dmd/fail_compilation/placenew.d b/tests/dmd/fail_compilation/placenew.d index 033d078e191..2cb15eb530e 100644 --- a/tests/dmd/fail_compilation/placenew.d +++ b/tests/dmd/fail_compilation/placenew.d @@ -1,21 +1,24 @@ /* TEST_OUTPUT: --- -fail_compilation/placenew.d(23): Error: PlacementExpression `3` is an rvalue, but must be an lvalue -fail_compilation/placenew.d(28): Error: undefined identifier `x` -fail_compilation/placenew.d(36): Error: `new ( i )` PlacementExpression cannot be evaluated at compile time -fail_compilation/placenew.d(39): called from here: `xxx()` -fail_compilation/placenew.d(39): while evaluating: `static assert(xxx() == 1)` -fail_compilation/placenew.d(48): Error: new placement size 24 must be >= object size 40 -fail_compilation/placenew.d(54): Error: placement new cannot be used with associative arrays -fail_compilation/placenew.d(67): Error: new placement size 4 must be >= class object size $?:32=16|64=24$ -fail_compilation/placenew.d(77): Error: `@safe` function `test7` cannot use placement `new` is not allowed in a `@safe` function +fail_compilation/placenew.d(26): Error: PlacementExpression `3` is an rvalue, but must be an lvalue +fail_compilation/placenew.d(31): Error: undefined identifier `x` +fail_compilation/placenew.d(39): Error: `new ( i )` PlacementExpression cannot be evaluated at compile time +fail_compilation/placenew.d(42): called from here: `xxx()` +fail_compilation/placenew.d(42): while evaluating: `static assert(xxx() == 1)` +fail_compilation/placenew.d(51): Error: new placement size 24 must be >= object size 40 +fail_compilation/placenew.d(57): Error: placement new cannot be used with associative arrays +fail_compilation/placenew.d(70): Error: new placement size 4 must be >= class object size $?:32=16|64=24$ +fail_compilation/placenew.d(80): Error: placement `new` is not allowed in a `@safe` function +fail_compilation/placenew.d(89): Error: PlacementExpression cannot be a dynamic array +fail_compilation/placenew.d(92): Error: placement new cannot be used with dynamic arrays +fail_compilation/placenew.d(95): Error: PlacementExpression `s` of type `const(int)` must be unshared and mutable --- */ void test0() { int i; - int* pi = new (i) int; + int* pi = new (i) int; // OK } void test1() @@ -78,3 +81,16 @@ void test7() } /*************************************************/ + +void test8() +{ + void[] a; + a.reserve(int.sizeof); + int* ps = new(a) int; + + ubyte[a.sizeof] sa; + int[] ia = new(sa) int[4]; + + const int s; + ps = new(s) int; +} diff --git a/tests/dmd/fail_compilation/pragmamangle1.d b/tests/dmd/fail_compilation/pragmamangle1.d index d959705ac1b..a69770691cb 100644 --- a/tests/dmd/fail_compilation/pragmamangle1.d +++ b/tests/dmd/fail_compilation/pragmamangle1.d @@ -7,7 +7,7 @@ fail_compilation/pragmamangle1.d(44): Error: `pragma(mangle)` must be attached t fail_compilation/pragmamangle1.d(46): Error: `pragma(mangle)` must be attached to a declaration fail_compilation/pragmamangle1.d(53): Error: `pragma(mangle)` expects string literal argument for mangled name fail_compilation/pragmamangle1.d(56): Error: `pragma(mangle)` zero-length string not allowed for mangled name -fail_compilation/pragmamangle1.d(59): Error: pragma(mangle)` expects 1 or 2 arguments +fail_compilation/pragmamangle1.d(59): Error: `pragma(mangle)` expects 1 or 2 arguments fail_compilation/pragmamangle1.d(62): Error: `pragma(mangle)` cannot apply to a template declaration fail_compilation/pragmamangle1.d(62): use `template cannot_apply(Args...) { pragma(mangle, "template") ... }` fail_compilation/pragmamangle1.d(65): Error: `pragma(mangle)` takes a single argument that must be a string literal diff --git a/tests/dmd/fail_compilation/pragmamangle2.d b/tests/dmd/fail_compilation/pragmamangle2.d index 85c461af106..a5235157b0c 100644 --- a/tests/dmd/fail_compilation/pragmamangle2.d +++ b/tests/dmd/fail_compilation/pragmamangle2.d @@ -7,7 +7,7 @@ fail_compilation/pragmamangle2.d(46): Error: `pragma(mangle)` must be attached t fail_compilation/pragmamangle2.d(48): Error: `pragma(mangle)` must be attached to a declaration fail_compilation/pragmamangle2.d(55): Error: `pragma(mangle)` expects string literal argument for mangled name fail_compilation/pragmamangle2.d(58): Error: `pragma(mangle)` zero-length string not allowed for mangled name -fail_compilation/pragmamangle2.d(61): Error: pragma(mangle)` expects 1 or 2 arguments +fail_compilation/pragmamangle2.d(61): Error: `pragma(mangle)` expects 1 or 2 arguments fail_compilation/pragmamangle2.d(64): Error: `pragma(mangle)` cannot apply to a template declaration fail_compilation/pragmamangle2.d(64): use `template cannot_apply(Args...) { pragma(mangle, "template") ... }` fail_compilation/pragmamangle2.d(67): Error: `pragma(mangle)` takes a single argument that must be a string literal diff --git a/tests/dmd/fail_compilation/reserved_version.d b/tests/dmd/fail_compilation/reserved_version.d index 2432d1b30ea..b64b80ce90f 100644 --- a/tests/dmd/fail_compilation/reserved_version.d +++ b/tests/dmd/fail_compilation/reserved_version.d @@ -124,11 +124,11 @@ fail_compilation/reserved_version.d(225): Error: version identifier `D_ProfileGC fail_compilation/reserved_version.d(226): Error: version identifier `D_Invariants` is reserved and cannot be set fail_compilation/reserved_version.d(227): Error: version identifier `D_Optimized` is reserved and cannot be set fail_compilation/reserved_version.d(228): Error: version identifier `VisionOS` is reserved and cannot be set +fail_compilation/reserved_version.d(229): Error: version identifier `D_Profile` is reserved and cannot be set --- */ // Some extra empty lines to help fixup the manual line numbering after adding new version identifiers - #line 105 version = MSP430; version = D_P16; @@ -254,6 +254,7 @@ version = D_ProfileGC; version = D_Invariants; version = D_Optimized; version = VisionOS; +version = D_Profile; // This should work though debug = DigitalMars; diff --git a/tests/dmd/fail_compilation/reserved_version_switch.d b/tests/dmd/fail_compilation/reserved_version_switch.d index f124a3bf80f..1d82b22f944 100644 --- a/tests/dmd/fail_compilation/reserved_version_switch.d +++ b/tests/dmd/fail_compilation/reserved_version_switch.d @@ -110,6 +110,7 @@ // REQUIRED_ARGS: -version=none // REQUIRED_ARGS: -version=D_PreConditions // REQUIRED_ARGS: -version=D_PostConditions +// REQUIRED_ARGS: -version=D_Profile // REQUIRED_ARGS: -version=D_ProfileGC // REQUIRED_ARGS: -version=D_Invariants // REQUIRED_ARGS: -version=D_Optimized @@ -336,6 +337,7 @@ Error: version identifier `all` is reserved and cannot be set Error: version identifier `none` is reserved and cannot be set Error: version identifier `D_PreConditions` is reserved and cannot be set Error: version identifier `D_PostConditions` is reserved and cannot be set +Error: version identifier `D_Profile` is reserved and cannot be set Error: version identifier `D_ProfileGC` is reserved and cannot be set Error: version identifier `D_Invariants` is reserved and cannot be set Error: version identifier `D_Optimized` is reserved and cannot be set diff --git a/tests/dmd/fail_compilation/retref2.d b/tests/dmd/fail_compilation/retref2.d index ca64653efae..8062cb1d070 100644 --- a/tests/dmd/fail_compilation/retref2.d +++ b/tests/dmd/fail_compilation/retref2.d @@ -1,8 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/retref2.d(18): Error: function `ref int retref2.D.foo(return ref int)` does not override any function, did you mean to override `ref int retref2.C.foo(ref int)`? -fail_compilation/retref2.d(19): Error: function `ref int retref2.D.bar() scope return` does not override any function, did you mean to override `ref int retref2.C.bar()`? +fail_compilation/retref2.d(20): Error: function `ref int retref2.D.foo(return ref int)` does not override any function +fail_compilation/retref2.d(14): did you mean to override `ref int retref2.C.foo(ref int)`? +fail_compilation/retref2.d(21): Error: function `ref int retref2.D.bar() scope return` does not override any function +fail_compilation/retref2.d(15): did you mean to override `ref int retref2.C.bar()`? --- */ diff --git a/tests/dmd/fail_compilation/retscope.d b/tests/dmd/fail_compilation/retscope.d index 39fa8ab57af..489a7c1a97e 100644 --- a/tests/dmd/fail_compilation/retscope.d +++ b/tests/dmd/fail_compilation/retscope.d @@ -181,7 +181,8 @@ void foo11() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(197): Error: returning scope variable `e` is not allowed in a `@safe` function +fail_compilation/retscope.d(198): Error: returning scope variable `e` is not allowed in a `@safe` function +fail_compilation/retscope.d(197): `e` inferred `scope` because of `e.DG = d` --- */ @@ -201,7 +202,7 @@ void* escapeDg1(scope void* d) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(212): Error: assigning scope variable `p` to non-scope `e.e` is not allowed in a `@safe` function +fail_compilation/retscope.d(213): Error: assigning scope variable `p` to non-scope `e.e` is not allowed in a `@safe` function --- */ struct Escaper3 { void* e; } @@ -218,7 +219,7 @@ void* escape3 (scope void* p) @safe { /* TEST_OUTPUT: --- -fail_compilation/retscope.d(229): Error: scope parameter `ptr` may not be returned +fail_compilation/retscope.d(230): Error: scope parameter `ptr` may not be returned --- */ @@ -234,10 +235,10 @@ void* funretscope(scope dg_t ptr) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` -fail_compilation/retscope.d(248): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` fail_compilation/retscope.d(249): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` +fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` +fail_compilation/retscope.d(250): Error: cannot implicitly convert expression `() => & x` of type `void* delegate() pure nothrow @nogc @safe` to `void* delegate() scope @safe` --- */ @@ -254,7 +255,7 @@ void escape4() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(266): Error: taking address of `scope` variable `p` with pointers is not allowed in a `@safe` function +fail_compilation/retscope.d(267): Error: taking address of `scope` variable `p` with pointers is not allowed in a `@safe` function --- */ @@ -271,7 +272,7 @@ void escape5() @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(286): Error: escaping a reference to local variable `b` by returning `foo6(& b)` is not allowed in a `@safe` function +fail_compilation/retscope.d(287): Error: escaping a reference to local variable `b` by returning `foo6(& b)` is not allowed in a `@safe` function --- */ @@ -302,9 +303,9 @@ struct S7 /* TEST_OUTPUT: --- -fail_compilation/retscope.d(315): Error: scope parameter `p` may not be returned -fail_compilation/retscope.d(316): Error: returning `p[]` escapes a reference to parameter `p` -fail_compilation/retscope.d(319): Error: scope parameter `p` may not be returned +fail_compilation/retscope.d(316): Error: scope parameter `p` may not be returned +fail_compilation/retscope.d(317): Error: returning `p[]` escapes a reference to parameter `p` +fail_compilation/retscope.d(320): Error: scope parameter `p` may not be returned --- */ @@ -323,7 +324,7 @@ ref int[3] asStatic2( scope int[] p) @safe { return p[0 .. 3]; } /* TEST_OUTPUT: --- -fail_compilation/retscope.d(335): Error: assigning reference to local variable `i` to non-scope `f` is not allowed in a `@safe` function +fail_compilation/retscope.d(336): Error: assigning reference to local variable `i` to non-scope `f` is not allowed in a `@safe` function --- */ @@ -347,7 +348,7 @@ int* bar10( scope int** ptr ) @safe /* TEST_OUTPUT: --- -fail_compilation/retscope.d(358): Error: taking address of `scope` variable `aa` with pointers is not allowed in a `@safe` function +fail_compilation/retscope.d(359): Error: taking address of `scope` variable `aa` with pointers is not allowed in a `@safe` function --- */ @@ -420,6 +421,7 @@ class Foo13 TEST_OUTPUT: --- fail_compilation/retscope.d(1205): Error: scope variable `f14` calling non-scope member function `Foo14.foo()` is not allowed in a `@safe` function +fail_compilation/retscope.d(1204): `f14` inferred `scope` because of `f14.v = & i` --- */ @@ -680,6 +682,7 @@ TEST_OUTPUT: --- fail_compilation/retscope.d(1907): Error: assigning scope variable `x` to `ref` variable `this` with longer lifetime is not allowed in a `@safe` function fail_compilation/retscope.d(1913): Error: returning scope variable `x` is not allowed in a `@safe` function +fail_compilation/retscope.d(1912): `x` inferred `scope` because of `x = __param_0` --- */ #line 1900 diff --git a/tests/dmd/fail_compilation/retscope2.d b/tests/dmd/fail_compilation/retscope2.d index 18c7fe64cc9..ff8b875ba24 100644 --- a/tests/dmd/fail_compilation/retscope2.d +++ b/tests/dmd/fail_compilation/retscope2.d @@ -230,6 +230,7 @@ void test17428() @safe TEST_OUTPUT: --- fail_compilation/retscope2.d(1107): Error: returning scope variable `dg` is not allowed in a `@safe` function +fail_compilation/retscope2.d(1106): `dg` inferred `scope` because of `dg = &s.foo` --- */ diff --git a/tests/dmd/fail_compilation/retscope6.d b/tests/dmd/fail_compilation/retscope6.d index e3b734f03d4..72231be291e 100644 --- a/tests/dmd/fail_compilation/retscope6.d +++ b/tests/dmd/fail_compilation/retscope6.d @@ -78,11 +78,11 @@ void foo() @safe fail_compilation/retscope6.d(8016): Error: assigning address of variable `i` to `p` with longer lifetime is not allowed in a `@safe` function fail_compilation/retscope6.d(8031): Error: assigning reference to local variable `i` to non-scope parameter `p` calling `betty` is not allowed in a `@safe` function fail_compilation/retscope6.d(8031): Error: assigning reference to local variable `j` to non-scope parameter `q` calling `betty` is not allowed in a `@safe` function -fail_compilation/retscope6.d(8023): which is not `scope` because of `p = q` +fail_compilation/retscope6.d(8023): `q` is not `scope` because of `p = q` fail_compilation/retscope6.d(8048): Error: assigning reference to local variable `i` to non-scope parameter `p` calling `archie` is not allowed in a `@safe` function -fail_compilation/retscope6.d(8039): which is not `scope` because of `r = p` +fail_compilation/retscope6.d(8039): `p` is not `scope` because of `r = p` fail_compilation/retscope6.d(8048): Error: assigning reference to local variable `j` to non-scope parameter `q` calling `archie` is not allowed in a `@safe` function -fail_compilation/retscope6.d(8038): which is not `scope` because of `p = q` +fail_compilation/retscope6.d(8038): `q` is not `scope` because of `p = q` --- */ @@ -261,7 +261,7 @@ void escape_throw_20150() @safe /* TEST_OUTPUT: --- fail_compilation/retscope6.d(14019): Error: assigning scope variable `scopePtr` to non-scope parameter `x` calling `noInfer23021` is not allowed in a `@safe` function -fail_compilation/retscope6.d(14009): which is not `scope` because of `*escapeHole = cast(const(int)*)x` +fail_compilation/retscope6.d(14009): `x` is not `scope` because of `*escapeHole = cast(const(int)*)x` fail_compilation/retscope6.d(14022): Error: returning scope variable `scopePtr` is not allowed in a `@safe` function --- */ @@ -300,7 +300,7 @@ ref int escape23021() @safe /* TEST_OUTPUT: --- fail_compilation/retscope6.d(14050): Error: assigning scope variable `z` to non-scope parameter `y` calling `f23294` is not allowed in a `@safe` function -fail_compilation/retscope6.d(14044): which is not `scope` because of `x = y` +fail_compilation/retscope6.d(14044): `y` is not `scope` because of `x = y` --- */ diff --git a/tests/dmd/fail_compilation/safeprintf.d b/tests/dmd/fail_compilation/safeprintf.d new file mode 100644 index 00000000000..4f2dd42e4be --- /dev/null +++ b/tests/dmd/fail_compilation/safeprintf.d @@ -0,0 +1,42 @@ +/* +DISABLED: win32 win64 freebsd32 openbsd32 linux32 osx32 +TEST_OUTPUT: +--- +fail_compilation/safeprintf.d(29): Error: calling `pragma(printf)` function `printf` with format string `"s: %s\n"` is not allowed in a `@safe` function +fail_compilation/safeprintf.d(21): `safeprintf.printf` is declared here +fail_compilation/safeprintf.d(30): Error: calling `pragma(printf)` function `printf` with format string `"s: %S\n"` is not allowed in a `@safe` function +fail_compilation/safeprintf.d(21): `safeprintf.printf` is declared here +fail_compilation/safeprintf.d(31): Error: calling `pragma(printf)` function `printf` with format string `"s: %Z\n"` is not allowed in a `@safe` function +fail_compilation/safeprintf.d(21): `safeprintf.printf` is declared here +fail_compilation/safeprintf.d(31): Deprecation: format specifier `"%Z"` is invalid +fail_compilation/safeprintf.d(32): Error: calling `pragma(printf)` function `printf` with non-literal format string is not allowed in a `@safe` function +fail_compilation/safeprintf.d(21): `safeprintf.printf` is declared here +fail_compilation/safeprintf.d(33): Error: calling `pragma(printf)` function `bar` with format string `"%s"` is not allowed in a `@safe` function +fail_compilation/safeprintf.d(22): `safeprintf.bar` is declared here +fail_compilation/safeprintf.d(34): Error: `@safe` function `safeprintf.func` cannot call `@system` function `safeprintf.sys_printf` +fail_compilation/safeprintf.d(23): `safeprintf.sys_printf` is declared here +--- +*/ + +extern (C) @trusted pragma(printf) int printf(const(char)* format, ...); +extern(C) pragma(printf) @trusted void bar(int, const char*, ...); +extern (C) @system pragma(printf) int sys_printf(const(char)* format, ...); + +@safe void func(int i, char* s, dchar* d) +{ + printf("no specs"); // OK + printf("i: %d\n", i); // OK + printf("s: %s\n", s); + printf("s: %S\n", d); + printf("s: %Z\n", s); + printf(s, i); // non-literal + bar(1, "%s", s); // preceding args + sys_printf("%d", i); // not safe +} + +// no errors +@system void sys(char* s) +{ + printf(s); // non-literal + printf("%s", s); +} diff --git a/tests/dmd/fail_compilation/scope_infer_diagnostic.d b/tests/dmd/fail_compilation/scope_infer_diagnostic.d new file mode 100644 index 00000000000..50b3d323e92 --- /dev/null +++ b/tests/dmd/fail_compilation/scope_infer_diagnostic.d @@ -0,0 +1,35 @@ +/* +REQUIRED_ARGS: -preview=dip1000 +TEST_OUTPUT: +--- +fail_compilation/scope_infer_diagnostic.d(34): Error: `@safe` function `scope_infer_diagnostic.outer` cannot call `@system` function `scope_infer_diagnostic.inner!(void delegate(const(char)[]) pure nothrow @nogc @safe).inner` +fail_compilation/scope_infer_diagnostic.d(28): and assigning scope variable `w` to non-scope parameter `w` calling `callee` makes it fail to infer `@safe` +fail_compilation/scope_infer_diagnostic.d(21): `w` is not `scope` because of `globalPtr = & w` +fail_compilation/scope_infer_diagnostic.d(25): `scope_infer_diagnostic.inner!(void delegate(const(char)[]) pure nothrow @nogc @safe).inner` is declared here +--- +*/ + +// Test that scope violation error messages show WHY the callee's parameter +// is not scope when going through the @safe inference chain. +// This is similar to how @nogc violations show the full inference chain. + +void* globalPtr; + +void callee(Writer)(Writer w) @trusted +{ + // This escapes w, preventing it from being inferred as scope + globalPtr = cast(void*)&w; + w("x"); +} + +void inner(Writer)(scope Writer w) +{ + // Scope violation: passing scope w to non-scope parameter + callee(w); +} + +void outer() @safe +{ + int x; + inner((const(char)[] s) { x++; }); +} diff --git a/tests/dmd/fail_compilation/staticarray.d b/tests/dmd/fail_compilation/staticarray.d new file mode 100644 index 00000000000..768c64f728f --- /dev/null +++ b/tests/dmd/fail_compilation/staticarray.d @@ -0,0 +1,67 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/staticarray.d(24): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(25): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(26): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(29): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(27): Error: struct `staticarray.ForwardRef1` circular or forward reference +fail_compilation/staticarray.d(38): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(36): Error: struct `staticarray.ForwardRef3` circular or forward reference +fail_compilation/staticarray.d(43): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(41): Error: struct `staticarray.ForwardRef4` circular or forward reference +fail_compilation/staticarray.d(50): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(47): Error: struct `staticarray.ForwardRef5` circular or forward reference +fail_compilation/staticarray.d(55): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(53): Error: struct `staticarray.ForwardRef6` circular or forward reference +fail_compilation/staticarray.d(60): Error: cannot infer static array length from `$`, provide an initializer +fail_compilation/staticarray.d(58): Error: struct `staticarray.ForwardRef7` circular or forward reference +fail_compilation/staticarray.d(66): Error: struct `staticarray.ForwardRef8` cannot have field `arr` with static array of same struct type +fail_compilation/staticarray.d(33): Error: variable `staticarray.ForwardRef2.arr` recursive initialization of field +--- +*/ + +int[$] arr1; +int[$] arr2 = void; +int[$][1] arr3 = 1; +struct ForwardRef1 +{ + ForwardRef1[$] arr = new ForwardRef1(); +} +struct ForwardRef2 +{ + ForwardRef2*[$] arr = [new ForwardRef2()]; +} + +struct ForwardRef3 +{ + ForwardRef3[$] arr = ForwardRef3.init; +} + +struct ForwardRef4 +{ + ForwardRef4[$] arr = make(); + static ForwardRef4 make() { return ForwardRef4.init; } +} + +struct ForwardRef5 +{ + enum bool flag = true; + ForwardRef5[$] arr = flag ? ForwardRef5.init : ForwardRef5.init; +} + +struct ForwardRef6 +{ + ForwardRef6[$] arr = (0, ForwardRef6.init); +} + +struct ForwardRef7 +{ + ForwardRef7[$] arr = make(); + static ForwardRef7[] make() { return [ForwardRef7.init]; } +} + +struct ForwardRef8 +{ + ForwardRef8[$][$] arr = [[ForwardRef8.init]]; +} diff --git a/tests/dmd/fail_compilation/struct_rvalue_assign.d b/tests/dmd/fail_compilation/struct_rvalue_assign.d new file mode 100644 index 00000000000..42451768645 --- /dev/null +++ b/tests/dmd/fail_compilation/struct_rvalue_assign.d @@ -0,0 +1,62 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/struct_rvalue_assign.d(16): Error: assignment to struct rvalue `foo()` is discarded +fail_compilation/struct_rvalue_assign.d(16): if the assignment is needed to modify a global, call `opAssign` directly or use an lvalue +fail_compilation/struct_rvalue_assign.d(17): Error: assignment to struct rvalue `foo()` is discarded +fail_compilation/struct_rvalue_assign.d(17): if the assignment is needed to modify a global, call `opOpAssign` directly or use an lvalue +fail_compilation/struct_rvalue_assign.d(18): Error: assignment to struct rvalue `foo()` is discarded +fail_compilation/struct_rvalue_assign.d(18): if the assignment is needed to modify a global, call `opUnary` directly or use an lvalue +--- +*/ +module sra 2024; + +void main() +{ + foo() = S.init; + foo() += 5; + ++foo(); + *foo(); // other unary ops may be OK + + // allowed + foo().opAssign(S.init); + foo().opOpAssign!"+"(5); + foo().opUnary!"++"(); +} + +S foo() => S.init; + +struct S +{ + int i; + + void opAssign(S s); + void opOpAssign(string op : "+")(int); + void opUnary(string op : "++")(); + void opUnary(string op : "*")(); +} + +void test() +{ + int i; + + static struct Ptr + { + int* p; + void opAssign(int rhs) { *p = rhs; } + } + Ptr(&i) = 1; // allowed + + struct Nested + { + void opAssign(int rhs) { i = rhs; } + } + Nested() = 1; // allowed + + static struct StaticOp + { + static si = 0; + static void opAssign(int rhs) { si = rhs; } + } + StaticOp() = 1; // allowed +} diff --git a/tests/dmd/fail_compilation/systemvariables_void_init.d b/tests/dmd/fail_compilation/systemvariables_void_init.d index 43478e782f4..e91af394ec7 100644 --- a/tests/dmd/fail_compilation/systemvariables_void_init.d +++ b/tests/dmd/fail_compilation/systemvariables_void_init.d @@ -5,8 +5,8 @@ TEST_OUTPUT: fail_compilation/systemvariables_void_init.d(48): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function fail_compilation/systemvariables_void_init.d(49): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function fail_compilation/systemvariables_void_init.d(50): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function -fail_compilation/systemvariables_void_init.d(51): Error: void intializing a bool (which must always be 0 or 1) is not allowed in a `@safe` function -fail_compilation/systemvariables_void_init.d(52): Error: void intializing a bool (which must always be 0 or 1) is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(51): Error: `void` initializing a `bool` (which must always be 0 or 1) is not allowed in a `@safe` function +fail_compilation/systemvariables_void_init.d(52): Error: `void` initializing a `bool` (which must always be 0 or 1) is not allowed in a `@safe` function fail_compilation/systemvariables_void_init.d(53): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function fail_compilation/systemvariables_void_init.d(54): Error: `void` initializing a type with unsafe bit patterns is not allowed in a `@safe` function --- diff --git a/tests/dmd/fail_compilation/test13867.d b/tests/dmd/fail_compilation/test13867.d index 36543f92ebe..59c49870b01 100644 --- a/tests/dmd/fail_compilation/test13867.d +++ b/tests/dmd/fail_compilation/test13867.d @@ -1,8 +1,10 @@ /* TEST_OUTPUT: --- -fail_compilation/test13867.d(12): Error: function `void test13867.X.blah()` does not override any function, did you mean to override `extern (C++) void test13867.Base.blah()`? -fail_compilation/test13867.d(19): Error: function `void test13867.Z.blah()` does not override any function, did you mean to override `extern (C++) void test13867.Base.blah()`? +fail_compilation/test13867.d(14): Error: function `void test13867.X.blah()` does not override any function +fail_compilation/test13867.d(11): did you mean to override `extern (C++) void test13867.Base.blah()`? +fail_compilation/test13867.d(21): Error: function `void test13867.Z.blah()` does not override any function +fail_compilation/test13867.d(11): did you mean to override `extern (C++) void test13867.Base.blah()`? --- */ extern (C++) class Base { diff --git a/tests/dmd/fail_compilation/test16188.d b/tests/dmd/fail_compilation/test16188.d index e3fedf34bd9..eaa3352276b 100644 --- a/tests/dmd/fail_compilation/test16188.d +++ b/tests/dmd/fail_compilation/test16188.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* * TEST_OUTPUT: --- fail_compilation/test16188.d(101): Error: no property `name` for `Where()` of type `test16188.Where` diff --git a/tests/dmd/fail_compilation/test17284.d b/tests/dmd/fail_compilation/test17284.d index a68a0b32d2b..0ad4a271338 100644 --- a/tests/dmd/fail_compilation/test17284.d +++ b/tests/dmd/fail_compilation/test17284.d @@ -4,7 +4,7 @@ TEST_OUTPUT: fail_compilation/test17284.d(17): Error: accessing overlapped field `U.c` with pointers is not allowed in a `@safe` function pure nothrow @safe void(U t) --- -REQUIRED_ARGS: -preview=bitfields + */ // https://issues.dlang.org/show_bug.cgi?id=17284 diff --git a/tests/dmd/fail_compilation/test17422.d b/tests/dmd/fail_compilation/test17422.d index e5577ddb54f..68d2f490547 100644 --- a/tests/dmd/fail_compilation/test17422.d +++ b/tests/dmd/fail_compilation/test17422.d @@ -2,7 +2,8 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17422.d(23): Error: returning scope variable `p` is not allowed in a `@safe` function +fail_compilation/test17422.d(24): Error: returning scope variable `p` is not allowed in a `@safe` function +fail_compilation/test17422.d(23): `p` inferred `scope` because of `p = rc.get()` --- */ struct RC diff --git a/tests/dmd/fail_compilation/test17423.d b/tests/dmd/fail_compilation/test17423.d index 785bbe7fc41..0d889310297 100644 --- a/tests/dmd/fail_compilation/test17423.d +++ b/tests/dmd/fail_compilation/test17423.d @@ -1,8 +1,9 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test17423.d(27): Error: assigning reference to local `this` to non-scope parameter `dlg` calling `opApply` is not allowed in a `@safe` function -fail_compilation/test17423.d(16): which is not `scope` because of `this.myDlg = dlg` +fail_compilation/test17423.d(28): Error: assigning reference to local `this` to non-scope parameter `dlg` calling `opApply` is not allowed in a `@safe` function +fail_compilation/test17423.d(17): `dlg` is not `scope` because of `this.myDlg = dlg` +fail_compilation/test17423.d(28): `this` inferred `scope` because of `int(int _) => 0` --- */ diff --git a/tests/dmd/fail_compilation/test18282.d b/tests/dmd/fail_compilation/test18282.d index f06b1bfc601..d6786d5a32d 100644 --- a/tests/dmd/fail_compilation/test18282.d +++ b/tests/dmd/fail_compilation/test18282.d @@ -1,13 +1,14 @@ /* REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test18282.d(25): Error: returning scope variable `aa` is not allowed in a `@safe` function -fail_compilation/test18282.d(34): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(26): Error: returning scope variable `aa` is not allowed in a `@safe` function fail_compilation/test18282.d(35): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function -fail_compilation/test18282.d(36): Error: returning scope variable `staa` is not allowed in a `@safe` function -fail_compilation/test18282.d(44): Error: escaping a reference to local variable `i` by copying `S2000(& i)` into allocated memory is not allowed in a `@safe` function -fail_compilation/test18282.d(53): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function -fail_compilation/test18282.d(53): Error: escaping a reference to local variable `c` by copying `& c` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(36): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(37): Error: returning scope variable `staa` is not allowed in a `@safe` function +fail_compilation/test18282.d(34): `staa` inferred `scope` because of `staa = [& i]` +fail_compilation/test18282.d(45): Error: escaping a reference to local variable `i` by copying `S2000(& i)` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(54): Error: escaping a reference to local variable `i` by copying `& i` into allocated memory is not allowed in a `@safe` function +fail_compilation/test18282.d(54): Error: escaping a reference to local variable `c` by copying `& c` into allocated memory is not allowed in a `@safe` function --- */ diff --git a/tests/dmd/fail_compilation/test19097.d b/tests/dmd/fail_compilation/test19097.d index f415dd92079..9acea999669 100644 --- a/tests/dmd/fail_compilation/test19097.d +++ b/tests/dmd/fail_compilation/test19097.d @@ -1,14 +1,21 @@ /* REQUIRED_ARGS: -preview=dip1000 * TEST_OUTPUT: --- -fail_compilation/test19097.d(44): Error: returning scope variable `s` is not allowed in a `@safe` function -fail_compilation/test19097.d(48): Error: returning scope variable `s1` is not allowed in a `@safe` function -fail_compilation/test19097.d(77): Error: assigning scope variable `z` to `ref` variable `refPtr` with longer lifetime is not allowed in a `@safe` function -fail_compilation/test19097.d(108): Error: returning scope variable `s4` is not allowed in a `@safe` function -fail_compilation/test19097.d(126): Error: returning scope variable `s5c` is not allowed in a `@safe` function -fail_compilation/test19097.d(130): Error: returning scope variable `s5m` is not allowed in a `@safe` function -fail_compilation/test19097.d(147): Error: returning scope variable `s6c` is not allowed in a `@safe` function -fail_compilation/test19097.d(151): Error: returning scope variable `s6m` is not allowed in a `@safe` function +fail_compilation/test19097.d(51): Error: returning scope variable `s` is not allowed in a `@safe` function +fail_compilation/test19097.d(50): `s` inferred `scope` because of `s = & i` +fail_compilation/test19097.d(55): Error: returning scope variable `s1` is not allowed in a `@safe` function +fail_compilation/test19097.d(54): `s1` inferred `scope` because of `s1 = & i` +fail_compilation/test19097.d(84): Error: assigning scope variable `z` to `ref` variable `refPtr` with longer lifetime is not allowed in a `@safe` function +fail_compilation/test19097.d(115): Error: returning scope variable `s4` is not allowed in a `@safe` function +fail_compilation/test19097.d(114): `s4` inferred `scope` because of `s4 = & x` +fail_compilation/test19097.d(133): Error: returning scope variable `s5c` is not allowed in a `@safe` function +fail_compilation/test19097.d(132): `s5c` inferred `scope` because of `s5c = i` +fail_compilation/test19097.d(137): Error: returning scope variable `s5m` is not allowed in a `@safe` function +fail_compilation/test19097.d(136): `s5m` inferred `scope` because of `s5m = i` +fail_compilation/test19097.d(154): Error: returning scope variable `s6c` is not allowed in a `@safe` function +fail_compilation/test19097.d(153): `s6c` inferred `scope` because of `s6c = i` +fail_compilation/test19097.d(158): Error: returning scope variable `s6m` is not allowed in a `@safe` function +fail_compilation/test19097.d(157): `s6m` inferred `scope` because of `s6m = i` --- */ diff --git a/tests/dmd/fail_compilation/test19193.d b/tests/dmd/fail_compilation/test19193.d index e75d90e5a92..9c4d7e4979f 100644 --- a/tests/dmd/fail_compilation/test19193.d +++ b/tests/dmd/fail_compilation/test19193.d @@ -2,7 +2,8 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/test19193.d(13): Deprecation: enum member `test19193.T19193!int.A.b` is deprecated +fail_compilation/test19193.d(14): Deprecation: enum member `test19193.T19193!int.A.b` is deprecated +fail_compilation/test19193.d(21): `b` is declared here --- */ diff --git a/tests/dmd/fail_compilation/test20245.d b/tests/dmd/fail_compilation/test20245.d index 5484786d64c..a37e596f9b6 100644 --- a/tests/dmd/fail_compilation/test20245.d +++ b/tests/dmd/fail_compilation/test20245.d @@ -2,16 +2,21 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- -fail_compilation/test20245.d(21): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function -fail_compilation/test20245.d(22): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function -fail_compilation/test20245.d(23): Error: returning scope variable `a` is not allowed in a `@safe` function -fail_compilation/test20245.d(27): Error: taking address of `scope` variable `x` with pointers is not allowed in a `@safe` function -fail_compilation/test20245.d(33): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function -fail_compilation/test20245.d(34): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function -fail_compilation/test20245.d(50): Error: assigning reference to local variable `price` to non-scope `this.minPrice` is not allowed in a `@safe` function -fail_compilation/test20245.d(69): Error: reference to local variable `this.content[]` calling non-scope member function `Exception.this()` is not allowed in a `@safe` function -fail_compilation/test20245.d(89): Error: assigning reference to local variable `this` to non-scope parameter `content` calling `listUp` is not allowed in a `@safe` function -fail_compilation/test20245.d(82): which is not `scope` because of `charPtr = content` +fail_compilation/test20245.d(26): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function +fail_compilation/test20245.d(25): `x` inferred `scope` because of `a = &x` +fail_compilation/test20245.d(27): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function +fail_compilation/test20245.d(28): Error: returning scope variable `a` is not allowed in a `@safe` function +fail_compilation/test20245.d(25): `a` inferred `scope` because of `a = &x` +fail_compilation/test20245.d(32): Error: taking address of `scope` variable `x` with pointers is not allowed in a `@safe` function +fail_compilation/test20245.d(38): Error: assigning reference to local variable `x` to non-scope parameter `ptr` calling `escape` is not allowed in a `@safe` function +fail_compilation/test20245.d(37): `x` inferred `scope` because of `a = &x` +fail_compilation/test20245.d(39): Error: escaping a reference to parameter `x` by copying `&x` into allocated memory is not allowed in a `@safe` function +fail_compilation/test20245.d(55): Error: assigning reference to local variable `price` to non-scope `this.minPrice` is not allowed in a `@safe` function +fail_compilation/test20245.d(74): Error: reference to local variable `this.content[]` calling non-scope member function `Exception.this()` is not allowed in a `@safe` function +fail_compilation/test20245.d(74): `this` inferred `scope` because of `this.content[]` +fail_compilation/test20245.d(94): Error: assigning reference to local variable `this` to non-scope parameter `content` calling `listUp` is not allowed in a `@safe` function +fail_compilation/test20245.d(87): `content` is not `scope` because of `charPtr = content` +fail_compilation/test20245.d(94): `this` inferred `scope` because of `&this.content` --- */ diff --git a/tests/dmd/fail_compilation/test20489.d b/tests/dmd/fail_compilation/test20489.d index 1cd5350959c..23da6a99efb 100644 --- a/tests/dmd/fail_compilation/test20489.d +++ b/tests/dmd/fail_compilation/test20489.d @@ -1,10 +1,9 @@ /* TEST_OUTPUT: --- -fail_compilation/test20489.d(19): Error: function `pure nothrow @nogc @safe int test20489.D.f(int delegate(int) pure nothrow @nogc @safe body)` does not override any function, did you mean to override `pure nothrow @nogc @safe int test20489.B.f(scope int delegate(int) pure nothrow @nogc @safe)`? -fail_compilation/test20489.d(19): Did you intend to override: -fail_compilation/test20489.d(19): `pure nothrow @nogc @safe int test20489.B.f(scope int delegate(int) pure nothrow @nogc @safe)` -fail_compilation/test20489.d(19): Parameter 1 is missing `scope` +fail_compilation/test20489.d(18): Error: function `pure nothrow @nogc @safe int test20489.D.f(int delegate(int) pure nothrow @nogc @safe body)` does not override any function +fail_compilation/test20489.d(14): did you mean to override `pure nothrow @nogc @safe int test20489.B.f(scope int delegate(int) pure nothrow @nogc @safe)`? +fail_compilation/test20489.d(18): parameter 1 is missing `scope` --- */ diff --git a/tests/dmd/fail_compilation/test20515.d b/tests/dmd/fail_compilation/test20515.d index cf4bbde58d9..b753db3a5de 100644 --- a/tests/dmd/fail_compilation/test20515.d +++ b/tests/dmd/fail_compilation/test20515.d @@ -2,8 +2,9 @@ /* TEST_OUTPUT: --- -fail_compilation/test20515.d:16: Deprecation: function `test20515.foo` is deprecated -fail_compilation/test20515.d:17: Error: undefined identifier `bar` +fail_compilation/test20515.d:17: Deprecation: function `test20515.foo` is deprecated +fail_compilation/test20515.d:13: `foo` is declared here +fail_compilation/test20515.d:18: Error: undefined identifier `bar` --- */ diff --git a/tests/dmd/fail_compilation/test20863a.d b/tests/dmd/fail_compilation/test20863a.d new file mode 100644 index 00000000000..545b436a666 --- /dev/null +++ b/tests/dmd/fail_compilation/test20863a.d @@ -0,0 +1,23 @@ +// must not assert/crash with empty declarations +/* TEST_OUTPUT: +--- +fail_compilation/test20863a.d(21): Error: no property `Entry` for type `object.TypeInfo_AssociativeArray` +fail_compilation/test20863a.d(17): class `TypeInfo_AssociativeArray` defined here +fail_compilation/test20863a.d(21): Error: no property `aaGetHash` for type `object.TypeInfo_AssociativeArray` +fail_compilation/test20863a.d(17): class `TypeInfo_AssociativeArray` defined here +fail_compilation/test20863a.d(21): Error: no property `aaOpEqual` for type `object.TypeInfo_AssociativeArray` +fail_compilation/test20863a.d(17): class `TypeInfo_AssociativeArray` defined here +--- +*/ + +module object; + +class Object { } +class TypeInfo { } +class TypeInfo_AssociativeArray { } + +extern(C) int main() +{ + int[int] aa; + return 0; +} diff --git a/tests/dmd/fail_compilation/test20863b.d b/tests/dmd/fail_compilation/test20863b.d new file mode 100644 index 00000000000..27a1dbefd73 --- /dev/null +++ b/tests/dmd/fail_compilation/test20863b.d @@ -0,0 +1,25 @@ +// must not assert/crash with mismatched declarations +/* TEST_OUTPUT: +--- +fail_compilation/test20863b.d(23): Error: `Entry` isn't a template +fail_compilation/test20863b.d(23): Error: `aaGetHash` isn't a template function +fail_compilation/test20863b.d(23): Error: `aaOpEqual` isn't a template function +--- +*/ + +module object; + +class Object { } +class TypeInfo { } +class TypeInfo_AssociativeArray +{ + int Entry; + struct aaOpEqual(K, V) { } + struct aaGetHash(K, V) { } +} + +extern(C) int main() +{ + int[int] aa; + return 0; +} diff --git a/tests/dmd/fail_compilation/test21246.d b/tests/dmd/fail_compilation/test21246.d index 02c0b350171..8e27d985056 100644 --- a/tests/dmd/fail_compilation/test21246.d +++ b/tests/dmd/fail_compilation/test21246.d @@ -3,7 +3,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test21246.d(16): Error: function `void test21246.C.set(Clock clock)` does not override any function, did you mean to override `void imports.test21246.B.set(imports.test21246.Clock clock)`? +fail_compilation/test21246.d(17): Error: function `void test21246.C.set(Clock clock)` does not override any function +fail_compilation/imports/test21246.d(7): did you mean to override `void imports.test21246.B.set(imports.test21246.Clock clock)`? --- */ module test21246; diff --git a/tests/dmd/fail_compilation/test21259.d b/tests/dmd/fail_compilation/test21259.d index 31dba3d52ca..c928bab7e7d 100644 --- a/tests/dmd/fail_compilation/test21259.d +++ b/tests/dmd/fail_compilation/test21259.d @@ -3,10 +3,14 @@ /* TEST_OUTPUT: --- -fail_compilation/test21259.d(39): Deprecation: alias `test21259.Foo.width` is deprecated -fail_compilation/test21259.d(40): Deprecation: alias `test21259.Foo2.width` is deprecated -fail_compilation/test21259.d(41): Deprecation: variable `test21259.Foo3.bar` is deprecated -fail_compilation/test21259.d(42): Deprecation: alias `test21259.Foo4.width` is deprecated +fail_compilation/test21259.d(43): Deprecation: alias `test21259.Foo.width` is deprecated +fail_compilation/test21259.d(20): `width` is declared here +fail_compilation/test21259.d(44): Deprecation: alias `test21259.Foo2.width` is deprecated +fail_compilation/test21259.d(26): `width` is declared here +fail_compilation/test21259.d(45): Deprecation: variable `test21259.Foo3.bar` is deprecated +fail_compilation/test21259.d(31): `bar` is declared here +fail_compilation/test21259.d(46): Deprecation: alias `test21259.Foo4.width` is deprecated +fail_compilation/test21259.d(38): `width` is declared here --- */ diff --git a/tests/dmd/fail_compilation/test21634.d b/tests/dmd/fail_compilation/test21634.d new file mode 100644 index 00000000000..30bce991914 --- /dev/null +++ b/tests/dmd/fail_compilation/test21634.d @@ -0,0 +1,25 @@ +/* +REQUIRED_ARGS: -verrors=context +TEST_OUTPUT: +--- +fail_compilation/test21634.d(22): Error: function literal `(int x) { }` is not callable using argument types `(string)` + (int x) {} ("%s"); + ^ +fail_compilation/test21634.d(22): cannot pass argument `"%s"` of type `string` to parameter `int x` + (int x) {} ("%s"); + ^ +fail_compilation/test21634.d(24): Error: declaration `test21634.main.foo` is already defined + int foo; + ^ +fail_compilation/test21634.d(23): `variable` `foo` is defined here + float foo; + ^ +--- +*/ +void f(int x) {} +void main() +{ + (int x) {} ("%s"); + float foo; + int foo; +} diff --git a/tests/dmd/fail_compilation/test22344.c b/tests/dmd/fail_compilation/test22344.c index a8916f66c03..a14363a7fc0 100644 --- a/tests/dmd/fail_compilation/test22344.c +++ b/tests/dmd/fail_compilation/test22344.c @@ -2,6 +2,7 @@ --- fail_compilation/test22344.c(103): Error: function `test22344.func` redeclaration with different type fail_compilation/test22344.c(203): Error: function `test22344.test` redeclaration with different type +fail_compilation/test22344.c(301): Error: function `test22344.foo` redeclaration with different type --- */ @@ -26,3 +27,8 @@ int test(int x, ...) { return x; } + +#line 300 + +int foo(); +double foo(); diff --git a/tests/dmd/fail_compilation/test22397.d b/tests/dmd/fail_compilation/test22397.d new file mode 100644 index 00000000000..a1a89799bfc --- /dev/null +++ b/tests/dmd/fail_compilation/test22397.d @@ -0,0 +1,16 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test22397.d(13): Error: this array literal causes a GC allocation in `@nogc` function `main` +fail_compilation/test22397.d(14): Error: this array literal causes a GC allocation in `@nogc` function `main` +fail_compilation/test22397.d(15): Error: this array literal causes a GC allocation in `@nogc` function `main` +--- +*/ + +// https://issues.dlang.org/show_bug.cgi?id=22397 +@nogc void main() +{ + @("uda") int[] a = [1, 2]; // should error + align(8) int[] b = [3, 4]; // should error + extern(C) int[] c = [5, 6]; // should error +} diff --git a/tests/dmd/fail_compilation/test23073.d b/tests/dmd/fail_compilation/test23073.d index e47569aacb3..14a9ac11ad8 100644 --- a/tests/dmd/fail_compilation/test23073.d +++ b/tests/dmd/fail_compilation/test23073.d @@ -3,7 +3,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- fail_compilation/test23073.d(28): Error: assigning scope variable `c` to non-scope parameter `c` calling `assignNext` is not allowed in a `@safe` function -fail_compilation/test23073.d(22): which is not `scope` because of `c.next = c` +fail_compilation/test23073.d(22): `c` is not `scope` because of `c.next = c` --- */ diff --git a/tests/dmd/fail_compilation/test23968.d b/tests/dmd/fail_compilation/test23968.d index 4456e75c707..f371618f603 100644 --- a/tests/dmd/fail_compilation/test23968.d +++ b/tests/dmd/fail_compilation/test23968.d @@ -5,7 +5,8 @@ /* TEST_OUTPUT: --- -fail_compilation/test23968.d(22): Deprecation: alias `test23968.a` is deprecated +fail_compilation/test23968.d(23): Deprecation: alias `test23968.a` is deprecated +fail_compilation/test23968.d(18): `a` is declared here --- */ diff --git a/tests/dmd/fail_compilation/test23982.d b/tests/dmd/fail_compilation/test23982.d index dac70fd9fb7..2388febce1c 100644 --- a/tests/dmd/fail_compilation/test23982.d +++ b/tests/dmd/fail_compilation/test23982.d @@ -3,7 +3,7 @@ REQUIRED_ARGS: -preview=dip1000 TEST_OUTPUT: --- fail_compilation/test23982.d(35): Error: assigning scope variable `a` to non-scope parameter `a` calling `foo2` is not allowed in a `@safe` function -fail_compilation/test23982.d(26): which is not `scope` because of `b = a` +fail_compilation/test23982.d(26): `a` is not `scope` because of `b = a` --- */ // https://issues.dlang.org/show_bug.cgi?id=23982 diff --git a/tests/dmd/fail_compilation/test9701b.d b/tests/dmd/fail_compilation/test9701b.d index 725a4cd0ea6..ce2e54c3ef6 100644 --- a/tests/dmd/fail_compilation/test9701b.d +++ b/tests/dmd/fail_compilation/test9701b.d @@ -2,8 +2,10 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/test9701b.d(20): Deprecation: enum member `test9701b.Enum.e0` is deprecated -fail_compilation/test9701b.d(21): Deprecation: enum member `test9701b.Enum.e1` is deprecated - message +fail_compilation/test9701b.d(22): Deprecation: enum member `test9701b.Enum.e0` is deprecated +fail_compilation/test9701b.d(16): `e0` is declared here +fail_compilation/test9701b.d(23): Deprecation: enum member `test9701b.Enum.e1` is deprecated - message +fail_compilation/test9701b.d(17): `e1` is declared here --- */ diff --git a/tests/dmd/fail_compilation/test_isOverlapped_errors.d b/tests/dmd/fail_compilation/test_isOverlapped_errors.d new file mode 100644 index 00000000000..ef0a1782dd8 --- /dev/null +++ b/tests/dmd/fail_compilation/test_isOverlapped_errors.d @@ -0,0 +1,17 @@ +/* +TEST_OUTPUT: +--- +fail_compilation/test_isOverlapped_errors.d(100): Error: expected 1 arguments for `isOverlapped` but had 0 +fail_compilation/test_isOverlapped_errors.d(101): Error: expected 1 arguments for `isOverlapped` but had 2 +--- +*/ + +struct S +{ + union { int x; } + int y; +} + +#line 100 +enum a = __traits(isOverlapped); +enum b = __traits(isOverlapped, S, S.x); diff --git a/tests/dmd/fail_compilation/type_as_initializer.d b/tests/dmd/fail_compilation/type_as_initializer.d new file mode 100644 index 00000000000..57be109ba0b --- /dev/null +++ b/tests/dmd/fail_compilation/type_as_initializer.d @@ -0,0 +1,52 @@ +/* TEST_OUTPUT: +--- +fail_compilation/type_as_initializer.d(40): Error: initializer must be an expression, not `S1` +fail_compilation/type_as_initializer.d(40): perhaps use `S1()` to construct a value of the type +fail_compilation/type_as_initializer.d(43): Error: initializer must be an expression, not `S2` +fail_compilation/type_as_initializer.d(46): Error: initializer must be an expression, not `S3` +fail_compilation/type_as_initializer.d(46): perhaps use `S3(...)` to construct a value of the type +fail_compilation/type_as_initializer.d(49): Error: initializer must be an expression, not `C1` +fail_compilation/type_as_initializer.d(49): perhaps use `new C1()` to construct a value of the type +fail_compilation/type_as_initializer.d(52): Error: initializer must be an expression, not `C2` +fail_compilation/type_as_initializer.d(52): perhaps use `new C2(...)` to construct a value of the type +--- +*/ + +// Struct with no constructors - hint with () +struct S1 {} + +// Struct with copy constructor - no hint (can't default construct) +struct S2 +{ + this(ref S2) {} +} + +// Struct with required-arg constructor only - hint with (...) +struct S3 +{ + this(int x) {} +} + +// Class with no constructors - hint with new () +class C1 {} + +// Class with required-arg constructor only - hint with new (...) +class C2 +{ + this(int x) {} +} + +// Test cases +enum e1 = S1; // line 44 + +// Copy constructor - no hint +enum e2 = S2; // line 47 + +// Required args - hint with (...) +enum e3 = S3; // line 50 + +// Class with no ctor - hint with new () +enum e4 = C1; // line 53 + +// Class with required args - hint with new (...) +enum e5 = C2; // line 56 diff --git a/tests/dmd/run.d b/tests/dmd/run.d index a7e932f3043..a2cc83d5ec9 100755 --- a/tests/dmd/run.d +++ b/tests/dmd/run.d @@ -494,12 +494,16 @@ Target[] filterTargets(Target[] targets, const string[string] env) quitSilently(1); Target[] targetsThatNeedUpdating; + const dmdLastModified = env["DMD"].timeLastModified.ifThrown(SysTime.init); foreach (t; targets) { immutable testName = t.normalizedTestName; - auto resultRunTime = resultsDir.buildPath(testName ~ ".out").timeLastModified.ifThrown(SysTime.init); - if (!force && resultRunTime > testPath(testName).timeLastModified && - resultRunTime > env["DMD"].timeLastModified.ifThrown(SysTime.init)) + auto testResultPath = resultsDir.buildPath(testName ~ ".out"); + auto resultRunTime = testResultPath.timeLastModified.ifThrown(SysTime.init); + auto testSourcePath = testPath(testName); + auto sourceLastModified = testSourcePath.timeLastModified.ifThrown(SysTime.init); + if (!force && resultRunTime > sourceLastModified && + resultRunTime > dmdLastModified) log("%s is already up-to-date", testName); else targetsThatNeedUpdating ~= t; diff --git a/tests/dmd/runnable/ai.d b/tests/dmd/runnable/ai.d new file mode 100644 index 00000000000..26d515f071e --- /dev/null +++ b/tests/dmd/runnable/ai.d @@ -0,0 +1,116 @@ +/* +PERMUTE_ARGS: -O -release +Test cases generated by AI. +*/ + +import core.stdc.stdio; + +void arithmetic_expression_selftest() +{ + /* If a bit is set in `fail`, that test expression evaluated differently than expected. */ + uint fail = 0; + uint t = 0; + + /* ---- precedence & associativity (integers) ---- */ + /* 1) * binds tighter than + */ + t = ((3 + 4 * 5) == (3 + (4 * 5))); + fail |= cast(uint)(!t) << 0; + + /* 2) / binds tighter than - */ + t = ((20 - 12 / 3) == (20 - (12 / 3))); + fail |= cast(uint)(!t) << 1; + + /* 3) left-associative subtraction: (a-b)-c */ + t = ((100 - 30 - 20) == ((100 - 30) - 20)); + fail |= cast(uint)(!t) << 2; + + /* 4) left-associative division: (a/b)/c */ + t = ((100 / 10 / 2) == ((100 / 10) / 2)); + fail |= cast(uint)(!t) << 3; + + /* 5) shift lower precedence than +: a << (b+c) is NOT (a< u); + /* In practice this is true because u+s becomes huge, but we only check + relative ordering; if the implementation got conversions wrong, it may differ. */ + fail |= cast(uint)(!t) << 8; + } + + /* ---- exact integer identities (no UB) ---- */ + /* 10) distributive property with small ints */ + t = ((7 * (9 + 11)) == (7 * 9 + 7 * 11)); + fail |= cast(uint)(!t) << 9; + + /* 11) (a^b)^b == a for uint */ + { + uint a = 0xA5A5A5A5u, b = 0x3C3C3C3Cu; + t = (((a ^ b) ^ b) == a); + fail |= cast(uint)(!t) << 10; + } + + /* ---- floating evaluation / conversion tests ---- */ + /* 12) conversion changes the meaning: cast(int)(x+y) vs cast(int)x + cast(int)y */ + { + double x = 1.6, y = 1.6; + t = ((cast(int)(x + y)) != (cast(int)x + cast(int)y)); /* 3 != 2 */ + fail |= cast(uint)(!t) << 11; + } + + /* 13) float vs double rounding differences (should differ on most IEEE-754 systems) */ + { + float xf = 16777217.0f; /* 2^24 + 1 cannot be represented in float */ + double xd = 16777217.0; /* representable exactly in double */ + t = ((cast(double)xf) != xd); + fail |= cast(uint)(!t) << 12; + } + + /* 14) (a+b)+c vs a+(b+c) can differ in floating-point */ + { + double a = 1e16, b = -1e16, c = 1.0; + double left = (a + b) + c; /* (1e16-1e16)+1 = 1 */ + double right = a + (b + c); /* 1e16+(-1e16+1) may round to 0 */ + t = (left != right); +// fail |= cast(uint)(!t) << 13; + } + + /* 15) multiplication/division reassociation differs for floats */ + { + double a = 1e308, b = 1e-308, c = 1e-308; + double left = (a * b) * c; + double right = a * (b * c); + /* one side likely underflows differently; we just expect "not always equal" */ + t = (left != right); +// fail |= cast(uint)(!t) << 14; + } + + if (fail) + printf("fail: x%x\n", fail); + assert(!fail); +} + +int main() +{ + arithmetic_expression_selftest(); + return 0; +} diff --git a/tests/dmd/runnable/cdvecfill.sh b/tests/dmd/runnable/cdvecfill.sh index 22de2926ae1..a83c5650cad 100644 --- a/tests/dmd/runnable/cdvecfill.sh +++ b/tests/dmd/runnable/cdvecfill.sh @@ -14,17 +14,17 @@ tmp_file=${RESULTS_TEST_DIR}/${TEST_NAME}.out obj_file=${RESULTS_TEST_DIR}/${TEST_NAME}.o if [ $OS == "linux" ] && [ $MODEL == "64" ]; then - $DMD -betterC -c -O -m64 ${src_file} -of${obj_file} + $DMD -betterC -c -O -m64 ${src_file} -of${obj_file} -check=nullderef=off objdump --disassemble --disassembler-options=intel ${obj_file} | tail -n+3 | sed 's/[ \t]\s*$//' > ${tmp_file} diff ${expect_file} ${tmp_file} rm_retry ${obj_file} ${tmp_file} - $DMD -betterC -c -O -m64 -mcpu=avx ${src_file} -of${obj_file} + $DMD -betterC -c -O -m64 -mcpu=avx ${src_file} -of${obj_file} -check=nullderef=off objdump --disassemble --disassembler-options=intel ${obj_file} | tail -n+3 | sed 's/[ \t]\s*$//' > ${tmp_file} diff ${expect_file_avx} ${tmp_file} rm_retry ${obj_file} ${tmp_file} - $DMD -betterC -c -O -m64 -mcpu=avx2 ${src_file} -of${obj_file} + $DMD -betterC -c -O -m64 -mcpu=avx2 ${src_file} -of${obj_file} -check=nullderef=off objdump --disassemble --disassembler-options=intel ${obj_file} | tail -n+3 | sed 's/[ \t]\s*$//' > ${tmp_file} diff ${expect_file_avx2} ${tmp_file} rm_retry ${obj_file} ${tmp_file} diff --git a/tests/dmd/runnable/dbitfields.d b/tests/dmd/runnable/dbitfields.d index aa154c7bbb2..c8ebdc8f87a 100644 --- a/tests/dmd/runnable/dbitfields.d +++ b/tests/dmd/runnable/dbitfields.d @@ -1,4 +1,4 @@ -/* REQUIRED_ARGS: -preview=bitfields +/* */ struct S diff --git a/tests/dmd/runnable/dbitfieldsdm.d b/tests/dmd/runnable/dbitfieldsdm.d new file mode 100644 index 00000000000..e18ad9abebb --- /dev/null +++ b/tests/dmd/runnable/dbitfieldsdm.d @@ -0,0 +1,196 @@ +/* test bitfields for Digital Mars + * Note that this test is for win32 only + * + * + * DISABLED: win32mscoff win64 linux freebsd osx + * RUN_OUTPUT: +--- + DM | MS | P32 | P64 +T0 = 1 1 || 1 1 | 1 1 | 1 1 | 1 1 +T1 = 2 2 || 2 2 | 2 2 | 2 2 | 2 2 +T2 = 4 4 || 4 4 | 4 4 | 4 4 | 4 4 +T3 = 16 8 || 16 8 | 16 8 | 8 4 | 8 8 +T4 = 16 8 || 16 8 | 16 8 | 12 4 | 16 8 +T5 = 16 8 || 16 8 | 16 8 | 8 4 | 8 8 +S1 = 8 8 || 8 8 | 8 8 | 4 4 | 8 8 +S2 = 4 4 || 4 4 | 4 4 | 4 4 | 4 4 +S3 = 8 4 || 8 4 | 8 4 | 4 4 | 4 4 +S4 = 8 4 || 8 4 | 8 4 | 4 4 | 4 4 +S5 = 8 4 || 8 4 | 8 4 | 4 4 | 4 4 +S6 = 2 2 || 2 2 | 2 2 | 2 2 | 2 2 +S7 = 16 8 || 16 8 | 16 8 | 4 4 | 8 8 +S8 = 4 2 || 4 2 | 4 2 | 2 2 | 2 2 +S8A = 4 2 || 4 2 | 4 2 | 2 2 | 2 2 +S8B = 6 2 || 6 2 | 6 2 | 2 2 | 2 2 +S8C = 8 4 || 8 4 | 8 4 | 4 4 | 4 4 +S9 = 4 2 || 4 2 | 4 2 | 4 2 | 4 2 +S10 = 1 1 || 0 0 | * * | 0 1 | 0 1 +S11 = 1 1 || 0 0 | 4 1 | 0 1 | 0 1 +S12 = 4 4 || 4 4 | 4 4 | 4 4 | 4 4 +S13 = 8 4 || 8 4 | 8 4 | 8 4 | 8 4 +S14 = 8 4 || 8 4 | 8 4 | 8 4 | 8 4 +S15 = 8 4 || 8 4 | 8 4 | 4 4 | 4 4 +S16 = 4 4 || 0 0 | 4 4 | 4 1 | 4 1 +S17 = 4 4 || 4 4 | 4 4 | 4 4 | 4 4 +S18 = 2 1 || 2 1 | 2 1 | 5 1 | 9 1 +A0 = 16 8 || 16 8 | 16 8 | 12 4 | 16 8 +A1 = 12 4 || 12 4 | 12 4 | 12 4 | 12 4 +A2 = 12 4 || 12 4 | 12 4 | 12 4 | 12 4 +A3 = 16 4 || 16 4 | 16 4 | 16 4 | 16 4 +A4 = 12 4 || 12 4 | 12 4 | 8 4 | 8 4 +A5 = 2 1 || 2 1 | 2 1 | 2 1 | 2 1 +A6 = 4 2 || 4 2 | 4 2 | 2 2 | 2 2 +A7 = 16 4 || 16 4 | 16 4 | 12 4 | 16 8 +A8 = 12 4 || 12 4 | 12 4 | 8 4 | 8 8 +A9 = 32 8 || 32 8 | 32 8 | 16 4 | 16 8 +A10 = 4 2 || 4 2 | 4 2 | 2 2 | 2 2 +A11 = 16 4 || 16 4 | 16 4 | 12 4 | 12 4 +S9 = x30200 +S14 = x300000201 +S15 = x201 +S18 = 1 should be 4 +A0 = x1 +--- + */ + +import core.stdc.stdio; + +int is64bit() { return size_t.sizeof == 8; } // otherwise assume 32 bit + +/*************************************************************/ + +struct T0 { ubyte x:1; }; // +struct T1 { short x:1; }; // +struct T2 { int x:1; }; // +struct T3 { ubyte a,b,c,d; long x:1; }; // +struct T4 { ubyte a,b,c,d,e,f,g,h; long x:1; }; // +struct T5 { ubyte a,b,c,d,e,f,g; long x:1; }; // +struct S1 { long f:1; }; // +struct S2 { int x:1; int y:1; }; // +struct S3 { short c; int x:1; uint y:1; }; // +struct S4 { int x:1; short y:1; }; // +struct S5 { short x:1; int y:1; }; // +struct S6 { short x:1; short y:1; }; // +struct S7 { short x:1; int y:1; long z:1; }; // +struct S8 { ubyte a; ubyte b:1; short c:2; }; // +struct S8A { ubyte b:1; short c:2; }; // +struct S8B { ubyte a; short b:1; ubyte c:2; }; // +struct S8C { ubyte a; int b:1; }; // +struct S9 { ubyte a; ubyte b:2; short c:9; }; // +struct S10 { }; // sizeof differs from C treatment +struct S11 { int :0; }; // sizeof differs from C treatment +struct S12 { int :0; int x; }; // +struct S13 { uint x:12; uint x1:1; uint x2:1; uint x3:1; uint x4:1; int w; }; // +struct S14 { ubyte a; ubyte b:4; int c:30; }; // +struct S15 { ubyte a; ubyte b:2; int c:9; }; // +struct S16 { int :32; }; // sizeof differs from C treatment +struct S17 { int a:32; }; // +struct S18 { ubyte a; long :0; ubyte b; }; // +struct A0 { int a; long b:34, c:4; }; // +struct A1 { int a; uint b:11; int c; }; // +struct A2 { int a; uint b:11, c:5, d:16; // + int e; }; +struct A3 { int a; uint b:11, c:5, :0, d:16; // + int e; }; +struct A4 { int a:8; short b:7; // + uint c:29; }; +struct A5 { ubyte a:7, b:2; }; // +struct A6 { ubyte a:7; short b:2; }; // +struct A7 { short a:8; int b:16; int c; // + ubyte d:7; }; +struct A8 { short a:8; int b:16; int :0; // + ubyte c:7; }; +struct A9 { ushort a:8; int b:16; // + uint c:29; long d:9; + uint e:2, f:31; }; +struct A10 { ushort a:8; ubyte b; }; // +struct A11 { ubyte a; int b:5, c:11, :0, d:8; // + struct { int ee:8; } }; + +int main() +{ + /* MS produces identical results for 32 and 64 bit compiles, + * DM is 32 bit only + */ + printf(" DM | MS | P32 | P64\n"); + printf("T0 = %2d %d || 1 1 | 1 1 | 1 1 | 1 1\n", cast(int)T0.sizeof, cast(int)T0.alignof); + printf("T1 = %2d %d || 2 2 | 2 2 | 2 2 | 2 2\n", cast(int)T1.sizeof, cast(int)T1.alignof); + printf("T2 = %2d %d || 4 4 | 4 4 | 4 4 | 4 4\n", cast(int)T2.sizeof, cast(int)T2.alignof); + printf("T3 = %2d %d || 16 8 | 16 8 | 8 4 | 8 8\n", cast(int)T3.sizeof, cast(int)T3.alignof); + printf("T4 = %2d %d || 16 8 | 16 8 | 12 4 | 16 8\n", cast(int)T4.sizeof, cast(int)T4.alignof); + printf("T5 = %2d %d || 16 8 | 16 8 | 8 4 | 8 8\n", cast(int)T5.sizeof, cast(int)T5.alignof); + printf("S1 = %2d %d || 8 8 | 8 8 | 4 4 | 8 8\n", cast(int)S1.sizeof, cast(int)S1.alignof); + printf("S2 = %2d %d || 4 4 | 4 4 | 4 4 | 4 4\n", cast(int)S2.sizeof, cast(int)S2.alignof); + printf("S3 = %2d %d || 8 4 | 8 4 | 4 4 | 4 4\n", cast(int)S3.sizeof, cast(int)S3.alignof); + printf("S4 = %2d %d || 8 4 | 8 4 | 4 4 | 4 4\n", cast(int)S4.sizeof, cast(int)S4.alignof); + printf("S5 = %2d %d || 8 4 | 8 4 | 4 4 | 4 4\n", cast(int)S5.sizeof, cast(int)S5.alignof); + printf("S6 = %2d %d || 2 2 | 2 2 | 2 2 | 2 2\n", cast(int)S6.sizeof, cast(int)S6.alignof); + printf("S7 = %2d %d || 16 8 | 16 8 | 4 4 | 8 8\n", cast(int)S7.sizeof, cast(int)S7.alignof); + printf("S8 = %2d %d || 4 2 | 4 2 | 2 2 | 2 2\n", cast(int)S8.sizeof, cast(int)S8.alignof); + printf("S8A = %2d %d || 4 2 | 4 2 | 2 2 | 2 2\n", cast(int)S8A.sizeof, cast(int)S8A.alignof); + printf("S8B = %2d %d || 6 2 | 6 2 | 2 2 | 2 2\n", cast(int)S8B.sizeof, cast(int)S8B.alignof); + printf("S8C = %2d %d || 8 4 | 8 4 | 4 4 | 4 4\n", cast(int)S8C.sizeof, cast(int)S8C.alignof); + printf("S9 = %2d %d || 4 2 | 4 2 | 4 2 | 4 2\n", cast(int)S9.sizeof, cast(int)S9.alignof); + printf("S10 = %2d %d || 0 0 | * * | 0 1 | 0 1\n", cast(int)S10.sizeof, cast(int)S10.alignof); // MS doesn't compile + printf("S11 = %2d %d || 0 0 | 4 1 | 0 1 | 0 1\n", cast(int)S11.sizeof, cast(int)S11.alignof); + printf("S12 = %2d %d || 4 4 | 4 4 | 4 4 | 4 4\n", cast(int)S12.sizeof, cast(int)S12.alignof); + printf("S13 = %2d %d || 8 4 | 8 4 | 8 4 | 8 4\n", cast(int)S13.sizeof, cast(int)S13.alignof); + printf("S14 = %2d %d || 8 4 | 8 4 | 8 4 | 8 4\n", cast(int)S14.sizeof, cast(int)S14.alignof); + printf("S15 = %2d %d || 8 4 | 8 4 | 4 4 | 4 4\n", cast(int)S15.sizeof, cast(int)S15.alignof); + printf("S16 = %2d %d || 0 0 | 4 4 | 4 1 | 4 1\n", cast(int)S16.sizeof, cast(int)S16.alignof); + printf("S17 = %2d %d || 4 4 | 4 4 | 4 4 | 4 4\n", cast(int)S17.sizeof, cast(int)S17.alignof); + printf("S18 = %2d %d || 2 1 | 2 1 | 5 1 | 9 1\n", cast(int)S18.sizeof, cast(int)S18.alignof); + printf("A0 = %2d %d || 16 8 | 16 8 | 12 4 | 16 8\n", cast(int)A0.sizeof, cast(int)A0.alignof); + printf("A1 = %2d %d || 12 4 | 12 4 | 12 4 | 12 4\n", cast(int)A1.sizeof, cast(int)A1.alignof); + printf("A2 = %2d %d || 12 4 | 12 4 | 12 4 | 12 4\n", cast(int)A2.sizeof, cast(int)A2.alignof); + printf("A3 = %2d %d || 16 4 | 16 4 | 16 4 | 16 4\n", cast(int)A3.sizeof, cast(int)A3.alignof); + printf("A4 = %2d %d || 12 4 | 12 4 | 8 4 | 8 4\n", cast(int)A4.sizeof, cast(int)A4.alignof); + printf("A5 = %2d %d || 2 1 | 2 1 | 2 1 | 2 1\n", cast(int)A5.sizeof, cast(int)A5.alignof); + printf("A6 = %2d %d || 4 2 | 4 2 | 2 2 | 2 2\n", cast(int)A6.sizeof, cast(int)A6.alignof); + printf("A7 = %2d %d || 16 4 | 16 4 | 12 4 | 16 8\n", cast(int)A7.sizeof, cast(int)A7.alignof); + printf("A8 = %2d %d || 12 4 | 12 4 | 8 4 | 8 8\n", cast(int)A8.sizeof, cast(int)A8.alignof); + printf("A9 = %2d %d || 32 8 | 32 8 | 16 4 | 16 8\n", cast(int)A9.sizeof, cast(int)A9.alignof); + printf("A10 = %2d %d || 4 2 | 4 2 | 2 2 | 2 2\n", cast(int)A10.sizeof, cast(int)A10.alignof); + printf("A11 = %2d %d || 16 4 | 16 4 | 12 4 | 12 4\n", cast(int)A11.sizeof, cast(int)A11.alignof); + + { + S9 s; + uint x; + *cast(uint *)&s = 0; + s.b = 2; s.c = 3; + x = *cast(uint *)&s; + printf("S9 = x%x\n", x); + } + { + S14 s = { 1, 2, 3 }; + ulong v; + *cast(long *)&s = 0; + s.a = 1; + s.b = 2; + s.c = 3; + v = *cast(ulong *)&s; + printf("S14 = x%llx\n", v); + } + { + S15 s = { 1,2,3 }; + uint x; + *cast(uint *)&s = 0; + s.a = 1; s.b = 2; s.c = 3; + x = *cast(uint *)&s; + printf("S15 = x%x\n", x); + } + { + S18 s; + printf("S18 = %d should be %d\n", cast(int)(&s.b - &s.a), is64bit() ? 8 : 4); + } + { + A0 s; + long x; + *cast(long *)&s = 0; + s.a = 1; s.b = 15; + x = *cast(long *)&s; + printf("A0 = x%llx\n", x); + } + + return 0; +} diff --git a/tests/dmd/runnable/dbitfieldsms.d b/tests/dmd/runnable/dbitfieldsms.d index 42157f7c7bb..70a72c19b76 100644 --- a/tests/dmd/runnable/dbitfieldsms.d +++ b/tests/dmd/runnable/dbitfieldsms.d @@ -1,5 +1,4 @@ /* test bitfields for Microsoft C - * REQUIRED_ARGS: -preview=bitfields * DISABLED: win32 linux freebsd openbsd osx * RUN_OUTPUT: --- diff --git a/tests/dmd/runnable/dbitfieldsposix32.d b/tests/dmd/runnable/dbitfieldsposix32.d index 33ef3acdb41..26e44d29fc8 100644 --- a/tests/dmd/runnable/dbitfieldsposix32.d +++ b/tests/dmd/runnable/dbitfieldsposix32.d @@ -1,5 +1,4 @@ /* test bitfields - * REQUIRED_ARGS: -preview=bitfields * DISABLED: win32 win64 linux64 freebsd64 openbsd64 osx64 * RUN_OUTPUT: --- diff --git a/tests/dmd/runnable/dbitfieldsposix64.d b/tests/dmd/runnable/dbitfieldsposix64.d index 7d9d87419ee..8ed3ae5fe44 100644 --- a/tests/dmd/runnable/dbitfieldsposix64.d +++ b/tests/dmd/runnable/dbitfieldsposix64.d @@ -1,5 +1,4 @@ /* test bitfields - * REQUIRED_ARGS: -preview=bitfields * DISABLED: win32 win64 linux32 freebsd32 openbsd32 osx32 LDC_not_x86 // LDC: these bad tests fail for non-Apple AArch64 targets * RUN_OUTPUT: --- diff --git a/tests/dmd/runnable/extra-files/gc19675.d b/tests/dmd/runnable/extra-files/gc19675.d new file mode 100644 index 00000000000..98b1302b12f --- /dev/null +++ b/tests/dmd/runnable/extra-files/gc19675.d @@ -0,0 +1,10 @@ +module gc19675; +import memory19675; + +class ManualGC +{ + GC.ProfileStats profileStats() + { + return typeof(return).init; + } +} diff --git a/tests/dmd/runnable/extra-files/main19675.d b/tests/dmd/runnable/extra-files/main19675.d new file mode 100644 index 00000000000..782469d8cb5 --- /dev/null +++ b/tests/dmd/runnable/extra-files/main19675.d @@ -0,0 +1,10 @@ +import gc19675; +import memory19675; + +void main() +{ + auto p = new ManualGC; + auto s = p.profileStats(); + auto s2 = GC.profileStats(); + assert(s.numCollections[0] == 0); +} diff --git a/tests/dmd/runnable/extra-files/memory19675.d b/tests/dmd/runnable/extra-files/memory19675.d new file mode 100644 index 00000000000..19ee7052aaf --- /dev/null +++ b/tests/dmd/runnable/extra-files/memory19675.d @@ -0,0 +1,16 @@ + +module memory19675; + +struct GC +{ + struct ProfileStats + { + size_t[10] numCollections; + } + static ProfileStats profileStats() + { + return typeof(return).init; + } + +} + diff --git a/tests/dmd/runnable/extra-files/sectiondefs.d b/tests/dmd/runnable/extra-files/sectiondefs.d new file mode 100644 index 00000000000..764057839ad --- /dev/null +++ b/tests/dmd/runnable/extra-files/sectiondefs.d @@ -0,0 +1,13 @@ +module extrafiles.sectiondefs; +import core.attribute; + +version(Windows) + enum PlatformEntryName(string Name) = "." ~ Name ~ "$N"; +else + enum PlatformEntryName(string Name) = Name; + +@section(PlatformEntryName!"myInts") +__gshared int anInt = 9; + +@section(PlatformEntryName!"my8Ints") +__gshared int[8] an8Int = [64, 72, 9, 81, 21, 59, 45, 2]; diff --git a/tests/dmd/runnable/fix20433.c b/tests/dmd/runnable/fix20433.c new file mode 100644 index 00000000000..0930db7491f --- /dev/null +++ b/tests/dmd/runnable/fix20433.c @@ -0,0 +1,15 @@ +//ImportC: typeof in initializer expression at function scope errors with "circular typeof definition" #20433 + + +#include +#include + +int x = sizeof(typeof(typeof(x))); // supported in C +int main() +{ + + int y = sizeof(typeof(y)); + assert(y == 4); + assert(x == 4); + +} diff --git a/tests/dmd/runnable/fix21925.c b/tests/dmd/runnable/fix21925.c new file mode 100644 index 00000000000..b3e8d0a89bd --- /dev/null +++ b/tests/dmd/runnable/fix21925.c @@ -0,0 +1,14 @@ +//https://github.com/dlang/dmd/issues/21925 + +#include +int a; +int a; +int a; +int a; +int a; + + +int main() +{ + assert(a == 0); // no duplicate symbol error +} diff --git a/tests/dmd/runnable/foreach5.d b/tests/dmd/runnable/foreach5.d index b0befcceb62..024db2a864c 100644 --- a/tests/dmd/runnable/foreach5.d +++ b/tests/dmd/runnable/foreach5.d @@ -1208,6 +1208,36 @@ void testLDC326() } } +/***************************************/ +// https://github.com/dlang/dmd/issues/22629 + +struct Collection2 +{ + this(ref Collection2) {} + + int opApply(int delegate(Collection2)) + { + return 0; + } +} + +Collection2 testForeach2(ref Collection2 level1, ref Collection2 level2) +{ + foreach (first; level1) { + foreach (second; level2) + return second; + } + + return Collection2(); +} + +void test22629() +{ + Collection2 c1, c2; + testForeach2(c1, c2); +} + + /***************************************/ int main() @@ -1241,6 +1271,7 @@ int main() test14653(); test17041(); testLDC326(); + test22629(); printf("Success\n"); return 0; diff --git a/tests/dmd/runnable/func.c b/tests/dmd/runnable/func.c new file mode 100644 index 00000000000..be556d1b718 --- /dev/null +++ b/tests/dmd/runnable/func.c @@ -0,0 +1,22 @@ +#include +#include +#include + +void foo() +{ + assert(strcmp(__FUNCTION__, "foo") == 0); + assert(strstr(__PRETTY_FUNCTION__, "foo")); // make room for runtime differences +} + +int bar(int a, int b) +{ + assert(strcmp(__FUNCTION__, "bar") == 0); + assert(strstr(__PRETTY_FUNCTION__, "bar")); // ditto for bar + return 0; +} + +int main() +{ + foo(); + return bar(4, 6); +} diff --git a/tests/dmd/runnable/gdb22590.c b/tests/dmd/runnable/gdb22590.c index afd57675097..8b8446820e6 100644 --- a/tests/dmd/runnable/gdb22590.c +++ b/tests/dmd/runnable/gdb22590.c @@ -1,5 +1,5 @@ /* -REQUIRED_ARGS: -g +REQUIRED_ARGS: -g -check=nullderef=off PERMUTE_ARGS: GDB_SCRIPT: --- diff --git a/tests/dmd/runnable/imports/pragmainline_a.d b/tests/dmd/runnable/imports/pragmainline_a.d new file mode 100644 index 00000000000..cc87fbba7dc --- /dev/null +++ b/tests/dmd/runnable/imports/pragmainline_a.d @@ -0,0 +1,45 @@ +module imports.pragmainline_a; + +pragma(inline, true) +int foo() +{ + return 1; +} + +pragma(inline, true) +auto bar() +{ + return &foo; +} + +mixin template LengthField(alias sym) +{ + pragma(inline, true) + size_t length() const + { + return sym.length; + } +} + +struct Data +{ + string data; + mixin LengthField!data; + + pragma(inline, true) + int opApply(scope int delegate(const Data) dg) { + return dg(this); + } +} + +pragma(inline, true) +int value() +{ + return 10; +} + +pragma(inline, true) +noreturn throws(T)(T param) +{ + throw new Exception(""); +} diff --git "a/tests/dmd/runnable/imports/\344\275\240\345\245\275.d" "b/tests/dmd/runnable/imports/\344\275\240\345\245\275.d" new file mode 100644 index 00000000000..e772fa18c1c --- /dev/null +++ "b/tests/dmd/runnable/imports/\344\275\240\345\245\275.d" @@ -0,0 +1,6 @@ +module imports.你好; + +int foo() +{ + return 0; +} diff --git a/tests/dmd/runnable/inline4.d b/tests/dmd/runnable/inline4.d new file mode 100644 index 00000000000..40c4553076d --- /dev/null +++ b/tests/dmd/runnable/inline4.d @@ -0,0 +1,397 @@ +struct S +{ + int a; + int b; + int c; + + bool test(int a_, int b_, int c_) inout + { + return a_ == a && b_ == b && c_ == c; + } +} + +__gshared S globalS = S(2, 3, 4); +__gshared S globalS2 = S(); +immutable S immutableS = S(9, 8, 7); + +S getVal() +{ + // Returns by value + return globalS; +} + +ref S getRef() +{ + // Returns by reference + return globalS; +} + +ref S getRefRvalue() __rvalue +{ + // Takes ownership of globalS + return globalS; +} + +S getImmutable() +{ + return immutableS; +} + +__gshared int globalDtorCount; + +struct D +{ + int d; + + this(D rhs) + { + d = rhs.d; + rhs.d = 0xdeadbeef; + } + + this(ref D rhs) + { + d = 12345; + } + + ~this() + { + if (d == 123456) + globalDtorCount++; + d = 0xdeadbeef; + } +} + +__gshared D globalD = D(123456); +__gshared D globalD2 = D(10000); + +void resetD() +{ + globalDtorCount = 0; + globalD.d = 123456; + globalD2.d = 10000; +} + +D getD() +{ + // Returns by value + return globalD; +} + +D getRvalueD() +{ + // Returns by moving globalD, but should not have reference semantics + // Tests if the inliner incorrectly applies reference semantics + return __rvalue(globalD); +} + +ref D getRefD() +{ + // Returns by reference + return globalD; +} + +ref D getRefRvalueD() __rvalue +{ + // Takes ownership of globalS + return globalD; +} + +/************************************/ +// Test inlining of return by value + +S funcVal1() +{ + return getVal(); +} + +S funcVal2() +{ + return getRef(); +} + +S funcVal3() +{ + return getRefRvalue(); +} + +S funcVal4() +{ + return globalS.a ? immutableS : globalS; +} + +S funcVal5() +{ + return globalS.a ? globalS : S(); +} + +D funcVal6() +{ + return getD(); +} + +D funcVal7() +{ + return getRvalueD(); +} + +D funcVal8() +{ + return getRefD(); +} + +D funcVal9() +{ + return getRefRvalueD(); +} + +D funcVal10() +{ + return __rvalue(globalS.a ? globalD : D()); +} + +void consumeD(D d) {} + +void testValueReturn() +{ + // Returning by value should not change the source object + getVal().a++; + assert(globalS.test(2, 3, 4)); + getImmutable().a++; + assert(immutableS.test(9, 8, 7)); + funcVal1().a++; + assert(globalS.test(2, 3, 4)); + funcVal2().c++; + assert(globalS.test(2, 3, 4)); + funcVal3().c++; + assert(globalS.test(2, 3, 4)); + funcVal4().a++; + assert(immutableS.test(9, 8, 7)); + funcVal5().a++; + assert(globalS.test(2, 3, 4)); + + consumeD(getD()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(__rvalue(getD())); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(getRvalueD()); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(__rvalue(getRvalueD())); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(funcVal6()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(__rvalue(funcVal6())); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(funcVal7()); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(__rvalue(funcVal7())); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(funcVal8()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(__rvalue(funcVal8())); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(funcVal9()); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(__rvalue(funcVal9())); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + resetD(); + + consumeD(funcVal10()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + consumeD(__rvalue(funcVal10())); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); +} + + +/************************************/ +// Test inlining of return by reference + +ref S funcRef1() +{ + return getRef(); +} + +ref S funcRef2() +{ + + return globalS.a ? globalS : globalS2; +} + +ref D funcRef3() +{ + return getRefD(); +} + +ref D funcRef4() +{ + return __rvalue(globalS.a ? globalD : globalD2); +} + +void consumeRefD(ref D d) +{ + assert(d.d == 123456); + consumeD(__rvalue(d)); + assert(d.d == 0xdeadbeef); +} + +void testRefReturn() +{ + // Returning by ref should mutate the source object + funcRef1().a++; + assert(globalS.test(3, 3, 4)); + funcRef2().c++; + assert(globalS.test(3, 3, 5)); + + // Passing ref to value parameter should trigger a copy + resetD(); + consumeD(funcRef3()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + + // ... but not if there is __rvalue + consumeD(__rvalue(funcRef3())); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + + // ditto + resetD(); + consumeD(funcRef4()); + assert(globalD.d == 123456); + assert(globalDtorCount == 0); + consumeD(__rvalue(funcRef4())); + assert(globalD.d == 0xdeadbeef); + assert(globalDtorCount == 1); + + resetD(); + consumeRefD(funcRef3()); + + resetD(); + consumeRefD(funcRef4()); +} + +/************************************/ +// Test inlining of return by rvalue reference + +ref S funcRvalueRef1() __rvalue +{ + return getRef(); +} + +ref S funcRvalueRef2() __rvalue +{ + return globalS.a ? globalS : globalS2; +} + +ref D funcRvalueRef3() __rvalue +{ + return getRefD(); +} + +ref D funcRvalueRef4() __rvalue +{ + return globalS.a ? globalD : globalD2; +} + +void consumeRvalueRefD(D d) +{ + assert(d.d == 123456); + consumeD(__rvalue(d)); + assert(d.d == 0xdeadbeef); +} + +void testRvalueRefReturn() +{ + // rvalue ref is ref + funcRvalueRef1().a++; + assert(globalS.test(4, 3, 5)); + funcRvalueRef2().c++; + assert(globalS.test(4, 3, 6)); + + resetD(); + consumeRvalueRefD(funcRvalueRef3()); + + resetD(); + consumeRvalueRefD(funcRvalueRef4()); +} + +/************************************/ +// https://github.com/dlang/dmd/issues/22157 +class Test22157 +{ + override string toString() + { + auto e = { return cast() super; } (); + return null; + } +} + +/************************************/ +// https://issues.dlang.org/show_bug.cgi?id=22089 + +struct S22089 +{ + @disable this(ref return scope typeof(this) rhs); + @disable this(this); + void* cons; + this(int i) + { + cons = cast(void*)&this; + } + void start() + { + void* s = cast(void*)&this; + assert(cons == s); + } +} + +auto fun22089() +{ + return S22089(42); +} + +void test22089() +{ + auto op = fun22089(); + op.start(); +} + +/************************************/ + +void main() +{ + testValueReturn(); + testRefReturn(); + testRvalueRefReturn(); + test22089(); +} diff --git a/tests/dmd/runnable/issue20578.d b/tests/dmd/runnable/issue20578.d new file mode 100644 index 00000000000..899dc3a8eb9 --- /dev/null +++ b/tests/dmd/runnable/issue20578.d @@ -0,0 +1,14 @@ +// REQUIRED_ARGS: -inline + +int fun(string[]) +{ + if (false) + static foreach(m; [1,2,3] ) { } + + return 0; +} + +int main(string[] args) +{ + return fun(args); +} diff --git a/tests/dmd/runnable/issue22069.d b/tests/dmd/runnable/issue22069.d new file mode 100644 index 00000000000..41a94a9b1e2 --- /dev/null +++ b/tests/dmd/runnable/issue22069.d @@ -0,0 +1,27 @@ +// REQUIRED_ARGS: -O +// https://github.com/dlang/dmd/issues/22069 + +int recurse(int* i) +{ + L1: + int j = 0; + int* p = &j; + + if (*i) + { + return recurse(p); + } + else + { + if (p is i) + assert(0); + else + return j; + } +} + +void main() +{ + int i = 1; + recurse(&i); +} diff --git a/tests/dmd/runnable/issue22481.d b/tests/dmd/runnable/issue22481.d new file mode 100644 index 00000000000..bbd0338f0e2 --- /dev/null +++ b/tests/dmd/runnable/issue22481.d @@ -0,0 +1,18 @@ +// REQUIRED_ARGS: -inline + +int v; + +void f() +{ + for (int i = 1; i < 5; i++) + { + v = i; + return; + } +} + +void main() +{ + f(); + assert(v == 1); +} diff --git a/tests/dmd/runnable/issue22621.d b/tests/dmd/runnable/issue22621.d new file mode 100644 index 00000000000..e596341c630 --- /dev/null +++ b/tests/dmd/runnable/issue22621.d @@ -0,0 +1,40 @@ +// Test for Issue 22621 +// Destructor should not be called on uninitialized overlapped field + +int dtorCalls = 0; + +struct D +{ + int magic = 0xC0FFEE; + + ~this() @safe + { + // d's destructor should NOT be called, + // while dd's destructor should be called. + dtorCalls++; + assert(magic == 0xC0FFEE, "Destructor called on uninitialized field!"); + } +} + +struct SUS +{ + union { + struct { + D d; + } + uint b; + } + D dd; +} + +void main() +{ + { + // Initialize only 'b', not 'd' + // Without the fix, d's destructor would be called on garbage memory + SUS sus = SUS(b:0xDEADBEEF); + } + + // Just dd's destructor should be called, so dtorCalls should be 1 + assert(dtorCalls == 1, "Destructor was incorrectly called!"); +} diff --git a/tests/dmd/runnable/issue22639.d b/tests/dmd/runnable/issue22639.d new file mode 100644 index 00000000000..4a1a99faafd --- /dev/null +++ b/tests/dmd/runnable/issue22639.d @@ -0,0 +1,35 @@ +// REQUIRED_ARGS: -betterC + +struct Arr(T, int CAPACITY) +{ + int count = 0; + T[CAPACITY] items; + int opApply(scope int delegate(T) dg) + { + int result; + for (int i = 0; i < count; i++) + if ((result = dg(items[i])) != 0) + break; + return result; + } +} + +struct Foo {} +struct Bar { + Arr!(Foo*, 32) array; + Foo* get() + { + foreach(Foo* it; array) + { + return it; + } + return null; + } +} + +Foo* foo; +Bar bar; +extern(C) void main() +{ + foo = bar.get(); +} diff --git a/tests/dmd/runnable/mars1.d b/tests/dmd/runnable/mars1.d index 27d722b02c3..4a976de14b5 100644 --- a/tests/dmd/runnable/mars1.d +++ b/tests/dmd/runnable/mars1.d @@ -9,6 +9,31 @@ template tuple(A...) { alias tuple = A; } /////////////////////// +void testIntegralPromotions() +{ + uint uconv1(int q, ubyte p) { return p; } assert(uconv1(0,0xFF) == 0xFF); + uint uconv2(int q, ushort p) { return p; } assert(uconv2(0,0xFFFF) == 0xFFFF); + uint uconv3(int q, uint p) { return p; } assert(uconv3(0,0xFFFF_FFFF) == 0xFFFF_FFFF); + //uint uconv4(int q, ulong p) { return p; } + + ulong uconv5(int q, ubyte p) { return p; } assert(uconv5(0,0xFF) == 0xFF); + ulong uconv6(int q, ushort p) { return p; } assert(uconv6(0,0xFFFF) == 0xFFFF); + ulong uconv7(int q, uint p) { return p; } assert(uconv7(0,0xFFFF_FFFF) == 0xFFFF_FFFF); + ulong uconv8(int q, ulong p) { return p; } assert(uconv8(0,0xFFFF_FFFF_FFFF_FFFF) == 0xFFFF_FFFF_FFFF_FFFF); + + uint sconv1(int q, byte p) { return p; } assert(sconv1(0,cast(byte)0xFF) == 0xFFFF_FFFF); + uint sconv2(int q, short p) { return p; } assert(sconv2(0,cast(short)0xFFFF) == 0xFFFF_FFFF); + uint sconv3(int q, int p) { return p; } assert(sconv3(0,0xFFFF_FFFF) == 0xFFFF_FFFF); + //uint sconv4(int q, long p) { return p; } + + ulong sconv5(int q, byte p) { return p; } assert(sconv5(0,cast(byte)0xFF) == 0xFFFF_FFFF_FFFF_FFFF); + ulong sconv6(int q, short p) { return p; } assert(sconv6(0,cast(short)0xFFFF) == 0xFFFF_FFFF_FFFF_FFFF); + ulong sconv7(int q, int p) { return p; } assert(sconv7(0,0xFFFF_FFFF) == 0xFFFF_FFFF_FFFF_FFFF); + ulong sconv8(int q, long p) { return p; } assert(sconv8(0,0xFFFF_FFFF_FFFF_FFFF) == 0xFFFF_FFFF_FFFF_FFFF); +} + +/////////////////////// + // https://github.com/dlang/dmd/pull/11441 long sdiv1(long l) @@ -2584,6 +2609,8 @@ void test10() int main() { + testIntegralPromotions(); + // All the various integer divide tests testsdiv2(); testulldiv(); diff --git a/tests/dmd/runnable/minimal2.d b/tests/dmd/runnable/minimal2.d index 7319463e920..af8fdf4fb16 100644 --- a/tests/dmd/runnable/minimal2.d +++ b/tests/dmd/runnable/minimal2.d @@ -1,5 +1,5 @@ // DFLAGS: -// REQUIRED_ARGS: -defaultlib= +// REQUIRED_ARGS: -defaultlib= -check=nullderef=off // EXTRA_SOURCES: extra-files/minimal/object.d // This test ensures that interfaces and classes can be used in a minimal diff --git a/tests/dmd/runnable/nested.d b/tests/dmd/runnable/nested.d index 4c99c59e8a9..89617de5809 100644 --- a/tests/dmd/runnable/nested.d +++ b/tests/dmd/runnable/nested.d @@ -2526,6 +2526,27 @@ void test14846() foo14846({ S* p = new S(1); }); foo14846({ S[] a = [S()]; }); foo14846({ S[] a = [S(1)]; }); + + void named1() + { + S s; + } + + foo14846(&named1); + + void named2() + { + S s = S(1); + } + + foo14846(&named2); + + void named3() + { + S[3] s; + } + + foo14846(&named3); } /*******************************************/ diff --git a/tests/dmd/runnable/noreturn2.d b/tests/dmd/runnable/noreturn2.d index 79ed74e8466..929dc121176 100644 --- a/tests/dmd/runnable/noreturn2.d +++ b/tests/dmd/runnable/noreturn2.d @@ -103,20 +103,30 @@ void testAccess() { enum msg = "Accessed expression of type `noreturn`"; - // FIXME: Another assertion failure in the backend trying to generate noreturn.sizeof = 0 byte assignment - version (FIXME) - testAssertFailure(__LINE__ + 3, msg, function noreturn() + testAssertFailure(__LINE__ + 3, msg, { noreturn a; noreturn b = a; }); - if (false) // read does not assert! - testAssertFailure(__LINE__ + 3, msg, function noreturn() + testAssertFailure(__LINE__ + 3, msg, { noreturn a; int b = a; - assert(false, "Unreachable!"); // Statement above not detected as noreturn + }); + + testAssertFailure(__LINE__ + 4, msg, + { + noreturn a; + auto p = &a; // OK + int b = *p; + }); + + testAssertFailure(__LINE__ + 4, msg, + { + noreturn a; + ref r = a; // OK, reads &a + int b = r; // asserts }); testAssertFailure(__LINE__ + 2, msg, function noreturn() @@ -124,21 +134,21 @@ void testAccess() cast(noreturn) 1; }); - version (FIXME) - testAssertFailure(__LINE__ + 3, msg, function noreturn() + testAssertFailure(__LINE__ + 3, msg, { noreturn a; noreturn b = cast(noreturn) 1; }); - if (false) // Read does not assert testAssertFailure(__LINE__ + 3, msg, function noreturn() { noreturn a; return a; }); - if (false) // Read does not assert + // FIXME: assertion failure in the backend in paramsize() - noreturn.sizeof = 0 + // https://github.com/dlang/dmd/issues/20286 + version (FIXME) testAssertFailure(__LINE__ + 4, msg, function noreturn() { static void foo(noreturn) {} @@ -146,6 +156,38 @@ void testAccess() foo(a); assert(false, "Unreachable!"); // Ditto }); + + testAssertFailure(__LINE__ + 5, msg, + { + static fv(int) {} + static fr(ref noreturn a) + { + fv(a); // asserts + } + noreturn a; + fr(a); // OK, passes &a + }); + + testAssertFailure(__LINE__ + 3, msg, + { + noreturn v; + auto id = typeid(v); + }); + + // test condition + testAssertFailure(__LINE__ + 3, msg, + { + noreturn v; + if (v) + return; + }); + + // https://github.com/dlang/dmd/issues/22430 + testAssertFailure(__LINE__ + 3, msg, + { + noreturn a; + auto b = true ? a : 1; + }); } /*****************************************/ diff --git a/tests/dmd/runnable/nullderefcheck.d b/tests/dmd/runnable/nullderefcheck.d new file mode 100644 index 00000000000..b2b6af18f8c --- /dev/null +++ b/tests/dmd/runnable/nullderefcheck.d @@ -0,0 +1,38 @@ +// REQUIRED_ARGS: -check=nullderef=on +// PERMUTE_ARGS: + +struct Struct +{ + int field; +} + +void aLazyFunc(lazy int val) +{ + int storage = val; +} + +void main() +{ + wrap!(() { Struct* ptr; int val = ptr.field; })(__LINE__); + wrap!(() { int* ptr; int val = *ptr; })(__LINE__); + wrap!(() { Object ptr; auto del = &ptr.toString; del(); })(__LINE__); + wrap!(() { Object obj; obj.toString(); })(__LINE__); + wrap!(() { void function() func; func(); })(__LINE__); + wrap!(() { void delegate() del; del(); })(__LINE__); + + int val = 2; + val.aLazyFunc(); +} + +void wrap(alias test)(int expectedLine) +{ + try + { + test(); + assert(0); + } + catch (Error e) + { + assert(e.line == expectedLine); + } +} diff --git a/tests/dmd/runnable/opcolon.d b/tests/dmd/runnable/opcolon.d new file mode 100644 index 00000000000..554d542b900 --- /dev/null +++ b/tests/dmd/runnable/opcolon.d @@ -0,0 +1,24 @@ +// REQUIRED_ARGS: -betterC + +/* This test triggers an address miscalculation bug in DMD 2.111 + * with -inline. + * May not crash if the data segment has a different layout, + * e.g. when pasted into another file. + */ + +struct S { + int i; +} + +__gshared S gs = S(1); +ref S get() +{ + return gs; +} + +extern (C) +int main() +{ + (get().i ? get() : get()).i++; + return 0; +} diff --git a/tests/dmd/runnable/opover3.d b/tests/dmd/runnable/opover3.d index 71468262553..98001401691 100644 --- a/tests/dmd/runnable/opover3.d +++ b/tests/dmd/runnable/opover3.d @@ -169,6 +169,31 @@ struct S12124 // speculative opCall instantiation for diagnostic message should not cause false errors } +/**************************************/ +// https://github.com/dlang/dmd/issues/20927 + +struct NoStatic0 { auto opCall() => 2; } +struct NoStatic1 { int x; NoStatic1 opCall() => NoStatic1(3); } + +struct Yes0 { static opCall() => 2; } +struct Yes1 { static opCall()() => 2; } +struct Yes2 +{ + auto call()(int x) => this.init; + template call() { static call() => 2; } + alias opCall = call; +} + +void test20927() +{ + assert(NoStatic0() == NoStatic0.init); + assert(NoStatic1()() == NoStatic1(3)); + + assert(Yes0() == 2); + assert(Yes1() == 2); + assert(Yes2() == 2); +} + /**************************************/ void main() @@ -181,4 +206,5 @@ void main() test3c(); test4(); test12070(); + test20927(); } diff --git a/tests/dmd/runnable/overload.d b/tests/dmd/runnable/overload.d index c413ade029a..40fb4729e37 100644 --- a/tests/dmd/runnable/overload.d +++ b/tests/dmd/runnable/overload.d @@ -1262,6 +1262,23 @@ void test21522() /***************************************************/ +// https://github.com/dlang/dmd/issues/21920 + +struct S21920 +{ + void funB2(char a) {} + void funB(int b) {} + alias funB = funB2; + void funB()(float t) {} +} + +void test21920() +{ + static assert(__traits(getOverloads, S21920, "funB", true).length == 3); +} + +/***************************************************/ + int main() { test1528a(); @@ -1298,6 +1315,7 @@ int main() test14965(); test21481(); test21522(); + test21920(); printf("Success\n"); return 0; diff --git a/tests/dmd/runnable/pragmainline.d b/tests/dmd/runnable/pragmainline.d new file mode 100644 index 00000000000..f71c4b08c0a --- /dev/null +++ b/tests/dmd/runnable/pragmainline.d @@ -0,0 +1,61 @@ +// REQUIRED_ARGS: -wi +// EXTRA_FILES: imports/pragmainline_a.d +/* TEST_OUTPUT: +--- +--- +*/ + + +import imports.pragmainline_a; + +auto anonclass() +{ + return new class { + pragma(inline, true) + final size_t foo() + { + return value(); + } + }; +} + +auto testAlwaysInline() +{ + size_t var; + + foreach (d; Data("string")) + { + var = d.length(); + } + + assert(var == 6); + + var = anonclass().foo(); + + assert(var == 10); + + auto nested = (size_t i) { + return i - value(); + }; + + var = nested(var); + + assert(var == 0); +} + +void main() +{ + immutable baz = () => 1; + assert(foo() == bar()()); + assert(foo() == baz()); + assert(bar()() == baz()); + + testAlwaysInline(); + + bool caught = false; + try + throws(throws(1)); + catch (Exception e) + caught = true; + assert(caught); +} diff --git a/tests/dmd/runnable/real_to_float.d b/tests/dmd/runnable/real_to_float.d new file mode 100644 index 00000000000..7d42b52f32a --- /dev/null +++ b/tests/dmd/runnable/real_to_float.d @@ -0,0 +1,70 @@ +/* The test related to https://github.com/dlang/dmd/issues/22322 + * The issue title: + * "converting real to float uses double rounding for 64-bit code + * causing unexpected results" + */ + +pragma(inline, false) +void test22322(real r) +{ + assert(r == 0x1.000002fffffffcp-1); + double d = r; + assert(d == 0x1.000003p-1); + float f = r; + assert(f == 0x1.000002p-1); + float fd = d; + assert(fd == 0x1.000004p-1); + real rd = d; + assert(rd == 0x1.000003p-1); + float frd = rd; + assert(frd == 0x1.000004p-1); +} + +// https://github.com/dlang/dmd/issues/18316 +pragma(inline, false) +void test18316(real closest) +{ + // Approximations to pi^2, accurate to 18 digits: + // real closest = 0x9.de9e64df22ef2d2p+0L; + real next = 0x9.de9e64df22ef2d3p+0L; + assert(closest != next); + + // A literal with 23 digits maps to the correct + // representation. + real dig23 = 9.86960_44010_89358_61883_45L; + assert (dig23 == closest); + + // 22 digits should also be (more than) sufficient, + // but no... + real dig22 = 9.86960_44010_89358_61883_5L; + assert (dig22 == closest); // Fails; should pass +} + +// https://github.com/dlang/dmd/issues/19733 +pragma(inline, false) +void test19733(real r) +{ + assert(r == 0x1FFFFFFFFFFFFFFFDp0L); +} + +pragma(inline, false) +void testDenormal(real rx) +{ + enum rd = 8.4052578577802337657e-4933L; + real r1 = rx; + real r2 = rd; + assert(r1 > 0); + assert(r1 == r2); +} + +void main() +{ + static if (real.mant_dig == 64) + { + // values must be passed to non-inlineable function to avoid "optimization" to double + test22322(0.5000000894069671353303618843710864894092082977294921875); + test18316(0x9.de9e64df22ef2d2p+0L); + test19733(36893488147419103229.0L); + testDenormal(0x1p-16384L); + } +} diff --git a/tests/dmd/runnable/rvalue1.d b/tests/dmd/runnable/rvalue1.d index 2592f2a9e95..78c50919899 100644 --- a/tests/dmd/runnable/rvalue1.d +++ b/tests/dmd/runnable/rvalue1.d @@ -1,4 +1,4 @@ -/* PERMUTE_ARGS: -preview=rvaluerefparam +/* REQUIRED_ARGS: -preview=rvaluerefparam /* testing __rvalue */ import core.stdc.stdio; @@ -242,6 +242,87 @@ void test10() assert(s.p.s == "hello"); } +/********************************/ +// https://github.com/dlang/dmd/issues/22111 + +__gshared int copyCount11; +__gshared int moveCount11; +__gshared int dtorCount11; + +struct S11 +{ + int i; + this(S11 rhs) { moveCount11++; } + this(ref S rhs) { copyCount11++; } + ~this() { dtorCount11++; } +} + +__gshared S11 s11obj; + +ref S11 refS11() { return s11obj; } +ref S11 moveS11() __rvalue { return s11obj; } +S11 copyRefS11() { return __rvalue(refS11()); } +S11 copyMoveS11() { return moveS11(); } + +void test11() +{ + copyRefS11(); + assert(copyCount11 == 0 && moveCount11 == 1 && dtorCount11 == 2); + moveCount11 = dtorCount11 = 0; + copyMoveS11(); + assert(copyCount11 == 0 && moveCount11 == 1 && dtorCount11 == 2); +} + +/********************************/ + +struct S12{ + S12* ptr; + this(int) { ptr = &this; } + this(ref inout S12) { ptr = &this; } + this(S12) { ptr = &this; } +} + +struct V12 +{ + S12 s; + this(int) { s = S12(1); } + int opApply(int delegate(Object)) { return 0; } +} + +S12 foo12() +{ + return __rvalue(V12(1).s); +} + +S12 bar12() +{ + S12 s = S12(1); // NRVO + foreach (_; V12(1)) + return s; + return s; +} + +S12 baz12() +{ + S12 s1 = S12(1); + S12 s2 = S12(1); // No NRVO + foreach (_; V12(1)) + return s1; + return s2; +} + +void test12() +{ + S12 s = foo12(); + assert(&s == s.ptr); + + S12 s2 = bar12(); + assert(&s2 == s2.ptr); + + S12 s3 = baz12(); + assert(&s3 == s3.ptr); +} + /********************************/ int main() @@ -255,6 +336,9 @@ int main() test7(); test8(); test9(); + test10(); + test11(); + test12(); return 0; } diff --git a/tests/dmd/runnable/sctor.d b/tests/dmd/runnable/sctor.d index b587e6efe80..ad418d4d176 100644 --- a/tests/dmd/runnable/sctor.d +++ b/tests/dmd/runnable/sctor.d @@ -465,6 +465,42 @@ void test19389() assert(bar.b.x == 7); // fails } +/***************************************************/ +// https://github.com/dlang/dmd/issues/22604 + +struct S22604 +{ + S22604* ptr; + + this(int) + { + ptr = &this; + } + + this(this) + { + ptr = &this; + } +} + +struct T22604 +{ + S22604 a, b, c, d; + + this(int) + { + a = b = c = d = S22604(1); + } +} + +void test22604() +{ + T22604 t = T22604(1); + assert(t.a.ptr is &t.a); + assert(t.b.ptr is &t.b); + assert(t.c.ptr is &t.c); + assert(t.d.ptr is &t.d); +} /***************************************************/ @@ -478,6 +514,7 @@ int main() test14944(); test15869(); test19389(); + test22604(); printf("Success\n"); return 0; diff --git a/tests/dmd/runnable/sectiondefs.d b/tests/dmd/runnable/sectiondefs.d new file mode 100644 index 00000000000..a94a636c038 --- /dev/null +++ b/tests/dmd/runnable/sectiondefs.d @@ -0,0 +1,121 @@ +/* +EXTRA_SOURCES: extra-files/sectiondefs.d +EXTRA_FILES: extra-files/sectiondefs.d +REQUIRED_ARGS(windows): -L/INCREMENTAL:NO +*/ +// Incremental linking must be turned off, or it will add padding. +module sectiondefs; +import core.attribute; + +version (ELFv1) + version = ELF; +else version (ELFv2) + version = ELF; + +version(Windows) + enum PlatformEntryName(string Name) = "." ~ Name ~ "$N"; +else + enum PlatformEntryName(string Name) = Name; + +mixin template SectionRange(string SectionName, Type) +{ + version (OSX) + { + enum Segment = (is(Type == const) || is(Type == immutable)) ? "__TEXT" : "__DATA"; + + extern(C) extern __gshared + { + pragma(mangle, "section$start$" ~ Segment ~ "$" ~ SectionName) + Type start; + pragma(mangle, "section$end$" ~ Segment ~ "$" ~ SectionName) + Type end; + } + } + else version (ELF) + { + extern(C) extern __gshared + { + pragma(mangle, "__start_" ~ SectionName) + Type start; + pragma(mangle, "__stop_" ~ SectionName) + Type end; + } + } + else version (Windows) + { + __gshared + { + @section("." ~ SectionName ~ "$A") + Type _head; + + @section("." ~ SectionName ~ "$Z") + Type _tail; + } + + Type* start() + { + return &_head + 1; + } + + Type* end() + { + return &_tail; + } + } + + Type[] range() + { + version (Windows) + return start()[0 .. end() - start()]; + else + return (&start)[0 .. (&end - &start)]; + } +} + +mixin SectionRange!("myInts", int) myIntsSection; +mixin SectionRange!("my8Ints", int[8]) my8IntsSection; + +@section(PlatformEntryName!"myInts") +__gshared int anInt = 2; + +@section(PlatformEntryName!"my8Ints") +__gshared int[8] an8Int = [46, 92, 11, 7, 2, 55, 33, 22]; + +void main() +{ + //int dummy = anInt, dummy8 = an8Int[0]; + + version(none) + { + import core.stdc.stdio; + printf("=========== sectiondefs tests ================\n"); + printf("myInts %p %zd\n", myIntsSection.range.ptr, myIntsSection.range.length); + printf("my8IntsSection %p %zd\n", my8IntsSection.range.ptr, my8IntsSection.range.length); + + version (Windows) + printf("start %p %p\n", myIntsSection.start(), my8IntsSection.start()); + else + printf("start %p %p\n", &myIntsSection.start, &my8IntsSection.start); + + version (Windows) + printf("end %p %p\n", myIntsSection.end(), my8IntsSection.end()); + else + printf("end %p %p\n", &myIntsSection.end, &my8IntsSection.end); + + printf("- "); + foreach (v; myIntsSection.range) + printf("%d, ", v); + printf("\n-\n"); + foreach(v; my8IntsSection.range) + printf(" - [%d, %d, %d, %d, %d, %d, %d, %d],\n", v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7]); + printf("\n"); + } + + assert(myIntsSection.range == [2, 9] || myIntsSection.range == [9, 2]); + + assert(my8IntsSection.range == [ + [46, 92, 11, 7, 2, 55, 33, 22], [64, 72, 9, 81, 21, 59, 45, 2] + ] || my8IntsSection.range == [ + [64, 72, 9, 81, 21, 59, 45, 2], [46, 92, 11, 7, 2, 55, 33, 22] + ]); +} diff --git a/tests/dmd/runnable/staticarray.d b/tests/dmd/runnable/staticarray.d new file mode 100644 index 00000000000..39cfb0a439a --- /dev/null +++ b/tests/dmd/runnable/staticarray.d @@ -0,0 +1,83 @@ +void main() +{ + int[3] arr1 = [1,2,3]; + int[$] arr2 = [1,2,3]; + const(int)[$] arr13 = [1,2,3]; + assert(arr1.length == 3); + assert(arr2.length == 3); + assert(arr13.length == 3); + static assert(arr2.length == 3); + static assert(arr13.length == 3); + static assert(is(typeof(arr13) == const(int)[3])); + assert(arr1 == arr2); + + int[$] arr3 = [10] ~ [20]; + assert(arr3.length == 2); + assert(arr3[0] == 10); + assert(arr3[1] == 20); + static assert(arr3.length == 2); + + int[$] arrConcatA = [2]; + int[$] arrConcatB = [2]; + int[$] arrConcatC = arrConcatA ~ arrConcatB; + assert(arrConcatC.length == 2); + assert(arrConcatC[0] == 2); + assert(arrConcatC[1] == 2); + static assert(arrConcatC.length == 2); + static assert(is(typeof(arrConcatC) == int[2])); + + int[$][$] arr4 = [[10], [10]]; + assert(arr4.length == 2); + assert(arr4[0].length == 1); + static assert(arr4.length == 2); + static assert(arr4[0].length == 1); + + static assert(!__traits(compiles, + { + int[$] arr5 = 3; + })); + + static assert(!__traits(compiles, + { + int[$] arr6 = new int[2]; + })); + + int[N] arrn(size_t N)() + { + int[N] res; + return res; + } + int[$] arr7 = arrn!(2)(); + assert(arr7.length == 2); + static assert(arr7.length == 2); + + int[2][$] arr8 = [[1, 2], [3, 4], [5, 6]]; + assert(arr8.length == 3); + assert(arr8[0].length == 2); + static assert(arr8.length == 3); + static assert(arr8[0].length == 2); + + int[$][$][$] arr9 = [[[1, 2]], [[3, 4]]]; + assert(arr9.length == 2); + assert(arr9[0].length == 1); + assert(arr9[0][0].length == 2); + static assert(arr9.length == 2); + static assert(arr9[0].length == 1); + static assert(arr9[0][0].length == 2); + + static assert(!__traits(compiles, + { + float[$] arr10 = 3.0f; + })); + + static assert(!__traits(compiles, + { + string[$] arr11 = "abc"; + })); + + char[$] arr12 = "abc"; + assert(arr12.length == 3); + assert(arr12[0] == 'a'); + assert(arr12[1] == 'b'); + assert(arr12[2] == 'c'); +} diff --git a/tests/dmd/runnable/stress.d b/tests/dmd/runnable/stress.d index 66373c4270d..078041aced0 100644 --- a/tests/dmd/runnable/stress.d +++ b/tests/dmd/runnable/stress.d @@ -2,8 +2,6 @@ // PERMUTE_ARGS: import core.stdc.stdio : printf; -import std.string : splitLines; -import std.utf : toUTF16, toUTF32; /***********************************************/ @@ -106,19 +104,6 @@ void MDCHAR() foreach(char[] s; str) { tmp = tmp ~ s; } - - foreach(s; splitLines(cast(string)tmp)) { - size_t lstart; - foreach(size_t idx, char c; s) { - if(c == '\n') { - if(s[lstart..idx] != "TEST LINE") { - printf("Error testing character array\n"); - break; - } - lstart = idx + 1; - } - } - } } void CHAR() @@ -151,24 +136,6 @@ void WCHAR() const int ITERS = 1000; alias wchar typ; typ[] str; - - for(int idx = 0; idx < ITERS; idx++) { - str = str ~ toUTF16(cast(char[])"TEST LINE\n"); - } - - if(str.length != (ITERS * 10)) printf("Length Error: %zd\n",str.length); - if(str.sizeof != (typ[]).sizeof) printf("Size Error: %zd\n",str.sizeof); - - size_t lstart; - foreach(size_t idx, char c; str) { - if(c == '\n') { - if(str[lstart..idx] != toUTF16(cast(char[])"TEST LINE")) { - printf("Error testing character array\n"); - break; - } - lstart = idx + 1; - } - } } void DCHAR() @@ -176,24 +143,6 @@ void DCHAR() const int ITERS = 1000; alias dchar typ; typ[] str; - - for(int idx = 0; idx < ITERS; idx++) { - str = str ~ toUTF32(cast(char[])"TEST LINE\n"); - } - - if(str.length != (ITERS * 10)) printf("Length Error: %zd\n",str.length); - if(str.sizeof != (typ[]).sizeof) printf("Size Error: %zd\n",str.sizeof); - - size_t lstart; - foreach(size_t idx, char c; str) { - if(c == '\n') { - if(str[lstart..idx] != toUTF32(cast(char[])"TEST LINE")) { - printf("Error testing character array\n"); - break; - } - lstart = idx + 1; - } - } } void BYTE() diff --git a/tests/dmd/runnable/structlit_rvalue.d b/tests/dmd/runnable/structlit_rvalue.d new file mode 100644 index 00000000000..86ef405c1f1 --- /dev/null +++ b/tests/dmd/runnable/structlit_rvalue.d @@ -0,0 +1,67 @@ +struct S22585_1 +{ + char[32] a; + int b = 1; + + this(ref S22585_1 s) + { + s.b = 2; + } +} + +struct T22585_1 +{ + S22585_1 s; +} + +void copyConstruct(S22585_1) {} + +void mutate(ref S22585_1 s) +{ + s.b = 2; +} + +struct S22585_2 +{ + char[32] a; + int b = 1; + ~this() {} +} + +struct T22585_2 +{ + S22585_2 s; +} + +pragma(inline, true) +S22585_2 inlinedRvalue1() +{ + bool b; + return (b ? T22585_2.init : T22585_2.init).s; +} + +void mutateCopyOf(S22585_2 s) +{ + s.b = 2; +} + +pragma(inline, true) +S22585_2 inlinedRvalue2() +{ + return S22585_2.init; +} + +void assignCopyOf(S22585_2 s) +{ + s = S22585_2.init; +} + +void main() +{ + bool b; + copyConstruct((b ? T22585_1.init : T22585_1.init).s); + mutate((b ? T22585_1.init : T22585_1.init).s); + mutateCopyOf(inlinedRvalue1()); + inlinedRvalue2.b = 2; + assignCopyOf(S22585_2.init); +} diff --git a/tests/dmd/runnable/template9.d b/tests/dmd/runnable/template9.d index 7a55b2dbfee..42d64495604 100644 --- a/tests/dmd/runnable/template9.d +++ b/tests/dmd/runnable/template9.d @@ -3405,7 +3405,7 @@ template map_front12186(fun...) void test12186() { - immutable int[][] mat; + immutable int[][] mat = new int[][](1); mat.map_front12186!((in r) => 0); // OK mat.map_front12186!((const r) => 0); // OK diff --git a/tests/dmd/runnable/test19675.sh b/tests/dmd/runnable/test19675.sh new file mode 100644 index 00000000000..bd588c686a9 --- /dev/null +++ b/tests/dmd/runnable/test19675.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${LIBEXT} -lib ${EXTRA_FILES}/gc19675.d ${EXTRA_FILES}/memory19675.d +$DMD -m${MODEL} -I${EXTRA_FILES} -of${OUTPUT_BASE}${EXE} ${EXTRA_FILES}/main19675.d ${OUTPUT_BASE}${LIBEXT} + +rm_retry ${OUTPUT_BASE}{${LIBEXT},${EXE}} diff --git a/tests/dmd/runnable/test20275.d b/tests/dmd/runnable/test20275.d new file mode 100644 index 00000000000..1288397264b --- /dev/null +++ b/tests/dmd/runnable/test20275.d @@ -0,0 +1,9 @@ +// EXTRA_SOURCES: imports/你好.d +// UNICODE_NAMES: + +import imports.你好; + +int main() +{ + return foo(); +} diff --git a/tests/dmd/runnable/test22079.d b/tests/dmd/runnable/test22079.d new file mode 100644 index 00000000000..a2e676759a3 --- /dev/null +++ b/tests/dmd/runnable/test22079.d @@ -0,0 +1,18 @@ +struct S { + ~this() {} +} + +__gshared S s = S(); + +ref S refS() { + return s; +} + +void takeS(S s2) { + assert(&s !is &s2); +} + +void main() +{ + takeS(refS()); +} diff --git a/tests/dmd/runnable/test22384.d b/tests/dmd/runnable/test22384.d new file mode 100644 index 00000000000..9a48263e383 --- /dev/null +++ b/tests/dmd/runnable/test22384.d @@ -0,0 +1,49 @@ +//https://github.com/dlang/dmd/issues/22384 +struct S +{ + int a = 1; + int b : 16 = 2; + int c : 16 = 3; + int d = 4; +} + +struct T +{ + int a = 1; // .long 1 + int b : 4 = 2; // .byte 0x32 (b=2, c=3 merged) + int c : 4 = 3; + int d : 8 = 4; // .byte 0x04 + int e : 4 = 5; // .byte 0x65 (e=5, f_low=6 merged) + int f : 12 = 6; // .byte 0x00 (f_high) + int g = 7; // .long 7 +} + +struct M +{ + int a : 4 = 1; + int : 4; + int b : 4 = 2; +} + +S s; +T t; +M m; + +void main() +{ + assert(s.a == 1); + assert(s.b == 2); + assert(s.c == 3); + assert(s.d == 4); + + assert(t.a == 1); + assert(t.b == 2); + assert(t.c == 3); + assert(t.d == 4); + assert(t.e == 5); + assert(t.f == 6); + assert(t.g == 7); + + assert(m.a == 1); + assert(m.b == 2); +} diff --git a/tests/dmd/runnable/test22427.d b/tests/dmd/runnable/test22427.d new file mode 100644 index 00000000000..15d9fc00375 --- /dev/null +++ b/tests/dmd/runnable/test22427.d @@ -0,0 +1,40 @@ +// https://github.com/dlang/dmd/issues/22427 + +noreturn exit1() +{ + throw new Exception("exit(1)"); +} + +noreturn exit0() +{ + throw new Exception("exit(0)"); +} + +void main() +{ + try + { + scope exitProgram = (bool failure) @trusted { + return failure + ? throw new Exception("exit(1)") + : throw new Exception("exit(0)"); + }; + exitProgram(false); + } + catch (Exception e) + { + assert(e.message == "exit(0)"); + } + + try + { + scope exitProgram = (bool failure) @trusted { + return failure ? exit1() : exit0(); + }; + exitProgram(false); + } + catch (Exception e) + { + assert(e.message == "exit(0)"); + } +} diff --git a/tests/dmd/runnable/test22489.d b/tests/dmd/runnable/test22489.d new file mode 100644 index 00000000000..e0bfee39460 --- /dev/null +++ b/tests/dmd/runnable/test22489.d @@ -0,0 +1,20 @@ +// REQUIRED_ARGS: -inline -O + +real f(real r) +{ + return r - real.infinity; +} + +void main() +{ + assert(f(real.infinity) != f(real.infinity)); + + version (D_SIMD) + { + import core.simd; + float4 v1 = float.infinity; + float4 v2 = v1 - v1; + static foreach (i; 0 .. 4) + assert(v2[i] != v2[i]); + } +} diff --git a/tests/dmd/runnable/test28.d b/tests/dmd/runnable/test28.d index f744712f2f9..5491474f13b 100644 --- a/tests/dmd/runnable/test28.d +++ b/tests/dmd/runnable/test28.d @@ -1,3 +1,5 @@ +// PERMUTE_ARGS: -fPIC -inline -release -g -O + module test; import core.stdc.stdio; @@ -1272,6 +1274,129 @@ void test18576() /*******************************************/ +struct S67 +{ + S67* ptr; + + this(int) + { + pragma(inline, false); + ptr = &this; + } + + @disable this(this); +} + +S67 make67() +{ + return S67(1); +} + +__gshared int i67; + +S67 f67() +out (s; s.ptr == &s) +{ + i67++; + return make67(); +} + +void test67() +{ + S67 s = f67(); + assert(s.ptr == &s); + + S67 s2 = make67(); + auto closure = () { assert(s2.ptr == &s2); }; + closure(); +} + +/*******************************************/ +// https://github.com/dlang/dmd/issues/22160 + +struct Vector22160(T) +{ + T[] _payload; + + ~this() const nothrow {} + + @property size_t length() const + { + return _payload.length; + } + + @property T* ptr() inout { + return cast(T*) _payload.ptr; + } +} + +struct DEREncoder +{ + Vector22160!ubyte getContentsUnlocked() + { + return Vector22160!ubyte(); + } + + Vector22160!ubyte m_contents; +} + +Vector22160!ubyte putInSequence()(const auto ref Vector22160!ubyte contents) +{ + return DEREncoder().getContentsUnlocked(); +} + +void foo22160(T)(Vector22160!T*, T* ptr, size_t) +{ + assert(ptr is null); +} + +void bar22160(Vector22160!ubyte val) +{ + ulong[16] padding = 0x1234567890123456UL; + foo22160(&val, val.ptr, val.length); +} + +void test22160() +{ + bar22160(putInSequence(Vector22160!ubyte())); +} + +/*******************************************/ +// https://github.com/dlang/dmd/issues/22292 + +struct Vector22292(T) +{ + T[] payload = [1]; + + ~this() nothrow + { + payload = null; + } + + void check(ref Vector22292 val) + { + assert(val.payload.length == 1); + } +} + +struct DEREncoder2 +{ + ref Vector22292!int getContentsUnlocked() + { + return m_contents; + } + + Vector22292!int m_contents; +} + +void test22292() +{ + Vector22292!int o; + o.check(DEREncoder2().getContentsUnlocked()); +} + +/*******************************************/ + void main() { printf("Start\n"); @@ -1336,6 +1461,9 @@ void main() test64(); test65(); test18576(); + test67(); + test22160(); + test22292(); printf("Success\n"); } diff --git a/tests/dmd/runnable/test36.d b/tests/dmd/runnable/test36.d index 016a85736b0..09a1c89ff12 100644 --- a/tests/dmd/runnable/test36.d +++ b/tests/dmd/runnable/test36.d @@ -33,9 +33,14 @@ extern (Windows): override void func() { int esp; - asm{ - mov esp,ESP; - } + version (D_InlineAsm_X86) + asm{ + mov esp,ESP; + } + version (D_InlineAsm_X86_64) + asm{ + mov esp,ESP; + } printf("\n%d",esp); printf(`func`); } @@ -48,15 +53,25 @@ int main() { auto inst= new invarianttest; int esp; - asm{ - mov esp,ESP; - } + version (D_InlineAsm_X86) + asm{ + mov esp,ESP; + } + version (D_InlineAsm_X86_64) + asm{ + mov esp,ESP; + } inst.func(); inst.method(); printf("\n%d\n",esp); - asm{ - mov esp,ESP; - } + version (D_InlineAsm_X86) + asm{ + mov esp,ESP; + } + version (D_InlineAsm_X86_64) + asm{ + mov esp,ESP; + } printf("\n%d\n",esp); return 0; } diff --git a/tests/dmd/runnable/test_delegate_init_in_struct.d b/tests/dmd/runnable/test_delegate_init_in_struct.d new file mode 100644 index 00000000000..9e74d35b95b --- /dev/null +++ b/tests/dmd/runnable/test_delegate_init_in_struct.d @@ -0,0 +1,15 @@ +struct S +{ + string[] delegate() dg; +} + +S s = { + dg: () => ["hello"] // SEGFAULT without explicit `delegate` +}; + +void main() +{ + auto result = s.dg(); + assert(result.length == 1); + assert(result[0] == "hello"); +} diff --git a/tests/dmd/runnable/test_real_array_param.d b/tests/dmd/runnable/test_real_array_param.d new file mode 100644 index 00000000000..327cccc4af9 --- /dev/null +++ b/tests/dmd/runnable/test_real_array_param.d @@ -0,0 +1,16 @@ +void fn(int* x, real[1] arr) +{ + auto y = *x; // should not segfault + assert(y == 42, "x parameter corrupted"); + assert(arr[0] == 1.0, "arr (real[1]) corrupted"); +} + +void main() +{ + real[1] arr = [1.0]; + int x = 42; + fn(&x, arr); + + assert(x == 42, "x value corrupted"); + assert(arr[0] == 1.0, "arr (real[1]) value corrupted"); +} diff --git a/tests/dmd/runnable/testc22259.c b/tests/dmd/runnable/testc22259.c new file mode 100644 index 00000000000..e8b8c9a5205 --- /dev/null +++ b/tests/dmd/runnable/testc22259.c @@ -0,0 +1,21 @@ +// DISABLED: win32 win64 + +// https://github.com/dlang/dmd/issues/22259 + +#include +#include +#include + +void foo() +{ + _Complex double x = 1 + 1.0if; + assert(creal(x) == 1.000000); + assert(cimag(x) == 1.000000); + return; +} + +int main() +{ + foo(); + return 0; +} diff --git a/tests/dmd/runnable/testcomplexinit.c b/tests/dmd/runnable/testcomplexinit.c new file mode 100644 index 00000000000..f8a33a445db --- /dev/null +++ b/tests/dmd/runnable/testcomplexinit.c @@ -0,0 +1,28 @@ +// DISABLED: win32 win64 + +#include +#include +#include + +struct com +{ + int r; + int c; +}; + +void foo() +{ + struct com obj = { 1, 3}; + _Complex double x = { obj.r, obj.c}; //real + im*i; + + assert(creal(x) == 1.000000); + assert(cimag(x) == 3.000000); + return; +} + + +int main() +{ + foo(); + return 0; +} diff --git a/tests/dmd/runnable/testpdb.d b/tests/dmd/runnable/testpdb.d index 8c672ce80ae..7f8976b7ec5 100644 --- a/tests/dmd/runnable/testpdb.d +++ b/tests/dmd/runnable/testpdb.d @@ -72,6 +72,8 @@ void main(string[] args) test19318(session, globals); + test18950(session, globals); + testE982(session, globals); test20253(session, globals); diff --git a/tests/dmd/runnable/traits_initSymbol.d b/tests/dmd/runnable/traits_initSymbol.d index a224d0e3b59..e330772cf26 100644 --- a/tests/dmd/runnable/traits_initSymbol.d +++ b/tests/dmd/runnable/traits_initSymbol.d @@ -105,6 +105,19 @@ void testExternCppClass() assert(init == (cast(void*) ac)[0 .. init.length]); } +void testFuncParam() +{ + // https://github.com/dlang/dmd/issues/22135 + struct S {} + + void foo(T)(T _) {} + + void bar() + { + foo(__traits(initSymbol, S)); + } +} + void main() { testZero(); @@ -113,4 +126,5 @@ void main() testAlignedStruct(); testAlignedClass(); testExternCppClass(); + testFuncParam(); } diff --git a/tests/dmd/runnable/uda.d b/tests/dmd/runnable/uda.d index 133ae054573..713f36405aa 100644 --- a/tests/dmd/runnable/uda.d +++ b/tests/dmd/runnable/uda.d @@ -749,6 +749,22 @@ template test15804() alias a15804 = test15804!(); +/************************************************/ +// https://github.com/dlang/dmd/issues/22282 + +struct S22282 +{ + int a,b; + this(string a, string b) { } + ~this() { } +} + +void issue22282() +{ + enum var; + @var S22282 file = S22282("tmp", "w"); +} + /************************************************/ int main() @@ -773,6 +789,7 @@ int main() test18(); test19(); test20(); + issue22282(); printf("Success\n"); return 0; diff --git a/tests/dmd/runnable/with.d b/tests/dmd/runnable/with.d new file mode 100644 index 00000000000..2f946622d2e --- /dev/null +++ b/tests/dmd/runnable/with.d @@ -0,0 +1,15 @@ + +struct S +{ + int x; +} +S s; +void main() +{ + with(auto ss = S()) + { + x = 42; + s.x = x; + } + assert(s.x == 42); +} diff --git a/tests/dmd/tools/d_do_test.d b/tests/dmd/tools/d_do_test.d index 79a72a33f2b..8d3291e48d6 100755 --- a/tests/dmd/tools/d_do_test.d +++ b/tests/dmd/tools/d_do_test.d @@ -2104,7 +2104,7 @@ int tryMain(string[] args) { try { - string diffUpdatedText = replaceFromDiff(existingText, ce.diff); + string diffUpdatedText = replaceFromDiff(existingText, ce.diff.unifyDirSep("/")); std.file.write(input_file, diffUpdatedText); writefln("\n==> `%s_OUTPUT` of %s has been updated by applying a diff", type, input_file); return Result.returnRerun; @@ -2389,9 +2389,25 @@ int runBashTest(string input_dir, string test_name, const ref EnvData envData) */ int runGDBTestWithLock(const ref EnvData envData, int delegate() fun) { + import core.thread : Thread; + import std.datetime : dur; + import std.conv: text; + // Tests failed on SemaphoreCI when multiple GDB tests were run at once - scope lockfile = File(envData.results_dir.buildPath("gdb.lock"), "w"); - lockfile.lock(); + const lockPath = envData.results_dir.buildPath("gdb.lock"); + scope lockfile = File(lockPath, "w"); + enum maxWaitSeconds = 30; + auto waitTime = StopWatch(AutoStart.yes); + while (!lockfile.tryLock()) + { + if (waitTime.peek.total!"seconds" >= maxWaitSeconds) + { + throw new Exception( + text("Time out waiting for ", lockPath, " after ", maxWaitSeconds, + " seconds. A stale stopped test process may still hold the lock.")); + } + Thread.sleep(100.msecs); + } scope (exit) lockfile.unlock(); return fun(); diff --git a/tests/dmd/unit/deinitialization.d b/tests/dmd/unit/deinitialization.d index e583631d814..9196b811af8 100644 --- a/tests/dmd/unit/deinitialization.d +++ b/tests/dmd/unit/deinitialization.d @@ -36,12 +36,13 @@ unittest import dmd.target : addDefaultVersionIdentifiers; import dmd.mtype : Type; import dmd.globals : global; + import dmd.typesem : Type_init; assert(Type.stringtable == Type.stringtable.init); global._init(); - Type._init(); + Type_init(); Type.deinitialize(); global.deinitialize(); diff --git a/tests/dmd/unit/objc/protocols/optional_methods.d b/tests/dmd/unit/objc/protocols/optional_methods.d index 3a55bbcf7e1..33e35b22db8 100644 --- a/tests/dmd/unit/objc/protocols/optional_methods.d +++ b/tests/dmd/unit/objc/protocols/optional_methods.d @@ -177,9 +177,14 @@ unittest @optional void foo()(); } + extern (Objective-C) + class Bar : Foo + { + } + void main() { - Foo f; + Foo f = new Bar; f.foo(); } }.stripDelimited; @@ -190,7 +195,7 @@ unittest "Error: function test.Foo.foo!().foo template cannot be optional" ), Diagnostic( - SourceLoc(filename, 12, 10), + SourceLoc(filename, 17, 10), "Error: template instance test.Foo.foo!() error instantiating" ) ]; @@ -216,7 +221,7 @@ unittest void main() { - Foo f; + Foo f = new Foo; f.foo(); } }.stripDelimited; diff --git a/tests/dmd/unit/semantic/control_flow.d b/tests/dmd/unit/semantic/control_flow.d index 0e4b0918044..384376f512a 100644 --- a/tests/dmd/unit/semantic/control_flow.d +++ b/tests/dmd/unit/semantic/control_flow.d @@ -487,25 +487,32 @@ unittest (FuncDeclaration fd) { // Rewritten as: - // bool __os2 = false; - // try - // { - // } - // catch(Throwable __o3) - // { - // __os2 = true; - // throw __o3; - // } - // if (!__os2) - // throw new Exception(""); + //bool __os2 = false; + //try + //{ + // try + // { + // } + // catch(Throwable __o3) + // { + // __os2 = true; + // throw __o3; + // } + //} + //finally + // if (!__os2) + // throw _d_newclassT(); // // FIXME: null statement at index 1 without errors?!? auto stmts = getStatements(fd); - assert(stmts.length == 4); + assert(stmts.length == 3); + + auto finallyStatement = (*stmts)[2].isTryFinallyStatement(); + assert(finallyStatement !is null); // BUG(?): blockexit yields `fallthru` for the try-catch because the exception is typed as `Throwable` - testBlockExit(fd, (*stmts)[2], BE.fallthru); - assert((*stmts)[2].isTryCatchStatement()); + testBlockExit(fd, finallyStatement._body, BE.fallthru); + assert(finallyStatement._body.isTryCatchStatement()); testBlockExit(fd, fd.fbody, BE.fallthru | BE.throw_); }); diff --git a/tests/plugins/visitor_example.d b/tests/plugins/visitor_example.d index 022d5485a8a..0d5a4f73924 100644 --- a/tests/plugins/visitor_example.d +++ b/tests/plugins/visitor_example.d @@ -12,6 +12,7 @@ import dmd.location; import dmd.visitor; import dmd.declaration; import dmd.dsymbol; +import dmd.typesem; extern(C++) class MyVisitor : SemanticTimeTransitiveVisitor { alias visit = SemanticTimeTransitiveVisitor.visit;