Skip to content

Commit

Permalink
update boost to 1.78 #49
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejiang committed Dec 18, 2021
1 parent 2955cc9 commit a6e9a88
Show file tree
Hide file tree
Showing 21 changed files with 5,896 additions and 4,010 deletions.
2 changes: 1 addition & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ boost_sys_objs=${boost_sys_src:.cpp=.o}
boost_fs_src=${wildcard boost/libs/filesystem/src/*.cpp}
boost_fs_objs=${boost_fs_src:.cpp=.o}

PKG_CPPFLAGS =-DROUT -I../inst/include -DBOOST_NO_AUTO_PTR
PKG_CPPFLAGS =-DROUT -I../inst/include -DBOOST_NO_AUTO_PTR -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_FILESYSTEM_SINGLE_THREADED #the last to flagsare needed to compile bundled boost file system library 1.78

cytolib_src=${wildcard *.cpp}
cytolib_objs=${cytolib_src:.cpp=.o}
Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ boost_sys_objs=${boost_sys_src:.cpp=.o}
boost_fs_src=${wildcard boost/libs/filesystem/src/*.cpp}
boost_fs_objs=${boost_fs_src:.cpp=.o}

PKG_CPPFLAGS =-DROUT -I../inst/include -DRCPP_PARALLEL_USE_TBB=1 -fpermissive -DBOOST_NO_AUTO_PTR
PKG_CPPFLAGS =-DROUT -I../inst/include -DRCPP_PARALLEL_USE_TBB=1 -fpermissive -DBOOST_NO_AUTO_PTR -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_FILESYSTEM_SINGLE_THREADED


#needs to wrap in $(shell) to strip the quotes returned by rhdf5lib::pkgconfig
Expand Down
9 changes: 8 additions & 1 deletion src/boost/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
source files are copied from boost_1_75
source files are copied from boost_1_78
extraction file system module from boost:
download boost_1_78
./bootstrap.sh
./b2 tools/bcp
mkdir foo
./dist/bin/bcp boost/filesystem foo/

(portion of submodules extracted by bcp xxx ./foo, can's use build files from bcp since it doesn't work somehow)
compiles with the headers from BH package
32 changes: 32 additions & 0 deletions src/boost/libs/filesystem/src/atomic_ref.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// atomic.hpp ------------------------------------------------------------------------//

// Copyright 2021 Andrey Semashev

// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt

// See library home page at http://www.boost.org/libs/filesystem

//--------------------------------------------------------------------------------------//

#ifndef BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_
#define BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_

#include <boost/filesystem/config.hpp>

#if !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)

#include <atomic>

namespace atomic_ns = std;

#else // !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)

#include <boost/memory_order.hpp>
#include <boost/atomic/atomic_ref.hpp>

namespace atomic_ns = boost;

#endif // !defined(BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF)

#endif // BOOST_FILESYSTEM_SRC_ATOMIC_REF_HPP_
69 changes: 69 additions & 0 deletions src/boost/libs/filesystem/src/atomic_tools.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// atomic_tools.hpp ------------------------------------------------------------------//

// Copyright 2021 Andrey Semashev

// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt

// See library home page at http://www.boost.org/libs/filesystem

//--------------------------------------------------------------------------------------//

#ifndef BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_
#define BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_

#include <boost/filesystem/config.hpp>

#if !defined(BOOST_FILESYSTEM_SINGLE_THREADED)

#include "atomic_ref.hpp"

namespace boost {
namespace filesystem {
namespace detail {

//! Atomically loads the value
template< typename T >
BOOST_FORCEINLINE T atomic_load_relaxed(T& a)
{
return atomic_ns::atomic_ref< T >(a).load(atomic_ns::memory_order_relaxed);
}

//! Atomically stores the value
template< typename T >
BOOST_FORCEINLINE void atomic_store_relaxed(T& a, T val)
{
atomic_ns::atomic_ref< T >(a).store(val, atomic_ns::memory_order_relaxed);
}

} // namespace detail
} // namespace filesystem
} // namespace boost

#else // !defined(BOOST_FILESYSTEM_SINGLE_THREADED)

namespace boost {
namespace filesystem {
namespace detail {

//! Atomically loads the value
template< typename T >
BOOST_FORCEINLINE T atomic_load_relaxed(T const& a)
{
return a;
}

//! Atomically stores the value
template< typename T >
BOOST_FORCEINLINE void atomic_store_relaxed(T& a, T val)
{
a = val;
}

} // namespace detail
} // namespace filesystem
} // namespace boost

#endif // !defined(BOOST_FILESYSTEM_SINGLE_THREADED)

#endif // BOOST_FILESYSTEM_SRC_ATOMIC_TOOLS_HPP_
75 changes: 41 additions & 34 deletions src/boost/libs/filesystem/src/codecvt_error_category.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,65 +13,72 @@

#include <boost/config/warning_disable.hpp>

#include <boost/filesystem/config.hpp>
#include <boost/filesystem/path_traits.hpp>
#include <boost/system/error_code.hpp>
#include <locale>
#include <string>
#include <vector>
#include <cstdlib>
#include <cassert>

//--------------------------------------------------------------------------------------//

namespace
namespace boost {
namespace filesystem {

namespace {

class codecvt_error_cat BOOST_FINAL :
public boost::system::error_category
{
public:
#if !defined(BOOST_CLANG) || __clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ > 8)
BOOST_DEFAULTED_FUNCTION(codecvt_error_cat(), {})
#else
// clang up to version 3.8 requires a user-defined default constructor in order to be able to declare a static constant of the error category.
codecvt_error_cat() {}
#endif
const char* name() const BOOST_SYSTEM_NOEXCEPT BOOST_OVERRIDE;
std::string message(int ev) const BOOST_OVERRIDE;
};

const char* codecvt_error_cat::name() const BOOST_SYSTEM_NOEXCEPT
{
class codecvt_error_cat : public boost::system::error_category
{
public:
codecvt_error_cat(){}
const char* name() const BOOST_SYSTEM_NOEXCEPT BOOST_OVERRIDE;
std::string message(int ev) const BOOST_OVERRIDE;
};

const char* codecvt_error_cat::name() const BOOST_SYSTEM_NOEXCEPT
{
return "codecvt";
}
}

std::string codecvt_error_cat::message(int ev) const
{
std::string codecvt_error_cat::message(int ev) const
{
std::string str;
switch (ev)
{
case std::codecvt_base::ok:
str = "ok";
break;
str = "ok";
break;
case std::codecvt_base::partial:
str = "partial";
break;
str = "partial";
break;
case std::codecvt_base::error:
str = "error";
break;
str = "error";
break;
case std::codecvt_base::noconv:
str = "noconv";
break;
str = "noconv";
break;
default:
str = "unknown error";
str = "unknown error";
break;
}
return str;
}
}

} // unnamed namespace

namespace boost
BOOST_FILESYSTEM_DECL boost::system::error_category const& codecvt_error_category()
{
namespace filesystem
{

BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category()
{
static const codecvt_error_cat codecvt_error_cat_const;
return codecvt_error_cat_const;
}
static const codecvt_error_cat codecvt_error_cat_const;
return codecvt_error_cat_const;
}

} // namespace filesystem
} // namespace filesystem
} // namespace boost
Loading

0 comments on commit a6e9a88

Please sign in to comment.