From 971a81944643103a5e6183c8017fa9306bc76c7a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 4 Feb 2015 16:28:23 -0600 Subject: [PATCH 01/75] Use order-only prerequisites for include files This prevents unnecessary recompilations when an include file gets regenerated. --- configure/RULES_BUILD | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 31267faf9..2c0cb7bdf 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -215,15 +215,16 @@ $(TESTPRODNAME) $(PRODNAME): %$(EXE): %.o : %.cc %.o : %.cpp -%$(OBJ): %.c $(COMMON_INC) $(INSTALL_INC) +# Include files are order-only prerequisites for compilation: +%$(OBJ): %.c | $(COMMON_INC) $(INSTALL_INC) @$(RM) $@ $(COMPILE.c) -c $< -%$(OBJ): %.cc $(COMMON_INC) $(INSTALL_INC) +%$(OBJ): %.cc | $(COMMON_INC) $(INSTALL_INC) @$(RM) $@ $(COMPILE.cpp) -c $< -%$(OBJ): %.cpp $(COMMON_INC) $(INSTALL_INC) +%$(OBJ): %.cpp | $(COMMON_INC) $(INSTALL_INC) @$(RM) $@ $(COMPILE.cpp) -c $< From 1a094f5971c7649cb345542b80d165eb59c5dbbf Mon Sep 17 00:00:00 2001 From: Richard Fearn Date: Thu, 5 Feb 2015 11:53:33 +0100 Subject: [PATCH 02/75] catools: make `caget -lb` output '0' instead of empty string for zero value --- src/catools/tool_lib.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 71b444ccb..6ad1a8b56 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -68,17 +68,21 @@ void sprint_long (char *ret, long val, IntFormatT outType) case hex: sprintf(ret, "0x%lX", val); break; case oct: sprintf(ret, "0o%lo", val); break; case bin: - for (i=31; i>=0 ; i--) - { - bit = (val>>i) & 0x1L; - if (skip<0 && bit) + if (val == 0) { + sprintf(ret, "0"); + } else { + for (i=31; i>=0 ; i--) { - skip = 31 - i; /* skip leading 0's */ - ret[i+1] = '\0'; - } - if (skip >= 0) - { - ret[31-i-skip] = (bit) ? '1' : '0'; + bit = (val>>i) & 0x1L; + if (skip<0 && bit) + { + skip = 31 - i; /* skip leading 0's */ + ret[i+1] = '\0'; + } + if (skip >= 0) + { + ret[31-i-skip] = (bit) ? '1' : '0'; + } } } break; From 7fe5f2f3a3a50b8716794681bf283b8d3e564993 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Feb 2015 10:22:55 -0600 Subject: [PATCH 03/75] Another order-only prerequisite --- configure/RULES_BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 2c0cb7bdf..135509942 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -94,7 +94,7 @@ include $(CONFIG)/RULES_TARGET # Read dependency files ifneq (,$(strip $(HDEPENDS_FILES))) -$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): $(COMMON_INC) +$(filter-out $(wildcard *$(DEP)), $(HDEPENDS_FILES)): | $(COMMON_INC) -include $(HDEPENDS_FILES) endif From 02aa7e2f73293ada08705523ce4d393bda25c249 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Feb 2015 18:10:33 -0600 Subject: [PATCH 04/75] Stop bogus error messages from CA Repeater on Windows Required adding a new API to osiSock.h and the 2 implementations of epicsSocketConvertErrnoToString. --- src/ca/repeater.cpp | 85 ++++++++----------- .../WIN32/epicsSocketConvertErrnoToString.cpp | 40 +++++---- .../epicsSocketConvertErrnoToString.cpp | 20 +++-- src/libCom/osi/osiSock.h | 6 +- 4 files changed, 75 insertions(+), 76 deletions(-) diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index ef271e461..847431d34 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* @@ -16,26 +15,6 @@ * Author: Jeff Hill * Date: 3-27-90 * - * Control System Software for the GTA Project - * - * Copyright 1988, 1989, the Regents of the University of California. - * - * This software was produced under a U.S. Government contract - * (W-7405-ENG-36) at the Los Alamos National Laboratory, which is - * operated by the University of California for the U.S. Department - * of Energy. - * - * Developed by the Controls and Automation Group (AT-8) - * Accelerator Technology Division - * Los Alamos National Laboratory - * - * Direct inqueries to: - * Jeff HIll, AT-8, Mail Stop H820 - * Los Alamos National Laboratory - * Los Alamos, New Mexico 87545 - * Phone: (505) 665-1831 - * E-mail: johill@lanl.gov - * * PURPOSE: * Broadcasts fan out over the LAN, but old IP kernels do not allow * two processes on the same machine to get the same broadcast @@ -108,17 +87,17 @@ static const unsigned short PORT_ANY = 0u; /* * makeSocket() */ -static bool makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) +static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) { int status; - union { - struct sockaddr_in ia; - struct sockaddr sa; - } bd; + union { + struct sockaddr_in ia; + struct sockaddr sa; + } bd; SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 ); if ( sock == INVALID_SOCKET ) { - return false; + return SOCKERRNO; } /* @@ -132,15 +111,16 @@ static bool makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) bd.ia.sin_port = htons ( port ); status = bind ( sock, &bd.sa, (int) sizeof(bd) ); if ( status < 0 ) { + status = SOCKERRNO; epicsSocketDestroy ( sock ); - return false; + return status; } if ( reuseAddr ) { epicsSocketEnableAddressReuseDuringTimeWaitState ( sock ); } } *pSock = sock; - return true; + return 0; } repeaterClient::repeaterClient ( const osiSockAddr &fromIn ) : @@ -156,10 +136,10 @@ bool repeaterClient::connect () { int status; - if ( ! makeSocket ( PORT_ANY, false, & this->sock ) ) { + if ( int sockerrno = makeSocket ( PORT_ANY, false, & this->sock ) ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( - sockErrBuf, sizeof ( sockErrBuf ) ); + epicsSocketConvertErrorToString ( + sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: no client sock because \"%s\"\n", __FILE__, sockErrBuf ); return false; @@ -300,20 +280,25 @@ inline bool repeaterClient::identicalPort ( const osiSockAddr &fromIn ) bool repeaterClient::verify () { SOCKET tmpSock; - bool success = makeSocket ( this->port (), false, & tmpSock ); - if ( success ) { + int sockerrno = makeSocket ( this->port (), false, & tmpSock ); + + if ( sockerrno == SOCK_EADDRINUSE ) { + // Normal result, client using port + return true; + } + + if ( sockerrno == 0 ) { + // Client went away, released port epicsSocketDestroy ( tmpSock ); } else { - if ( SOCKERRNO != SOCK_EADDRINUSE ) { - char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( - sockErrBuf, sizeof ( sockErrBuf ) ); - fprintf ( stderr, "CA Repeater: bind test err was \"%s\"\n", - sockErrBuf ); - } + char sockErrBuf[64]; + epicsSocketConvertErrorToString ( + sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); + fprintf ( stderr, "CA Repeater: Bind test error \"%s\"\n", + sockErrBuf ); } - return ! success; + return false; } @@ -387,10 +372,10 @@ static void register_new_client ( osiSockAddr & from, if ( ! init ) { SOCKET sock; - if ( ! makeSocket ( PORT_ANY, true, & sock ) ) { + if ( int sockerrno = makeSocket ( PORT_ANY, true, & sock ) ) { char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( - sockErrBuf, sizeof ( sockErrBuf ) ); + epicsSocketConvertErrorToString ( + sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: Unable to create repeater bind test socket because \"%s\"\n", __FILE__, sockErrBuf ); } @@ -511,18 +496,18 @@ void ca_repeater () port = envGetInetPortConfigParam ( & EPICS_CA_REPEATER_PORT, static_cast (CA_REPEATER_PORT) ); - if ( ! makeSocket ( port, true, & sock ) ) { + if ( int sockerrno = makeSocket ( port, true, & sock ) ) { /* * test for server was already started */ - if ( SOCKERRNO == SOCK_EADDRINUSE ) { + if ( sockerrno == SOCK_EADDRINUSE ) { osiSockRelease (); debugPrintf ( ( "CA Repeater: exiting because a repeater is already running\n" ) ); return; } char sockErrBuf[64]; - epicsSocketConvertErrnoToString ( - sockErrBuf, sizeof ( sockErrBuf ) ); + epicsSocketConvertErrorToString ( + sockErrBuf, sizeof ( sockErrBuf ), sockerrno ); fprintf ( stderr, "%s: Unable to create repeater socket because \"%s\" - fatal\n", __FILE__, sockErrBuf ); osiSockRelease (); diff --git a/src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp b/src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp index d0a70aeaa..5ab809cde 100644 --- a/src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp +++ b/src/libCom/osi/os/WIN32/epicsSocketConvertErrnoToString.cpp @@ -1,11 +1,9 @@ - /*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ @@ -20,28 +18,36 @@ #include "epicsStdio.h" /* - * epicsSocketConvertErrnoToString () + * epicsSocketConvertErrorToString () */ -void epicsSocketConvertErrnoToString ( - char * pBuf, unsigned bufSize ) +void epicsSocketConvertErrorToString ( + char * pBuf, unsigned bufSize, int theSockError ) { if ( bufSize ) { - /* - * this does not work on systems prior to W2K - */ - int theSockError = SOCKERRNO; - DWORD success = FormatMessage ( - FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, - NULL, theSockError, - MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), /* Default language */ - pBuf, bufSize, NULL ); - if ( ! success ) { + /* + * this does not work on systems prior to W2K + */ + DWORD success = FormatMessage ( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_MAX_WIDTH_MASK, + NULL, theSockError, + MAKELANGID ( LANG_NEUTRAL, SUBLANG_DEFAULT ), /* Default language */ + pBuf, bufSize, NULL ); + if ( ! success ) { int status = epicsSnprintf ( pBuf, bufSize, "WINSOCK Error %d", theSockError ); if ( status <= 0 ) { strncpy ( pBuf, "WINSOCK Error", bufSize ); pBuf [bufSize - 0] = '\0'; } - } + } } } + +/* + * epicsSocketConvertErrnoToString () + */ +void epicsSocketConvertErrnoToString ( + char * pBuf, unsigned bufSize ) +{ + epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO ); +} diff --git a/src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp b/src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp index 0edee89de..0e0ef94f0 100644 --- a/src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp +++ b/src/libCom/osi/os/default/epicsSocketConvertErrnoToString.cpp @@ -1,11 +1,9 @@ - /*************************************************************************\ * Copyright (c) 2002 The University of Chicago, as Operator of Argonne * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /* osdSock.c */ @@ -22,14 +20,22 @@ #include "osiSock.h" /* - * epicsSocketConvertErrnoToString() + * epicsSocketConvertErrorToString() */ -void epicsSocketConvertErrnoToString ( - char * pBuf, unsigned bufSize ) +void epicsSocketConvertErrorToString ( + char * pBuf, unsigned bufSize, int theSockError ) { if ( bufSize ) { - strncpy ( pBuf, strerror ( SOCKERRNO ), bufSize ); + strncpy ( pBuf, strerror ( theSockError ), bufSize ); pBuf[bufSize-1] = '\0'; } } +/* + * epicsSocketConvertErrnoToString() + */ +void epicsSocketConvertErrnoToString ( + char * pBuf, unsigned bufSize ) +{ + epicsSocketConvertErrorToString ( pBuf, bufSize, SOCKERRNO ); +} diff --git a/src/libCom/osi/osiSock.h b/src/libCom/osi/osiSock.h index b098290da..1b52c7993 100644 --- a/src/libCom/osi/osiSock.h +++ b/src/libCom/osi/osiSock.h @@ -140,9 +140,11 @@ epicsShareFunc int epicsShareAPI osiSockAttach (void); /* returns T if success, epicsShareFunc void epicsShareAPI osiSockRelease (void); /* - * convert socket error number to a string + * convert socket error numbers to a string */ -epicsShareFunc void epicsSocketConvertErrnoToString ( +epicsShareFunc void epicsSocketConvertErrorToString ( + char * pBuf, unsigned bufSize, int error ); +epicsShareFunc void epicsSocketConvertErrnoToString ( char * pBuf, unsigned bufSize ); typedef union osiSockAddr { From 26ab431c0a6a2e7970787393bb4d015ea37c2e72 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 11:16:24 -0600 Subject: [PATCH 05/75] Back-ported the tapfiles build target from 3.15 This is the version that works on Windows. --- configure/RULES.Db | 2 +- configure/RULES_ARCHS | 2 +- configure/RULES_BUILD | 19 ++++++++++++++----- configure/RULES_DIRS | 3 ++- documentation/RELEASE_NOTES.html | 9 +++++++++ src/tools/makeTestfile.pl | 3 +++ 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index 436c05a9a..45acff5da 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -134,7 +134,7 @@ ACTIONS += build ACTIONS += install ACTIONS += buildInstall ACTIONS += browse -ACTIONS += runtests +ACTIONS += runtests tapfiles actionArchTargets = $(foreach x, $(ACTIONS),\ $(foreach arch,$(BUILD_ARCHS), $(x)$(DIVIDER)$(arch))) diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index eba7cfab5..1d4c2d4c1 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -17,7 +17,7 @@ ACTIONS += build ACTIONS += install ACTIONS += buildInstall ACTIONS += browse -ACTIONS += runtests +ACTIONS += runtests tapfiles #ACTIONS += rebuild actionPart = $(word 1, $(subst $(DIVIDER), ,$@)) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index 36e21f547..bba3cdc73 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -96,6 +96,8 @@ ifneq (,$(strip $(TESTS))) TARGETS += testspec endif +TAPFILES += $(TESTSCRIPTS:.t=.tap) + #--------------------------------------------------------------- # Libraries # @@ -142,7 +144,8 @@ clean:: @$(RM) *.i *$(OBJ) *.a $(TESTPRODNAME) $(LIBNAME) $(SHRLIBNAME) \ $(INC) $(TARGETS) $(DLL_LINK_LIBNAME) $(TDS) \ *.out MakefileInclude $(LOADABLE_SHRLIBNAME) *.manifest *.exp \ - $(COMMON_INC) $(HDEPENDS_FILES) $(PRODTARGETS) $(TESTSCRIPTS) + $(COMMON_INC) $(HDEPENDS_FILES) $(PRODTARGETS) \ + $(TESTSCRIPTS) $(TAPFILES) ifdef RES @$(RM) *$(RES) endif @@ -338,16 +341,22 @@ testspec: $(TESTSCRIPTS) $(if $^, @echo Tests: $^ >> $@) $(if $(TESTSPEC_$(OS_CLASS)), @echo "Harness: $(TESTSPEC_$(OS_CLASS))" >> $@) +tapfiles: $(TESTSCRIPTS) $(TAPFILES) + +# A .tap file is the output from running the associated test script +%.tap: %.t + -$(PERL) $< -tap > $@ + # If there's a perl test script (.plt) available, use it %.t: ../%.plt @$(RM) $@ - @$(CP) $< $@ + $(CP) $< $@ -# Some versions of Test::Harness expect test programs in perl only. +# Test programs (.t files) must be written in Perl. # Generate a perl program to exec the real test binary. -%.t: %$(EXE) +%.t: %$(EXE) $(TOOLS)/makeTestfile.pl @$(RM) $@ - @$(PERL) $(TOOLS)/makeTestfile.pl $@ $< + $(PERL) $(TOOLS)/makeTestfile.pl $@ $< #--------------------------------------------------------------- ## Install rules for BIN_INSTALLS and LIB_INSTALLS diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index edf200ad6..8fd3f63b6 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -12,7 +12,8 @@ ARCHS += $(BUILD_ARCHS) -ACTIONS += inc build install buildInstall clean realclean archclean runtests +ACTIONS += inc build install buildInstall clean realclean archclean +ACTIONS += runtests tapfiles dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index bd0a375ad..f95eb2e03 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,15 @@ +

Back-ported the tapfiles build target from 3.15

+ +

This GNUmake target runs the same tests as the runtests target, but +instead of summarizing or displaying the output for each test script it creates +a .tap file inside the architecture build directory which contains the +detailed test output. The output file can be parsed by continuous integration +packages such as Jenkins to show the +test results.

+

Fix buffer overflow in epicsStrnRawFromEscaped()

Launchpad bug diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl index 80f6f4d38..a037eb71c 100644 --- a/src/tools/makeTestfile.pl +++ b/src/tools/makeTestfile.pl @@ -12,6 +12,8 @@ # because some versions of the Perl test harness can only run test scripts # that are actually written in Perl. The script we generate execs the # real test program which must be in the same directory as the .t file. +# If the script is given an argument -tap it sets HARNESS_ACTIVE in the +# environment to make the epicsUnitTest code generate strict TAP output. # Usage: makeTestfile.pl target.t executable # target.t is the name of the Perl script to generate @@ -25,6 +27,7 @@ open(my $OUT, '>', $target) or die "Can't create $target: $!\n"; print $OUT < Date: Fri, 13 Feb 2015 12:17:24 -0600 Subject: [PATCH 06/75] Fix epicsExceptionTest on darwin Clang's optimizer seems to elide the new (nothrow) if we don't actually observe the value of p... --- src/libCom/test/epicsExceptionTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/test/epicsExceptionTest.cpp b/src/libCom/test/epicsExceptionTest.cpp index a15b49672..53f56c32d 100644 --- a/src/libCom/test/epicsExceptionTest.cpp +++ b/src/libCom/test/epicsExceptionTest.cpp @@ -77,7 +77,7 @@ static void epicsExceptionTestPrivate () try { char * p = new ( nothrow ) char [unsuccessfulNewSize]; - testOk(p == 0, "new (nothrow)"); + testOk(p == 0, "new (nothrow) returned %p", p); } catch( ... ) { testFail("new (nothrow): threw"); From 26d60bc516b83720f6863d105ae8e7541bd50ab2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 15:29:08 -0600 Subject: [PATCH 07/75] Attempt to fix Windows test failures epicsMessageQueue test wasn't printing the last test result. --- src/libCom/test/epicsMessageQueueTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index f9c1d98fa..5b0f46490 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -10,8 +10,6 @@ * $Revision-Id$ * * Author W. Eric Norum - * norume@aps.anl.gov - * 630 252 4793 */ #include #include @@ -109,6 +107,7 @@ receiver(void *arg) testDiag("Sender %d -- %d messages", sender, expectmsg[sender-1]-1); } testOk1(errors == 0); + testDiag("Receiver finished"); epicsEventSignal(finished); } @@ -126,6 +125,7 @@ sender(void *arg) epicsThreadSleep(0.005 * (randBelow(5))); epicsThreadSleep(0.005 * (randBelow(20))); } + testDiag("%s exiting, sent %d messages", epicsThreadGetNameSelf(), i-1); } extern "C" void messageQueueTest(void *parm) @@ -273,13 +273,13 @@ extern "C" void messageQueueTest(void *parm) * Single receiver, multiple sender tests */ testDiag("Single receiver, multiple sender tests:"); - testDiag("This test takes 5 minutes..."); + testDiag("This test lasts 60 seconds..."); epicsThreadCreate("Sender 1", epicsThreadPriorityLow, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); epicsThreadCreate("Sender 2", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); epicsThreadCreate("Sender 3", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); epicsThreadCreate("Sender 4", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); - epicsThreadSleep(300.0); + epicsThreadSleep(60.0); testExit = 1; } @@ -295,6 +295,7 @@ MAIN(epicsMessageQueueTest) messageQueueTest, NULL); epicsEventWait(finished); + epicsThreadSleep(1.0); return testDone(); } From 2e4d8b31ff43b2595b81530452451c293c1090ef Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 13 Feb 2015 15:56:50 -0600 Subject: [PATCH 08/75] Mark windows-x64 Math failures as TODO --- src/libCom/test/epicsMathTest.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/libCom/test/epicsMathTest.c b/src/libCom/test/epicsMathTest.c index 527dd2922..8ea763cf0 100644 --- a/src/libCom/test/epicsMathTest.c +++ b/src/libCom/test/epicsMathTest.c @@ -31,11 +31,26 @@ MAIN(epicsMathTest) testOk1(epicsINF == epicsINF); testOk1(epicsINF > 0.0); testOk1(epicsINF - epicsINF != 0.0); + +#if defined(_WIN64) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64"); +#endif testOk1(epicsINF + -epicsINF != 0.0); testOk1(-epicsINF + epicsINF != 0.0); +#if defined(_WIN64) && defined(_MSC_VER) + testTodoEnd(); +#endif + testOk1(isnan(epicsINF - epicsINF)); + +#if defined(_WIN64) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64"); +#endif testOk1(isnan(epicsINF + -epicsINF)); testOk1(isnan(-epicsINF + epicsINF)); +#if defined(_WIN64) && defined(_MSC_VER) + testTodoEnd(); +#endif testOk1(isnan(epicsNAN)); testOk1(!isinf(epicsNAN)); @@ -46,8 +61,15 @@ MAIN(epicsMathTest) testOk1(!(epicsNAN >= epicsNAN)); testOk1(!(epicsNAN > epicsNAN)); testOk1(isnan(epicsNAN - epicsNAN)); + +#if defined(_WIN64) && defined(_MSC_VER) + testTodoBegin("Known failure on windows-x64"); +#endif testOk1(isnan(epicsNAN + -epicsNAN)); testOk1(isnan(-epicsNAN + epicsNAN)); +#if defined(_WIN64) && defined(_MSC_VER) + testTodoEnd(); +#endif c = huge / tiny; testOk(!isnan(c), "!isnan(1e300 / 1e-300)"); From c5ded30684a27292923140834d46d661fdeedbfd Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 16 Feb 2015 16:30:52 -0600 Subject: [PATCH 09/75] Extended asTrapWrite to provide put data Backwards-compatible enhancement to the asTrapWrite API to provide listener routines with the data being put by the client. The asTrapWriteMessage structure is extended with 3 new fields for data type, element count and a pointer to the source buffer. Tim Mooney requested this enhancement for his caPutRecorder code, which doesn't work if the record overwrites the new value within its process() routine, e.g. when jogging a motor record. --- documentation/RELEASE_NOTES.html | 25 +++++++++++++++ src/as/asLib.h | 46 ++++++++++++++++---------- src/as/asTrapWrite.c | 55 ++++++++++++++++++-------------- src/as/asTrapWrite.h | 8 +++-- src/rsrv/camessage.c | 9 +++--- 5 files changed, 96 insertions(+), 47 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index f95eb2e03..837b7e024 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,31 @@ +

Enhanced API for asTrapWrite listeners

+ +

External software such as the CA Put Logging module that registers a listener +with the asTrapWrite subsystem was not previously given access to the actual +data being sent by the CA client. In most cases this was not a problem as the +listener can look at the field being modified both before and after the +operation, but if the put processes the record which immediately overwrites the +new value, the client's value cannot be observed.

+ +

This release adds three fields to the asTrapWriteMessage structure that is +passed to the listener routines. These new fields provide the CA data type, the +number of array elements, and a pointer to the source data buffer. This change +is completely backwards compatible with listener code written against the +original API. The new API can be detected at compile-time as follows:

+ +
+#include "asLib.h"
+
+/* ... */
+
+#ifdef asTrapWriteWithData
+    /* Enhanced API */
+#endif
+
+

Back-ported the tapfiles build target from 3.15

