diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 5e5b80101..ce25d5d9e 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -165,6 +165,7 @@ GCC_PIPE = NO # Set RPATH when linking executables and libraries. # Must be either YES or NO. If you set this to NO you must also provide a -# way for Base executables to find their shared libraries at build-time. +# way for Base executables to find their shared libraries when they are +# run at build-time, e.g. set the LD_LIBRARY_PATH environment variable. LINKER_USE_RPATH = YES diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 7764c66b8..c37b4804d 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -369,10 +369,10 @@ $(INSTALL_LIB)/%.lib: %.lib $(INSTALL_SHRLIBS): $(INSTALL_SHRLIB)/%: % $(ECHO) "Installing shared library $@" @$(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_SHRLIB) -ifneq ($(SHRLIB_SUFFIX),.dll) +ifneq ($(SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE)) ifneq (,$(strip $(SHRLIB_VERSION))) - @$(RM) $(subst .$(SHRLIB_VERSION),,$@) - ln -s $< $(subst .$(SHRLIB_VERSION),,$@) + @$(RM) $(subst $(SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE),$@) + ln -s $< $(subst $(SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE),$@) endif # SHRLIB_VERSION endif # SHRLIB_SUFFIX @@ -393,10 +393,12 @@ $(INSTALL_TCLLIB)/$(TCLINDEX): $(INSTALL_TCLLIBS) $(INSTALL_LOADABLE_SHRLIBS): $(INSTALL_SHRLIB)/%: % $(ECHO) "Installing loadable shared library $@" @$(INSTALL_LIBRARY) -d -m 555 $< $(INSTALL_SHRLIB) +ifneq ($(LOADABLE_SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE)) ifneq (,$(strip $(LOADABLE_SHRLIB_VERSION))) - @$(RM) $(subst .$(LOADABLE_SHRLIB_VERSION),,$@) - ln -s $< $(subst .$(LOADABLE_SHRLIB_VERSION),,$@) + @$(RM) $(subst $(LOADABLE_SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE),$@) + ln -s $< $(subst $(LOADABLE_SHRLIB_SUFFIX),$(SHRLIB_SUFFIX_BASE),$@) endif # LOADABLE_SHRLIB_VERSION +endif # LOADABLE_SHRLIB_SUFFIX $(INSTALL_CONFIG)/%: % $(ECHO) "Installing config file $@" diff --git a/configure/os/CONFIG.Common.UnixCommon b/configure/os/CONFIG.Common.UnixCommon index 3d3bb9c0f..5c6af5b92 100644 --- a/configure/os/CONFIG.Common.UnixCommon +++ b/configure/os/CONFIG.Common.UnixCommon @@ -19,8 +19,9 @@ OBJ = .o #Library prefix and suffixes LIB_PREFIX = lib LIB_SUFFIX = .a -SHRLIB_SUFFIX = .so$(addprefix .,$(SHRLIB_VERSION)) -LOADABLE_SHRLIB_SUFFIX = .so$(addprefix .,$(LOADABLE_SHRLIB_VERSION)) +SHRLIB_SUFFIX_BASE = .so +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE).$(SHRLIB_VERSION) +LOADABLE_SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE).$(LOADABLE_SHRLIB_VERSION) LOADABLE_SHRLIB_PREFIX = lib #------------------------------------------------------- diff --git a/configure/os/CONFIG.Common.cygwin-x86 b/configure/os/CONFIG.Common.cygwin-x86 index ee3653b76..4181ce2ba 100644 --- a/configure/os/CONFIG.Common.cygwin-x86 +++ b/configure/os/CONFIG.Common.cygwin-x86 @@ -48,12 +48,11 @@ STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL # But: if there are no objects LIBRARY_LD_OBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! -SHRLIB_PREFIX= -SHRLIB_SUFFIX=.dll +SHRLIB_PREFIX = +SHRLIB_SUFFIX_BASE = .dll +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) -LOADABLE_SHRLIB_PREFIX= -LOADABLE_SHRLIB_SUFFIX=.dll LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX)) # diff --git a/configure/os/CONFIG.Common.iosCommon b/configure/os/CONFIG.Common.iosCommon index 9159ba817..cac7ae47f 100644 --- a/configure/os/CONFIG.Common.iosCommon +++ b/configure/os/CONFIG.Common.iosCommon @@ -42,10 +42,6 @@ ARCH_DEP_LDFLAGS += $(ARCH_DEP_FLAGS) # Operating system flags OP_SYS_CFLAGS += -isysroot $(SDK_DIR) -D__IPHONE_OS_VERSION_MIN_REQUIRED=30200 -#-------------------------------------------------- -# Don't try to use precompiled headers when converting sequencer files -CPPSNCFLAGS += -no-cpp-precomp - #-------------------------------------------------- # Always compile in debugging symbol table information # @@ -54,14 +50,24 @@ OPT_CXXFLAGS_YES += -g #------------------------------------------------------- # Compiler definitions: -# Use clang instead of gcc -CC = $(GNU_BIN)/clang -CCC = $(GNU_BIN)/clang++ -CMPLR_CLASS = clang -GNU_LDLIBS_YES = + +CC_GNU = gcc +CCC_GNU = g++ +CMPLR_CLASS_GNU = gcc +CC_LLVM = llvm-gcc +CCC_LLVM = llvm-g++ +CMPLR_CLASS_LLVM = gcc +CC_CLANG = clang +CCC_CLANG = clang++ +CMPLR_CLASS_CLANG = clang + +CC = $(firstword $(wildcard $(GNU_BIN)/$(CC_$(COMPILER))) $(CC_$(COMPILER))) +CCC = $(firstword $(wildcard $(GNU_BIN)/$(CCC_$(COMPILER))) $(CCC_$(COMPILER))) +CMPLR_CLASS = $(CMPLR_CLASS_$(COMPLER)) #------------------------------------------------------- # Linker flags +GNU_LDLIBS_YES = OP_SYS_LDFLAGS += -dynamic -Z -L$(SDK_DIR)/usr/lib -L$(SDK_DIR)/usr/lib/system #------------------------------------------------------- @@ -71,7 +77,8 @@ SHRLIB_LDFLAGS = -dynamiclib -flat_namespace -undefined suppress \ -install_name $(shell perl $(TOOLS)/fullPathName.pl $(INSTALL_LIB))/$@ \ -compatibility_version $(EPICS_VERSION).$(EPICS_REVISION) \ -current_version $(SHRLIB_VERSION) -SHRLIB_SUFFIX = .$(SHRLIB_VERSION).dylib +SHRLIB_SUFFIX_BASE = .dylib +SHRLIB_SUFFIX = .$(SHRLIB_VERSION)$(SHRLIB_SUFFIX_BASE) LOADABLE_SHRLIB_LDFLAGS = -bundle -flat_namespace -undefined suppress diff --git a/configure/os/CONFIG.Common.win32-x86-cygwin b/configure/os/CONFIG.Common.win32-x86-cygwin index 49029cf2e..9cff54d3e 100644 --- a/configure/os/CONFIG.Common.win32-x86-cygwin +++ b/configure/os/CONFIG.Common.win32-x86-cygwin @@ -55,12 +55,13 @@ STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL # But: if there are no objects LIBRARY_LD_OBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! -SHRLIB_PREFIX= -SHRLIB_SUFFIX=.dll +SHRLIB_PREFIX = +SHRLIB_SUFFIX_BASE = .dll +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) -LOADABLE_SHRLIB_PREFIX= -LOADABLE_SHRLIB_SUFFIX=.dll +LOADABLE_SHRLIB_PREFIX = +LOADABLE_SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX)) # diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index f4ee2c1ff..44a7fbe7c 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -49,12 +49,13 @@ STATIC_CXXFLAGS_NO= $(VISC_DLL) -D_DLL # But: if there are no objects LIBRARY_LD_OBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! -SHRLIB_PREFIX= -SHRLIB_SUFFIX=.dll +SHRLIB_PREFIX = +SHRLIB_SUFFIX_BASE = .dll +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) -LOADABLE_SHRLIB_PREFIX= -LOADABLE_SHRLIB_SUFFIX=.dll +LOADABLE_SHRLIB_PREFIX = +LOADABLE_SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(LOADABLE_SHRLIB_SUFFIX)) # diff --git a/configure/os/CONFIG.darwinCommon.darwinCommon b/configure/os/CONFIG.darwinCommon.darwinCommon index dd794a02d..7e02bbf82 100644 --- a/configure/os/CONFIG.darwinCommon.darwinCommon +++ b/configure/os/CONFIG.darwinCommon.darwinCommon @@ -36,11 +36,6 @@ ARCH_DEP_LDFLAGS += $(ARCH_DEP_FLAGS) # OP_SYS_CFLAGS += -fno-common -# -# Don't try to use precompiled headers when converting sequencer files -# -CPPSNCFLAGS += -no-cpp-precomp - # # Darwin os definition # @@ -75,7 +70,8 @@ SHRLIB_LDFLAGS = -dynamiclib -flat_namespace -undefined suppress \ -install_name $(shell perl $(TOOLS)/fullPathName.pl $(INSTALL_LIB))/$@ \ -compatibility_version $(EPICS_VERSION).$(EPICS_REVISION) \ -current_version $(SHRLIB_VERSION) -SHRLIB_SUFFIX = .$(SHRLIB_VERSION).dylib +SHRLIB_SUFFIX_BASE = .dylib +SHRLIB_SUFFIX = .$(SHRLIB_VERSION)$(SHRLIB_SUFFIX_BASE) LOADABLE_SHRLIB_LDFLAGS = -bundle -flat_namespace -undefined suppress diff --git a/configure/os/CONFIG.win32-x86-borland.win32-x86-borland b/configure/os/CONFIG.win32-x86-borland.win32-x86-borland index 26235c3bd..42e9396dd 100644 --- a/configure/os/CONFIG.win32-x86-borland.win32-x86-borland +++ b/configure/os/CONFIG.win32-x86-borland.win32-x86-borland @@ -178,7 +178,8 @@ LINK.shrlib+= $(DLL_DEF_FLAG),$(LIBRARY_LD_RESS) # But: if there are no objects LIBRARY_LD_OBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! -SHRLIB_SUFFIX=.dll +SHRLIB_SUFFIX_BASE = .dll +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) diff --git a/configure/os/CONFIG.win32-x86.win32-x86 b/configure/os/CONFIG.win32-x86.win32-x86 index da07db685..873aad327 100644 --- a/configure/os/CONFIG.win32-x86.win32-x86 +++ b/configure/os/CONFIG.win32-x86.win32-x86 @@ -214,7 +214,8 @@ MUNCH_CMD = $(CCC) /Fo $@ $^ # But: if there are no objects LIBRARY_LD_OBJS to include # in this library (may be for e.g. base/src/libCompat # on some archs), don't define (and build) any library! -SHRLIB_SUFFIX=.dll +SHRLIB_SUFFIX_BASE = .dll +SHRLIB_SUFFIX = $(SHRLIB_SUFFIX_BASE) SHRLIBNAME_YES = $(BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) LOADABLE_SHRLIBNAME = $(LOADABLE_BUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) TESTSHRLIBNAME_YES = $(TESTBUILD_LIBRARY:%=%$(SHRLIB_SUFFIX)) diff --git a/configure/os/CONFIG_SITE.Common.ios-arm b/configure/os/CONFIG_SITE.Common.ios-arm index 43874fe41..462db67f8 100644 --- a/configure/os/CONFIG_SITE.Common.ios-arm +++ b/configure/os/CONFIG_SITE.Common.ios-arm @@ -19,10 +19,3 @@ ARCH_CLASS = armv7 #ARCH_CLASS = armv6 armv7 #ARCH_CLASS = armv6 - - -# Uncomment these two definitions to use g++ instead of clang++ -# which may be needed in some circumstances: -# -#CCC = $(GNU_BIN)/c++ -#GNU_LDLIBS_YES = -lgcc diff --git a/configure/os/CONFIG_SITE.Common.iosCommon b/configure/os/CONFIG_SITE.Common.iosCommon index 121857c27..a41721621 100644 --- a/configure/os/CONFIG_SITE.Common.iosCommon +++ b/configure/os/CONFIG_SITE.Common.iosCommon @@ -10,17 +10,29 @@ #IOS_VERSION = 3.2 #IOS_VERSION = 4.1 +#IOS_VERSION = 4.2 #IOS_VERSION = 4.3 IOS_VERSION = 5.0 -# Most sites will want shared libraries +# Which compiler to use: +# CLANG is preferred for recent versions of Xcode +# LLVM uses the llvm-gcc and llvm-g++ compilers +# GNU is needed for older versions of Xcode -STATIC_BUILD=NO -SHARED_LIBRARIES=YES +COMPILER = CLANG +#COMPILER = LLVM +#COMPILER = GNU -# Platform path, this is probably correct +# Most sites will want to build shared libraries (which is the +# default), but if you get an error from ld while building libCom, +# try uncommenting this, which is needed for some compiler versions: + +#SHARED_LIBRARIES = NO + + +# Get platform path from OS, these are usually correct: XCODE_PATH := $(shell xcode-select -print-path) PLATFORM_DIR = $(XCODE_PATH)/Platforms/$(IOS_PLATFORM).platform diff --git a/src/ioc/db/dbConvert.c b/src/ioc/db/dbConvert.c index 4b7ad7da1..303c1e1a8 100644 --- a/src/ioc/db/dbConvert.c +++ b/src/ioc/db/dbConvert.c @@ -416,7 +416,7 @@ static long getCharChar( char *pbuffer = (char *)pto; char *psrc=(char *)(paddr->pfield); - if (paddr->pfldDes->field_type == DBF_STRING) { + if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) { /* This is a DBF_STRING field being read as a long string. * The buffer we return must be zero-terminated. */ @@ -443,7 +443,7 @@ static long getCharUchar( unsigned char *pbuffer = (unsigned char *)pto; char *psrc=(char *)(paddr->pfield); - if (paddr->pfldDes->field_type == DBF_STRING) { + if (paddr->pfldDes && paddr->pfldDes->field_type == DBF_STRING) { /* This is a DBF_STRING field being read as a long string. * The buffer we return must be zero-terminated. */ @@ -2600,7 +2600,7 @@ static long putStringEnum( status = (*prset->get_enum_strs)(paddr,&enumStrs); if(!status) { nchoices = enumStrs.no_str; - nargs = sscanf(pbuffer," %u %n",&ind,&nchars); + nargs = sscanf(pbuffer,"%u%n",&ind,&nchars); if(nargs==1 && nchars==strlen(pbuffer) && indget_enum_strs)(paddr,&enumStrs); if(!status) { nchoices = enumStrs.no_str; - nargs = sscanf(from," %u %n",&ind,&nchars); + nargs = sscanf(from,"%u%n",&ind,&nchars); if(nargs==1 && nchars==strlen(from) && ind '%s'", pFormat, buf); + + char bigBuf [512]; + memset(bigBuf, '\a', sizeof(bigBuf)); + bigBuf[ sizeof(bigBuf) - 1] = '\0'; + et.strftime(buf, sizeof(buf), bigBuf); + testOk(strcmp(buf, "") == 0, "bad format => '%s'", buf); } - { // invalidFormatTest - char bigBuf [512]; - char buf [32]; - memset(bigBuf, '\a', sizeof(bigBuf )); - bigBuf[ sizeof(bigBuf) - 1] = '\0'; - begin.strftime(buf, sizeof(buf), bigBuf); - testOk(strcmp(buf, "") == 0, "bad format => '%s'", buf); + epicsTime now; + try { + now = epicsTime::getCurrent(); + testPass("default time provider"); + } + catch ( ... ) { + testFail("epicsTime::getCurrent() throws"); + testAbort("Can't continue, check your time provider"); + } + + { + l_fp ntp = now; + epicsTime tsf = ntp; + const double diff = fabs(tsf - now); + // the difference in the precision of the two time formats + static const double precisionNTP = 1.0 / (1.0 + 0xffffffff); + testOk1(diff <= precisionEPICS + precisionNTP); } testDiag("Running %d loops", nTimes); - for (int iTimes=0; iTimes < nTimes; ++iTimes) { - for (unsigned i=0; i= end); + epicsTime copy = now; + testOk1(copy == now); + testOk1(copy <= now); + testOk1(copy >= now); - testOk1(end > begin); - testOk1(end >= begin); - testOk1(begin != end); - testOk1(begin < end); - testOk1(begin <= end); + testOk1(now > begin); + testOk1(now >= begin); + testOk1(begin != now); + testOk1(begin < now); + testOk1(begin <= now); - testOk1(end - end == 0); - testOk(fabs((end - begin) - diff) < precisionEPICS * 0.01, - "end - begin ~= diff"); + testOk1(now - now == 0); + testOk(fabs((now - begin) - diff) < precisionEPICS * 0.01, + "now - begin ~= diff"); testOk1(begin + 0 == begin); - testOk1(begin + diff == end); - testOk1(end - 0 == end); - testOk1(end - diff == begin); + testOk1(begin + diff == now); + testOk1(now - 0 == now); + testOk1(now - diff == begin); - epicsTime end2 = begin; - end2 += diff; - testOk(end2 == end, "(begin += diff) == end"); + epicsTime end = begin; + end += diff; + testOk(end == now, "(begin += diff) == now"); - end2 = end; - end2 -= diff; - testOk(end2 == begin, "(end -= diff) == begin"); + end = now; + end -= diff; + testOk(end == begin, "(now -= diff) == begin"); // test struct tm round-trip conversion local_tm_nano_sec ansiDate = begin; epicsTime beginANSI = ansiDate; - testOk1(beginANSI + diff == end); + testOk1(beginANSI + diff == now); // test struct timespec round-trip conversion struct timespec ts = begin; epicsTime beginTS = ts; - testOk1(beginTS + diff == end); + testOk1(beginTS + diff == now); } return testDone(); diff --git a/src/std/rec/calcoutRecord.c b/src/std/rec/calcoutRecord.c index 062580c76..0b7c78323 100644 --- a/src/std/rec/calcoutRecord.c +++ b/src/std/rec/calcoutRecord.c @@ -252,6 +252,7 @@ static long process(calcoutRecord *prec) if (doOutput) { if (prec->odly > 0.0) { prec->dlya = 1; + recGblGetTimeStamp(prec); db_post_events(prec, &prec->dlya, DBE_VALUE); callbackRequestProcessCallbackDelayed(&prpvt->doOutCb, prec->prio, prec, (double)prec->odly); @@ -263,9 +264,11 @@ static long process(calcoutRecord *prec) prec->pact = TRUE; } } + recGblGetTimeStamp(prec); } else { /* pact == TRUE */ if (prec->dlya) { prec->dlya = 0; + recGblGetTimeStamp(prec); db_post_events(prec, &prec->dlya, DBE_VALUE); /* Make pact FALSE for asynchronous device support*/ prec->pact = FALSE; @@ -274,9 +277,9 @@ static long process(calcoutRecord *prec) prec->pact = TRUE; } else {/*Device Support is asynchronous*/ writeValue(prec); + recGblGetTimeStamp(prec); } } - recGblGetTimeStamp(prec); monitor(prec); recGblFwdLink(prec); prec->pact = FALSE; diff --git a/src/std/rec/seqRecord.c b/src/std/rec/seqRecord.c index 67e2518d8..5b43d34e8 100644 --- a/src/std/rec/seqRecord.c +++ b/src/std/rec/seqRecord.c @@ -90,8 +90,6 @@ typedef struct callbackSeq { int index; }callbackSeq; -int processNextLink(); - /***************************************************************************** * @@ -327,7 +325,9 @@ static long asyncFinish(seqRecord *prec) if (seqRecDebug > 5) printf("asyncFinish(%s) completing processing\n", prec->name); prec->udf = FALSE; - + + recGblGetTimeStamp(prec); + MonitorMask = recGblResetAlarms(prec); if (MonitorMask) @@ -336,8 +336,6 @@ static long asyncFinish(seqRecord *prec) /* process the forward scan link record */ recGblFwdLink(prec); - recGblGetTimeStamp(prec); - /* tsLocalTime(&prec->time); */ prec->pact = FALSE; return(0); @@ -377,6 +375,8 @@ static void processCallback(CALLBACK *arg) dbGetLink(&(pcb->plinks[pcb->index]->dol), DBR_DOUBLE, &(pcb->plinks[pcb->index]->dov),0,0); + recGblGetTimeStamp(prec); + /* Dump the value to the destination field */ dbPutLink(&(pcb->plinks[pcb->index]->lnk), DBR_DOUBLE, &(pcb->plinks[pcb->index]->dov),1);