Skip to content

Commit

Permalink
Enabled -std=c++11 option if compiler supported
Browse files Browse the repository at this point in the history
  • Loading branch information
Kazuki OIKAWA committed Mar 18, 2016
1 parent da5520f commit c615d6b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 26 deletions.
10 changes: 4 additions & 6 deletions jubatus/util/data/serialization/tr1_unordered_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
#ifndef JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_MAP_H_
#define JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_MAP_H_

#if defined(__GLIBCXX__) && __cplusplus < 201103

#include "base.h"

#include <utility> // Include a lightweight header for __GLIBCXX__.
#ifdef __GLIBCXX__
#include <tr1/unordered_map>
#endif

#include "pair.h"

Expand All @@ -46,8 +46,6 @@ namespace util{
namespace data{
namespace serialization{

#ifdef __GLIBCXX__

template <class Archive, class K, class V, class H, class P, class A>
void serialize(Archive &ar, std::tr1::unordered_map<K, V, H, P, A> &m)
{
Expand All @@ -71,10 +69,10 @@ void serialize(Archive &ar, std::tr1::unordered_map<K, V, H, P, A> &m)
}
}

#endif

} // serialization
} // data
} // util
} // jubatus

#endif // #if defined(__GLIBCXX__) && __cplusplus < 201103
#endif // #ifndef JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_MAP_H_
10 changes: 4 additions & 6 deletions jubatus/util/data/serialization/tr1_unordered_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
#ifndef JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_SET_H_
#define JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_SET_H_

#if defined(__GLIBCXX__) && __cplusplus < 201103

#include "base.h"

#include <utility> // include a lightweight header for __GLIBCXX__.
#ifdef __GLIBCXX__
#include <tr1/unordered_set>
#endif

#include "pair.h"

Expand All @@ -46,8 +46,6 @@ namespace util{
namespace data{
namespace serialization{

#ifdef __GLIBCXX__

template <class Archive, class T, class H, class P, class A>
void serialize(Archive &ar, std::tr1::unordered_set<T, H, P, A> &s)
{
Expand All @@ -71,10 +69,10 @@ void serialize(Archive &ar, std::tr1::unordered_set<T, H, P, A> &s)
}
}

#endif

} // serialization
} // data
} // util
} // jubatus

#endif // #if defined(__GLIBCXX__) && __cplusplus < 201103
#endif // #ifndef JUBATUS_UTIL_DATA_SERIALIZATION_TR1_UNORDERED_SET_H_
8 changes: 4 additions & 4 deletions jubatus/util/data/serialization_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@

#include "jubatus/util/util-config.h"

#if HAVE_TR1_UNORDERED_MAP
#if !HAVE_UNORDERED_MAP && HAVE_TR1_UNORDERED_MAP
#include "./serialization/tr1_unordered_map.h"
#endif

#if HAVE_TR1_UNORDERED_SET
#if !HAVE_UNORDERED_SET && HAVE_TR1_UNORDERED_SET
#include "./serialization/tr1_unordered_set.h"
#endif

Expand Down Expand Up @@ -302,7 +302,7 @@ TEST(serialization, string) {
for (string::iterator it=vs1.begin(),jt=vs2.begin();it!=vs1.end();++it,++jt) EXPECT_EQ(*it,*jt);
}

#if HAVE_TR1_UNORDERED_MAP
#if !HAVE_UNORDERED_MAP && HAVE_TR1_UNORDERED_MAP

TEST(serialization, tr1_unordered_map) {
srandom(time(NULL));
Expand Down Expand Up @@ -348,7 +348,7 @@ TEST(serialization, pficommon_unordered_map){
}
}

#if HAVE_TR1_UNORDERED_SET
#if !HAVE_UNORDERED_SET && HAVE_TR1_UNORDERED_SET

TEST(serialization, tr1_unordered_set) {
srandom(time(NULL));
Expand Down
4 changes: 2 additions & 2 deletions jubatus/util/lang/enable_shared_from_this.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define JUBATUS_UTIL_LANG_ENABLE_SHARED_FROM_THIS_H_

#include <memory>
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
#include <tr1/memory>
#endif
#include "shared_ptr.h"
Expand All @@ -43,7 +43,7 @@ namespace util {
namespace lang {

namespace detail {
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
namespace enable_shared_from_this_ns = ::std::tr1;
#else
namespace enable_shared_from_this_ns = ::std;
Expand Down
4 changes: 2 additions & 2 deletions jubatus/util/lang/function.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define JUBATUS_UTIL_LANG_FUNCTION_H_

#include <functional>
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
#include <tr1/functional>
#endif

Expand All @@ -42,7 +42,7 @@ namespace util {
namespace lang {

namespace detail {
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
namespace function_ns = ::std::tr1;
#else
namespace function_ns = ::std;
Expand Down
4 changes: 2 additions & 2 deletions jubatus/util/lang/ref.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define JUBATUS_UTIL_LANG_REF_H_

#include <functional>
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
#include <tr1/functional>
#endif

Expand All @@ -42,7 +42,7 @@ namespace util {
namespace lang {

namespace detail {
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
namespace ref_ns = ::std::tr1;
#else
namespace ref_ns = ::std;
Expand Down
4 changes: 2 additions & 2 deletions jubatus/util/lang/shared_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <exception>
#include <memory>
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
#include <tr1/memory>
#endif

Expand Down Expand Up @@ -64,7 +64,7 @@ template <class T>
class enable_shared_from_this;

namespace detail {
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
namespace shared_ptr_ns = ::std::tr1;
#else
namespace shared_ptr_ns = ::std;
Expand Down
4 changes: 2 additions & 2 deletions jubatus/util/lang/weak_ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#define JUBATUS_UTIL_LANG_WEAK_PTR_H_

#include <memory>
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
#include <tr1/memory>
#endif

Expand All @@ -42,7 +42,7 @@ namespace util {
namespace lang {

namespace detail {
#ifdef __GLIBCXX__
#if defined(__GLIBCXX__) && __cplusplus < 201103
namespace weak_ptr_ns = ::std::tr1;
#else
namespace weak_ptr_ns = ::std;
Expand Down
3 changes: 3 additions & 0 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def configure(conf):

conf.check_cxx(lib = 'msgpack')

if conf.check_cxx(cxxflags='-std=c++11', mandatory=False):
env.append_unique('CXXFLAGS', ['-std=c++11', '-Wno-deprecated-declarations'])

if Options.options.debug:
conf.define('_GLIBCXX_DEBUG', 1)
else:
Expand Down

0 comments on commit c615d6b

Please sign in to comment.