Commit 1402f772 authored by Luca Boccassi's avatar Luca Boccassi

Problem: no automated way to enforce C++98 compatibility

Solution: if the compiler supports it, pass C++98-compat flags.
Currently Clang supports this flag but GCC does not.

Add a new flag to enable it, as building with C++98-compat but also
with -std=gnu++11 will cause a lot of warnings due to the backward
compat ifdefs.

Add a CI job to run it and ensure we don't break compatibility.
parent f215e13a
......@@ -111,6 +111,19 @@ matrix:
os: linux
- env: BUILD_TYPE=default POLLER=select
os: linux
- env: CXX=clang++ BUILD_TYPE=default CURVE=libsodium GSSAPI=enabled PGM=enabled NORM=enabled FORCE_98=enabled
os: linux
compiler: clang
addons:
apt:
sources:
- sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/ ./'
key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/Release.key'
packages:
- libkrb5-dev
- libnorm-dev
- libpgm-dev
- libsodium-dev
sudo: false
......
......@@ -55,6 +55,11 @@
different internal implementations of the trie algorithm used to track
subscriptions. Requires a compiler that supports C++11.
* New autoconf flag "--enable-force-CXX98-compat" which will force -std=gnu++98
and, if the compiler supports them (clang++ at the moment), it will also add
-Wc++98-compat -Wc++98-compat-pedantic so that compatibility with C++98 can
be tested.
* Many, many coding style, duplication and static analysis improvements.
* Many, many improvements to the CMake build system, especially on Windows.
......
......@@ -62,6 +62,10 @@ if [ $BUILD_TYPE == "default" ]; then
CONFIG_OPTS+=("--enable-drafts=yes")
fi
if [ -n "$FORCE_98" ] && [ "$FORCE_98" == "enabled" ]; then
CONFIG_OPTS+=("--enable-force-CXX98-compat=yes")
fi
# Build and check this project
(
./autogen.sh &&
......
......@@ -58,7 +58,6 @@ ZMQ_ORIG_CXXFLAGS="${CXXFLAGS:-none}"
AC_PROG_CC
AX_CHECK_COMPILE_FLAG([-std=gnu11], [CFLAGS+=" -std=gnu11"], [AC_PROG_CC_C99])
AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11([ext], [optional])
AX_CODE_COVERAGE
AM_PROG_CC_C_O
AC_PROG_SED
......@@ -76,6 +75,17 @@ AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AX_VALGRIND_CHECK
AC_ARG_ENABLE([force-CXX98-compat],
[AS_HELP_STRING([--enable-force-CXX98-compat], [force C++98 build [default=disabled]])])
if test "x$enable_force_CXX98_compat" = "xyes"; then
AC_LANG_PUSH([C++])
AX_CHECK_COMPILE_FLAG([-std=gnu++98], [CXXFLAGS+=" -std=gnu++98"], [])
AX_CHECK_COMPILE_FLAG([-Wc++98-compat -Wc++98-compat-pedantic], [CXXFLAGS+=" -Wc++98-compat"], [])
AC_LANG_POP([C++])
else
AX_CXX_COMPILE_STDCXX_11([ext], [optional])
fi
# Check whether to build a with debug symbols
LIBZMQ_CHECK_ENABLE_DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment