Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Jun 16, 2018
2 parents cc961da + 15b682a commit 8d4e394
Show file tree
Hide file tree
Showing 143 changed files with 2,656 additions and 2,117 deletions.
8 changes: 4 additions & 4 deletions .dscanner.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if_else_same_check="enabled"
; Checks for some problems with constructors
constructor_check="enabled"
; Checks for unused variables and function parameters
unused_variable_check="enabled"
unused_variable_check="skip-unittest"
; Checks for unused labels
unused_label_check="enabled"
; Checks for duplicate attributes
Expand Down Expand Up @@ -258,7 +258,6 @@ has_public_example="-etc.c.curl,\
-std.net.isemail,\
-std.numeric,\
-std.parallelism,\
-std.path,\
-std.process,\
-std.range.interfaces,\
-std.regex,\
Expand Down Expand Up @@ -346,7 +345,6 @@ properly_documented_public_functions="-etc.c.odbc.sql,\
-std.experimental.logger.core,\
-std.experimental.logger.filelogger,\
-std.format,\
-std.functional,\
-std.getopt,\
-std.internal.cstring,\
-std.internal.math.biguintcore,\
Expand Down Expand Up @@ -409,7 +407,6 @@ unused_variable_check="-std.algorithm.comparison,\
-std.container.dlist,\
-std.container.rbtree,\
-std.container.slist,\
-std.conv,\
-std.csv,\
-std.datetime,\
-std.datetime.date,\
Expand Down Expand Up @@ -481,3 +478,6 @@ unused_variable_check="-std.algorithm.comparison,\
vcall_in_ctor="-std.socket,-std.xml"
; Check for @trusted applied to a bigger scope than a single function
trust_too_much="-std.regex,-std.stdio,-std.uni,-std.internal.cstring"
; Checks for if statements whose 'then' block is the same as the 'else' block
; Temporarily disable until https://github.com/dlang-community/D-Scanner/issues/593 is fixed
if_else_same_check="-std.typecons"
3 changes: 3 additions & 0 deletions changelog/remove_std_c.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The deprecated `std.c` package has been removed.

Use the `core.stdc` package instead.
27 changes: 27 additions & 0 deletions changelog/std-algorithm-mutation-remove.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
`std.algorithm.mutation.remove` now only accepts integral values or pair of integral values as offset

Previously, without being stated in the documentation,
$(REF remove, std,algorithm) used to accept any values as `offset`.
This behavior was very error-prone:

---
import std.algorithm, std.stdio;
[0, 1, 2, 3, 4].remove(1, 3).writeln; // 0, 2, 4 -- correct
[0, 1, 2, 3, 4].remove([1, 3]).writeln; // 0, 3, 4 -- incorrect
---

With this release, using arrays as individual elements is no longer valid.
$(REF tuple, std,typecons) can be used to explicitly indicate that a range
from `start` to `stop` (non-enclosing) should be removed:

---
import std.algorithm, std.stdio, std.typecons;
[0, 1, 2, 3, 4].remove(tuple(1, 3)).writeln; // 0, 3, 4
---

However, only 2-tuples are allowed to avoid this un-intuitive scenario:

---
import std.algorithm, std.stdio, std.typecons;
[0, 1, 2, 3, 4].remove(tuple(1, 3, 4)).writeln; // 0, 4?
---
19 changes: 19 additions & 0 deletions changelog/std-math-fminmax.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Changed semantics of std.math.{fmin,fmax} wrt. NaNs.

The semantics of $(REF fmin, std, math) and $(REF fmax, std, math) have been
streamlined with the C functions: if one of the arguments is a NaN, return the
other. This involves an additional $(REF isNaN, std, math) check. Use
$(REF min, std, algorithm, comparison) and $(REF max, std, algorithm, comparison)
for the previous semantics performing a single comparison.

---
import std.math;
assert(fmin(real.nan, 2.0L) == 2.0L);
assert(fmin(2.0L, real.nan) == 2.0L); // previously: NaN
assert(isNaN(fmin(real.nan, real.nan)));

