Skip to content

Commit e3bc47d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents efaf83a + e9c80e2 commit e3bc47d

74 files changed

Lines changed: 16242 additions & 4850 deletions

Some content is hidden

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

.dscanner.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ has_public_example="-etc.c.curl,\
255255
-std.internal.math.gammafunction,\
256256
-std.internal.scopebuffer,\
257257
-std.internal.test.dummyrange,\
258+
-std.internal.unicode_tables,\
258259
-std.int128,\
259260
-std.json,\
260261
-std.mathspecial,\

.github/workflows/main.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010
cancel-in-progress: true
1111

1212
jobs:
13-
posix:
13+
main:
1414
strategy:
1515
fail-fast: false
1616
matrix:
@@ -26,18 +26,27 @@ jobs:
2626
os: macos-13
2727
- job_name: macOS 12 x64
2828
os: macos-12
29+
# Windows
30+
- job_name: Windows x64
31+
os: windows-2022
32+
- job_name: Windows x86
33+
os: windows-2022
34+
model: 32
2935
name: ${{ matrix.job_name }}
3036
runs-on: ${{ matrix.os }}
3137
timeout-minutes: 40
3238
env:
3339
# for ci/run.sh:
34-
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || '') }}
40+
OS_NAME: ${{ startsWith(matrix.os, 'ubuntu') && 'linux' || (startsWith(matrix.os, 'macos') && 'osx' || (startsWith(matrix.os, 'windows') && 'windows' || '')) }}
3541
MODEL: ${{ matrix.model || '64' }}
3642
HOST_DMD: dmd
37-
N: ${{ startsWith(matrix.os, 'macos') && '3' || '2' }}
43+
N: ${{ startsWith(matrix.os, 'macos') && '3' || '4' }}
3844
FULL_BUILD: false
3945
# work around https://issues.dlang.org/show_bug.cgi?id=23517
4046
MACOSX_DEPLOYMENT_TARGET: '11'
47+
defaults:
48+
run:
49+
shell: bash
4150
steps:
4251
- uses: actions/checkout@v4
4352
with:
@@ -61,16 +70,40 @@ jobs:
6170
fi
6271
6372
git clone --branch "$REPO_BRANCH" --depth 1 https://github.com/dlang/dmd.git ../dmd
64-
- name: Install prerequisites
73+
74+
- name: 'Posix: Install prerequisites'
75+
if: runner.os != 'Windows'
6576
run: cd ../dmd && ${{ runner.os == 'macOS' && 'ci/cirrusci.sh' || 'sudo -E ci/cirrusci.sh' }}
66-
- name: Install host compiler
77+
- name: 'Windows: Set up MSVC environment'
78+
if: runner.os == 'Windows'
79+
uses: seanmiddleditch/gha-setup-vsdevenv@v4
80+
with:
81+
arch: ${{ env.MODEL == '64' && 'x64' || 'x86' }}
82+
83+
- name: 'Posix: Install host compiler'
84+
if: runner.os != 'Windows'
6785
run: cd ../dmd && ci/run.sh install_host_compiler
86+
- name: 'Windows: Install host compiler'
87+
if: runner.os == 'Windows'
88+
uses: dlang-community/setup-dlang@v1.3.0
89+
with:
90+
compiler: ldc-latest
91+
6892
- name: Build
6993
run: cd ../dmd && ci/run.sh build
94+
env:
95+
# on Windows, `ci/run.sh build` expects the DMD env var to be set to the DMD-CLI-compatible host compiler
96+
DMD: ${{ runner.os == 'Windows' && 'ldmd2' || '' }}
97+
# work around the LDC host compiler on Windows assuming the first link.exe in PATH is the MSVC one
98+
# (VSINSTALLDIR is set, but GHA uses Git's bin\bash.exe for `shell: bash`, which prepends Git's usr\bin to PATH, with GNU link.exe)
99+
LDC_VSDIR_FORCE: ${{ runner.os == 'Windows' && '1' || '' }}
70100
- name: Test dmd
71101
run: cd ../dmd && ci/run.sh test_dmd
72102
- name: Test druntime
73103
run: cd ../dmd && ci/run.sh test_druntime
104+
- name: 'Windows x86: Add 32-bit libcurl.dll to PATH (required for Phobos unittests)'
105+
if: runner.os == 'Windows' && env.MODEL == '32'
106+
run: echo "$(dirname "$(which $DC)")/../lib32" >> $GITHUB_PATH
74107
- name: Test phobos
75108
run: cd ../dmd && ci/run.sh test_phobos
76109

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/phobos.json
44

