Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
388 changes: 388 additions & 0 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ target_link_libraries(boost_assert
Boost::config
)

if (BOOST_USE_MODULES)
target_compile_definitions(boost_assert INTERFACE BOOST_USE_MODULES)
endif()

# Add headers and .natvis to project, for better IDE integration

if(NOT CMAKE_VERSION VERSION_LESS 3.19)
Expand Down
10 changes: 10 additions & 0 deletions include/boost/assert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID
//

// Make the header safe to include from libraries supporting modules
#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_ASSERT)
# error "Please #include <boost/assert.hpp> in your module global fragment"
#endif

// Don't include the file again in module purviews
#ifndef BOOST_IN_MODULE_PURVIEW

#undef BOOST_ASSERT
#undef BOOST_ASSERT_MSG
#undef BOOST_ASSERT_IS_VOID
Expand Down Expand Up @@ -88,4 +96,6 @@ namespace boost
# define BOOST_VERIFY(expr) BOOST_ASSERT(expr)
# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg)

#endif // BOOST_IN_MODULE_PURVIEW

#endif
15 changes: 10 additions & 5 deletions include/boost/assert/source_location.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Make the header safe to include from libraries supporting modules
#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED)
# error "Please #include <boost/assert/source_location.hpp> in your module global fragment"
#endif

#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED
#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED

Expand All @@ -9,16 +14,16 @@

#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <cstdio>
#include <cstring>
#include <boost/config/std/string.hpp>
#include <boost/config/std/cstdio.hpp>
#include <boost/config/std/cstring.hpp>

#if !defined(BOOST_NO_IOSTREAM)
#include <iosfwd>
#include <boost/config/std/iosfwd.hpp>
#endif

#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L
# include <source_location>
# include <boost/config/std/source_location.hpp>
#endif

namespace boost
Expand Down
5 changes: 5 additions & 0 deletions include/boost/current_function.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Make the header safe to include from libraries supporting modules
#if defined(BOOST_IN_MODULE_PURVIEW) && !defined(BOOST_CURRENT_FUNCTION_HPP_INCLUDED)
# error "Please #include <boost/current_function.hpp> in your module global fragment"
#endif

#ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED
#define BOOST_CURRENT_FUNCTION_HPP_INCLUDED

Expand Down
4 changes: 4 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)

if(HAVE_BOOST_TEST)

if(BOOST_USE_MODULES)
set(CMAKE_CXX_MODULE_STD ON)
endif()

boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::assert Boost::core)

endif()
2 changes: 1 addition & 1 deletion test/assert_msg_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//

#include <boost/detail/lightweight_test.hpp>
#include <stdio.h>
#include <boost/config/std/cstdio.hpp>

// default case, !NDEBUG
// BOOST_ASSERT_MSG(x) -> assert(x)
Expand Down
2 changes: 1 addition & 1 deletion test/assert_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void test_disabled()
#define BOOST_ENABLE_ASSERT_HANDLER
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <cstdio>
#include <boost/config/std/cstdio.hpp>

int handler_invoked = 0;
int msg_handler_invoked = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/assert_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//

#include <boost/detail/lightweight_test.hpp>
#include <stdio.h>
#include <boost/config/std/cstdio.hpp>

// default case, !NDEBUG
// BOOST_ASSERT(x) -> assert(x)
Expand Down
2 changes: 1 addition & 1 deletion test/check_cmake_version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <boost/core/lightweight_test.hpp>
#include <boost/version.hpp>
#include <cstdio>
#include <boost/config/std/cstdio.hpp>