This GNUmake target runs the same tests as the runtests target, but diff --git a/src/as/asLib.h b/src/as/asLib.h index b3da2f836..2a420a23b 100644 --- a/src/as/asLib.h +++ b/src/as/asLib.h @@ -30,25 +30,38 @@ typedef enum{ } asClientStatus; typedef void (*ASCLIENTCALLBACK) (ASCLIENTPVT,asClientStatus); + /* The following routines are macros with the following syntax long asCheckGet(ASCLIENTPVT asClientPvt); long asCheckPut(ASCLIENTPVT asClientPvt); */ -#define asCheckGet(asClientPvt)\ - (asActive \ - ? ((asClientPvt)->access>=asREAD ? TRUE : FALSE)\ - : TRUE) -#define asCheckPut(asClientPvt)\ - (asActive \ - ? ((asClientPvt)->access>=asWRITE ? TRUE : FALSE)\ - : TRUE) -#define asTrapWriteBefore(asClientPvt,user,host,addr) \ - (((asActive) && (asClientPvt)->trapMask) \ - ? asTrapWriteBeforeWrite((user),(host),(addr)) \ - : 0) +#define asCheckGet(asClientPvt) \ + (!asActive || ((asClientPvt)->access >= asREAD)) +#define asCheckPut(asClientPvt) \ + (!asActive || ((asClientPvt)->access >= asWRITE)) + +/* More convenience macros +void *asTrapWriteWithData(ASCLIENTPVT asClientPvt, + const char *userid, const char *hostid, void *addr, + int dbrType, int no_elements, void *data); +void asTrapWriteAfter(ASCLIENTPVT asClientPvt); +*/ +#define asTrapWriteWithData(asClientPvt, user, host, addr, type, count, data) \ + ((asActive && (asClientPvt)->trapMask) \ + ? asTrapWriteBeforeWithData((user), (host), (addr), (type), (count), (data)) \ + : 0) +#define asTrapWriteAfter(pvt) \ + if (pvt) asTrapWriteAfterWrite(pvt) + +/* This macro is for backwards compatibility, upgrade any code + calling it to use asTrapWriteWithData() instead ASAP: +void *asTrapWriteBefore(ASCLIENTPVT asClientPvt, + const char *userid, const char *hostid, void *addr); +*/ +#define asTrapWriteBefore(asClientPvt, user, host, addr) \ + asTrapWriteWithData(asClientPvt, user, host, addr, 0, 0, NULL) + -#define asTrapWriteAfter(pvt) if((pvt)) asTrapWriteAfterWrite((pvt)) - epicsShareFunc long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction); epicsShareFunc long epicsShareAPI asInitFile( const char *filename,const char *substitutions); @@ -100,8 +113,9 @@ epicsShareFunc int epicsShareAPI asDumpMemFP(FILE *fp,const char *asgname, epicsShareFunc int epicsShareAPI asDumpHash(void); epicsShareFunc int epicsShareAPI asDumpHashFP(FILE *fp); -epicsShareFunc void * epicsShareAPI asTrapWriteBeforeWrite( - const char *userid,const char *hostid,void *addr); +epicsShareFunc void * epicsShareAPI asTrapWriteBeforeWithData( + const char *userid, const char *hostid, void *addr, + int dbrType, int no_elements, void *data); epicsShareFunc void epicsShareAPI asTrapWriteAfterWrite(void *pvt); diff --git a/src/as/asTrapWrite.c b/src/as/asTrapWrite.c index 7c2536f93..65a77f09f 100644 --- a/src/as/asTrapWrite.c +++ b/src/as/asTrapWrite.c @@ -3,8 +3,7 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found +* EPICS BASE is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. \*************************************************************************/ /*asTrapWrite.c */ @@ -100,47 +99,53 @@ void epicsShareAPI asTrapWriteUnregisterListener(asTrapWriteId id) = (listenerPvt *)ellNext(&plistenerPvt->node); if(plistenerPvt->plistener == plistener) { ellDelete(&pwriteMessage->listenerPvtList,&plistenerPvt->node); - freeListFree(pasTrapWritePvt->freeListListenerPvt,(void *)plistenerPvt); + freeListFree(pasTrapWritePvt->freeListListenerPvt, plistenerPvt); } plistenerPvt = pnext; } pwriteMessage = (writeMessage *)ellNext(&pwriteMessage->node); } ellDelete(&pasTrapWritePvt->listenerList,&plistener->node); - free((void *)plistener); + free(plistener); epicsMutexUnlock(pasTrapWritePvt->lock); } -void * epicsShareAPI asTrapWriteBeforeWrite( - const char *userid,const char *hostid,void *addr) +void * epicsShareAPI asTrapWriteBeforeWithData( + const char *userid, const char *hostid, void *addr, + int dbrType, int no_elements, void *data) { writeMessage *pwriteMessage; listener *plistener; - listenerPvt *plistenerPvt; - if(pasTrapWritePvt==0) return(0); - if(ellCount(&pasTrapWritePvt->listenerList)<=0) return 0; + if (pasTrapWritePvt == 0 || + ellCount(&pasTrapWritePvt->listenerList) <= 0) return 0; + pwriteMessage = (writeMessage *)freeListCalloc( pasTrapWritePvt->freeListWriteMessage); pwriteMessage->message.userid = userid; pwriteMessage->message.hostid = hostid; pwriteMessage->message.serverSpecific = addr; + pwriteMessage->message.dbrType = dbrType; + pwriteMessage->message.no_elements = no_elements; + pwriteMessage->message.data = data; ellInit(&pwriteMessage->listenerPvtList); + epicsMutexMustLock(pasTrapWritePvt->lock); - ellAdd(&pasTrapWritePvt->writeMessageList,&pwriteMessage->node); + ellAdd(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node); plistener = (listener *)ellFirst(&pasTrapWritePvt->listenerList); - while(plistener) { - plistenerPvt = (listenerPvt *)freeListCalloc( + while (plistener) { + listenerPvt *plistenerPvt = (listenerPvt *)freeListCalloc( pasTrapWritePvt->freeListListenerPvt); + plistenerPvt->plistener = plistener; pwriteMessage->message.userPvt = 0; - (*plistener->func)(&pwriteMessage->message,0); + plistener->func(&pwriteMessage->message, 0); plistenerPvt->userPvt = pwriteMessage->message.userPvt; - ellAdd(&pwriteMessage->listenerPvtList,&plistenerPvt->node); + ellAdd(&pwriteMessage->listenerPvtList, &plistenerPvt->node); plistener = (listener *)ellNext(&plistener->node); } epicsMutexUnlock(pasTrapWritePvt->lock); - return((void *)pwriteMessage); + return pwriteMessage; } void epicsShareAPI asTrapWriteAfterWrite(void *pvt) @@ -148,20 +153,22 @@ void epicsShareAPI asTrapWriteAfterWrite(void *pvt) writeMessage *pwriteMessage = (writeMessage *)pvt; listenerPvt *plistenerPvt; - if(pwriteMessage==0 || pasTrapWritePvt==0) return; + if (pwriteMessage == 0 || + pasTrapWritePvt == 0) return; + epicsMutexMustLock(pasTrapWritePvt->lock); plistenerPvt = (listenerPvt *)ellFirst(&pwriteMessage->listenerPvtList); - while(plistenerPvt) { + while (plistenerPvt) { listenerPvt *pnext = (listenerPvt *)ellNext(&plistenerPvt->node); - listener *plistener; - plistener = plistenerPvt->plistener; + listener *plistener = plistenerPvt->plistener; + pwriteMessage->message.userPvt = plistenerPvt->userPvt; - (*plistener->func)(&pwriteMessage->message,1); - ellDelete(&pwriteMessage->listenerPvtList,&plistenerPvt->node); - freeListFree(pasTrapWritePvt->freeListListenerPvt,(void *)plistenerPvt); + plistener->func(&pwriteMessage->message, 1); + ellDelete(&pwriteMessage->listenerPvtList, &plistenerPvt->node); + freeListFree(pasTrapWritePvt->freeListListenerPvt, plistenerPvt); plistenerPvt = pnext; } - ellDelete(&pasTrapWritePvt->writeMessageList,&pwriteMessage->node); - freeListFree(pasTrapWritePvt->freeListWriteMessage,(void *)pwriteMessage); + ellDelete(&pasTrapWritePvt->writeMessageList, &pwriteMessage->node); + freeListFree(pasTrapWritePvt->freeListWriteMessage, pwriteMessage); epicsMutexUnlock(pasTrapWritePvt->lock); } diff --git a/src/as/asTrapWrite.h b/src/as/asTrapWrite.h index ec34c5312..b8033cb94 100644 --- a/src/as/asTrapWrite.h +++ b/src/as/asTrapWrite.h @@ -3,9 +3,8 @@ * National Laboratory. * Copyright (c) 2002 The Regents of the University of California, as * Operator of Los Alamos National Laboratory. -* EPICS BASE Versions 3.13.7 -* and higher are distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. \*************************************************************************/ /*asTrapWrite.h*/ /* Author: Marty Kraimer Date: 07NOV2000 */ @@ -24,6 +23,9 @@ typedef struct asTrapWriteMessage { const char *hostid; void *serverSpecific; void *userPvt; + int dbrType; /* Data type from ca/db_access.h, NOT dbFldTypes.h */ + int no_elements; + void *data; /* Might be NULL if no data is available */ } asTrapWriteMessage; diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index ba83af1b3..4ad28243a 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -814,10 +814,10 @@ static int write_action ( caHdrLargeArray *mp, return RSRV_ERROR; } - asWritePvt = asTrapWriteBefore ( pciu->asClientPVT, + asWritePvt = asTrapWriteWithData ( pciu->asClientPVT, pciu->client->pUserName ? pciu->client->pUserName : "", pciu->client->pHostName ? pciu->client->pHostName : "", - (void *) &pciu->addr ); + (void *) &pciu->addr, mp->m_dataType, mp->m_count, pPayload ); dbStatus = db_put_field( &pciu->addr, @@ -1819,11 +1819,12 @@ static int write_notify_action ( caHdrLargeArray *mp, void *pPayload, return RSRV_OK; } - pciu->pPutNotify->asWritePvt = asTrapWriteBefore ( + pciu->pPutNotify->asWritePvt = asTrapWriteWithData ( pciu->asClientPVT, pciu->client->pUserName ? pciu->client->pUserName : "", pciu->client->pHostName ? pciu->client->pHostName : "", - (void *) &pciu->addr ); + (void *) &pciu->addr, mp->m_dataType, mp->m_count, + pciu->pPutNotify->dbPutNotify.pbuffer ); dbPutNotify(&pciu->pPutNotify->dbPutNotify); From 2f0e9172a4e26aed422cbcc5899f51aab1087a3e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 10:45:30 -0500 Subject: [PATCH 10/75] tool_lib.c: ensure output string is always set Ensure that val2str always writes to its output buffer, which is static and shared between all PVs. Should make bugs like lp:1418526 more obvious. --- src/catools/tool_lib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/catools/tool_lib.c b/src/catools/tool_lib.c index 080b6c3de..22ea66c7e 100644 --- a/src/catools/tool_lib.c +++ b/src/catools/tool_lib.c @@ -120,6 +120,7 @@ char *val2str (const void *v, unsigned type, int index) strcpy (str, "*** invalid type"); return str; } + strcpy (str, "!!!"); base_type = type % (LAST_TYPE+1); From b996e63beb2e90895423a543aae808a9793e1be6 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 10:57:05 -0500 Subject: [PATCH 11/75] dbReadTest.c: flush errlog on exit as per lp:1419879 --- src/dbStatic/dbReadTest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbReadTest.c b/src/dbStatic/dbReadTest.c index c7a433232..d3771019d 100644 --- a/src/dbStatic/dbReadTest.c +++ b/src/dbStatic/dbReadTest.c @@ -86,5 +86,6 @@ int main(int argc,char **argv) dbReportDeviceConfig(pdbbase,stdout); */ dbFreeBase(pdbbase); + errlogFlush(); return(0); } From 2623c2f46f7a529ead9b687f515040bce69618e8 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 11:01:49 -0500 Subject: [PATCH 12/75] dbStaticLib.c: clean pdbbase after free --- src/dbStatic/dbStaticLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index 8334ef7f6..fa6a1303d 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -727,6 +727,7 @@ void epicsShareAPI dbFreeBase(dbBase *pdbbase) dbPvdFreeMem(pdbbase); dbFreePath(pdbbase); free((void *)pdbbase); + pdbbase = NULL; return; } From 276ea54ee48976bc29f9682e1a5a3c2f8ce39149 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 17 Feb 2015 11:03:06 -0500 Subject: [PATCH 13/75] don't destroy locked mutex --- src/dbStatic/dbPvdLib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dbStatic/dbPvdLib.c b/src/dbStatic/dbPvdLib.c index 43f9cd40f..49060366b 100644 --- a/src/dbStatic/dbPvdLib.c +++ b/src/dbStatic/dbPvdLib.c @@ -181,6 +181,7 @@ void dbPvdFreeMem(dbBase *pdbbase) ellDelete(&pbucket->list, (ELLNODE *)ppvdNode); free(ppvdNode); } + epicsMutexUnlock(pbucket->lock); epicsMutexDestroy(pbucket->lock); free(pbucket); } From 681a996bf0b2a10c2d267952bc9965fce27abb49 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 17 Feb 2015 13:59:13 -0600 Subject: [PATCH 14/75] Unifying rsrv error messages --- src/rsrv/camessage.c | 13 +++++-------- src/rsrv/camsgtask.c | 21 +++++++++++++-------- src/rsrv/caserverio.c | 17 +++++++---------- src/rsrv/caservertask.c | 8 ++++---- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/src/rsrv/camessage.c b/src/rsrv/camessage.c index ba83af1b3..e0521cf3a 100644 --- a/src/rsrv/camessage.c +++ b/src/rsrv/camessage.c @@ -274,21 +274,18 @@ static void log_header ( pciu = MPTOPCIU(mp); if (pContext) { - epicsPrintf ("CAS: request from %s => \"%s\"\n", + epicsPrintf ("CAS: request from %s => %s\n", hostName, pContext); } - epicsPrintf ( -"CAS: Request from %s => cmmd=%d cid=0x%x type=%d count=%d postsize=%u\n", + epicsPrintf ( "CAS: Request from %s => cmmd=%d cid=0x%x type=%d count=%d postsize=%u\n", hostName, mp->m_cmmd, mp->m_cid, mp->m_dataType, mp->m_count, mp->m_postsize); - epicsPrintf ( -"CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n", - hostName, mp->m_available, mnum, (pciu?(void *)&pciu->addr:NULL)); + epicsPrintf ( "CAS: Request from %s => available=0x%x \tN=%u paddr=%p\n", + hostName, mp->m_available, mnum, (pciu ? (void *)&pciu->addr : NULL)); if (mp->m_cmmd==CA_PROTO_WRITE && mp->m_dataType==DBF_STRING && pPayLoad ) { - epicsPrintf ( -"CAS: Request from %s => \tThe string written: %s \n", + epicsPrintf ( "CAS: Request from %s => Wrote string \"%s\"\n", hostName, (char *)pPayLoad ); } } diff --git a/src/rsrv/camsgtask.c b/src/rsrv/camsgtask.c index a5133caf6..c1f112961 100644 --- a/src/rsrv/camsgtask.c +++ b/src/rsrv/camsgtask.c @@ -67,9 +67,10 @@ void camsgtask ( void *pParm ) status = socket_ioctl (client->sock, FIONREAD, &nchars); if (status < 0) { char sockErrBuf[64]; + epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf("CAS: io ctl err - %s\n", + errlogPrintf("CAS: ioctl error - %s\n", sockErrBuf); cas_send_bs_msg(client, TRUE); } @@ -98,9 +99,8 @@ void camsgtask ( void *pParm ) } if ( anerrno == SOCK_ENOBUFS ) { - errlogPrintf ( - "rsrv: system low on network buffers " - "- receive retry in 15 seconds\n" ); + errlogPrintf ( + "CAS: Out of network buffers, retring receive in 15 seconds\n" ); epicsThreadSleep ( 15.0 ); continue; } @@ -109,10 +109,15 @@ void camsgtask ( void *pParm ) * normal conn lost conditions */ if ( ( anerrno != SOCK_ECONNABORTED && - anerrno != SOCK_ECONNRESET && - anerrno != SOCK_ETIMEDOUT ) || - CASDEBUG > 2 ) { - errlogPrintf ( "CAS: client disconnect(errno=%d)\n", anerrno ); + anerrno != SOCK_ECONNRESET && + anerrno != SOCK_ETIMEDOUT ) || + CASDEBUG > 2 ) { + char sockErrBuf[64]; + + epicsSocketConvertErrorToString( + sockErrBuf, sizeof ( sockErrBuf ), anerrno); + errlogPrintf ( "CAS: Client disconnected - %s\n", + sockErrBuf ); } break; } diff --git a/src/rsrv/caserverio.c b/src/rsrv/caserverio.c index 466e492f0..387bf210b 100644 --- a/src/rsrv/caserverio.c +++ b/src/rsrv/caserverio.c @@ -90,7 +90,8 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) } if ( anerrno == SOCK_ENOBUFS ) { - errlogPrintf ( "rsrv: system low on network buffers - send retry in 15 seconds\n" ); + errlogPrintf ( + "CAS: Out of network buffers, retrying send in 15 seconds\n" ); epicsThreadSleep ( 15.0 ); continue; } @@ -108,8 +109,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ( - "CAS: TCP send to \"%s\" failed because \"%s\"\n", + errlogPrintf ( "CAS: TCP send to %s failed - %s\n", buf, sockErrBuf); } pclient->disconnect = TRUE; @@ -135,7 +135,7 @@ void cas_send_bs_msg ( struct client *pclient, int lock_needed ) char sockErrBuf[64]; epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); - errlogPrintf ("rsrv: socket shutdown error was %s\n", + errlogPrintf ("CAS: Socket shutdown error - %s\n", sockErrBuf ); } } @@ -204,7 +204,7 @@ void cas_send_dg_msg ( struct client * pclient ) } else { errlogPrintf ( - "cas: system failed to send entire udp frame?\n" ); + "CAS: System failed to send entire udp frame?\n" ); } } else { @@ -213,11 +213,8 @@ void cas_send_dg_msg ( struct client * pclient ) epicsSocketConvertErrnoToString ( sockErrBuf, sizeof ( sockErrBuf ) ); ipAddrToDottedIP ( &pclient->addr, buf, sizeof(buf) ); - errlogPrintf( - "CAS: UDP send to \"%s\" " - "failed because \"%s\"\n", - buf, - sockErrBuf); + errlogPrintf( "CAS: UDP send to %s failed - %s\n", + buf, sockErrBuf); } pclient->send.stk = 0u; diff --git a/src/rsrv/caservertask.c b/src/rsrv/caservertask.c index 21bcba9f4..7c911d64b 100644 --- a/src/rsrv/caservertask.c +++ b/src/rsrv/caservertask.c @@ -252,7 +252,7 @@ int rsrv_init (void) status = envGetLongConfigParam ( &EPICS_CA_MAX_ARRAY_BYTES, &maxBytesAsALong ); if ( status || maxBytesAsALong < 0 ) { - errlogPrintf ( "cas: EPICS_CA_MAX_ARRAY_BYTES was not a positive integer\n" ); + errlogPrintf ( "CAS: EPICS_CA_MAX_ARRAY_BYTES was not a positive integer\n" ); rsrvSizeofLargeBufTCP = MAX_TCP; } else { @@ -266,7 +266,7 @@ int rsrv_init (void) maxBytes = 0xffffffff; } if ( maxBytes < MAX_TCP ) { - errlogPrintf ( "cas: EPICS_CA_MAX_ARRAY_BYTES was rounded up to %u\n", MAX_TCP ); + errlogPrintf ( "CAS: EPICS_CA_MAX_ARRAY_BYTES was rounded up to %u\n", MAX_TCP ); rsrvSizeofLargeBufTCP = MAX_TCP; } else { @@ -551,7 +551,7 @@ void destroy_client ( struct client *client ) freeListFree ( rsrvLargeBufFreeListTCP, client->send.buf ); } else { - errlogPrintf ( "cas: Corrupt send buffer free list type code=%u during client cleanup?\n", + errlogPrintf ( "CAS: Corrupt send buffer free list type code=%u during client cleanup?\n", client->send.type ); } } @@ -563,7 +563,7 @@ void destroy_client ( struct client *client ) freeListFree ( rsrvLargeBufFreeListTCP, client->recv.buf ); } else { - errlogPrintf ( "cas: Corrupt recv buffer free list type code=%u during client cleanup?\n", + errlogPrintf ( "CAS: Corrupt recv buffer free list type code=%u during client cleanup?\n", client->send.type ); } } From 7e36a58f1e8cf0bf9e9c941383fa590e77a767ca Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 17 Feb 2015 14:29:20 -0600 Subject: [PATCH 15/75] Back-ported dbLoadRecordsHook from the 3.15 branch --- documentation/RELEASE_NOTES.html | 4 ++++ src/db/dbAccess.c | 10 +++++++++- src/db/dbAccessDefs.h | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 837b7e024..bec510c5c 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,10 @@ +

Back-ported dbLoadRecordsHook from the 3.15 branch

+ +

See the Release Notes from the Base 3.15.1 release for details.

+

Enhanced API for asTrapWrite listeners

External software such as the CA Put Logging module that registers a listener diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c index d3e47062c..787bdbe1e 100644 --- a/src/db/dbAccess.c +++ b/src/db/dbAccess.c @@ -61,6 +61,10 @@ epicsShareDef struct dbBase *pdbbase = 0; epicsShareDef volatile int interruptAccept=FALSE; +/* Hook Routines */ + +epicsShareDef DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook = NULL; + static short mapDBFToDBR[DBF_NTYPES] = { /* DBF_STRING => */ DBR_STRING, /* DBF_CHAR => */ DBR_CHAR, @@ -817,7 +821,11 @@ int epicsShareAPI dbLoadDatabase(const char *file, const char *path, const char int epicsShareAPI dbLoadRecords(const char* file, const char* subs) { - return dbReadDatabase(&pdbbase, file, 0, subs); + int status = dbReadDatabase(&pdbbase, file, 0, subs); + + if (!status && dbLoadRecordsHook) + dbLoadRecordsHook(file, subs); + return status; } diff --git a/src/db/dbAccessDefs.h b/src/db/dbAccessDefs.h index 73d68c4ef..472ad6bd1 100644 --- a/src/db/dbAccessDefs.h +++ b/src/db/dbAccessDefs.h @@ -276,9 +276,14 @@ epicsShareFunc long epicsShareAPI dbBufferSize( short dbrType,long options,long nRequest); epicsShareFunc long epicsShareAPI dbValueSize(short dbrType); +/* Hook Routine */ + +typedef void (*DB_LOAD_RECORDS_HOOK_ROUTINE)(const char* filename, + const char* substitutions); +epicsShareExtern DB_LOAD_RECORDS_HOOK_ROUTINE dbLoadRecordsHook; + epicsShareFunc int epicsShareAPI dbLoadDatabase( const char *filename, const char *path, const char *substitutions); - epicsShareFunc int epicsShareAPI dbLoadRecords( const char* filename, const char* substitutions); From d2a216b28e405332136f80e23ee8a246a89c6f2c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 17 Feb 2015 16:21:13 -0600 Subject: [PATCH 16/75] More MS Windows-x64 test fixes --- src/libCom/test/epicsCalcTest.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index d7836a338..3fee4923b 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -553,10 +553,18 @@ MAIN(epicsCalcTest) testExpr(0.0 + NaN); testExpr(Inf + 0.0); testExpr(Inf + Inf); +#if defined(_WIN64) && defined(_MSC_VER) + testCalc("Inf + -Inf", NaN); +#else testExpr(Inf + -Inf); +#endif testExpr(Inf + NaN); testExpr(-Inf + 0.0); +#if defined(_WIN64) && defined(_MSC_VER) + testCalc("-Inf + Inf", NaN); +#else testExpr(-Inf + Inf); +#endif testExpr(-Inf + -Inf); testExpr(-Inf + NaN); testExpr(NaN + 0.0); From b041041518c33c79d47007315b8e9953fbc6376a Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Wed, 18 Feb 2015 15:46:05 -0600 Subject: [PATCH 17/75] doc: fix typos and list of files in documentation directory --- documentation/README.1st | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/documentation/README.1st b/documentation/README.1st index 6d1142fdb..b5b85f2d3 100644 --- a/documentation/README.1st +++ b/documentation/README.1st @@ -100,7 +100,7 @@ later. GNU readline or Tecla library - GNU readline and Tecla librararies can be used by the IOC shell to + GNU readline and Tecla libraries can be used by the IOC shell to provide command line editing and command line history recall and edit. GNU readline (or Tecla library) must be installed on your target system when COMMANDLINE_LIBRARY is set to READLINE (or TECLA) for that target. @@ -124,7 +124,7 @@ EPICS documentation is available through the [3]EPICS website at Argonne. - Release specific documenataion can also be found in the + Release specific documentation can also be found in the base/documentation directory of the distribution. Directory Structure @@ -137,7 +137,7 @@ base/configure Operating system independent build config files base/configure/os Operating system dependent build config files base/configure/tools Perl and shell scripts used in the build - base/documentation Distributation documentation + base/documentation Distribution documentation base/src All epics base source code in subdirectories base/src/RTEMS Code to configure RTEMS for EPICS base/src/as Access security @@ -170,7 +170,7 @@ base/src/libCom/macLib Macro substitution handler base/src/libCom/misc Miscellaneous utilities base/src/libCom/osi Operating system independent API - base/src/libCom/osi/os Operating system dependant code in subdirectories + base/src/libCom/osi/os Operating system dependent code in subdirectories base/src/libCom/ring Methods for creating and using ring buffers base/src/libCom/taskwd Task watchdog base/src/libCom/test Test tools (timer, semBinary, semMutex,fdmgr, ...) @@ -206,14 +206,14 @@ Build related components - base/documentation/README* files + base/documentation directory - contains setup, build, and install documents README.1st Instructions for setup and building epics base README.html html version of README.1st - README.WIN32 Microsoft WIN32 specific instructions - README.cxxTemplates Information about C++ templates in EPICS base + README.MS_Windows Microsoft Windows specific instructions + README.cris Axis CRIS specific instructions + README.darwin.html Installation notes for OS X (Darwin) README.niCpu030 NI cpu030 specific instructions - README.darwin Installation notes for Mac OS X (Darwin) RELEASE_NOTES.html Notes on release changes KnownProblems.html List of known problems and workarounds Converting*To*.html Release specific conversion instructions @@ -240,7 +240,7 @@ CONFIG_BASE_VERSION Definitions for EPICS base version number CONFIG_COMMON Definitions common to all builds CONFIG_ENV Definitions of EPICS environment variables - CONFIG_SITE Site specific make defintions + CONFIG_SITE Site specific make definitions CONFIG_SITE_ENV Site defaults for EPICS environment variables MAKEFILE Installs CONFIG* RULES* creates CONFIG_APP_INCLUDE @@ -271,7 +271,7 @@ base/src/tools directory - contains Perl scripts used for the build Makefile Makefile for installing the scripts into cfg dir - convertRelease.pl Performs consistancy checks on RELEASE files + convertRelease.pl Performs consistency checks on RELEASE files cvsclean.pl Remove all .#* files in directory tree dos2unix.pl Converts text file from DOS CR/LF to unix ISO expandvars.pl Tool to expand @VAR@ variables while copying a file From dda4eb3a58a3f213ac2478b3905be55134443cdc Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 18 Feb 2015 16:36:42 -0600 Subject: [PATCH 18/75] Fix more MS idiocy Windows has signed characters, but if you pass a negative value (i.e. a character with value >= 0x80) into the debug version of its isprint() runtime library function it asserts. --- src/libCom/misc/epicsString.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libCom/misc/epicsString.c b/src/libCom/misc/epicsString.c index 4ee9fed35..2ce13be6d 100644 --- a/src/libCom/misc/epicsString.c +++ b/src/libCom/misc/epicsString.c @@ -88,7 +88,7 @@ int epicsStrnRawFromEscaped(char *to, size_t outsize, const char *from, pfrom++; /*skip the x*/ for (i=0; i<2; i++) { - if (!isxdigit((int)*pfrom)) break; + if (!isxdigit(0xff & (int)*pfrom)) break; strval[i] = *pfrom++; nfrom++; } sscanf(strval,"%x",&ival); @@ -131,7 +131,7 @@ int epicsStrnEscapedFromRaw(char *outbuf, size_t outsize, const char *inbuf, case '\'': len = epicsSnprintf(outpos, maxout, "\\'"); break; case '\"': len = epicsSnprintf(outpos, maxout, "\\\""); break; default: - if (isprint((int)c)) + if (isprint(0xff & (int)c)) len = epicsSnprintf(outpos, maxout, "%c", c); else len = epicsSnprintf(outpos, maxout, "\\%03o", @@ -166,7 +166,7 @@ size_t epicsStrnEscapedFromRawSize(const char *inbuf, size_t inlen) nout++; break; default: - if (!isprint((int)c)) + if (!isprint(0xff & (int)c)) nout += 3; } } @@ -230,7 +230,7 @@ int epicsStrPrintEscaped(FILE *fp, const char *s, size_t len) case '\'': nout += fprintf(fp, "\\'"); break; case '\"': nout += fprintf(fp, "\\\""); break; default: - if (isprint((int)c)) + if (isprint(0xff & (int)c)) nout += fprintf(fp, "%c", c); else nout += fprintf(fp, "\\%03o", (unsigned char)c); From 804aeafaa71938d7db0c0c4c4cb071b48b547b81 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 18 Feb 2015 16:44:07 -0600 Subject: [PATCH 19/75] Fix dbVerify()'s postfix buffer size --- src/dbStatic/dbStaticLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dbStatic/dbStaticLib.c b/src/dbStatic/dbStaticLib.c index fa6a1303d..08ec137e1 100644 --- a/src/dbStatic/dbStaticLib.c +++ b/src/dbStatic/dbStaticLib.c @@ -45,7 +45,7 @@ int dbStaticDebug = 0; static char *pNullString = ""; #define messagesize 100 -#define RPCL_LEN 184 +#define RPCL_LEN INFIX_TO_POSTFIX_SIZE(80) static char *ppstring[5]={"NPP","PP","CA","CP","CPP"}; static char *msstring[4]={"NMS","MS","MSI","MSS"}; From 836d81f0b75dc44a0275f8accc4dc2c3ac552c47 Mon Sep 17 00:00:00 2001 From: "J. Lewis Muir" Date: Wed, 18 Feb 2015 16:55:09 -0600 Subject: [PATCH 20/75] doc: HTML: fix typos and list of files in documentation directory --- documentation/README.html | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/documentation/README.html b/documentation/README.html index f84dbfca5..620feffcc 100644 --- a/documentation/README.html +++ b/documentation/README.html @@ -1,4 +1,7 @@ + README - EPICS Base Installation Instructions @@ -102,7 +105,7 @@ For RTEMS targets, you need RTEMS core and toolset version 4.9.2 or later.

GNU readline or Tecla library
- GNU readline and Tecla librararies can be used by the IOC shell to + GNU readline and Tecla libraries can be used by the IOC shell to provide command line editing and command line history recall and edit. GNU readline (or Tecla library) must be installed on your target system when COMMANDLINE_LIBRARY is set to READLINE (or TECLA) for that target. @@ -124,7 +127,7 @@

Documentation

EPICS documentation is available through the EPICS website at Argonne. -

Release specific documenataion can also be found in the base/documentation +

Release specific documentation can also be found in the base/documentation directory of the distribution.

Directory Structure

@@ -137,7 +140,7 @@ base/configure Operating system independent build config files base/configure/os Operating system dependent build config files base/configure/tools Perl and shell scripts used in the build - base/documentation Distributation documentation + base/documentation Distribution documentation base/src All epics base source code in subdirectories base/src/RTEMS Code to configure RTEMS for EPICS base/src/as Access security @@ -170,7 +173,7 @@ base/src/libCom/macLib Macro substitution handler base/src/libCom/misc Miscellaneous utilities base/src/libCom/osi Operating system independent API - base/src/libCom/osi/os Operating system dependant code in subdirectories + base/src/libCom/osi/os Operating system dependent code in subdirectories base/src/libCom/ring Methods for creating and using ring buffers base/src/libCom/taskwd Task watchdog base/src/libCom/test Test tools (timer, semBinary, semMutex,fdmgr, ...) @@ -210,14 +213,15 @@

Build related components

-

base/documentation/README* files

+

base/documentation directory - contains setup, build, and install + documents

         README.1st           Instructions for setup and building epics base
         README.html          html version of README.1st
-        README.WIN32         Microsoft WIN32 specific instructions
-        README.cxxTemplates  Information about C++ templates in EPICS base
+        README.MS_Windows    Microsoft Windows specific instructions
+        README.cris          Axis CRIS specific instructions
+        README.darwin.html   Installation notes for OS X (Darwin)
         README.niCpu030      NI cpu030 specific instructions
-        README.darwin        Installation notes for Mac OS X (Darwin)
         RELEASE_NOTES.html   Notes on release changes
         KnownProblems.html   List of known problems and workarounds
         Converting*To*.html  Release specific conversion instructions
@@ -246,7 +250,7 @@
         CONFIG_BASE_VERSION   Definitions for EPICS base version number
         CONFIG_COMMON         Definitions common to all builds
         CONFIG_ENV            Definitions of EPICS environment variables
-        CONFIG_SITE           Site specific make defintions
+        CONFIG_SITE           Site specific make definitions
         CONFIG_SITE_ENV       Site defaults for EPICS environment variables
         MAKEFILE              Installs CONFIG* RULES* creates
         CONFIG_APP_INCLUDE
@@ -279,7 +283,7 @@
 

base/src/tools directory - contains Perl scripts used for the build

         Makefile                Makefile for installing the scripts into cfg dir
-        convertRelease.pl       Performs consistancy checks on RELEASE files
+        convertRelease.pl       Performs consistency checks on RELEASE files
         cvsclean.pl             Remove all .#* files in directory tree
         dos2unix.pl             Converts text file from DOS CR/LF to unix ISO
         expandvars.pl           Tool to expand @VAR@ variables while copying a file

From 9813fa6474d2c161723bd592eae5d0fec39723f1 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Thu, 19 Feb 2015 15:55:48 -0600
Subject: [PATCH 21/75] db: Allow link fields to return a DOUBLE value

A dbCa link does a ca_get with type DBR_CTRL_DOUBLE
to populate its list of attribute values immediately
after connecting. If the target is a DBF_*LINK field
it used to return an error, preventing the link from
properly connecting. This change makes dbGetField()
return a single NAN value instead of rejecting the
request.

Fixes: lp:545358
---
 src/db/dbAccess.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/db/dbAccess.c b/src/db/dbAccess.c
index 787bdbe1e..068e59bd4 100644
--- a/src/db/dbAccess.c
+++ b/src/db/dbAccess.c
@@ -969,6 +969,11 @@ long epicsShareAPI dbGetField(DBADDR *paddr,short dbrType,
             if (nRequest && *nRequest > 1) *nRequest = 1;
             break;
 
+        case DBR_DOUBLE:    /* Needed for dbCa links */
+            if (nRequest && *nRequest) *nRequest = 1;
+            *(double *)pbuffer = epicsNAN;
+            goto done;
+
         case DBR_CHAR:
         case DBR_UCHAR:
             if (nRequest && *nRequest > 0) {

From e822d8d8c46def2ef128f2aa6e064de8ef8eb18a Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Thu, 19 Feb 2015 17:33:27 -0600
Subject: [PATCH 22/75] Suppress corrupt error output from dbStatic parser

The yyerror() routine gets called twice in some cases.
Don't print the yytext or input file location the second
time through -- yytext has already been freed, and the
user doesn't need to see the location twice.

Fixes lp:1422803
---
 src/dbStatic/dbYacc.y | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/dbStatic/dbYacc.y b/src/dbStatic/dbYacc.y
index b8cc9b4cf..24be58d87 100644
--- a/src/dbStatic/dbYacc.y
+++ b/src/dbStatic/dbYacc.y
@@ -266,12 +266,14 @@ alias: tokenALIAS '(' tokenSTRING ',' tokenSTRING ')'
 static int yyerror(char *str)
 {
     if (str)
-        epicsPrintf("Error: %s\n   ", str);
+        epicsPrintf("Error: %s\n", str);
     else
         epicsPrintf("Error");
-    epicsPrintf(" at or before \"%s\"", yytext);
-    dbIncludePrint();
-    yyFailed = TRUE;
+    if (!yyFailed) {    /* Only print this stuff once */
+        epicsPrintf(" at or before \"%s\"", yytext);
+        dbIncludePrint();
+        yyFailed = TRUE;
+    }
     return(0);
 }
 static long pvt_yy_parse(void)

From 3501fda48d5cf3f18d3de498618ad718a9785709 Mon Sep 17 00:00:00 2001
From: Michael Davidsaver 
Date: Thu, 19 Feb 2015 19:18:16 -0500
Subject: [PATCH 23/75] dbCa: dbCaPutLinkCallback prevent out of bounds write

The internal buffer of the caLink is sized based on the
number of elements of the destination PV.
---
 src/db/dbCa.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/db/dbCa.c b/src/db/dbCa.c
index 22870ba30..b35b5d80d 100644
--- a/src/db/dbCa.c
+++ b/src/db/dbCa.c
@@ -381,6 +381,8 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
             dbAddr.pfield = pca->pputNative;
             /*Following only used for DBF_STRING*/
             dbAddr.field_size = MAX_STRING_SIZE;
+            if(nRequest>pca->nelements)
+                nRequest = pca->nelements;
             status = aConvert(&dbAddr, pbuffer, nRequest, pca->nelements, 0);
         }
         link_action |= CA_WRITE_NATIVE;

From c0cf25eeeea5d66f719cb2ae7bddb56e9451a82b Mon Sep 17 00:00:00 2001
From: Michael Davidsaver 
Date: Thu, 19 Feb 2015 19:18:27 -0500
Subject: [PATCH 24/75] dbCa: dbCaPutLinkCallback initialize entire array

CA links will write the full target array size.
Ensure that uninitialized elements are zeroed.
---
 src/db/dbCa.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/db/dbCa.c b/src/db/dbCa.c
index b35b5d80d..bb976bd5b 100644
--- a/src/db/dbCa.c
+++ b/src/db/dbCa.c
@@ -367,7 +367,7 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
             plink->value.pv_link.pvlMask |= pvlOptOutNative;
  */
         }
-        if (nRequest == 1){
+        if (nRequest == 1 && pca->nelements==1){
             long (*fConvert)(const void *from, void *to, struct dbAddr *paddr);
 
             fConvert = dbFastPutConvertRoutine[dbrType][newType];
@@ -384,6 +384,10 @@ long dbCaPutLinkCallback(struct link *plink,short dbrType,
             if(nRequest>pca->nelements)
                 nRequest = pca->nelements;
             status = aConvert(&dbAddr, pbuffer, nRequest, pca->nelements, 0);
+            if(nRequestnelements) {
+                long elemsize = dbr_value_size[ca_field_type(pca->chid)];
+                memset(nRequest*elemsize+(char*)pca->pputNative, 0, (pca->nelements-nRequest)*elemsize);
+            }
         }
         link_action |= CA_WRITE_NATIVE;
         pca->gotOutNative = TRUE;

From 3e6597be90848ccfd4f9449ada2d12aeac9b3475 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:13:05 -0600
Subject: [PATCH 25/75] Applied record-support-santity-check.patch

---
 src/dbStatic/dbToRecordtypeH.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/dbStatic/dbToRecordtypeH.c b/src/dbStatic/dbToRecordtypeH.c
index a97a44f87..cfd62792f 100644
--- a/src/dbStatic/dbToRecordtypeH.c
+++ b/src/dbStatic/dbToRecordtypeH.c
@@ -228,12 +228,14 @@ int main(int argc,char **argv)
 	fprintf(outFile,"#ifdef __cplusplus\n");
 	fprintf(outFile,"extern \"C\" {\n");
 	fprintf(outFile,"#endif\n");
+        fprintf(outFile,"#include \n");
         fprintf(outFile,"#include \n");
 	pdbRecordType = (dbRecordType *)ellFirst(&pdbbase->recordTypeList);
 	while(pdbRecordType) {
 		fprintf(outFile,"static int %sRecordSizeOffset(dbRecordType *pdbRecordType)\n{\n",
 		pdbRecordType->name);
 	    fprintf(outFile,"    %sRecord *prec = 0;\n",pdbRecordType->name);
+	    fprintf(outFile,"  assert(pdbRecordType->no_fields==%u);\n", pdbRecordType->no_fields);
 	    for(i=0; ino_fields; i++) {
 		char	name[256];
 		int		j;

From a6af0daae9e5f854a310dc74a751e7d83e76ca6a Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:21:45 -0600
Subject: [PATCH 26/75] Applied linux-use-RT-thread-priorities.patch

---
 configure/CONFIG_SITE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE
index 57779f637..22f9cef1f 100644
--- a/configure/CONFIG_SITE
+++ b/configure/CONFIG_SITE
@@ -176,7 +176,7 @@ COMPAT_313=NO
 #INSTALL_LOCATION=
 
 # Use POSIX thread priority scheduling (YES or NO)
-USE_POSIX_THREAD_PRIORITY_SCHEDULING = NO
+USE_POSIX_THREAD_PRIORITY_SCHEDULING = YES
 
 #  Site version number, if set will append '-' and this string to the
 #  EPICS version number string that is reported by many tools

From a437768c9c4bd58a8267ab8842540a30160ebdc4 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:25:28 -0600
Subject: [PATCH 27/75] Applied
 linux-runtime-disable-RT-priorities-if-not-supported.patch

---
 src/libCom/osi/os/posix/osdThread.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c
index 30583e162..0f1523549 100644
--- a/src/libCom/osi/os/posix/osdThread.c
+++ b/src/libCom/osi/os/posix/osdThread.c
@@ -57,6 +57,7 @@ typedef struct commonAttr{
     int                maxPriority;
     int                minPriority;
     int                schedPolicy;
+    int                usePolicy;
 } commonAttr;
 
 typedef struct epicsThreadOSD {
@@ -79,6 +80,7 @@ typedef struct epicsThreadOSD {
 typedef struct {
     int min_pri, max_pri;
     int policy;
+    int ok;
 } priAvailable;
 #endif
 
@@ -138,6 +140,8 @@ static void setSchedulingPolicy(epicsThreadOSD *pthreadInfo,int policy)
 #if defined (_POSIX_THREAD_PRIORITY_SCHEDULING)
     int status;
 
+    if(!pcommonAttr->usePolicy) return;
+
     status = pthread_attr_getschedparam(
         &pthreadInfo->attr,&pthreadInfo->schedParam);
     checkStatusOnce(status,"pthread_attr_getschedparam");
@@ -278,6 +282,7 @@ int           low, try;
 
     prm->min_pri = min;
     prm->max_pri = try_pri(max, prm->policy) ? max-1 : max;
+    prm->ok = 1;
 
     return 0;
 }
@@ -290,6 +295,7 @@ void         *dummy;
 int          status;
 
     arg.policy = a_p->schedPolicy;
+    arg.ok = 0;
 
     status = pthread_create(&id, 0, find_pri_range, &arg);
     checkStatusQuit(status, "pthread_create","epicsThreadInit");
@@ -299,6 +305,7 @@ int          status;
 
     a_p->minPriority = arg.min_pri;
     a_p->maxPriority = arg.max_pri;
+    a_p->usePolicy = arg.ok;
 }
 #endif
 
@@ -608,6 +615,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn
     pthreadInfo->osiPriority = priority;
     if(!pthreadInfo->isFifoScheduled) return;
 #if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) 
+    if(!pcommonAttr->usePolicy) return;
     pthreadInfo->schedParam.sched_priority = getOssPriorityValue(pthreadInfo);
     status = pthread_attr_setschedparam(
         &pthreadInfo->attr,&pthreadInfo->schedParam);

From 0fa8702842136a5b29c22dc7b9caed4eb7a0d852 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:34:53 -0600
Subject: [PATCH 28/75] Applied test-epicsTimerQueue-reference-counter.patch

---
 src/libCom/test/epicsTimerTest.cpp | 38 +++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/src/libCom/test/epicsTimerTest.cpp b/src/libCom/test/epicsTimerTest.cpp
index 25264e1e1..43a6528b3 100644
--- a/src/libCom/test/epicsTimerTest.cpp
+++ b/src/libCom/test/epicsTimerTest.cpp
@@ -29,6 +29,41 @@
 #define verify(exp) ((exp) ? (void)0 : \
     epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
 
+class notified : public epicsTimerNotify
+{
+public:
+    bool done;
+    notified() : epicsTimerNotify(), done(false) {}
+
+    expireStatus expire(const epicsTime ¤tTime)
+    {done=true; return expireStatus(noRestart);}
+};
+
+void testRefCount()
+{
+    notified action;
+
+    epicsTimerQueueActive *Q1, *Q2;
+    epicsTimer *T1, *T2;
+
+    Q1 = &epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin );
+
+    T1 = &Q1->createTimer();
+    //timer->start(action, 0.0);
+
+    Q2 = &epicsTimerQueueActive::allocate ( true, epicsThreadPriorityMin );
+
+    testOk1(Q1==Q2);
+
+    T2 = &Q2->createTimer();
+
+    T2->destroy();
+    Q2->release();
+
+    T1->destroy();
+    Q1->release();
+}
+
 static const double delayVerifyOffset = 1.0; // sec 
 
 class delayVerify : public epicsTimerNotify {
@@ -419,7 +454,8 @@ void testPeriodic ()
 
 MAIN(epicsTimerTest)
 {
-    testPlan(40);
+    testPlan(41);
+    testRefCount();
     testAccuracy ();
     testCancel ();
     testExpireDestroy ();

From 4cf3613ace5e3e6abd15fd82a50a8cb09910143e Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 12:38:26 -0600
Subject: [PATCH 29/75] Applied missing-header.patch

---
 src/libCom/cxxTemplates/epicsSingleton.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libCom/cxxTemplates/epicsSingleton.h b/src/libCom/cxxTemplates/epicsSingleton.h
index b97c82b8c..cece8007c 100644
--- a/src/libCom/cxxTemplates/epicsSingleton.h
+++ b/src/libCom/cxxTemplates/epicsSingleton.h
@@ -19,6 +19,7 @@
 #define epicsSingleton_h
 
 #include 
+#include 
 
 #include "shareLib.h"
 #include "epicsAssert.h"

From 4658a88584dc043aa411bf75c70142359e72b2cb Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 14:48:05 -0600
Subject: [PATCH 30/75] Allow compiler flags from command line

The following variables are reserved for use from the
GNUmake command line:
  CMD_INCLUDES
  CMD_CPPFLAGS
  CMD_CFLAGS
  CMD_CXXFLAGS
  CMD_LDFLAGS
  CMD_DBFLAGS
  CMD_DBDFLAGS
  CMD_ARFLAGS

For example:
  make CMD_INCLUDES=/opt/local/include CMD_LDFLAGS=-L/opt/local/lib
---
 configure/CONFIG_COMMON                 | 47 ++++++++++++++++---------
 configure/RULES.Db                      |  4 +--
 configure/os/CONFIG.Common.RTEMS        | 37 +++++++++----------
 configure/os/CONFIG.win32-x86.win32-x86 |  3 +-
 4 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON
index 6b31eea37..839c94283 100644
--- a/configure/CONFIG_COMMON
+++ b/configure/CONFIG_COMMON
@@ -209,6 +209,16 @@ USR_CPPFLAGS =
 USR_DBDFLAGS =
 USR_ARFLAGS =
 
+# Variables to be set only on the command-line:
+# CMD_INCLUDES =
+# CMD_CFLAGS =
+# CMD_CXXFLAGS =
+# CMD_LDFLAGS =
+# CMD_CPPFLAGS =
+# CMD_DBFLAGS =
+# CMD_DBDFLAGS =
+# CMD_ARFLAGS =
+
 # Debug specific options
 DEBUG_CPPFLAGS =
 DEBUG_CFLAGS =
@@ -267,32 +277,35 @@ RUNTIME_LDFLAGS += $(RUNTIME_LDFLAGS_$(COMMANDLINE_LIBRARY))
 # Flags
 
 INCLUDES = -I. $(SRC_INCLUDES) $(INSTALL_INCLUDES) $(RELEASE_INCLUDES)\
- $(TARGET_INCLUDES) $(USR_INCLUDES) $(OP_SYS_INCLUDES) $($(BUILD_CLASS)_INCLUDES)
+ $(TARGET_INCLUDES) $(USR_INCLUDES) $(CMD_INCLUDES) $(OP_SYS_INCLUDES)\
+ $($(BUILD_CLASS)_INCLUDES)
 
-CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\
- $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\
- $(CODE_CFLAGS) $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
+CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS)\
+ $(DEBUG_CFLAGS) $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS)\
+ $(USR_CFLAGS) $(CMD_CFLAGS) $(ARCH_DEP_CFLAGS) $(CODE_CFLAGS)\
+ $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
 
-CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS) $(DEBUG_CXXFLAGS)\
- $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS) $(ARCH_DEP_CXXFLAGS)\
- $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
+CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS)\
+ $(DEBUG_CXXFLAGS) $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS)\
+ $(USR_CXXFLAGS) $(CMD_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS)\
+ $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
 
-LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \
- $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\
- $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
+LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(CMD_LDFLAGS)\
+ $(POSIX_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS)\
+ $($(BUILD_CLASS)_LDFLAGS) $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
 
-LDLIBS = \
- $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS) $(GNU_LDLIBS_$(GNU))
+LDLIBS = $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)\
+ $(GNU_LDLIBS_$(GNU))
 
-CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS)\
- $(OPT_CPPFLAGS) $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS)\
- $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
- $(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
+CPPFLAGS = $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\
+ $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS) $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS)\
+ $(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\
+ $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
 
 #--------------------------------------------------
 # ar definition default
 ARFLAGS =
-ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $@  $(LIBRARY_LD_OBJS)
+ARCMD = $(AR) $(ARFLAGS) $(USR_ARFLAGS) $(CMD_ARFLAGS) $@  $(LIBRARY_LD_OBJS)
 
 #--------------------------------------------------
 # 'Munch' link-edit
diff --git a/configure/RULES.Db b/configure/RULES.Db
index 45acff5da..f0a4f6868 100644
--- a/configure/RULES.Db
+++ b/configure/RULES.Db
@@ -24,8 +24,8 @@ vpath %.acs $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
 DBD_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DBD) $(RELEASE_DBD_DIRS)
 DB_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DB) $(RELEASE_DB_DIRS)
 
-DBDFLAGS = $(USR_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
-DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
+DBDFLAGS = $(USR_DBDFLAGS) $(CMD_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
+DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(CMD_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
 
 #####################################################
 # To allow os specific dbd files AND have the -j option work properly,
diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS
index faf2bd23c..81132cdfd 100644
--- a/configure/os/CONFIG.Common.RTEMS
+++ b/configure/os/CONFIG.Common.RTEMS
@@ -49,28 +49,29 @@ RANLIB := $(RTEMS_TOOLS)/bin/$(RANLIB)
 VALID_BUILDS = Ioc
 
 #--------------------------------------------------
-# The RTEMS Makefiles redefine several macros, so we have to go
-# through the following contortions to get the EPICS flags back.
-CFLAGS = $(CROSS_CFLAGS) $(OPT_CFLAGS) $(DEBUG_CFLAGS)\
- $(WARN_CFLAGS) $(TARGET_CFLAGS) $(USR_CFLAGS) $(ARCH_DEP_CFLAGS)\
- $(CODE_CFLAGS) $(STATIC_CFLAGS)  $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS)\
- $(HDEPENDS_CFLAGS)
+# The RTEMS Makefiles redefine several macros, so we have to
+# reset them to the proper EPICS values, from CONFIG_COMMON
+CFLAGS = $($(BUILD_CLASS)_CFLAGS) $(POSIX_CFLAGS) $(OPT_CFLAGS)\
+ $(DEBUG_CFLAGS) $(PIPE_CFLAGS) $(WARN_CFLAGS) $(TARGET_CFLAGS)\
+ $(USR_CFLAGS) $(CMD_CFLAGS) $(ARCH_DEP_CFLAGS) $(CODE_CFLAGS)\
+ $(STATIC_CFLAGS) $(OP_SYS_CFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
 
-CXXFLAGS = $(CROSS_CXXFLAGS) $(OPT_CXXFLAGS)\
- $(DEBUG_CXXFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS) $(USR_CXXFLAGS)\
- $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS) $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS)\
- $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
+CXXFLAGS = $($(BUILD_CLASS)_CXXFLAGS) $(POSIX_CXXFLAGS) $(OPT_CXXFLAGS)\
+ $(DEBUG_CXXFLAGS) $(PIPE_CFLAGS) $(WARN_CXXFLAGS) $(TARGET_CXXFLAGS)\
+ $(USR_CXXFLAGS) $(CMD_CXXFLAGS) $(ARCH_DEP_CXXFLAGS) $(CODE_CXXFLAGS)\
+ $(STATIC_CXXCFLAGS) $(OP_SYS_CXXFLAGS) $(LIBRARY_SRC_CFLAGS) $(HDEPENDS_CFLAGS)
 
-LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) \
- $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS) $(CROSS_LDFLAGS)\
- $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
+LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(CMD_LDFLAGS)\
+ $(POSIX_LDFLAGS) $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(OP_SYS_LDFLAGS)\
+ $($(BUILD_CLASS)_LDFLAGS) $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS)
 
-LDLIBS = \
- $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)
+LDLIBS = $(POSIX_LDLIBS) $(ARCH_DEP_LDLIBS) $(DEBUG_LDLIBS) $(OP_SYS_LDLIBS)\
+ $(GNU_LDLIBS_$(GNU))
 
-CPPFLAGS += $(CROSS_CPPFLAGS) $(POSIX_CPPFLAGS)\
-$(BASE_CPPFLAGS) $(TARGET_CPPFLAGS) $(USR_CPPFLAGS) $(ARCH_DEP_CPPFLAGS)\
- $(OP_SYS_CPPFLAGS) $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
+CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\
+ $(DEBUG_CPPFLAGS) $(WARN_CPPFLAGS) $(BASE_CPPFLAGS) $(TARGET_CPPFLAGS)\
+ $(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\
+ $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS)
 
 #--------------------------------------------------
 # Although RTEMS uses gcc, it wants to use gcc its own way
diff --git a/configure/os/CONFIG.win32-x86.win32-x86 b/configure/os/CONFIG.win32-x86.win32-x86
index a9fa77ca8..ed6839de7 100644
--- a/configure/os/CONFIG.win32-x86.win32-x86
+++ b/configure/os/CONFIG.win32-x86.win32-x86
@@ -189,7 +189,8 @@ OP_SYS_CXXFLAGS = $(COMPILER_CXXFLAGS)
 #		'-entry:_DllMainCRTStartup$(DLLENTRY)'
 DLLENTRY = @12
 
-WIN32_DLLFLAGS = /subsystem:windows /dll $(OPT_LDFLAGS) $(USR_LDFLAGS) $(TARGET_LDFLAGS) $(LIB_LDFLAGS)
+WIN32_DLLFLAGS = /subsystem:windows /dll $(OPT_LDFLAGS) \
+ $(USR_LDFLAGS) $(CMD_LDFLAGS) $(TARGET_LDFLAGS) $(LIB_LDFLAGS)
 
 #
 # specify dll .def file only if it exists

From 88314d0374b163261b2d04cb07b73a35b259fc84 Mon Sep 17 00:00:00 2001
From: Andrew Johnson 
Date: Fri, 20 Feb 2015 15:24:29 -0600
Subject: [PATCH 31/75] Release notes for CMD_ variables

---
 documentation/RELEASE_NOTES.html | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index bec510c5c..ef8612194 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -13,6 +13,29 @@
 
 
 
+

Added Make variables for command-line use

+ +

The following variables are now used during the build process, reserved for +setting on the command-line only (Makefiles should continue to use the +USR_ equivalents):

+ +
    +
  • CMD_INCLUDES
  • +
  • CMD_CPPFLAGS
  • +
  • CMD_CFLAGS
  • +
  • CMD_CXXFLAGS
  • +
  • CMD_LDFLAGS
  • +
  • CMD_DBFLAGS
  • +
  • CMD_DBDFLAGS
  • +
  • CMD_ARFLAGS
  • +
+ +

For example:

+ +
+make CMD_INCLUDES=/opt/local/include CMD_LDFLAGS=-L/opt/local/lib
+
+

Back-ported dbLoadRecordsHook from the 3.15 branch

See the Release Notes from the Base 3.15.1 release for details.

From 0f2d6eac9b1450157a4ca140fb460c231cdfc414 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Feb 2015 15:34:57 -0600 Subject: [PATCH 32/75] Applied rtems-build-gesys-loadable-objects.patch --- configure/RULES_BUILD | 6 +++++ configure/os/CONFIG.Common.RTEMS | 38 +++++++++++++++++++++++++++ configure/os/CONFIG_SITE.Common.RTEMS | 6 +++++ documentation/RELEASE_NOTES.html | 6 +++++ 4 files changed, 56 insertions(+) diff --git a/configure/RULES_BUILD b/configure/RULES_BUILD index bba3cdc73..c0e1ffbe7 100644 --- a/configure/RULES_BUILD +++ b/configure/RULES_BUILD @@ -331,6 +331,12 @@ $(OBJLIB_MUNCHNAME):%.munch : %_ctdt$(OBJ) %$(OBJ) @$(RM) $@ $(MUNCH_CMD) +# GeSys modules for RTEMS +$(MODNAME): %$(MODEXT): %$(EXE) + @echo "Building module $@" + @$(RM) $@ + $(LINK.mod) + runtests: $(TESTSCRIPTS) -$(PERL) -MTest::Harness -e 'runtests @ARGV if @ARGV;' $^ diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index 81132cdfd..2e3b73ac8 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -83,6 +83,8 @@ OPT_CXXFLAGS_YES = $(CFLAGS_OPTIMIZE_V) OPT_CFLAGS_NO = $(CFLAGS_DEBUG_V) OPT_CXXFLAGS_NO = $(CFLAGS_DEBUG_V) +MODEXT=.obj + #-------------------------------------------------- # operating system class (include/os/) OS_CLASS = RTEMS @@ -97,6 +99,42 @@ OP_SYS_LDFLAGS += $(CPU_CFLAGS) -u Init \ $(PROJECT_RELEASE)/lib/no-signal.rel \ $(PROJECT_RELEASE)/lib/no-rtmon.rel +MOD_SYS_LDFLAGS += $(CPU_CFLAGS) -Wl,-r -nostdlib + +# Do not link against libraries which are part of the Generic Image +GESYS_LIBS += -lgcc +GESYS_LIBS += -lc -lm -lrtemscpu -lrtemsbsp -lrtems++ -lbspExt +GESYS_LIBS += -lcexp -ltecla_r -lspencer_regexp -lpmelf -lpmbfd +GESYS_LIBS += -lnfs -ltelnetd -lrtems-gdb-stub + +# While not part of the Generic Image it provides symbols which +# would conflict. +GESYS_LIBS += -lrtemsCom + +#-------------------------------------------------- +# Options for building GeSys loadable objects + +MODNAME_YES = $(PRODNAME:%$(EXE)=%$(MODEXT)) +MODNAME += $(MODNAME_$(USE_GESYS)) +PRODTARGETS += $(MODNAME) +BIN_INSTALLS += $(MODNAME) + +# changes to LDFLAGS in CONFIG_COMMON and LINK.cpp in CONFIG.Common.UnixCommon +# should be reflected here with the following exceptions +# +# replace OP_SYS_LDFLAGS with MOD_SYS_LDFLAGS +# replace PROD_LDLIBS with MOD_LDLIBS +# remove STATIC_LDFLAGS + +MOD_LDLIBS = $(filter-out $(GESYS_LIBS),$(PROD_LDLIBS)) + +MOD_LDFLAGS = $(OPT_LDFLAGS) $(TARGET_LDFLAGS) $(USR_LDFLAGS) $(POSIX_LDFLAGS) \ + $(ARCH_DEP_LDFLAGS) $(DEBUG_LDFLAGS) $(MOD_SYS_LDFLAGS) $($(BUILD_CLASS)_LDFLAGS)\ + $(RUNTIME_LDFLAGS) $(CODE_LDFLAGS) + +LINK.mod = $(CCC) -o $@ $(PRODDIR_LDFLAGS) $(MOD_LDFLAGS) +LINK.mod += $(PROD_LDFLAGS) $(PROD_LD_OBJS) $(PROD_LD_RESS) $(MOD_LDLIBS) + #-------------------------------------------------- # RTEMS has neither shared libraries nor dynamic loading STATIC_BUILD=YES diff --git a/configure/os/CONFIG_SITE.Common.RTEMS b/configure/os/CONFIG_SITE.Common.RTEMS index d8b700b8c..a276bfa47 100644 --- a/configure/os/CONFIG_SITE.Common.RTEMS +++ b/configure/os/CONFIG_SITE.Common.RTEMS @@ -12,6 +12,12 @@ RTEMS_BASE = /usr/local/rtems/rtems-$(RTEMS_VERSION) # RTEMS_TOOLS = $(RTEMS_BASE) +# Link Generic System loadable objects instead of full executable. +# +# A GeSys object is similar to a shared library. It can be (un)loaded +# at runtime by the Generic System loader which is available as a +# patch against RTEMS. +USE_GESYS=NO # If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC # network configuration you must uncomment and specify your Internet diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index ef8612194..c022df09f 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,12 @@ +

Build rules for RTEMS GESYS modules

+ +

RTEMS target builds can now be configured to make GESYS modules by changing +the USE_GESYS=NO setting in the file +configure/os/CONFIG_SITE.Common.RTEMS to YES.

+

Added Make variables for command-line use