import std.algorithm.comparison;
assert(min(real.nan, 2.0L) == 2.0L);
assert(isNaN(min(2.0L, real.nan)));
assert(isNaN(min(real.nan, real.nan)));
---
26 changes: 15 additions & 11 deletions dip1000.mak
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ aa[std.typecons]=-dip1000 -version=DIP1000 # merged https://github.com/dlang/pho
aa[std.typetuple]=-dip1000
aa[std.uni]=-dip1000 # merged https://github.com/dlang/phobos/pull/6294, https://github.com/dlang/phobos/pull/6041 (see also TODO-list there); supersedes/includes https://github.com/dlang/phobos/pull/5045; see also https://github.com/dlang/phobos/pull/6104 for improvements proposed by Seb
aa[std.uri]=-dip1000
aa[std.utf]=-dip1000 # for me (carblue) std.utf is -dip1000 compilable even without applying https://github.com/dlang/phobos/pull/5915, i.e. I don't observe a depends on (?); after applying PR 5915 it's still dip1000
aa[std.utf]=-dip1000
aa[std.uuid]=-dip1000
aa[std.variant]=-dip1000
aa[std.xml]=-dip1000
Expand All @@ -59,8 +59,8 @@ aa[std.zlib]=-dip1000

aa[std.algorithm.comparison]=-dip1000
aa[std.algorithm.internal]=-dip1000
aa[std.algorithm.iteration]=-dip25 # depends on std.container.slist (to be updated https://github.com/dlang/phobos/pull/6295)
aa[std.algorithm.mutation]=-dip25 # depends on std.container.slist (to be updated https://github.com/dlang/phobos/pull/6295)
aa[std.algorithm.iteration]=-dip1000
aa[std.algorithm.mutation]=-dip1000
aa[std.algorithm.package]=-dip1000
aa[std.algorithm.searching]=-dip25 # depends on https://github.com/dlang/phobos/pull/6246 merged and std.algorithm.comparison fixed
aa[std.algorithm.setops]=-dip1000
Expand Down Expand Up @@ -95,7 +95,7 @@ aa[std.container.binaryheap]=-dip1000
aa[std.container.dlist]=-dip1000
aa[std.container.package]=-dip1000
aa[std.container.rbtree]=-dip25 # DROP
aa[std.container.slist]=-dip25 # -dip1000 -version=DIP1000 depends on an update (no insertFront's code duplication in constructor) and merge of https://github.com/dlang/phobos/pull/6295
aa[std.container.slist]=-dip1000
aa[std.container.util]=-dip25 # depends on rbtree and slist = -dip1000

