Skip to content

Commit

Permalink
Merge pull request #1498 from peternewman/0.10-libftdi1
Browse files Browse the repository at this point in the history
Use C++11 if required by random
  • Loading branch information
peternewman committed Oct 2, 2018
2 parents 93448c8 + e61351f commit 30ea4d2
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 29 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ matrix:

env:
global:
# No colours in terminal (to reduce log file size)
- TERM=dumb
# Parallel make build
- MAKEFLAGS="-j 2"
# -- BEGIN Coverity Scan ENV
Expand Down Expand Up @@ -285,7 +287,12 @@ before_install:
- if [ "$TASK" == "spellintian" -o "$TASK" == "spellintian-duplicates" ]; then sudo add-apt-repository ppa:waja/trusty-backports -y; sudo apt-get update -qq; sudo apt-get install lintian -y; fi # Install a late enough lintian

after_failure:
- cat ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/test-suite.log
# Disabled as otherwise the logfile is too big
# - if [ -f ${TRAVIS_BUILD_DIR}/config.log ]; then cat ${TRAVIS_BUILD_DIR}/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/config.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/config.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/config.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/test-suite.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/test-suite.log; fi
- if [ -f ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/test-suite.log ]; then cat ${TRAVIS_BUILD_DIR}/ola-*/_build/sub/test-suite.log; fi

after_success:
- if [ "$TASK" = "coverage" ]; then coveralls --gcov /usr/bin/gcov-8 -b . -E '.*Test\.cpp$' -E '.*\.pb\.cc$' -E '.*\.pb\.cpp$' -E '.*\.pb\.h$' -E '.*\.yy\.cpp$' -E '.*\.tab\.cpp$' -E '.*\.tab\.h$' -E '.*/doxygen/examples.*$' --gcov-options '\-lp' > /dev/null; fi
Expand Down
9 changes: 8 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ COMMON_TESTING_FLAGS_ONLY_WARNINGS = $(COMMON_CXXFLAGS_ONLY_WARNINGS) \
COMMON_TESTING_FLAGS = $(COMMON_TESTING_FLAGS_ONLY_WARNINGS)
COMMON_TESTING_PROTOBUF_FLAGS = $(COMMON_TESTING_FLAGS)

# The genererated protobuf files don't compile with -Werror on win32 so we
# The generated protobuf files don't compile with -Werror on win32 so we
# disable fatal warnings on WIN32.
if ! USING_WIN32
if FATAL_WARNINGS
Expand All @@ -70,6 +70,13 @@ if FATAL_WARNINGS
COMMON_TESTING_FLAGS += -Werror
COMMON_TESTING_PROTOBUF_FLAGS += -Werror -Wno-error=unused-parameter \
-Wno-error=deprecated-declarations

if GNU_PLUS_PLUS_11_DEPRECATIONS
# We have to use gnu++11 for some reason, so stop it complaining about
# auto_ptr
COMMON_CXXFLAGS += -Wno-error=deprecated-declarations
COMMON_TESTING_FLAGS += -Wno-error=deprecated-declarations
endif
endif
endif

