Skip to content

Commit fb210e7

Browse files
committed
Merge pull request cpp-netlib#569 from deanberris/0.11-devel-cpp11-upgrade
0.12-devel to be C++11-only
2 parents 9bcbde7 + 8a8279a commit fb210e7

File tree

163 files changed

+1499
-1328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1499
-1328
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ libs/mime/test/mime-roundtrip
1010
*.a
1111
_build
1212
/.project
13+
build/

.travis.yml

+56-50
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,61 @@
1-
language:
2-
- cpp
3-
1+
sudo: false
2+
language: cpp
43
compiler:
5-
- gcc
6-
- clang
7-
4+
- g++
5+
- clang
86
env:
9-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
10-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
11-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
12-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
13-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
14-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
15-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
16-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
17-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
18-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
19-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
20-
- BOOST_VER=1.54.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
21-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
22-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
23-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
24-
- BOOST_VER=1.55.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
25-
26-
before_install:
27-
- if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then
28-
sudo add-apt-repository ppa:boost-latest/ppa --yes;
29-
sudo apt-get update;
30-
fi
31-
- if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then
32-
svn export http://svn.boost.org/svn/boost/tags/release/Boost_${BOOST_VER//./_} ../boost_${BOOST_VER//./_};
33-
export BOOST_ROOT=$TRAVIS_BUILD_DIR/../boost_${BOOST_VER//./_};
34-
fi
35-
7+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
8+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
9+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
10+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="ON" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
11+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="ON"
12+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Release" ENABLE_HTTPS="OFF"
13+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON"
14+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="OFF"
15+
# Support the sanitizers in clang only
16+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
17+
- BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
18+
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
19+
#- 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"
20+
matrix:
21+
exclude:
22+
- compiler: g++
23+
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=thread"
24+
- compiler: g++
25+
env: BOOST_VER=1.59.0 BUILD_SHARED_LIBS="OFF" CMAKE_BUILD_TYPE="Debug" ENABLE_HTTPS="ON" CMAKE_CXX_FLAGS="-fsanitize=address"
26+
# TODO(deanberris): It seems Boost is not msan-clean yet; report bugs and maybe fix?
27+
# - compiler: g++
28+
# 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"
3629
install:
37-
- if [ "${CXX}" == "g++" ] || [ ${BUILD_SHARED_LIBS} = "OFF" ]; then
38-
sudo apt-get install libboost${BOOST_VER/%.0/}-all-dev;
39-
fi
40-
- if [ "${CXX}" == "clang++" ] && [ ${BUILD_SHARED_LIBS} = "ON" ]; then
41-
cd $BOOST_ROOT;
42-
./bootstrap.sh --with-toolset=$CC;
43-
./b2 -j4 --stagedir=.;
44-
cd -;
45-
fi
46-
30+
- mkdir -p ${HOME}/bin
31+
- if [ "${CC}" = "gcc" ]; then export TOOLSET="gcc"; ln -s `which g++-4.8` ${HOME}/bin/g++;
32+
ln -s `which gcc-4.8` ${HOME}/bin/gcc; fi
33+
- if [ "${CC}" = "clang" ]; then export TOOLSET="clang"; ln -s `which clang-3.6` ${HOME}/bin/clang;
34+
ln -s `which clang++-3.6` ${HOME}/bin/clang++; fi
35+
- export BOOST_VERSION=${BOOST_VER//./_}
36+
- export PATH=${HOME}/bin:${PATH}
37+
- travis_wait ./install-boost.sh
38+
- export BOOST_ROOT=${HOME}/${CC}-boost_${BOOST_VER//./_}
39+
- "${CXX} --version"
40+
cache:
41+
directories:
42+
- "${HOME}/${CC}-boost_${BOOST_VER//./_}"
4743
script:
48-
- cmake -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
49-
-DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}
50-
-DCPP-NETLIB_ENABLE_HTTPS=${ENABLE_HTTPS}
51-
- make
52-
- make test
53-
44+
- pwd
45+
- sh -x build.sh
5446
after_failure:
55-
- cat Testing/Temporary/LastTest.log
47+
- cat build/Testing/Temporary/LastTest.log
48+
addons:
49+
apt:
50+
sources:
51+
- ubuntu-toolchain-r-test
52+
- llvm-toolchain-precise-3.6
53+
- kalakris-cmake
54+
packages:
55+
- gcc-4.8
56+
- g++-4.8
57+
- clang-3.6
58+
- cmake
59+
notifications:
60+
slack:
61+
secure: Y7lLjqZ83+b/jaJ5+EKwvgCDeERi4bVbDn9tLp8sieTdu+ENsPI+JmLYSXZXPpe7JrItrXW6uJJXN2wG1h7au4mpVVTghd31HBzuzrqVxDphWPhp16NYzvbAgQQRBXvFVvfSdW/Kb/n2fX6xDApY0t6vNREb/GKg0GyzESb4ZjU=

.ycm_extra_conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'-Wall',
1818
'-Wextra',
1919
'-Werror',
20-
'-std=c++03',
20+
'-std=c++11',
2121
'-isystem',
2222
'.',
2323
'-isystem',

CMakeLists.txt

+16-12
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,25 @@ if(NOT IS_ABSOLUTE "${INSTALL_CMAKE_DIR}")
2727
set(INSTALL_CMAKE_DIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}")
2828
endif()
2929

30-
3130
if(CPP-NETLIB_BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS)
3231
message (STATUS "Linking boost testing libs dynamically...")
33-
set(Boost_USE_STATIC_LIBS OFF)
3432
set(CPP-NETLIB_BUILD_SHARED_LIBS ON)
3533
set(BUILD_SHARED_LIBS ON)
36-
add_definitions(-DBOOST_TEST_DYN_LINK)
3734
else()
38-
set(Boost_USE_STATIC_LIBS ON)
3935
set(CPP-NETLIB_BUILD_SHARED_LIBS OFF)
4036
set(BUILD_SHARED_LIBS OFF)
4137
endif()
4238

39+
# Always use Boost's shared libraries.
40+
set(Boost_USE_STATIC_LIBS OFF)
41+
42+
# We need this for all tests to use the dynamic version.
43+
add_definitions(-DBOOST_TEST_DYN_LINK)
44+
45+
# Always use multi-threaded Boost libraries.
4346
set(Boost_USE_MULTI_THREADED ON)
44-
find_package( Boost 1.54.0
47+
48+
find_package( Boost 1.57.0
4549
REQUIRED unit_test_framework system regex date_time thread filesystem
4650
program_options chrono atomic )
4751

@@ -67,15 +71,15 @@ if (OPENSSL_FOUND)
6771
endif()
6872

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

boost/mime.hpp

+19-23
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
#ifndef _BOOST_MIME_HPP
1010
#define _BOOST_MIME_HPP
1111

12+
#include <iosfwd>
1213
#include <list>
1314
#include <string>
1415
#include <vector>
15-
#include <iosfwd>
1616

17-
#include <boost/spirit/include/qi.hpp>
17+
#include <boost/fusion/adapted/struct.hpp>
1818
#include <boost/fusion/include/std_pair.hpp>
1919
#include <boost/spirit/include/phoenix.hpp> // pulls in all of Phoenix
20+
#include <boost/spirit/include/qi.hpp>
2021
#include <boost/spirit/include/support_istream_iterator.hpp>
21-
#include <boost/fusion/adapted/struct.hpp>
2222

23-
#include <boost/shared_ptr.hpp>
24-
#include <boost/format.hpp>
25-
#include <boost/algorithm/string/predicate.hpp>
2623
#include <boost/algorithm/string.hpp>
24+
#include <boost/algorithm/string/predicate.hpp>
25+
#include <boost/format.hpp>
26+
#include <boost/shared_ptr.hpp>
2727

2828
// #define DUMP_MIME_DATA 1
2929

@@ -321,7 +321,8 @@ static void read_multipart_body(Iterator &begin, Iterator end,
321321
"= %d %s") %
322322
mp_body.body_prolog.size() % mp_body.sub_parts.size() %
323323
mp_body.body_epilog.size() %
324-
(mp_body.prolog_is_missing ? "(missing)" : "")) << std::endl;
324+
(mp_body.prolog_is_missing ? "(missing)" : ""))
325+
<< std::endl;
325326
std::cout << std::endl << "****** Multipart Body Prolog *******" << std::endl;
326327
std::copy(mp_body.body_prolog.begin(), mp_body.body_prolog.end(),
327328
std::ostream_iterator<char>(std::cout));
@@ -381,11 +382,7 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
381382
template <class traits = detail::default_types>
382383
class basic_mime {
383384
public:
384-
typedef enum {
385-
simple_part,
386-
multi_part,
387-
message_part
388-
} part_kind;
385+
typedef enum { simple_part, multi_part, message_part } part_kind;
389386
// Types for headers
390387
typedef typename traits::string_type string_type;
391388
typedef std::pair<std::string, string_type> headerEntry;
@@ -618,8 +615,7 @@ class basic_mime {
618615
std::string boundary;
619616
try {
620617
boundary = detail::get_boundary(get_content_type_header());
621-
}
622-
catch (std::runtime_error &) {
618+
} catch (std::runtime_error &) {
623619
// FIXME: Make boundary strings (more?) unique
624620
boundary = str(boost::format("------=_NextPart-%s.%08ld") %
625621
detail::k_package_name % std::clock());
@@ -707,9 +703,8 @@ class basic_mime {
707703
else if (get_part_kind() == multi_part) {
708704
if (idx >= m_subparts.size())
709705
throw std::runtime_error(
710-
str(boost::format(
711-
"Trying to access part %d (of %d) sub-part to a "
712-
"multipart/xxx mime part") %
706+
str(boost::format("Trying to access part %d (of %d) sub-part to a "
707+
"multipart/xxx mime part") %
713708
idx % m_subparts.size()));
714709
} else { // message-part
715710
if (get_part_kind() == message_part)
@@ -720,9 +715,8 @@ class basic_mime {
720715

721716
if (idx >= m_subparts.size())
722717
throw std::runtime_error(
723-
str(boost::format(
724-
"Trying to access part %d (of %d) sub-part to a "
725-
"message/xxx mime part") %
718+
str(boost::format("Trying to access part %d (of %d) sub-part to a "
719+
"message/xxx mime part") %
726720
idx % m_subparts.size()));
727721
}
728722
}
@@ -764,12 +758,14 @@ static boost::shared_ptr<basic_mime<traits> > parse_mime(
764758
#ifdef DUMP_MIME_DATA
765759
std::cout << "Content-Type: " << content_type << std::endl;
766760
std::cout << str(boost::format("retVal->get_part_kind () = %d") %
767-
((int)retVal->get_part_kind())) << std::endl;
761+
((int)retVal->get_part_kind()))
762+
<< std::endl;
768763
#endif
769764

770765
if (retVal->get_part_kind() == mime_part::simple_part)
771-
retVal->set_body(detail::read_simplepart_body<
772-
typename mime_part::bodyContainer, Iterator>(begin, end));
766+
retVal->set_body(
767+
detail::read_simplepart_body<typename mime_part::bodyContainer,
768+
Iterator>(begin, end));
773769
else if (retVal->get_part_kind() == mime_part::message_part) {
774770
// If we've got a message/xxxx, then there is no body, and we have
775771
// a single

boost/network.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7-
#ifndef __NETWORK_HPP__
8-
#define __NETWORK_HPP__
7+
#ifndef BOOST_NETWORK_HPP__
8+
#define BOOST_NETWORK_HPP__
99

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

17-
#endif // __NETWORK_HPP__
17+
#endif // BOOST_NETWORK_HPP__

boost/network/constants.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9+
#include <boost/mpl/if.hpp>
910
#include <boost/network/support/is_default_string.hpp>
1011
#include <boost/network/support/is_default_wstring.hpp>
11-
#include <boost/mpl/if.hpp>
1212

1313
namespace boost {
1414
namespace network {
@@ -124,7 +124,7 @@ struct constants_wide {
124124
return https_;
125125
}
126126
};
127-
}
127+
} // namespace impl
128128

129129
template <class Tag>
130130
struct constants

boost/network/detail/directive_base.hpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
88
#define __NETWORK_DETAIL_DIRECTIVE_BASE_HPP__
99

10+
#include <boost/network/message_fwd.hpp>
11+
1012
/** Defines the base type from which all directives inherit
1113
* to allow friend access to message and other types' internals.
1214
*/
@@ -17,12 +19,13 @@ namespace detail {
1719
template <class Tag>
1820
struct directive_base {
1921
typedef Tag tag;
20-
// explicit directive_base(basic_message<tag> & message_)
21-
// : _message(message_)
22+
explicit directive_base(basic_message<tag> & message)
23+
: message_(message) {}
24+
2225
protected:
23-
~directive_base() {}; // can only be extended
26+
~directive_base() = default; // can only be extended
2427

25-
// mutable basic_message<tag> & _message;
28+
basic_message<tag> & message_;
2629
};
2730

2831
} // namespace detail

boost/network/detail/wrapper_base.hpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ struct wrapper_base {
1717
explicit wrapper_base(Message& message_) : _message(message_) {};
1818

1919
protected:
20-
~wrapper_base() {}; // for extending only
21-
20+
~wrapper_base() = default; // for extending only
2221
Message& _message;
2322
};
2423

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

2928
protected:
30-
~wrapper_base_const() {}; // for extending only
31-
29+
~wrapper_base_const() = default; // for extending only
3230
Message const& _message;
3331
};
3432

0 commit comments

Comments
 (0)