Skip to content
Merged
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
13 changes: 10 additions & 3 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def main(ctx):
},
],
extras=[
{ 'match': {'compiler': 'gcc =latest', 'os': 'linux'},
'name': 'GCC static linking',
'environment': {'B2_LINK': 'static'},
},
{ 'match': {'compiler': 'gcc =8', 'os': 'linux'},
'name': 'GCC 8 CMake superproject',
'type': 'cmake-superproject',
Expand Down Expand Up @@ -114,6 +118,9 @@ def main(ctx):
{ 'match': {'compiler': 'clang =latest', 'os': 'linux'},
'special': 'valgrind',
},
{ 'match': {'compiler': 'gcc =latest', 'os': 'linux'},
'special': 'valgrind',
},
],
) + [
linux_cxx("docs", "g++", buildtype="docs", buildscript="drone", image="cppalliance/boost_superproject_build:24.04-v3", environment={'COMMENT': 'docs'}, globalenv=globalenv),
Expand Down Expand Up @@ -383,24 +390,24 @@ def apply_special(job, special):

elif special == 'valgrind':
job['name'] = 'Valgrind ' + job['name']
job['type'] = 'valgrind'
set_or_append(
job['environment'], 'B2_TESTFLAGS', 'testing.launcher=valgrind',
)
job['environment']['VALGRIND_OPTS'] = '--error-exitcode=1'
job.setdefault('packages', []).append('valgrind')

if job['compiler'] == 'clang' and job['os'] == 'linux':
job.setdefault('packages', []).append('libc6-dbg')
job['packages'].append('libc6-dbg')

if special in ('asan', 'tsan', 'ubsan'):
job['environment']['B2_' + special.upper()] = '1'
job['environment']['B2_VARIANT'] = 'debug'

if job['compiler'] == 'clang' and job['os'] == 'linux':
job.setdefault('packages', []).append(
'libclang-rt-%s-dev' % job['version']
)
if special in ('asan', 'tsan', 'ubsan', 'valgrind'):
job['environment']['B2_VARIANT'] = 'debug'
job['environment']['COMMENT'] = special
set_or_append(
job['environment'], 'B2_DEFINES', 'BOOST_NO_STRESS_TEST=1',
Expand Down
11 changes: 0 additions & 11 deletions .drone/drone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,6 @@ echo '==================================> SCRIPT'
cd $BOOST_ROOT/libs/$SELF
ci/travis/codecov.sh

elif [ "$DRONE_JOB_BUILDTYPE" == "valgrind" ]; then

echo '==================================> INSTALL'

common_install

echo '==================================> SCRIPT'

cd $BOOST_ROOT/libs/$SELF
ci/travis/valgrind.sh

elif [ "$DRONE_JOB_BUILDTYPE" == "coverity" ]; then

echo '==================================> INSTALL'
Expand Down
9 changes: 6 additions & 3 deletions include/boost/json/impl/value.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -637,21 +637,24 @@ string&
value::
emplace_string() noexcept
{
return *::new(&str_) string(destroy());
storage_ptr sp = destroy();
return *::new(&str_) string(sp);
}

array&
value::
emplace_array() noexcept
{
return *::new(&arr_) array(destroy());
storage_ptr sp = destroy();
return *::new(&arr_) array(sp);
}

object&
value::
emplace_object() noexcept
{
return *::new(&obj_) object(destroy());
storage_ptr sp = destroy();
return *::new(&obj_) object(sp);
}

void
Expand Down
7 changes: 7 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ endif()
file(GLOB_RECURSE BOOST_JSON_TESTS_FILES CONFIGURE_DEPENDS Jamfile *.cpp *.hpp)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX cmake_install_test/.*$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX cmake-subdir/.*$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX header_only\.cpp$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX intrusive_macros\.cpp$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX limits\.cpp$)
list(FILTER BOOST_JSON_TESTS_FILES EXCLUDE REGEX no_exceptions\.cpp$)
Expand Down Expand Up @@ -54,6 +55,12 @@ target_compile_definitions(boost_json-limits PRIVATE
add_test(NAME boost_json-limits COMMAND boost_json-limits)
add_dependencies(tests boost_json-limits)

add_executable(boost_json-header_only ${EXCLUDE_TESTS_FROM_ALL} header_only.cpp Jamfile)
boost_json_setup_properties(boost_json-header_only)

add_test(NAME boost_json-header_only COMMAND boost_json-header_only)
add_dependencies(tests boost_json-header_only)

add_executable(boost_json-no_exceptions ${EXCLUDE_TESTS_FROM_ALL} no_exceptions.cpp main.cpp ../src/src.cpp Jamfile)
boost_json_setup_properties(boost_json-no_exceptions)

Expand Down
8 changes: 7 additions & 1 deletion test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ run limits.cpp main.cpp /boost/json//json_sources
<define>BOOST_JSON_STACK_BUFFER_SIZE=256
;

run header_only.cpp
: requirements
<include>../include
<dependency>/boost/json//boost_json
;

run no_exceptions.cpp main.cpp /boost/json//json_sources
: requirements
<exception-handling>off
Expand All @@ -103,5 +109,5 @@ boost-pretty-printers.test-gdb-printers gdb-printers
;
explicit gdb-printers ;

alias common : $(SOURCES:B) limits no_exceptions intrusive_macros ;
alias common : $(SOURCES:B) limits header_only no_exceptions intrusive_macros ;
alias heavy : $(HEAVY_SOURCES:B) ;
32 changes: 32 additions & 0 deletions test/header_only.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <boost/json/src.hpp>

void
with_array()
{
boost::json::value jv;
jv.emplace_array();
}

void
with_object()
{
boost::json::value jv;
jv.emplace_object();
}

void
with_string()
{
boost::json::value jv;
jv.emplace_string();
}

int main(int, char **)
{
// it's important these are separate functions, otherwise the warnings this
// file is supposed to produce do not manifest
with_array();
with_object();
with_string();
return 0;
}
Loading