Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit f3a4326

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents ec4438f + dac9625 commit f3a4326

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1869
-729
lines changed

.cirrus.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
common_steps_template: &COMMON_STEPS_TEMPLATE
2+
clone_dmd_script: |
3+
set -uexo pipefail
4+
git clone --branch "${CIRRUS_BASE_BRANCH:-$CIRRUS_BRANCH}" --depth 1 https://github.com/dlang/dmd.git ../dmd
5+
install_prerequisites_script: cd ../dmd && ./cirrusci.sh
6+
install_host_compiler_script: cd ../dmd && ./ci.sh install_host_compiler
7+
setup_repos_script: |
8+
set -uexo pipefail
9+
ln -s $CIRRUS_WORKING_DIR ../druntime
10+
cd ../dmd && ./ci.sh setup_repos "${CIRRUS_BASE_BRANCH:-$CIRRUS_BRANCH}"
11+
build_script: cd ../dmd && ./ci.sh build
12+
test_dmd_script: cd ../dmd && ./ci.sh test_dmd
13+
test_druntime_script: cd ../dmd && ./ci.sh test_druntime
14+
test_phobos_script: cd ../dmd && ./ci.sh test_phobos
15+
16+
environment:
17+
CIRRUS_CLONE_DEPTH: 1
18+
# for ci.sh:
19+
MODEL: 64
20+
HOST_DC: dmd
21+
N: 4
22+
OS_NAME: linux
23+
FULL_BUILD: false
24+
25+
# Linux
26+
task:
27+
name: Ubuntu 16.04 $TASK_NAME_SUFFIX
28+
container:
29+
image: ubuntu:16.04
30+
cpu: 4
31+
memory: 8G
32+
timeout_in: 60m
33+
environment:
34+
matrix:
35+
- TASK_NAME_SUFFIX: x86
36+
MODEL: 32
37+
- TASK_NAME_SUFFIX: x64
38+
install_git_script: apt-get -q update && apt-get install -yq git-core
39+
<< : *COMMON_STEPS_TEMPLATE
40+
41+
# Mac
42+
task:
43+
name: macOS 10.15 x64
44+
osx_instance:
45+
image: catalina-xcode
46+
timeout_in: 60m
47+
environment:
48+
OS_NAME: darwin
49+
# override Cirrus default OS (`darwin`)
50+
OS: osx
51+
<< : *COMMON_STEPS_TEMPLATE
52+
53+
# FreeBSD
54+
task:
55+
name: FreeBSD 12.1 x64
56+
freebsd_instance:
57+
image_family: freebsd-12-1
58+
cpu: 4
59+
memory: 8G
60+
timeout_in: 60m
61+
environment:
62+
OS_NAME: freebsd
63+
CI_DFLAGS: -version=TARGET_FREEBSD12
64+
install_bash_and_git_script: pkg install -y bash git
65+
<< : *COMMON_STEPS_TEMPLATE

azure-pipelines.yml

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,91 +2,79 @@
22

33
variables:
44
DMD_BRANCH: $[ coalesce(variables['System.PullRequest.TargetBranch'], variables['Build.SourceBranchName'], 'master') ]
5+
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
56