Expand Down
1 change: 0 additions & 1 deletion common/base/LoggingTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ void MockLogDestination::AddExpected(log_level level, string log_line) {
void MockLogDestination::Write(log_level level, const string &log_line) {
vector<string> tokens;
ola::StringSplit(log_line, &tokens, ":");
vector<string>::iterator iter;
OLA_ASSERT_EQ(tokens.size() , (size_t) 3);
OLA_ASSERT_GT(m_log_lines.size(), 0);
std::pair<log_level, string> expected_result = m_log_lines.at(0);
Expand Down
70 changes: 56 additions & 14 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,64 @@ AC_MSG_RESULT($ac_cv_gnu_plus_plus_11)

AM_CONDITIONAL([SUPPORTS_GNU_PLUS_PLUS_11], [test "x$ac_cv_gnu_plus_plus_11" = xyes])

# This checks whether random needs gnu++11 or not, it doesn't set HAVE_RANDOM
# (as it's using AC_CHECK_HEADER not HEADERS), we do that later as normal
# We don't pass the compiler flag to the preprocessor (CPPFLAGS) because that
# variable is used by the C preprocessor too, and some of the pthread checks
# test for C code, which complains it doesn't understand gnu++. We may
# therefore generate some warnings in configure, but it should all work!
ac_cv_header_random_98="no"
ac_cv_header_random_11="no"

AC_MSG_NOTICE([checking for random gnu++98 compatibility])
old_cxxflags=$CXXFLAGS
CXXFLAGS="${CXXFLAGS} -std=gnu++98 -Wall -Werror"
# Manually purge the cache
AS_UNSET([ac_cv_header_random])
AC_CHECK_HEADER(
[random],
[ac_cv_header_random_98="yes"],
[ac_cv_header_random_98="no"])
# Manually purge the cache
AS_UNSET([ac_cv_header_random])
CXXFLAGS=$old_cxxflags

AS_IF([test "x$ac_cv_gnu_plus_plus_11" = xyes],
[AC_MSG_NOTICE([checking for random gnu++11 compatibility])
old_cxxflags=$CXXFLAGS
CXXFLAGS="${CXXFLAGS} -std=gnu++11 -Wall -Werror"
# Manually purge the cache
AS_UNSET([ac_cv_header_random])
AC_CHECK_HEADER(
[random],
[ac_cv_header_random_11=yes],
[ac_cv_header_random_11=no])
# Manually purge the cache
AS_UNSET([ac_cv_header_random])
CXXFLAGS=$old_cxxflags])

# force us into gnu++98 mode if necessary
# If gnu++11 and gnu++98 then
# If no unit tests, force to gnu++98
# If unittests and cppunit < 1.14.0, force to gnu++98
# Else turn off deprecation messages for std::auto_ptr and run gnu++11
# If random works with gnu++98
# If no unit tests, force to gnu++98
# If unittests and cppunit < 1.14.0, force to gnu++98
# Else turn off deprecation messages for std::auto_ptr and run gnu++11
# Else run gnu++11
require_gnu_plus_plus_11="no"
AS_IF([test "x$ac_cv_gnu_plus_plus_11" = xyes],
[AS_IF([test "x$ac_cv_gnu_plus_plus_98" = xyes],
[AS_IF([test "x$enable_unittests" = xno],
[CXXFLAGS="$CXXFLAGS -std=gnu++98"],
[PKG_CHECK_MODULES([CPPUNIT1], [cppunit < 1.14.0],
[CXXFLAGS="$CXXFLAGS -std=gnu++98"],
[PKG_CHECK_MODULES([CPPUNIT2], [cppunit >= 1.14.0],
[require_gnu_plus_plus_11="yes"],
[AC_MSG_WARN([OLA requires std::auto_ptr support.])])
])
])
[AS_IF([test "x$ac_cv_header_random_98" = xyes],
[AS_IF([test "x$enable_unittests" = xno],
[CXXFLAGS="$CXXFLAGS -std=gnu++98"],
[PKG_CHECK_MODULES([CPPUNIT1], [cppunit < 1.14.0],
[CXXFLAGS="$CXXFLAGS -std=gnu++98"],
[PKG_CHECK_MODULES([CPPUNIT2], [cppunit >= 1.14.0],
[require_gnu_plus_plus_11="yes"],
[AC_MSG_WARN([OLA requires std::auto_ptr support.])])
])
])
],
[require_gnu_plus_plus_11="yes"])
])
])
AS_IF([test "x$require_gnu_plus_plus_11" = xyes],
Expand Down Expand Up @@ -776,8 +817,9 @@ esac

AS_IF([test "x$with_uucp_lock" != x], [UUCPLOCK=$with_uucp_lock])
AS_IF([test -d $UUCPLOCK],
[AC_DEFINE_UNQUOTED(UUCP_LOCK_DIR, "$UUCPLOCK")],
AC_MSG_ERROR(No suitable lock directory))
[AC_DEFINE_UNQUOTED(UUCP_LOCK_DIR, "$UUCPLOCK")
AC_MSG_RESULT($UUCPLOCK)],
AC_MSG_ERROR(no suitable lock directory))

# Python wrappers & RDM Responder tests.
#####################################################
Expand Down
5 changes: 1 addition & 4 deletions plugins/pathport/PathportDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ PathportDevice::PathportDevice(PathportPlugin *owner,
* Start this device
*/
bool PathportDevice::StartHook() {
vector<ola::network::UDPSocket*> sockets;
vector<ola::network::UDPSocket*>::iterator iter;

uint32_t product_id;
if (!StringToInt(m_preferences->GetValue(K_NODE_ID_KEY), &product_id)) {
OLA_WARN << "Invalid node Id " << m_preferences->GetValue(K_NODE_ID_KEY);
Expand Down Expand Up @@ -111,7 +108,7 @@ bool PathportDevice::StartHook() {

m_plugin_adaptor->AddReadDescriptor(m_node->GetSocket());
m_timeout_id = m_plugin_adaptor->RegisterRepeatingTimeout(
ADVERTISTMENT_PERIOD_MS,
ADVERTISEMENT_PERIOD_MS,
NewCallback(this, &PathportDevice::SendArpReply));

return true;
Expand Down
2 changes: 1 addition & 1 deletion plugins/pathport/PathportDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PathportDevice: public ola::Device {

static const char PATHPORT_DEVICE_NAME[];
static const uint32_t PORTS_PER_DEVICE = 8;
static const int ADVERTISTMENT_PERIOD_MS = 6000;
static const int ADVERTISEMENT_PERIOD_MS = 6000;
};
} // namespace pathport
} // namespace plugin
Expand Down
2 changes: 1 addition & 1 deletion plugins/sandnet/SandNetDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool SandNetDevice::StartHook() {
m_plugin_adaptor->AddReadDescriptor(*iter);

m_timeout_id = m_plugin_adaptor->RegisterRepeatingTimeout(
ADVERTISTMENT_PERIOD_MS,
ADVERTISEMENT_PERIOD_MS,
NewCallback(this, &SandNetDevice::SendAdvertisement));

return true;
Expand Down
4 changes: 2 additions & 2 deletions plugins/sandnet/SandNetDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class SandNetDevice: public ola::Device {
static const char SANDNET_DEVICE_NAME[];
// the number of input ports to create
static const unsigned int INPUT_PORTS = 8;
// send an advertistment every 2s.
static const int ADVERTISTMENT_PERIOD_MS = 2000;
// send an advertisement every 2s.
static const int ADVERTISEMENT_PERIOD_MS = 2000;
};
} // namespace sandnet
} // namespace plugin
Expand Down
10 changes: 6 additions & 4 deletions plugins/uartdmx/UartDmxPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ string UartDmxPlugin::Description() const {
"\n"
"enabled = true\n"
"Enable this plugin (DISABLED by default).\n"
"device = /dev/ttyACM0\n"
"The device to use for DMX output (optional). Multiple devices are supported "
"if the hardware exists. Using USB-serial adapters is not supported (try the "
"ftdidmx plugin instead).\n"
"device = /dev/ttyAMA0\n"
"The device to use for DMX output (optional). Multiple devices are \n"
"supported if the hardware exists.\n"
"On later software it may also be /dev/serial0.\n"
"Using USB-serial adapters is not supported (try the ftdidmx plugin \n"
"instead).\n"
"--- Per Device Settings (using above device name) ---\n"
"<device>-break = 100\n"
"The DMX break time in microseconds for this device (optional).\n"
Expand Down

0 comments on commit 30ea4d2

Please sign in to comment.