The following variables are now used during the build process, reserved for From 335cba0049a708a1fd7a577af44cc878c7de1ce7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Feb 2015 15:35:59 -0600 Subject: [PATCH 33/75] Applied rtems-mvme5500-needs-libbspExt.patch --- configure/os/CONFIG.Common.RTEMS-mvme5500 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure/os/CONFIG.Common.RTEMS-mvme5500 b/configure/os/CONFIG.Common.RTEMS-mvme5500 index 082e46b38..39be35635 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme5500 +++ b/configure/os/CONFIG.Common.RTEMS-mvme5500 @@ -22,4 +22,6 @@ define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary $< $@ endef +OP_SYS_LDLIBS += -lbspExt + include $(CONFIG)/os/CONFIG.Common.RTEMS From 3601a73b77500e379a34520909b15b9c9918be0c Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Feb 2015 15:42:14 -0600 Subject: [PATCH 34/75] Applied rtems-use-macro-for-BIN2BOOT.patch --- configure/os/CONFIG.Common.RTEMS-pc386 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/os/CONFIG.Common.RTEMS-pc386 b/configure/os/CONFIG.Common.RTEMS-pc386 index 0c6088783..2b20b974a 100644 --- a/configure/os/CONFIG.Common.RTEMS-pc386 +++ b/configure/os/CONFIG.Common.RTEMS-pc386 @@ -12,7 +12,7 @@ MUNCH_SUFFIX = .boot MUNCHNAME = $(PRODNAME:%$(EXE)=%$(MUNCH_SUFFIX)) define MUNCH_CMD $(RTEMS_TOOLS)/bin/$(OBJCOPY_FOR_TARGET) -O binary -R .comment -S $< temp.bin - $(PROJECT_RELEASE)/build-tools/bin2boot $@ 0x00097E00 \ + $(BIN2BOOT) $@ 0x00097E00 \ $(PROJECT_RELEASE)/lib/start16.bin 0x00097C00 0 temp.bin 0x00100000 0 rm -f temp.bin endef From 2d7a8a4aee4c82329ac3b703e91db9bbdfda8d9b Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 20 Feb 2015 16:35:47 -0600 Subject: [PATCH 35/75] Pull blockingSockTest.cpp from 3.15 --- src/libCom/test/blockingSockTest.cpp | 30 ++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/libCom/test/blockingSockTest.cpp b/src/libCom/test/blockingSockTest.cpp index 6d316f753..1a16bb9e6 100644 --- a/src/libCom/test/blockingSockTest.cpp +++ b/src/libCom/test/blockingSockTest.cpp @@ -60,7 +60,9 @@ public: void start (); void daemon (); void stop (); + address addr () const; protected: + address srvaddr; SOCKET sock; epicsThreadId id; bool exit; @@ -156,18 +158,20 @@ extern "C" void serverDaemon ( void * pParam ) { } server::server ( const address & addrIn ) : + srvaddr ( addrIn ), sock ( epicsSocketCreate ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ), id ( 0 ), exit ( false ) { testOk ( this->sock != INVALID_SOCKET, "Server socket valid" ); // setup server side - address tmpAddr = addrIn; - int status = bind ( this->sock, - & tmpAddr.sa, sizeof ( tmpAddr ) ); + osiSocklen_t slen = sizeof ( this->srvaddr ); + int status = bind ( this->sock, & this->srvaddr.sa, slen ); if ( status ) { testDiag ( "bind to server socket failed, status = %d", status ); - testAbort ( "Stop all CA servers before running this test." ); + } + if ( getsockname(this->sock, & this->srvaddr.sa, & slen) != 0 ) { + testAbort ( "Failed to read socket address" ); } status = listen ( this->sock, 10 ); testOk ( status == 0, "Server socket listening" ); @@ -182,7 +186,7 @@ void server::start () testOk ( this->id != 0, "Server thread created" ); } -void server::daemon () +void server::daemon () { while ( ! this->exit ) { // accept client side @@ -204,13 +208,18 @@ void server::stop () epicsSocketDestroy ( this->sock ); } +address server::addr () const +{ + return this->srvaddr; +} + serverCircuit::serverCircuit ( SOCKET sockIn ) : circuit ( sockIn ) { circuit * pCir = this; - epicsThreadId threadId = epicsThreadCreate ( - "server circuit", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), + epicsThreadId threadId = epicsThreadCreate ( + "server circuit", epicsThreadPriorityMedium, + epicsThreadGetStackSize(epicsThreadStackMedium), socketRecvTest, pCir ); testOk ( threadId != 0, "Server circuit thread created" ); } @@ -231,7 +240,7 @@ static const char *mechName(int mech) {esscimqi_socketBothShutdownRequired, "esscimqi_socketBothShutdownRequired" }, {esscimqi_socketSigAlarmRequired, "esscimqi_socketSigAlarmRequired" } }; - + for (unsigned i=0; i < (sizeof(mechs) / sizeof(mechs[0])); ++i) { if (mech == mechs[i].mech) return mechs[i].name; @@ -248,10 +257,11 @@ MAIN(blockingSockTest) memset ( (char *) & addr, 0, sizeof ( addr ) ); addr.ia.sin_family = AF_INET; addr.ia.sin_addr.s_addr = htonl ( INADDR_LOOPBACK ); - addr.ia.sin_port = htons ( 5064 ); // CA + addr.ia.sin_port = 0; server srv ( addr ); srv.start (); + addr = srv.addr (); clientCircuit client ( addr ); epicsThreadSleep ( 1.0 ); From 2bae36845e74c1e74bbc07321c0f5340d527a6d0 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 23 Feb 2015 13:30:45 -0600 Subject: [PATCH 36/75] Adjust a few CONFIG_SITE files, mostly comments --- configure/os/CONFIG_SITE.Common.linux-arm | 41 +++++++++++++++++++ ...ONFIG_SITE.linux-x86-debug.linux-x86-debug | 6 +++ ...SITE.linux-x86_64-debug.linux-x86_64-debug | 6 +-- .../os/CONFIG_SITE.linux-x86_64.linux-arm | 9 ++++ 4 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 configure/os/CONFIG_SITE.Common.linux-arm create mode 100644 configure/os/CONFIG_SITE.linux-x86_64.linux-arm diff --git a/configure/os/CONFIG_SITE.Common.linux-arm b/configure/os/CONFIG_SITE.Common.linux-arm new file mode 100644 index 000000000..466dffe15 --- /dev/null +++ b/configure/os/CONFIG_SITE.Common.linux-arm @@ -0,0 +1,41 @@ +# CONFIG_SITE.Common.linux-arm +# +# $Revision-Id$ +# +# Site Specific definitions for linux-arm target +# Only the local epics system manager should modify this file + +# NOTE for SHARED_LIBRARIES: In most cases if this is set to YES the +# shared libraries will be found automatically. However if the .so +# files are installed at a different path to their compile-time path +# then in order to be found at runtime do one of these: +# a) LD_LIBRARY_PATH must include the full absolute pathname to +# $(INSTALL_LOCATION)/lib/$(EPICS_HOST_ARCH) when invoking base +# executables. +# b) Add the runtime path to SHRLIB_DEPLIB_DIRS and PROD_DEPLIB_DIRS, which +# will add the named directory to the list contained in the executables. +# c) Add the runtime path to /etc/ld.so.conf and run ldconfig +# to inform the system of the shared library location. + +# Depending on your version of Linux you'll want one of the following +# lines to enable command-line editing and history in iocsh. If you're +# not sure which, start with the top one and work downwards until the +# build doesn't fail to link the readline library. If none of them work, +# comment them all out to build without readline support. + +# No other libraries needed (recent Fedora, Ubuntu etc.): +#COMMANDLINE_LIBRARY = READLINE + +# Needs -lncurses (RHEL 5 etc.): +#COMMANDLINE_LIBRARY = READLINE_NCURSES + +# Needs -lcurses (older versions) +#COMMANDLINE_LIBRARY = READLINE_CURSES + + +# It makes sense to include debugging symbols even in optimized builds +# in case you want to attach gdb to the process or examine a core-dump. +# This does cost disk space, but not memory as debug symbols are not +# loaded into RAM when the binary is loaded. +OPT_CFLAGS_YES += -g +OPT_CXXFLAGS_YES += -g diff --git a/configure/os/CONFIG_SITE.linux-x86-debug.linux-x86-debug b/configure/os/CONFIG_SITE.linux-x86-debug.linux-x86-debug index 69f6e7daf..7e6cd3768 100644 --- a/configure/os/CONFIG_SITE.linux-x86-debug.linux-x86-debug +++ b/configure/os/CONFIG_SITE.linux-x86-debug.linux-x86-debug @@ -1,3 +1,9 @@ +# CONFIG_SITE.linux-x86-debug.linux-x86-debug +# +# $Revision-Id$ +# +# Site specific overrides for linux-x86-debug host and target builds +#------------------------------------------------------- #Prepares the object code to collect data for profiling with prof. #PROFILE=YES diff --git a/configure/os/CONFIG_SITE.linux-x86_64-debug.linux-x86_64-debug b/configure/os/CONFIG_SITE.linux-x86_64-debug.linux-x86_64-debug index 848b7c89a..3685bc811 100644 --- a/configure/os/CONFIG_SITE.linux-x86_64-debug.linux-x86_64-debug +++ b/configure/os/CONFIG_SITE.linux-x86_64-debug.linux-x86_64-debug @@ -2,10 +2,8 @@ # # $Revision-Id$ # -# Site specific override definitions for solaris-sparc host builds -# Only the local epics system manager should modify this file - - +# Site specific overrides for linux-x86_64 host and target builds +#------------------------------------------------------- #Prepares the object code to collect data for profiling with prof. #PROFILE=YES diff --git a/configure/os/CONFIG_SITE.linux-x86_64.linux-arm b/configure/os/CONFIG_SITE.linux-x86_64.linux-arm new file mode 100644 index 000000000..95d64e108 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86_64.linux-arm @@ -0,0 +1,9 @@ +# CONFIG_SITE.linux-x86_64.linux-arm +# +# $Revision-Id$ +# +# Site specific settings for linux-x86_64 host - linux-arm target builds +#------------------------------------------------------- + +# Inherit setting from linux-x86 +include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm From d06b1a178a3dbb3b8e7b384d204bf523fe2f48d7 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 23 Feb 2015 14:12:39 -0600 Subject: [PATCH 37/75] Applied Added-configure-files-for-linux-arm-debug.patch --- configure/os/CONFIG.Common.linux-arm-debug | 13 +++++++++++++ configure/os/CONFIG.linux-arm-debug.Common | 12 ++++++++++++ .../os/CONFIG.linux-arm-debug.linux-arm-debug | 14 ++++++++++++++ configure/os/CONFIG.linux-arm.linux-arm-debug | 15 +++++++++++++++ .../CONFIG_SITE.linux-arm-debug.linux-arm-debug | 13 +++++++++++++ .../os/CONFIG_SITE.linux-x86.linux-arm-debug | 9 +++++++++ .../os/CONFIG_SITE.linux-x86_64.linux-arm-debug | 9 +++++++++ 7 files changed, 85 insertions(+) create mode 100644 configure/os/CONFIG.Common.linux-arm-debug create mode 100644 configure/os/CONFIG.linux-arm-debug.Common create mode 100644 configure/os/CONFIG.linux-arm-debug.linux-arm-debug create mode 100644 configure/os/CONFIG.linux-arm.linux-arm-debug create mode 100644 configure/os/CONFIG_SITE.linux-arm-debug.linux-arm-debug create mode 100644 configure/os/CONFIG_SITE.linux-x86.linux-arm-debug create mode 100644 configure/os/CONFIG_SITE.linux-x86_64.linux-arm-debug diff --git a/configure/os/CONFIG.Common.linux-arm-debug b/configure/os/CONFIG.Common.linux-arm-debug new file mode 100644 index 000000000..3f4b40102 --- /dev/null +++ b/configure/os/CONFIG.Common.linux-arm-debug @@ -0,0 +1,13 @@ +# CONFIG.Common.linux-arm-debug +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for linux-arm with debug compiler flags +# Override these settings in CONFIG_SITE.Common.linux-arm-debug +#------------------------------------------------------- + +# Include definitions common to all linux-arm target archs +include $(CONFIG)/os/CONFIG.Common.linux-arm + +HOST_OPT=NO diff --git a/configure/os/CONFIG.linux-arm-debug.Common b/configure/os/CONFIG.linux-arm-debug.Common new file mode 100644 index 000000000..16ea60420 --- /dev/null +++ b/configure/os/CONFIG.linux-arm-debug.Common @@ -0,0 +1,12 @@ +# CONFIG.linux-arm-debug.Common +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for linux-arm-debug host builds +# Override these settings in CONFIG_SITE.linux-arm-debug.Common +#------------------------------------------------------- + +#Include definitions common to linux-arm hosts +include $(CONFIG)/os/CONFIG.linux-arm.Common + diff --git a/configure/os/CONFIG.linux-arm-debug.linux-arm-debug b/configure/os/CONFIG.linux-arm-debug.linux-arm-debug new file mode 100644 index 000000000..2567008aa --- /dev/null +++ b/configure/os/CONFIG.linux-arm-debug.linux-arm-debug @@ -0,0 +1,14 @@ +# CONFIG.linux-arm-debug.linux-arm-debug +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for linux-arm-debug host and target build +# Override these settings in CONFIG_SITE.linux-arm-debug.linux-arm-debug +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.linux-arm.linux-arm + +# Removes -O optimization and adds -g compile option +HOST_OPT=NO + diff --git a/configure/os/CONFIG.linux-arm.linux-arm-debug b/configure/os/CONFIG.linux-arm.linux-arm-debug new file mode 100644 index 000000000..d6e86be18 --- /dev/null +++ b/configure/os/CONFIG.linux-arm.linux-arm-debug @@ -0,0 +1,15 @@ +# CONFIG.linux-arm.linux-arm-debug +# +# $Revision-Id$ +# This file is maintained by the build community. +# +# Definitions for linux-arm host - linux-arm-debug target build +# Override these settings in CONFIG_SITE.linux-arm.linux-arm-debug +#------------------------------------------------------- + +-include $(CONFIG)/os/CONFIG.linux-arm.linux-arm +-include $(CONFIG)/os/CONFIG_SITE.Common.linux-arm +-include $(CONFIG)/os/CONFIG_SITE.linux-arm.linux-arm + +BUILD_CLASS=HOST +HOST_OPT=NO diff --git a/configure/os/CONFIG_SITE.linux-arm-debug.linux-arm-debug b/configure/os/CONFIG_SITE.linux-arm-debug.linux-arm-debug new file mode 100644 index 000000000..fc4a9f2a9 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-arm-debug.linux-arm-debug @@ -0,0 +1,13 @@ +# CONFIG_SITE.linux-arm-debug.linux-arm-debug +# +# $Revision-Id$ +# +# Site specific overrides for linux-arm-debug host and target builds +#------------------------------------------------------- + +#Prepares the object code to collect data for profiling with prof. +#PROFILE=YES + +#Compiles for profiling with the gprof profiler. +#GPROF=YES + diff --git a/configure/os/CONFIG_SITE.linux-x86.linux-arm-debug b/configure/os/CONFIG_SITE.linux-x86.linux-arm-debug new file mode 100644 index 000000000..461c44290 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86.linux-arm-debug @@ -0,0 +1,9 @@ +# CONFIG_SITE.linux-x86.linux-arm-debug +# +# $Revision-Id$ +# +# Site specific settings for linux-x86 host - linux-arm-debug target builds +#------------------------------------------------------- + +# Inherit settings from linux-arm +include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm diff --git a/configure/os/CONFIG_SITE.linux-x86_64.linux-arm-debug b/configure/os/CONFIG_SITE.linux-x86_64.linux-arm-debug new file mode 100644 index 000000000..98e644671 --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86_64.linux-arm-debug @@ -0,0 +1,9 @@ +# CONFIG_SITE.linux-x86_64.linux-arm-debug +# +# $Revision-Id$ +# +# Site specific settings for linux-x86_64 host - linux-arm-debug target builds +#------------------------------------------------------- + +# Inherit settings from linux-arm +include $(CONFIG)/os/CONFIG_SITE.linux-x86.linux-arm From 4a0880003c0111ec397312ebaa989fb02ced633a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Feb 2015 14:30:42 -0600 Subject: [PATCH 38/75] Support MinGW cross-builds on linux-x86 and x86_64 --- configure/os/CONFIG.Common.win32-x86-mingw | 3 ++- configure/os/CONFIG.linux-x86.win32-x86-mingw | 22 ++++++++++++++++++ .../os/CONFIG.linux-x86_64.win32-x86-mingw | 9 ++++++++ .../os/CONFIG.win32-x86-mingw.win32-x86-mingw | 11 ++++++--- .../os/CONFIG_SITE.Common.win32-x86-mingw | 10 ++++---- .../os/CONFIG_SITE.linux-x86.win32-x86-mingw | 23 +++++++++++++++++++ .../CONFIG_SITE.linux-x86_64.win32-x86-mingw | 8 +++++++ ...ONFIG_SITE.win32-x86-mingw.win32-x86-mingw | 14 ++++------- documentation/RELEASE_NOTES.html | 10 ++++++++ src/as/asHost.rc | 2 +- src/as/asIoc.rc | 2 +- src/ca/ca.rc | 2 +- src/cas/build/cas.rc | 2 +- src/db/dbIoc.rc | 2 +- src/dbStatic/dbStaticHost.rc | 2 +- src/dbStatic/dbStaticIoc.rc | 2 +- src/dbtools/dbtoolsIoc.rc | 2 +- src/dev/softDev/softDevIoc.rc | 2 +- src/dev/testDev/testDevIoc.rc | 2 +- src/gdd/gdd.rc | 2 +- src/libCom/Com.rc | 2 +- src/misc/misc.rc | 2 +- src/misc/miscIoc.rc | 2 +- src/rec/recIoc.rc | 2 +- src/registry/registryIoc.rc | 2 +- src/rsrv/rsrvIoc.rc | 2 +- 26 files changed, 107 insertions(+), 37 deletions(-) create mode 100644 configure/os/CONFIG.linux-x86.win32-x86-mingw create mode 100644 configure/os/CONFIG.linux-x86_64.win32-x86-mingw create mode 100644 configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw create mode 100644 configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw diff --git a/configure/os/CONFIG.Common.win32-x86-mingw b/configure/os/CONFIG.Common.win32-x86-mingw index a229902a7..7ff9b5fe5 100644 --- a/configure/os/CONFIG.Common.win32-x86-mingw +++ b/configure/os/CONFIG.Common.win32-x86-mingw @@ -34,7 +34,8 @@ ARCH_DEP_LDFLAGS += -m32 # Override for -DUNIX from CONFIG.Common.UnixCommon OP_SYS_CPPFLAGS = -D_MINGW -EXE=.exe +EXE = .exe +RES = .coff VISC_DLL_NO = -DEPICS_DLL_NO VISC_DLL_YES = diff --git a/configure/os/CONFIG.linux-x86.win32-x86-mingw b/configure/os/CONFIG.linux-x86.win32-x86-mingw new file mode 100644 index 000000000..0e9c44c13 --- /dev/null +++ b/configure/os/CONFIG.linux-x86.win32-x86-mingw @@ -0,0 +1,22 @@ +# CONFIG.linux-x86.win32-x86-mingw +# +# Definitions for linux-x86 host win32-x86-mingw target builds +# Override these definitions in CONFIG_SITE.linux-x86.win32-x86-mingw +#------------------------------------------------------- + +# Include common gnu compiler definitions +include $(CONFIG)/CONFIG.gnuCommon + +# Add resource compiler +RCCMD = $(CMPLR_PREFIX)windres$(CMPLR_SUFFIX) $(INCLUDES) $< $@ + +# Remove -fPIC flags, add out-implib +SHRLIB_CFLAGS = +SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) +LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) + +# Don't link with gcc library +GNU_LDLIBS_YES = + +# Link with winsock2 +OP_SYS_LDLIBS = -lws2_32 diff --git a/configure/os/CONFIG.linux-x86_64.win32-x86-mingw b/configure/os/CONFIG.linux-x86_64.win32-x86-mingw new file mode 100644 index 000000000..fe4edd1e8 --- /dev/null +++ b/configure/os/CONFIG.linux-x86_64.win32-x86-mingw @@ -0,0 +1,9 @@ +# CONFIG.linux-x86_64.win32-x86-mingw +# +# Definitions for linux-x86_64 host win32-x86-mingw target builds +# Override these definitions in CONFIG_SITE.linux-x86_64.win32-x86-mingw +#------------------------------------------------------- + +# Settings as for the linux-x86 host architecture +include $(CONFIG)/os/CONFIG.linux-x86.win32-x86-mingw + diff --git a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw index 96fa115fc..c101376c8 100644 --- a/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG.win32-x86-mingw.win32-x86-mingw @@ -9,22 +9,27 @@ # Include common gnu compiler definitions include $(CONFIG)/CONFIG.gnuCommon +# Undo various things set by CONFIG.gnuCommon + CMPLR_PREFIX = +# Remove $(GNU_BIN)/ path CC = $(CMPLR_PREFIX)gcc CCC = $(CMPLR_PREFIX)g++ AR = $(CMPLR_PREFIX)ar -rc LD = $(CMPLR_PREFIX)ld -r RANLIB = $(CMPLR_PREFIX)ranlib -RES = .coff + +# Add resource compiler RCCMD = $(CMPLR_PREFIX)windres $(INCLUDES) $< $@ -# No -fPIC avoids "-fPIC ignored for target (all code is position independent)" +# Remove -fPIC flags, add out-implib SHRLIB_CFLAGS = SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) LOADABLE_SHRLIB_LDFLAGS = -shared -Wl,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX) -# Override linking with gcc library from CONFIG.gnuCommon +# Don't link with gcc library GNU_LDLIBS_YES = +# Link with winsock2 OP_SYS_LDLIBS = -lws2_32 diff --git a/configure/os/CONFIG_SITE.Common.win32-x86-mingw b/configure/os/CONFIG_SITE.Common.win32-x86-mingw index e61ffc7b9..39f219b19 100644 --- a/configure/os/CONFIG_SITE.Common.win32-x86-mingw +++ b/configure/os/CONFIG_SITE.Common.win32-x86-mingw @@ -1,11 +1,9 @@ -# CONFIG_SITE.win32-x86-mingw.Common +# CONFIG_SITE.Common.win32-x86-mingw # # $Revision-Id$ # -# Site Specific definitions for cygwin-x86 target -# Only the local epics system manager should modify this file +# Site Specific definitions for win32-x86-mingw target -# If readline is not installed comment the following line -# to omit command-line editing and history support +# If readline is available uncomment the following line +# to enable command-line editing and history support #COMMANDLINE_LIBRARY = READLINE - diff --git a/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw b/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw new file mode 100644 index 000000000..1d132b74d --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw @@ -0,0 +1,23 @@ +# CONFIG_SITE.linux-x86.win32-x86-mingw +# +# Configuration for linux-x86 host win32-x86-mingw target builds +#------------------------------------------------------- + +# Early versions of the MinGW cross-build tools can only build +# static (non-DLL) libraries. Fedora's cross-build of gcc 4.4.6 +# needs these uncommented, other distributions have not been +# tested with this release of Base: +SHARED_LIBRARIES = NO +STATIC_BUILD = YES + +# The cross-build tools are in $(GNU_DIR)/bin +# Default is /usr +#GNU_DIR = /usr/local + +# Different distribution cross-build packages use different prefixes: +# Ubuntu: +#CMPLR_PREFIX = i686-w64-mingw32- +# RHEL: +CMPLR_PREFIX = i686-pc-mingw32- +# Debian? +#CMPLR_PREFIX = i586-mingw32msvc- diff --git a/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw b/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw new file mode 100644 index 000000000..99836730a --- /dev/null +++ b/configure/os/CONFIG_SITE.linux-x86_64.win32-x86-mingw @@ -0,0 +1,8 @@ +# CONFIG_SITE.linux-x86_64.win32-x86-mingw +# +# Configuration for linux-x86_64 host win32-x86-mingw target builds +#------------------------------------------------------- + +# Inherit from the linux-x86 host architecture +include $(CONFIG)/os/CONFIG_SITE.linux-x86.win32-x86-mingw + diff --git a/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw b/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw index 259d1e0c8..9022b8e2b 100644 --- a/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw +++ b/configure/os/CONFIG_SITE.win32-x86-mingw.win32-x86-mingw @@ -3,15 +3,9 @@ # $Revision-Id$ # # Site Specific definitions for win32-x86-mingw target -# Only the local epics system manager should modify this file +# The MinGW bin directory must be in your path. -# Uncomment the following settings for MinGW_w32 releases -# /bin should be in your path -#CMPLR_PREFIX=i686-w64-mingw32- -#CC = $(CMPLR_PREFIX)gcc -#CCC = $(CMPLR_PREFIX)g++ -#AR = $(CMPLR_PREFIX)ar -rc -#LD = $(CMPLR_PREFIX)ld -r -#RANLIB = $(CMPLR_PREFIX)ranlib - +# Set the compiler prefix for your MinGW installation +#CMPLR_PREFIX = i686-w64-mingw32- +#CMPLR_PREFIX = i586-mingw32msvc- diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index c022df09f..98cd64ae7 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,16 @@ +

MinGW Cross-builds from Linux

+ +

Build configuration files have been back-ported from the 3.15 branch that +allows cross-building of the win32-x86-mingw target from either linux-x86 or +linux-x86_64 hosts. Many Linux distributions now package the necessary MinGW +cross-build tools and libraries to support this. Adjust the settings in +configure/os/CONFIG_SITE.linux-x86.win32-x86-mingw and add win32-x86-mingw to +the CROSS_COMPILER_TARGET_ARCHS variable in configure/CONFIG_SITE or in +configure/os/CONFIG_SITE.linux-x86.Common.

+

Build rules for RTEMS GESYS modules

RTEMS target builds can now be configured to make GESYS modules by changing diff --git a/src/as/asHost.rc b/src/as/asHost.rc index 77981517e..6546cf8be 100644 --- a/src/as/asHost.rc +++ b/src/as/asHost.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/as/asIoc.rc b/src/as/asIoc.rc index f83a3c17e..c693af530 100644 --- a/src/as/asIoc.rc +++ b/src/as/asIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/ca/ca.rc b/src/ca/ca.rc index cf25cdf24..b1f87acb4 100644 --- a/src/ca/ca.rc +++ b/src/ca/ca.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/cas/build/cas.rc b/src/cas/build/cas.rc index 8ad47e360..6c84bced8 100644 --- a/src/cas/build/cas.rc +++ b/src/cas/build/cas.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/db/dbIoc.rc b/src/db/dbIoc.rc index 6b261fff3..5c810b0e5 100644 --- a/src/db/dbIoc.rc +++ b/src/db/dbIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbStatic/dbStaticHost.rc b/src/dbStatic/dbStaticHost.rc index a6d32066a..6065fc55c 100644 --- a/src/dbStatic/dbStaticHost.rc +++ b/src/dbStatic/dbStaticHost.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbStatic/dbStaticIoc.rc b/src/dbStatic/dbStaticIoc.rc index 865e8102d..b9f12cd80 100644 --- a/src/dbStatic/dbStaticIoc.rc +++ b/src/dbStatic/dbStaticIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dbtools/dbtoolsIoc.rc b/src/dbtools/dbtoolsIoc.rc index 5f3d70bf4..d7aedf548 100644 --- a/src/dbtools/dbtoolsIoc.rc +++ b/src/dbtools/dbtoolsIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dev/softDev/softDevIoc.rc b/src/dev/softDev/softDevIoc.rc index addbe1708..7e789bb2e 100644 --- a/src/dev/softDev/softDevIoc.rc +++ b/src/dev/softDev/softDevIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/dev/testDev/testDevIoc.rc b/src/dev/testDev/testDevIoc.rc index 04c9dbdae..70ab82d1f 100644 --- a/src/dev/testDev/testDevIoc.rc +++ b/src/dev/testDev/testDevIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/gdd/gdd.rc b/src/gdd/gdd.rc index e5ca7379d..d677c6f7a 100644 --- a/src/gdd/gdd.rc +++ b/src/gdd/gdd.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/libCom/Com.rc b/src/libCom/Com.rc index d0edc440b..d5a5562b7 100644 --- a/src/libCom/Com.rc +++ b/src/libCom/Com.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/misc/misc.rc b/src/misc/misc.rc index 040cf26c8..a24406060 100644 --- a/src/misc/misc.rc +++ b/src/misc/misc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/misc/miscIoc.rc b/src/misc/miscIoc.rc index abff0a137..235c2a746 100644 --- a/src/misc/miscIoc.rc +++ b/src/misc/miscIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/rec/recIoc.rc b/src/rec/recIoc.rc index 7dad57625..a345ef4b9 100644 --- a/src/rec/recIoc.rc +++ b/src/rec/recIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/registry/registryIoc.rc b/src/registry/registryIoc.rc index e2397ba0b..46e7dca2c 100644 --- a/src/registry/registryIoc.rc +++ b/src/registry/registryIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO diff --git a/src/rsrv/rsrvIoc.rc b/src/rsrv/rsrvIoc.rc index 758096e16..b82b2e5ca 100644 --- a/src/rsrv/rsrvIoc.rc +++ b/src/rsrv/rsrvIoc.rc @@ -1,4 +1,4 @@ -#include +#include #include "epicsVersion.h" VS_VERSION_INFO VERSIONINFO From b7baa2504eccc4e62a4b302d9b2cc164daa62516 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Feb 2015 16:23:14 -0600 Subject: [PATCH 39/75] Only build Cap5.so for the host architecture --- src/cap5/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cap5/Makefile b/src/cap5/Makefile index ba145eb11..41c66a51c 100644 --- a/src/cap5/Makefile +++ b/src/cap5/Makefile @@ -25,9 +25,8 @@ PERL_VERSION = $(shell $(PERL) ../perlConfig.pl version) PERL_ARCHNAME = $(shell $(PERL) ../perlConfig.pl archname) PERL_ARCHPATH = $(PERL_VERSION)/$(PERL_ARCHNAME) -ifeq ($(findstring Host,$(VALID_BUILDS)),Host) -ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),) - # Doesn't build on WIN32 +ifeq ($(T_A),$(EPICS_HOST_ARCH)) # No cross-builds (wrong Perl!) +ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),) # Doesn't build on WIN32 LOADABLE_LIBRARY_HOST = Cap5 PERL_SCRIPTS += cainfo.pl From 65d39fcbc85e177a4e22265425060fc544c805ab Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 24 Feb 2015 16:51:59 -0600 Subject: [PATCH 40/75] Moved linux-arm cross-build link-time settings --- configure/os/CONFIG.Common.linux-arm | 27 +------------------ configure/os/CONFIG.linux-x86.linux-arm | 25 +++++++++++++++-- configure/os/CONFIG.linux-x86.linux-arm-debug | 9 +++++++ configure/os/CONFIG.linux-x86_64.linux-arm | 8 ++++++ .../os/CONFIG.linux-x86_64.linux-arm-debug | 8 ++++++ 5 files changed, 49 insertions(+), 28 deletions(-) create mode 100644 configure/os/CONFIG.linux-x86.linux-arm-debug create mode 100644 configure/os/CONFIG.linux-x86_64.linux-arm create mode 100644 configure/os/CONFIG.linux-x86_64.linux-arm-debug diff --git a/configure/os/CONFIG.Common.linux-arm b/configure/os/CONFIG.Common.linux-arm index 15dad9e9e..a305523eb 100644 --- a/configure/os/CONFIG.Common.linux-arm +++ b/configure/os/CONFIG.Common.linux-arm @@ -1,9 +1,7 @@ # CONFIG.Common.linux-arm # -# This file is maintained by the build community. -# # Definitions for linux-arm target builds -# Sites may override these definitions in CONFIG_SITE.Common.linux-arm +# Override these settings in CONFIG_SITE.Common.linux-arm #------------------------------------------------------- # Include definitions common to all Linux targets @@ -11,26 +9,3 @@ include $(CONFIG)/os/CONFIG.Common.linuxCommon ARCH_CLASS = arm -ifeq ($(BUILD_CLASS),CROSS) - VALID_BUILDS = Ioc - GNU_TARGET = arm-linux - - # prefix of compiler tools - CMPLR_SUFFIX = - CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET)) - - # Provide a link-time path for shared libraries - SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath-link,%) - SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) - - # Provide a link-time path for products - PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%) - PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) - - # Provide a link-time path for readline - RUNTIME_LDFLAGS_READLINE_YES = -Wl,-rpath-link,$(GNU_DIR)/lib - RUNTIME_LDFLAGS_READLINE = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) - RUNTIME_LDFLAGS_READLINE_CURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) - RUNTIME_LDFLAGS_READLINE_NCURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) - -endif diff --git a/configure/os/CONFIG.linux-x86.linux-arm b/configure/os/CONFIG.linux-x86.linux-arm index 2d38bfcc9..e2cf36a52 100644 --- a/configure/os/CONFIG.linux-x86.linux-arm +++ b/configure/os/CONFIG.linux-x86.linux-arm @@ -1,10 +1,31 @@ # CONFIG.linux-x86.linux-arm # # Definitions for linux-x86 host - linux-arm target builds -# Sites may override these definitions in CONFIG_SITE.linux-x86.linux-arm +# Override these settings in CONFIG_SITE.linux-x86.linux-arm #------------------------------------------------------- -# Copied from x86.x86 +VALID_BUILDS = Ioc +GNU_TARGET = arm-linux + +# prefix of compiler tools +CMPLR_SUFFIX = +CMPLR_PREFIX = $(addsuffix -,$(GNU_TARGET)) + +# Provide a link-time path for shared libraries +SHRLIBDIR_RPATH_LDFLAGS_YES += $(SHRLIB_DEPLIB_DIRS:%=-Wl,-rpath-link,%) +SHRLIBDIR_LDFLAGS += $(SHRLIBDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) + +# Provide a link-time path for products +PRODDIR_RPATH_LDFLAGS_YES += $(PROD_DEPLIB_DIRS:%=-Wl,-rpath-link,%) +PRODDIR_LDFLAGS += $(PRODDIR_RPATH_LDFLAGS_$(LINKER_USE_RPATH)) + +# Provide a link-time path for readline +RUNTIME_LDFLAGS_READLINE_YES = -Wl,-rpath-link,$(GNU_DIR)/lib +RUNTIME_LDFLAGS_READLINE = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) +RUNTIME_LDFLAGS_READLINE_CURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) +RUNTIME_LDFLAGS_READLINE_NCURSES = $(RUNTIME_LDFLAGS_READLINE_$(LINKER_USE_RPATH)) + +# Library flags STATIC_LDFLAGS_YES= -Wl,-Bstatic STATIC_LDFLAGS_NO= STATIC_LDLIBS_YES= -Wl,-Bdynamic diff --git a/configure/os/CONFIG.linux-x86.linux-arm-debug b/configure/os/CONFIG.linux-x86.linux-arm-debug new file mode 100644 index 000000000..16dad62c3 --- /dev/null +++ b/configure/os/CONFIG.linux-x86.linux-arm-debug @@ -0,0 +1,9 @@ +# CONFIG.linux-x86.linux-arm-debug +# +# Definitions for linux-x86 host - linux-arm-debug target builds +# Override these settings in CONFIG_SITE.linux-x86.linux-arm-debug +#------------------------------------------------------- + +# Include definitions for linux-arm targets +include $(CONFIG)/os/CONFIG.linux-x86.linux-arm + diff --git a/configure/os/CONFIG.linux-x86_64.linux-arm b/configure/os/CONFIG.linux-x86_64.linux-arm new file mode 100644 index 000000000..38cd888ad --- /dev/null +++ b/configure/os/CONFIG.linux-x86_64.linux-arm @@ -0,0 +1,8 @@ +# CONFIG.linux-x86_64.linux-arm +# +# Definitions for linux-x86_64 host - linux-arm target builds +# Sites may override these definitions in CONFIG_SITE.linux-x86_64.linux-arm +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.linux-x86.linux-arm + diff --git a/configure/os/CONFIG.linux-x86_64.linux-arm-debug b/configure/os/CONFIG.linux-x86_64.linux-arm-debug new file mode 100644 index 000000000..3feb41089 --- /dev/null +++ b/configure/os/CONFIG.linux-x86_64.linux-arm-debug @@ -0,0 +1,8 @@ +# CONFIG.linux-x86_64.linux-arm-debug +# +# Definitions for linux-x86_64 host - linux-arm-debug target builds +# Override these settings in CONFIG_SITE.linux-x86_64.linux-arm-debug +#------------------------------------------------------- + +include $(CONFIG)/os/CONFIG.linux-x86.linux-arm + From 12793d33131a306e522355946ea01b32e703f23f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 25 Feb 2015 12:02:34 -0600 Subject: [PATCH 41/75] Cosmetic changes in configure/os --- configure/os/CONFIG_SITE.Common.RTEMS | 9 ++++++--- configure/os/CONFIG_SITE.Common.linux-arm | 4 ++-- configure/os/CONFIG_SITE.Common.linux-xscale_be | 5 ++++- configure/os/CONFIG_SITE.linux-x86.linux-arm | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/configure/os/CONFIG_SITE.Common.RTEMS b/configure/os/CONFIG_SITE.Common.RTEMS index a276bfa47..d2cccea67 100644 --- a/configure/os/CONFIG_SITE.Common.RTEMS +++ b/configure/os/CONFIG_SITE.Common.RTEMS @@ -1,12 +1,15 @@ +# CONFIG_SITE.Common.RTEMS +# +# $Revision-Id$ # # Site-specific information for all RTEMS targets -# #------------------------------------------------------- # Where to find RTEMS # +# APS: RTEMS_VERSION = 4.10.2 -RTEMS_BASE = /usr/local/rtems/rtems-$(RTEMS_VERSION) +RTEMS_BASE = /usr/local/vw/rtems/rtems-$(RTEMS_VERSION) # Cross-compile toolchain in $(RTEMS_TOOLS)/bin # @@ -17,7 +20,7 @@ RTEMS_TOOLS = $(RTEMS_BASE) # A GeSys object is similar to a shared library. It can be (un)loaded # at runtime by the Generic System loader which is available as a # patch against RTEMS. -USE_GESYS=NO +USE_GESYS = NO # If you're using neither BOOTP/DHCP nor FLASH to pick up your IOC # network configuration you must uncomment and specify your Internet diff --git a/configure/os/CONFIG_SITE.Common.linux-arm b/configure/os/CONFIG_SITE.Common.linux-arm index 466dffe15..0e78404cc 100644 --- a/configure/os/CONFIG_SITE.Common.linux-arm +++ b/configure/os/CONFIG_SITE.Common.linux-arm @@ -2,8 +2,8 @@ # # $Revision-Id$ # -# Site Specific definitions for linux-arm target -# Only the local epics system manager should modify this file +# Site Specific definitions for all linux-arm targets +#------------------------------------------------------- # NOTE for SHARED_LIBRARIES: In most cases if this is set to YES the # shared libraries will be found automatically. However if the .so diff --git a/configure/os/CONFIG_SITE.Common.linux-xscale_be b/configure/os/CONFIG_SITE.Common.linux-xscale_be index 0d28a4e2a..226aebac6 100644 --- a/configure/os/CONFIG_SITE.Common.linux-xscale_be +++ b/configure/os/CONFIG_SITE.Common.linux-xscale_be @@ -1,9 +1,12 @@ # CONFIG_SITE.Common.linux-xscale_be # +# $Revision-Id$ +# # Site specific definitions for linux-xscale_be target builds. #------------------------------------------------------- # Set GNU_DIR to point to directory containing the tool-chain -GNU_DIR = /usr/local/xscale_be +# APS: +GNU_DIR = /usr/local/vw/xscale_be diff --git a/configure/os/CONFIG_SITE.linux-x86.linux-arm b/configure/os/CONFIG_SITE.linux-x86.linux-arm index f27a6a0cd..528c9bc6c 100644 --- a/configure/os/CONFIG_SITE.linux-x86.linux-arm +++ b/configure/os/CONFIG_SITE.linux-x86.linux-arm @@ -1,4 +1,4 @@ -# CONFIG_SITE.linux-x86.linux-arm +# CONFIG_SITE.linux-x86.linux-arm # # $Revision-Id$ # @@ -8,7 +8,8 @@ # Tools install path #GNU_DIR = /home/targetOS/linux-arm/host/x86-linux/gcc_3.3.3 -GNU_DIR = /net/phoebus/vw/zynq-2011.09 +# APS: +GNU_DIR = /usr/local/vw/zynq-2011.09 # GNU crosscompiler target name GNU_TARGET = arm-xilinx-linux-gnueabi From d53521f160bb36349a1eeb1783ef51805f26cd6a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 25 Feb 2015 16:23:05 -0600 Subject: [PATCH 42/75] Set version to 3.14.12.5-pre1 --- configure/CONFIG_BASE_VERSION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index b4adca194..017fe7d9c 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -30,11 +30,11 @@ EPICS_MODIFICATION = 12 # EPICS_PATCH_LEVEL must be a number (win32 resource file requirement) # Not included if zero -EPICS_PATCH_LEVEL = 4 +EPICS_PATCH_LEVEL = 5 # This will end in -DEV between official releases -EPICS_DEV_SNAPSHOT=-DEV -#EPICS_DEV_SNAPSHOT=-pre1 +#EPICS_DEV_SNAPSHOT=-DEV +EPICS_DEV_SNAPSHOT=-pre1 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV From 004e7237c3fd93914ca505d6c5ce66b851aaf3b5 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 25 Feb 2015 16:24:28 -0600 Subject: [PATCH 43/75] Snapshot to -pre1-DEV --- configure/CONFIG_BASE_VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 017fe7d9c..0d8dcb1db 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -34,8 +34,8 @@ EPICS_PATCH_LEVEL = 5 # This will end in -DEV between official releases #EPICS_DEV_SNAPSHOT=-DEV -EPICS_DEV_SNAPSHOT=-pre1 -#EPICS_DEV_SNAPSHOT=-pre1-DEV +#EPICS_DEV_SNAPSHOT=-pre1 +EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV #EPICS_DEV_SNAPSHOT=-rc1 From 91c8ba592d73df969e84f2c6c7edb3b479a2f029 Mon Sep 17 00:00:00 2001 From: Janet Anderson Date: Thu, 26 Feb 2015 13:24:29 -0600 Subject: [PATCH 44/75] Added directory change comment for Older Xcode --- configure/os/CONFIG_SITE.Common.iosCommon | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure/os/CONFIG_SITE.Common.iosCommon b/configure/os/CONFIG_SITE.Common.iosCommon index de51f6153..a964c5bca 100644 --- a/configure/os/CONFIG_SITE.Common.iosCommon +++ b/configure/os/CONFIG_SITE.Common.iosCommon @@ -12,10 +12,14 @@ #IOS_DEPLOYMENT_TARGET = 5.1 #IOS_DEPLOYMENT_TARGET = 6.0 #IOS_DEPLOYMENT_TARGET = 6.1 -IOS_DEPLOYMENT_TARGET = 7.0 -#IOS_DEPLOYMENT_TARGET = 8.0 +#IOS_DEPLOYMENT_TARGET = 7.0 +#IOS_DEPLOYMENT_TARGET = 7.1 +IOS_DEPLOYMENT_TARGET = 8.0 #IOS_DEPLOYMENT_TARGET = 8.1 +# Older versions of Xcode may require this SDK_DIR definition +#SDK_DIR = $(PLATFORM_DIR)/Developer/SDKs/$(IOS_PLATFORM)$(IOS_DEPLOYMENT_TARGET).sdk + # Which compiler to use: # CLANG is required for Xcode 5.0 and later From 2799f1cf3f178046af958df281a76d32beffd77e Mon Sep 17 00:00:00 2001 From: Janet Anderson Date: Thu, 26 Feb 2015 13:26:56 -0600 Subject: [PATCH 45/75] Fixed incorrect comment lines --- configure/CONFIG_ADDONS | 1 - configure/os/CONFIG.Common.RTEMS-mvme2100 | 2 +- configure/os/CONFIG.Common.win32-x86-cygwin | 2 +- configure/os/CONFIG.solaris-sparc64.Common | 2 +- configure/os/CONFIG.solaris-sparc64.solaris-sparc64 | 2 +- configure/os/CONFIG.solarisCommon.solarisCommon | 4 ++-- configure/os/CONFIG.win32-x86-mingw.Common | 2 +- configure/os/CONFIG.win32-x86.windows-x64 | 2 +- configure/os/CONFIG_SITE.Common.win32-x86-cygwin | 2 +- 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/configure/CONFIG_ADDONS b/configure/CONFIG_ADDONS index 86813964e..61ce7d380 100644 --- a/configure/CONFIG_ADDONS +++ b/configure/CONFIG_ADDONS @@ -26,7 +26,6 @@ # USR_CFLAGS C flags # USR_CXXFLAGS C++ flags # USR_CPPFLAGS c preprocesser flags -# INC include-files to install # SRCS source files for building libraries and prods # USR_SRCS source files for building libraries and prods # PROD_SRCS source files for building prods diff --git a/configure/os/CONFIG.Common.RTEMS-mvme2100 b/configure/os/CONFIG.Common.RTEMS-mvme2100 index 9f7eeefca..aac3650fd 100644 --- a/configure/os/CONFIG.Common.RTEMS-mvme2100 +++ b/configure/os/CONFIG.Common.RTEMS-mvme2100 @@ -1,5 +1,5 @@ # -# CONFIG.Common.RTEMS-mvme3100 +# CONFIG.Common.RTEMS-mvme2100 # $Revision-Id$ # Author: W. Eric Norum # diff --git a/configure/os/CONFIG.Common.win32-x86-cygwin b/configure/os/CONFIG.Common.win32-x86-cygwin index 4994ea682..5e63bf399 100644 --- a/configure/os/CONFIG.Common.win32-x86-cygwin +++ b/configure/os/CONFIG.Common.win32-x86-cygwin @@ -4,7 +4,7 @@ # This file is maintained by the build community. # # Definitions for cygwin-x86 target builds -# Sites may override these definitions in CONFIG_SITE.Common.cygwin-x86 +# Sites may override these definitions in CONFIG_SITE.Common.win32-x86-cygwin #------------------------------------------------------- # Include definitions common to all Unix targets diff --git a/configure/os/CONFIG.solaris-sparc64.Common b/configure/os/CONFIG.solaris-sparc64.Common index b153adcf0..e62d51750 100644 --- a/configure/os/CONFIG.solaris-sparc64.Common +++ b/configure/os/CONFIG.solaris-sparc64.Common @@ -3,7 +3,7 @@ # $Revision-Id$ # This file is maintained by the build community. # -# Definitions for solaris-sparc Sun compiler host builds +# Definitions for solaris-sparc64 Sun compiler host builds # Sites may override these definitions in CONFIG_SITE.solaris-sparc64.Common #------------------------------------------------------- diff --git a/configure/os/CONFIG.solaris-sparc64.solaris-sparc64 b/configure/os/CONFIG.solaris-sparc64.solaris-sparc64 index fd44a4f84..451ecde08 100644 --- a/configure/os/CONFIG.solaris-sparc64.solaris-sparc64 +++ b/configure/os/CONFIG.solaris-sparc64.solaris-sparc64 @@ -3,7 +3,7 @@ # $Revision-Id$ # This file is maintained by the build community. # -# Definitions for solaris-sparc Sun compiler host - solaris-sparc Sun compiler target builds +# Definitions for solaris-sparc64 compiler host - solaris-sparc64 compiler target builds # Sites may override these definitions in CONFIG_SITE.solaris-sparc64.solaris-sparc64 #------------------------------------------------------- diff --git a/configure/os/CONFIG.solarisCommon.solarisCommon b/configure/os/CONFIG.solarisCommon.solarisCommon index 027124654..21c90f32c 100644 --- a/configure/os/CONFIG.solarisCommon.solarisCommon +++ b/configure/os/CONFIG.solarisCommon.solarisCommon @@ -3,8 +3,8 @@ # $Revision-Id$ # This file is maintained by the build community. # -# Definitions for solaris-sparc host - solaris-sparc target build -# Sites may override these definitions in CONFIG_SITE.solaris-sparc.solaris-sparc +# Definitions for solaris host - solaris target build +# Sites may override these definitions in CONFIG_SITE.solarisCommon.solarisCommon #------------------------------------------------------- GNU = NO diff --git a/configure/os/CONFIG.win32-x86-mingw.Common b/configure/os/CONFIG.win32-x86-mingw.Common index 40310fddb..e8698832c 100644 --- a/configure/os/CONFIG.win32-x86-mingw.Common +++ b/configure/os/CONFIG.win32-x86-mingw.Common @@ -4,7 +4,7 @@ # This file is maintained by the build community. # # Definitions for win32-x86-cygwin host archs -# Sites may override these definitions in CONFIG_SITE.win32-x86-cygwin.Common +# Sites may override these definitions in CONFIG_SITE.win32-x86-mingw.Common #------------------------------------------------------- #Include definitions common to unix hosts diff --git a/configure/os/CONFIG.win32-x86.windows-x64 b/configure/os/CONFIG.win32-x86.windows-x64 index 8c51ef704..ff12735f9 100644 --- a/configure/os/CONFIG.win32-x86.windows-x64 +++ b/configure/os/CONFIG.win32-x86.windows-x64 @@ -13,7 +13,7 @@ ARCH_DEP_CPPFLAGS += /favor:blend #ARCH_DEP_CPPFLAGS += /Wp64 -# /favor:blend both AMD64 and INTEL64 +# /favor:blend both AMD64 and INTEL64 This is the default # /favor:AMD64 # /favor:INTEL64 (new value) # /favor:EN64T (old value) diff --git a/configure/os/CONFIG_SITE.Common.win32-x86-cygwin b/configure/os/CONFIG_SITE.Common.win32-x86-cygwin index 206ab48c7..766a5dc31 100644 --- a/configure/os/CONFIG_SITE.Common.win32-x86-cygwin +++ b/configure/os/CONFIG_SITE.Common.win32-x86-cygwin @@ -2,6 +2,6 @@ # # $Revision-Id$ # -# Site Specific definitions for cygwin-x86 target +# Site Specific definitions for win32-x86-cygwin target # Only the local epics system manager should modify this file From 2378d465d11128bc7ff1695210b17525e6c50025 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 27 Feb 2015 16:07:07 -0600 Subject: [PATCH 46/75] Update supported targets lists in CONFIG_SITE --- configure/CONFIG_SITE | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/configure/CONFIG_SITE b/configure/CONFIG_SITE index 22f9cef1f..3063a993f 100644 --- a/configure/CONFIG_SITE +++ b/configure/CONFIG_SITE @@ -25,6 +25,7 @@ # darwin-x86 (Intel based Apple running OSX) # freebsd-x86 (GNU compiler used for host builds) # freebsd-x86_64 (GNU compiler used for host builds) +# linux-arm (GNU compiler used for host builds) # linux-ppc (GNU compiler used for host builds) # linux-ppc64 (GNU compiler used for host builds) # linux-x86 (GNU compiler used for host builds) @@ -41,10 +42,13 @@ # win32-x86 (MS Visual C++ compiler used for host builds) # win32-x86-cygwin (WIN32 API with cygwin GNU compiler used for host builds) # win32-x86-mingw (MinGW compiler used for host builds) +# win32-x86-static (MS Visual C++ compiler used for host builds) # windows-x64 (MS Visual C++ compiler used for host builds) # windows-x64-mingw (MinGW compiler used for host builds) +# windows-x64-static (MS Visual C++ compiler used for host builds) -# Debugging builds +# Debugging builds: +# linux-arm-debug (GNU compiler used for host builds) # linux-x86-debug (GNU compiler with -g option for host builds) # linux-x86_64-debug (GNU compiler with -g option for host builds) # solaris-sparc-debug (sun compiler no optimization,-g for debugging info) @@ -61,13 +65,13 @@ # # Currently Supporting: -# ios-arm -# ios-386 +# ios-arm (darwin-x86 host) +# ios-386 (darwin-x86 host) # linux-386 (linux-x86 host) # linux-486 (linux-x86 host) # linux-586 (linux-x86 host) # linux-686 (linux-x86 host) -# linux-arm (linux-x86 host) +# linux-arm (linux-x86 or -x86_64 host) # linux-arm_eb (linux-x86 host) # linux-arm_el (linux-x86 host) # linux-athlon (linux-x86 host) @@ -102,6 +106,7 @@ # RTEMS-pc386 # RTEMS-psim # RTEMS-uC5282 +# win32-x86-mingw (linux-x86 or -x86_64 host) # # Definitions of CROSS_COMPILER_TARGET_ARCHS in From b3bfac3f16c320d9c5f56f54b048606872d0a8fd Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:10 -0500 Subject: [PATCH 47/75] add EPICS_ALWAYS_INLINE --- .../osi/compiler/clang/compilerSpecific.h | 6 +++ .../osi/compiler/default/compilerSpecific.h | 8 ++++ .../osi/compiler/gcc/compilerSpecific.h | 6 +++ .../osi/compiler/msvc/compilerSpecific.h | 6 +++ .../osi/compiler/solStudio/compilerSpecific.h | 43 +++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 src/libCom/osi/compiler/solStudio/compilerSpecific.h diff --git a/src/libCom/osi/compiler/clang/compilerSpecific.h b/src/libCom/osi/compiler/clang/compilerSpecific.h index 482ee513e..9871fcf7d 100644 --- a/src/libCom/osi/compiler/clang/compilerSpecific.h +++ b/src/libCom/osi/compiler/clang/compilerSpecific.h @@ -20,6 +20,12 @@ # error compiler/clang/compilerSpecific.h is only for use with the clang compiler #endif +#if __has_attribute(always_inline) +#define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline)) +#else +#define EPICS_ALWAYS_INLINE __inline__ +#endif + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compiler/default/compilerSpecific.h b/src/libCom/osi/compiler/default/compilerSpecific.h index f2a3f8c36..8af1727c5 100644 --- a/src/libCom/osi/compiler/default/compilerSpecific.h +++ b/src/libCom/osi/compiler/default/compilerSpecific.h @@ -15,6 +15,14 @@ #ifndef compilerSpecific_h #define compilerSpecific_h + +/* The 'inline' key work, possibily with compiler + * dependent flags to force inlineing where it would + * otherwise not be done. + * + * Warning: Second guessing the compiler may result in larger code size + */ +#define EPICS_ALWAYS_INLINE inline #ifdef __cplusplus diff --git a/src/libCom/osi/compiler/gcc/compilerSpecific.h b/src/libCom/osi/compiler/gcc/compilerSpecific.h index 6696c7a89..ca46a9348 100644 --- a/src/libCom/osi/compiler/gcc/compilerSpecific.h +++ b/src/libCom/osi/compiler/gcc/compilerSpecific.h @@ -23,6 +23,12 @@ #ifdef __clang__ # error compiler/gcc/compilerSpecific.h is not for use with the clang compiler #endif + +#if __GNUC__ > 2 +# define EPICS_ALWAYS_INLINE __inline__ __attribute__((always_inline)) +#else +# define EPICS_ALWAYS_INLINE __inline__ +#endif #ifdef __cplusplus diff --git a/src/libCom/osi/compiler/msvc/compilerSpecific.h b/src/libCom/osi/compiler/msvc/compilerSpecific.h index 587d534c7..49cf266ae 100644 --- a/src/libCom/osi/compiler/msvc/compilerSpecific.h +++ b/src/libCom/osi/compiler/msvc/compilerSpecific.h @@ -20,6 +20,12 @@ # error compiler/msvc/compilerSpecific.h is only for use with the Microsoft compiler #endif +#if _MSC_VER >= 1200 +#define EPICS_ALWAYS_INLINE __forceinline +#else +#define EPICS_ALWAYS_INLINE __inline +#endif + #ifdef __cplusplus /* diff --git a/src/libCom/osi/compiler/solStudio/compilerSpecific.h b/src/libCom/osi/compiler/solStudio/compilerSpecific.h new file mode 100644 index 000000000..2bdcec64d --- /dev/null +++ b/src/libCom/osi/compiler/solStudio/compilerSpecific.h @@ -0,0 +1,43 @@ +/*************************************************************************\ +* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* Copyright (c) 2002 The Regents of the University of California, as +* Operator of Los Alamos National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* + * Author: + * Jeffrey O. Hill + * johill@lanl.gov + */ + +#ifndef compilerSpecific_h +#define compilerSpecific_h + +#ifndef __SUNPRO_C +# error Not Solaris Studio +#endif + +#if __SUNPRO_C<0x590 +# define EPICS_ALWAYS_INLINE inline +#else +# define EPICS_ALWAYS_INLINE inline __attribute__((always_inline)) +#endif + +#ifdef __cplusplus + +/* + * CXX_PLACEMENT_DELETE - defined if compiler supports placement delete + * CXX_THROW_SPECIFICATION - defined if compiler supports throw specification + * + * (our default guess is that the compiler implements the C++ 97 standard) + */ +#define CXX_THROW_SPECIFICATION +#define CXX_PLACEMENT_DELETE + +#endif /* __cplusplus */ + + +#endif /* ifndef compilerSpecific_h */ From 84e9ff3bc5236c36ed0fa741a67df4d1e595502f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:10 -0500 Subject: [PATCH 48/75] libCom/test: Add epicsInlineTest --- src/libCom/test/Makefile | 8 ++++ src/libCom/test/epicsInlineTest1.c | 64 +++++++++++++++++++++++++++ src/libCom/test/epicsInlineTest2.c | 28 ++++++++++++ src/libCom/test/epicsInlineTest3.cpp | 27 +++++++++++ src/libCom/test/epicsInlineTest4.cpp | 27 +++++++++++ src/libCom/test/epicsRunLibComTests.c | 2 + 6 files changed, 156 insertions(+) create mode 100644 src/libCom/test/epicsInlineTest1.c create mode 100644 src/libCom/test/epicsInlineTest2.c create mode 100644 src/libCom/test/epicsInlineTest3.cpp create mode 100644 src/libCom/test/epicsInlineTest4.cpp diff --git a/src/libCom/test/Makefile b/src/libCom/test/Makefile index 3a3d32a8f..e0c1b064c 100755 --- a/src/libCom/test/Makefile +++ b/src/libCom/test/Makefile @@ -22,6 +22,14 @@ epicsTypesTest_SRCS += epicsTypesTest.cpp testHarness_SRCS += epicsTypesTest.cpp TESTS += epicsTypesTest +TESTPROD_HOST += epicsInlineTest +epicsInlineTest_SRCS += epicsInlineTest1.c +epicsInlineTest_SRCS += epicsInlineTest2.c +epicsInlineTest_SRCS += epicsInlineTest3.cpp +epicsInlineTest_SRCS += epicsInlineTest4.cpp +testHarness_SRCS += $(epicsInlineTest_SRCS) +TESTS += epicsInlineTest + TESTPROD_HOST += epicsCalcTest epicsCalcTest_SRCS += epicsCalcTest.cpp testHarness_SRCS += epicsCalcTest.cpp diff --git a/src/libCom/test/epicsInlineTest1.c b/src/libCom/test/epicsInlineTest1.c new file mode 100644 index 000000000..e377e5f1d --- /dev/null +++ b/src/libCom/test/epicsInlineTest1.c @@ -0,0 +1,64 @@ +/*************************************************************************\ +* Copyright (c) 2015 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* This test checks the variations on inline function defintions. + * + * "static inline int func(void) {...}" + * + * Consistent meaning in C89, C99, and C++ (98 and 11). + * If not inline'd results in a private symbol in each compilation unit. + * Thus the non-inline'd version is duplicated in each compilation unit. + * However, definitions in different compilation units may be different. + * + * "inline int func(void) {...}" + * Warning: Not consistent, avoid use in headers meant for C or C++ + * + * In C++ this may be safely defined in more than one compilation unit. + * Where not inlined it will result in a weak public symbol. + * Thus non-inline'd version isn't duplicated, but must be the same + * in all compilation units. + * + */ + +#include "compilerSpecific.h" +#include "epicsUnitTest.h" + +#include "testMain.h" + +static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void) +{ + return 1; +} + +/* Fails to link in C99 +inline int epicsInlineTestFn2(void) +{ + return 42; +} +*/ + +void epicsInlineTest1(void) +{ + testDiag("epicsInlineTest1()"); + testOk1(epicsInlineTestFn1()==1); + /*testOk1(epicsInlineTestFn2()==42);*/ +} + +void epicsInlineTest2(void); +void epicsInlineTest3(void); +void epicsInlineTest4(void); + +MAIN(epicsInlineTest) +{ + testPlan(6); + testDiag("Test variation on inline int func()"); + epicsInlineTest1(); + epicsInlineTest2(); + epicsInlineTest3(); + epicsInlineTest4(); + return testDone(); +} diff --git a/src/libCom/test/epicsInlineTest2.c b/src/libCom/test/epicsInlineTest2.c new file mode 100644 index 000000000..b787276fb --- /dev/null +++ b/src/libCom/test/epicsInlineTest2.c @@ -0,0 +1,28 @@ +/*************************************************************************\ +* Copyright (c) 2015 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "compilerSpecific.h" +#include "epicsUnitTest.h" + +static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void) +{ + return 2; +} + +/* Fails to link in C99 +inline int epicsInlineTestFn2(void) +{ + return 42; +} +*/ + +void epicsInlineTest2(void) +{ + testDiag("epicsInlineTest2()"); + testOk1(epicsInlineTestFn1()==2); + /*testOk1(epicsInlineTestFn2()==42);*/ +} diff --git a/src/libCom/test/epicsInlineTest3.cpp b/src/libCom/test/epicsInlineTest3.cpp new file mode 100644 index 000000000..9647be6dc --- /dev/null +++ b/src/libCom/test/epicsInlineTest3.cpp @@ -0,0 +1,27 @@ +/*************************************************************************\ +* Copyright (c) 2015 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "compilerSpecific.h" +#include "epicsUnitTest.h" + +static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void) +{ + return 3; +} + +inline int epicsInlineTestFn2(void) +{ + return 42; +} + +extern "C" +void epicsInlineTest3(void) +{ + testDiag("epicsInlineTest3()"); + testOk1(epicsInlineTestFn1()==3); + testOk1(epicsInlineTestFn2()==42); +} diff --git a/src/libCom/test/epicsInlineTest4.cpp b/src/libCom/test/epicsInlineTest4.cpp new file mode 100644 index 000000000..545b45ffd --- /dev/null +++ b/src/libCom/test/epicsInlineTest4.cpp @@ -0,0 +1,27 @@ +/*************************************************************************\ +* Copyright (c) 2015 Brookhaven Science Associates, as Operator of +* Brookhaven National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +#include "compilerSpecific.h" +#include "epicsUnitTest.h" + +static EPICS_ALWAYS_INLINE int epicsInlineTestFn1(void) +{ + return 4; +} + +inline int epicsInlineTestFn2(void) +{ + return 42; +} + +extern "C" +void epicsInlineTest4(void) +{ + testDiag("epicsInlineTest4()"); + testOk1(epicsInlineTestFn1()==4); + testOk1(epicsInlineTestFn2()==42); +} diff --git a/src/libCom/test/epicsRunLibComTests.c b/src/libCom/test/epicsRunLibComTests.c index 5bf6cafd1..fe308b061 100644 --- a/src/libCom/test/epicsRunLibComTests.c +++ b/src/libCom/test/epicsRunLibComTests.c @@ -44,6 +44,7 @@ int epicsThreadTest(void); int epicsTimerTest(void); int epicsTimeTest(void); int epicsTypesTest(void); +int epicsInlineTest(void); int macDefExpandTest(void); int macLibTest(void); int ringBytesTest(void); @@ -92,6 +93,7 @@ void epicsRunLibComTests(void) runTest(epicsThreadPrivateTest); runTest(epicsTimeTest); runTest(epicsTypesTest); + runTest(epicsInlineTest); runTest(macDefExpandTest); runTest(macLibTest); runTest(ringBytesTest); From 0d4519eb541f5717d2774801196856e12aa04342 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:11 -0500 Subject: [PATCH 49/75] epicsAtomic: fix C linkage With gcc -std=gnu99 (present default) functions qualified with plain 'inline' emit strong public symbols (nm says 'T') in every compilation unit the definition appears. This causes linking to fail in all cases where executable are statically linked, and many where dynamic linking is used. --- src/libCom/osi/compiler/clang/epicsAtomicCD.h | 10 -- .../osi/compiler/default/epicsAtomicCD.h | 11 +- src/libCom/osi/compiler/gcc/epicsAtomicCD.h | 10 +- src/libCom/osi/compiler/msvc/epicsAtomicCD.h | 20 +--- .../osi/compiler/solStudio/epicsAtomicCD.h | 10 -- src/libCom/osi/epicsAtomic.h | 101 +++++++----------- src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp | 22 ---- src/libCom/osi/os/default/epicsAtomicOSD.c | 0 src/libCom/osi/os/posix/epicsAtomicOSD.cpp | 27 +---- src/libCom/osi/os/posix/epicsAtomicOSD.h | 17 +++ src/libCom/osi/os/solaris/epicsAtomicOSD.h | 16 +-- src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp | 21 ---- src/libCom/osi/os/vxWorks/epicsAtomicOSD.h | 8 +- 13 files changed, 82 insertions(+), 191 deletions(-) delete mode 100644 src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp create mode 100644 src/libCom/osi/os/default/epicsAtomicOSD.c delete mode 100644 src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp diff --git a/src/libCom/osi/compiler/clang/epicsAtomicCD.h b/src/libCom/osi/compiler/clang/epicsAtomicCD.h index 00fa24e4b..34037869b 100644 --- a/src/libCom/osi/compiler/clang/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/clang/epicsAtomicCD.h @@ -16,16 +16,6 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h -#if defined ( __cplusplus ) -# define EPICS_ATOMIC_INLINE inline -#else -# define EPICS_ATOMIC_INLINE __inline__ -#endif - -/* - * we have an inline keyword so we can proceed - * with an os specific inline instantiation - */ #include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/compiler/default/epicsAtomicCD.h b/src/libCom/osi/compiler/default/epicsAtomicCD.h index 3ca260759..34037869b 100644 --- a/src/libCom/osi/compiler/default/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/default/epicsAtomicCD.h @@ -16,15 +16,6 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h -#if __STDC_VERSION__ >= 199901L || defined ( __cplusplus ) -# define EPICS_ATOMIC_INLINE inline - /* - * We have already defined the public interface in epicsAtomic.h - * so there is nothing more to implement if there isnt an inline - * keyword available. Otherwise, if we have an inline keyword - * we will proceed with an os specific inline implementation. - */ -# include "epicsAtomicOSD.h" -#endif +#include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h index e3989769f..8f7f97d16 100644 --- a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h @@ -20,8 +20,6 @@ # error this header is only for use with the gnu compiler #endif -#define EPICS_ATOMIC_INLINE __inline__ - #define GCC_ATOMIC_CONCAT( A, B ) GCC_ATOMIC_CONCATR(A,B) #define GCC_ATOMIC_CONCATR( A, B ) ( A ## B ) @@ -69,7 +67,7 @@ extern "C" { #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER #define EPICS_ATOMIC_READ_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { __sync_synchronize (); } @@ -77,7 +75,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) { __sync_synchronize (); } @@ -88,7 +86,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER #if GCC_ATOMIC_INTRINSICS_MIN_X86 #define EPICS_ATOMIC_READ_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { asm("mfence;"); } @@ -98,7 +96,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER #if GCC_ATOMIC_INTRINSICS_MIN_X86 #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) { asm("mfence;"); } diff --git a/src/libCom/osi/compiler/msvc/epicsAtomicCD.h b/src/libCom/osi/compiler/msvc/epicsAtomicCD.h index f834f0405..282aa971a 100644 --- a/src/libCom/osi/compiler/msvc/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/msvc/epicsAtomicCD.h @@ -26,16 +26,10 @@ #include -#if _MSC_VER >= 1200 -# define EPICS_ATOMIC_INLINE __forceinline -#else -# define EPICS_ATOMIC_INLINE __inline -#endif - #if defined ( _M_IX86 ) # pragma warning( push ) # pragma warning( disable : 4793 ) - EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier () + EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void) { long fence; __asm { xchg fence, eax } @@ -44,14 +38,14 @@ #elif defined ( _M_X64 ) # define MS_ATOMIC_64 # pragma intrinsic ( __faststorefence ) - EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier () + EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void) { __faststorefence (); } #elif defined ( _M_IA64 ) # define MS_ATOMIC_64 # pragma intrinsic ( __mf ) - EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier () + EPICS_ATOMIC_INLINE void epicsAtomicMemoryBarrier (void) { __mf (); } @@ -88,13 +82,13 @@ extern "C" { #endif /* __cplusplus */ #define EPICS_ATOMIC_READ_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { epicsAtomicMemoryBarrier (); } #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) { epicsAtomicMemoryBarrier (); } @@ -108,10 +102,6 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () #else /* ifdef _MSC_EXTENSIONS */ -#if defined ( __cplusplus ) -# define EPICS_ATOMIC_INLINE inline -#endif - /* * if unavailable as an intrinsic we will try * for os specific inline solution diff --git a/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h b/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h index 60083cf71..34037869b 100644 --- a/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h @@ -16,16 +16,6 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h -#if defined ( __cplusplus ) -# define EPICS_ATOMIC_INLINE inline -#else -# define EPICS_ATOMIC_INLINE __inline -#endif - -/* - * we have an inline keyword so we can proceed - * with an os specific inline instantiation - */ #include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/epicsAtomic.h b/src/libCom/osi/epicsAtomic.h index f3d509f56..f568c9de0 100644 --- a/src/libCom/osi/epicsAtomic.h +++ b/src/libCom/osi/epicsAtomic.h @@ -17,7 +17,9 @@ #include /* define size_t */ -#include "shareLib.h" +#include "compilerSpecific.h" + +#define EPICS_ATOMIC_INLINE EPICS_FUNC_INLINE #ifdef __cplusplus extern "C" { @@ -26,10 +28,10 @@ extern "C" { typedef void * EpicsAtomicPtrT; /* load target into cache */ -epicsShareFunc void epicsAtomicReadMemoryBarrier (); +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void); /* push cache version of target into target */ -epicsShareFunc void epicsAtomicWriteMemoryBarrier (); +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void); /* * lock out other smp processors from accessing the target, @@ -37,8 +39,8 @@ epicsShareFunc void epicsAtomicWriteMemoryBarrier (); * to target, allow other smp processors to access the target, * return new value of target as modified by this operation */ -epicsShareFunc size_t epicsAtomicIncrSizeT ( size_t * pTarget ); -epicsShareFunc int epicsAtomicIncrIntT ( int * pTarget ); +EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT ( size_t * pTarget ); +EPICS_ATOMIC_INLINE int epicsAtomicIncrIntT ( int * pTarget ); /* * lock out other smp processors from accessing the target, @@ -46,8 +48,8 @@ epicsShareFunc int epicsAtomicIncrIntT ( int * pTarget ); * to target, allow out other smp processors to access the target, * return new value of target as modified by this operation */ -epicsShareFunc size_t epicsAtomicDecrSizeT ( size_t * pTarget ); -epicsShareFunc int epicsAtomicDecrIntT ( int * pTarget ); +EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT ( size_t * pTarget ); +EPICS_ATOMIC_INLINE int epicsAtomicDecrIntT ( int * pTarget ); /* * lock out other smp processors from accessing the target, @@ -55,23 +57,23 @@ epicsShareFunc int epicsAtomicDecrIntT ( int * pTarget ); * to target, allow other smp processors to access the target, * return new value of target as modified by this operation */ -epicsShareFunc size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ); -epicsShareFunc size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta ); -epicsShareFunc int epicsAtomicAddIntT ( int * pTarget, int delta ); +EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ); +EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta ); +EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ); /* * set cache version of target, flush cache to target */ -epicsShareFunc void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue ); -epicsShareFunc void epicsAtomicSetIntT ( int * pTarget, int newValue ); -epicsShareFunc void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue ); +EPICS_ATOMIC_INLINE void epicsAtomicSetSizeT ( size_t * pTarget, size_t newValue ); +EPICS_ATOMIC_INLINE void epicsAtomicSetIntT ( int * pTarget, int newValue ); +EPICS_ATOMIC_INLINE void epicsAtomicSetPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT newValue ); /* * fetch target into cache, return new value of target */ -epicsShareFunc size_t epicsAtomicGetSizeT ( const size_t * pTarget ); -epicsShareFunc int epicsAtomicGetIntT ( const int * pTarget ); -epicsShareFunc EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget ); +EPICS_ATOMIC_INLINE size_t epicsAtomicGetSizeT ( const size_t * pTarget ); +EPICS_ATOMIC_INLINE int epicsAtomicGetIntT ( const int * pTarget ); +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTarget ); /* * lock out other smp processors from accessing the target, @@ -80,11 +82,11 @@ epicsShareFunc EpicsAtomicPtrT epicsAtomicGetPtrT ( const EpicsAtomicPtrT * pTar * to access the target, return the original value stored in the * target */ -epicsShareFunc size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, size_t oldVal, size_t newVal ); -epicsShareFunc int epicsAtomicCmpAndSwapIntT ( int * pTarget, +EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ); -epicsShareFunc EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ); @@ -111,119 +113,98 @@ namespace atomic { /* * overloaded c++ interface */ -epicsShareFunc size_t increment ( size_t & v ); -epicsShareFunc int increment ( int & v ); -epicsShareFunc size_t decrement ( size_t & v ); -epicsShareFunc int decrement ( int & v ); -epicsShareFunc size_t add ( size_t & v, size_t delta ); -epicsShareFunc int add ( int & v, int delta ); -epicsShareFunc size_t subtract ( size_t & v, size_t delta ); -epicsShareFunc int subtract ( int & v, int delta ); -epicsShareFunc void set ( size_t & v , size_t newValue ); -epicsShareFunc void set ( int & v, int newValue ); -epicsShareFunc void set ( EpicsAtomicPtrT & v, - EpicsAtomicPtrT newValue ); -epicsShareFunc size_t get ( const size_t & v ); -epicsShareFunc int get ( const int & v ); -epicsShareFunc EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v ); -epicsShareFunc size_t compareAndSwap ( size_t & v, size_t oldVal, - size_t newVal ); -epicsShareFunc int compareAndSwap ( int & v, int oldVal, int newVal ); -epicsShareFunc EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v, - EpicsAtomicPtrT oldVal, - EpicsAtomicPtrT newVal ); /************* incr ***************/ -inline size_t increment ( size_t & v ) +EPICS_ATOMIC_INLINE size_t increment ( size_t & v ) { return epicsAtomicIncrSizeT ( & v ); } -inline int increment ( int & v ) +EPICS_ATOMIC_INLINE int increment ( int & v ) { return epicsAtomicIncrIntT ( & v ); } /************* decr ***************/ -inline size_t decrement ( size_t & v ) +EPICS_ATOMIC_INLINE size_t decrement ( size_t & v ) { return epicsAtomicDecrSizeT ( & v ); } -inline int decrement ( int & v ) +EPICS_ATOMIC_INLINE int decrement ( int & v ) { return epicsAtomicDecrIntT ( & v ); } /************* add ***************/ -inline size_t add ( size_t & v, size_t delta ) +EPICS_ATOMIC_INLINE size_t add ( size_t & v, size_t delta ) { return epicsAtomicAddSizeT ( & v, delta ); } -inline int add ( int & v, int delta ) +EPICS_ATOMIC_INLINE int add ( int & v, int delta ) { return epicsAtomicAddIntT ( & v, delta ); } /************* sub ***************/ -inline size_t subtract ( size_t & v, size_t delta ) +EPICS_ATOMIC_INLINE size_t subtract ( size_t & v, size_t delta ) { return epicsAtomicSubSizeT ( & v, delta ); } -inline int subtract ( int & v, int delta ) +EPICS_ATOMIC_INLINE int subtract ( int & v, int delta ) { return epicsAtomicAddIntT ( & v, -delta ); } /************* set ***************/ -inline void set ( size_t & v , size_t newValue ) +EPICS_ATOMIC_INLINE void set ( size_t & v , size_t newValue ) { epicsAtomicSetSizeT ( & v, newValue ); } -inline void set ( int & v, int newValue ) +EPICS_ATOMIC_INLINE void set ( int & v, int newValue ) { epicsAtomicSetIntT ( & v, newValue ); } -inline void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue ) +EPICS_ATOMIC_INLINE void set ( EpicsAtomicPtrT & v, EpicsAtomicPtrT newValue ) { epicsAtomicSetPtrT ( & v, newValue ); } /************* get ***************/ -inline size_t get ( const size_t & v ) +EPICS_ATOMIC_INLINE size_t get ( const size_t & v ) { return epicsAtomicGetSizeT ( & v ); } -inline int get ( const int & v ) +EPICS_ATOMIC_INLINE int get ( const int & v ) { return epicsAtomicGetIntT ( & v ); } -inline EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v ) +EPICS_ATOMIC_INLINE EpicsAtomicPtrT get ( const EpicsAtomicPtrT & v ) { return epicsAtomicGetPtrT ( & v ); } /************* cas ***************/ -inline size_t compareAndSwap ( size_t & v, - size_t oldVal, size_t newVal ) +EPICS_ATOMIC_INLINE size_t compareAndSwap ( size_t & v, + size_t oldVal, size_t newVal ) { return epicsAtomicCmpAndSwapSizeT ( & v, oldVal, newVal ); } -inline int compareAndSwap ( int & v, int oldVal, int newVal ) +EPICS_ATOMIC_INLINE int compareAndSwap ( int & v, int oldVal, int newVal ) { return epicsAtomicCmpAndSwapIntT ( & v, oldVal, newVal ); } -inline EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v, - EpicsAtomicPtrT oldVal, - EpicsAtomicPtrT newVal ) +EPICS_ATOMIC_INLINE EpicsAtomicPtrT compareAndSwap ( EpicsAtomicPtrT & v, + EpicsAtomicPtrT oldVal, + EpicsAtomicPtrT newVal ) { return epicsAtomicCmpAndSwapPtrT ( & v, oldVal, newVal ); } diff --git a/src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp b/src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp deleted file mode 100644 index e3f684e29..000000000 --- a/src/libCom/osi/os/WIN32/epicsAtomicOSD.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -/*************************************************************************\ -* Copyright (c) 2011 LANS LLC, as Operator of -* Los Alamos National Laboratory. -* EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - */ - -#define epicsExportSharedSymbols -#include "epicsAtomic.h" - -// if the compiler is unable to inline then instantiate out-of-line -#ifndef EPICS_ATOMIC_INLINE -# define EPICS_ATOMIC_INLINE -# include "epicsAtomicOSD.h" -#endif - diff --git a/src/libCom/osi/os/default/epicsAtomicOSD.c b/src/libCom/osi/os/default/epicsAtomicOSD.c new file mode 100644 index 000000000..e69de29bb diff --git a/src/libCom/osi/os/posix/epicsAtomicOSD.cpp b/src/libCom/osi/os/posix/epicsAtomicOSD.cpp index 6e94cbcc4..1cc227fcd 100644 --- a/src/libCom/osi/os/posix/epicsAtomicOSD.cpp +++ b/src/libCom/osi/os/posix/epicsAtomicOSD.cpp @@ -19,14 +19,6 @@ #include "epicsAssert.h" #include "epicsAtomic.h" -// if the compiler is unable to inline then instantiate out-of-line -#ifndef EPICS_ATOMIC_INLINE -# define EPICS_ATOMIC_INLINE -# include "epicsAtomicOSD.h" -#endif - -#ifndef EPICS_ATOMIC_LOCK - /* * Slow, but probably correct on all systems. * Useful only if something more efficient isn`t @@ -69,31 +61,14 @@ void epicsAtomicUnlock ( EpicsAtomicLockKey * ) assert ( status == 0 ); } -#endif // ifndef EPICS_ATOMIC_LOCK -#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER // Slow, but probably correct on all systems. // Useful only if something more efficient isn`t // provided based on knowledge of the compiler // or OS -void epicsAtomicReadMemoryBarrier () +void epicsAtomicMemoryBarrierFallback (void) { EpicsAtomicLockKey key; epicsAtomicLock ( & key ); epicsAtomicUnlock ( & key ); } -#endif - -#ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER -// Slow, but probably correct on all systems. -// Useful only if something more efficient isn`t -// provided based on knowledge of the compiler -// or OS -void epicsAtomicWriteMemoryBarrier () -{ - EpicsAtomicLockKey key; - epicsAtomicLock ( & key ); - epicsAtomicUnlock ( & key ); -} -#endif - diff --git a/src/libCom/osi/os/posix/epicsAtomicOSD.h b/src/libCom/osi/os/posix/epicsAtomicOSD.h index ff972016d..fdc38dfe2 100644 --- a/src/libCom/osi/os/posix/epicsAtomicOSD.h +++ b/src/libCom/osi/os/posix/epicsAtomicOSD.h @@ -16,14 +16,31 @@ #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h +#include + typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) +{ + epicsAtomicMemoryBarrierFallback(); +} +#endif + +#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) +{ + epicsAtomicMemoryBarrierFallback(); +} +#endif + epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); +epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void ); #ifdef __cplusplus } /* end of extern "C" */ diff --git a/src/libCom/osi/os/solaris/epicsAtomicOSD.h b/src/libCom/osi/os/solaris/epicsAtomicOSD.h index 6dbda494d..14a5f1502 100644 --- a/src/libCom/osi/os/solaris/epicsAtomicOSD.h +++ b/src/libCom/osi/os/solaris/epicsAtomicOSD.h @@ -13,6 +13,8 @@ * johill@lanl.gov */ +#include "shareLib.h" + #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h @@ -31,7 +33,7 @@ extern "C" { #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER #define EPICS_ATOMIC_READ_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { membar_consumer (); } @@ -39,7 +41,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) { membar_producer (); } @@ -47,7 +49,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () #ifndef EPICS_ATOMIC_CAS_INTT #define EPICS_ATOMIC_CAS_INTT -EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, +EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, int oldVal, int newVal ) { STATIC_ASSERT ( sizeof ( int ) == sizeof ( unsigned ) ); @@ -59,7 +61,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, #ifndef EPICS_ATOMIC_CAS_SIZET #define EPICS_ATOMIC_CAS_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( +EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( size_t * pTarget, size_t oldVal, size_t newVal ) { @@ -71,7 +73,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicCmpAndSwapSizeT ( #ifndef EPICS_ATOMIC_CAS_PTRT #define EPICS_ATOMIC_CAS_PTRT -EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( +EPICS_ATOMIC_INLINE EpicsAtomicPtrT epicsAtomicCmpAndSwapPtrT ( EpicsAtomicPtrT * pTarget, EpicsAtomicPtrT oldVal, EpicsAtomicPtrT newVal ) @@ -132,7 +134,7 @@ EPICS_ATOMIC_INLINE int epicsAtomicAddIntT ( int * pTarget, int delta ) #ifndef EPICS_ATOMIC_ADD_SIZET #define EPICS_ATOMIC_ADD_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, size_t delta ) { STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) ); @@ -143,7 +145,7 @@ EPICS_ATOMIC_INLINE size_t epicsAtomicAddSizeT ( size_t * pTarget, #ifndef EPICS_ATOMIC_SUB_SIZET #define EPICS_ATOMIC_SUB_SIZET -EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, +EPICS_ATOMIC_INLINE size_t epicsAtomicSubSizeT ( size_t * pTarget, size_t delta ) { STATIC_ASSERT ( sizeof ( ulong_t ) == sizeof ( size_t ) ); diff --git a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp deleted file mode 100644 index 6a9f529a3..000000000 --- a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -/*************************************************************************\ -* Copyright (c) 2011 LANS LLC, as Operator of -* Los Alamos National Laboratory. -* EPICS BASE is distributed subject to a Software License Agreement found -* in file LICENSE that is included with this distribution. -\*************************************************************************/ - -/* - * Author Jeffrey O. Hill - * johill@lanl.gov - */ - -#define epicsExportSharedSymbols -#include "epicsAtomic.h" - -// if the compiler is unable to inline then instantiate out-of-line -#ifndef EPICS_ATOMIC_INLINE -# define EPICS_ATOMIC_INLINE -# include "epicsAtomicOSD.h" -#endif diff --git a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h index 5454e70ba..32a7d5a10 100644 --- a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h +++ b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h @@ -38,7 +38,7 @@ extern "C" { #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER #define EPICS_ATOMIC_READ_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { VX_MEM_BARRIER_R (); } @@ -46,7 +46,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER #define EPICS_ATOMIC_WRITE_MEMORY_BARRIER -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) { VX_MEM_BARRIER_W (); } @@ -232,7 +232,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( EpicsAtomicLockKey * pKey ) * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system * (we are not protecting against multiple access to memory mapped IO) */ -EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () {} +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) {} #endif #ifndef EPICS_ATOMIC_WRITE_MEMORY_BARRIER @@ -241,7 +241,7 @@ EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier () {} * no need for memory barrior since prior to vxWorks 6.6 it is a single cpu system * (we are not protecting against multiple access to memory mapped IO) */ -EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier () {} +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) {} #endif #ifdef __cplusplus From 214c9003a9837e8a1b284273f5c76a404d41563f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:11 -0500 Subject: [PATCH 50/75] epicsAtomicTest: include some information about build conditions Give some idea which implementations are being used --- src/libCom/osi/compiler/clang/epicsAtomicCD.h | 2 + .../osi/compiler/default/epicsAtomicCD.h | 2 + src/libCom/osi/compiler/gcc/epicsAtomicCD.h | 2 + src/libCom/osi/compiler/msvc/epicsAtomicCD.h | 4 + .../osi/compiler/solStudio/epicsAtomicCD.h | 2 + src/libCom/osi/os/WIN32/epicsAtomicOSD.h | 2 + src/libCom/osi/os/posix/epicsAtomicOSD.h | 2 + src/libCom/osi/os/solaris/epicsAtomicOSD.h | 2 + src/libCom/osi/os/vxWorks/epicsAtomicOSD.h | 4 + src/libCom/test/epicsAtomicTest.cpp | 78 +++++++++++++++++++ 10 files changed, 100 insertions(+) diff --git a/src/libCom/osi/compiler/clang/epicsAtomicCD.h b/src/libCom/osi/compiler/clang/epicsAtomicCD.h index 34037869b..763cb0537 100644 --- a/src/libCom/osi/compiler/clang/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/clang/epicsAtomicCD.h @@ -16,6 +16,8 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h +#define EPICS_ATOMIC_CMPLR_NAME "CLANG" + #include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/compiler/default/epicsAtomicCD.h b/src/libCom/osi/compiler/default/epicsAtomicCD.h index 34037869b..585a39c97 100644 --- a/src/libCom/osi/compiler/default/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/default/epicsAtomicCD.h @@ -16,6 +16,8 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h +#define EPICS_ATOMIC_CMPLR_NAME "DEFAULT" + #include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h index 8f7f97d16..15b9a6c9a 100644 --- a/src/libCom/osi/compiler/gcc/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/gcc/epicsAtomicCD.h @@ -20,6 +20,8 @@ # error this header is only for use with the gnu compiler #endif +#define EPICS_ATOMIC_CMPLR_NAME "GCC" + #define GCC_ATOMIC_CONCAT( A, B ) GCC_ATOMIC_CONCATR(A,B) #define GCC_ATOMIC_CONCATR( A, B ) ( A ## B ) diff --git a/src/libCom/osi/compiler/msvc/epicsAtomicCD.h b/src/libCom/osi/compiler/msvc/epicsAtomicCD.h index 282aa971a..e7d1c4b77 100644 --- a/src/libCom/osi/compiler/msvc/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/msvc/epicsAtomicCD.h @@ -24,6 +24,8 @@ #ifdef _MSC_EXTENSIONS +#define EPICS_ATOMIC_CMPLR_NAME "MSVC-INTRINSIC" + #include #if defined ( _M_IX86 ) @@ -102,6 +104,8 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) #else /* ifdef _MSC_EXTENSIONS */ +#define EPICS_ATOMIC_CMPLR_NAME "MSVC-DIRECT" + /* * if unavailable as an intrinsic we will try * for os specific inline solution diff --git a/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h b/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h index 34037869b..8a733a558 100644 --- a/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h +++ b/src/libCom/osi/compiler/solStudio/epicsAtomicCD.h @@ -16,6 +16,8 @@ #ifndef epicsAtomicCD_h #define epicsAtomicCD_h +#define EPICS_ATOMIC_CMPLR_NAME "SOLSTUDIO" + #include "epicsAtomicOSD.h" #endif /* epicsAtomicCD_h */ diff --git a/src/libCom/osi/os/WIN32/epicsAtomicOSD.h b/src/libCom/osi/os/WIN32/epicsAtomicOSD.h index da5e49c86..2170fceff 100644 --- a/src/libCom/osi/os/WIN32/epicsAtomicOSD.h +++ b/src/libCom/osi/os/WIN32/epicsAtomicOSD.h @@ -16,6 +16,8 @@ #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h +#define EPICS_ATOMIC_OS_NAME "WIN32" + #ifdef VC_EXTRALEAN # define VC_EXTRALEAN_DETECTED_epicsAtomicOSD_h #else diff --git a/src/libCom/osi/os/posix/epicsAtomicOSD.h b/src/libCom/osi/os/posix/epicsAtomicOSD.h index fdc38dfe2..9dad0e204 100644 --- a/src/libCom/osi/os/posix/epicsAtomicOSD.h +++ b/src/libCom/osi/os/posix/epicsAtomicOSD.h @@ -18,6 +18,8 @@ #include +#define EPICS_ATOMIC_OS_NAME "POSIX" + typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey; #ifdef __cplusplus diff --git a/src/libCom/osi/os/solaris/epicsAtomicOSD.h b/src/libCom/osi/os/solaris/epicsAtomicOSD.h index 14a5f1502..1fa23bd88 100644 --- a/src/libCom/osi/os/solaris/epicsAtomicOSD.h +++ b/src/libCom/osi/os/solaris/epicsAtomicOSD.h @@ -18,6 +18,8 @@ #ifndef epicsAtomicOSD_h #define epicsAtomicOSD_h +#define EPICS_ATOMIC_OS_NAME "Solaris" + #if defined ( __SunOS_5_10 ) /* diff --git a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h index 32a7d5a10..e7bdde0c3 100644 --- a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h +++ b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.h @@ -32,6 +32,8 @@ #include #include +#define EPICS_ATOMIC_OS_NAME "VX-ATOMICLIB" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -206,6 +208,8 @@ EPICS_ATOMIC_INLINE int epicsAtomicCmpAndSwapIntT ( int * pTarget, #include "vxLib.h" #include "intLib.h" +#define EPICS_ATOMIC_OS_NAME "VX-INTLIB" + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/src/libCom/test/epicsAtomicTest.cpp b/src/libCom/test/epicsAtomicTest.cpp index 78cfa5b95..21d56eec7 100644 --- a/src/libCom/test/epicsAtomicTest.cpp +++ b/src/libCom/test/epicsAtomicTest.cpp @@ -248,11 +248,89 @@ template void testCAS < EpicsAtomicPtrT > (void); # pragma warning ( pop ) #endif +static void testClassify() +{ + testDiag("Classify Build conditions"); +#ifdef EPICS_ATOMIC_CMPLR_NAME + testDiag("Compiler dependent impl name %s", EPICS_ATOMIC_CMPLR_NAME); +#else + testDiag("Compiler dependent impl name undefined"); +#endif +#ifdef EPICS_ATOMIC_CMPLR_NAME + testDiag("OS dependent impl name %s", EPICS_ATOMIC_OS_NAME); +#else + testDiag("OS dependent impl name undefined"); +#endif + +#ifdef __GNUC__ +#if GCC_ATOMIC_INTRINSICS_GCC4_OR_BETTER + testDiag("GCC using atomic builtin memory barrier"); +#else + testDiag("GCC using asm memory barrier"); +#endif +#if GCC_ATOMIC_INTRINSICS_AVAIL_INT_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER + testDiag("GCC use builtin for int"); +#endif +#if GCC_ATOMIC_INTRINSICS_AVAIL_SIZE_T || GCC_ATOMIC_INTRINSICS_AVAIL_EARLIER + testDiag("GCC use builtin for size_t"); +#endif + +#ifndef EPICS_ATOMIC_INCR_INTT + testDiag("Use default epicsAtomicIncrIntT()"); +#endif +#ifndef EPICS_ATOMIC_INCR_SIZET + testDiag("Use default epicsAtomicIncrSizeT()"); +#endif +#ifndef EPICS_ATOMIC_DECR_INTT + testDiag("Use default epicsAtomicDecrIntT()"); +#endif +#ifndef EPICS_ATOMIC_DECR_SIZET + testDiag("Use default epicsAtomicDecrSizeT()"); +#endif +#ifndef EPICS_ATOMIC_ADD_INTT + testDiag("Use default epicsAtomicAddIntT()"); +#endif +#ifndef EPICS_ATOMIC_ADD_SIZET + testDiag("Use default epicsAtomicAddSizeT()"); +#endif +#ifndef EPICS_ATOMIC_SUB_SIZET + testDiag("Use default epicsAtomicSubSizeT()"); +#endif +#ifndef EPICS_ATOMIC_SET_INTT + testDiag("Use default epicsAtomicSetIntT()"); +#endif +#ifndef EPICS_ATOMIC_SET_SIZET + testDiag("Use default epicsAtomicSetSizeT()"); +#endif +#ifndef EPICS_ATOMIC_SET_PTRT + testDiag("Use default epicsAtomicSetPtrT()"); +#endif +#ifndef EPICS_ATOMIC_GET_INTT + testDiag("Use default epicsAtomicGetIntT()"); +#endif +#ifndef EPICS_ATOMIC_GET_SIZET + testDiag("Use default epicsAtomicGetSizeT()"); +#endif +#ifndef EPICS_ATOMIC_GET_PTRT + testDiag("Use default epicsAtomicGetPtrT()"); +#endif +#ifndef EPICS_ATOMIC_CAS_INTT + testDiag("Use default epicsAtomicCmpAndSwapIntT()"); +#endif +#ifndef EPICS_ATOMIC_CAS_SIZET + testDiag("Use default epicsAtomicCmpAndSwapSizeT()"); +#endif +#ifndef EPICS_ATOMIC_CAS_PTRT + testDiag("Use default epicsAtomicCmpAndSwapPtrT()"); +#endif +#endif /* __GNUC__ */ +} MAIN ( epicsAtomicTest ) { testPlan ( 31 ); + testClassify (); testIncrDecr < int > (); testIncrDecr < size_t > (); From 332fd550adf945f1146a27312caed3ec7fe2f847 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:11 -0500 Subject: [PATCH 51/75] epicsAtomic: RTEMS ISR safe impl. for epicsAtomicLock() --- src/libCom/osi/epicsAtomic.h | 2 +- src/libCom/osi/os/RTEMS/epicsAtomicOSD.h | 65 ++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 src/libCom/osi/os/RTEMS/epicsAtomicOSD.h diff --git a/src/libCom/osi/epicsAtomic.h b/src/libCom/osi/epicsAtomic.h index f568c9de0..b3aad5c9c 100644 --- a/src/libCom/osi/epicsAtomic.h +++ b/src/libCom/osi/epicsAtomic.h @@ -19,7 +19,7 @@ #include "compilerSpecific.h" -#define EPICS_ATOMIC_INLINE EPICS_FUNC_INLINE +#define EPICS_ATOMIC_INLINE static EPICS_ALWAYS_INLINE #ifdef __cplusplus extern "C" { diff --git a/src/libCom/osi/os/RTEMS/epicsAtomicOSD.h b/src/libCom/osi/os/RTEMS/epicsAtomicOSD.h new file mode 100644 index 000000000..fefd2015e --- /dev/null +++ b/src/libCom/osi/os/RTEMS/epicsAtomicOSD.h @@ -0,0 +1,65 @@ + +/*************************************************************************\ +* Copyright (c) 2011 LANS LLC, as Operator of +* Los Alamos National Laboratory. +* Copyright (c) 2011 UChicago Argonne LLC, as Operator of Argonne +* National Laboratory. +* EPICS BASE is distributed subject to a Software License Agreement found +* in file LICENSE that is included with this distribution. +\*************************************************************************/ + +/* + * Author Jeffrey O. Hill + * johill@lanl.gov + */ + +#ifndef epicsAtomicOSD_h +#define epicsAtomicOSD_h + +#include +#include "epicsMMIO.h" +#include "compilerSpecific.h" +#include "epicsInterrupt.h" + +#define EPICS_ATOMIC_OS_NAME "RTEMS" + +typedef struct EpicsAtomicLockKey { + int key; +} EpicsAtomicLockKey; + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) +{ + epicsAtomicMemoryBarrierFallback(); +} +#endif + +#ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER +EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) +{ + rwbarr(); +} +#endif + +EPICS_ATOMIC_INLINE void epicsAtomicLock ( struct EpicsAtomicLockKey * pkey ) +{ + pkey->key = epicsInterruptLock(); +} + +EPICS_ATOMIC_INLINE void epicsAtomicUnlock ( struct EpicsAtomicLockKey * pkey ) +{ + epicsInterruptUnlock(pkey->key); +} + +#ifdef __cplusplus +} /* end of extern "C" */ +#endif /* __cplusplus */ + +#include "epicsAtomicDefault.h" + +#endif /* epicsAtomicOSD_h */ + From 73dcc2745ffaec7ce9ec51c470bafe2973dde728 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:11 -0500 Subject: [PATCH 52/75] Fix for Solaris C++ compiler --- src/libCom/osi/compiler/solStudio/compilerSpecific.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libCom/osi/compiler/solStudio/compilerSpecific.h b/src/libCom/osi/compiler/solStudio/compilerSpecific.h index 2bdcec64d..a9d59a5bf 100644 --- a/src/libCom/osi/compiler/solStudio/compilerSpecific.h +++ b/src/libCom/osi/compiler/solStudio/compilerSpecific.h @@ -16,11 +16,12 @@ #ifndef compilerSpecific_h #define compilerSpecific_h -#ifndef __SUNPRO_C +#if !defined(__SUNPRO_C) && !defined (__SUNPRO_CC) # error Not Solaris Studio #endif -#if __SUNPRO_C<0x590 +#if (defined(__SUNPRO_C) && __SUNPRO_C < 0x590) || \ + (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) # define EPICS_ALWAYS_INLINE inline #else # define EPICS_ALWAYS_INLINE inline __attribute__((always_inline)) From 89596fc30853d39e6d1871d67e72356ef6b92da5 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 27 Feb 2015 17:29:11 -0500 Subject: [PATCH 53/75] Fix typo in epicsAtomicTest.cpp testClassify() --- src/libCom/test/epicsAtomicTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/test/epicsAtomicTest.cpp b/src/libCom/test/epicsAtomicTest.cpp index 21d56eec7..1c4dcf20f 100644 --- a/src/libCom/test/epicsAtomicTest.cpp +++ b/src/libCom/test/epicsAtomicTest.cpp @@ -256,7 +256,7 @@ static void testClassify() #else testDiag("Compiler dependent impl name undefined"); #endif -#ifdef EPICS_ATOMIC_CMPLR_NAME +#ifdef EPICS_ATOMIC_OS_NAME testDiag("OS dependent impl name %s", EPICS_ATOMIC_OS_NAME); #else testDiag("OS dependent impl name undefined"); From fb1a0c2b1e3db8d956f47de11fd37dd1cbc26105 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 28 Feb 2015 20:20:56 -0600 Subject: [PATCH 54/75] Clean up g++ warnings in repeater.cpp --- src/ca/repeater.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ca/repeater.cpp b/src/ca/repeater.cpp index 847431d34..5e123ee2d 100644 --- a/src/ca/repeater.cpp +++ b/src/ca/repeater.cpp @@ -89,14 +89,10 @@ static const unsigned short PORT_ANY = 0u; */ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) { - int status; - union { - struct sockaddr_in ia; - struct sockaddr sa; - } bd; - SOCKET sock = epicsSocketCreate ( AF_INET, SOCK_DGRAM, 0 ); + if ( sock == INVALID_SOCKET ) { + *pSock = sock; return SOCKERRNO; } @@ -104,6 +100,11 @@ static int makeSocket ( unsigned short port, bool reuseAddr, SOCKET * pSock ) * no need to bind if unconstrained */ if ( port != PORT_ANY ) { + int status; + union { + struct sockaddr_in ia; + struct sockaddr sa; + } bd; memset ( (char *) &bd, 0, sizeof (bd) ); bd.ia.sin_family = AF_INET; From d432fb31158b09aede6e4fca6d96dec0a01dd181 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 2 Mar 2015 14:22:25 -0600 Subject: [PATCH 55/75] Fix Darwin build --- src/libCom/osi/os/posix/osdThread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/osi/os/posix/osdThread.c b/src/libCom/osi/os/posix/osdThread.c index 8e0b30472..632b545f9 100644 --- a/src/libCom/osi/os/posix/osdThread.c +++ b/src/libCom/osi/os/posix/osdThread.c @@ -634,7 +634,7 @@ epicsShareFunc void epicsShareAPI epicsThreadSetPriority(epicsThreadId pthreadIn pthreadInfo->osiPriority = priority; if(!pthreadInfo->isRealTimeScheduled) return; -#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) +#if defined (_POSIX_THREAD_PRIORITY_SCHEDULING) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0 if(!pcommonAttr->usePolicy) return; pthreadInfo->schedParam.sched_priority = epicsThreadGetPosixPriority(pthreadInfo); status = pthread_attr_setschedparam( From 61438b4e7e750137a314551216e5fcc36d398c36 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 2 Mar 2015 15:04:09 -0600 Subject: [PATCH 56/75] Fix Windows builds --- src/ioc/db/test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ioc/db/test/Makefile b/src/ioc/db/test/Makefile index ef0927c26..c16016378 100644 --- a/src/ioc/db/test/Makefile +++ b/src/ioc/db/test/Makefile @@ -14,7 +14,7 @@ TESTLIBRARY = dbTestIoc dbTestIoc_SRCS += xRecord.c dbTestIoc_SRCS += dbLinkdset.c -dbTestIoc_LIBS = dbCore +dbTestIoc_LIBS = dbCore ca Com TARGETS += $(COMMON_DIR)/dbTestIoc.dbd dbTestIoc_DBD += menuGlobal.dbd From bc52c8e374018f9be84448fb4ece44f588aed1b9 Mon Sep 17 00:00:00 2001 From: Benjamin Franksen Date: Tue, 3 Mar 2015 11:45:23 -0600 Subject: [PATCH 57/75] Fixed RELEASE_PERL_MODULE_DIRS --- configure/CONFIG_APP_INCLUDE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_APP_INCLUDE b/configure/CONFIG_APP_INCLUDE index 6b6786169..14113c951 100644 --- a/configure/CONFIG_APP_INCLUDE +++ b/configure/CONFIG_APP_INCLUDE @@ -16,7 +16,7 @@ define RELEASE_FLAGS_template RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include)) RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd) RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db) - RELEASE_PERL_MODULE_DIRS += $$(wildcard $$($(1)_LIB)/perl) + RELEASE_PERL_MODULE_DIRS += $$(wildcard $$(strip $$($(1)))/lib/perl) endef $(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) )) From 5f638805ddfccdff76810f2b5ebef50e244e665b Mon Sep 17 00:00:00 2001 From: Benjamin Franksen Date: Tue, 3 Mar 2015 11:47:37 -0600 Subject: [PATCH 58/75] Improved "Installing ..." messages in RULES.Db --- configure/RULES.Db | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure/RULES.Db b/configure/RULES.Db index f0a4f6868..11e4d40a6 100644 --- a/configure/RULES.Db +++ b/configure/RULES.Db @@ -199,7 +199,7 @@ $(COMMON_DIR)/%.substitutions: endif $(INSTALL_DB)/%.substitutions: %.substitutions - $(ECHO) "Installing db file $@" + $(ECHO) "Installing substitution file $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) .PRECIOUS: $(COMMON_DIR)/%.substitutions @@ -213,7 +213,7 @@ $(COMMON_DIR)/%.template: $(COMMON_DIR)/%.edf @$(RM) $@.VAR $(INSTALL_DB)/%.template: %.template - $(ECHO) "Installing db file $@" + $(ECHO) "Installing template file $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) .PRECIOUS: $(COMMON_DIR)/%.template @@ -351,7 +351,7 @@ $(COMMON_DIR)/%.db: $(COMMON_DIR)/%.db$(RAW) else $(INSTALL_DB)/%: % - $(ECHO) "Installing db file $@" + $(ECHO) "Installing $@" @$(INSTALL) -d -m $(INSTALL_PERMISSIONS) $< $(@D) endif From d26654674c7b131bfb4388586e23fe0a089d1260 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 3 Mar 2015 11:53:23 -0600 Subject: [PATCH 59/75] Fix the RTEMS override of the ECHO variable --- configure/os/CONFIG.Common.RTEMS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure/os/CONFIG.Common.RTEMS b/configure/os/CONFIG.Common.RTEMS index 2e3b73ac8..9e6a1ad41 100644 --- a/configure/os/CONFIG.Common.RTEMS +++ b/configure/os/CONFIG.Common.RTEMS @@ -73,6 +73,8 @@ CPPFLAGS += $($(BUILD_CLASS)_CPPFLAGS) $(POSIX_CPPFLAGS) $(OPT_CPPFLAGS)\ $(USR_CPPFLAGS) $(CMD_CPPFLAGS) $(ARCH_DEP_CPPFLAGS) $(OP_SYS_CPPFLAGS)\ $(OP_SYS_INCLUDE_CPPFLAGS) $(CODE_CPPFLAGS) +ECHO = @$(if $(findstring s,$(patsubst T_A=%,,$(MAKEFLAGS))),$(NOP),echo) + #-------------------------------------------------- # Although RTEMS uses gcc, it wants to use gcc its own way CROSS_CPPFLAGS = From 20155602fc226650fef4f56424884c163cc8b046 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Thu, 5 Mar 2015 14:50:42 -0600 Subject: [PATCH 60/75] Renamed the record test harness routine Now named epicsRunRecordTests and as such it matches the other test harness routines. --- src/std/rec/test/Makefile | 8 ++++---- .../rec/test/{epicsRunTests.c => epicsRunRecordTests.c} | 2 +- src/std/rec/test/rtemsTestHarness.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/std/rec/test/{epicsRunTests.c => epicsRunRecordTests.c} (95%) diff --git a/src/std/rec/test/Makefile b/src/std/rec/test/Makefile index fcdb0ac7f..db2c099ff 100644 --- a/src/std/rec/test/Makefile +++ b/src/std/rec/test/Makefile @@ -35,8 +35,8 @@ testHarness_SRCS += analogMonitorTest_registerRecordDeviceDriver.cpp TESTFILES += $(COMMON_DIR)/analogMonitorTest.dbd ../analogMonitorTest.db TESTS += analogMonitorTest -# epicsRunTests runs all the test programs in a known working order. -testHarness_SRCS += epicsRunTests.c +# epicsRunRecordTests runs all the test programs in a known working order. +testHarness_SRCS += epicsRunRecordTests.c recordTestHarness_SRCS += $(testHarness_SRCS) recordTestHarness_SRCS_RTEMS += rtemsTestHarness.c @@ -44,8 +44,8 @@ recordTestHarness_SRCS_RTEMS += rtemsTestHarness.c PROD_vxWorks = recordTestHarness PROD_RTEMS = recordTestHarness -TESTSPEC_vxWorks = recordTestHarness.munch; epicsRunTests -TESTSPEC_RTEMS = recordTestHarness.boot; epicsRunTests +TESTSPEC_vxWorks = recordTestHarness.munch; epicsRunRecordTests +TESTSPEC_RTEMS = recordTestHarness.boot; epicsRunRecordTests TESTSCRIPTS_HOST += $(TESTS:%=%.t) diff --git a/src/std/rec/test/epicsRunTests.c b/src/std/rec/test/epicsRunRecordTests.c similarity index 95% rename from src/std/rec/test/epicsRunTests.c rename to src/std/rec/test/epicsRunRecordTests.c index 2c2e9c70a..092c0a6ce 100644 --- a/src/std/rec/test/epicsRunTests.c +++ b/src/std/rec/test/epicsRunRecordTests.c @@ -15,7 +15,7 @@ int analogMonitorTest(void); int arrayOpTest(void); -void epicsRunTests(void) +void epicsRunRecordTests(void) { testHarness(); diff --git a/src/std/rec/test/rtemsTestHarness.c b/src/std/rec/test/rtemsTestHarness.c index dd25941ef..772d5394e 100644 --- a/src/std/rec/test/rtemsTestHarness.c +++ b/src/std/rec/test/rtemsTestHarness.c @@ -5,10 +5,10 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -extern void epicsRunTests(void); +extern void epicsRunRecordTests(void); int main(int argc, char **argv) { - epicsRunTests(); /* calls epicsExit(0) */ + epicsRunRecordTests(); /* calls epicsExit(0) */ return 0; } From 5610b0706867745df043b9cb93b029371889cd55 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2015 17:43:26 -0600 Subject: [PATCH 61/75] configure: Support for cfg/TOP_RULES* and cfg/DIR_RULES* Idea and initial implementation from Benjamin Franksen, I added the DIR_RULES and ACTIONS support. Reverses the order in which cfg/CONFIG* files are included. --- configure/CONFIG | 8 ++++++-- configure/CONFIG_APP_INCLUDE | 3 --- configure/RULES_ARCHS | 13 +++++++++++++ configure/RULES_DIRS | 13 +++++++++++++ configure/RULES_FILE_TYPE | 17 +++++++++++------ configure/RULES_TOP | 7 +++++++ documentation/RELEASE_NOTES.html | 25 +++++++++++++++++++++++++ 7 files changed, 75 insertions(+), 11 deletions(-) diff --git a/configure/CONFIG b/configure/CONFIG index 4f20c7d52..637afa3b4 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -58,6 +58,10 @@ include $(CONFIG)/CONFIG_BASE_VERSION include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common -include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common +RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops) +RELEASE_TOPS_REVERSE := $(shell \ + $(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS)) + ifdef T_A # Cross compile specific definitions @@ -88,8 +92,8 @@ endif # Include /cfg/CONFIG* definitions from tops defined in RELEASE* files # ifneq ($(CONFIG),$(TOP)/configure) -RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops) -RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/CONFIG*)) +RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS_REVERSE), \ + $(wildcard $($(top))/cfg/CONFIG*)) ifneq ($(RELEASE_CFG_CONFIGS),) include $(RELEASE_CFG_CONFIGS) endif diff --git a/configure/CONFIG_APP_INCLUDE b/configure/CONFIG_APP_INCLUDE index 14113c951..9c23ec6a4 100644 --- a/configure/CONFIG_APP_INCLUDE +++ b/configure/CONFIG_APP_INCLUDE @@ -1,7 +1,4 @@ export TOP -export IOCAPPS - -RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops) ifneq ($(RELEASE_TOPS),) diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 1d4c2d4c1..6dfe4c92e 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -30,6 +30,15 @@ cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch)) buildDirs = $(addprefix O.,$(BUILD_ARCHS)) +# Include /cfg/DIR_RULES* files from tops defined in RELEASE* files +# Do this here so they can add ACTIONS +# +RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \ + $(wildcard $($(top))/cfg/DIR_RULES*)) +ifneq ($(RELEASE_CFG_DIR_RULES),) + include $(RELEASE_CFG_DIR_RULES) +endif + #************************************************************************* # Create epics_host_arch dependancies for GNU make -j option # Only works with GNU make 3.81 or later (uses eval function) @@ -92,3 +101,7 @@ realclean :: .PHONY : $(cleanArchTargets) .PHONY : $(BUILD_ARCHS) rebuild .PHONY : $(ACTIONS) clean realclean archclean all + +# User specific rules +# +-include $(HOME)/configure/RULES_USER diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index 8fd3f63b6..1043fc140 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -36,6 +36,15 @@ actionArchTargets = $(foreach action, $(ACTIONS),\ all : install +# Include /cfg/DIR_RULES* files from tops defined in RELEASE* files +# Do this here so they can add ACTIONS +# +RELEASE_CFG_DIR_RULES = $(foreach top, $(RELEASE_TOPS), \ + $(wildcard $($(top))/cfg/DIR_RULES*)) +ifneq ($(RELEASE_CFG_DIR_RULES),) + include $(RELEASE_CFG_DIR_RULES) +endif + # Allows rebuild to work with parallel builds option, -j. ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS))) $(foreach dir, $(DIRS), $(dir)$(DIVIDER)install): \ @@ -79,3 +88,7 @@ $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \ .PHONY : $(dirActionArchTargets) .PHONY : $(actionArchTargets) + +# User specific rules +# +-include $(HOME)/configure/RULES_USER diff --git a/configure/RULES_FILE_TYPE b/configure/RULES_FILE_TYPE index b58bf550f..c3a3e541c 100644 --- a/configure/RULES_FILE_TYPE +++ b/configure/RULES_FILE_TYPE @@ -10,23 +10,25 @@ # #--------------------------------------------------------------- -# Include /configure/RULES_BUILD definitions from tops defined in RELEASE* files +# Include /configure/RULES_BUILD from tops defined in RELEASE* files # -RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/configure/RULES_BUILD)) +RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), \ + $(wildcard $($(top))/configure/RULES_BUILD)) ifneq ($(RELEASE_RULES_BUILDS),) include $(RELEASE_RULES_BUILDS) endif #--------------------------------------------------------------- -# Include /cfg/RULES* definitions from tops defined in RELEASE* files +# Include /cfg/RULES* files from tops defined in RELEASE* files # -RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), $(wildcard $($(top))/cfg/RULES*)) +RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), \ + $(wildcard $($(top))/cfg/RULES*)) ifneq ($(RELEASE_CFG_RULES),) include $(RELEASE_CFG_RULES) endif #--------------------------------------------------------------- -# If this is not BASE then include TOP/configure/RULES_BUILD definitions +# If this is not BASE then include /configure/RULES_BUILD # ifeq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),) TOP_RULES_BUILDS = $(wildcard $(TOP)/configure/RULES_BUILD) @@ -36,7 +38,7 @@ endif endif #--------------------------------------------- -# Include our own $(INSTALL_CFG)/RULES* definitions +# Include our own $(INSTALL_CFG)/RULES* files # TOP_CFG_RULES = $(wildcard $(INSTALL_CFG)/RULES*) ifneq ($(TOP_CFG_RULES),) @@ -69,3 +71,6 @@ $(foreach type, $(FILE_TYPE),$(eval $(call FILE_TYPE_template,$(strip $(type)))) clean:: @$(RM) $(foreach type, $(FILE_TYPE), $($(type))) +# User specific rules +# +-include $(HOME)/configure/RULES_USER diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 8f100621a..94d753ec1 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -82,3 +82,10 @@ help: .PHONY: cleandirs distclean cvsclean realuninstall archuninstall uninstallDirs .PHONY: uninstall help +# Include /cfg/TOP_RULES* files from tops defined in RELEASE* files +# +RELEASE_CFG_TOP_RULES = $(foreach top, $(RELEASE_TOPS), \ + $(wildcard $($(top))/cfg/TOP_RULES*)) +ifneq ($(RELEASE_CFG_TOP_RULES),) + include $(RELEASE_CFG_TOP_RULES) +endif diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 98cd64ae7..6bbcb5643 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -13,6 +13,31 @@ +

Changes to <top>/cfg/* files

+ +

The order in which cfg/CONFIG* and cfg/RULES* files are included from support +applications listed in the configure/RELEASE* files has been changed. Previously +these files were included in the order in which the top areas are listed in the +RELEASE file, but it makes more sense to load them in reverse order since later +entries override earlier ones in Makefiles but the release file order is +supposed to allow earlier entries to take precedence over later ones. The same +change has been made to the inclusion of the <top>/configure/RULES_BUILD +files.

+ +

Two new file types can also be provided in a module's cfg directory. Files +named TOP_RULES* will be included by the top-level Makefile of other modules +that refer to this module; files name DIR_RULES* will be included by all +Makefiles that merely descend into lower-level directories. The cfg/RULES* files +are only included when make is building code inside the O.<arch> +directories.

+ +

The new cfg/DIR_RULES* file inclusion was designed to permit new recursive +make actions to be implemented by appending the name of the new action to the +ACTIONS variable. There must be a matching rule in one of the cfg/RULES* files +when doing this. Similar rules may also be defined in the cfg/TOP_RULES* and/or +cfg/DIR_RULES* files, but these should only state prerequisites and not directly +provide commands to be executed.

+

MinGW Cross-builds from Linux

Build configuration files have been back-ported from the 3.15 branch that From 2a6714fd03199db58ee14a546c907aa9b13b2c3d Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Fri, 6 Mar 2015 18:14:59 -0600 Subject: [PATCH 62/75] configure: Cosmetic changes only, comments & spacing. --- configure/CONFIG | 6 ++-- configure/CONFIG_APP_INCLUDE | 25 +++++++++++---- configure/RULES_ARCHS | 36 +++++++++------------- configure/RULES_DIRS | 59 ++++++++++++++++++++---------------- configure/RULES_FILE_TYPE | 30 ++++++++---------- configure/RULES_TOP | 19 ++++++------ 6 files changed, 91 insertions(+), 84 deletions(-) diff --git a/configure/CONFIG b/configure/CONFIG index 637afa3b4..4a9624022 100644 --- a/configure/CONFIG +++ b/configure/CONFIG @@ -59,8 +59,6 @@ include $(CONFIG)/os/CONFIG.$(EPICS_HOST_ARCH).Common -include $(CONFIG)/os/CONFIG_SITE.$(EPICS_HOST_ARCH).Common RELEASE_TOPS := $(shell $(CONVERTRELEASE) -T $(TOP) releaseTops) -RELEASE_TOPS_REVERSE := $(shell \ - $(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS)) ifdef T_A @@ -92,8 +90,10 @@ endif # Include /cfg/CONFIG* definitions from tops defined in RELEASE* files # ifneq ($(CONFIG),$(TOP)/configure) +RELEASE_TOPS_REVERSE := $(shell \ + $(PERL) -e '$$,=" ";print reverse @ARGV' $(RELEASE_TOPS)) RELEASE_CFG_CONFIGS = $(foreach top, $(RELEASE_TOPS_REVERSE), \ - $(wildcard $($(top))/cfg/CONFIG*)) + $(wildcard $($(top))/cfg/CONFIG*)) ifneq ($(RELEASE_CFG_CONFIGS),) include $(RELEASE_CFG_CONFIGS) endif diff --git a/configure/CONFIG_APP_INCLUDE b/configure/CONFIG_APP_INCLUDE index 9c23ec6a4..d8cefde31 100644 --- a/configure/CONFIG_APP_INCLUDE +++ b/configure/CONFIG_APP_INCLUDE @@ -1,21 +1,34 @@ +#************************************************************************* +# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne +# National Laboratory. +# Copyright (c) 2002 The Regents of the University of California, as +# Operator of Los Alamos National Laboratory. +# EPICS BASE is distributed subject to a Software License Agreement found +# in the file LICENSE that is included with this distribution. +#************************************************************************* +# +# $Revision-Id$ +# + export TOP ifneq ($(RELEASE_TOPS),) define RELEASE_FLAGS_template export $(1) - $(1)_HOST_BIN = $$(strip $$($(1)))/bin/$$(EPICS_HOST_ARCH) - $(1)_HOST_LIB = $$(strip $$($(1)))/lib/$$(EPICS_HOST_ARCH) - $(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$$(T_A)) - $(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$$(T_A)) + $(1)_HOST_BIN = $$(strip $$($(1)))/bin/$(EPICS_HOST_ARCH) + $(1)_HOST_LIB = $$(strip $$($(1)))/lib/$(EPICS_HOST_ARCH) + $(1)_BIN = $$(wildcard $$(strip $$($(1)))/bin/$(T_A)) + $(1)_LIB = $$(wildcard $$(strip $$($(1)))/lib/$(T_A)) SHRLIB_SEARCH_DIRS += $$($(1)_LIB) - RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS))) + RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$(OS_CLASS))) RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include)) RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd) RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db) RELEASE_PERL_MODULE_DIRS += $$(wildcard $$(strip $$($(1)))/lib/perl) endef -$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) )) +$(foreach top, $(RELEASE_TOPS), \ + $(eval $(call RELEASE_FLAGS_template,$(top)))) endif diff --git a/configure/RULES_ARCHS b/configure/RULES_ARCHS index 6dfe4c92e..5dd343ff6 100644 --- a/configure/RULES_ARCHS +++ b/configure/RULES_ARCHS @@ -20,13 +20,12 @@ ACTIONS += browse ACTIONS += runtests tapfiles #ACTIONS += rebuild -actionPart = $(word 1, $(subst $(DIVIDER), ,$@)) -archPart = $(word 2, $(subst $(DIVIDER), ,$@)) +actionArchTargets = $(foreach action, $(ACTIONS), \ + $(foreach arch, $(BUILD_ARCHS), \ + $(action)$(DIVIDER)$(arch))) -actionArchTargets = $(foreach x, $(ACTIONS),\ - $(foreach arch,$(BUILD_ARCHS), $(x)$(DIVIDER)$(arch))) - -cleanArchTargets = $(foreach arch,$(BUILD_ARCHS), clean$(DIVIDER)$(arch)) +cleanArchTargets = $(foreach arch, $(BUILD_ARCHS), \ + clean$(DIVIDER)$(arch)) buildDirs = $(addprefix O.,$(BUILD_ARCHS)) @@ -39,28 +38,19 @@ ifneq ($(RELEASE_CFG_DIR_RULES),) include $(RELEASE_CFG_DIR_RULES) endif -#************************************************************************* -# Create epics_host_arch dependancies for GNU make -j option -# Only works with GNU make 3.81 or later (uses eval function) +# Create EPICS_HOST_ARCH dependancies for GNU make -j option. # Needed in dirs where EPICS_HOST_ARCH build creates a tool used in # cross arch builds CROSS_ARCHS += $(CROSS1) $(CROSS2) -# j is NOT found in MAKEFLAGS when using make 3.81 -# Hope to uncomment this for GNU make 3.82 -#ifeq ($(findstring j,$(MAKEFLAGS)),j) - define DEP_template $(2): $$(EPICS_HOST_ARCH) $(1)$$(DIVIDER)$(2): $(1)$$(DIVIDER)$$(EPICS_HOST_ARCH) O.$(2) endef - -$(foreach action, $(ACTIONS), $(foreach arch,\ - $(CROSS_ARCHS),$(eval $(call DEP_template,$(action),$(arch))))) - -#endif -#************************************************************************* +$(foreach action, $(ACTIONS), \ + $(foreach arch, $(CROSS_ARCHS), \ + $(eval $(call DEP_template,$(action),$(arch))))) # Allows rebuild to work with parallel builds option, -j. ifeq (rebuild,$(filter rebuild,$(MAKECMDGOALS))) @@ -68,8 +58,11 @@ $(buildDirs) O.Common : clean rebuild: install endif +archPart = $(word 2, $(subst $(DIVIDER), ,$@)) +actionPart = $(word 1, $(subst $(DIVIDER), ,$@)) $(actionArchTargets) : $(buildDirs) O.Common - $(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. T_A=$(archPart) $(actionPart) + $(MAKE) -C O.$(archPart) -f ../Makefile TOP=$(TOP)/.. \ + T_A=$(archPart) $(actionPart) $(BUILD_ARCHS) : % : O.% O.Common $(MAKE) -C O.$@ -f ../Makefile TOP=$(TOP)/.. T_A=$@ @@ -82,8 +75,7 @@ $(buildDirs): O.Common: $(MKDIR) O.Common -# -# special clean rule +# Clean rules # clean :: $(RMDIR) $(addprefix O.,$(BUILD_ARCHS)) O.Common diff --git a/configure/RULES_DIRS b/configure/RULES_DIRS index 1043fc140..55e2ab562 100644 --- a/configure/RULES_DIRS +++ b/configure/RULES_DIRS @@ -15,26 +15,21 @@ ARCHS += $(BUILD_ARCHS) ACTIONS += inc build install buildInstall clean realclean archclean ACTIONS += runtests tapfiles -dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) - -actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ - $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) - dirActionArchTargets = $(foreach dir, $(DIRS), \ - $(foreach action, $(ACTIONS),\ - $(foreach arch, $(ARCHS), \ - $(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch)))) + $(foreach action, $(ACTIONS), \ + $(foreach arch, $(ARCHS), \ + $(dir)$(DIVIDER)$(action)$(DIVIDER)$(arch)))) dirArchTargets += $(foreach dir, $(DIRS), \ - $(foreach arch, $(ARCHS),\ - $(dir)$(DIVIDER)$(arch))) + $(foreach arch, $(ARCHS), \ + $(dir)$(DIVIDER)$(arch))) dirActionTargets += $(foreach dir, $(DIRS), \ - $(foreach action, $(ACTIONS),\ - $(dir)$(DIVIDER)$(action))) -actionArchTargets = $(foreach action, $(ACTIONS),\ - $(foreach arch, $(ARCHS), \ - $(action)$(DIVIDER)$(arch))) + $(foreach action, $(ACTIONS), \ + $(dir)$(DIVIDER)$(action))) +actionArchTargets = $(foreach action, $(ACTIONS), \ + $(foreach arch, $(ARCHS), \ + $(action)$(DIVIDER)$(arch))) -all : install +all: install # Include /cfg/DIR_RULES* files from tops defined in RELEASE* files # Do this here so they can add ACTIONS @@ -57,30 +52,42 @@ endif define DEP_template1 $(1): $$($(1)_DEPEND_DIRS) endef -$(foreach dir, $(DIRS),$(eval $(call DEP_template1,$(dir)))) +$(foreach dir, $(DIRS), \ + $(eval $(call DEP_template1,$(dir)))) define DEP_template2 -$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) +$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) endef -$(foreach action, $(ACTIONS), $(foreach dir, $(DIRS),$(eval $(call DEP_template2,$(dir),$(action))))) +$(foreach action, $(ACTIONS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template2,$(dir),$(action))))) define DEP_template3 -$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2),$$(ddir))) +$(1)$$(DIVIDER)$(2) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2),$$(ddir))) endef -$(foreach arch, $(ARCHS), $(foreach dir, $(DIRS),$(eval $(call DEP_template3,$(dir),$(arch))))) +$(foreach arch, $(ARCHS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template3,$(dir),$(arch))))) define DEP_template4 -$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS),$$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir))) +$(1)$$(DIVIDER)$(2)$$(DIVIDER)$(3) : $$(foreach ddir, $$($(1)_DEPEND_DIRS), \ + $$(addsuffix $$(DIVIDER)$(2)$$(DIVIDER)$(3),$$(ddir))) endef -$(foreach arch, $(ARCHS), $(foreach action, $(ACTIONS), $(foreach dir, $(DIRS), \ - $(eval $(call DEP_template4,$(dir),$(action),$(arch)))))) - +$(foreach arch, $(ARCHS), \ + $(foreach action, $(ACTIONS), \ + $(foreach dir, $(DIRS), \ + $(eval $(call DEP_template4,$(dir),$(action),$(arch)))))) +dirPart = $(join $(dir $@), $(word 1, $(subst $(DIVIDER), ,$(notdir $@)))) +actionArchPart = $(join $(word 2, $(subst $(DIVIDER), ,$(notdir $@))), \ + $(addprefix $(DIVIDER),$(word 3, $(subst $(DIVIDER), ,$(notdir $@))))) $(DIRS) $(dirActionTargets) $(dirArchTargets) $(dirActionArchTargets) : $(MAKE) -C $(dirPart) $(actionArchPart) $(ARCHS) $(ACTIONS) $(actionArchTargets) :%: \ - $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) + $(foreach dir, $(DIRS), $(dir)$(DIVIDER)%) .PHONY : $(DIRS) all rebuild .PHONY : $(ARCHS) $(ACTIONS) diff --git a/configure/RULES_FILE_TYPE b/configure/RULES_FILE_TYPE index c3a3e541c..e4d459a0b 100644 --- a/configure/RULES_FILE_TYPE +++ b/configure/RULES_FILE_TYPE @@ -6,28 +6,26 @@ # EPICS BASE is distributed subject to a Software License Agreement found # in the file LICENSE that is included with this distribution. #************************************************************************* +# # $Revision-Id$ # -#--------------------------------------------------------------- # Include /configure/RULES_BUILD from tops defined in RELEASE* files # RELEASE_RULES_BUILDS = $(foreach top, $(RELEASE_TOPS), \ - $(wildcard $($(top))/configure/RULES_BUILD)) + $(wildcard $($(top))/configure/RULES_BUILD)) ifneq ($(RELEASE_RULES_BUILDS),) include $(RELEASE_RULES_BUILDS) endif -#--------------------------------------------------------------- # Include /cfg/RULES* files from tops defined in RELEASE* files # RELEASE_CFG_RULES = $(foreach top, $(RELEASE_TOPS), \ - $(wildcard $($(top))/cfg/RULES*)) + $(wildcard $($(top))/cfg/RULES*)) ifneq ($(RELEASE_CFG_RULES),) include $(RELEASE_CFG_RULES) endif -#--------------------------------------------------------------- # If this is not BASE then include /configure/RULES_BUILD # ifeq ($(wildcard $(TOP)/configure/CONFIG_BASE_VERSION),) @@ -37,7 +35,6 @@ ifneq ($(TOP_RULES_BUILDS),) endif endif -#--------------------------------------------- # Include our own $(INSTALL_CFG)/RULES* files # TOP_CFG_RULES = $(wildcard $(INSTALL_CFG)/RULES*) @@ -45,29 +42,28 @@ ifneq ($(TOP_CFG_RULES),) include $(TOP_CFG_RULES) endif -#--------------------------------------------------------------- - +# Rules to install each FILE_TYPE +# define FILE_TYPE_template - -$(1) += $$(if $$(strip $$($(1)_$$(OS_CLASS))),$$(subst -nil-,,$$($(1)_$$(OS_CLASS))), $$($(1)_DEFAULT)) - +$(1) += $$(if $$(strip $$($(1)_$(OS_CLASS))), \ + $$(subst -nil-,,$$($(1)_$(OS_CLASS))), \ + $$($(1)_DEFAULT)) INSTALLS_$(1) = $$($(1):%=$$(INSTALL_$(1))/%) $$(INSTALL_$(1))/%: ../% $(ECHO) "Installing $(1) file $$@" @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) - $$(INSTALL_$(1))/%: % $(ECHO) "Installing $(1) file $$@" @$$(INSTALL) -d -m $$(INSTALL_PERMISSIONS) $$< $$(dir $$@) -buildInstall : $$(INSTALLS_$(1)) - +buildInstall: $$(INSTALLS_$(1)) endef +$(foreach type, $(FILE_TYPE), \ + $(eval $(call FILE_TYPE_template,$(strip $(type))))) -$(foreach type, $(FILE_TYPE),$(eval $(call FILE_TYPE_template,$(strip $(type))))) -#--------------------------------------------- - +# Cleaning FILE_TYPE files +# clean:: @$(RM) $(foreach type, $(FILE_TYPE), $($(type))) diff --git a/configure/RULES_TOP b/configure/RULES_TOP index 94d753ec1..d05188943 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -4,17 +4,18 @@ # Copyright (c) 2002 The Regents of the University of California, as # Operator of Los Alamos National Laboratory. # EPICS BASE is distributed subject to a Software License Agreement found -# in file LICENSE that is included with this distribution. +# in the file LICENSE that is included with this distribution. #************************************************************************* # -# $Revision-Id$ +# $Revision-Id$ # include $(CONFIG)/RULES_DIRS distclean: realclean cvsclean realuninstall -CVSCLEAN=$(firstword $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) +CVSCLEAN = $(firstword \ + $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) cvsclean: $(PERL) $(CVSCLEAN) @@ -22,17 +23,15 @@ realuninstall: uninstallDirs $(RMDIR) $(INSTALL_LOCATION_BIN) $(RMDIR) $(INSTALL_LOCATION_LIB) -UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC)\ - $(INSTALL_HTML) $(INSTALL_JAVA) $(INSTALL_TEMPLATES) \ - $(INSTALL_DB) +UNINSTALL_DIRS += $(INSTALL_DBD) $(INSTALL_INCLUDE) $(INSTALL_DOC) \ + $(INSTALL_HTML) $(INSTALL_JAVA) $(INSTALL_TEMPLATES) $(INSTALL_DB) UNINSTALL_DIRS += $(DIRECTORY_TARGETS) uninstallDirs: $(RMDIR) $(UNINSTALL_DIRS) uninstall: archuninstall uninstallDirs -archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) - @$(MAKE) -f Makefile cleandirs +archuninstall: $(addprefix uninstall$(DIVIDER),$(BUILD_ARCHS)) | cleandirs archPart = $(word 2, $(subst $(DIVIDER), ,$@)) uninstall$(DIVIDER)%: @@ -40,14 +39,14 @@ uninstall$(DIVIDER)%: $(RMDIR) $(INSTALL_LOCATION_LIB)/$(archPart) cleandirs: + @$(NOP) ifeq ($(wildcard $(INSTALL_LOCATION_BIN)/*),) $(RMDIR) $(INSTALL_LOCATION_BIN) endif ifeq ($(wildcard $(INSTALL_LOCATION_LIB)/*),) $(RMDIR) $(INSTALL_LOCATION_LIB) endif - @echo -# The echo above stops a "nothing to be done for cleandirs" message + help: @echo "Usage: gnumake [options] [target] ..." From 74c6e8175286cdd4ff95963fee3257be46facbbe Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sun, 8 Mar 2015 15:26:07 -0500 Subject: [PATCH 63/75] Fixed HDEPENDS_MKMFFLAGS --- configure/CONFIG_COMMON | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_COMMON b/configure/CONFIG_COMMON index dc4e9011b..fcdadb7bf 100644 --- a/configure/CONFIG_COMMON +++ b/configure/CONFIG_COMMON @@ -339,7 +339,7 @@ PREPROCESS.cpp = $(CPP) $(CPPFLAGS) $(INCLUDES) $< > $@ HDEPENDS_METHOD = MKMF -HDEPENDS_MKMFFLAGS = -m $*$(DEP) $(subst -I,,$(INCLUDES)) $@ +HDEPENDS_MKMFFLAGS = -m $*$(DEP) $(INCLUDES) $@ HDEPENDS_MKMF.c = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS) HDEPENDS_MKMF.cpp = $(MKMF) $(HDEPENDS_FLAGS) $(HDEPENDS_MKMFFLAGS) From 84e74d09241b0e49dc7e557e389869982121060f Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2015 11:33:50 -0500 Subject: [PATCH 64/75] Fix 'Can't find convertRelease.pl' problem --- configure/CONFIG_BASE | 3 ++- configure/RULES_TOP | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index d1f561503..c6cdaac6e 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -54,6 +54,7 @@ BASE_CPPFLAGS += $(OSITHREAD_DEFAULT_STACK_FLAGS_$(OSITHREAD_USE_DEFAULT_STACK)) # Where to find the installed build tools TOOLS = $(EPICS_BASE_HOST_BIN) +FIND_TOOL = $(firstword $(wildcard $$(TOOLS)/$(1) $(TOP)/src/tools/$(1))) #--------------------------------------------------------------- # Epics base build tools and tool flags @@ -63,7 +64,7 @@ DBEXPAND = $(call PATH_FILTER, $(TOOLS)/dbExpand$(HOSTEXE)) DBTORECORDTYPEH = $(call PATH_FILTER, $(TOOLS)/dbToRecordtypeH$(HOSTEXE)) DBTOMENUH = $(call PATH_FILTER, $(TOOLS)/dbToMenuH$(HOSTEXE)) REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl -CONVERTRELEASE = $(PERL) $(TOOLS)/convertRelease.pl +CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl) FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl #------------------------------------------------------- diff --git a/configure/RULES_TOP b/configure/RULES_TOP index d05188943..1898f591e 100644 --- a/configure/RULES_TOP +++ b/configure/RULES_TOP @@ -14,8 +14,7 @@ include $(CONFIG)/RULES_DIRS distclean: realclean cvsclean realuninstall -CVSCLEAN = $(firstword \ - $(wildcard $(TOOLS)/cvsclean.pl $(TOP)/src/tools/cvsclean.pl)) +CVSCLEAN = $(call FIND_TOOL,cvsclean.pl) cvsclean: $(PERL) $(CVSCLEAN) From 0f0a8cbbe5f5bc29c9e1fb2e8590157c05e47606 Mon Sep 17 00:00:00 2001 From: Janet Anderson Date: Mon, 9 Mar 2015 12:34:42 -0500 Subject: [PATCH 65/75] Set version to 3.14.12.5-rc1 --- configure/CONFIG_BASE_VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 0d8dcb1db..4ff90c817 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -35,10 +35,10 @@ EPICS_PATCH_LEVEL = 5 # This will end in -DEV between official releases #EPICS_DEV_SNAPSHOT=-DEV #EPICS_DEV_SNAPSHOT=-pre1 -EPICS_DEV_SNAPSHOT=-pre1-DEV +#EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV -#EPICS_DEV_SNAPSHOT=-rc1 +EPICS_DEV_SNAPSHOT=-rc1 #EPICS_DEV_SNAPSHOT=-rc1-DEV #EPICS_DEV_SNAPSHOT=-rc2 #EPICS_DEV_SNAPSHOT=-rc2-DEV From 657f72652760414552f09a5cacfd5433acef577a Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2015 14:24:44 -0500 Subject: [PATCH 66/75] Fix FIND_TOOL --- configure/CONFIG_BASE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/CONFIG_BASE b/configure/CONFIG_BASE index c6cdaac6e..373b8311e 100644 --- a/configure/CONFIG_BASE +++ b/configure/CONFIG_BASE @@ -54,7 +54,7 @@ BASE_CPPFLAGS += $(OSITHREAD_DEFAULT_STACK_FLAGS_$(OSITHREAD_USE_DEFAULT_STACK)) # Where to find the installed build tools TOOLS = $(EPICS_BASE_HOST_BIN) -FIND_TOOL = $(firstword $(wildcard $$(TOOLS)/$(1) $(TOP)/src/tools/$(1))) +FIND_TOOL = $(firstword $(wildcard $(TOOLS)/$(1) $(TOP)/src/tools/$(1))) #--------------------------------------------------------------- # Epics base build tools and tool flags From e75ec5f85b7f65f3b7339567d4eb8908c3c747bc Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2015 14:33:17 -0500 Subject: [PATCH 67/75] Set snapshot to -rc1-DEV --- configure/CONFIG_BASE_VERSION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG_BASE_VERSION b/configure/CONFIG_BASE_VERSION index 4ff90c817..a0783bb06 100644 --- a/configure/CONFIG_BASE_VERSION +++ b/configure/CONFIG_BASE_VERSION @@ -38,8 +38,8 @@ EPICS_PATCH_LEVEL = 5 #EPICS_DEV_SNAPSHOT=-pre1-DEV #EPICS_DEV_SNAPSHOT=-pre2 #EPICS_DEV_SNAPSHOT=-pre2-DEV -EPICS_DEV_SNAPSHOT=-rc1 -#EPICS_DEV_SNAPSHOT=-rc1-DEV +#EPICS_DEV_SNAPSHOT=-rc1 +EPICS_DEV_SNAPSHOT=-rc1-DEV #EPICS_DEV_SNAPSHOT=-rc2 #EPICS_DEV_SNAPSHOT=-rc2-DEV #EPICS_DEV_SNAPSHOT= From e0f97a9215a583e419e00cf1f9e20b1cb7e8f075 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Mon, 9 Mar 2015 18:07:13 -0500 Subject: [PATCH 68/75] Set testPlan in dbCaStatsTest.c --- src/ioc/db/test/dbCaStatsTest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ioc/db/test/dbCaStatsTest.c b/src/ioc/db/test/dbCaStatsTest.c index e9de6ae6f..020c65f10 100644 --- a/src/ioc/db/test/dbCaStatsTest.c +++ b/src/ioc/db/test/dbCaStatsTest.c @@ -67,7 +67,7 @@ void testCaStats(void) { MAIN(dbCaStatsTest) { - testPlan(0); + testPlan(5); testCaStats(); return testDone(); } From 6bf3f5554f89ee3a17fae56e6c97929210f0ef5e Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 9 Mar 2015 19:48:30 -0400 Subject: [PATCH 69/75] epicsAtomic: fix function def. order epicsAtomicMemoryBarrierFallback used before definition --- src/libCom/osi/os/posix/epicsAtomicOSD.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libCom/osi/os/posix/epicsAtomicOSD.h b/src/libCom/osi/os/posix/epicsAtomicOSD.h index 9dad0e204..892d2dcb5 100644 --- a/src/libCom/osi/os/posix/epicsAtomicOSD.h +++ b/src/libCom/osi/os/posix/epicsAtomicOSD.h @@ -26,6 +26,10 @@ typedef struct EpicsAtomicLockKey {} EpicsAtomicLockKey; extern "C" { #endif /* __cplusplus */ +epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); +epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); +epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void ); + #ifndef EPICS_ATOMIC_READ_MEMORY_BARRIER EPICS_ATOMIC_INLINE void epicsAtomicReadMemoryBarrier (void) { @@ -40,10 +44,6 @@ EPICS_ATOMIC_INLINE void epicsAtomicWriteMemoryBarrier (void) } #endif -epicsShareFunc void epicsAtomicLock ( struct EpicsAtomicLockKey * ); -epicsShareFunc void epicsAtomicUnlock ( struct EpicsAtomicLockKey * ); -epicsShareFunc void epicsAtomicMemoryBarrierFallback ( void ); - #ifdef __cplusplus } /* end of extern "C" */ #endif /* __cplusplus */ From 5bbd954ec84e907404e6f93bede829eb499d9163 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 9 Mar 2015 21:27:49 -0400 Subject: [PATCH 70/75] epicsAtomic: fix noop OSDs Ensure that all are epicsAtomicOSD.cpp and use no-op to prevent RTEMS from using the posix implementation. --- .../osi/os/{default/epicsAtomicOSD.c => RTEMS/epicsAtomicOSD.cpp} | 0 src/libCom/osi/os/default/epicsAtomicOSD.cpp | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/libCom/osi/os/{default/epicsAtomicOSD.c => RTEMS/epicsAtomicOSD.cpp} (100%) create mode 100644 src/libCom/osi/os/default/epicsAtomicOSD.cpp diff --git a/src/libCom/osi/os/default/epicsAtomicOSD.c b/src/libCom/osi/os/RTEMS/epicsAtomicOSD.cpp similarity index 100% rename from src/libCom/osi/os/default/epicsAtomicOSD.c rename to src/libCom/osi/os/RTEMS/epicsAtomicOSD.cpp diff --git a/src/libCom/osi/os/default/epicsAtomicOSD.cpp b/src/libCom/osi/os/default/epicsAtomicOSD.cpp new file mode 100644 index 000000000..e69de29bb From fb7273046c1ea9e261377d8135e97ce80c8b63b5 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 10 Mar 2015 10:39:37 -0400 Subject: [PATCH 71/75] epicsAtomic: also prevent vxWorks from using posix/epicsAtomicOSD.cpp --- src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp diff --git a/src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp b/src/libCom/osi/os/vxWorks/epicsAtomicOSD.cpp new file mode 100644 index 000000000..e69de29bb From 1cacb8ef72a844906d330ca61e6da6ec16721549 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2015 13:04:15 -0500 Subject: [PATCH 72/75] Make TOP an absolute path when running test programs If the test starts an IOC, the registerRecordDeviceDriver routine will compare the absolute path of TOP at build time against the environment variable value (normally relative) and print a warning if they differ. This change cleans up the .tap output from such tests. --- src/tools/makeTestfile.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl index a037eb71c..3766573a6 100644 --- a/src/tools/makeTestfile.pl +++ b/src/tools/makeTestfile.pl @@ -27,7 +27,12 @@ open(my $OUT, '>', $target) or die "Can't create $target: $!\n"; print $OUT < Date: Tue, 10 Mar 2015 14:17:28 -0500 Subject: [PATCH 73/75] Chasing Jenkins instability on Windows --- src/libCom/test/epicsMessageQueueTest.cpp | 29 +++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index 5b0f46490..4ffa9d90e 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -25,7 +25,8 @@ #include "testMain.h" static const char *msg1 = "1234567890This is a very long message."; -static volatile int testExit = 0; +static volatile int sendExit = 0; +static volatile int recvExit = 0; static epicsEventId finished; /* @@ -85,10 +86,10 @@ receiver(void *arg) for (sender = 1 ; sender <= 4 ; sender++) expectmsg[sender-1] = 1; - while (!testExit) { + while (!recvExit) { cbuf[0] = '\0'; len = q->receive(cbuf, sizeof cbuf, 2.0); - if (len < 0 && !testExit) { + if (len < 0 && !recvExit) { testDiag("receiver() received unexpected timeout"); ++errors; } @@ -104,10 +105,11 @@ receiver(void *arg) } for (sender = 1 ; sender <= 4 ; sender++) { if (expectmsg[sender-1] > 1) - testDiag("Sender %d -- %d messages", sender, expectmsg[sender-1]-1); + testDiag("Received %d messages from Sender %d", + expectmsg[sender-1]-1, sender); } testOk1(errors == 0); - testDiag("Receiver finished"); + testDiag("Receiver exiting"); epicsEventSignal(finished); } @@ -119,13 +121,13 @@ sender(void *arg) int len; int i = 0; - while (!testExit) { + while (!sendExit) { len = sprintf(cbuf, "%s -- %d.", epicsThreadGetNameSelf(), ++i); while (q->trySend((void *)cbuf, len) < 0) epicsThreadSleep(0.005 * (randBelow(5))); epicsThreadSleep(0.005 * (randBelow(20))); } - testDiag("%s exiting, sent %d messages", epicsThreadGetNameSelf(), i-1); + testDiag("%s exiting, sent %d messages", epicsThreadGetNameSelf(), i); } extern "C" void messageQueueTest(void *parm) @@ -279,9 +281,15 @@ extern "C" void messageQueueTest(void *parm) epicsThreadCreate("Sender 3", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); epicsThreadCreate("Sender 4", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); - epicsThreadSleep(60.0); + for (i = 0; i < 10; i++) { + testDiag("... %d", 10 - i); + epicsThreadSleep(6.0); + } - testExit = 1; + sendExit = 1; + epicsThreadSleep(1.0); + recvExit = 1; + testDiag("Scheduler exiting"); } MAIN(epicsMessageQueueTest) @@ -294,7 +302,8 @@ MAIN(epicsMessageQueueTest) epicsThreadGetStackSize(epicsThreadStackMedium), messageQueueTest, NULL); - epicsEventWait(finished); + epicsEventMustWait(finished); + testDiag("Main thread signalled"); epicsThreadSleep(1.0); return testDone(); From 753bfcc579cd0533d852f23daf0e8f8a871e1093 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Tue, 10 Mar 2015 18:14:11 -0500 Subject: [PATCH 74/75] Check sender threads are starting --- src/libCom/test/epicsMessageQueueTest.cpp | 66 +++++++++++++++-------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/src/libCom/test/epicsMessageQueueTest.cpp b/src/libCom/test/epicsMessageQueueTest.cpp index 4ffa9d90e..8d7daea05 100644 --- a/src/libCom/test/epicsMessageQueueTest.cpp +++ b/src/libCom/test/epicsMessageQueueTest.cpp @@ -28,6 +28,7 @@ static const char *msg1 = "1234567890This is a very long message."; static volatile int sendExit = 0; static volatile int recvExit = 0; static epicsEventId finished; +static unsigned int mediumStack; /* * In Numerical Recipes in C: The Art of Scientific Computing (William H. @@ -78,6 +79,7 @@ extern "C" void receiver(void *arg) { epicsMessageQueue *q = (epicsMessageQueue *)arg; + const char *myName = epicsThreadGetNameSelf(); char cbuf[80]; int expectmsg[4]; int len; @@ -97,7 +99,8 @@ receiver(void *arg) sender >= 1 && sender <= 4) { if (expectmsg[sender-1] != msgNum) { ++errors; - testDiag("%s received %d '%.*s' -- expected %d", epicsThreadGetNameSelf(), len, len, cbuf, expectmsg[sender-1]); + testDiag("%s received %d '%.*s' -- expected %d", + myName, len, len, cbuf, expectmsg[sender-1]); } expectmsg[sender-1] = msgNum + 1; epicsThreadSleep(0.001 * (randBelow(20))); @@ -109,7 +112,7 @@ receiver(void *arg) expectmsg[sender-1]-1, sender); } testOk1(errors == 0); - testDiag("Receiver exiting"); + testDiag("%s exiting", myName); epicsEventSignal(finished); } @@ -132,6 +135,7 @@ sender(void *arg) extern "C" void messageQueueTest(void *parm) { + epicsThreadId myThreadId = epicsThreadGetIdSelf(); unsigned int i; char cbuf[80]; int len; @@ -155,20 +159,23 @@ extern "C" void messageQueueTest(void *parm) len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 3); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); want++; len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 2); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); q1->trySend((void *)msg1, i++); want++; len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 2); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); q1->trySend((void *)msg1, i++); testOk1(q1->pending() == 3); @@ -178,7 +185,8 @@ extern "C" void messageQueueTest(void *parm) testOk(q1->pending() == i, "q1->pending() == %d", i); want++; if (!testOk1((len == want) & (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); } testOk1(q1->pending() == 0); @@ -196,20 +204,23 @@ extern "C" void messageQueueTest(void *parm) len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 3); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); want++; len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 2); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); q1->send((void *)msg1, i++, 1.0); want++; len = q1->receive(cbuf, sizeof cbuf); testOk1(q1->pending() == 2); if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); q1->send((void *)msg1, i++, 1.0); testOk1(q1->pending() == 3); @@ -219,7 +230,8 @@ extern "C" void messageQueueTest(void *parm) testOk(q1->pending() == i, "q1->pending() == %d", i); want++; if (!testOk1((len == want) && (strncmp(msg1, cbuf, len) == 0))) - testDiag("wanted:%d '%.*s' got:%d '%.*s'", want, want, msg1, len, len, cbuf); + testDiag("wanted:%d '%.*s' got:%d '%.*s'", + want, want, msg1, len, len, cbuf); } testOk1(q1->pending() == 0); @@ -235,7 +247,8 @@ extern "C" void messageQueueTest(void *parm) testOk1(q1->pending() == 0); testDiag("Single receiver with invalid size, single sender tests:"); - epicsThreadCreate("Bad Receiver", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), badReceiver, q1); + epicsThreadCreate("Bad Receiver", epicsThreadPriorityMedium, + mediumStack, badReceiver, q1); epicsThreadSleep(1.0); testOk(q1->send((void *)msg1, 10) == 0, "Send with waiting receiver"); epicsThreadSleep(2.0); @@ -243,8 +256,9 @@ extern "C" void messageQueueTest(void *parm) epicsThreadSleep(2.0); testDiag("Single receiver, single sender tests:"); - epicsThreadSetPriority(epicsThreadGetIdSelf(), epicsThreadPriorityHigh); - epicsThreadCreate("Receiver one", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), receiver, q1); + epicsThreadSetPriority(myThreadId, epicsThreadPriorityHigh); + epicsThreadCreate("Receiver one", epicsThreadPriorityMedium, + mediumStack, receiver, q1); for (pass = 1 ; pass <= 3 ; pass++) { for (i = 0 ; i < 10 ; i++) { if (q1->trySend((void *)msg1, i) < 0) @@ -256,7 +270,7 @@ extern "C" void messageQueueTest(void *parm) case 1: if (i<6) testDiag(" priority-based scheduler, sent %d messages", i); - epicsThreadSetPriority(epicsThreadGetIdSelf(), epicsThreadPriorityLow); + epicsThreadSetPriority(myThreadId, epicsThreadPriorityLow); break; case 2: if (i<10) @@ -276,13 +290,21 @@ extern "C" void messageQueueTest(void *parm) */ testDiag("Single receiver, multiple sender tests:"); testDiag("This test lasts 60 seconds..."); - epicsThreadCreate("Sender 1", epicsThreadPriorityLow, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); - epicsThreadCreate("Sender 2", epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); - epicsThreadCreate("Sender 3", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); - epicsThreadCreate("Sender 4", epicsThreadPriorityHigh, epicsThreadGetStackSize(epicsThreadStackMedium), sender, q1); + testOk(!!epicsThreadCreate("Sender 1", epicsThreadPriorityLow, + mediumStack, sender, q1), + "Created Sender 1"); + testOk(!!epicsThreadCreate("Sender 2", epicsThreadPriorityMedium, + mediumStack, sender, q1), + "Created Sender 2"); + testOk(!!epicsThreadCreate("Sender 3", epicsThreadPriorityHigh, + mediumStack, sender, q1), + "Created Sender 3"); + testOk(!!epicsThreadCreate("Sender 4", epicsThreadPriorityHigh, + mediumStack, sender, q1), + "Created Sender 4"); for (i = 0; i < 10; i++) { - testDiag("... %d", 10 - i); + testDiag("... %2d", 10 - i); epicsThreadSleep(6.0); } @@ -294,13 +316,13 @@ extern "C" void messageQueueTest(void *parm) MAIN(epicsMessageQueueTest) { - testPlan(58); + testPlan(62); finished = epicsEventMustCreate(epicsEventEmpty); + mediumStack = epicsThreadGetStackSize(epicsThreadStackMedium); epicsThreadCreate("messageQueueTest", epicsThreadPriorityMedium, - epicsThreadGetStackSize(epicsThreadStackMedium), - messageQueueTest, NULL); + mediumStack, messageQueueTest, NULL); epicsEventMustWait(finished); testDiag("Main thread signalled"); From de298da94c44518ab7a259635fe07d03250b6b22 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Wed, 11 Mar 2015 10:53:37 -0500 Subject: [PATCH 75/75] Fix Jenkins instability on Windows --- src/tools/makeTestfile.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/tools/makeTestfile.pl b/src/tools/makeTestfile.pl index a037eb71c..bdc0059d0 100644 --- a/src/tools/makeTestfile.pl +++ b/src/tools/makeTestfile.pl @@ -10,7 +10,7 @@ # The makeTestfile.pl script generates a file $target.t which is needed # because some versions of the Perl test harness can only run test scripts -# that are actually written in Perl. The script we generate execs the +# that are actually written in Perl. The script we generate runs the # real test program which must be in the same directory as the .t file. # If the script is given an argument -tap it sets HARNESS_ACTIVE in the # environment to make the epicsUnitTest code generate strict TAP output. @@ -23,12 +23,16 @@ use strict; my ($target, $exe) = @ARGV; +# Use system on Windows, exec doesn't work the same there and +# GNUmake thinks the test has finished as soon as Perl exits. +my $exec = $^O eq 'MSWin32' ? "system('./$exe') == 0" : "exec './$exe'"; + open(my $OUT, '>', $target) or die "Can't create $target: $!\n"; print $OUT <