67
jobs:
78
- job: Windows
89
timeoutInMinutes: 120
910
pool:
1011
vmImage: 'vs2017-win2016'
1112
variables:
12-
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
13-
HOST_DMD_VERSION: 2.093.1
13+
D_COMPILER: dmd
14+
HOST_DMD_VERSION: LATEST
1415
strategy:
1516
matrix:
1617
x64:
1718
OS: Win_64
1819
MODEL: 64
1920
ARCH: x64
20-
D_COMPILER: dmd
21+
x86-OMF:
22+
OS: Win_32
23+
MODEL: 32
24+
ARCH: x86
2125
steps:
26+
- checkout: self
27+
fetchDepth: 1
2228
- script: set
23-
displayName: environment
29+
displayName: Print environment variables
2430
- script: systeminfo
25-
displayName: systeminfo
31+
displayName: Print system info
2632
- task: CopyFiles@2
2733
inputs:
2834
sourceFolder: '$(Build.SourcesDirectory)'
2935
contents: '**/*'
3036
TargetFolder: '$(Build.SourcesDirectory)/../druntime'
31-
- script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
37+
- script: git clone --branch $(DMD_BRANCH) --depth 1 https://github.com/dlang/dmd.git ../dmd
38+
displayName: Clone DMD repo
3239
- script: |
3340
call "%VSINSTALLDIR%\VC\Auxiliary\Build\vcvarsall.bat" %ARCH%
3441
cd ../dmd && sh --login .azure-pipelines/windows.sh
35-
displayName: Build DMD
42+
displayName: Build and test
3643
37-
- job: Windows_OMF
44+
- job: Windows_VisualD
3845
timeoutInMinutes: 120
3946
pool:
4047
vmImage: 'vs2017-win2016'
4148
variables:
42-
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
43-
HOST_DMD_VERSION: LATEST
49+
D_COMPILER: ldc
50+
VISUALD_VER: v0.49.0
51+
LDC_VERSION: 1.23.0
4452
strategy:
4553
matrix:
46-
x86:
54+
x86-mscoff:
4755
OS: Win_32
48-
MODEL: 32
56+
MODEL: 32mscoff
4957
ARCH: x86
50-
D_COMPILER: dmd
51-
steps:
52-
- script: set
53-
displayName: environment
54-
- script: systeminfo
55-
displayName: systeminfo
56-
- task: CopyFiles@2
57-
inputs:
58-
sourceFolder: '$(Build.SourcesDirectory)'
59-
contents: '**/*'
60-
TargetFolder: '$(Build.SourcesDirectory)/../druntime'
61-
- script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
62-
- script: cd ../dmd && sh --login .azure-pipelines/windows.sh
63-
64-
- job: Windows_VisualD
65-
timeoutInMinutes: 120
66-
pool:
67-
vmImage: 'vs2017-win2016'
68-
variables:
69-
VSINSTALLDIR: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\
70-
HOST_DMD_VERSION: 2.093.1
71-
strategy:
72-
matrix:
73-
win32-ldc:
58+
x86-mscoff_MinGW:
7459
OS: Win_32
75-
MODEL: 32
60+
MODEL: 32mscoff
7661
ARCH: x86
77-
D_COMPILER: ldc
78-
VISUALD_VER: v0.49.0
79-
LDC_VERSION: 1.14.0
62+
C_RUNTIME: mingw
8063
steps:
64+
- checkout: self
65+
fetchDepth: 1
8166
- script: set
82-
displayName: environment
67+
displayName: Print environment variables
8368
- script: systeminfo
84-
displayName: systeminfo
69+
displayName: Print system info
8570
- task: CopyFiles@2
8671
inputs:
8772
sourceFolder: '$(Build.SourcesDirectory)'
8873
contents: '**/*'
8974
TargetFolder: '$(Build.SourcesDirectory)/../druntime'
90-
- script: git clone --branch $(DMD_BRANCH) https://github.com/dlang/dmd.git ../dmd
75+
- script: git clone --branch $(DMD_BRANCH) --depth 1 https://github.com/dlang/dmd.git ../dmd
76+
displayName: Clone DMD repo
9177
- script: cd ../dmd && sh --login .azure-pipelines/windows-visual-studio.sh
92-
- script: cd ../dmd && call .azure-pipelines\windows-msbuild.bat
78+
displayName: Download required binaries
79+
- script: cd ../dmd && call .azure-pipelines/windows-msbuild.bat
80+
displayName: Build and test

benchmark/gcbench/vdparser.extra/vdc/parser/mod.d

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ class DeclarationBlock
627627
// "C" ++
628628
// "D"
629629
// "Windows"
630-
// "Pascal"
631630
// "System"
632631
class LinkageAttribute
633632
{
@@ -691,7 +690,6 @@ Attribute tokenToLinkageType(Token tok)
691690
case "C": return Attr_ExternC;
692691
case "D": return Attr_ExternD;
693692
case "Windows": return Attr_ExternWindows;
694-
case "Pascal": return Attr_ExternPascal;
695693
case "System": return Attr_ExternSystem;
696694
default: return 0;
697695
}

