Skip to content

Commit

Permalink
Fix bootstrap on FreeBSD w/clang.
Browse files Browse the repository at this point in the history
  • Loading branch information
grafikrobot committed Aug 19, 2023
1 parent 4072ec8 commit b422d4f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/engine/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ check_toolset ()
if test_toolset gcc && test_compiler g++$TOOLSET_SUFFIX -x c++ -std=c++11 -D_GNU_SOURCE ; then B2_TOOLSET=gcc$TOOLSET_SUFFIX ; return ${TRUE} ; fi
# GCC (gcc) with -pthread arg (for AIX)..
if test_toolset gcc && test_compiler g++$TOOLSET_SUFFIX -x c++ -std=c++11 -pthread ; then B2_TOOLSET=gcc$TOOLSET_SUFFIX ; return ${TRUE} ; fi
# Clang (clang) on FreeBSD needs -pthread arg..
if test_toolset clang && test_uname FreeBSD && test_compiler clang++$TOOLSET_SUFFIX -x c++ -std=c++11 -pthread ; then B2_TOOLSET=clang$TOOLSET_SUFFIX ; return ${TRUE} ; fi
# Clang (clang)..
if test_toolset clang && test_compiler clang++$TOOLSET_SUFFIX -x c++ -std=c++11 ; then B2_TOOLSET=clang$TOOLSET_SUFFIX ; return ${TRUE} ; fi
# Intel macOS (intel-darwin)
Expand Down
42 changes: 28 additions & 14 deletions src/engine/check_cxx11.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Copyright 2020 Rene Rivera
/* Copyright 2020-2023 Rene Rivera
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
* (See accompanying file LICENSE.txt or
* https://www.bfgroup.xyz/b2/LICENSE.txt)
*/

/*
Expand All @@ -11,23 +12,36 @@ compiler to build the engine with.
*/

// Some headers we test...
#include <thread>
#include <memory>
#include <mutex>
#include <thread>

// Some basic constexpr support?
template <int C> struct X { static constexpr int c = C; };
template <int C>
struct X
{
static constexpr int c = C;
};

int main()
{
// Check for basic thread calls.
// [2020-08-19] Mingw-w64 with win32 threading model (as opposed to posix
// threading model) does not really have std::thread etc. Please see comments
// in sysinfo.cpp.
#ifndef _WIN32
{ auto _ = std::thread::hardware_concurrency(); }
#endif
#ifndef _WIN32
// Check for basic thread calls.
// [2020-08-19] Mingw-w64 with win32 threading model (as opposed to posix
// threading model) does not really have std::thread etc. Please see
// comments in sysinfo.cpp.
{
auto _ = std::thread::hardware_concurrency();
}
{
std::mutex m;
std::lock_guard<std::mutex> l(m);
}
#endif

// [2021-08-07] We check the following C++11 features: brace initialization,
// unique_ptr. Plus the author's ability to memorize some digits.
{ const std::unique_ptr <float> pf {new float {3.14159f}}; }
// [2021-08-07] We check the following C++11 features: brace initialization,
// unique_ptr. Plus the author's ability to memorize some digits.
{
const std::unique_ptr<float> pf { new float { 3.14159f } };
}
}

0 comments on commit b422d4f

Please sign in to comment.