From 70e9d46d755edb70826260600bbd251f6c3fd776 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Thu, 5 Dec 2019 16:44:59 +0100 Subject: [PATCH 01/12] libcom: import some C99 math (isnan etc.) into global namespace --- src/libCom/osi/os/posix/epicsMath.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libCom/osi/os/posix/epicsMath.h b/src/libCom/osi/os/posix/epicsMath.h index 4e558676c..13f25e520 100644 --- a/src/libCom/osi/os/posix/epicsMath.h +++ b/src/libCom/osi/os/posix/epicsMath.h @@ -14,6 +14,14 @@ #include #ifdef __cplusplus + +#include + +using std::isfinite; +using std::isinf; +using std::isnan; +using std::isnormal; + extern "C" { #endif From 09ec3af3371020278d5c41ca19e170468dc2fc02 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Fri, 6 Dec 2019 10:52:38 +0100 Subject: [PATCH 02/12] libcom: fix colliding isnan/isinf between C99 and C++0x for gcc-4 This fix can be removed once support for gcc-4 is dropped in 2038 --- src/libCom/osi/os/posix/epicsMath.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libCom/osi/os/posix/epicsMath.h b/src/libCom/osi/os/posix/epicsMath.h index 13f25e520..1ef96d76f 100644 --- a/src/libCom/osi/os/posix/epicsMath.h +++ b/src/libCom/osi/os/posix/epicsMath.h @@ -18,8 +18,10 @@ #include using std::isfinite; +#ifndef __GXX_EXPERIMENTAL_CXX0X__ using std::isinf; using std::isnan; +#endif using std::isnormal; extern "C" { From 2e89a60c2dd405f4891e6d8e6f1b24747ee5790c Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 11 Dec 2019 14:51:16 +0100 Subject: [PATCH 03/12] libcom: properly declare isnan() in C++ code --- src/libCom/cppStd/epicsAlgorithm.h | 4 +++- src/libCom/iocsh/iocsh.cpp | 3 +++ src/libCom/test/epicsAlgorithmTest.cpp | 4 ++++ src/libCom/test/epicsCalcTest.cpp | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libCom/cppStd/epicsAlgorithm.h b/src/libCom/cppStd/epicsAlgorithm.h index 20850242d..54dec91e9 100644 --- a/src/libCom/cppStd/epicsAlgorithm.h +++ b/src/libCom/cppStd/epicsAlgorithm.h @@ -13,7 +13,9 @@ #ifndef __EPICS_ALGORITHM_H__ #define __EPICS_ALGORITHM_H__ -#include "epicsMath.h" +#include + +using std::isnan; // The C++ standard only requires types to be less-than comparable, so // the epicsMin and epicsMax templates only use operator < diff --git a/src/libCom/iocsh/iocsh.cpp b/src/libCom/iocsh/iocsh.cpp index 03d4c28b4..307fabfbf 100644 --- a/src/libCom/iocsh/iocsh.cpp +++ b/src/libCom/iocsh/iocsh.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #define epicsExportSharedSymbols #include "errlog.h" @@ -31,6 +32,8 @@ #include "cantProceed.h" #include "iocsh.h" +using std::isinf; + extern "C" { /* diff --git a/src/libCom/test/epicsAlgorithmTest.cpp b/src/libCom/test/epicsAlgorithmTest.cpp index fa8c0c03f..108c15d62 100644 --- a/src/libCom/test/epicsAlgorithmTest.cpp +++ b/src/libCom/test/epicsAlgorithmTest.cpp @@ -9,11 +9,15 @@ // epicsAlgorithmTest.cpp // Authors: Jeff Hill & Andrew Johnson +#include + #include "epicsUnitTest.h" #include "epicsAlgorithm.h" #include "epicsMath.h" #include "testMain.h" +using std::isnan; + MAIN(epicsAlgorithm) { testPlan(22); diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index 2492c95ba..aae412262 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "epicsUnitTest.h" #include "epicsTypes.h" @@ -16,6 +17,9 @@ #include "postfix.h" #include "testMain.h" +using std::isnan; +using std::isinf; + /* Infrastructure for running tests */ double doCalc(const char *expr) { From b0418e5274eae8a632c5d3bc9b87811a828ac5de Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 10:25:11 -0800 Subject: [PATCH 04/12] epicsSockResolveTest add detail --- src/libCom/test/epicsSockResolveTest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libCom/test/epicsSockResolveTest.c b/src/libCom/test/epicsSockResolveTest.c index 8131d9dbf..04b2973fa 100644 --- a/src/libCom/test/epicsSockResolveTest.c +++ b/src/libCom/test/epicsSockResolveTest.c @@ -75,8 +75,11 @@ MAIN(epicsSockResolveTest) testSkip(2, " aToIPAddr() failed"); } else { - testOk(addr.sin_addr.s_addr == htonl(okdata[i].IP), " IP correct"); - testOk(addr.sin_port == htons(okdata[i].port), " Port correct"); + testOk(addr.sin_addr.s_addr == htonl(okdata[i].IP), + " IP correct 0x%08x == 0x%08x", (unsigned)ntohl(addr.sin_addr.s_addr), + (unsigned)okdata[i].IP); + testOk(addr.sin_port == htons(okdata[i].port), " Port correct %u == %u", + ntohs(addr.sin_port), okdata[i].port); } } From 87229fdef0a255b8551ecd4119f0ed847b2e318f Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 10:05:19 -0800 Subject: [PATCH 05/12] redo travis-ci with matrix add mix of Ubuntu versions --- .travis.yml | 72 +++++++++++++++++++++++++++++++------------- ci/travis-build.sh | 4 +-- ci/travis-prepare.sh | 33 +++----------------- 3 files changed, 56 insertions(+), 53 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5079bff0c..b68a94223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,18 +1,54 @@ -sudo: false -dist: trusty language: c -compiler: - - gcc -env: - - CMPLR=gcc - - CMPLR=gcc EXTRA=CMD_CXXFLAGS=-std=c++11 - - CMPLR=gcc STATIC=YES - - CMPLR=clang - - CMPLR=clang STATIC=YES - - WINE=32 TEST=NO STATIC=YES - - WINE=32 TEST=NO STATIC=NO - - RTEMS=4.10 TEST=NO - - RTEMS=4.9 TEST=NO + +matrix: + include: + - sudo: false + dist: bionic + compiler: gcc + env: CMPLR=gcc + - sudo: false + dist: xenial + compiler: gcc + env: CMPLR=gcc + - sudo: false + dist: bionic + compiler: gcc + env: CMPLR=gcc CMD_CXXFLAGS=-std=c++11 + - sudo: false + dist: trusty + compiler: gcc + env: CMPLR=gcc STATIC=YES + - sudo: false + dist: bionic + compiler: gcc + env: CMPLR=clang + - sudo: false + dist: xenial + compiler: gcc + env: CMPLR=clang + - sudo: false + dist: trusty + compiler: gcc + env: CMPLR=clang STATIC=YES + - sudo: false + dist: trusty + compiler: gcc + env: WINE=32 TEST=NO STATIC=YES + - sudo: false + dist: trusty + compiler: gcc + env: WINE=32 TEST=NO STATIC=NO + - sudo: false + dist: trusty + compiler: gcc + env: RTEMS=4.10 TEST=NO + - sudo: false + dist: trusty + compiler: gcc + env: RTEMS=4.9 TEST=NO + - os: osx + env: CMD_CFLAGS="-mmacosx-version-min=10.7" CMD_CXXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" CMD_LDXFLAGS="-mmacosx-version-min=10.7 -std=c++11 -stdlib=libc++" + addons: apt: packages: @@ -21,12 +57,6 @@ addons: - perl - clang - g++-mingw-w64-i686 - - bison - - flex - - texinfo - - install-info -cache: - directories: - - $HOME/.cache + install: sh ci/travis-prepare.sh "$HOME/.cache/qemu/built" - fi + echo "==== /etc/hosts" + cat /etc/hosts + echo "====" fi - -cd "$CURDIR" From 8a9637568ebd2b69e733983cbd3ce61d5a66710c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 11:06:34 -0800 Subject: [PATCH 06/12] travis-ci /etc/hosts workaround --- ci/travis-prepare.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ci/travis-prepare.sh b/ci/travis-prepare.sh index 9797b0faa..393bd80b6 100644 --- a/ci/travis-prepare.sh +++ b/ci/travis-prepare.sh @@ -6,9 +6,18 @@ die() { exit 1 } - if [ -f /etc/hosts ] then + # The travis-ci "bionic" image throws us a curveball in /etc/hosts + # by including two entries for localhost. The first for 127.0.1.1 + # which causes epicsSockResolveTest to fail. + # cat /etc/hosts + # ... + # 127.0.1.1 localhost localhost ip4-loopback + # 127.0.0.1 localhost nettuno travis vagrant travis-job-.... + + sudo sed -i -e '/^127\.0\.1\.1/ s|localhost\s*||g' /etc/hosts + echo "==== /etc/hosts" cat /etc/hosts echo "====" From 247fea0fa9dfcde109d74b1b836fe6b37b5d4a0b Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 10:25:55 -0800 Subject: [PATCH 07/12] Revert "libcom: properly declare isnan() in C++ code" This reverts commit 2e89a60c2dd405f4891e6d8e6f1b24747ee5790c. --- src/libCom/cppStd/epicsAlgorithm.h | 4 +--- src/libCom/iocsh/iocsh.cpp | 3 --- src/libCom/test/epicsAlgorithmTest.cpp | 4 ---- src/libCom/test/epicsCalcTest.cpp | 4 ---- 4 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/libCom/cppStd/epicsAlgorithm.h b/src/libCom/cppStd/epicsAlgorithm.h index 54dec91e9..20850242d 100644 --- a/src/libCom/cppStd/epicsAlgorithm.h +++ b/src/libCom/cppStd/epicsAlgorithm.h @@ -13,9 +13,7 @@ #ifndef __EPICS_ALGORITHM_H__ #define __EPICS_ALGORITHM_H__ -#include - -using std::isnan; +#include "epicsMath.h" // The C++ standard only requires types to be less-than comparable, so // the epicsMin and epicsMax templates only use operator < diff --git a/src/libCom/iocsh/iocsh.cpp b/src/libCom/iocsh/iocsh.cpp index 307fabfbf..03d4c28b4 100644 --- a/src/libCom/iocsh/iocsh.cpp +++ b/src/libCom/iocsh/iocsh.cpp @@ -16,7 +16,6 @@ #include #include #include -#include #define epicsExportSharedSymbols #include "errlog.h" @@ -32,8 +31,6 @@ #include "cantProceed.h" #include "iocsh.h" -using std::isinf; - extern "C" { /* diff --git a/src/libCom/test/epicsAlgorithmTest.cpp b/src/libCom/test/epicsAlgorithmTest.cpp index 108c15d62..fa8c0c03f 100644 --- a/src/libCom/test/epicsAlgorithmTest.cpp +++ b/src/libCom/test/epicsAlgorithmTest.cpp @@ -9,15 +9,11 @@ // epicsAlgorithmTest.cpp // Authors: Jeff Hill & Andrew Johnson -#include - #include "epicsUnitTest.h" #include "epicsAlgorithm.h" #include "epicsMath.h" #include "testMain.h" -using std::isnan; - MAIN(epicsAlgorithm) { testPlan(22); diff --git a/src/libCom/test/epicsCalcTest.cpp b/src/libCom/test/epicsCalcTest.cpp index aae412262..2492c95ba 100644 --- a/src/libCom/test/epicsCalcTest.cpp +++ b/src/libCom/test/epicsCalcTest.cpp @@ -8,7 +8,6 @@ #include #include -#include #include "epicsUnitTest.h" #include "epicsTypes.h" @@ -17,9 +16,6 @@ #include "postfix.h" #include "testMain.h" -using std::isnan; -using std::isinf; - /* Infrastructure for running tests */ double doCalc(const char *expr) { From 24f08460bbca3311db150dffd3275b12e964309d Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 10:26:00 -0800 Subject: [PATCH 08/12] Revert "libcom: fix colliding isnan/isinf between C99 and C++0x for gcc-4" This reverts commit 09ec3af3371020278d5c41ca19e170468dc2fc02. --- src/libCom/osi/os/posix/epicsMath.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libCom/osi/os/posix/epicsMath.h b/src/libCom/osi/os/posix/epicsMath.h index 1ef96d76f..13f25e520 100644 --- a/src/libCom/osi/os/posix/epicsMath.h +++ b/src/libCom/osi/os/posix/epicsMath.h @@ -18,10 +18,8 @@ #include using std::isfinite; -#ifndef __GXX_EXPERIMENTAL_CXX0X__ using std::isinf; using std::isnan; -#endif using std::isnormal; extern "C" { From 60a092fa50e36a4843c3b441557d810a828fc333 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 16 Dec 2019 10:28:27 -0800 Subject: [PATCH 09/12] posix/epicsMath.h Include "" for c++11 and pull in non-namespace versions of isnan() and friends. --- src/libCom/osi/os/posix/epicsMath.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libCom/osi/os/posix/epicsMath.h b/src/libCom/osi/os/posix/epicsMath.h index 13f25e520..a8e9b815f 100644 --- a/src/libCom/osi/os/posix/epicsMath.h +++ b/src/libCom/osi/os/posix/epicsMath.h @@ -15,12 +15,14 @@ #ifdef __cplusplus +#if __cplusplus>=201103L #include using std::isfinite; using std::isinf; using std::isnan; using std::isnormal; +#endif extern "C" { #endif From 33f2d8c4aaffae02297397be899714635e468e47 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Fri, 4 May 2018 20:27:51 -0700 Subject: [PATCH 10/12] debug epicsTimerTest (cherry picked from commit 2af0c1047067401b01be8c0ad055fb58c21c50f4) --- src/libCom/test/epicsTimerTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/test/epicsTimerTest.cpp b/src/libCom/test/epicsTimerTest.cpp index f2a510819..d820e64be 100644 --- a/src/libCom/test/epicsTimerTest.cpp +++ b/src/libCom/test/epicsTimerTest.cpp @@ -112,7 +112,7 @@ double delayVerify::checkError () const double actualDelay = this->expireStamp - this->beginStamp; double measuredError = actualDelay - this->expectedDelay; double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay; - if ( ! testOk1 ( percentError < messageThresh ) ) { + if ( ! testOk ( percentError < messageThresh, "%f < %f", percentError, messageThresh ) ) { testDiag ( "delay = %f s, error = %f s (%.1f %%)", this->expectedDelay, measuredError, percentError ); } From e068191684617232b4112eff31abb07f32760046 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 8 Aug 2018 14:36:28 -0700 Subject: [PATCH 11/12] epicsTimerTest loosen test threshold (cherry picked from commit f955199805dc1987cc72f0d2691bf2a80fe796e3) --- src/libCom/test/epicsTimerTest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libCom/test/epicsTimerTest.cpp b/src/libCom/test/epicsTimerTest.cpp index d820e64be..aebf3f066 100644 --- a/src/libCom/test/epicsTimerTest.cpp +++ b/src/libCom/test/epicsTimerTest.cpp @@ -108,7 +108,7 @@ inline double delayVerify::delay () const double delayVerify::checkError () const { - const double messageThresh = 2.0; // percent + const double messageThresh = 5.0; // percent double actualDelay = this->expireStamp - this->beginStamp; double measuredError = actualDelay - this->expectedDelay; double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay; From feb938fae2515eb3ad245f51847edfddf6f06706 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 12 Nov 2019 17:36:10 -0800 Subject: [PATCH 12/12] minor epicsTimerTest (cherry picked from commit 7acd7c61450e2ecc5880cd7d12f12a59ee9d02e4) --- src/libCom/test/epicsTimerTest.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libCom/test/epicsTimerTest.cpp b/src/libCom/test/epicsTimerTest.cpp index aebf3f066..55870ed2d 100644 --- a/src/libCom/test/epicsTimerTest.cpp +++ b/src/libCom/test/epicsTimerTest.cpp @@ -112,10 +112,9 @@ double delayVerify::checkError () const double actualDelay = this->expireStamp - this->beginStamp; double measuredError = actualDelay - this->expectedDelay; double percentError = 100.0 * fabs ( measuredError ) / this->expectedDelay; - if ( ! testOk ( percentError < messageThresh, "%f < %f", percentError, messageThresh ) ) { - testDiag ( "delay = %f s, error = %f s (%.1f %%)", - this->expectedDelay, measuredError, percentError ); - } + testOk ( percentError < messageThresh, "%f < %f, delay = %f s, error = %f s (%.1f %%)", + percentError, messageThresh, + this->expectedDelay, measuredError, percentError ); return measuredError; }