55
generated
6+
generated-lib
67
GNUmakefile
78
.DS_Store
89
.*.sw*
@@ -18,9 +19,11 @@ obj/
1819

1920
# Rule for VS Code config folder
2021
.vscode
21-
22+
dub.selections.json
2223
*.html
2324

2425
.dub/
2526
libphobos_*
2627
source/
28+
29+
tools/ucd*

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ More Links
1212
* Use our [Bugzilla bug tracker](https://issues.dlang.org)
1313
* Follow the [D style](http://dlang.org/dstyle.html)
1414
* Participate in [our forum](http://forum.dlang.org/)
15-
* Ask questions on our `#d` IRC channel on freenode.org ([web interface](https://kiwiirc.com/client/irc.freenode.net/d))
15+
* Ask questions on our `#d` IRC channel on libera.chat ([web interface](https://kiwiirc.com/client/irc.libera.chat/d))
1616
* Review Phobos additions in the [Review Queue](http://wiki.dlang.org/Review_Queue).

Makefile

Lines changed: 58 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ else
7878
override PIC:=
7979
endif
8080

81+
# default to compiling the C parts (zlib) with DMD via importC; override with USE_IMPORTC=1/0
82+
USE_IMPORTC:=1
83+
84+
# FreeBSD 14 can't use importC for zlib thanks to asm in stdlib.h, which dmd can't handle.
85+
# https://issues.dlang.org/show_bug.cgi?id=24389
86+
ifeq (freebsd,$(OS))
87+
USE_IMPORTC=0
88+
endif
89+
8190
# Configurable stuff that's rarely edited
8291
INSTALL_DIR = ../install
8392
DRUNTIME_PATH = $(DMD_DIR)/druntime
@@ -101,58 +110,50 @@ else
101110
DRUNTIME = $(DRUNTIME_PATH)/../generated/$(OS)/$(BUILD)/$(MODEL)/druntime.lib
102111
endif
103112

104-
# Set CC and DMD
113+
# Set DMD
105114
ifeq ($(OS),win32wine)
106-
CC = wine dmc.exe
107115
DMD = wine dmd.exe
108116
RUN = wine
109117
else
110118
DMD = $(DMD_DIR)/generated/$(OS)/$(BUILD)/$(MODEL)/dmd$(DOTEXE)
111-
ifeq ($(MODEL),32omf)
112-
CC = dmc
113-
else ifeq ($(OS),windows)
114-
CC = cl.exe
115-
else
116-
CC = cc
117-
endif
118119
RUN =
119120
endif
120121

121-
# Set CFLAGS
122-
OUTFILEFLAG = -o
123-
NODEFAULTLIB=-defaultlib= -debuglib=
122+
# Set NODEFAULTLIB and CPPFLAGS (for the C preprocessor)
123+
NODEFAULTLIB:=-defaultlib= -debuglib=
124+
CPPFLAGS:=
124125
ifeq (,$(findstring win,$(OS)))
125-
CFLAGS=$(MODEL_FLAG) -fPIC -std=c11 -DHAVE_UNISTD_H
126+
CPPFLAGS := -DHAVE_UNISTD_H
126127
# Bundled with the system library on OSX, and doesn't work with >= MacOS 11
127128
ifneq (osx,$(OS))
128129
NODEFAULTLIB += -L-lpthread -L-lm
129130
endif
130-
ifeq ($(BUILD),debug)
131-
CFLAGS += -g
132-
else
133-
CFLAGS += -O3
134-
endif
135131
else
136132
ifeq ($(MODEL),32omf)
137-
CFLAGS=-DNO_snprintf
138-
ifeq ($(BUILD),debug)
139-
CFLAGS += -g
140-
else
141-
CFLAGS += -O
142-
endif
143-
else # win64/win32coff
144-
OUTFILEFLAG = /Fo
145-
CFLAGS += /nologo /Zl /GS-
146-
ifeq ($(BUILD),debug)
147-
CFLAGS += /Z7
148-
else
149-
CFLAGS += /O2
150-
endif
133+
CPPFLAGS := -DNO_snprintf
151134
endif
152135
endif
153-
ifeq (osx,$(OS))
154-
ifeq (64,$(MODEL))
155-
CFLAGS+=--target=x86_64-darwin-apple # ARM cpu is not supported by dmd
136+
137+
# Set CC, CC_OUTFILEFLAG and CFLAGS unless using importC
138+
ifneq ($(USE_IMPORTC),1)
139+
CC := cc
140+
CC_OUTFILEFLAG := -o
141+
142+
ifeq ($(OS),win32wine)
143+
CC := wine dmc.exe
144+
CFLAGS := $(if $(findstring $(BUILD),debug),-g,-O)
145+
else ifeq ($(MODEL),32omf)
146+
CC := dmc
147+
CFLAGS := $(if $(findstring $(BUILD),debug),-g,-O)
148+
else ifeq ($(OS),windows)
149+
CC := cl
150+
CC_OUTFILEFLAG := /Fo
151+
CFLAGS := /nologo /Zl /GS- $(if $(findstring $(BUILD),debug),/Z7,/O2)
152+
else # Posix
153+
CFLAGS := $(MODEL_FLAG) -fPIC -std=c11 $(if $(findstring $(BUILD),debug),-g,-O3)
154+
ifeq (osx64,$(OS)$(MODEL))
155+
CFLAGS += --target=x86_64-darwin-apple # ARM cpu is not supported by dmd
156+
endif
156157
endif
157158
endif
158159

@@ -299,10 +300,15 @@ ALL_D_FILES = $(addsuffix .d, $(STD_MODULES) $(EXTRA_MODULES_COMMON) \
299300
$(EXTRA_MODULES_WIN32) $(EXTRA_MODULES_INTERNAL))
300301

301302
# C files to be part of the build
302-
C_MODULES = $(addprefix etc/c/zlib/, adler32 compress crc32 deflate \
303+
C_MODULES := $(addprefix etc/c/zlib/, adler32 compress crc32 deflate \
303304
gzclose gzlib gzread gzwrite infback inffast inflate inftrees trees uncompr zutil)
305+
C_FILES := $(addsuffix .c, $(C_MODULES))
304306

305-
OBJS = $(addsuffix $(DOTOBJ),$(addprefix $(ROOT)/,$(C_MODULES)))
307+
ifeq ($(USE_IMPORTC),1)
308+
C_OBJS := $(ROOT)/zlib$(DOTOBJ)
309+
else
310+
C_OBJS := $(addprefix $(ROOT)/, $(addsuffix $(DOTOBJ), $(C_MODULES)))
311+
endif
306312

307313
# build with shared library support (defaults to true on supported platforms)
308314
SHARED=$(if $(findstring $(OS),linux freebsd),1,)
@@ -348,12 +354,18 @@ endif
348354
lib: $(LIB)
349355
dll: $(ROOT)/libphobos2.so
350356

357+
ifeq ($(USE_IMPORTC),1)
358+
# the druntime dependency makes sure DMD has been built
359+
$(ROOT)/zlib$(DOTOBJ): $(C_FILES) $(DRUNTIME)
360+
$(DMD) -c $(DFLAGS) $(addprefix -P=,$(CPPFLAGS) -Ietc/c/zlib) -of$@ $(C_FILES)
361+
else
351362
$(ROOT)/%$(DOTOBJ): %.c
352363
@[ -d $(dir $@) ] || mkdir -p $(dir $@) || [ -d $(dir $@) ]
353-
$(CC) -c $(CFLAGS) $< $(OUTFILEFLAG)$@
364+
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< $(CC_OUTFILEFLAG)$@
365+
endif
354366

355-
$(LIB): $(OBJS) $(ALL_D_FILES) $(DRUNTIME)
356-
$(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(OBJS)
367+
$(LIB): $(C_OBJS) $(ALL_D_FILES) $(DRUNTIME)
368+
$(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(C_OBJS)
357369

358370
$(ROOT)/libphobos2.so: $(ROOT)/$(SONAME)
359371
ln -sf $(notdir $(LIBSO)) $@
@@ -362,8 +374,8 @@ $(ROOT)/$(SONAME): $(LIBSO)
362374
ln -sf $(notdir $(LIBSO)) $@
363375

364376
$(LIBSO): override PIC:=-fPIC
365-
$(LIBSO): $(OBJS) $(ALL_D_FILES) $(DRUNTIMESO)
366-
$(DMD) $(DFLAGS) -shared $(NODEFAULTLIB) -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(D_FILES) $(OBJS)
377+
$(LIBSO): $(C_OBJS) $(ALL_D_FILES) $(DRUNTIMESO)
378+
$(DMD) $(DFLAGS) -shared $(NODEFAULTLIB) -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(D_FILES) $(C_OBJS)
367379

368380
ifeq (osx,$(OS))
369381
# Build fat library that combines the 32 bit and the 64 bit libraries
@@ -404,8 +416,8 @@ ifneq (1,$(SHARED))
404416

405417
$(UT_D_OBJS): $(DRUNTIME)
406418

407-
$(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME)
408-
$(DMD) $(DFLAGS) $(UDFLAGS) -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(OBJS) $(DRUNTIME) $(LINKDL) $(NODEFAULTLIB)
419+
$(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(C_OBJS) $(DRUNTIME)
420+
$(DMD) $(DFLAGS) $(UDFLAGS) -of$@ $(DRUNTIME_PATH)/src/test_runner.d $(UT_D_OBJS) $(C_OBJS) $(DRUNTIME) $(LINKDL) $(NODEFAULTLIB)
409421

410422
else
411423

@@ -414,8 +426,8 @@ UT_LIBSO:=$(ROOT)/unittest/libphobos2-ut.so
414426
$(UT_D_OBJS): $(DRUNTIMESO)
415427

416428
$(UT_LIBSO): override PIC:=-fPIC
417-
$(UT_LIBSO): $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO)
418-
$(DMD) $(DFLAGS) -shared $(UDFLAGS) -of$@ $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) $(LINKDL) $(NODEFAULTLIB)
429+
$(UT_LIBSO): $(UT_D_OBJS) $(C_OBJS) $(DRUNTIMESO)
430+
$(DMD) $(DFLAGS) -shared $(UDFLAGS) -of$@ $(UT_D_OBJS) $(C_OBJS) $(DRUNTIMESO) $(LINKDL) $(NODEFAULTLIB)
419431

420432
$(ROOT)/unittest/test_runner$(DOTEXE): $(DRUNTIME_PATH)/src/test_runner.d $(UT_LIBSO)
421433
$(DMD) $(DFLAGS) -of$@ $< -L$(UT_LIBSO) $(NODEFAULTLIB)

azure-pipelines.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
`isForwardRange`, `isBidirectionalRange`, and `isRandomAccessRange` now take an optional element type
2+
3+
In Phobos 2.106, an optional second template parameter was added to
4+
`isInputRange` to enable conveniently checking a range's element type. Now, the
5+
same parameter has been added to `isForwardRange`, `isBidirectionalRange`, and
6+
`isRandomAccessRange`.
7+
8+
As before, if a second type argument is passed to one of these templates, the
9+
range's element type is checked to see if it is
10+
$(DDSUBLINK spec/const3, implicit_qualifier_conversions, qualifier-convertible)
11+
to the given type, and this additional check must pass in order for the
12+
template to evaluate to `true`.
13+
14+
Examples:
15+
---
16+
// exact match
17+
static assert( isForwardRange!(int[], int));
18+
19+
// match with qualifier conversion
20+
static assert( isBidirectionalRange!(int[], const(int));
21+
22+
// not a match
23+
static assert(!isRandomAccessRange!(int[], string));
24+
---

0 commit comments

Comments
 (0)