benchmark/gcbench/vdparser.extra/vdc/util.d

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
// This file is part of Visual D
23
//
34
// Visual D integrates the D programming language into Visual Studio
@@ -110,7 +111,6 @@ enum AttrBits
110111
ExternCPP,
111112
ExternD,
112113
ExternWindows,
113-
ExternPascal,
114114
ExternSystem,
115115
Export,
116116
Align,
@@ -124,7 +124,7 @@ enum AttrBits
124124
mixin(genFlagsEnum("", "Attr_", [__traits(allMembers,AttrBits)]));
125125

126126
enum Attr_AlignMask = Attr_Align | Attr_Align1 | Attr_Align2 | Attr_Align4 | Attr_Align8 | Attr_Align16;
127-
enum Attr_CallMask = Attr_ExternC | Attr_ExternCPP | Attr_ExternD | Attr_ExternWindows | Attr_ExternPascal | Attr_ExternSystem;
127+
enum Attr_CallMask = Attr_ExternC | Attr_ExternCPP | Attr_ExternD | Attr_ExternWindows | Attr_ExternSystem;
128128
enum Attr_ShareMask = Attr_Shared | Attr_Gshared | Attr_Thread;
129129

130130
alias uint Attribute;
@@ -219,7 +219,6 @@ string attrToString(Attribute attr)
219219
case Attr_ExternCPP: return "extern(C++)";
220220
case Attr_ExternD: return "extern(D)";
221221
case Attr_ExternWindows: return "extern(Windows)";
222-
case Attr_ExternPascal: return "extern(Pascal)";
223222
case Attr_ExternSystem: return "extern(System)";
224223
case Attr_Export: return "export";
225224
case Attr_Align: return "align";
@@ -258,7 +257,6 @@ string attrToStringC(Attribute attr)
258257
case Attr_ExternCPP: return "";
259258
case Attr_ExternD: return "";
260259
case Attr_ExternWindows: return "__stdcall";
261-
case Attr_ExternPascal: return "__pascal";
262260
case Attr_ExternSystem: return "__stdcall";
263261
case Attr_Export: return "__declspec(dllexport)";
264262
case Attr_Align: return "__declspec(align(4))";

mak/COPY

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ COPY=\
123123
$(IMPDIR)\core\sys\darwin\sys\event.d \
124124
$(IMPDIR)\core\sys\darwin\sys\mman.d \
125125
\
126+
$(IMPDIR)\core\sys\freebsd\config.d \
126127
$(IMPDIR)\core\sys\freebsd\dlfcn.d \
127128
$(IMPDIR)\core\sys\freebsd\err.d \
128129
$(IMPDIR)\core\sys\freebsd\execinfo.d \

mak/SRCS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ SRCS=\
8989
src\core\stdcpp\string.d \
9090
src\core\stdcpp\string_view.d \
9191
src\core\stdcpp\type_traits.d \
92+
src\core\stdcpp\utility.d \
9293
src\core\stdcpp\vector.d \
9394
src\core\stdcpp\xutility.d \
9495
\
@@ -516,6 +517,8 @@ SRCS=\
516517
src\rt\memset.d \
517518
src\rt\minfo.d \
518519
src\rt\monitor_.d \
520+
src\rt\msvc.d \
521+
src\rt\msvc_math.d \
519522
src\rt\profilegc.d \
520523
src\rt\qsort.d \
521524
src\rt\sections.d \

src/core/attribute.d

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@
1616
module core.attribute;
1717

1818
version (D_ObjectiveC)
19+
{
20+
version = UdaOptional;
1921
version = UdaSelector;
22+
}
2023

2124
version (Posix)
2225
version = UdaGNUAbiTag;
2326

2427
version (CoreDdoc)
2528
{
2629
version = UdaGNUAbiTag;
30+
version = UdaOptional;
2731
version = UdaSelector;
2832
}
2933

@@ -68,6 +72,68 @@ version (UdaSelector) struct selector
6872
string selector;
6973
}
7074

