Merge remote-tracking branch 'upstream/stable' into merge_stable

This commit is contained in:
Martin Nowak 2017-11-21 14:10:41 +01:00
commit 4024b1250d
2 changed files with 23 additions and 13 deletions

View file

@ -40,7 +40,7 @@ ifeq (osx,$(OS))
export MACOSX_DEPLOYMENT_TARGET=10.7
endif
# Default to a release built, override with BUILD=debug
# Default to a release build, override with BUILD=debug
ifeq (,$(BUILD))
BUILD_WAS_SPECIFIED=0
BUILD=release
@ -54,11 +54,19 @@ ifneq ($(BUILD),release)
endif
endif
# -fPIC is enabled by default and can be disabled with DISABLE_PIC=1
ifeq ($(DISABLE_PIC),)
PIC_FLAG:=-fPIC
# default to PIC on x86_64, use PIC=1/0 to en-/disable PIC.
# Note that shared libraries and C files are always compiled with PIC.
ifeq ($(PIC),)
ifeq ($(MODEL),64) # x86_64
PIC:=1
else
PIC:=0
endif
endif
ifeq ($(PIC),1)
override PIC:=-fPIC
else
PIC_FLAG:=
override PIC:=
endif
# Configurable stuff that's rarely edited
@ -120,7 +128,7 @@ else
endif
# Set DFLAGS
DFLAGS=-conf= -I$(DRUNTIME_PATH)/import $(DMDEXTRAFLAGS) -w -de -dip25 $(MODEL_FLAG) $(PIC_FLAG)
DFLAGS=-conf= -I$(DRUNTIME_PATH)/import $(DMDEXTRAFLAGS) -w -de -dip25 $(MODEL_FLAG) $(PIC)
ifeq ($(BUILD),debug)
DFLAGS += -g -debug
else
@ -312,6 +320,7 @@ $(ROOT)/libphobos2.so: $(ROOT)/$(SONAME)
$(ROOT)/$(SONAME): $(LIBSO)
ln -sf $(notdir $(LIBSO)) $@
$(LIBSO): override PIC:=-fPIC
$(LIBSO): $(OBJS) $(ALL_D_FILES) $(DRUNTIMESO)
$(DMD) $(DFLAGS) -shared -debuglib= -defaultlib= -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(LINKDL) $(D_FILES) $(OBJS)
@ -353,6 +362,7 @@ UT_LIBSO:=$(ROOT)/unittest/libphobos2-ut.so
$(UT_D_OBJS): $(DRUNTIMESO)
$(UT_LIBSO): override PIC:=-fPIC
$(UT_LIBSO): $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO)
$(DMD) $(DFLAGS) -shared -unittest -of$@ $(UT_D_OBJS) $(OBJS) $(DRUNTIMESO) $(LINKDL) -defaultlib= -debuglib=

View file

@ -119,7 +119,7 @@ if (fun.length >= 1)
/++
$(D cache) eagerly evaluates $(D front) of $(D range)
on each construction or call to $(D popFront),
to store the result in a cache.
to store the result in a _cache.
The result is then directly returned when $(D front) is called,
rather than re-evaluated.
@ -129,24 +129,24 @@ In particular, it can be placed after a call to $(D map), or before a call
to $(D filter).
$(D cache) may provide
$(REF_ALTTEXT bidirectional range, isBidirectionalRange, std,range,primitives)
$(REF_ALTTEXT bidirectional _range, isBidirectionalRange, std,_range,primitives)
iteration if needed, but since this comes at an increased cost, it must be explicitly requested via the
call to $(D cacheBidirectional). Furthermore, a bidirectional cache will
call to $(D cacheBidirectional). Furthermore, a bidirectional _cache will
evaluate the "center" element twice, when there is only one element left in
the range.
the _range.
$(D cache) does not provide random access primitives,
as $(D cache) would be unable to cache the random accesses.
as $(D cache) would be unable to _cache the random accesses.
If $(D Range) provides slicing primitives,
then $(D cache) will provide the same slicing primitives,
but $(D hasSlicing!Cache) will not yield true (as the $(REF hasSlicing, std,_range,primitives)
trait also checks for random access).
Params:
range = an $(REF_ALTTEXT input range, isInputRange, std,range,primitives)
range = an $(REF_ALTTEXT input _range, isInputRange, std,_range,primitives)
Returns:
an input range with the cached values of range
an input _range with the cached values of _range
+/
auto cache(Range)(Range range)
if (isInputRange!Range)