int main( int ac, char const* av[] )
{
Expand Down
2 changes: 1 addition & 1 deletion test/current_function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <boost/current_function.hpp>
#include <boost/config.hpp>
#include <cstdio>
#include <boost/config/std/cstdio.hpp>

void message(char const * file, long line, char const * func, char const * msg)
{
Expand Down
2 changes: 1 addition & 1 deletion test/current_function_test2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <boost/current_function.hpp>
#include <boost/core/lightweight_test.hpp>
#include <string>
#include <boost/config/std/string.hpp>

int f()
{
Expand Down
2 changes: 1 addition & 1 deletion test/exp/assert_exp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <boost/config.hpp>
#include <boost/current_function.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <boost/config/std/string.hpp>

// Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled
static std::string quote( std::string const & s )
Expand Down
2 changes: 1 addition & 1 deletion test/exp/assert_msg_exp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <boost/config.hpp>
#include <boost/current_function.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <boost/config/std/string.hpp>

// Each backslash in __FILE__ when passed through BOOST_STRINGIZE is doubled
static std::string quote( std::string const & s )
Expand Down
2 changes: 1 addition & 1 deletion test/exp/verify_exp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <boost/config.hpp>
#include <boost/current_function.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <boost/config/std/string.hpp>

// default case, !NDEBUG
// BOOST_VERIFY(x) -> BOOST_ASSERT(x)
Expand Down
2 changes: 1 addition & 1 deletion test/exp/verify_msg_exp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <boost/config.hpp>
#include <boost/current_function.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
#include <boost/config/std/string.hpp>

// default case, !NDEBUG
// BOOST_VERIFY_MSG(x,"m") -> BOOST_ASSERT_MSG(x,"m")
Expand Down
2 changes: 1 addition & 1 deletion test/source_location_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <boost/assert/source_location.hpp>
#include <boost/core/lightweight_test.hpp>
#include <cstring>
#include <boost/config/std/cstring.hpp>

static char const* adjust_filename( char const* file )
{
Expand Down
4 changes: 2 additions & 2 deletions test/source_location_test3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#include <boost/assert/source_location.hpp>
#include <boost/core/lightweight_test.hpp>
#include <sstream>
#include <cstring>
#include <boost/config/std/sstream.hpp>
#include <boost/config/std/cstring.hpp>

static char const* adjust_filename( char const* file )
{
Expand Down
2 changes: 1 addition & 1 deletion test/source_location_test4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <boost/assert/source_location.hpp>
#include <boost/core/lightweight_test.hpp>
#include <boost/config.hpp>
#include <cstring>
#include <boost/config/std/cstring.hpp>

static char const* adjust_filename( char const* file )
{
Expand Down
2 changes: 1 addition & 1 deletion test/source_location_test5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <boost/assert/source_location.hpp>
#include <boost/core/lightweight_test.hpp>
#include <exception>
#include <boost/config/std/exception.hpp>

template<class T> class result
{
Expand Down
2 changes: 1 addition & 1 deletion test/verify_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void test_disabled()
#define BOOST_ENABLE_ASSERT_HANDLER
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <cstdio>
#include <boost/config/std/cstdio.hpp>

int handler_invoked = 0;

Expand Down
15 changes: 15 additions & 0 deletions tools/install-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#
# Copyright (c) 2026 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#

set -e

wget https://github.com/Kitware/CMake/releases/download/v4.2.3/cmake-4.2.3-linux-x86_64.tar.gz
tar -xf cmake-4.2.3-linux-x86_64.tar.gz
mv cmake-4.2.3-linux-x86_64 /opt/cmake
update-alternatives --install /usr/bin/cmake cmake /opt/cmake/bin/cmake 100
update-alternatives --install /usr/bin/ctest ctest /opt/cmake/bin/ctest 100
28 changes: 28 additions & 0 deletions tools/setup_boost_with_modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/python3

# This is a temporary workaround to make CIs use the
# "Boost with C++20 modules" proposal, instead of the regular develop branch
# Call it instead of depinst

from subprocess import run
import os

def main():

submodules = [
('tools/cmake', 'https://github.com/anarthal/boost-cmake'),
('libs/core', 'https://github.com/anarthal/core'),
('libs/throw_exception','https://github.com/anarthal/throw_exception'),
('libs/config', 'https://github.com/anarthal/config'),
]

for submodule, url in submodules:
os.chdir(submodule)
run(['git', 'remote', 'add', 'modules', url])
run(['git', 'fetch', '--depth', '1', 'modules', 'feature/cxx20-modules'])
run(['git', 'checkout', 'modules/feature/cxx20-modules'])
os.chdir('../..')


if __name__ == '__main__':
main()