75+
/**
76+
* Use this attribute to make an Objective-C interface method optional.
77+
*
78+
* An optional method is a method that does **not** have to be implemented in
79+
* the class that implements the interface. To safely call an optional method,
80+
* a runtime check should be performed to make sure the receiver implements the
81+
* method.
82+
*
83+
* This is a special compiler recognized attribute, it has several
84+
* requirements, which all will be enforced by the compiler:
85+
*
86+
* * The attribute can only be attached to methods which have Objective-C
87+
* linkage. That is, a method inside an interface declared as `extern (Objective-C)`
88+
*
89+
* * It can only be used for methods that are declared inside an interface
90+
* * It can only be used once in a method declaration
91+
* * It cannot be attached to a method that is a template
92+
*
93+
* Examples:
94+
* ---
95+
* import core.attribute : optional, selector;
96+
*
97+
* extern (Objective-C):
98+
*
99+
* struct objc_selector;
100+
* alias SEL = objc_selector*;
101+
*
102+
* SEL sel_registerName(in char* str);
103+
*
104+
* extern class NSObject
105+
* {
106+
* bool respondsToSelector(SEL sel) @selector("respondsToSelector:");
107+
* }
108+
*
109+
* interface Foo
110+
* {
111+
* @optional void foo() @selector("foo");
112+
* @optional void bar() @selector("bar");
113+
* }
114+
*
115+
* class Bar : NSObject
116+
* {
117+
* static Bar alloc() @selector("alloc");
118+
* Bar init() @selector("init");
119+
*
120+
* void bar() @selector("bar")
121+
* {
122+
* }
123+
* }
124+
*
125+
* extern (D) void main()
126+
* {
127+
* auto bar = Bar.alloc.init;
128+
*
129+
* if (bar.respondsToSelector(sel_registerName("bar")))
130+
* bar.bar();
131+
* }
132+
* ---
133+
*/
134+
version (UdaOptional)
135+
enum optional;
136+
71137
/**
72138
* Use this attribute to declare an ABI tag on a C++ symbol.
73139
*

src/core/demangle.d

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,6 @@ pure @safe:
10071007
F // D
10081008
U // C
10091009
W // Windows
1010-
V // Pascal
10111010
R // C++
10121011
10131012
FuncAttrs:
@@ -1087,10 +1086,6 @@ pure @safe:
10871086
popFront();
10881087
put( "extern (Windows) " );
10891088
break;
1090-
case 'V': // Pascal
1091-
popFront();
1092-
put( "extern (Pascal) " );
1093-
break;
10941089
case 'R': // C++
10951090
popFront();
10961091
put( "extern (C++) " );
@@ -2399,8 +2394,8 @@ private template isExternCPP(FT) if (is(FT == function))
23992394
private template hasPlainMangling(FT) if (is(FT == function))
24002395
{
24012396
enum lnk = __traits(getLinkage, FT);
2402-
// C || Pascal || Windows
2403-
enum hasPlainMangling = lnk == "C" || lnk == "Pascal" || lnk == "Windows";
2397+
// C || Windows
2398+
enum hasPlainMangling = lnk == "C" || lnk == "Windows";
24042399
}
24052400

24062401
@safe pure nothrow unittest
@@ -2523,7 +2518,8 @@ else
25232518
"pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"],
25242519
["_D13testexpansion__T1sTSQw__TQjTiZQoFiZ6ResultZQBbFQBcZQq3fooMFNaNfZv",
25252520
"pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"],
2526-
// ambiguity on 'V', template value argument or pascal function
2521+
// formerly ambiguous on 'V', template value argument or pascal function
2522+
// pascal functions have now been removed (in v2.095.0)
25272523
["_D3std4conv__T7enumRepTyAaTEQBa12experimental9allocator15building_blocks15stats_collector7OptionsVQCti64ZQDnyQDh",
25282524
"immutable(char[]) std.conv.enumRep!(immutable(char[]), std.experimental.allocator.building_blocks.stats_collector.Options, 64).enumRep"],
25292525
// symbol back reference to location with symbol back reference

0 commit comments

Comments
 (0)