Skip to content

0.12-devel to be C++11-only #569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 36 commits into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a370594
Run clang-tidy with all checks.
deanberris Oct 28, 2015
44bd36b
Manual changes to update style and fix breakages
deanberris Oct 28, 2015
5f6e9ee
Changes to make things build
deanberris Oct 31, 2015
7b88a41
Reintroduce missing code for parsing query maps
deanberris Oct 31, 2015
6349c11
clang-tidy modernize-.* all the things
deanberris Nov 2, 2015
6d8879c
Upgrade travis config
deanberris Nov 2, 2015
65a0e6e
Fix typo in URL
deanberris Nov 2, 2015
feec209
Fix another typo on the URL.
deanberris Nov 2, 2015
4847865
Make travis wait for a Boost build to finish
deanberris Nov 2, 2015
e19af74
Change level of travis_wait call; chmod +x .sh files
deanberris Nov 2, 2015
abe68b4
Only support Boost 1.59 for now.
deanberris Nov 2, 2015
b10dfbb
Only produce shared+multithreaded debug & release boost libs
deanberris Nov 2, 2015
8cb4c16
Looks like we need static libs too
deanberris Nov 2, 2015
198dd07
Integrate travis; Use Boost 1.57 at least; Always use shared libs fro…
deanberris Nov 2, 2015
f6c7ee6
Use the dynamic version of Boost.Test always.
deanberris Nov 2, 2015
de7c710
Use v4 again instead of just address
deanberris Nov 4, 2015
39a2705
v4() for real this time
deanberris Nov 4, 2015
2e3340f
Change test to fetch different targets
deanberris Nov 12, 2015
7e0f93e
Simplify http test
deanberris Nov 12, 2015
552401b
Use ninja-build
deanberris Nov 12, 2015
19beafb
Update cmake
deanberris Nov 12, 2015
99f6168
Use updated cmake to support ninja-build
deanberris Nov 12, 2015
937d589
Travis cannot handle ninja builds yet, probably to lack of resources …
deanberris Nov 12, 2015
d5ec24e
j4 is too much. :(
deanberris Nov 12, 2015
d661fcc
Check with the sanitizers
deanberris Nov 12, 2015
5751338
Honor the CMAKE_CXX_FLAGS environment variable
deanberris Nov 12, 2015
511dd04
Print latest log properly
deanberris Nov 12, 2015
9fbc300
Fix some issues with the (deprecated) synchronous client implementati…
deanberris Nov 16, 2015
2f2239c
Only use libc++ if in OS X
deanberris Nov 16, 2015
4be4eae
Issue identified with memory sanitizer
deanberris Nov 16, 2015
600daff
Fix unsafe usage of boost::as_literal, caught by memory sanitiser
deanberris Nov 16, 2015
03870ca
Force use of size_t in distance calculation
deanberris Nov 16, 2015
9bad07c
Removing noexcept from defaulted move constructor
deanberris Nov 18, 2015
2f2c021
Track origins for memsan runs
deanberris Nov 18, 2015
7f70dac
Exclude msan builds from g++
deanberris Nov 18, 2015
8a8279a
Do not use msan yet; Boost seems to be not msan-clean
deanberris Nov 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ libs/mime/test/mime-roundtrip
*.a
_build
/.project
build/
106 changes: 56 additions & 50 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,61 @@
language:
- cpp

sudo: false
language: cpp
compiler:
- gcc
- clang

- g++
- clang
env:
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"

before_install:
- if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then
sudo add-apt-repository ppa:boost-latest/ppa --yes;
sudo apt-get update;
fi
- if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then
svn export http://svn.boost.org/svn/boost/tags/release/Boost_${BOOST_VER//./_} ../boost_${BOOST_VER//./_};
export BOOST_ROOT=$TRAVIS_BUILD_DIR/../boost_${BOOST_VER//./_};
fi

- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
# Support the sanitizers in clang only
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
#- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2"
matrix:
exclude:
- compiler: g++
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
- compiler: g++
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
# - compiler: g++
# env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2"
install:
- if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then
sudo apt-get install libboost${BOOST_VER/%.0/}-all-dev;
fi
- if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then
cd $BOOST_ROOT;
./bootstrap.sh --with-toolset=$CC;
./b2 -j4 --stagedir=.;
cd -;
fi

- mkdir -p ${HOME}/bin
- if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++;
ln -s `which gcc-4.8` ${HOME}/bin/gcc; fi
- if [ "${CC}" = "clang" ]; then export TOOLSET="clang"; ln -s `which clang-3.6` ${HOME}/bin/clang;
ln -s `which clang++-3.6` ${HOME}/bin/clang++; fi
- export BOOST_VERSION=${BOOST_VER//./_}
- export PATH=${HOME}/bin:${PATH}
- travis_wait ./install-boost.sh
- export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_}
- "${CXX} --version"
cache:
directories:
- "${HOME}/${CC}-boost_${BOOST_VER//./_}"
script:
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
-DCPP-NETLIB_ENABLE_HTTPS=${ENABLE_HTTPS}
- make
- make test

- pwd
- sh -x build.sh
after_failure:
- cat Testing/Temporary/LastTest.log
- cat build/Testing/Temporary/LastTest.log
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
- kalakris-cmake
packages:
- gcc-4.8
- g++-4.8
- clang-3.6
- cmake
notifications:
slack:
secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU=
2 changes: 1 addition & 1 deletion .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'-Wall',
'-Wextra',
'-Werror',
'-std=c++03',
'-std=c++11',
'-isystem',
'.',
'-isystem',
Expand Down
28 changes: 16 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,25 @@ if(NOT IS_ABSOLUTE "${INSTALL_CMAKE_DIR}")
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}")
endif()


if(CPP-NETLIB_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
message (STATUS "Linking boost testing libs dynamically...")
set(Boost_USE_STATIC_LIBS OFF)
set(CPP-NETLIB_BUILD_SHARED_LIBS ON)
set(BUILD_SHARED_LIBS ON)
add_definitions(-DBOOST_TEST_DYN_LINK)
else()
set(Boost_USE_STATIC_LIBS ON)
set(CPP-NETLIB_BUILD_SHARED_LIBS OFF)
set(BUILD_SHARED_LIBS OFF)
endif()

# Always use Boost's shared libraries.
set(Boost_USE_STATIC_LIBS OFF)

# We need this for all tests to use the dynamic version.
add_definitions(-DBOOST_TEST_DYN_LINK)

# Always use multi-threaded Boost libraries.
set(Boost_USE_MULTI_THREADED ON)
find_package( Boost 1.54.0

find_package( Boost 1.57.0
REQUIRED unit_test_framework system regex date_time thread filesystem
program_options chrono atomic )

Expand All @@ -67,15 +71,15 @@ if (OPENSSL_FOUND)
endif()

if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
# Use C++11 when using GNU compilers.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11")
elseif (${CMAKE_CXX_COMPILER_ID} MATCHES Clang)
# We want to link in C++11 mode in Clang too, but also set a high enough
# template depth for the template metaprogramming.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# We want to link in C++11 mode if we're using Clang and on OS X.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256 -std=c++11 -stdlib=libc++")
else()
# We just add the -Wall and a high enough template depth
# flag for Clang in other systems.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -ftemplate-depth=256")
# Use libc++ only in OS X.
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
endif()

Expand Down
42 changes: 19 additions & 23 deletions boost/mime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
#ifndef _BOOST_MIME_HPP
#define _BOOST_MIME_HPP

#include <iosfwd>
#include <list>
#include <string>
#include <vector>
#include <iosfwd>

#include <boost/spirit/include/qi.hpp>
#include <boost/fusion/adapted/struct.hpp>
#include <boost/fusion/include/std_pair.hpp>
#include <boost/spirit/include/phoenix.hpp> // pulls in all of Phoenix
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/support_istream_iterator.hpp>
#include <boost/fusion/adapted/struct.hpp>

#include <boost/shared_ptr.hpp>
#include <boost/format.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>

// #define DUMP_MIME_DATA 1

Expand Down Expand Up @@ -321,7 +321,8 @@ static void read_multipart_body(Iterator &begin, Iterator end,
"= %d %s") %
mp_body.body_prolog.size() % mp_body.sub_parts.size() %
mp_body.body_epilog.size() %
(mp_body.prolog_is_missing ? "(missing)" : "")) << std::endl;
(mp_body.prolog_is_missing ? "(missing)" : ""))
<< std::endl;
std::cout << std::endl << "****** Multipart Body Prolog *******" << std::endl;
std::copy(mp_body.body_prolog.begin(), mp_body.body_prolog.end(),
std::ostream_iterator<char>(std::cout));
Expand Down Expand Up @@ -381,11 +382,7 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
template <class traits = detail::default_types>
class basic_mime {
public:
typedef enum {
simple_part,
multi_part,
message_part
} part_kind;
typedef enum { simple_part, multi_part, message_part } part_kind;
// Types for headers
typedef typename traits::string_type string_type;
typedef std::pair<std::string, string_type> headerEntry;
Expand Down Expand Up @@ -618,8 +615,7 @@ class basic_mime {
std::string boundary;
try {
boundary = detail::get_boundary(get_content_type_header());
}
catch (std::runtime_error &) {
} catch (std::runtime_error &) {
// FIXME: Make boundary strings (more?) unique
boundary = str(boost::format("------=_NextPart-%s.%08ld") %
detail::k_package_name % std::clock());
Expand Down Expand Up @@ -707,9 +703,8 @@ class basic_mime {
else if (get_part_kind() == multi_part) {
if (idx >= m_subparts.size())
throw std::runtime_error(
str(boost::format(
"Trying to access part %d (of %d) sub-part to a "
"multipart/xxx mime part") %
str(boost::format("Trying to access part %d (of %d) sub-part to a "
"multipart/xxx mime part") %
idx % m_subparts.size()));
} else { // message-part
if (get_part_kind() == message_part)
Expand All @@ -720,9 +715,8 @@ class basic_mime {

if (idx >= m_subparts.size())
throw std::runtime_error(
str(boost::format(
"Trying to access part %d (of %d) sub-part to a "
"message/xxx mime part") %
str(boost::format("Trying to access part %d (of %d) sub-part to a "
"message/xxx mime part") %
idx % m_subparts.size()));
}
}
Expand Down Expand Up @@ -764,12 +758,14 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
#ifdef DUMP_MIME_DATA
std::cout << "Content-Type: " << content_type << std::endl;
std::cout << str(boost::format("retVal->get_part_kind () = %d") %
((int)retVal->get_part_kind())) << std::endl;
((int)retVal->get_part_kind()))
<< std::endl;
#endif

if (retVal->get_part_kind() == mime_part::simple_part)
retVal->set_body(detail::read_simplepart_body<
typename mime_part::bodyContainer, Iterator>(begin, end));
retVal->set_body(
detail::read_simplepart_body<typename mime_part::bodyContainer,
Iterator>(begin, end));
else if (retVal->get_part_kind() == mime_part::message_part) {
// If we've got a message/xxxx, then there is no body, and we have
// a single
Expand Down
6 changes: 3 additions & 3 deletions boost/network.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef __NETWORK_HPP__
#define __NETWORK_HPP__
#ifndef BOOST_NETWORK_HPP__
#define BOOST_NETWORK_HPP__

// Include all headers in network/
// Author: Dean Michael Berris
Expand All @@ -14,4 +14,4 @@
#include <boost/network/message.hpp> // message type implementation
#include <boost/network/protocol.hpp> // protocols implementation

#endif // __NETWORK_HPP__
#endif // BOOST_NETWORK_HPP__
4 changes: 2 additions & 2 deletions boost/network/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#include <boost/mpl/if.hpp>
#include <boost/network/support/is_default_string.hpp>
#include <boost/network/support/is_default_wstring.hpp>
#include <boost/mpl/if.hpp>

namespace boost {
namespace network {
Expand Down Expand Up @@ -124,7 +124,7 @@ struct constants_wide {
return https_;
}
};
}
} // namespace impl

template <class Tag>
struct constants
Expand Down
11 changes: 7 additions & 4 deletions boost/network/detail/directive_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
#define __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__

#include <boost/network/message_fwd.hpp>

/** Defines the base type from which all directives inherit
* to allow friend access to message and other types' internals.
*/
Expand All @@ -17,12 +19,13 @@ namespace detail {
template <class Tag>
struct directive_base {
typedef Tag tag;
// explicit directive_base(basic_message<tag> & message_)
// : _message(message_)
explicit directive_base(basic_message<tag> & message)
: message_(message) {}

protected:
~directive_base() {}; // can only be extended
~directive_base() = default; // can only be extended

// mutable basic_message<tag> & _message;
basic_message<tag> & message_;
};

} // namespace detail
Expand Down
6 changes: 2 additions & 4 deletions boost/network/detail/wrapper_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ struct wrapper_base {
explicit wrapper_base(Message& message_) : _message(message_) {};

protected:
~wrapper_base() {}; // for extending only

~wrapper_base() = default; // for extending only
Message& _message;
};

Expand All @@ -27,8 +26,7 @@ struct wrapper_base_const {
explicit wrapper_base_const(Message const& message_) : _message(message_) {}

protected:
~wrapper_base_const() {}; // for extending only

~wrapper_base_const() = default; // for extending only
Message const& _message;
};

Expand Down
Loading