aa[std.datetime.date]=-dip1000
Expand All @@ -121,24 +121,28 @@ aa[std.experimental.allocator.common]=-dip1000
aa[std.experimental.allocator.gc_allocator]=-dip1000
aa[std.experimental.allocator.mallocator]=-dip1000
aa[std.experimental.allocator.mmap_allocator]=-dip1000
aa[std.experimental.allocator.package]=-dip25 # Linker errors
aa[std.experimental.allocator.package]=-dip25 # Linker errors: undefined reference pure nothrow @property @nogc return @safe std.internal.test.dummyrange.DummyRange!(0, 1, 1, uint[]).DummyRange std.internal.test.dummyrange.DummyRange!(0, 1, 1, uint[]).DummyRange.save()
# pure nothrow @property @nogc return @safe std.internal.test.dummyrange.DummyRange!(0, 1, 2, uint[]).DummyRange std.internal.test.dummyrange.DummyRange!(0, 1, 2, uint[]).DummyRange.save()
# pure nothrow @property @nogc return @safe std.internal.test.dummyrange.DummyRange!(1, 1, 1, uint[]).DummyRange std.internal.test.dummyrange.DummyRange!(1, 1, 1, uint[]).DummyRange.save()
# pure nothrow @property @nogc return @safe std.internal.test.dummyrange.DummyRange!(1, 1, 2, uint[]).DummyRange std.internal.test.dummyrange.DummyRange!(1, 1, 2, uint[]).DummyRange.save()
aa[std.experimental.allocator.showcase]=-dip1000
aa[std.experimental.allocator.typed]=-dip1000
aa[std.experimental.allocator.building_blocks.affix_allocator]=-dip25 # Linker errors
aa[std.experimental.allocator.building_blocks.affix_allocator]=-dip1000
aa[std.experimental.allocator.building_blocks.aligned_block_list]=-dip1000
aa[std.experimental.allocator.building_blocks.allocator_list]=-dip1000
aa[std.experimental.allocator.building_blocks.ascending_page_allocator]=-dip1000
aa[std.experimental.allocator.building_blocks.bitmapped_block]=-dip25 # Linker error
aa[std.experimental.allocator.building_blocks.bucketizer]=-dip25 # Linker errors
aa[std.experimental.allocator.building_blocks.fallback_allocator]=-dip25 # Linker errors
aa[std.experimental.allocator.building_blocks.bitmapped_block]=-dip1000
aa[std.experimental.allocator.building_blocks.bucketizer]=-dip1000
aa[std.experimental.allocator.building_blocks.fallback_allocator]=-dip1000
aa[std.experimental.allocator.building_blocks.free_list]=-dip1000
aa[std.experimental.allocator.building_blocks.free_tree]=-dip1000
aa[std.experimental.allocator.building_blocks.kernighan_ritchie]=-dip1000
aa[std.experimental.allocator.building_blocks.null_allocator]=-dip1000
aa[std.experimental.allocator.building_blocks.package]=-dip1000
aa[std.experimental.allocator.building_blocks.quantizer]=-dip1000
aa[std.experimental.allocator.building_blocks.region]=-dip25 # Linker errors
aa[std.experimental.allocator.building_blocks.region]=-dip1000
aa[std.experimental.allocator.building_blocks.scoped_allocator]=-dip1000
aa[std.experimental.allocator.building_blocks.segregator]=-dip25 # Linker errors
aa[std.experimental.allocator.building_blocks.segregator]=-dip1000
aa[std.experimental.allocator.building_blocks.stats_collector]=-dip1000
aa[std.experimental.logger.core]=-dip1000 # merged https://github.com/dlang/phobos/pull/6266
aa[std.experimental.logger.filelogger]=-dip25 # merged https://github.com/dlang/phobos/pull/6266; depends on https://github.com/dlang/phobos/pull/5915 ? and a fix for: std.format.formattedWrite
Expand Down
30 changes: 11 additions & 19 deletions posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ROOT_OF_THEM_ALL = generated
ROOT = $(ROOT_OF_THEM_ALL)/$(OS)/$(BUILD)/$(MODEL)
DUB=dub
TOOLS_DIR=../tools
DSCANNER_HASH=032ac7e3ed5ea7df5e097badcfcd91d3cb8f18da
DSCANNER_HASH=39496ede1a2c00674c4e04b6513be7cc9aee6cef
DSCANNER_DIR=$(ROOT_OF_THEM_ALL)/dscanner-$(DSCANNER_HASH)

# Set DRUNTIME name and full path
Expand Down Expand Up @@ -120,19 +120,20 @@ else
endif

# Set DFLAGS
DFLAGS=-conf= -I$(DRUNTIME_PATH)/import $(DMDEXTRAFLAGS) -w -de -dip25 $(MODEL_FLAG) $(PIC) -transition=complex
DFLAGS=
override DFLAGS+=-conf= -I$(DRUNTIME_PATH)/import $(DMDEXTRAFLAGS) -w -de -dip25 $(MODEL_FLAG) $(PIC) -transition=complex
ifeq ($(BUILD),debug)
DFLAGS += -g -debug
override DFLAGS += -g -debug
else
DFLAGS += -O -release
override DFLAGS += -O -release
endif

ifdef ENABLE_COVERAGE
DFLAGS += -cov
override DFLAGS += -cov
endif
ifneq (,$(TZ_DATABASE_DIR))
$(file > /tmp/TZDatabaseDirFile, ${TZ_DATABASE_DIR})
DFLAGS += -version=TZDatabaseDir -J/tmp/
override DFLAGS += -version=TZDatabaseDir -J/tmp/
endif

UDFLAGS=-unittest
Expand Down Expand Up @@ -218,19 +219,11 @@ PACKAGE_std_regex = package $(addprefix internal/,generator ir parser \
# Modules in std (including those in packages)
STD_MODULES=$(call P2MODULES,$(STD_PACKAGES))

# OS-specific D modules
EXTRA_MODULES_LINUX := $(addprefix std/c/linux/, linux socket)
EXTRA_MODULES_OSX := $(addprefix std/c/osx/, socket)
EXTRA_MODULES_FREEBSD := $(addprefix std/c/freebsd/, socket)
EXTRA_MODULES_WIN32 := $(addprefix std/c/windows/, com stat windows \
winsock) $(addprefix std/windows/, charset syserror)

# Other D modules that aren't under std/
EXTRA_MODULES_COMMON := $(addprefix etc/c/,curl odbc/sql odbc/sqlext \
odbc/sqltypes odbc/sqlucode sqlite3 zlib) $(addprefix std/c/,fenv locale \
math process stdarg stddef stdio stdlib string time wcharh)
odbc/sqltypes odbc/sqlucode sqlite3 zlib)

EXTRA_DOCUMENTABLES := $(EXTRA_MODULES_LINUX) $(EXTRA_MODULES_WIN32) $(EXTRA_MODULES_COMMON)
EXTRA_DOCUMENTABLES := $(EXTRA_MODULES_COMMON)

EXTRA_MODULES_INTERNAL := $(addprefix std/, \
algorithm/internal \
Expand All @@ -257,8 +250,7 @@ ALL_D_FILES = $(addsuffix .d, $(STD_MODULES) $(EXTRA_MODULES_COMMON) \
$(EXTRA_MODULES_LINUX) $(EXTRA_MODULES_OSX) $(EXTRA_MODULES_FREEBSD) \
$(EXTRA_MODULES_WIN32) $(EXTRA_MODULES_INTERNAL)) \
std/internal/windows/advapi32.d \
std/windows/registry.d std/c/linux/pthread.d std/c/linux/termios.d \
std/c/linux/tipc.d
std/windows/registry.d

# C files to be part of the build
C_MODULES = $(addprefix etc/c/zlib/, adler32 compress crc32 deflate \
Expand Down Expand Up @@ -348,7 +340,7 @@ UT_D_OBJS:=$(addprefix $(ROOT)/unittest/,$(addsuffix .o,$(D_MODULES)))
$(UT_D_OBJS): $(ALL_D_FILES)
$(UT_D_OBJS): $(ROOT)/unittest/%.o: %.d
@mkdir -p $(dir $@)
$(DMD) $(DFLAGS) $(UDFLAGS) $(aa[$(subst /,.,$(basename $<))]) -c -of$@ $<
$(DMD) $(DFLAGS) $(UDFLAGS) -c -of$@ $<

ifneq (1,$(SHARED))

Expand Down
8 changes: 4 additions & 4 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Written in the D programming language.
/**
This is a submodule of $(MREF std, algorithm).
It contains generic _comparison algorithms.
It contains generic comparison algorithms.
$(SCRIPT inhibitQuickIndex = 1;)
$(BOOKTABLE Cheat Sheet,
Expand Down Expand Up @@ -29,12 +29,12 @@ $(T2 isSameLength,
$(T2 levenshteinDistance,
`levenshteinDistance("kitten", "sitting")` returns `3` by using
the $(LINK2 https://en.wikipedia.org/wiki/Levenshtein_distance,
Levenshtein distance _algorithm).)
Levenshtein distance algorithm).)
$(T2 levenshteinDistanceAndPath,
`levenshteinDistanceAndPath("kitten", "sitting")` returns
`tuple(3, "snnnsni")` by using the
$(LINK2 https://en.wikipedia.org/wiki/Levenshtein_distance,
Levenshtein distance _algorithm).)
Levenshtein distance algorithm).)
$(T2 max,
`max(3, 4, 2)` returns `4`.)
$(T2 min,
Expand All @@ -51,7 +51,7 @@ License: $(HTTP boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: $(HTTP erdani.com, Andrei Alexandrescu)
Source: $(PHOBOSSRC std/algorithm/_comparison.d)
Source: $(PHOBOSSRC std/algorithm/comparison.d)
Macros:
T2=$(TR $(TDNW $(LREF $1)) $(TD $+))
Expand Down
Loading

0 comments on commit 8d4e394

Please sign in to comment.